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_snapshot, ec2_snapshot_info: Add support to modify snapshot share permissions #1464

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
make linter happy, add changelog fragment
mandar242 committed May 5, 2023
commit 9234548368e791d90347afe29b4d10035ae08cf5
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
minor_changes:
- ec2_snapshot - Add support for modifying createVolumePermission (https://github.com/ansible-collections/amazon.aws/pull/1464).
- ec2_snapshot_info - Add createVolumePermission to output result (https://github.com/ansible-collections/amazon.aws/pull/1464).
10 changes: 5 additions & 5 deletions plugins/modules/ec2_snapshot_info.py
Original file line number Diff line number Diff line change
@@ -252,11 +252,11 @@ def get_snapshots(connection, module, request_args):

def _describe_snapshot_attribute(module, ec2, snapshot_id):
try:
response = ec2.describe_snapshot_attribute(Attribute='createVolumePermission', SnapshotId=snapshot_id)
response = ec2.describe_snapshot_attribute(Attribute="createVolumePermission", SnapshotId=snapshot_id)
except (BotoCoreError, ClientError) as e: # pylint: disable=duplicate-except
module.fail_json_aws(e, msg="Failed to describe snapshot attribute createVolumePermission")

return response['CreateVolumePermissions']
return response["CreateVolumePermissions"]


def list_ec2_snapshots(connection, module, request_args):
@@ -268,10 +268,10 @@ def list_ec2_snapshots(connection, module, request_args):
result = {}

# Add createVolumePermission info to snapshots result
for snapshot in snapshots['Snapshots']:
snapshot_id = snapshot.get('SnapshotId')
for snapshot in snapshots["Snapshots"]:
snapshot_id = snapshot.get("SnapshotId")
create_vol_permission = _describe_snapshot_attribute(module, connection, snapshot_id)
snapshot['CreateVolumePermissions'] = create_vol_permission
snapshot["CreateVolumePermissions"] = create_vol_permission

# Turn the boto3 result in to ansible_friendly_snaked_names
snaked_snapshots = []