Algo: Deploy error: The error was: AttributeError: module 'time' has no attribute 'clock'

Created on 24 Sep 2020  路  1Comment  路  Source: trailofbits/algo

While deploying to Azure, got this error:

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AttributeError: module 'time' has no attribute 'clock'

fatal: [localhost]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):n File "/home/ll/.ansible/tmp/ansible-tmp-1600930951.3805804-16482-30144226544439/AnsiballZ_azure_rm_deployment.py", line 102, in n _ansiballz_main()n File "/home/ll/.ansible/tmp/ansible-tmp-1600930951.3805804-16482-30144226544439/AnsiballZ_azure_rm_deployment.py", line 94, in _ansiballz_mainn invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)n File "/home/ll/.ansible/tmp/ansible-tmp-1600930951.3805804-16482-30144226544439/AnsiballZ_azure_rm_deployment.py", line 40, in invoke_modulen runpy.run_module(mod_name='ansible.modules.cloud.azure.azure_rm_deployment', init_globals=None, run_name='__main__', alter_sys=True)n File "/usr/lib/python3.8/runpy.py", line 206, in run_modulen return _run_module_code(code, init_globals, run_name, mod_spec)n File "/usr/lib/python3.8/runpy.py", line 96, in _run_module_coden _run_code(code, mod_globals, init_globals,n File "/usr/lib/python3.8/runpy.py", line 86, in _run_coden exec(code, run_globals)n File "/tmp/ansible_azure_rm_deployment_payload_jjehvh8g/ansible_azure_rm_deployment_payload.zip/ansible/modules/cloud/azure/azure_rm_deployment.py", line 702, in n File "/tmp/ansible_azure_rm_deployment_payload_jjehvh8g/ansible_azure_rm_deployment_payload.zip/ansible/modules/cloud/azure/azure_rm_deployment.py", line 698, in mainn File "/tmp/ansible_azure_rm_deployment_payload_jjehvh8g/ansible_azure_rm_deployment_payload.zip/ansible/modules/cloud/azure/azure_rm_deployment.py", line 469, in __init__n File "/tmp/ansible_azure_rm_deployment_payload_jjehvh8g/ansible_azure_rm_deployment_payload.zip/ansible/module_utils/azure_rm_common.py", line 341, in __init__n File "/tmp/ansible_azure_rm_deployment_payload_jjehvh8g/ansible_azure_rm_deployment_payload.zip/ansible/module_utils/azure_rm_common.py", line 1145, in __init__n File "/tmp/ansible_azure_rm_deployment_payload_jjehvh8g/ansible_azure_rm_deployment_payload.zip/ansible/module_utils/azure_rm_common.py", line 1378, in _get_credentialsn File "/tmp/ansible_azure_rm_deployment_payload_jjehvh8g/ansible_azure_rm_deployment_payload.zip/ansible/module_utils/azure_rm_common.py", line 1289, in _get_azure_cli_credentialsn File "/home/ll/algo/.env/lib/python3.8/site-packages/azure/common/credentials.py", line 46, in get_azure_cli_credentialsn profile = get_cli_profile()n File "/home/ll/algo/.env/lib/python3.8/site-packages/azure/common/credentials.py", line 29, in get_cli_profilen return Profile(storage=ACCOUNT)n File "/home/ll/algo/.env/lib/python3.8/site-packages/azure/cli/core/_profile.py", line 125, in __init__n self.cli_ctx = cli_ctx or get_default_cli()n File "/home/ll/algo/.env/lib/python3.8/site-packages/azure/cli/core/__init__.py", line 485, in get_default_clin return AzCli(cli_name='az',n File "/home/ll/algo/.env/lib/python3.8/site-packages/azure/cli/core/__init__.py", line 52, in __init__n SESSION.load(os.path.join(azure_folder, 'az.sess'), max_age=3600)n File "/home/ll/algo/.env/lib/python3.8/site-packages/azure/cli/core/_session.py", line 37, in loadn if st.st_mtime + max_age < time.clock():nAttributeError: module 'time' has no attribute 'clock'n", "module_stdout": "", "msg": "MODULE FAILUREnSee stdout/stderr for the exact error", "rc": 1}

The deployment env is Win10 running Ubuntu WSL2.

It looks like the python 3.8 may be using a depricated library for key generation. This here may describe the issue:
https://stackoverflow.com/questions/58569361/attributeerror-module-time-has-no-attribute-clock-in-python-3-8

I tried to install PyCryptoDome and remove Cryptography, but Cryptography gets re-installed at runtime of ./algo.

Thanks guys!

Most helpful comment

I think the problem is in this file:

algo/roles/cloud-azure/tasks/venv.yml

The version of azure-cli-core is too old. So this line has to change:
- azure-cli-core==2.0.35

I've changed it to this, and the deploy worked:
- azure-cli-core==2.12.0

Hope this helps... I could do a pull request I guess?

>All comments

I think the problem is in this file:

algo/roles/cloud-azure/tasks/venv.yml

The version of azure-cli-core is too old. So this line has to change:
- azure-cli-core==2.0.35

I've changed it to this, and the deploy worked:
- azure-cli-core==2.12.0

Hope this helps... I could do a pull request I guess?

Was this page helpful?
0 / 5 - 0 ratings