Bug 1336909

Summary: [abrt] ansible-lint: utils.py:81:find_children:AttributeError: 'module' object has no attribute 'parse_yaml_from_file'
Product: [Fedora] Fedora Reporter: Till Maas <opensource>
Component: ansible-lintAssignee: Parag Nemade <pnemade>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 22CC: opensource, orion, pnemade
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
URL: https://retrace.fedoraproject.org/faf/reports/bthash/94e3c097d202fb71af7c0f087941cecd14e27be5
Whiteboard: abrt_hash:88a2019120fd7c03c1586ac386b0ce8933a14987;
Fixed In Version: ansible-lint-2.6.2-1.fc22 ansible-lint-2.6.2-1.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-06-07 01:20:48 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
File: backtrace none

Description Till Maas 2016-05-17 19:25:39 UTC
Description of problem:
I ran ansible-lint on a playbook.

Version-Release number of selected component:
ansible-lint-2.0.3-1.fc22

Additional info:
reporter:       libreport-2.6.4
cmdline:        /usr/bin/python2 /usr/bin/ansible-lint playbook.yml
environ:        
executable:     /usr/bin/ansible-lint
kernel:         4.4.6-201.fc22.x86_64
runlevel:       N 5
type:           Python
uid:            1000

Truncated backtrace:
utils.py:81:find_children:AttributeError: 'module' object has no attribute 'parse_yaml_from_file'

Traceback (most recent call last):
  File "/usr/bin/ansible-lint", line 104, in <module>
    sys.exit(main(sys.argv[1:]))
  File "/usr/bin/ansible-lint", line 91, in main
    matches = runner.run()
  File "/usr/lib/python2.7/site-packages/ansiblelint/__init__.py", line 171, in run
    for file in utils.find_children(arg):
  File "/usr/lib/python2.7/site-packages/ansiblelint/utils.py", line 81, in find_children
    pb_data = ansible.utils.parse_yaml_from_file(playbook[0])
AttributeError: 'module' object has no attribute 'parse_yaml_from_file'

Local variables in innermost frame:
basedir: ''
results: []
playbook: ('playbook.yml', 'playbook')

Comment 1 Till Maas 2016-05-17 19:25:43 UTC
Created attachment 1158461 [details]
File: backtrace

Comment 2 Parag Nemade 2016-05-18 04:41:15 UTC
I ran ansible-lint on couple of playbook files and they worked fine. I think to  reproduce this bug, I will need that exact playbook file. 

Or we have latest ansible-lint-2.6.2 built for F23+ releases. I have done a scratch build for f22. You can check your playbook against this new ansible-lint release -> http://koji.fedoraproject.org/koji/taskinfo?taskID=14142583

Comment 3 Till Maas 2016-05-20 22:12:28 UTC
Thank you for the fast reply.

The bug also happens with playbooks from Fedora infra, for example:
ansible-lint playbooks/rdiff-backup.yml
Traceback (most recent call last):
  File "/usr/bin/ansible-lint", line 104, in <module>
    sys.exit(main(sys.argv[1:]))
  File "/usr/bin/ansible-lint", line 91, in main
    matches = runner.run()
  File "/usr/lib/python2.7/site-packages/ansiblelint/__init__.py", line 171, in run
    for file in utils.find_children(arg):
  File "/usr/lib/python2.7/site-packages/ansiblelint/utils.py", line 81, in find_children
    pb_data = ansible.utils.parse_yaml_from_file(playbook[0])
AttributeError: 'module' object has no attribute 'parse_yaml_from_file'

And there is no parse_yaml_from_file in ansible.utils from ansible-2.0.2.0-1.fc22

It works with ansible-lint-2.6.2-1.fc22.noarch from the scratch build.

Comment 4 Orion Poplawski 2016-05-20 22:42:27 UTC
I'm seeing with on EPEL7 which has a woefully out of date ansible-lint as well:

ansible-lint-2.0.1-1.el7.noarch

Comment 5 Orion Poplawski 2016-05-20 23:01:39 UTC
Fails to build on el7 with:

Executing(%check): /bin/sh -e /tmp/rpm/rpm-tmp.vHovss
+ umask 022
+ cd /export/home/orion/fedora/ansible-lint
+ cd ansible-lint-2.6.2
+ /usr/bin/python2 setup.py test
/usr/lib64/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'include_package_date'
  warnings.warn(msg)
running test
running egg_info
writing requirements to lib/ansible_lint.egg-info/requires.txt
writing lib/ansible_lint.egg-info/PKG-INFO
writing top-level names to lib/ansible_lint.egg-info/top_level.txt
writing dependency_links to lib/ansible_lint.egg-info/dependency_links.txt
reading manifest file 'lib/ansible_lint.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'lib/ansible_lint.egg-info/SOURCES.txt'
running build_ext
Traceback (most recent call last):
  File "setup.py", line 26, in <module>
    test_suite="test"
  File "/usr/lib64/python2.7/distutils/core.py", line 152, in setup
    dist.run_commands()
  File "/usr/lib64/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/usr/lib64/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/usr/lib/python2.7/site-packages/setuptools/command/test.py", line 138, in run
    self.with_project_on_sys_path(self.run_tests)
  File "/usr/lib/python2.7/site-packages/setuptools/command/test.py", line 118, in with_project_on_sys_path
    func()
  File "/usr/lib/python2.7/site-packages/setuptools/command/test.py", line 164, in run_tests
    testLoader = cks
  File "/usr/lib64/python2.7/unittest/main.py", line 94, in __init__
    self.parseArgs(argv)
  File "/usr/lib64/python2.7/unittest/main.py", line 149, in parseArgs
    self.createTests()
  File "/usr/lib64/python2.7/unittest/main.py", line 158, in createTests
    self.module)
  File "/usr/lib64/python2.7/unittest/loader.py", line 128, in loadTestsFromNames
    suites = [self.loadTestsFromName(name, module) for name in names]
  File "/usr/lib64/python2.7/unittest/loader.py", line 103, in loadTestsFromName
    return self.loadTestsFromModule(obj)
  File "/usr/lib/python2.7/site-packages/setuptools/command/test.py", line 35, in loadTestsFromModule
    tests.append(self.loadTestsFromName(submodule))
  File "/usr/lib64/python2.7/unittest/loader.py", line 100, in loadTestsFromName
    parent, obj = obj, getattr(obj, part)
AttributeError: 'module' object has no attribute 'test_support'


But I think this is because there aren't actually any tests to run.

Comment 6 Parag Nemade 2016-05-21 04:20:54 UTC
Thanks Till and Orion. I will backport the 2.6.2 release to F22 and epel7.

Comment 7 Fedora Update System 2016-05-21 05:21:42 UTC
ansible-lint-2.6.2-1.fc22 has been submitted as an update to Fedora 22. https://bodhi.fedoraproject.org/updates/FEDORA-2016-6919765188

Comment 8 Fedora Update System 2016-05-21 09:53:21 UTC
ansible-lint-2.6.2-1.el7 has been submitted as an update to Fedora EPEL 7. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2016-3e196c6cc5

Comment 9 Fedora Update System 2016-05-22 03:50:58 UTC
ansible-lint-2.6.2-1.fc22 has been pushed to the Fedora 22 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-6919765188

Comment 10 Fedora Update System 2016-05-23 15:19:41 UTC
ansible-lint-2.6.2-1.el7 has been pushed to the Fedora EPEL 7 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2016-3e196c6cc5

Comment 11 Fedora Update System 2016-06-07 01:20:46 UTC
ansible-lint-2.6.2-1.fc22 has been pushed to the Fedora 22 stable repository. If problems still persist, please make note of it in this bug report.

Comment 12 Fedora Update System 2016-06-21 21:49:57 UTC
ansible-lint-2.6.2-1.el7 has been pushed to the Fedora EPEL 7 stable repository. If problems still persist, please make note of it in this bug report.