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 module errors out when using modify_volume option about 'size' #471

Closed
1 task done
CptLolliPants opened this issue Aug 25, 2021 · 2 comments · Fixed by #479
Closed
1 task done

ec2_vol module errors out when using modify_volume option about 'size' #471

CptLolliPants opened this issue Aug 25, 2021 · 2 comments · Fixed by #479
Assignees
Labels
bug This issue/PR relates to a bug module module plugins plugin (any type) python3 traceback

Comments

@CptLolliPants
Copy link

Summary

When you try to modify a exiting AWS volume attached to a running instance, withj the option modify_volume: true, you get this error:

Unknown parameter in input: "size", must be one of: DryRun, VolumeId, Size, VolumeType, Iops, Throughput, MultiAttachEnabled

The problem appears to be in de update_volume function in ec2_vol.py where it says: req_obj['size'] = target_size.

If you change this in req_obj['Size'] = target_size, everything works fine.

I noticed the change in the main branch, but have not found it in the current 1.5.0 release

Issue Type

Bug Report

Component Name

ec2_vol

Ansible Version

ansible 2.9.10
  config file = /home/user/ansible/ansible-test/ansible.cfg
  configured module search path = ['/home/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/user/.local/lib/python3.8/site-packages/ansible
  executable location = /home/user/.local/bin/ansible
  python version = 3.8.5 (default, May 27 2021, 13:30:53) [GCC 9.3.0]

Collection Versions

amazon.aws 1.4.1 #(also tried 1.5.0)

AWS SDK versions

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/local/lib/python3.8/dist-packages
Requires:
Required-by:
---
Name: boto3
Version: 1.17.4
Summary: The AWS SDK for Python
Home-page: https://github.com/boto/boto3
Author: Amazon Web Services
Author-email: None
License: Apache License 2.0
Location: /usr/local/lib/python3.8/dist-packages
Requires: s3transfer, jmespath, botocore
Required-by:
---
Name: botocore
Version: 1.20.4
Summary: Low-level, data-driven core of boto 3.
Home-page: https://github.com/boto/botocore
Author: Amazon Web Services
Author-email: None
License: Apache License 2.0
Location: /usr/local/lib/python3.8/dist-packages
Requires: jmespath, python-dateutil, urllib3
Required-by: s3transfer, boto3, awscli

Configuration

none

OS / Environment

Ubuntu 20.04

Steps to Reproduce

- name: modify volume of instance
  amazon.aws.ec2_vol:
    modify_volume: true
    aws_access_key: "{{ aws_iam_deploy_key }}"
    aws_secret_key: "{{ aws_iam_deploy_secret }}"
    instance: "{{ instance_id }}"
    name: "{{ inventory_hostname }}_data_volume_1"
    volume_size: 10
    device_name: /dev/xvdf
    aws_region: eu-west-1

Expected Results

I expected to increase the existing volume

Actual Results

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: Unknown parameter in input: "size", must be one of: DryRun, VolumeId, Size, VolumeType, Iops, Throughput, MultiAttachEnabled
fatal: [test-sjoerd-01]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n  File \"/home/sjoerd/.ansible/tmp/ansible-tmp-1629896709.667519-16865-53038063967578/AnsiballZ_ec2_vol.py\", line 102, in <module>\n    _ansiballz_main()\n  File \"/home/sjoerd/.ansible/tmp/ansible-tmp-1629896709.667519-16865-53038063967578/AnsiballZ_ec2_vol.py\", line 94, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/home/sjoerd/.ansible/tmp/ansible-tmp-1629896709.667519-16865-53038063967578/AnsiballZ_ec2_vol.py\", line 40, in invoke_module\n    runpy.run_module(mod_name='ansible_collections.amazon.aws.plugins.modules.ec2_vol', init_globals=None, run_name='__main__', alter_sys=True)\n  File \"/usr/lib/python3.8/runpy.py\", line 207, in run_module\n    return _run_module_code(code, init_globals, run_name, mod_spec)\n  File \"/usr/lib/python3.8/runpy.py\", line 97, in _run_module_code\n    _run_code(code, mod_globals, init_globals,\n  File \"/usr/lib/python3.8/runpy.py\", line 87, in _run_code\n    exec(code, run_globals)\n  File \"/tmp/ansible_amazon.aws.ec2_vol_payload_w1_zkwi7/ansible_amazon.aws.ec2_vol_payload.zip/ansible_collections/amazon/aws/plugins/modules/ec2_vol.py\", line 809, in <module>\n  File \"/tmp/ansible_amazon.aws.ec2_vol_payload_w1_zkwi7/ansible_amazon.aws.ec2_vol_payload.zip/ansible_collections/amazon/aws/plugins/modules/ec2_vol.py\", line 782, in main\n  File \"/tmp/ansible_amazon.aws.ec2_vol_payload_w1_zkwi7/ansible_amazon.aws.ec2_vol_payload.zip/ansible_collections/amazon/aws/plugins/modules/ec2_vol.py\", line 398, in update_volume\n  File \"/tmp/ansible_amazon.aws.ec2_vol_payload_w1_zkwi7/ansible_amazon.aws.ec2_vol_payload.zip/ansible_collections/amazon/aws/plugins/module_utils/core.py\", line 289, in deciding_wrapper\n  File \"/usr/local/lib/python3.8/dist-packages/botocore/client.py\", line 357, in _api_call\n    return self._make_api_call(operation_name, kwargs)\n  File \"/usr/local/lib/python3.8/dist-packages/botocore/client.py\", line 648, in _make_api_call\n    request_dict = self._convert_to_request_dict(\n  File \"/usr/local/lib/python3.8/dist-packages/botocore/client.py\", line 696, in _convert_to_request_dict\n    request_dict = self._serializer.serialize_to_request(\n  File \"/usr/local/lib/python3.8/dist-packages/botocore/validate.py\", line 293, in serialize_to_request\n    raise ParamValidationError(report=report.generate_report())\nbotocore.exceptions.ParamValidationError: Parameter validation failed:\nUnknown parameter in input: \"size\", must be one of: DryRun, VolumeId, Size, VolumeType, Iops, Throughput, MultiAttachEnabled\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

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 Aug 25, 2021
@mandar242 mandar242 self-assigned this Aug 27, 2021
ansible-zuul bot pushed a commit that referenced this issue Sep 9, 2021
#371) (#479)

ec2_vol: backport to stable-1.5 to fix modify_volume size option bug

SUMMARY

Back port to stable-1.5 to fix a bug in  modify_volume, 'size' option.

Fixes #471.
ISSUE TYPE


Bugfix Pull Request

COMPONENT NAME

ec2_vol
ADDITIONAL INFORMATION



Required fix was done but was not applied in 1.5.0 release.
For more details, please visit #471.

Backports: #371
Depends-On: #491

Reviewed-by: Jill R <None>
Reviewed-by: Alina Buzachis <None>
Reviewed-by: None <None>
abikouo pushed a commit to abikouo/amazon.aws that referenced this issue Sep 18, 2023
* More no_log changes
* changelog
abikouo pushed a commit to abikouo/amazon.aws that referenced this issue Sep 18, 2023
* More no_log changes
* changelog
abikouo pushed a commit to abikouo/amazon.aws that referenced this issue Oct 24, 2023
* More no_log changes
* changelog
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 module module plugins plugin (any type) python3 traceback
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants