Comment 1 for bug 1530962

Revision history for this message
Andres Toomsalu (andres-active) wrote : Re: mariadb "Creating haproxy mysql user" task failing with "no no attribute 'add_metaclass'" error

Seems that v2.0.0-0.2.alpha2 ansible install in kolla_ansible image is just broken (with centos binary container image at least):

[root@kolla kolla]# docker exec -it kolla_ansible bash
[root@kolla /]# ansible --version
Traceback (most recent call last):
  File "/usr/bin/ansible", line 40, in <module>
    from ansible.utils.display import Display
  File "/usr/lib/python2.7/site-packages/ansible/utils/display.py", line 35, in <module>
    from ansible import constants as C
  File "/usr/lib/python2.7/site-packages/ansible/constants.py", line 30, in <module>
    from ansible.parsing.splitter import unquote
  File "/usr/lib/python2.7/site-packages/ansible/parsing/__init__.py", line 32, in <module>
    from ansible.parsing.vault import VaultLib
  File "/usr/lib/python2.7/site-packages/ansible/parsing/vault/__init__.py", line 82, 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 9, in <module>
    from cryptography.hazmat.backends.multibackend import MultiBackend
  File "/usr/lib64/python2.7/site-packages/cryptography/hazmat/backends/multibackend.py", line 9, in <module>
    from cryptography.hazmat.backends.interfaces import (
  File "/usr/lib64/python2.7/site-packages/cryptography/hazmat/backends/interfaces.py", line 12, in <module>
    @six.add_metaclass(abc.ABCMeta)
AttributeError: 'module' object has no attribute 'add_metaclass'

Simple workaround which seems to fix the issue is:
[root@kolla /]# pip install --upgrade ansible
Requirement already up-to-date: ansible in /usr/lib/python2.7/site-packages
Requirement already up-to-date: paramiko in /usr/lib/python2.7/site-packages (from ansible)
Requirement already up-to-date: jinja2 in /usr/lib64/python2.7/site-packages (from ansible)
Collecting PyYAML (from ansible)
  Downloading PyYAML-3.11.tar.gz (248kB)
    100% |################################| 249kB 721kB/s
Collecting setuptools (from ansible)
  Downloading setuptools-19.2-py2.py3-none-any.whl (463kB)
    100% |################################| 466kB 427kB/s
Requirement already up-to-date: pycrypto>=2.6 in /usr/lib64/python2.7/site-packages (from ansible)
Collecting six (from ansible)
  Downloading six-1.10.0-py2.py3-none-any.whl
Requirement already up-to-date: ecdsa>=0.11 in /usr/lib/python2.7/site-packages (from paramiko->ansible)
Requirement already up-to-date: MarkupSafe in /usr/lib64/python2.7/site-packages (from jinja2->ansible)
Building wheels for collected packages: PyYAML
  Running setup.py bdist_wheel for PyYAML
  Stored in directory: /root/.cache/pip/wheels/fa/db/f6/dee55793d344f1706dc4a5a693298f0115241d1085cc212364
Successfully built PyYAML
Installing collected packages: PyYAML, setuptools, six
  Found existing installation: PyYAML 3.10
    DEPRECATION: Uninstalling a distutils installed project (PyYAML) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
    Uninstalling PyYAML-3.10:
      Successfully uninstalled PyYAML-3.10
  Found existing installation: setuptools 0.9.8
    Uninstalling setuptools-0.9.8:
      Successfully uninstalled setuptools-0.9.8
  Found existing installation: six 1.9.0
    Uninstalling six-1.9.0:
      Successfully uninstalled six-1.9.0
Successfully installed PyYAML-3.11 setuptools-19.2 six-1.10.0

IF replacing git pulled ansible with distro provided package (ie yum install ansible) instead - ansible will work - yet mysql module commands will return 'success' instead of 'SUCCESS' - and result parsing in ansible playbooks will fail:
--- EXAMPLE ---
localhost | success >> {
    "changed": false,
    "user": "haproxy"
}
--- EXAMPLE ---