1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-03-21 20:59:10 +00:00

Fixing coding standards issues in the scaleway_ip_info.py module.

This commit is contained in:
Philip Norton 2026-03-20 16:58:31 +00:00
parent 47ce914236
commit 0ff768ddab

View file

@ -28,7 +28,7 @@ options:
region: region:
type: str type: str
description: description:
- Scaleway region to use (for example C(par1)). - Scaleway region to use (for example C(par1)) (deprecated).
required: false required: false
choices: choices:
- ams1 - ams1
@ -44,7 +44,8 @@ options:
- EMEA-PL-WAW1 - EMEA-PL-WAW1
- waw2 - waw2
- waw3 - waw3
zone
zone:
type: str type: str
description: description:
- Scaleway zone to use (for example (nl-ams-1)) - Scaleway zone to use (for example (nl-ams-1))
@ -59,6 +60,7 @@ options:
- pl-waw-1 - pl-waw-1
- pl-waw-2 - pl-waw-2
- pl-waw-3 - pl-waw-3
- it-mil-1
""" """
EXAMPLES = r""" EXAMPLES = r"""
@ -104,7 +106,6 @@ from ansible.module_utils.basic import AnsibleModule
from ansible_collections.community.general.plugins.module_utils.scaleway import ( from ansible_collections.community.general.plugins.module_utils.scaleway import (
SCALEWAY_LOCATION, SCALEWAY_LOCATION,
SCALEWAY_ENDPOINT, SCALEWAY_ENDPOINT,
SCALEWAY_REGIONS,
SCALEWAY_ZONES, SCALEWAY_ZONES,
Scaleway, Scaleway,
ScalewayException, ScalewayException,
@ -145,21 +146,21 @@ def main():
api = ScalewayIpInfo(module=module) api = ScalewayIpInfo(module=module)
if module.params["zone"]: if module.params["zone"]:
zone = module.params["zone"] zone = module.params["zone"]
api_path = f"instance/v1/zones/{zone}/ips" api_path = f"instance/v1/zones/{zone}/ips"
response = scaleway_ip_info=api.get(path=api_path) response = scaleway_ip_info=api.get(path=api_path)
module.exit_json(scaleway_ip_info=response.json.get('ips')) module.exit_json(scaleway_ip_info=response.json.get('ips'))
else: else:
module.deprecate( module.deprecate(
msg="The 'region' parameter is deprecated. Use 'zone' to specify the Scaleway zone instead.", msg="The 'region' parameter is deprecated. Use 'zone' to specify the Scaleway zone instead.",
version="14.0.0", version="14.0.0",
collection_name="community.general", collection_name="community.general",
) )
try: try:
module.exit_json(scaleway_ip_info=ScalewayIpInfo(module).get_resources()) module.exit_json(scaleway_ip_info=ScalewayIpInfo(module).get_resources())
except ScalewayException as exc: except ScalewayException as exc:
module.fail_json(msg=exc.message) module.fail_json(msg=exc.message)
if __name__ == "__main__": if __name__ == "__main__":