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

Collection fails with python 3.8 #139

Closed
UnwashedMeme opened this issue May 29, 2020 · 9 comments · Fixed by #246
Closed

Collection fails with python 3.8 #139

UnwashedMeme opened this issue May 29, 2020 · 9 comments · Fixed by #246
Labels
has_pr PR fixes have been made medium_priority Medium priority

Comments

@UnwashedMeme
Copy link
Contributor

SUMMARY

On Python 3.8 (the default on Ubuntu 20.04) this collection fails because is transitively using deprecated python functions.

This was fixed 6 months ago in Azure/azure-cli#11239 in azure-cli-core = ">=2.0.77" but this collection wants azure-cli-core = "==2.0.35"

Looking through the requirements.txt listed here, it looks like we're kinda far behind.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

Any

ANSIBLE VERSION
ansible 2.9.9
python version = 3.8.2 (default, Apr 27 2020, 15:53:34) [GCC 9.3.0]
CONFIGURATION
DEFAULT_LOAD_CALLBACK_PLUGINS(~/.ansible.cfg) = True
DEFAULT_STDOUT_CALLBACK(~/.ansible.cfg) = yaml
INTERPRETER_PYTHON(~/.ansible.cfg) = auto
OS / ENVIRONMENT
Distributor ID:	Ubuntu
Description:	Ubuntu 20.04 LTS
Release:	20.04
Codename:	focal
STEPS TO REPRODUCE
$ virtualenv -p /usr/bin/python3.8 /tmp/foobar
$ cd /tmp/foobar
$ . bin/activate
# this is the current head of the dev branch
$ pip install -r https://raw.githubusercontent.com/ansible-collections/azure/234d9fc70097eb4481fe98c05580c9850c431798/requirements-azure.txt
$ ansible-galaxy collection install azure.azcollection --force
Installing 'azure.azcollection:0.1.3'
$ ansible -vvv  \
  -c local -e ansible_python_interpreter=/tmp/foobar/bin/python3 \
  -i localhost, all \
  -m azure.azcollection.azure_rm_resourcegroup -a "name=foobar location=eastus2" 
$ ansible -c local -i localhost, all -m azure.azcollection.azure_rm_resourcegroup -a "name=foobar location=eastus2" -vvv

...

<localhost> EXEC /bin/sh -c '/tmp/foobar/bin/python3 /home/njbird/.ansible/tmp/ansible-tmp-1590766242.1559303-3640414-175026806580758/AnsiballZ_azure_rm_resourcegroup.py && sleep 0'
<localhost> EXEC /bin/sh -c 'rm -f -r /home/njbird/.ansible/tmp/ansible-tmp-1590766242.1559303-3640414-175026806580758/ > /dev/null 2>&1 && sleep 0'          
The full traceback is:                                                                                                                                                                 
Traceback (most recent call last):
  File "/home/njbird/.ansible/tmp/ansible-tmp-1590766242.1559303-3640414-175026806580758/AnsiballZ_azure_rm_resourcegroup.py", line 102, in <module>
    _ansiballz_main()
  File "/home/njbird/.ansible/tmp/ansible-tmp-1590766242.1559303-3640414-175026806580758/AnsiballZ_azure_rm_resourcegroup.py", line 94, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "/home/njbird/.ansible/tmp/ansible-tmp-1590766242.1559303-3640414-175026806580758/AnsiballZ_azure_rm_resourcegroup.py", line 40, in invoke_module

...

  File "/tmp/ansible_azure.azcollection.azure_rm_resourcegroup_payload_wu2wgs7f/ansible_azure.azcollection.azure_rm_resourcegroup_payload.zip/ansible_collections/azure/azcollection/plugins/module_utils/azure_rm_common.py", line 1359, in _get_azure_cli_credentials
  File "/tmp/foobar/lib/python3.8/site-packages/azure/common/credentials.py", line 46, in get_azure_cli_credentials
    profile = get_cli_profile()
  File "/tmp/foobar/lib/python3.8/site-packages/azure/common/credentials.py", line 29, in get_cli_profile
    return Profile(storage=ACCOUNT)
  File "/tmp/foobar/lib/python3.8/site-packages/azure/cli/core/_profile.py", line 125, in __init__
    self.cli_ctx = cli_ctx or get_default_cli()
  File "/tmp/foobar/lib/python3.8/site-packages/azure/cli/core/__init__.py", line 485, in get_default_cli
    return AzCli(cli_name='az',
  File "/tmp/foobar/lib/python3.8/site-packages/azure/cli/core/__init__.py", line 52, in __init__
    SESSION.load(os.path.join(azure_folder, 'az.sess'), max_age=3600)
  File "/tmp/foobar/lib/python3.8/site-packages/azure/cli/core/_session.py", line 37, in load
    if st.st_mtime + max_age < time.clock():
AttributeError: module 'time' has no attribute 'clock'
@Fred-sun
Copy link
Collaborator

Fred-sun commented Jun 1, 2020

@UnwashedMeme This is because the time module in python3.8 does not have a clock attribute. I will report this problem to the development team due to incompatible versions. You can use python3.6 for the time being. Thank you!

@pkoziol
Copy link

pkoziol commented Jun 3, 2020

Using python 3.6 is problematic for Mac users using homebrew (or simply impossible? I haven't figured out it yet). homebrew has packages for ansible 2.9.9 and ansible 2.8.12. Both of them have explicit dependency on python@3.8 😞

@Fred-sun
Copy link
Collaborator

Fred-sun commented Jun 3, 2020

Yes, I am sorry to cause you trouble, I will advance the problem resolution as soon as possible, thank you!

@fghamsary
Copy link

Same problem :'(

@jschwanz
Copy link

jschwanz commented Sep 1, 2020

+1 We've hit this with the Azure DevOps Ubuntu 20.04 agent

ansible 2.9.6
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/vsts/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.8.2 (default, Jul 16 2020, 14:00:26) [GCC 9.3.0]

@uda
Copy link

uda commented Sep 3, 2020

How is this still a medium_priority issue? Python 3.6 is already in security-fixes phase, 3.7 breaks on this as well.

@Fred-sun, this has already been solved, the solution is upgrading azure API dependencies, not rewrite all ansible modules.

@Fred-sun
Copy link
Collaborator

Fred-sun commented Sep 3, 2020

@uda Because it is not caused by ansible-collection, but other reasons, so mark it as medium_priority. Which dependency package needs to be upgraded? Can you list them? Thank you!。

@uda
Copy link

uda commented Sep 3, 2020

@Fred-sun from the original issuer's words:

This was fixed 6 months ago in Azure/azure-cli#11239 in azure-cli-core = ">=2.0.77" but this collection wants azure-cli-core = "==2.0.35"

And I mentioned it in ansible's issue: ansible/ansible#67473 (comment)
And you commented on that issue in June, requesting to close it due to this issue having been reported ansible/ansible#67473 (comment)

@Fred-sun
Copy link
Collaborator

Fred-sun commented Sep 3, 2020

@uda Yes, I ignored this, I will update the ansible_collection dependency package as soon as possible to close this issue! Thank you!

@Fred-sun Fred-sun added the has_pr PR fixes have been made label Sep 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has_pr PR fixes have been made medium_priority Medium priority
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants