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

ec2_eni: parameter device_index expects integer from user, but further in the code it is expected string but passed the integer #870

Closed
1 task done
dahorak opened this issue Jun 8, 2022 · 2 comments · Fixed by #877
Labels
bug This issue/PR relates to a bug jira module module needs_triage plugins plugin (any type) python3 traceback

Comments

@dahorak
Copy link

dahorak commented Jun 8, 2022

Summary

When I try to create second interface and attach it to EC2 instance using ec2_eni module it fails with python traceback:

The full traceback is:
Traceback (most recent call last):
  File "/tmp/ansible_amazon.aws.ec2_eni_payload_8w5xc_go/ansible_amazon.aws.ec2_eni_payload.zip/ansible_collections/amazon/aws/plugins/modules/ec2_eni.py", line 792, in uniquely_find_eni
  File "/tmp/ansible_amazon.aws.ec2_eni_payload_8w5xc_go/ansible_amazon.aws.ec2_eni_payload.zip/ansible_collections/amazon/aws/plugins/module_utils/core.py", line 336, in deciding_wrapper
    return retrying_wrapper(*args, **kwargs)
  File "/tmp/ansible_amazon.aws.ec2_eni_payload_8w5xc_go/ansible_amazon.aws.ec2_eni_payload.zip/ansible_collections/amazon/aws/plugins/module_utils/cloud.py", line 125, in _retry_wrapper
    base_class=cls.base_class,
  File "/tmp/ansible_amazon.aws.ec2_eni_payload_8w5xc_go/ansible_amazon.aws.ec2_eni_payload.zip/ansible_collections/amazon/aws/plugins/module_utils/cloud.py", line 68, in _retry_func
    return func()
  File "/usr/lib/python3.6/site-packages/botocore/client.py", line 357, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/usr/lib/python3.6/site-packages/botocore/client.py", line 649, in _make_api_call
    api_params, operation_model, context=request_context)
  File "/usr/lib/python3.6/site-packages/botocore/client.py", line 697, in _convert_to_request_dict
    api_params, operation_model)
  File "/usr/lib/python3.6/site-packages/botocore/validate.py", line 297, in serialize_to_request
    raise ParamValidationError(report=report.generate_report())
botocore.exceptions.ParamValidationError: Parameter validation failed:
Invalid type for parameter Filters[1].Values[0], value: 1, type: <class 'int'>, valid types: <class 'str'>
[WARNING]: botocore < 1.19.0 is not supported or tested.  Some features may not work.
[WARNING]: boto3 < 1.16.0 is not supported or tested.  Some features may not work.
fatal: [localhost]: FAILED! => {
    "boto3_version": "1.15.15",
    "botocore_version": "1.18.15",
    "changed": false,
    "invocation": {
        "module_args": {
            "allow_reassignment": false,
            "attached": null,
            "aws_access_key": "...",
            "aws_ca_bundle": null,
            "aws_config": null,
            "aws_secret_key": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "debug_botocore_endpoint_logs": false,
            "delete_on_termination": null,
            "description": "second-interface",
            "device_index": 1,
            "ec2_url": null,
            "eni_id": null,
            "force_detach": false,
            "instance_id": "i-...",
            "name": "second-interface",
            "private_ip_address": null,
            "profile": null,
            "purge_secondary_private_ip_addresses": false,
            "purge_tags": true,
            "region": "us-east-1",
            "secondary_private_ip_address_count": null,
            "secondary_private_ip_addresses": null,
            "security_groups": [],
            "security_token": null,
            "source_dest_check": null,
            "state": "present",
            "subnet_id": "subnet-...",
            "tags": null,
            "validate_certs": true
        }
    },
    "msg": "Failed to find unique eni with filters: [{'Name': 'attachment.instance-id', 'Values': ['i-...']}, {'Name': 'attachment.device-index', 'Values': [1]}]: Parameter validation failed:\nInvalid type for parameter Filters[1].Values[0], value: 1, type: <class 'int'>, valid types: <class 'str'>"

I tried it also with different version of Python (3.7, 3.10), but if fails with the same error.

If I tried to define the device_index as string (device_index: 1 | str), it fails with error:

    "msg": "argument device_index is of type <class 'str'> and we were unable to convert to int: <class 'str'> cannot be converted to an int"

Issue Type

Bug Report

Component Name

ec2_eni

Ansible Version

$ ansible --version
ansible 2.9.27
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/test/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.6/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.6.8 (default, Jan 19 2022, 23:28:49) [GCC 8.5.0 20210514 (Red Hat 8.5.0-7)]
$ ansible --version
ansible [core 2.12.3]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/dahorak/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.10/site-packages/ansible
  ansible collection location = /home/dahorak/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.10.4 (main, Mar 25 2022, 00:00:00) [GCC 12.0.1 20220308 (Red Hat 12.0.1-0)]
  jinja version = 3.0.3
  libyaml = True

Collection Versions

$ ansible-galaxy collection list

Collection        Version
----------------- -------
amazon.aws        3.3.0  
ansible.posix     1.3.0  
community.general 4.6.1  

AWS SDK versions

$ pip show boto boto3 botocore
Name: boto3
Version: 1.15.15
Summary: The AWS SDK for Python
Home-page: https://github.com/boto/boto3
Author: Amazon Web Services
Author-email: UNKNOWN
License: Apache License 2.0
Location: /usr/lib/python3.6/site-packages
Requires: botocore, jmespath, s3transfer
---
Name: botocore
Version: 1.18.15
Summary: Low-level, data-driven core of boto 3.
Home-page: https://github.com/boto/botocore
Author: Amazon Web Services
Author-email: UNKNOWN
License: Apache License 2.0
Location: /usr/lib/python3.6/site-packages
Requires: jmespath, python-dateutil, urllib3
$ pip show boto boto3 botocore
Name: boto3
Version: 1.21.8
Summary: The AWS SDK for Python
Home-page: https://github.com/boto/boto3
Author: Amazon Web Services
Author-email: 
License: Apache License 2.0
Location: /usr/lib/python3.10/site-packages
Requires: botocore, jmespath, s3transfer
Required-by: 
---
Name: botocore
Version: 1.24.8
Summary: Low-level, data-driven core of boto 3.
Home-page: https://github.com/boto/botocore
Author: Amazon Web Services
Author-email: 
License: Apache License 2.0
Location: /usr/lib/python3.10/site-packages
Requires: jmespath, python-dateutil, urllib3
Required-by: awscli, boto3, s3transfer

Configuration

$ ansible-config dump --only-changed

OS / Environment

CentOS Stream release 8
Fedora release 36 (Thirty Six)

Steps to Reproduce

---
- name: "Create second interface"
  hosts: "localhost"
    
  vars:
    aws_access_key: "..."
    aws_secret_key: "..."
    aws_region: "us-east-1"
    aws_instance_id: "i-..."
    aws_second_subnet: "subnet-..."

  tasks:
    - name: Create second interface
      amazon.aws.ec2_eni:
        aws_access_key: "{{ aws_access_key }}"
        aws_secret_key: "{{ aws_secret_key }}"
        region: "{{ aws_region }}"
        name: "second-interface"
        description: "second-interface"
        instance_id: "{{ aws_instance_id }}"
        device_index: 1
        subnet_id: "{{ aws_second_subnet }}"
        state: present

Expected Results

It should create interface and attach it to instance.

Actual Results

$ ansible-playbook -i inventory.yml  playbook-test.yml -vvvvvv
ansible-playbook 2.9.27
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/test/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.6/site-packages/ansible
  executable location = /usr/bin/ansible-playbook
  python version = 3.6.8 (default, Jan 19 2022, 23:28:49) [GCC 8.5.0 20210514 (Red Hat 8.5.0-7)]
Using /etc/ansible/ansible.cfg as config file
setting up inventory plugins
host_list declined parsing /home/test/test/inventory.yml as it did not pass its verify_file() method
script declined parsing /home/test/test/inventory.yml as it did not pass its verify_file() method
Parsed /home/test/test/inventory.yml inventory source with yaml plugin
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit
localhost does not match 'all'
Loading callback plugin default of type stdout, v2.0 from /usr/lib/python3.6/site-packages/ansible/plugins/callback/default.py
Attempting to use 'actionable' callback.
Skipping callback 'actionable', as we already have a stdout callback.
Attempting to use 'aws_resource_actions' callback.
Attempting to use 'cgroup_memory_recap' callback.
Attempting to use 'cgroup_perf_recap' callback.
Attempting to use 'context_demo' callback.
Attempting to use 'counter_enabled' callback.
Skipping callback 'counter_enabled', as we already have a stdout callback.
Attempting to use 'debug' callback.
Skipping callback 'debug', as we already have a stdout callback.
Attempting to use 'dense' callback.
Skipping callback 'dense', as we already have a stdout callback.
Attempting to use 'dense' callback.
Skipping callback 'dense', as we already have a stdout callback.
Attempting to use 'foreman' callback.
Attempting to use 'full_skip' callback.
Skipping callback 'full_skip', as we already have a stdout callback.
Attempting to use 'grafana_annotations' callback.
Attempting to use 'hipchat' callback.
Attempting to use 'jabber' callback.
Attempting to use 'json' callback.
Skipping callback 'json', as we already have a stdout callback.
Attempting to use 'junit' callback.
Attempting to use 'log_plays' callback.
Attempting to use 'logdna' callback.
Attempting to use 'logentries' callback.
Attempting to use 'logstash' callback.
Attempting to use 'mail' callback.
Attempting to use 'minimal' callback.
Skipping callback 'minimal', as we already have a stdout callback.
Attempting to use 'nrdp' callback.
Attempting to use 'null' callback.
Skipping callback 'null', as we already have a stdout callback.
Attempting to use 'oneline' callback.
Skipping callback 'oneline', as we already have a stdout callback.
Attempting to use 'osx_say' callback.
Attempting to use 'profile_roles' callback.
Attempting to use 'profile_tasks' callback.
Attempting to use 'say' callback.
Attempting to use 'selective' callback.
Skipping callback 'selective', as we already have a stdout callback.
Attempting to use 'skippy' callback.
Skipping callback 'skippy', as we already have a stdout callback.
Attempting to use 'slack' callback.
Attempting to use 'splunk' callback.
Attempting to use 'stderr' callback.
Skipping callback 'stderr', as we already have a stdout callback.
Attempting to use 'sumologic' callback.
Attempting to use 'syslog_json' callback.
Attempting to use 'timer' callback.
Attempting to use 'tree' callback.
Attempting to use 'unixy' callback.
Skipping callback 'unixy', as we already have a stdout callback.
Attempting to use 'yaml' callback.
Skipping callback 'yaml', as we already have a stdout callback.

PLAYBOOK: playbook-test.yml ************************************************************************
Positional arguments: playbook-test.yml
verbosity: 6
connection: smart
timeout: 10
become_method: sudo
tags: ('all',)
inventory: ('/home/test/test/inventory.yml',)
forks: 5
1 plays in playbook-test.yml

PLAY [Create second interface] *********************************************************************

TASK [Gathering Facts] *****************************************************************************
task path: /home/test/test/playbook-test.yml:2
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: test
<127.0.0.1> EXEC /bin/sh -c 'echo ~test && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/test/.ansible/tmp `"&& mkdir "` echo /home/test/.ansible/tmp/ansible-tmp-1654691154.2020857-245441-121728147229491 `" && echo ansible-tmp-1654691154.2020857-245441-121728147229491="` echo /home/test/.ansible/tmp/ansible-tmp-1654691154.2020857-245441-121728147229491 `" ) && sleep 0'
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/basic.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/__init__.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/ansible_collector.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/default_collectors.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/namespace.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/compat/selectors.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/common/text/formatters.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/common/file.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/_text.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/common/parameters.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/common/_json_compat.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/common/text/__init__.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/common/process.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/common/_collections_compat.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/parsing/__init__.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/common/_utils.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/common/text/converters.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/parsing/convert_bool.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/pycompat24.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/compat/__init__.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/common/validation.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/six/__init__.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/common/__init__.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/common/sys_info.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/compat/_selectors2.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/common/collections.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/distro/__init__.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/distro/_distro.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/compat.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/collector.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/timeout.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/network/openbsd.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/hardware/darwin.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/system/selinux.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/system/distribution.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/hardware/linux.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/virtual/openbsd.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/system/date_time.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/hardware/hurd.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/network/darwin.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/system/ssh_pub_keys.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/system/python.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/hardware/sunos.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/network/iscsi.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/network/fc_wwn.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/system/pkg_mgr.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/other/facter.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/other/ohai.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/system/dns.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/virtual/base.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/network/netbsd.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/virtual/hpux.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/system/platform.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/other/__init__.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/system/user.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/system/caps.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/network/hpux.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/virtual/netbsd.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/network/sunos.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/system/cmdline.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/hardware/__init__.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/hardware/dragonfly.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/system/fips.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/hardware/base.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/network/base.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/virtual/linux.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/network/hurd.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/network/__init__.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/network/dragonfly.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/system/__init__.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/network/linux.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/virtual/sunos.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/hardware/hpux.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/system/lsb.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/system/service_mgr.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/virtual/__init__.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/virtual/dragonfly.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/hardware/openbsd.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/system/local.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/hardware/netbsd.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/system/chroot.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/virtual/freebsd.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/hardware/freebsd.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/hardware/aix.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/network/aix.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/network/freebsd.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/network/nvme.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/system/env.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/system/apparmor.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/network/generic_bsd.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/sysctl.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/utils.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/facts/virtual/sysctl.py
Using module file /usr/lib/python3.6/site-packages/ansible/modules/system/setup.py
<127.0.0.1> PUT /home/test/.ansible/tmp/ansible-local-245435r_cw7lqi/tmpdgb1scmp TO /home/test/.ansible/tmp/ansible-tmp-1654691154.2020857-245441-121728147229491/AnsiballZ_setup.py
<127.0.0.1> EXEC /bin/sh -c 'chmod u+x /home/test/.ansible/tmp/ansible-tmp-1654691154.2020857-245441-121728147229491/ /home/test/.ansible/tmp/ansible-tmp-1654691154.2020857-245441-121728147229491/AnsiballZ_setup.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '/usr/bin/python3.6 /home/test/.ansible/tmp/ansible-tmp-1654691154.2020857-245441-121728147229491/AnsiballZ_setup.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c 'rm -f -r /home/test/.ansible/tmp/ansible-tmp-1654691154.2020857-245441-121728147229491/ > /dev/null 2>&1 && sleep 0'
ok: [localhost]
META: ran handlers

TASK [Create second interface] *********************************************************************
task path: /home/test/test/playbook-test.yml:13
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: test
<127.0.0.1> EXEC /bin/sh -c 'echo ~test && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/test/.ansible/tmp `"&& mkdir "` echo /home/test/.ansible/tmp/ansible-tmp-1654691155.052014-245487-199583058355356 `" && echo ansible-tmp-1654691155.052014-245487-199583058355356="` echo /home/test/.ansible/tmp/ansible-tmp-1654691155.052014-245487-199583058355356 `" ) && sleep 0'
Using module_utils file ansible_collections/amazon/aws/plugins/module_utils/ec2
Using module_utils file ansible_collections/amazon/aws
Using module_utils file ansible_collections/amazon/aws/plugins/module_utils/core
Using module_utils file ansible_collections/amazon/aws/plugins/module_utils/tagging
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/basic.py
Using module_utils file ansible_collections/amazon
Using module_utils file ansible_collections
Using module_utils file ansible_collections/amazon/aws/plugins/module_utils/waiters
Using module_utils file ansible_collections/amazon/aws/plugins
Using module_utils file ansible_collections/amazon/aws/plugins/module_utils
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/common/dict_transformations.py
Using module_utils file ansible_collections/amazon/aws/plugins/module_utils/cloud
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/_text.py
Using module_utils file ansible_collections/amazon/aws/plugins/module_utils/policy
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/ansible_release.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/six/__init__.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/common/__init__.py
Using module_utils file ansible_collections/amazon/aws/plugins/module_utils/version
Using module_utils file ansible_collections/amazon/aws/plugins/module_utils/_version
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/compat/selectors.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/common/text/formatters.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/common/file.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/common/_json_compat.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/common/parameters.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/common/text/__init__.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/common/process.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/common/_collections_compat.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/parsing/__init__.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/common/_utils.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/common/text/converters.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/parsing/convert_bool.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/pycompat24.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/compat/__init__.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/common/validation.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/common/sys_info.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/compat/_selectors2.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/common/collections.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/distro/__init__.py
Using module_utils file /usr/lib/python3.6/site-packages/ansible/module_utils/distro/_distro.py
Using module file /home/test/.ansible/collections/ansible_collections/amazon/aws/plugins/modules/ec2_eni.py
<127.0.0.1> PUT /home/test/.ansible/tmp/ansible-local-245435r_cw7lqi/tmp4motjjb9 TO /home/test/.ansible/tmp/ansible-tmp-1654691155.052014-245487-199583058355356/AnsiballZ_ec2_eni.py
<127.0.0.1> EXEC /bin/sh -c 'chmod u+x /home/test/.ansible/tmp/ansible-tmp-1654691155.052014-245487-199583058355356/ /home/test/.ansible/tmp/ansible-tmp-1654691155.052014-245487-199583058355356/AnsiballZ_ec2_eni.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '/usr/bin/python3.6 /home/test/.ansible/tmp/ansible-tmp-1654691155.052014-245487-199583058355356/AnsiballZ_ec2_eni.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c 'rm -f -r /home/test/.ansible/tmp/ansible-tmp-1654691155.052014-245487-199583058355356/ > /dev/null 2>&1 && sleep 0'
The full traceback is:
Traceback (most recent call last):
  File "/tmp/ansible_amazon.aws.ec2_eni_payload_8w5xc_go/ansible_amazon.aws.ec2_eni_payload.zip/ansible_collections/amazon/aws/plugins/modules/ec2_eni.py", line 792, in uniquely_find_eni
  File "/tmp/ansible_amazon.aws.ec2_eni_payload_8w5xc_go/ansible_amazon.aws.ec2_eni_payload.zip/ansible_collections/amazon/aws/plugins/module_utils/core.py", line 336, in deciding_wrapper
    return retrying_wrapper(*args, **kwargs)
  File "/tmp/ansible_amazon.aws.ec2_eni_payload_8w5xc_go/ansible_amazon.aws.ec2_eni_payload.zip/ansible_collections/amazon/aws/plugins/module_utils/cloud.py", line 125, in _retry_wrapper
    base_class=cls.base_class,
  File "/tmp/ansible_amazon.aws.ec2_eni_payload_8w5xc_go/ansible_amazon.aws.ec2_eni_payload.zip/ansible_collections/amazon/aws/plugins/module_utils/cloud.py", line 68, in _retry_func
    return func()
  File "/usr/lib/python3.6/site-packages/botocore/client.py", line 357, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/usr/lib/python3.6/site-packages/botocore/client.py", line 649, in _make_api_call
    api_params, operation_model, context=request_context)
  File "/usr/lib/python3.6/site-packages/botocore/client.py", line 697, in _convert_to_request_dict
    api_params, operation_model)
  File "/usr/lib/python3.6/site-packages/botocore/validate.py", line 297, in serialize_to_request
    raise ParamValidationError(report=report.generate_report())
botocore.exceptions.ParamValidationError: Parameter validation failed:
Invalid type for parameter Filters[1].Values[0], value: 1, type: <class 'int'>, valid types: <class 'str'>
[WARNING]: botocore < 1.19.0 is not supported or tested.  Some features may not work.
[WARNING]: boto3 < 1.16.0 is not supported or tested.  Some features may not work.
fatal: [localhost]: FAILED! => {
    "boto3_version": "1.15.15",
    "botocore_version": "1.18.15",
    "changed": false,
    "invocation": {
        "module_args": {
            "allow_reassignment": false,
            "attached": null,
            "aws_access_key": "...",
            "aws_ca_bundle": null,
            "aws_config": null,
            "aws_secret_key": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "debug_botocore_endpoint_logs": false,
            "delete_on_termination": null,
            "description": "second-interface",
            "device_index": 1,
            "ec2_url": null,
            "eni_id": null,
            "force_detach": false,
            "instance_id": "i-...",
            "name": "second-interface",
            "private_ip_address": null,
            "profile": null,
            "purge_secondary_private_ip_addresses": false,
            "purge_tags": true,
            "region": "us-east-1",
            "secondary_private_ip_address_count": null,
            "secondary_private_ip_addresses": null,
            "security_groups": [],
            "security_token": null,
            "source_dest_check": null,
            "state": "present",
            "subnet_id": "subnet-...",
            "tags": null,
            "validate_certs": true
        }
    },
    "msg": "Failed to find unique eni with filters: [{'Name': 'attachment.instance-id', 'Values': ['i-...']}, {'Name': 'attachment.device-index', 'Values': [1]}]: Parameter validation failed:\nInvalid type for parameter Filters[1].Values[0], value: 1, type: <class 'int'>, valid types: <class 'str'>"
}

PLAY RECAP *****************************************************************************************
localhost                  : ok=1    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
@ansibullbot
Copy link

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibullbot
Copy link

@ansibullbot ansibullbot added bug This issue/PR relates to a bug module module needs_triage plugins plugin (any type) python3 traceback labels Jun 8, 2022
@dahorak dahorak changed the title ec2_eni: Parameter validation failed:\nInvalid type for parameter Filters[1].Values[0], value: 1, type: <class 'int'>, valid types: <class 'str'> ec2_eni: parameter device_index expects integer from user, but further in the code it is expected string but passed the integer Jun 9, 2022
@mandar242 mandar242 added the jira label Jun 16, 2022
softwarefactory-project-zuul bot pushed a commit that referenced this issue Jun 22, 2022
… api as expected by api call (#877)

ec2_eni: change data type of `device_index` to str when passing it to api as expected by api call

SUMMARY

Currently the data type for parameter device_index here while being passed to api call is integer but one of the API calls later used here in the module (describe_network_interfaces) expects it to be string as per boto3 api documentation.
Fixes #870

ISSUE TYPE


Bugfix Pull Request

COMPONENT NAME

ec2_eni

Reviewed-by: Mark Chappell <None>
Reviewed-by: Jill R <None>
Reviewed-by: Alina Buzachis <None>
jatorcasso pushed a commit to jatorcasso/amazon.aws that referenced this issue Jun 27, 2022
… api as expected by api call (ansible-collections#877)

ec2_eni: change data type of `device_index` to str when passing it to api as expected by api call

SUMMARY

Currently the data type for parameter device_index here while being passed to api call is integer but one of the API calls later used here in the module (describe_network_interfaces) expects it to be string as per boto3 api documentation.
Fixes ansible-collections#870

ISSUE TYPE


Bugfix Pull Request

COMPONENT NAME

ec2_eni

Reviewed-by: Mark Chappell <None>
Reviewed-by: Jill R <None>
Reviewed-by: Alina Buzachis <None>
abikouo pushed a commit to abikouo/amazon.aws that referenced this issue Sep 18, 2023
… integration tests (ansible-collections#870)

Add support for tagging certificates. Fix deprecated tasks in aws_acm integration tests

SUMMARY

This PR adds support for configuring arbitrary tags when importing a certificate using the aws_acm module. Previously, it was only possible to set the 'Name' tag.
Additionally, this PR fixes issues with the aws_acm integration tests.  The integration tests were using deprecated tasks or attributes, such as openssl_certificate.

ISSUE TYPE


Bugfix Pull Request

COMPONENT NAME

aws_acm
ADDITIONAL INFORMATION


Changes to the aws_acm.py module:

Add new tags and purge_tags attributes.
The certificate_arn attribute is now allowed when state='present'. A playbook should be allowed to modify an existing certificate entry by providing the ARN. For example, a play may want to add, modify, remove tags on an existing certificate.
The aws_acm module returns the updated tags. See example below.
Refactor aws_acm.py to improve code reuse and make it possible to set arbitrary tags. This should also help to 1) improve readability. 2) prepare for ansible-collections#869 which I am planning to work on next.

Backwards-compatibility is retained, even though it might make sense to normalize some of the attributes.
Example return value:
"certificate": {
            "arn": "arn:aws:acm:us-west-1:account:certificate/f85abf9d-4bda-4dcc-98c3-770664a68243",
            "domain_name": "acm1.949058644.ansible.com",
            "tags": {
                "Application": "search",
                "Environment": "development",
                "Name": "ansible-test-78006277-398b5796f999_949058644_1"
            }
        }

Integration tests:

The openssl_certificate task is deprecated. Migrate to x509_certificate.
The signature_algorithms attribute is no longer supported by the new x509_certificate task. Using selfsigned_digest instead.
The integration tests for the aws_acm module pass locally.
I see ansible/ansible#67788 has been closed, but tests/integration/targets/aws_acm/aliases still has unstable. I am not sure what to do about it. I was able to run the tests in my local workspace after making the above changes.

Reviewed-by: Markus Bergholz <[email protected]>
Reviewed-by: Sebastien Rosset <None>
Reviewed-by: Mark Woolley <[email protected]>
Reviewed-by: Alina Buzachis <None>
abikouo pushed a commit to abikouo/amazon.aws that referenced this issue Sep 18, 2023
… integration tests (ansible-collections#870)

Add support for tagging certificates. Fix deprecated tasks in aws_acm integration tests

SUMMARY

This PR adds support for configuring arbitrary tags when importing a certificate using the aws_acm module. Previously, it was only possible to set the 'Name' tag.
Additionally, this PR fixes issues with the aws_acm integration tests.  The integration tests were using deprecated tasks or attributes, such as openssl_certificate.

ISSUE TYPE


Bugfix Pull Request

COMPONENT NAME

aws_acm
ADDITIONAL INFORMATION


Changes to the aws_acm.py module:

Add new tags and purge_tags attributes.
The certificate_arn attribute is now allowed when state='present'. A playbook should be allowed to modify an existing certificate entry by providing the ARN. For example, a play may want to add, modify, remove tags on an existing certificate.
The aws_acm module returns the updated tags. See example below.
Refactor aws_acm.py to improve code reuse and make it possible to set arbitrary tags. This should also help to 1) improve readability. 2) prepare for ansible-collections#869 which I am planning to work on next.

Backwards-compatibility is retained, even though it might make sense to normalize some of the attributes.
Example return value:
"certificate": {
            "arn": "arn:aws:acm:us-west-1:account:certificate/f85abf9d-4bda-4dcc-98c3-770664a68243",
            "domain_name": "acm1.949058644.ansible.com",
            "tags": {
                "Application": "search",
                "Environment": "development",
                "Name": "ansible-test-78006277-398b5796f999_949058644_1"
            }
        }

Integration tests:

The openssl_certificate task is deprecated. Migrate to x509_certificate.
The signature_algorithms attribute is no longer supported by the new x509_certificate task. Using selfsigned_digest instead.
The integration tests for the aws_acm module pass locally.
I see ansible/ansible#67788 has been closed, but tests/integration/targets/aws_acm/aliases still has unstable. I am not sure what to do about it. I was able to run the tests in my local workspace after making the above changes.

Reviewed-by: Markus Bergholz <[email protected]>
Reviewed-by: Sebastien Rosset <None>
Reviewed-by: Mark Woolley <[email protected]>
Reviewed-by: Alina Buzachis <None>
abikouo pushed a commit to abikouo/amazon.aws that referenced this issue Oct 24, 2023
… integration tests (ansible-collections#870)

Add support for tagging certificates. Fix deprecated tasks in aws_acm integration tests

SUMMARY

This PR adds support for configuring arbitrary tags when importing a certificate using the aws_acm module. Previously, it was only possible to set the 'Name' tag.
Additionally, this PR fixes issues with the aws_acm integration tests.  The integration tests were using deprecated tasks or attributes, such as openssl_certificate.

ISSUE TYPE


Bugfix Pull Request

COMPONENT NAME

aws_acm
ADDITIONAL INFORMATION


Changes to the aws_acm.py module:

Add new tags and purge_tags attributes.
The certificate_arn attribute is now allowed when state='present'. A playbook should be allowed to modify an existing certificate entry by providing the ARN. For example, a play may want to add, modify, remove tags on an existing certificate.
The aws_acm module returns the updated tags. See example below.
Refactor aws_acm.py to improve code reuse and make it possible to set arbitrary tags. This should also help to 1) improve readability. 2) prepare for ansible-collections#869 which I am planning to work on next.

Backwards-compatibility is retained, even though it might make sense to normalize some of the attributes.
Example return value:
"certificate": {
            "arn": "arn:aws:acm:us-west-1:account:certificate/f85abf9d-4bda-4dcc-98c3-770664a68243",
            "domain_name": "acm1.949058644.ansible.com",
            "tags": {
                "Application": "search",
                "Environment": "development",
                "Name": "ansible-test-78006277-398b5796f999_949058644_1"
            }
        }

Integration tests:

The openssl_certificate task is deprecated. Migrate to x509_certificate.
The signature_algorithms attribute is no longer supported by the new x509_certificate task. Using selfsigned_digest instead.
The integration tests for the aws_acm module pass locally.
I see ansible/ansible#67788 has been closed, but tests/integration/targets/aws_acm/aliases still has unstable. I am not sure what to do about it. I was able to run the tests in my local workspace after making the above changes.

Reviewed-by: Markus Bergholz <[email protected]>
Reviewed-by: Sebastien Rosset <None>
Reviewed-by: Mark Woolley <[email protected]>
Reviewed-by: Alina Buzachis <None>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue/PR relates to a bug jira module module needs_triage plugins plugin (any type) python3 traceback
Projects
None yet
3 participants