When running ansinle-playbook, an exception always happens. Surprizingly, if I try to evaluate the statement that causes the exception in an interpreter, no error happens: $ python Python 2.7.11 (default, Apr 15 2016, 13:09:43) [GCC 5.3.1 20151207 (ALT Linux 5.3.1-alt3)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> sub = "playbook" >>> myclass = "%sCLI" % sub.capitalize() >>> myclass 'PlaybookCLI' >>> getattr(__import__("ansible.cli.%s" % sub, fromlist=[myclass]), myclass) <class 'ansible.cli.playbook.PlaybookCLI'> >>> $ rpm -qf "$(which ansible-playbook)" ansible-2.0.2.0-alt2 $ ansible-playbook ERROR! Unexpected Exception: 'module' object has no attribute '_vendor' the full traceback was: Traceback (most recent call last): File "/usr/bin/ansible-playbook", line 73, in <module> mycli = getattr(__import__("ansible.cli.%s" % sub, fromlist=[myclass]), myclass) File "/usr/lib/python2.7/site-packages/ansible/cli/playbook.py", line 30, in <module> from ansible.executor.playbook_executor import PlaybookExecutor File "/usr/lib/python2.7/site-packages/ansible/executor/playbook_executor.py", line 27, in <module> from ansible.executor.task_queue_manager import TaskQueueManager File "/usr/lib/python2.7/site-packages/ansible/executor/task_queue_manager.py", line 28, in <module> from ansible.executor.play_iterator import PlayIterator File "/usr/lib/python2.7/site-packages/ansible/executor/play_iterator.py", line 29, in <module> from ansible.playbook.block import Block File "/usr/lib/python2.7/site-packages/ansible/playbook/__init__.py", line 25, in <module> from ansible.playbook.play import Play File "/usr/lib/python2.7/site-packages/ansible/playbook/play.py", line 27, in <module> from ansible.playbook.base import Base File "/usr/lib/python2.7/site-packages/ansible/playbook/base.py", line 35, in <module> from ansible.parsing.dataloader import DataLoader File "/usr/lib/python2.7/site-packages/ansible/parsing/dataloader.py", line 32, in <module> from ansible.parsing.vault import VaultLib File "/usr/lib/python2.7/site-packages/ansible/parsing/vault/__init__.py", line 67, in <module> from cryptography.hazmat.primitives.hashes import SHA256 as c_SHA256 File "/usr/lib64/python2.7/site-packages/cryptography/hazmat/primitives/hashes.py", line 15, in <module> from cryptography.hazmat.backends.interfaces import HashBackend File "/usr/lib64/python2.7/site-packages/cryptography/hazmat/backends/__init__.py", line 7, in <module> import pkg_resources File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 90, in <module> packaging = pkg_resources._vendor.packaging AttributeError: 'module' object has no attribute '_vendor' $
Насколько я помню свои исследования, cli в 2.0* вполне официально нерабочий и обещался позже.
(В ответ на комментарий №1) > Насколько я помню свои исследования, cli в 2.0* вполне официально нерабочий и > обещался позже. Понятно, спасибо. Нам дали потестировать облачное приложение, которое хочет cli в скрипте установки. Там скромно написано, что лучше запускать этот скрипт с ansible-2.2. :)
This error happens iff python-module-pycrypto is not installed. The internal reasons for this have not been studied by me yet (perhaps, pycrypto is really needed, perhaps, pycrypto's absense leads to some alternative behavior which causes this error). More investigation in future. (If Python autoreqs are resurrected as in the build which I'm preparing in http://git.altlinux.org/tasks/171993/build/500/x86_64/ , pycrypto is detected, but as a dep of a module. But as we see, it must be also a dep of the main ansible code.)
More precise conditions for this error (in Sisyphus): * ansible-playbook tries to use python-module-pycrypto * if python-module-pycrypto is installed, it goes on successfully (without trying python-module-cryptography) * if python-module-pycrypto is not installed, this fails, and ansible-playbook tries to use python-module-cryptography * if python-module-cryptography is not installed, it goes on successfully * if python-module-cryptography is installed, the above error occurs when using it
In p8, the same conditions for this error hold. (The difference between the p8 and Sisyphus environments is that in p8 python-module-paramiko depends on python-module-pycrypto, which makes ansible-playbook happy because it depends on python-module-paramiko. And if one removes python-module-pycrypto, the same situation as in Sisyphus would be visible. In Sisyphus, python-module-paramiko depends on python-module-cryptography, so when it is used in ansible-playbook, this error happens.)