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:
@@ -74,18 +74,22 @@ RETURN = r"""
|
||||
"""
|
||||
|
||||
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"]),
|
||||
vol=dict(required=True),
|
||||
pool=dict(),
|
||||
size=dict()
|
||||
size=dict(),
|
||||
)
|
||||
)
|
||||
|
||||
@@ -95,20 +99,17 @@ def main():
|
||||
|
||||
xcli_client = connect_ssl(module)
|
||||
# required args
|
||||
volume = xcli_client.cmd.vol_list(
|
||||
vol=module.params.get('vol')).as_single_element
|
||||
state = module.params['state']
|
||||
volume = xcli_client.cmd.vol_list(vol=module.params.get("vol")).as_single_element
|
||||
state = module.params["state"]
|
||||
|
||||
state_changed = False
|
||||
if state == 'present' and not volume:
|
||||
state_changed = execute_pyxcli_command(
|
||||
module, 'vol_create', xcli_client)
|
||||
elif state == 'absent' and volume:
|
||||
state_changed = execute_pyxcli_command(
|
||||
module, 'vol_delete', xcli_client)
|
||||
if state == "present" and not volume:
|
||||
state_changed = execute_pyxcli_command(module, "vol_create", xcli_client)
|
||||
elif state == "absent" and volume:
|
||||
state_changed = execute_pyxcli_command(module, "vol_delete", xcli_client)
|
||||
|
||||
module.exit_json(changed=state_changed)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user