Open kutzi opened 1 year ago
Files identified in the description: None
If these files are inaccurate, please update the component name
section of the description or use the !component
bot command.
Having the same issue.
File \"/var/folders/3v/9txpvy690d9fchgwc_v3dp0h0000gn/T/ansible_community.aws.cloudfront_distribution_info_payload_z3n81zfa/ansible_community.aws.cloudfront_distribution_info_payload.zip/ansible_collections/amazon/aws/plugins/module_utils/cloudfront_facts.py\", line 166, in summary_get_origin_access_identity_list\nTypeError: CloudFrontFactsServiceManager.describe_cloudfront_property() takes 4 positional arguments but 5 were given\n",
Having the same issue too.
Looks like it's broken since version >6.0.0?
I have the (almost) same error with aws.community version 5.4.0
Error here:
CloudFrontFactsServiceManager.paginate_list_cloudfront_property() takes 5 positional arguments but 6 were given
the method is defined over at amazon.aws here https://github.com/ansible-collections/amazon.aws/blob/main/plugins/module_utils/cloudfront_facts.py#L124
Which seems a bit risky to me, as one could have a version of amazon.aws
not matching the code being used in the version of community.aws
.
In fact a version missmatch was the cause for the issue.
I had the versions
Installing version 5.4.0 for both fixed the issue. But other version combos might also work. It's just down to luck I guess. ;)
The combo 6.3.0 / 6.5.0 also seems to work if you prefer to stay on newer versions.
c.a 5.x.x required a.a >= 5 https://github.com/ansible-collections/community.aws/blob/stable-5/galaxy.yml#L12
Maybe it must also exclude a.a. < 6.
Yes. I guess it's the upper limit that matters here (from community.aws perspective).
I tried with different set of versions but still having the same error
Tried with:
community.aws 7.0.0
amazon.aws 7.1.0
community.aws 7.0.0
amazon.aws 7.0.0
community.aws 6.3.0
amazon.aws 6.5.0
Getting traceback:
File "/tmp/ansible_cloudfront_info_payload_8sg9y1zm/ansible_cloudfront_info_payload.zip/ansible_collections/community/aws/plugins/modules/cloudfront_distribution_info.py", line 408, in <module>
File "/tmp/ansible_cloudfront_info_payload_8sg9y1zm/ansible_cloudfront_info_payload.zip/ansible_collections/community/aws/plugins/modules/cloudfront_distribution_info.py", line 399, in main
File "/tmp/ansible_cloudfront_info_payload_8sg9y1zm/ansible_cloudfront_info_payload.zip/ansible_collections/amazon/aws/plugins/module_utils/cloudfront_facts.py", line 158, in summary
File "/tmp/ansible_cloudfront_info_payload_8sg9y1zm/ansible_cloudfront_info_payload.zip/ansible_collections/amazon/aws/plugins/module_utils/cloudfront_facts.py", line 166, in summary_get_origin_access_identity_list
TypeError: describe_cloudfront_property() takes 4 positional arguments but 5 were given
I cannot reproduce your error.
TypeError: describe_cloudfront_property() takes 4 positional arguments but 5 were given
The function describe_cloudfront_property()
was introduced in amazon.aws.6.0.0
https://github.com/ansible-collections/amazon.aws/blob/6.0.0/plugins/module_utils/cloudfront_facts.py#L108
And since it exists, it always accepts >= 4 positional arguments. So this error is an impossible one.
Maybe @abikouo got an idea?
ansible-galaxy collection install 'amazon.aws:<8.0.0' 'community.aws:<8.0.0'
m@zen4:~/git$ ansible-galaxy collection list |grep aws
amazon.aws 7.1.0
community.aws 7.0.0
amazon.aws 3.5.0
community.aws 3.6.0
netapp.aws 21.7.0
m@zen4:~/git$ ap test.yml
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
PLAY [localhost] ****************************************************************************************************************************************************************************************************
TASK [Gathering Facts] **********************************************************************************************************************************************************************************************
ok: [localhost]
TASK [test] *********************************************************************************************************************************************************************************************************
ok: [localhost]
PLAY RECAP **********************************************************************************************************************************************************************************************************
localhost : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
ansible-galaxy collection install 'amazon.aws:<7.0.0' 'community.aws:<7.0.0'
m@zen4:~/git$ ansible-galaxy collection list |grep aws
amazon.aws 3.5.0
community.aws 3.6.0
netapp.aws 21.7.0
amazon.aws 6.5.1
community.aws 6.4.0
m@zen4:~/git$ ap test.yml
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
PLAY [localhost] ****************************************************************************************************************************************************************************************************
TASK [Gathering Facts] **********************************************************************************************************************************************************************************************
ok: [localhost]
TASK [test] *********************************************************************************************************************************************************************************************************
ok: [localhost]
PLAY RECAP **********************************************************************************************************************************************************************************************************
localhost : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
m@zen4:~/git$ cat test.yml
---
- hosts: localhost
tasks:
- name: test
community.aws.cloudfront_distribution_info:
summary: true
profile: myaws
region: eu-central-1
Your ansible-galaxy collection list
command output still has community.aws
version 3.6.0
, maybe that's why you don't get the error?
Tried with your test.yml
file and still have the issue:
$ ansible-galaxy collection list
# /home/ec2-user/.ansible/collections/ansible_collections
Collection Version
--------------- -------
amazon.aws 7.2.0
community.aws 7.1.0
kubernetes.core 3.0.0
$ cat test_summary.yml
---
- hosts: localhost
tasks:
- name: test
community.aws.cloudfront_distribution_info:
summary: true
$ ansible-playbook test_summary.yml
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
PLAY [localhost] **********************************************************************************************************************************************
TASK [Gathering Facts] ****************************************************************************************************************************************
ok: [localhost]
TASK [test] ***************************************************************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: TypeError: describe_cloudfront_property() takes 4 positional arguments but 5 were given
fatal: [localhost]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n File \"/home/ec2-user/.ansible/tmp/ansible-tmp-1705588826.5443957-3243763-23136583234235/AnsiballZ_cloudfront_distribution_info.py\", line 107, in <module>\n _ansiballz_main()\n File \"/home/ec2-user/.ansible/tmp/ansible-tmp-1705588826.5443957-3243763-23136583234235/AnsiballZ_cloudfront_distribution_info.py\", line 99, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/home/ec2-user/.ansible/tmp/ansible-tmp-1705588826.5443957-3243763-23136583234235/AnsiballZ_cloudfront_distribution_info.py\", line 47, in invoke_module\n runpy.run_module(mod_name='ansible_collections.community.aws.plugins.modules.cloudfront_distribution_info', init_globals=dict(_module_fqn='ansible_collections.community.aws.plugins.modules.cloudfront_distribution_info', _modlib_path=modlib_path),\n File \"/usr/lib64/python3.9/runpy.py\", line 225, in run_module\n return _run_module_code(code, init_globals, run_name, mod_spec)\n File \"/usr/lib64/python3.9/runpy.py\", line 97, in _run_module_code\n _run_code(code, mod_globals, init_globals,\n File \"/usr/lib64/python3.9/runpy.py\", line 87, in _run_code\n exec(code, run_globals)\n File \"/tmp/ansible_community.aws.cloudfront_distribution_info_payload_sezyw8_z/ansible_community.aws.cloudfront_distribution_info_payload.zip/ansible_collections/community/aws/plugins/modules/cloudfront_distribution_info.py\", line 408, in <module>\n File \"/tmp/ansible_community.aws.cloudfront_distribution_info_payload_sezyw8_z/ansible_community.aws.cloudfront_distribution_info_payload.zip/ansible_collections/community/aws/plugins/modules/cloudfront_distribution_info.py\", line 399, in main\n File \"/tmp/ansible_community.aws.cloudfront_distribution_info_payload_sezyw8_z/ansible_community.aws.cloudfront_distribution_info_payload.zip/ansible_collections/amazon/aws/plugins/module_utils/cloudfront_facts.py\", line 159, in summary\n File \"/tmp/ansible_community.aws.cloudfront_distribution_info_payload_sezyw8_z/ansible_community.aws.cloudfront_distribution_info_payload.zip/ansible_collections/amazon/aws/plugins/module_utils/cloudfront_facts.py\", line 167, in summary_get_origin_access_identity_list\nTypeError: describe_cloudfront_property() takes 4 positional arguments but 5 were given\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
PLAY RECAP ****************************************************************************************************************************************************
localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
And below is the test with list_distributions
and list_streaming_distributions
that works fine to show that's the setup is fine:
$ cat test_list_distrib.yml
---
- hosts: localhost
tasks:
- name: test
community.aws.cloudfront_distribution_info:
list_distributions: true
list_streaming_distributions: true
$ ansible-playbook test_list_distrib.yml
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
PLAY [localhost] **********************************************************************************************************************************************
TASK [Gathering Facts] ****************************************************************************************************************************************
ok: [localhost]
TASK [test] ***************************************************************************************************************************************************
ok: [localhost]
PLAY RECAP ****************************************************************************************************************************************************
localhost : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
This is still an issue.
- name: Retrieve info about CloudFront
community.aws.cloudfront_distribution_info:
aws_access_key: "{{ aws_access_key }}"
aws_secret_key: "{{ aws_secret_key }}"
region: "{{ aws_region }}"
register: _cloudfront_distribution_info
tags: ["route53"]
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: TypeError: CloudFrontFactsServiceManager.describe_cloudfront_property() takes 4 positional arguments but 5 were given
fatal: [localhost]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n File \"/home/admin/.ansible/tmp/ansible-tmp-1708424392.9031956-417518-50506265318292/AnsiballZ_cloudfront_distribution_info.py\", line 107, in <module>\n _ansiballz_main()\n File \"/home/admin/.ansible/tmp/ansible-tmp-1708424392.9031956-417518-50506265318292/AnsiballZ_cloudfront_distribution_info.py\", line 99, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/home/admin/.ansible/tmp/ansible-tmp-1708424392.9031956-417518-50506265318292/AnsiballZ_cloudfront_distribution_info.py\", line 47, in invoke_module\n runpy.run_module(mod_name='ansible_collections.community.aws.plugins.modules.cloudfront_distribution_info', init_globals=dict(_module_fqn='ansible_collections.community.aws.plugins.modules.cloudfront_distribution_info', _modlib_path=modlib_path),\n File \"<frozen runpy>\", line 226, in run_module\n File \"<frozen runpy>\", line 98, in _run_module_code\n File \"<frozen runpy>\", line 88, in _run_code\n File \"/tmp/ansible_community.aws.cloudfront_distribution_info_payload_1z9jp9dv/ansible_community.aws.cloudfront_distribution_info_payload.zip/ansible_collections/community/aws/plugins/modules/cloudfront_distribution_info.py\", line 408, in <module>\n File \"/tmp/ansible_community.aws.cloudfront_distribution_info_payload_1z9jp9dv/ansible_community.aws.cloudfront_distribution_info_payload.zip/ansible_collections/community/aws/plugins/modules/cloudfront_distribution_info.py\", line 399, in main\n File \"/tmp/ansible_community.aws.cloudfront_distribution_info_payload_1z9jp9dv/ansible_community.aws.cloudfront_distribution_info_payload.zip/ansible_collections/amazon/aws/plugins/module_utils/cloudfront_facts.py\", line 159, in summary\n File \"/tmp/ansible_community.aws.cloudfront_distribution_info_payload_1z9jp9dv/ansible_community.aws.cloudfront_distribution_info_payload.zip/ansible_collections/amazon/aws/plugins/module_utils/cloudfront_facts.py\", line 167, in summary_get_origin_access_identity_list\nTypeError: CloudFrontFactsServiceManager.describe_cloudfront_property() takes 4 positional arguments but 5 were given\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1
$ ansible --version
ansible [core 2.16.2]
config file = /home/admin/ansible/ansible.cfg
configured module search path = ['/home/admin/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /home/admin/.local/lib/python3.11/site-packages/ansible
ansible collection location = /home/admin/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/local/bin/ansible
python version = 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] (/usr/bin/python3)
jinja version = 3.1.2
libyaml = True
$ ansible-galaxy collection list | grep aws
amazon.aws 7.2.0
community.aws 7.1.0
Still happening with these versions:
$ ansible-galaxy collection list | grep aws
amazon.aws 8.0.0
community.aws 8.0.0
I don't get it why the error is happen.
And in any case, this is an issue for amazon.aws collection. Because the error happen while calling line 159 https://github.com/ansible-collections/amazon.aws/blob/main/plugins/module_utils/cloudfront_facts.py#L159C9-L159C76
summary_dict.update(self.summary_get_origin_access_identity_list())
File "/tmp/ansible_community.aws.cloudfront_distribution_info_payload_783zpjan/ansible_community.aws.cloudfront_distribution_info_payload.zip/ansible_collections/amazon/aws/plugins/module_utils/cloudfront_facts.py", line 159, in summary
File "/tmp/ansible_community.aws.cloudfront_distribution_info_payload_783zpjan/ansible_community.aws.cloudfront_distribution_info_payload.zip/ansible_collections/amazon/aws/plugins/module_utils/cloudfront_facts.py", line 167, in summary_get_origin_access_identity_list
TypeError: CloudFrontFactsServiceManager.describe_cloudfront_property() takes 4 positional arguments but 5 were given
cc @abikouo @hakbailey @alinabuzachis
I experienced the same issue and found out that it somehow works with "summary: false" and "list_distributions: true"
@markuman yes the error happens in amazon.aws
, but community.aws is calling that code wrongly in older versions. As I said in my earlier comment , depending on other projects code is a risky thing as then you have to ensure your dependencies work across all versions of both projects. Hence I see the responsibility on community.aws here.
This is still an issue with version 9.0.0 of community.aws
and amazon.aws
$ ansible-galaxy collection list
Collection Version
--------------- -------
amazon.aws 9.0.0
community.aws 9.0.0
$ cat test.yml
---
- hosts: localhost
tasks:
- name: test
community.aws.cloudfront_distribution_info:
summary: true
$ ansible-playbook test.yml
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
PLAY [localhost] ***************************************************************************************************************************************************************************************************************************************************************************************************************
TASK [Gathering Facts] *********************************************************************************************************************************************************************************************************************************************************************************************************
ok: [localhost]
TASK [test] ********************************************************************************************************************************************************************************************************************************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: TypeError: describe_cloudfront_property() takes 4 positional arguments but 5 were given
fatal: [localhost]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n File \"/home/ec2-user/.ansible/tmp/ansible-tmp-1730887817.6292195-120615-43884281398096/AnsiballZ_cloudfront_distribution_info.py\", line 107, in <module>\n _ansiballz_main()\n File \"/home/ec2-user/.ansible/tmp/ansible-tmp-1730887817.6292195-120615-43884281398096/AnsiballZ_cloudfront_distribution_info.py\", line 99, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/home/ec2-user/.ansible/tmp/ansible-tmp-1730887817.6292195-120615-43884281398096/AnsiballZ_cloudfront_distribution_info.py\", line 47, in invoke_module\n runpy.run_module(mod_name='ansible_collections.community.aws.plugins.modules.cloudfront_distribution_info', init_globals=dict(_module_fqn='ansible_collections.community.aws.plugins.modules.cloudfront_distribution_info', _modlib_path=modlib_path),\n File \"/usr/lib64/python3.9/runpy.py\", line 225, in run_module\n return _run_module_code(code, init_globals, run_name, mod_spec)\n File \"/usr/lib64/python3.9/runpy.py\", line 97, in _run_module_code\n _run_code(code, mod_globals, init_globals,\n File \"/usr/lib64/python3.9/runpy.py\", line 87, in _run_code\n exec(code, run_globals)\n File \"/tmp/ansible_community.aws.cloudfront_distribution_info_payload_96ow2ip8/ansible_community.aws.cloudfront_distribution_info_payload.zip/ansible_collections/community/aws/plugins/modules/cloudfront_distribution_info.py\", line 408, in <module>\n File \"/tmp/ansible_community.aws.cloudfront_distribution_info_payload_96ow2ip8/ansible_community.aws.cloudfront_distribution_info_payload.zip/ansible_collections/community/aws/plugins/modules/cloudfront_distribution_info.py\", line 399, in main\n File \"/tmp/ansible_community.aws.cloudfront_distribution_info_payload_96ow2ip8/ansible_community.aws.cloudfront_distribution_info_payload.zip/ansible_collections/amazon/aws/plugins/module_utils/cloudfront_facts.py\", line 159, in summary\n File \"/tmp/ansible_community.aws.cloudfront_distribution_info_payload_96ow2ip8/ansible_community.aws.cloudfront_distribution_info_payload.zip/ansible_collections/amazon/aws/plugins/module_utils/cloudfront_facts.py\", line 167, in summary_get_origin_access_identity_list\nTypeError: describe_cloudfront_property() takes 4 positional arguments but 5 were given\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
PLAY RECAP *********************************************************************************************************************************************************************************************************************************************************************************************************************
localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
Summary
I'm trying to get a summary of all cloudfront distributions. I.e.
The call fails with:
I tried to get the info with a single distribution (i.e. specify distribution: true and distribution_id instead of summary) and that works fine, so I assume that it's not a general issue with my ansible installation
Issue Type
Bug Report
Component Name
community.aws.cloudfront_info
Ansible Version
Collection Versions
AWS SDK versions
Configuration
OS / Environment
Linux Mint
Steps to Reproduce
Expected Results
I expected the module to return a summary of all distributions
Actual Results
Code of Conduct