diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-18 05:52:22 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-18 05:52:22 +0000 |
commit | 38b7c80217c4e72b1d8988eb1e60bb6e77334114 (patch) | |
tree | 356e9fd3762877d07cde52d21e77070aeff7e789 /ansible_collections/amazon/aws/plugins/callback | |
parent | Adding upstream version 7.7.0+dfsg. (diff) | |
download | ansible-38b7c80217c4e72b1d8988eb1e60bb6e77334114.tar.xz ansible-38b7c80217c4e72b1d8988eb1e60bb6e77334114.zip |
Adding upstream version 9.4.0+dfsg.upstream/9.4.0+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ansible_collections/amazon/aws/plugins/callback')
-rw-r--r-- | ansible_collections/amazon/aws/plugins/callback/aws_resource_actions.py | 42 |
1 files changed, 17 insertions, 25 deletions
diff --git a/ansible_collections/amazon/aws/plugins/callback/aws_resource_actions.py b/ansible_collections/amazon/aws/plugins/callback/aws_resource_actions.py index 551a866a3..fa3a155ff 100644 --- a/ansible_collections/amazon/aws/plugins/callback/aws_resource_actions.py +++ b/ansible_collections/amazon/aws/plugins/callback/aws_resource_actions.py @@ -1,11 +1,9 @@ +# -*- coding: utf-8 -*- + # (C) 2018 Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -# Make coding more python3-ish -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -DOCUMENTATION = ''' +DOCUMENTATION = """ name: aws_resource_actions type: aggregate short_description: summarizes all "resource:actions" completed @@ -15,43 +13,37 @@ DOCUMENTATION = ''' be done easily by setting debug_botocore_endpoint_logs to True for group/aws using module_defaults. requirements: - whitelisting in configuration - see examples section below for details. -''' +""" -EXAMPLES = ''' +EXAMPLES = """ example: > To enable, add this to your ansible.cfg file in the defaults block [defaults] callback_whitelist = aws_resource_actions sample output: > -# -# AWS ACTIONS: ['s3:PutBucketAcl', 's3:HeadObject', 's3:DeleteObject', 's3:PutObjectAcl', 's3:CreateMultipartUpload', -# 's3:DeleteBucket', 's3:GetObject', 's3:DeleteObjects', 's3:CreateBucket', 's3:CompleteMultipartUpload', -# 's3:ListObjectsV2', 's3:HeadBucket', 's3:UploadPart', 's3:PutObject'] -# -sample output: > -# -# AWS ACTIONS: ['ec2:DescribeVpcAttribute', 'ec2:DescribeVpcClassicLink', 'ec2:ModifyVpcAttribute', 'ec2:CreateTags', -# 'sts:GetCallerIdentity', 'ec2:DescribeSecurityGroups', 'ec2:DescribeTags', 'ec2:DescribeVpcs', 'ec2:CreateVpc'] -# -''' + # + # AWS ACTIONS: ['s3:PutBucketAcl', 's3:HeadObject', 's3:DeleteObject', 's3:PutObjectAcl', 's3:CreateMultipartUpload', + # 's3:DeleteBucket', 's3:GetObject', 's3:DeleteObjects', 's3:CreateBucket', 's3:CompleteMultipartUpload', + # 's3:ListObjectsV2', 's3:HeadBucket', 's3:UploadPart', 's3:PutObject'] +""" -from ansible.plugins.callback import CallbackBase from ansible.module_utils._text import to_native +from ansible.plugins.callback import CallbackBase class CallbackModule(CallbackBase): CALLBACK_VERSION = 2.8 - CALLBACK_TYPE = 'aggregate' - CALLBACK_NAME = 'amazon.aws.aws_resource_actions' + CALLBACK_TYPE = "aggregate" + CALLBACK_NAME = "amazon.aws.aws_resource_actions" CALLBACK_NEEDS_WHITELIST = True def __init__(self): self.aws_resource_actions = [] - super(CallbackModule, self).__init__() + super().__init__() def extend_aws_resource_actions(self, result): - if result.get('resource_actions'): - self.aws_resource_actions.extend(result['resource_actions']) + if result.get("resource_actions"): + self.aws_resource_actions.extend(result["resource_actions"]) def runner_on_ok(self, host, res): self.extend_aws_resource_actions(res) @@ -68,4 +60,4 @@ class CallbackModule(CallbackBase): def playbook_on_stats(self, stats): if self.aws_resource_actions: self.aws_resource_actions = sorted(list(to_native(action) for action in set(self.aws_resource_actions))) - self._display.display("AWS ACTIONS: {0}".format(self.aws_resource_actions)) + self._display.display(f"AWS ACTIONS: {self.aws_resource_actions}") |