mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 06:12:51 +00:00
Reformat everything.
This commit is contained in:
@@ -118,15 +118,19 @@ msg:
|
||||
"""
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible_collections.community.general.plugins.module_utils.ibm_sa_utils import execute_pyxcli_command, \
|
||||
connect_ssl, spectrum_accelerate_spec, is_pyxcli_installed
|
||||
from ansible_collections.community.general.plugins.module_utils.ibm_sa_utils import (
|
||||
execute_pyxcli_command,
|
||||
connect_ssl,
|
||||
spectrum_accelerate_spec,
|
||||
is_pyxcli_installed,
|
||||
)
|
||||
|
||||
|
||||
def main():
|
||||
argument_spec = spectrum_accelerate_spec()
|
||||
argument_spec.update(
|
||||
dict(
|
||||
state=dict(default='present', choices=['present', 'absent']),
|
||||
state=dict(default="present", choices=["present", "absent"]),
|
||||
domain=dict(required=True),
|
||||
size=dict(),
|
||||
max_dms=dict(),
|
||||
@@ -137,7 +141,7 @@ def main():
|
||||
max_volumes=dict(),
|
||||
perf_class=dict(),
|
||||
hard_capacity=dict(),
|
||||
soft_capacity=dict()
|
||||
soft_capacity=dict(),
|
||||
)
|
||||
)
|
||||
|
||||
@@ -146,19 +150,16 @@ def main():
|
||||
is_pyxcli_installed(module)
|
||||
|
||||
xcli_client = connect_ssl(module)
|
||||
domain = xcli_client.cmd.domain_list(
|
||||
domain=module.params['domain']).as_single_element
|
||||
state = module.params['state']
|
||||
domain = xcli_client.cmd.domain_list(domain=module.params["domain"]).as_single_element
|
||||
state = module.params["state"]
|
||||
|
||||
state_changed = False
|
||||
msg = f"Domain '{module.params['domain']}'"
|
||||
if state == 'present' and not domain:
|
||||
state_changed = execute_pyxcli_command(
|
||||
module, 'domain_create', xcli_client)
|
||||
if state == "present" and not domain:
|
||||
state_changed = execute_pyxcli_command(module, "domain_create", xcli_client)
|
||||
msg += " created successfully."
|
||||
elif state == 'absent' and domain:
|
||||
state_changed = execute_pyxcli_command(
|
||||
module, 'domain_delete', xcli_client)
|
||||
elif state == "absent" and domain:
|
||||
state_changed = execute_pyxcli_command(module, "domain_delete", xcli_client)
|
||||
msg += " deleted successfully."
|
||||
else:
|
||||
msg += " state unchanged."
|
||||
@@ -166,5 +167,5 @@ def main():
|
||||
module.exit_json(changed=state_changed, msg=msg)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user