Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ARA 0.16.6 breaks Ansible on Python 2 due to pyfakefs 4 #118

Closed
markgoddard opened this issue Mar 4, 2020 · 3 comments
Closed

ARA 0.16.6 breaks Ansible on Python 2 due to pyfakefs 4 #118

markgoddard opened this issue Mar 4, 2020 · 3 comments
Assignees
Labels
0.x Related to version 0.x bug

Comments

@markgoddard
Copy link

What component is this about ?

Callback plugin.

What is your ARA installation like ?

This is affecting Kolla Ansible CI on stable branches that use Python 2: https://bugs.launchpad.net/kolla-ansible/+bug/1866079.

Reproducing on a CentOS 7.7 box:

sudo yum -y install python-virtualenv gcc libffi-devel openssl-devel
virtualenv ansible-2.6
source ansible-2.6/bin/activate
pip install 'ansible<2.7' 'ara<1.0.0'
cat << EOF > ansible.cfg
[defaults]
callback_plugins = $(pwd)/ansible-2.6/lib/python2.7/site-packages/ara/plugins/callbacks
EOF

Now gather facts:
./ansible-2.6/bin/ansible localhost -m setup -e ansible_python_interpreter=$(which python) -vvvv

What is happening ?

Ansible fails:

ansible 2.6.20
  config file = /home/mark/ansible.cfg
  configured module search path = [u'/home/mark/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /home/mark/ansible-2.6/lib/python2.7/site-packages/ansible
  executable location = /home/mark/ansible-2.6/bin/ansible
  python version = 2.7.5 (default, Aug 7 2019, 00:51:29) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
Using /home/mark/ansible.cfg as config file
setting up inventory plugins
Parsed /etc/ansible/hosts inventory source with ini plugin
 [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'

Loading callback plugin minimal of type stdout, v2.0 from /home/mark/ansible-2.6/lib/python2.7/site-packages/ansible/plugins/callback/minimal.pyc
ERROR! Unexpected Exception, this is probably a bug: invalid syntax (fake_filesystem.py, line 1195)
the full traceback was:

Traceback (most recent call last):
  File "/home/mark/ansible-2.6/bin/ansible", line 118, in <module>
    exit_code = cli.run()
  File "/home/mark/ansible-2.6/lib/python2.7/site-packages/ansible/cli/adhoc.py", line 181, in run
    result = self._tqm.run(play)
  File "/home/mark/ansible-2.6/lib/python2.7/site-packages/ansible/executor/task_queue_manager.py", line 231, in run
    self.load_callbacks()
  File "/home/mark/ansible-2.6/lib/python2.7/site-packages/ansible/executor/task_queue_manager.py", line 193, in load_callbacks
    for callback_plugin in callback_loader.all(class_only=True):
  File "/home/mark/ansible-2.6/lib/python2.7/site-packages/ansible/plugins/loader.py", line 489, in all
    module = self._load_module_source(name, path)
  File "/home/mark/ansible-2.6/lib/python2.7/site-packages/ansible/plugins/loader.py", line 357, in _load_module_source
    module = imp.load_source(full_name, path, module_file)
  File "/home/mark/ansible-2.6/lib/python2.7/site-packages/ara/plugins/callbacks/log_ara.py", line 29, in <module>
    from ara.webapp import create_app
  File "/home/mark/ansible-2.6/lib/python2.7/site-packages/ara/webapp.py", line 39, in <module>
    from ara.utils import fast_count
  File "/home/mark/ansible-2.6/lib/python2.7/site-packages/ara/utils.py", line 24, in <module>
    import pyfakefs.fake_filesystem as fake_filesystem
  File "/home/mark/ansible-2.6/lib/python2.7/site-packages/pyfakefs/fake_filesystem.py", line 1195
    def utime(self, path, times=None, *, ns=None, follow_symlinks=True):
                                       ^
SyntaxError: invalid syntax

What should be happening ?

Ansible gathers facts.

Analysis

pyfakefs 4.0.0 and 4.0.1 were released yesterday, apparently without python2 support. Looks like we need to pin.

pip install 'pyfakefs<4'

Now it works.

@dmsimard dmsimard added 0.x Related to version 0.x bug labels Apr 13, 2020
@dmsimard
Copy link
Contributor

Thanks @markgoddard for the issue. I'm back and have time to look into this.

The patch you sent ( https://review.opendev.org/#/c/711240/ ) looks fine to me but I'll need to untangle the CI a bit. I'll get a dot release out for 0.x once I manage to land the patch.

@dmsimard dmsimard self-assigned this Apr 13, 2020
@markgoddard
Copy link
Author

Great, thanks David.

@dmsimard
Copy link
Contributor

Merged and released in 0.16.7. Thanks !

arecordsansible pushed a commit that referenced this issue Apr 14, 2020
pyfakefs 4.0.0 dropped support for Python 2. This change fixes the issue
by pinning pyfakefs to <4.

Fixes: #118
Change-Id: I3ee0d0b17d3ff3938c92f6ad87e6fa2e0865b5d3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.x Related to version 0.x bug
Projects
None yet
Development

No branches or pull requests

2 participants