Skip to content

Commit 1d11ab5

Browse files
author
Nivedithaa Mahendran
committed
add logger statements
1 parent 76a754b commit 1d11ab5

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/mas/devops/users.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,8 @@ def set_user_group_reassignment_auth(self, user_id, groupreassign, manage_api_ke
352352
cert=self.manage_internal_client_pem_file_path,
353353
verify=self.manage_internal_ca_pem_file_path
354354
)
355+
self.logger.info(f"Response status code: {response.status_code}")
356+
self.logger.info(f"Response text: {response.text}")
355357

356358
if response.status_code == 200:
357359
self.logger.info(f"Successfully set group reassignment authorization for user {user_id}")
@@ -790,6 +792,7 @@ def create_or_get_manage_api_key_for_user(self, user_id, temporary=False):
790792
# otherwise, retrieve the apikey (either it already existed, or we just created it)
791793

792794
apikey = self.get_manage_api_key_for_user(user_id)
795+
self.logger.info(f"Retrieved Manage API Key for user {user_id}: {apikey}")
793796
if apikey is None:
794797
# either create call reported that apikey already exists, or we created the api key
795798
# so we expect the get call to find it
@@ -813,7 +816,7 @@ def get_manage_api_key_for_user(self, user_id):
813816
Raises:
814817
Exception: If the API call fails.
815818
"""
816-
self.logger.debug(f"Getting Manage API Key for user {user_id}")
819+
self.logger.info(f"Getting Manage API Key for user {user_id}")
817820
url = f"{self.manage_api_url_internal}/maximo/api/os/mxapiapikey"
818821
querystring = {
819822
"ccm": 1,
@@ -832,6 +835,7 @@ def get_manage_api_key_for_user(self, user_id):
832835
verify=self.manage_internal_ca_pem_file_path,
833836
cert=self.manage_internal_client_pem_file_path
834837
)
838+
self.logger.info(f"Response: {response.status_code} {response.text}")
835839

836840
if response.status_code == 200:
837841
json = response.json()
@@ -1023,6 +1027,8 @@ def add_user_to_manage_group(self, user_id, group_name, manage_api_key):
10231027
json=payload,
10241028
verify=self.manage_internal_ca_pem_file_path,
10251029
)
1030+
self.logger.info(f"Response status code: {response.status_code}")
1031+
self.logger.info(f"Response text: {response.text}")
10261032
if response.status_code == 204:
10271033
return None
10281034

@@ -1582,6 +1588,7 @@ def create_initial_user_for_saas(self, user, user_type, groupreassign=None):
15821588

15831589
if len(manage_security_groups) > 0 and "manage" in self.mas_workspace_application_ids:
15841590
maxadmin_manage_api_key = self.create_or_get_manage_api_key_for_user(MASUserUtils.MAXADMIN, temporary=True)
1591+
self.logger.info(f"Maxadmin manage api key - {maxadmin_manage_api_key}")
15851592
for manage_security_group in manage_security_groups:
15861593
self.add_user_to_manage_group(user_id, manage_security_group, maxadmin_manage_api_key)
15871594
if Version(self.mas_version) >= Version('9.1') and user_type == "PRIMARY" and groupreassign is not None:

0 commit comments

Comments
 (0)