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 - changing volume type from a type without IOPS (like standard) to one with (like gp3) raises exception #626

Closed
1 task done
briantist opened this issue Jan 20, 2022 · 0 comments · Fixed by #627

Comments

@briantist
Copy link
Contributor

Summary

I was trying to modify some existing standard volumes (system disks on existing instances) to gp3, and ec2_vol raised KeyError exceptions as it was trying to query the IOPS from the original volumes.

Issue Type

Bug Report

Component Name

ec2_vol

Ansible Version

$ ansible --version
ansible [core 2.11.7]
  config file = /home/briantist/code/flan/ansible.cfg
  configured module search path = ['/home/briantist/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/briantist/.a211/lib/python3.6/site-packages/ansible
  ansible collection location = /home/briantist/.ansible/collections
  executable location = /home/briantist/.a211/bin/ansible
  python version = 3.6.9 (default, Jan 26 2021, 15:33:00) [GCC 8.4.0]
  jinja version = 3.0.1
  libyaml = True

Collection Versions

$ ansible-galaxy collection list
Collection        Version
----------------- -------
amazon.aws        3.0.0
ansible.posix     1.2.0
community.aws     3.0.1
community.crypto  1.7.1
community.docker  1.7.0
community.general 3.3.2

AWS SDK versions

$ pip show boto boto3 botocore
WARNING: Package(s) not found: boto
Name: boto3
Version: 1.18.60
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: /home/briantist/.a211/lib/python3.6/site-packages
Requires: s3transfer, jmespath, botocore
Required-by:
---
Name: botocore
Version: 1.21.60
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: /home/briantist/.a211/lib/python3.6/site-packages
Requires: jmespath, python-dateutil, urllib3
Required-by: s3transfer, boto3

Configuration

$ ansible-config dump --only-changed
DEFAULT_FORKS(env: ANSIBLE_FORKS) = 30

OS / Environment

Ubuntu 18.04 (WSLv2)

Steps to Reproduce

      amazon.aws.ec2_vol:
        name: "{{ item.tags['Name'] | default(omit) }}"
        instance: "{{ current_instance.instance_id }}"
        device_name: "{{ item.device_mapping.device_name | mandatory }}"
        volume_type: "{{ item.device_mapping.ebs.volume_type | default(omit) }}"
        volume_size: "{{ item.device_mapping.ebs.volume_size | default(omit) }}"
        iops: "{{ item.device_mapping.ebs.iops | default(omit) }}"
        throughput: "{{ item.device_mapping.ebs.throughput | default(omit) }}"
        encrypted: "{{ item.device_mapping.ebs.encrypted | default(omit) }}"
        delete_on_termination: "{{ item.device_mapping.ebs.delete_on_termination | default(omit) }}"
        modify_volume: '{{ aws_modify_existing_ebs_volumes | default(true) }}'
        tags: "{{ item.tags | default(omit) }}"
      loop: "{{
          (
            ec2_launch_volumes
            | default([])
          ) + (
            ec2_provision_volumes
            | default(False)
            | bool
            | ternary(
              ec2_volumes
              | default([]), []
            )
          )
        }}"

Some of this relies on retrieving existing instance info, but the scenario is: existing instance with standard type EBS volume on the system disk, and I'm asking ec2_vol to make it gp3 with iops: 3000 and throughput: 125.

Expected Results

success

Actual Results

The full traceback is:
Traceback (most recent call last):
  File "/home/briantist/.ansible/tmp/ansible-tmp-1642693430.621672-18951-816662666959/AnsiballZ_ec2_vol.py", line 100, in <module>
    _ansiballz_main()
  File "/home/briantist/.ansible/tmp/ansible-tmp-1642693430.621672-18951-816662666959/AnsiballZ_ec2_vol.py", line 92, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "/home/briantist/.ansible/tmp/ansible-tmp-1642693430.621672-18951-816662666959/AnsiballZ_ec2_vol.py", line 41, in invoke_module
    run_name='__main__', alter_sys=True)
  File "/usr/lib/python3.6/runpy.py", line 205, in run_module
    return _run_module_code(code, init_globals, run_name, mod_spec)
  File "/usr/lib/python3.6/runpy.py", line 96, in _run_module_code
    mod_name, mod_spec, pkg_name, script_name)
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/tmp/ansible_amazon.aws.ec2_vol_payload_mms2zmfl/ansible_amazon.aws.ec2_vol_payload.zip/ansible_collections/amazon/aws/plugins/modules/ec2_vol.py", line 878, in <module>
  File "/tmp/ansible_amazon.aws.ec2_vol_payload_mms2zmfl/ansible_amazon.aws.ec2_vol_payload.zip/ansible_collections/amazon/aws/plugins/modules/ec2_vol.py", line 844, in main
  File "/tmp/ansible_amazon.aws.ec2_vol_payload_mms2zmfl/ansible_amazon.aws.ec2_vol_payload.zip/ansible_collections/amazon/aws/plugins/modules/ec2_vol.py", line 385, in update_volume
KeyError: 'iops'

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
ansible-zuul bot pushed a commit that referenced this issue Jan 26, 2022
#627)

`ec2_vol` - support changing from volume without IOPS to one with IOPS

SUMMARY

Fixes #626
Changing from standard volume type to gp3 failed when the module was trying to read the "original" IOPS value from the existing volume, since it doesn't have one.
See the linked issue for detailed description.

ISSUE TYPE


Bugfix Pull Request

COMPONENT NAME

ec2_vol
ADDITIONAL INFORMATION



N/A

Reviewed-by: Markus Bergholz <git@osuv.de>
Reviewed-by: Alina Buzachis <None>
Reviewed-by: None <None>
patchback bot pushed a commit that referenced this issue Jan 26, 2022
#627)

`ec2_vol` - support changing from volume without IOPS to one with IOPS

SUMMARY

Fixes #626
Changing from standard volume type to gp3 failed when the module was trying to read the "original" IOPS value from the existing volume, since it doesn't have one.
See the linked issue for detailed description.

ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME

ec2_vol
ADDITIONAL INFORMATION

N/A

Reviewed-by: Markus Bergholz <git@osuv.de>
Reviewed-by: Alina Buzachis <None>
Reviewed-by: None <None>
(cherry picked from commit a9b9bd1)
softwarefactory-project-zuul bot pushed a commit that referenced this issue Feb 9, 2022
#627) (#640)

[PR #627/a9b9bd13 backport][stable-2] `ec2_vol` - support changing from volume without IOPS to one with IOPS

This is a backport of PR #627 as merged into main (a9b9bd1).
SUMMARY

Fixes #626
Changing from standard volume type to gp3 failed when the module was trying to read the "original" IOPS value from the existing volume, since it doesn't have one.
See the linked issue for detailed description.

ISSUE TYPE


Bugfix Pull Request

COMPONENT NAME

ec2_vol
ADDITIONAL INFORMATION



N/A

Reviewed-by: Jill R <None>
alinabuzachis pushed a commit to alinabuzachis/amazon.aws that referenced this issue Feb 18, 2022
ansible-collections#627) (ansible-collections#640)

[PR ansible-collections#627/a9b9bd13 backport][stable-2] `ec2_vol` - support changing from volume without IOPS to one with IOPS

This is a backport of PR ansible-collections#627 as merged into main (a9b9bd1).
SUMMARY

Fixes ansible-collections#626
Changing from standard volume type to gp3 failed when the module was trying to read the "original" IOPS value from the existing volume, since it doesn't have one.
See the linked issue for detailed description.

ISSUE TYPE


Bugfix Pull Request

COMPONENT NAME

ec2_vol
ADDITIONAL INFORMATION



N/A

Reviewed-by: Jill R <None>
alinabuzachis pushed a commit to alinabuzachis/amazon.aws that referenced this issue Feb 18, 2022
ansible-collections#627)

`ec2_vol` - support changing from volume without IOPS to one with IOPS

SUMMARY

Fixes ansible-collections#626
Changing from standard volume type to gp3 failed when the module was trying to read the "original" IOPS value from the existing volume, since it doesn't have one.
See the linked issue for detailed description.

ISSUE TYPE


Bugfix Pull Request

COMPONENT NAME

ec2_vol
ADDITIONAL INFORMATION



N/A

Reviewed-by: Markus Bergholz <git@osuv.de>
Reviewed-by: Alina Buzachis <None>
Reviewed-by: None <None>
softwarefactory-project-zuul bot pushed a commit that referenced this issue Feb 22, 2022
#627) (#687)

ec2_vol - support changing from volume without IOPS to one with IOPS

ec2_vol - support changing from volume without IOPS to one with IOPS
Backport of PR #627 as merged into main (a9b9bd1) to stable-3 as well (it was originally only backported to stable-2).
SUMMARY
Fixes #626
Changing from standard volume type to gp3 failed when the module was trying to read the "original" IOPS value from the existing volume, since it doesn't have one.
See the linked issue for detailed description.
ISSUE TYPE
Bugfix Pull Request
COMPONENT NAME
ec2_vol
ADDITIONAL INFORMATION
N/A
Reviewed-by: Jill R 
SUMMARY


ISSUE TYPE


Bugfix Pull Request
Docs Pull Request
Feature Pull Request
New Module Pull Request

COMPONENT NAME

ADDITIONAL INFORMATION

Reviewed-by: Felix Fontein <felix@fontein.de>
Reviewed-by: Markus Bergholz <git@osuv.de>
abikouo pushed a commit to abikouo/amazon.aws that referenced this issue Sep 18, 2023
…#1370)

New module - accessanalyzer_validate_policy_info

SUMMARY
fixes: ansible-collections#626
Adds a module which supports validating and linting IAM policies
ISSUE TYPE

New Module Pull Request

COMPONENT NAME
plugins/modules/accessanalyzer_validate_policy_info.py
ADDITIONAL INFORMATION

Reviewed-by: Alina Buzachis <None>
abikouo pushed a commit to abikouo/amazon.aws that referenced this issue Sep 18, 2023
…#1370)

New module - accessanalyzer_validate_policy_info

SUMMARY
fixes: ansible-collections#626
Adds a module which supports validating and linting IAM policies
ISSUE TYPE

New Module Pull Request

COMPONENT NAME
plugins/modules/accessanalyzer_validate_policy_info.py
ADDITIONAL INFORMATION

Reviewed-by: Alina Buzachis <None>
abikouo pushed a commit to abikouo/amazon.aws that referenced this issue Oct 24, 2023
…#1370)

New module - accessanalyzer_validate_policy_info

SUMMARY
fixes: ansible-collections#626
Adds a module which supports validating and linting IAM policies
ISSUE TYPE

New Module Pull Request

COMPONENT NAME
plugins/modules/accessanalyzer_validate_policy_info.py
ADDITIONAL INFORMATION

Reviewed-by: Alina Buzachis <None>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant