Refactor DecortAccountInfo class (`MODULE_ARGS` attribute -> `module_args` property)

main
Dmitriy Smirnov 7 months ago
parent f00055e009
commit 77a2b6a182

@ -23,7 +23,21 @@ from ansible.module_utils.decort_utils import DecortController
class DecortAccountInfo(DecortController): class DecortAccountInfo(DecortController):
MODULE_ARGS = dict( def __init__(self):
amodule = AnsibleModule(**self.module_args, supports_check_mode=True)
super().__init__(amodule)
self.id, self.facts = self.account_find(
account_name=amodule.params['name'],
account_id=amodule.params['id'],
resource_consumption=amodule.params['resource_consumption'],
fail_if_not_found=True
)
@property
def module_args(self) -> dict:
return dict(
argument_spec=dict( argument_spec=dict(
app_id=dict( app_id=dict(
type='str', type='str',
@ -80,18 +94,6 @@ class DecortAccountInfo(DecortController):
] ]
) )
def __init__(self):
amodule = AnsibleModule(**self.MODULE_ARGS, supports_check_mode=True)
super().__init__(amodule)
self.id, self.facts = self.account_find(
account_name=amodule.params['name'],
account_id=amodule.params['id'],
resource_consumption=amodule.params['resource_consumption'],
fail_if_not_found=True
)
def exit(self): def exit(self):
self.result['facts'] = self.facts self.result['facts'] = self.facts
self.amodule.exit_json(**self.result) self.amodule.exit_json(**self.result)

Loading…
Cancel
Save