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_info now returns attachment_set dict wrapped in a list #515

Closed
1 task done
bradmacpherson opened this issue Sep 30, 2021 · 3 comments · Fixed by #518
Closed
1 task done

ec2_vol_info now returns attachment_set dict wrapped in a list #515

bradmacpherson opened this issue Sep 30, 2021 · 3 comments · Fixed by #518
Labels
bug This issue/PR relates to a bug has_pr module module plugins plugin (any type) python3

Comments

@bradmacpherson
Copy link

bradmacpherson commented Sep 30, 2021

Summary

When retrieving EC2 volume info, each volume's attachment_set dict is now being returned as a list containing that dict:

        {
             "attachment_set": [
                 {
                     "attach_time": "2021-09-28T19:27:49+00:00",
                     "delete_on_termination": false,
                     "device": "/dev/sdf",
                     "instance_id": "i-0c52a5600a4612cf6",
                     "status": "attached"
                 }
             ],
             "create_time": "2021-09-28T19:27:50.149000+00:00",
             "encrypted": true,
             "id": "vol-01796edb351564fda",
             "iops": 405,
             "region": "us-east-1",
             "size": 135,
             "snapshot_id": "snap-0dc5141ce65add8be",
             "status": "in-use",
             "tags": {
                 "Name": "sierratstue1-db",
                 "Patch Group": "Group 2"
             },
             "type": "gp2",
             "zone": "us-east-1a"
         },

Should be this:

        {
             "attachment_set": {
                 "attach_time": "2021-09-28T19:27:49+00:00",
                 "delete_on_termination": false,
                 "device": "/dev/sdf",
                 "instance_id": "i-0c52a5600a4612cf6",
                 "status": "attached"
             },
             "create_time": "2021-09-28T19:27:50.149000+00:00",
             "encrypted": true,
             "id": "vol-01796edb351564fda",
             "iops": 405,
             "region": "us-east-1",
             "size": 135,
             "snapshot_id": "snap-0dc5141ce65add8be",
             "status": "in-use",
             "tags": {
                 "Name": "sierratstue1-db",
                 "Patch Group": "Group 2"
             },
             "type": "gp2",
             "zone": "us-east-1a"
         },

Issue Type

Bug Report

Component Name

ec2_vol_info

Ansible Version

#16 1.185 ansible 2.10.2
#16 1.185   config file = None
#16 1.185   configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
#16 1.185   ansible python module location = /usr/lib/python3.7/site-packages/ansible
#16 1.185   executable location = /usr/lib/python-exec/python3.7/ansible
#16 1.185   python version = 3.7.9 (default, Dec  8 2020, 22:03:16) [GCC 9.3.0]

Collection Versions

#16 1.994 # /root/.ansible/collections/ansible_collections
#16 1.994 Collection        Version
#16 1.994 ----------------- -------
#16 1.994 amazon.aws        1.5.0  
#16 1.994 ansible.netcommon 1.5.0  
#16 1.995 community.general 3.2.0 

AWS SDK versions

#16 2.419 Name: boto
#16 2.419 Version: 2.49.0
#16 2.420 Summary: Amazon Web Services Library
#16 2.420 Home-page: https://github.com/boto/boto/
#16 2.420 Author: Mitch Garnaat
#16 2.420 Author-email: [email protected]
#16 2.420 License: MIT
#16 2.421 Location: /usr/lib/python3.7/site-packages
#16 2.421 Requires: 
#16 2.421 Required-by: 
#16 2.422 ---
#16 2.423 Name: boto3
#16 2.423 Version: 1.14.59
#16 2.423 Summary: The AWS SDK for Python
#16 2.423 Home-page: https://github.com/boto/boto3
#16 2.424 Author: Amazon Web Services
#16 2.424 Author-email: UNKNOWN
#16 2.425 License: Apache License 2.0
#16 2.425 Location: /usr/lib/python3.7/site-packages
#16 2.425 Requires: 
#16 2.425 Required-by: 
#16 2.426 ---
#16 2.427 Name: botocore
#16 2.427 Version: 1.17.59
#16 2.427 Summary: Low-level, data-driven core of boto 3.
#16 2.427 Home-page: https://github.com/boto/botocore
#16 2.428 Author: Amazon Web Services
#16 2.428 Author-email: UNKNOWN
#16 2.428 License: Apache License 2.0
#16 2.428 Location: /usr/lib/python3.7/site-packages
#16 2.429 Requires: jmespath, docutils, python-dateutil, urllib3
#16 2.429 Required-by: s3transfer

Configuration

No response

OS / Environment

Built on Gentoo Linux

Steps to Reproduce

- name: "Gather already-attached volume facts"
  local_action:
    module: amazon.aws.ec2_vol_info
    region: "{{ ec2_region }}"
    filters:
      attachment.instance-id: "{{ ec2_vm_id }}"
  register: _volume_facts

Expected Results

I would expect a data structure like this:

        {
             "attachment_set": {
                 "attach_time": "2021-09-28T19:27:49+00:00",
                 "delete_on_termination": false,
                 "device": "/dev/sdf",
                 "instance_id": "i-0c52a5600a4612cf6",
                 "status": "attached"
             },
             "create_time": "2021-09-28T19:27:50.149000+00:00",
             "encrypted": true,
             "id": "vol-01796edb351564fda",
             "iops": 405,
             "region": "us-east-1",
             "size": 135,
             "snapshot_id": "snap-0dc5141ce65add8be",
             "status": "in-use",
             "tags": {
                 "Name": "sierratstue1-db",
                 "Patch Group": "Group 2"
             },
             "type": "gp2",
             "zone": "us-east-1a"
         },

Actual Results

        {
             "attachment_set": [
                 {
                     "attach_time": "2021-09-28T19:27:49+00:00",
                     "delete_on_termination": false,
                     "device": "/dev/sdf",
                     "instance_id": "i-0c52a5600a4612cf6",
                     "status": "attached"
                 }
             ],
             "create_time": "2021-09-28T19:27:50.149000+00:00",
             "encrypted": true,
             "id": "vol-01796edb351564fda",
             "iops": 405,
             "region": "us-east-1",
             "size": 135,
             "snapshot_id": "snap-0dc5141ce65add8be",
             "status": "in-use",
             "tags": {
                 "Name": "sierratstue1-db",
                 "Patch Group": "Group 2"
             },
             "type": "gp2",
             "zone": "us-east-1a"
         },

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 labels Sep 30, 2021
@tremble
Copy link
Contributor

tremble commented Oct 1, 2021

Hi @bradmacpherson,

Thanks for this report. This change was introduced in version 2.0.0 to support multi-attachment disks. While it's documented in the changelog as a 'breaking change', we forgot to update the module documentation.

https://github.com/ansible-collections/amazon.aws/blob/main/CHANGELOG.rst#breaking-changes-porting-guide

ansible-zuul bot pushed a commit that referenced this issue Oct 1, 2021
Doc fix ec2_vol_info

SUMMARY

attachment_set has always be returned as a list of dictionaries, but the module documented it as a dictionary instead. Let's fix this documentation mismatch.
"attachment_set": [{
            "attach_time": "2015-10-23T00:22:29.000Z",
            "deleteOnTermination": "false",
            "device": "/dev/sdf",
            "instance_id": "i-8356263c",
            "status": "attached"
        }]

Fixes: #515

ISSUE TYPE


Docs Pull Request

COMPONENT NAME

ec2_vol_info

Reviewed-by: Mark Chappell <None>
Reviewed-by: Alina Buzachis <None>
Reviewed-by: None <None>
alinabuzachis pushed a commit to alinabuzachis/amazon.aws that referenced this issue Sep 9, 2022
* rds_instance - fix test syntax - test_read_replica.yml
* Note that rds_instance tests are slow
* add rds_snapshot to aws group
* changelog

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@1722d02
alinabuzachis pushed a commit to alinabuzachis/amazon.aws that referenced this issue Sep 9, 2022
* rds_instance - fix test syntax - test_read_replica.yml
* Note that rds_instance tests are slow
* add rds_snapshot to aws group
* changelog

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@1722d02
alinabuzachis pushed a commit to alinabuzachis/amazon.aws that referenced this issue Sep 9, 2022
* rds_instance - fix test syntax - test_read_replica.yml
* Note that rds_instance tests are slow
* add rds_snapshot to aws group
* changelog

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@1722d02
alinabuzachis pushed a commit to alinabuzachis/amazon.aws that referenced this issue Sep 9, 2022
* rds_instance - fix test syntax - test_read_replica.yml
* Note that rds_instance tests are slow
* add rds_snapshot to aws group
* changelog

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@1722d02
alinabuzachis pushed a commit to alinabuzachis/amazon.aws that referenced this issue Sep 16, 2022
* rds_instance - fix test syntax - test_read_replica.yml
* Note that rds_instance tests are slow
* add rds_snapshot to aws group
* changelog

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@1722d02
goneri pushed a commit to alinabuzachis/amazon.aws that referenced this issue Sep 21, 2022
* rds_instance - fix test syntax - test_read_replica.yml
* Note that rds_instance tests are slow
* add rds_snapshot to aws group
* changelog

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@1722d02
goneri pushed a commit to alinabuzachis/amazon.aws that referenced this issue Sep 21, 2022
* rds_instance - fix test syntax - test_read_replica.yml
* Note that rds_instance tests are slow
* add rds_snapshot to aws group
* changelog

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@1722d02
goneri pushed a commit to alinabuzachis/amazon.aws that referenced this issue Sep 21, 2022
* rds_instance - fix test syntax - test_read_replica.yml
* Note that rds_instance tests are slow
* add rds_snapshot to aws group
* changelog

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@1722d02
goneri pushed a commit to alinabuzachis/amazon.aws that referenced this issue Sep 21, 2022
* rds_instance - fix test syntax - test_read_replica.yml
* Note that rds_instance tests are slow
* add rds_snapshot to aws group
* changelog

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@1722d02
goneri pushed a commit to alinabuzachis/amazon.aws that referenced this issue Sep 21, 2022
* rds_instance - fix test syntax - test_read_replica.yml
* Note that rds_instance tests are slow
* add rds_snapshot to aws group
* changelog

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@1722d02
goneri pushed a commit to alinabuzachis/amazon.aws that referenced this issue Sep 21, 2022
* rds_instance - fix test syntax - test_read_replica.yml
* Note that rds_instance tests are slow
* add rds_snapshot to aws group
* changelog

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@1722d02
abikouo pushed a commit to abikouo/amazon.aws that referenced this issue Oct 24, 2023
* rds_instance - fix test syntax - test_read_replica.yml
* Note that rds_instance tests are slow
* add rds_snapshot to aws group
* 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 has_pr module module plugins plugin (any type) python3
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants