Refactor DecortAccountInfo class (MODULE_ARGS attribute -> module_args property)
This commit is contained in:
@@ -23,7 +23,21 @@ from ansible.module_utils.decort_utils import 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(
|
||||
app_id=dict(
|
||||
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):
|
||||
self.result['facts'] = self.facts
|
||||
self.amodule.exit_json(**self.result)
|
||||
|
||||
Reference in New Issue
Block a user