<?xml version="1.0" encoding="UTF-8" ?>

<bugzilla version="5.2"
          urlbase="https://bugzilla.altlinux.org/"
          
          maintainer="jenya@basealt.ru"
>

    <bug>
          <bug_id>32711</bug_id>
          
          <creation_ts>2016-11-03 21:37:36 +0300</creation_ts>
          <short_desc>ansible-playbook: Unexpected Exception: &apos;module&apos; object has no attribute &apos;_vendor&apos;</short_desc>
          <delta_ts>2017-07-26 21:46:10 +0300</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>4</classification_id>
          <classification>Development</classification>
          <product>Sisyphus</product>
          <component>ansible</component>
          <version>unstable</version>
          <rep_platform>all</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>NOTABUG</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P3</priority>
          <bug_severity>major</bug_severity>
          <target_milestone>---</target_milestone>
          <dependson>32709</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Ivan Zakharyaschev">imz</reporter>
          <assigned_to name="Andrey Cherepanov">cas</assigned_to>
          <cc>aen</cc>
    
    <cc>cas</cc>
    
    <cc>obirvalger</cc>
          
          <qa_contact>qa-sisyphus</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>159723</commentid>
    <comment_count>0</comment_count>
    <who name="Ivan Zakharyaschev">imz</who>
    <bug_when>2016-11-03 21:37:36 +0300</bug_when>
    <thetext>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 &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.
&gt;&gt;&gt; sub = &quot;playbook&quot;
&gt;&gt;&gt; myclass = &quot;%sCLI&quot; % sub.capitalize()
&gt;&gt;&gt; myclass
&apos;PlaybookCLI&apos;
&gt;&gt;&gt; getattr(__import__(&quot;ansible.cli.%s&quot; % sub, fromlist=[myclass]), myclass)
&lt;class &apos;ansible.cli.playbook.PlaybookCLI&apos;&gt;
&gt;&gt;&gt; 



$ rpm -qf &quot;$(which ansible-playbook)&quot;
ansible-2.0.2.0-alt2
$ ansible-playbook
ERROR! Unexpected Exception: &apos;module&apos; object has no attribute &apos;_vendor&apos;
the full traceback was:

Traceback (most recent call last):
  File &quot;/usr/bin/ansible-playbook&quot;, line 73, in &lt;module&gt;
    mycli = getattr(__import__(&quot;ansible.cli.%s&quot; % sub, fromlist=[myclass]), myclass)
  File &quot;/usr/lib/python2.7/site-packages/ansible/cli/playbook.py&quot;, line 30, in &lt;module&gt;
    from ansible.executor.playbook_executor import PlaybookExecutor
  File &quot;/usr/lib/python2.7/site-packages/ansible/executor/playbook_executor.py&quot;, line 27, in &lt;module&gt;
    from ansible.executor.task_queue_manager import TaskQueueManager
  File &quot;/usr/lib/python2.7/site-packages/ansible/executor/task_queue_manager.py&quot;, line 28, in &lt;module&gt;
    from ansible.executor.play_iterator import PlayIterator
  File &quot;/usr/lib/python2.7/site-packages/ansible/executor/play_iterator.py&quot;, line 29, in &lt;module&gt;
    from ansible.playbook.block import Block
  File &quot;/usr/lib/python2.7/site-packages/ansible/playbook/__init__.py&quot;, line 25, in &lt;module&gt;
    from ansible.playbook.play import Play
  File &quot;/usr/lib/python2.7/site-packages/ansible/playbook/play.py&quot;, line 27, in &lt;module&gt;
    from ansible.playbook.base import Base
  File &quot;/usr/lib/python2.7/site-packages/ansible/playbook/base.py&quot;, line 35, in &lt;module&gt;
    from ansible.parsing.dataloader import DataLoader
  File &quot;/usr/lib/python2.7/site-packages/ansible/parsing/dataloader.py&quot;, line 32, in &lt;module&gt;
    from ansible.parsing.vault import VaultLib
  File &quot;/usr/lib/python2.7/site-packages/ansible/parsing/vault/__init__.py&quot;, line 67, in &lt;module&gt;
    from cryptography.hazmat.primitives.hashes import SHA256 as c_SHA256
  File &quot;/usr/lib64/python2.7/site-packages/cryptography/hazmat/primitives/hashes.py&quot;, line 15, in &lt;module&gt;
    from cryptography.hazmat.backends.interfaces import HashBackend
  File &quot;/usr/lib64/python2.7/site-packages/cryptography/hazmat/backends/__init__.py&quot;, line 7, in &lt;module&gt;
    import pkg_resources
  File &quot;/usr/lib/python2.7/site-packages/pkg_resources/__init__.py&quot;, line 90, in &lt;module&gt;
    packaging = pkg_resources._vendor.packaging
AttributeError: &apos;module&apos; object has no attribute &apos;_vendor&apos;
$</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>159725</commentid>
    <comment_count>1</comment_count>
    <who name="Evgenii Terechkov">evg</who>
    <bug_when>2016-11-03 22:05:32 +0300</bug_when>
    <thetext>Насколько я помню свои исследования, cli в 2.0* вполне официально нерабочий и обещался позже.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>159728</commentid>
    <comment_count>2</comment_count>
    <who name="AEN">aen</who>
    <bug_when>2016-11-03 23:40:17 +0300</bug_when>
    <thetext>(В ответ на комментарий №1)
&gt; Насколько я помню свои исследования, cli в 2.0* вполне официально нерабочий и
&gt; обещался позже.

Понятно, спасибо.
Нам дали потестировать облачное приложение, которое хочет cli в скрипте установки. Там скромно написано, что лучше запускать этот скрипт с ansible-2.2. :)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>159790</commentid>
    <comment_count>3</comment_count>
    <who name="Ivan Zakharyaschev">imz</who>
    <bug_when>2016-11-09 15:24:22 +0300</bug_when>
    <thetext>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&apos;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&apos;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.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>159802</commentid>
    <comment_count>4</comment_count>
    <who name="Ivan Zakharyaschev">imz</who>
    <bug_when>2016-11-09 21:38:08 +0300</bug_when>
    <thetext>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</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>159804</commentid>
    <comment_count>5</comment_count>
    <who name="Ivan Zakharyaschev">imz</who>
    <bug_when>2016-11-09 22:19:16 +0300</bug_when>
    <thetext>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.)</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>