From 8e9d3d8d1834d54bd3204cc865d9c82568e82ef1 Mon Sep 17 00:00:00 2001 From: Mark Chappell Date: Thu, 19 May 2022 19:30:22 +0200 Subject: [PATCH] Fix linting issues. (#823) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix linting issues. (#701) Should fix #804 Fix linting issues reported by validate-modules in plugins SUMMARY See ansible-collections/news-for-maintainers#9. ISSUE TYPE Bugfix Pull Request COMPONENT NAME various 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: Gonéri Le Bouder Co-authored-by: Alina Buzachis --- changelogs/fragments/validate-plugins.yml | 9 ++++++ plugins/callback/aws_resource_actions.py | 2 +- plugins/inventory/aws_ec2.py | 5 ++- plugins/inventory/aws_rds.py | 6 ++-- plugins/lookup/aws_account_attribute.py | 4 +-- plugins/lookup/aws_secret.py | 4 +-- plugins/lookup/aws_service_ip_ranges.py | 4 +-- plugins/lookup/aws_ssm.py | 8 ++--- plugins/modules/ec2_instance.py | 4 +++ plugins/modules/ec2_snapshot_info.py | 38 ++++++++++++----------- 10 files changed, 51 insertions(+), 33 deletions(-) create mode 100644 changelogs/fragments/validate-plugins.yml diff --git a/changelogs/fragments/validate-plugins.yml b/changelogs/fragments/validate-plugins.yml new file mode 100644 index 00000000000..5b1feff1e1b --- /dev/null +++ b/changelogs/fragments/validate-plugins.yml @@ -0,0 +1,9 @@ +bugfixes: + - "aws_resource_actions callback plugin - fix linting errors in documentation data (https://github.com/ansible-collections/amazon.aws/pull/701)." + - "aws_ec2 inventory plugin - fix linting errors in documentation data (https://github.com/ansible-collections/amazon.aws/pull/701)." + - "aws_rds inventory plugin - fix linting errors in documentation data (https://github.com/ansible-collections/amazon.aws/pull/701)." + - "aws_account_attribute lookup plugin - fix linting errors in documentation data (https://github.com/ansible-collections/amazon.aws/pull/701)." + - "aws_account_attribute lookup plugin - fix linting errors in documentation data (https://github.com/ansible-collections/amazon.aws/pull/701)." + - "aws_secret lookup plugin - fix linting errors in documentation data (https://github.com/ansible-collections/amazon.aws/pull/701)." + - "aws_service_ip_ranges lookup plugin - fix linting errors in documentation data (https://github.com/ansible-collections/amazon.aws/pull/701)." + - "aws_ssm lookup plugin - fix linting errors in documentation data (https://github.com/ansible-collections/amazon.aws/pull/701)." diff --git a/plugins/callback/aws_resource_actions.py b/plugins/callback/aws_resource_actions.py index 9dae8e6f840..551a866a376 100644 --- a/plugins/callback/aws_resource_actions.py +++ b/plugins/callback/aws_resource_actions.py @@ -6,7 +6,7 @@ __metaclass__ = type DOCUMENTATION = ''' - callback: aws_resource_actions + name: aws_resource_actions type: aggregate short_description: summarizes all "resource:actions" completed description: diff --git a/plugins/inventory/aws_ec2.py b/plugins/inventory/aws_ec2.py index 9d0af92416f..14fc3baa573 100644 --- a/plugins/inventory/aws_ec2.py +++ b/plugins/inventory/aws_ec2.py @@ -6,7 +6,6 @@ DOCUMENTATION = ''' name: aws_ec2 - plugin_type: inventory short_description: EC2 inventory source requirements: - boto3 @@ -37,6 +36,7 @@ - A list of regions in which to describe EC2 instances. - If empty (the default) default this will include all regions, except possibly restricted ones like us-gov-west-1 and cn-north-1. type: list + elements: str default: [] hostnames: description: @@ -44,6 +44,7 @@ - You can use the options specified in U(http://docs.aws.amazon.com/cli/latest/reference/ec2/describe-instances.html#options). - To use tags as hostnames use the syntax tag:Name=Value to use the hostname Name_Value, or tag:Name to use the value of the Name tag. type: list + elements: dict default: [] filters: description: @@ -58,6 +59,7 @@ - Every entry in this list triggers a search query. As such, from a performance point of view, it's better to keep the list as short as possible. type: list + elements: dict default: [] exclude_filters: description: @@ -67,6 +69,7 @@ - Every entry in this list triggers a search query. As such, from a performance point of view, it's better to keep the list as short as possible. type: list + elements: dict default: [] include_extra_api_calls: description: diff --git a/plugins/inventory/aws_rds.py b/plugins/inventory/aws_rds.py index ecdd4ac0f46..75c364e920a 100644 --- a/plugins/inventory/aws_rds.py +++ b/plugins/inventory/aws_rds.py @@ -6,7 +6,6 @@ DOCUMENTATION = ''' name: aws_rds - plugin_type: inventory short_description: rds instance source description: - Get instances and clusters from Amazon Web Services RDS. @@ -33,14 +32,15 @@ statuses: description: A list of desired states for instances/clusters to be added to inventory. Set to ['all'] as a shorthand to find everything. type: list + elements: str default: - creating - available iam_role_arn: description: The ARN of the IAM role to assume to perform the inventory lookup. You should still provide AWS credentials with enough privilege to perform the AssumeRole action. - note: - Ansible versions prior to 2.10 should use the fully qualified plugin name 'amazon.aws.aws_rds'. + notes: + - Ansible versions prior to 2.10 should use the fully qualified plugin name 'amazon.aws.aws_rds'. extends_documentation_fragment: - inventory_cache - constructed diff --git a/plugins/lookup/aws_account_attribute.py b/plugins/lookup/aws_account_attribute.py index 6ac58d40c90..9b5f00c6f20 100644 --- a/plugins/lookup/aws_account_attribute.py +++ b/plugins/lookup/aws_account_attribute.py @@ -4,9 +4,9 @@ __metaclass__ = type DOCUMENTATION = ''' -lookup: aws_account_attribute +name: aws_account_attribute author: - - Sloane Hertel + - Sloane Hertel (@s-hertel) requirements: - python >= 3.6 - boto3 diff --git a/plugins/lookup/aws_secret.py b/plugins/lookup/aws_secret.py index 1bb815989e6..64580177dae 100644 --- a/plugins/lookup/aws_secret.py +++ b/plugins/lookup/aws_secret.py @@ -5,9 +5,9 @@ __metaclass__ = type DOCUMENTATION = r''' -lookup: aws_secret +name: aws_secret author: - - Aaron Smith + - Aaron Smith (!UNKNOWN) requirements: - python >= 3.6 - boto3 diff --git a/plugins/lookup/aws_service_ip_ranges.py b/plugins/lookup/aws_service_ip_ranges.py index 82447236860..bd34d1bd131 100644 --- a/plugins/lookup/aws_service_ip_ranges.py +++ b/plugins/lookup/aws_service_ip_ranges.py @@ -5,9 +5,9 @@ __metaclass__ = type DOCUMENTATION = ''' -lookup: aws_service_ip_ranges +name: aws_service_ip_ranges author: - - James Turner + - James Turner (!UNKNOWN) requirements: - must have public internet connectivity short_description: Look up the IP ranges for services provided in AWS such as EC2 and S3. diff --git a/plugins/lookup/aws_ssm.py b/plugins/lookup/aws_ssm.py index 678dbed851f..ebd2b23de0a 100644 --- a/plugins/lookup/aws_ssm.py +++ b/plugins/lookup/aws_ssm.py @@ -8,11 +8,11 @@ __metaclass__ = type DOCUMENTATION = ''' -lookup: aws_ssm +name: aws_ssm author: - - Bill Wang - - Marat Bakeev - - Michael De La Rue + - Bill Wang (!UNKNOWN) + - Marat Bakeev (!UNKNOWN) + - Michael De La Rue (!UNKNOWN) requirements: - python >= 3.6 - boto3 diff --git a/plugins/modules/ec2_instance.py b/plugins/modules/ec2_instance.py index c746dbc13f9..5fbca444ee8 100644 --- a/plugins/modules/ec2_instance.py +++ b/plugins/modules/ec2_instance.py @@ -157,6 +157,7 @@ description: - a list of ENI IDs (strings) or a list of objects containing the key I(id). type: list + elements: str assign_public_ip: description: - when true assigns a public IP address to the interface @@ -169,6 +170,7 @@ description: - a list of IPv6 addresses to assign to the network interface type: list + elements: str source_dest_check: description: - controls whether source/destination checking is enabled on the interface @@ -181,6 +183,7 @@ description: - a list of IPv4 addresses to assign to the network interface type: list + elements: str subnet_id: description: - the subnet to connect the network interface to @@ -198,6 +201,7 @@ description: - a list of security group IDs to attach to the interface type: list + elements: str volumes: description: - A list of block device mappings, by default this will always use the AMI root device so the volumes option is primarily for adding more storage. diff --git a/plugins/modules/ec2_snapshot_info.py b/plugins/modules/ec2_snapshot_info.py index 087d7c1ca2c..b178d9f7d80 100644 --- a/plugins/modules/ec2_snapshot_info.py +++ b/plugins/modules/ec2_snapshot_info.py @@ -6,17 +6,17 @@ __metaclass__ = type -DOCUMENTATION = ''' +DOCUMENTATION = r''' --- module: ec2_snapshot_info version_added: 1.0.0 -short_description: Gather information about ec2 volume snapshots in AWS +short_description: Gathers information about EC2 volume snapshots in AWS description: - - Gather information about ec2 volume snapshots in AWS. - - This module was called C(ec2_snapshot_facts) before Ansible 2.9. The usage did not change. + - Gathers information about EC2 volume snapshots in AWS. + - This module was called C(ec2_snapshot_facts) before Ansible 2.9. The usage did not change. author: - - "Rob White (@wimnat)" - - Aubin Bikouo (@abikouo) + - Rob White (@wimnat) + - Aubin Bikouo (@abikouo) options: snapshot_ids: description: @@ -71,12 +71,11 @@ the account use the filter 'owner-id'. extends_documentation_fragment: -- amazon.aws.aws -- amazon.aws.ec2 - + - amazon.aws.ec2 + - amazon.aws.aws ''' -EXAMPLES = ''' +EXAMPLES = r''' # Note: These examples do not set authentication details, see the AWS Guide for details. # Gather information about all snapshots, including public ones @@ -114,7 +113,7 @@ ''' -RETURN = ''' +RETURN = r''' snapshots: description: snapshots retrieved type: list @@ -137,9 +136,10 @@ returned: always sample: completed state_message: - description: Encrypted Amazon EBS snapshots are copied asynchronously. If a snapshot copy operation fails (for example, if the proper - AWS Key Management Service (AWS KMS) permissions are not obtained) this field displays error state details to help you diagnose why the - error occurred. + description: + - Encrypted Amazon EBS snapshots are copied asynchronously. If a snapshot copy operation fails (for example, if the proper + AWS Key Management Service (AWS KMS) permissions are not obtained) this field displays error state details to help you diagnose why the + error occurred. type: str returned: always sample: @@ -184,14 +184,16 @@ returned: always sample: "True" kms_key_id: - description: The full ARN of the AWS Key Management Service (AWS KMS) customer master key (CMK) that was used to \ - protect the volume encryption key for the parent volume. + description: + - The full ARN of the AWS Key Management Service (AWS KMS) customer master key (CMK) that was used to + protect the volume encryption key for the parent volume. type: str returned: always sample: "74c9742a-a1b2-45cb-b3fe-abcdef123456" data_encryption_key_id: - description: The data encryption key identifier for the snapshot. This value is a unique identifier that \ - corresponds to the data encryption key that was used to encrypt the original volume or snapshot copy. + description: + - The data encryption key identifier for the snapshot. This value is a unique identifier that + corresponds to the data encryption key that was used to encrypt the original volume or snapshot copy. type: str returned: always sample: "arn:aws:kms:ap-southeast-2:012345678900:key/74c9742a-a1b2-45cb-b3fe-abcdef123456"