Skip to content

Commit

Permalink
Cleanup headers and imports (ansible-collections#1738)
Browse files Browse the repository at this point in the history
Cleanup headers and imports

SUMMARY
Mass update of imports, docs fragments and file headers

Many of the amazon.aws module_utils and docs fragments got moved about, update community.aws to reflect this.
Consistently apply the comment headers as documented at https://docs.ansible.com/ansible/devel/dev_guide/developing_modules_documenting.html#python-shebang-utf-8-coding

ISSUE TYPE

Docs Pull Request
Feature Pull Request

COMPONENT NAME
ADDITIONAL INFORMATION
Header cleanup based upon:
https://docs.ansible.com/ansible/devel/dev_guide/developing_modules_documenting.html#python-shebang-utf-8-coding

Begin your Ansible module with #!/usr/bin/python - this “shebang” allows ansible_python_interpreter to work. Follow the shebang immediately with # -*- coding: utf-8 -*- to clarify that the file is UTF-8 encoded.

and
https://docs.ansible.com/ansible/devel/dev_guide/developing_modules_documenting.html#copyright-and-license

After the shebang and UTF-8 coding, add a copyright line with the original copyright holder and a license declaration. The license declaration should be ONLY one line, not the full GPL prefix.
...
Additions to the module (for instance, rewrites) are not permitted to add additional copyright lines other than the default copyright statement if missing:

Reviewed-by: Alina Buzachis

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@a4f20bf
  • Loading branch information
tremble authored and GomathiselviS committed Oct 24, 2024
1 parent a06ab88 commit dcd620c
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 38 deletions.
40 changes: 20 additions & 20 deletions plugins/modules/ec2_placement_group.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-

# Copyright (c) 2017 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)

from __future__ import absolute_import, division, print_function
__metaclass__ = type


DOCUMENTATION = '''
DOCUMENTATION = r"""
---
module: ec2_placement_group
version_added: 1.0.0
short_description: Create or delete an EC2 Placement Group
description:
- Create an EC2 Placement Group; if the placement group already exists,
nothing is done. Or, delete an existing placement group. If the placement
group is absent, do nothing. See also
U(https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/placement-groups.html)
author: "Brad Macpherson (@iiibrad)"
- Create an EC2 Placement Group; if the placement group already exists,
nothing is done. Or, delete an existing placement group. If the placement
group is absent, do nothing. See also
U(https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/placement-groups.html)
author:
- "Brad Macpherson (@iiibrad)"
options:
name:
description:
Expand Down Expand Up @@ -45,12 +44,12 @@
choices: [ 'cluster', 'spread', 'partition' ]
type: str
extends_documentation_fragment:
- amazon.aws.aws
- amazon.aws.ec2
- amazon.aws.boto3
'''
- amazon.aws.common.modules
- amazon.aws.region.modules
- amazon.aws.boto3
"""

EXAMPLES = '''
EXAMPLES = r"""
# Note: These examples do not set authentication details, see the AWS Guide
# for details.
Expand All @@ -77,10 +76,10 @@
name: my-cluster
state: absent
'''
"""


RETURN = '''
RETURN = r"""
placement_group:
description: Placement group attributes
returned: when state != absent
Expand All @@ -99,16 +98,17 @@
type: str
sample: "cluster"
'''
"""

try:
import botocore
except ImportError:
pass # caught by AnsibleAWSModule

from ansible_collections.amazon.aws.plugins.module_utils.botocore import is_boto3_error_code
from ansible_collections.amazon.aws.plugins.module_utils.retries import AWSRetry

from ansible_collections.community.aws.plugins.module_utils.modules import AnsibleCommunityAWSModule as AnsibleAWSModule
from ansible_collections.amazon.aws.plugins.module_utils.core import is_boto3_error_code
from ansible_collections.amazon.aws.plugins.module_utils.ec2 import AWSRetry


@AWSRetry.exponential_backoff()
Expand Down
36 changes: 18 additions & 18 deletions plugins/modules/ec2_placement_group_info.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-

# Copyright (c) 2017 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)

from __future__ import absolute_import, division, print_function
__metaclass__ = type


DOCUMENTATION = r'''
DOCUMENTATION = r"""
---
module: ec2_placement_group_info
version_added: 1.0.0
short_description: List EC2 Placement Group(s) details
description:
- List details of EC2 Placement Group(s).
author: "Brad Macpherson (@iiibrad)"
- List details of EC2 Placement Group(s).
author:
- "Brad Macpherson (@iiibrad)"
options:
names:
description:
Expand All @@ -24,13 +23,12 @@
required: false
default: []
extends_documentation_fragment:
- amazon.aws.aws
- amazon.aws.ec2
- amazon.aws.boto3
'''
- amazon.aws.common.modules
- amazon.aws.region.modules
- amazon.aws.boto3
"""

EXAMPLES = r'''
EXAMPLES = r"""
# Note: These examples do not set authentication details or the AWS region,
# see the AWS Guide for details.
Expand All @@ -49,10 +47,10 @@
msg: >
{{ specific_ec2_placement_groups | json_query("[?name=='my-cluster']") }}
'''
"""


RETURN = r'''
RETURN = r"""
placement_groups:
description: Placement group attributes
returned: always
Expand All @@ -71,14 +69,16 @@
type: str
sample: "cluster"
'''
"""

from ansible_collections.community.aws.plugins.module_utils.modules import AnsibleCommunityAWSModule as AnsibleAWSModule
try:
from botocore.exceptions import (BotoCoreError, ClientError)
from botocore.exceptions import BotoCoreError
from botocore.exceptions import ClientError
except ImportError:
pass # caught by AnsibleAWSModule

from ansible_collections.community.aws.plugins.module_utils.modules import AnsibleCommunityAWSModule as AnsibleAWSModule


def get_placement_groups_details(connection, module):
names = module.params.get("names")
Expand Down

0 comments on commit dcd620c

Please sign in to comment.