12.0.0
This commit is contained in:
@@ -10,6 +10,8 @@ description: See L(Module Documentation,https://repository.basistech.ru/BASIS/de
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.decort_utils import DecortController
|
||||
|
||||
from dynamix_sdk import exceptions as sdk_exceptions
|
||||
|
||||
|
||||
class DecortUser(DecortController):
|
||||
def __init__(self):
|
||||
@@ -43,16 +45,35 @@ class DecortUser(DecortController):
|
||||
self.facts = self.usermanager_whoami_result
|
||||
self.id = self.facts['name']
|
||||
|
||||
user_get = self.user_get(id=self.id)
|
||||
for key in ['emailaddresses', 'data']:
|
||||
self.facts[key] = user_get[key]
|
||||
try:
|
||||
user_model = self.api.cloudapi.user.get(user_name=self.id)
|
||||
except sdk_exceptions.RequestException as e:
|
||||
if (
|
||||
e.orig_exception.response is not None
|
||||
and e.orig_exception.response.status_code == 404
|
||||
):
|
||||
self.message(
|
||||
self.MESSAGES.obj_not_found(
|
||||
obj='user',
|
||||
)
|
||||
)
|
||||
self.exit(fail=True)
|
||||
raise e
|
||||
|
||||
self.facts.update(user_model.model_dump())
|
||||
|
||||
if self.aparams['resource_consumption']:
|
||||
self.facts.update(self.user_resource_consumption())
|
||||
self.facts.update(
|
||||
self.api.ca.user.get_resource_consumption().model_dump()
|
||||
)
|
||||
|
||||
# Delete duplicate self.facts['name']
|
||||
del self.facts['user_name']
|
||||
|
||||
if self.aparams['api_methods']:
|
||||
self.facts['api_methods'] = self.user_api_methods(id=self.id)
|
||||
|
||||
self.facts['api_methods'] = (
|
||||
self.api.cloudapi.user.api_list(user_name=self.id).model_dump()
|
||||
)
|
||||
search_string = self.aparams['objects_search']
|
||||
if search_string:
|
||||
self.facts['objects_search'] = self.user_objects_search(
|
||||
|
||||
Reference in New Issue
Block a user