Traceback in azure_rm.py on Centos 7.3 with Azure python SDK rc6

53 views
Skip to first unread message

Jose Moreno

unread,
Dec 13, 2016, 5:53:24 PM12/13/16
to Ansible Project
Hi there,

I am trying to install Ansible on a clean, yum-updated CentOS 7.3 machine with the Azure modules, but azure_rm.py refuses to work. I installed the Azure SDK version rc6, and I could not spot any error. I am using file based authentication (~/.azure/credentials), with a file that works in another host. However, azure_rm.py will break:

[jose@vm-00 ~]$ python ./ansible/contrib/inventory/azure_rm.py --list
Traceback (most recent call last):
  File "./ansible/contrib/inventory/azure_rm.py", line 205, in <module>
    from azure.common.credentials import ServicePrincipalCredentials, UserPassCredentials
  File "/usr/lib/python2.7/site-packages/azure/common/credentials.py", line 28, in <module>
    from msrestazure.azure_active_directory import (
  File "/usr/lib/python2.7/site-packages/msrestazure/azure_active_directory.py", line 35, in <module>
    import keyring
  File "/usr/lib/python2.7/site-packages/keyring/__init__.py", line 6, in <module>
    from .core import (set_keyring, get_keyring, set_password, get_password,
  File "/usr/lib/python2.7/site-packages/keyring/core.py", line 149, in <module>
    init_backend()
  File "/usr/lib/python2.7/site-packages/keyring/core.py", line 65, in init_backend
    keyrings = filter(limit, backend.get_all_keyring())
  File "/usr/lib/python2.7/site-packages/keyring/util/__init__.py", line 20, in wrapper
    func.always_returns = func(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/keyring/backend.py", line 179, in get_all_keyring
    _load_backends()
  File "/usr/lib/python2.7/site-packages/keyring/backend.py", line 139, in _load_backends
    list(map(_load_backend, backends))
  File "/usr/lib/python2.7/site-packages/keyring/backend.py", line 131, in _load_backend
    mod = importlib.import_module('.'+name, package)
  File "/usr/lib64/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/usr/lib/python2.7/site-packages/keyring/backends/SecretService.py", line 9, in <module>
    import secretstorage
  File "/usr/lib/python2.7/site-packages/secretstorage/__init__.py", line 14, in <module>
    from secretstorage.collection import Collection, create_collection, \
  File "/usr/lib/python2.7/site-packages/secretstorage/collection.py", line 21, in <module>
    from secretstorage.item import Item
  File "/usr/lib/python2.7/site-packages/secretstorage/item.py", line 15, in <module>
    from secretstorage.util import InterfaceWrapper, bus_get_object, \
  File "/usr/lib/python2.7/site-packages/secretstorage/util.py", line 14, in <module>
    from secretstorage.dhcrypto import Session, int_to_bytes
  File "/usr/lib/python2.7/site-packages/secretstorage/dhcrypto.py", line 36, in <module>
    DH_PRIME_1024 = int_from_bytes(bytearray(DH_PRIME_1024_BYTES), 'big')
  File "/usr/lib64/python2.7/site-packages/cryptography/utils.py", line 50, in int_from_bytes
    return int(data.encode('hex'), 16)
AttributeError: 'bytearray' object has no attribute 'encode' 

Any idea what is missing?

Thanks!

Trond Hindenes

unread,
Dec 14, 2016, 2:09:44 PM12/14/16
to Ansible Project
The doc is pretty clear about the supported Azure version beeting 2.0.0rc5. The python modules for Azure har unfortunately known for breaking changes betweens minor versions, so there's no way the Ansible modules will keep up with all the changes. Solution: Uninstall your current packages, and install 2.0.0rc5. rc5 has some include issues so you probably have to manually add some extra packages, but errors about that should be surfaced by Ansible. You can also manually verify by starting up python and try to import a module such as:
import msrestazure.azure_exceptions
Reply all
Reply to author
Forward
0 new messages