10.0.0
This commit is contained in:
50
library/decort_storage_policy.py
Normal file
50
library/decort_storage_policy.py
Normal file
@@ -0,0 +1,50 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
DOCUMENTATION = r'''
|
||||
---
|
||||
module: decort_storage_policy
|
||||
|
||||
description: See L(Module Documentation,https://repository.basistech.ru/BASIS/decort-ansible/wiki/Home). # noqa: E501
|
||||
'''
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.decort_utils import DecortController
|
||||
|
||||
|
||||
class DecortStoragePolicy(DecortController):
|
||||
def __init__(self):
|
||||
super().__init__(AnsibleModule(**self.amodule_init_args))
|
||||
self.id: int = self.aparams['id']
|
||||
|
||||
@property
|
||||
def amodule_init_args(self) -> dict:
|
||||
return self.pack_amodule_init_args(
|
||||
argument_spec=dict(
|
||||
id=dict(
|
||||
type='int',
|
||||
required=True,
|
||||
),
|
||||
),
|
||||
supports_check_mode=True,
|
||||
)
|
||||
|
||||
def run(self):
|
||||
self.get_info()
|
||||
self.exit()
|
||||
|
||||
def get_info(self):
|
||||
self.facts = self.storage_policy_get(id=self.id)
|
||||
self.facts['sep_pools'] = self.facts.pop('access_seps_pools')
|
||||
self.facts['iops_limit'] = self.facts.pop('limit_iops')
|
||||
self.facts['usage']['account_ids'] = self.facts['usage'].pop(
|
||||
'accounts'
|
||||
)
|
||||
self.facts['usage']['rg_ids'] = self.facts['usage'].pop('resgroups')
|
||||
|
||||
|
||||
def main():
|
||||
DecortStoragePolicy().run()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in New Issue
Block a user