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_vol: setting 'name' does not work, 'tags' is needed #1067

Closed
1 task done
nerijus opened this issue Sep 26, 2022 · 2 comments · Fixed by #1071
Closed
1 task done

ec2_vol: setting 'name' does not work, 'tags' is needed #1067

nerijus opened this issue Sep 26, 2022 · 2 comments · Fixed by #1071
Assignees
Labels
bug This issue/PR relates to a bug jira module module plugins plugin (any type) python3 traceback

Comments

@nerijus
Copy link
Contributor

nerijus commented Sep 26, 2022

Summary

This used to work with version 3.2.0:

- name: Modify root volume
  local_action:
    module: ec2_vol
    region: "{{ region }}"
    modify_volume: yes
    instance: "{{ instance_id }}"
    name: "{{ ec2_name }}"
    volume_type: "{{ volume_type }}"
    iops: "{{ volume_iops | default(3000) }}"
    throughput: "{{ volume_throughput }}"

With version > 4.0.0 it errors now:

  File "/tmp/ansible_ec2_vol_payload_kjipke6j/ansible_ec2_vol_payload.zip/ansible_collections/amazon/aws/plugins/modules/ec2_vol.py", line 869, in <module>
  File "/tmp/ansible_ec2_vol_payload_kjipke6j/ansible_ec2_vol_payload.zip/ansible_collections/amazon/aws/plugins/modules/ec2_vol.py", line 837, in main
TypeError: 'NoneType' object does not support item assignment

If I add line:

    tags: { 'Name': "{{ ec2_name }}" }

it works again. I see there is in the source:

            if name:
                tags['Name'] = name

but apparently it does not work?

Issue Type

Bug Report

Component Name

ec2_vol

Ansible Version

$ ansible --version
ansible [core 2.12.9]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/nerijus/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.10/site-packages/ansible
  ansible collection location = /home/nerijus/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.10.7 (main, Sep  7 2022, 00:00:00) [GCC 12.2.1 20220819 (Red Hat 12.2.1-1)]
  jinja version = 3.0.3
  libyaml = True

Collection Versions

$ ansible-galaxy collection list
# /usr/share/ansible/collections/ansible_collections
Collection        Version
----------------- -------
ansible.posix     1.4.0  
community.docker  2.7.1  
community.general 4.8.3  
community.mysql   3.4.0  
containers.podman 1.9.4  
google.cloud      1.0.2  

# /home/nerijus/.ansible/collections/ansible_collections
Collection             Version
---------------------- -------
amazon.aws             4.2.0  
ansible.netcommon      3.1.1  
ansible.posix          1.4.0  
ansible.utils          2.6.1  
ansible.windows        1.11.1 
community.aws          4.2.0  
community.crypto       2.0.1  
community.digitalocean 1.12.0 
community.general      5.6.0  
community.grafana      1.2.1  
community.mysql        3.5.1  
community.postgresql   2.2.0  
community.rabbitmq     1.0.1  
community.zabbix       1.8.0  
hetzner.hcloud         1.6.0  

AWS SDK versions

$ pip show boto boto3 botocore
Name: boto
Version: 2.49.0
Summary: Amazon Web Services Library
Home-page: https://github.com/boto/boto/
Author: Mitch Garnaat
Author-email: [email protected]
License: MIT
Location: /usr/lib/python3.10/site-packages
Requires: 
Required-by: 
---
Name: boto3
Version: 1.21.33
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.33
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

CACHE_PLUGIN(/home/nerijus/ansible-advbet/ansible.cfg) = jsonfile
CACHE_PLUGIN_CONNECTION(/home/nerijus/ansible-advbet/ansible.cfg) = ~/.cache/ansible-facts
CACHE_PLUGIN_TIMEOUT(/home/nerijus/ansible-advbet/ansible.cfg) = 86400
DEFAULT_ACTION_PLUGIN_PATH(/home/nerijus/ansible-advbet/ansible.cfg) = ['/home/nerijus/.local/lib/python3.*/*-packages/ara/plugins/action', '/usr/lib/python3.*/*-packages/ara/plugins/action', '/usr/local/lib/python*/*-packages/ara/plugins/action']
DEFAULT_CALLBACK_PLUGIN_PATH(/home/nerijus/ansible-advbet/ansible.cfg) = ['/home/nerijus/.local/lib/python3.*/*-packages/ara/plugins/callback', '/usr/lib/python3.*/*-packages/ara/plugins/callback', '/usr/local/lib/python*/*-packages/ara/plugins/callback']
DEFAULT_GATHERING(/home/nerijus/ansible-advbet/ansible.cfg) = smart
DEFAULT_HOST_LIST(/home/nerijus/ansible-advbet/ansible.cfg) = ['/home/nerijus/ansible-advbet/inventory/ops/hosts']
DEFAULT_LOOKUP_PLUGIN_PATH(/home/nerijus/ansible-advbet/ansible.cfg) = ['/home/nerijus/.local/lib/python3.*/*-packages/ara/plugins/lookup', '/usr/lib/python3.*/*-packages/ara/plugins/lookup', '/usr/local/lib/python*/*-packages/ara/plugins/lookup']
DEFAULT_REMOTE_USER(/home/nerijus/ansible-advbet/ansible.cfg) = root
DEFAULT_ROLES_PATH(/home/nerijus/ansible-advbet/ansible.cfg) = ['/home/nerijus/ansible-advbet/roles']
DEFAULT_STDOUT_CALLBACK(/home/nerijus/ansible-advbet/ansible.cfg) = debug
DISPLAY_SKIPPED_HOSTS(/home/nerijus/ansible-advbet/ansible.cfg) = False
MAX_FILE_SIZE_FOR_DIFF(/home/nerijus/ansible-advbet/ansible.cfg) = 0

OS / Environment

Fedora 36

Steps to Reproduce

- name: Modify root volume
  local_action:
    module: ec2_vol
    region: "{{ region }}"
    modify_volume: yes
    instance: "{{ instance_id }}"
    name: "{{ ec2_name }}"
    volume_type: "{{ volume_type }}"
    iops: "{{ volume_iops | default(3000) }}"
    throughput: "{{ volume_throughput }}"

Expected Results

It should not error.

Actual Results

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 Sep 26, 2022
@GomathiselviS GomathiselviS self-assigned this Sep 27, 2022
softwarefactory-project-zuul bot pushed a commit that referenced this issue Oct 5, 2022
Handle ec2_vol.tags when the associated instance already exists

Signed-off-by: GomathiselviS [email protected]
SUMMARY


Fixes #1067
ISSUE TYPE


Bugfix Pull Request

COMPONENT NAME

ec2_vol.py
ADDITIONAL INFORMATION

Reviewed-by: Mark Chappell <None>
Reviewed-by: Alina Buzachis <None>
Reviewed-by: GomathiselviS <None>
Reviewed-by: Mike Graves <[email protected]>
Reviewed-by: Gonéri Le Bouder <[email protected]>
patchback bot pushed a commit that referenced this issue Mar 13, 2023
Handle ec2_vol.tags when the associated instance already exists

Signed-off-by: GomathiselviS [email protected]
SUMMARY

Fixes #1067
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME

ec2_vol.py
ADDITIONAL INFORMATION

Reviewed-by: Mark Chappell <None>
Reviewed-by: Alina Buzachis <None>
Reviewed-by: GomathiselviS <None>
Reviewed-by: Mike Graves <[email protected]>
Reviewed-by: Gonéri Le Bouder <[email protected]>
(cherry picked from commit ffd06e9)
patchback bot pushed a commit that referenced this issue Mar 13, 2023
Handle ec2_vol.tags when the associated instance already exists

Signed-off-by: GomathiselviS [email protected]
SUMMARY

Fixes #1067
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME

ec2_vol.py
ADDITIONAL INFORMATION

Reviewed-by: Mark Chappell <None>
Reviewed-by: Alina Buzachis <None>
Reviewed-by: GomathiselviS <None>
Reviewed-by: Mike Graves <[email protected]>
Reviewed-by: Gonéri Le Bouder <[email protected]>
(cherry picked from commit ffd06e9)
softwarefactory-project-zuul bot pushed a commit that referenced this issue Mar 13, 2023
… (#1423)

[PR #1071/ffd06e97 backport][stable-5] Handle ec2_vol.tags when the associated instance already exists

This is a backport of PR #1071 as merged into main (ffd06e9).
Signed-off-by: GomathiselviS [email protected]
SUMMARY


Fixes #1067
Fixes: #1421
ISSUE TYPE


Bugfix Pull Request

COMPONENT NAME

ec2_vol.py
ADDITIONAL INFORMATION

Reviewed-by: Mark Chappell
softwarefactory-project-zuul bot pushed a commit that referenced this issue Mar 13, 2023
… (#1424)

[PR #1071/ffd06e97 backport][stable-4] Handle ec2_vol.tags when the associated instance already exists

This is a backport of PR #1071 as merged into main (ffd06e9).
Signed-off-by: GomathiselviS [email protected]
SUMMARY


Fixes #1067
ISSUE TYPE


Bugfix Pull Request

COMPONENT NAME

ec2_vol.py
ADDITIONAL INFORMATION

Reviewed-by: Mark Chappell
abikouo pushed a commit to abikouo/amazon.aws that referenced this issue Oct 24, 2023
…ansible-collections#1067)

In integration tests use a common AMI rather than hard coded per test

Depends-On: ansible-collections#1068
SUMMARY
Rather than hard coding the AMIs on a per-test basis, use a common AMI defined in setup_ec2_facts
ISSUE TYPE

Feature Pull Request

COMPONENT NAME
ec2_asg_instance_refresh
ec2_asg_lifecycle_hook
ec2_asg_scheduled_action
ec2_launch_template
ec2_lc
ec2_metric_alarm
ec2_scaling_policy
elb_network_lb
elb_target
elb_target_info
ADDITIONAL INFORMATION

Reviewed-by: Markus Bergholz <[email protected]>
Reviewed-by: Jill R <None>
abikouo pushed a commit to abikouo/amazon.aws that referenced this issue Oct 18, 2024
…ansible-collections#1067)

In integration tests use a common AMI rather than hard coded per test

Depends-On: ansible-collections#1068
SUMMARY
Rather than hard coding the AMIs on a per-test basis, use a common AMI defined in setup_ec2_facts
ISSUE TYPE

Feature Pull Request

COMPONENT NAME
ec2_asg_instance_refresh
ec2_asg_lifecycle_hook
ec2_asg_scheduled_action
ec2_launch_template
ec2_lc
ec2_metric_alarm
ec2_scaling_policy
elb_network_lb
elb_target
elb_target_info
ADDITIONAL INFORMATION

Reviewed-by: Markus Bergholz <[email protected]>
Reviewed-by: Jill R <None>

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@3f434f3
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 plugins plugin (any type) python3 traceback
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants