From 9e53281e5ae8dd4166b1b79231db72eb8eabac04 Mon Sep 17 00:00:00 2001 From: garciadeblas Date: Tue, 22 Oct 2024 14:04:36 +0200 Subject: [PATCH] Update log level in all ODU methods Change-Id: I1c0e22baf62ef513a89b1ee6895d42cbea358f51 Signed-off-by: garciadeblas --- osm_lcm/odu_libs/cluster_mgmt.py | 44 +++++++++++++++++++------------- osm_lcm/odu_libs/ksu.py | 34 ++++++++++-------------- osm_lcm/odu_libs/oka.py | 12 ++++----- osm_lcm/odu_libs/profiles.py | 20 +++++++++------ osm_lcm/odu_libs/vim_mgmt.py | 27 +++++++++++++------- 5 files changed, 76 insertions(+), 61 deletions(-) diff --git a/osm_lcm/odu_libs/cluster_mgmt.py b/osm_lcm/odu_libs/cluster_mgmt.py index 974afa5..879158a 100644 --- a/osm_lcm/odu_libs/cluster_mgmt.py +++ b/osm_lcm/odu_libs/cluster_mgmt.py @@ -39,8 +39,8 @@ def generate_age_key(): async def create_cluster(self, op_id, op_params, content): - self.logger.info("Create cluster workflow Enter") - self.logger.info(f"Operation {op_id}. Params: {op_params}. Content: {content}") + self.logger.info(f"create_cluster Enter. Operation {op_id}. Params: {op_params}") + # self.logger.debug(f"Content: {content}") db_cluster = content["cluster"] db_vim_account = content["vim_account"] @@ -135,8 +135,8 @@ async def create_cluster(self, op_id, op_params, content): async def update_cluster(self, op_id, op_params, content): - self.logger.info("Update cluster eks workflow Enter") - self.logger.info(f"Operation {op_id}. Params: {op_params}. Content: {content}") + self.logger.info(f"update_cluster Enter. Operation {op_id}. Params: {op_params}") + # self.logger.debug(f"Content: {content}") db_cluster = content["cluster"] db_vim_account = content["vim_account"] @@ -217,8 +217,8 @@ async def update_cluster(self, op_id, op_params, content): async def delete_cluster(self, op_id, op_params, content): - self.logger.info("Delete cluster workflow Enter") - self.logger.info(f"Operation {op_id}. Params: {op_params}. Content: {content}") + self.logger.info(f"delete_cluster Enter. Operation {op_id}. Params: {op_params}") + # self.logger.debug(f"Content: {content}") db_cluster = content["cluster"] @@ -258,8 +258,8 @@ async def delete_cluster(self, op_id, op_params, content): async def register_cluster(self, op_id, op_params, content): - self.logger.info("Register cluster workflow Enter") - self.logger.info(f"Operation {op_id}. Params: {op_params}. Content: {content}") + self.logger.info(f"register_cluster Enter. Operation {op_id}. Params: {op_params}") + # self.logger.debug(f"Content: {content}") db_cluster = content["cluster"] cluster_name = db_cluster["git_name"].lower() @@ -334,8 +334,10 @@ async def register_cluster(self, op_id, op_params, content): async def deregister_cluster(self, op_id, op_params, content): - self.logger.info("Deregister cluster workflow Enter") - self.logger.info(f"Operation {op_id}. Params: {op_params}. Content: {content}") + self.logger.info( + f"deregister_cluster Enter. Operation {op_id}. Params: {op_params}" + ) + # self.logger.debug(f"Content: {content}") db_cluster = content["cluster"] cluster_name = db_cluster["git_name"].lower() @@ -375,8 +377,8 @@ async def get_cluster_credentials(self, db_cluster): """ returns the kubeconfig file of a K8s cluster in a dictionary """ - self.logger.info("Get cluster credentials Enter") - self.logger.info(f"Content: {db_cluster}") + self.logger.info("get_cluster_credentials Enter") + # self.logger.debug(f"Content: {db_cluster}") secret_name = f"kubeconfig-{db_cluster['git_name'].lower()}" secret_namespace = "managed-resources" @@ -399,8 +401,10 @@ async def get_cluster_credentials(self, db_cluster): async def clean_items_cluster_create(self, op_id, op_params, content): - self.logger.info("Clean items cluster_create Enter") - self.logger.info(f"Operation {op_id}. Params: {op_params}. Content: {content}") + self.logger.info( + f"clean_items_cluster_create Enter. Operation {op_id}. Params: {op_params}" + ) + self.logger.debug(f"Content: {content}") items = { "secrets": [ { @@ -417,14 +421,18 @@ async def clean_items_cluster_create(self, op_id, op_params, content): async def clean_items_cluster_update(self, op_id, op_params, content): - self.logger.info("Clean items cluster_update Enter") - self.logger.info(f"Operation {op_id}. Params: {op_params}. Content: {content}") + self.logger.info( + f"clean_items_cluster_update Enter. Operation {op_id}. Params: {op_params}" + ) + # self.logger.debug(f"Content: {content}") return await self.clean_items_cluster_create(op_id, op_params, content) async def clean_items_cluster_register(self, op_id, op_params, content): - self.logger.info("Clean items cluster_register Enter") - self.logger.info(f"Operation {op_id}. Params: {op_params}. Content: {content}") + self.logger.info( + f"clean_items_cluster_register Enter. Operation {op_id}. Params: {op_params}" + ) + # self.logger.debug(f"Content: {content}") # Clean secrets cluster_name = content["cluster"]["git_name"].lower() items = { diff --git a/osm_lcm/odu_libs/ksu.py b/osm_lcm/odu_libs/ksu.py index 17c7bae..886a6cc 100644 --- a/osm_lcm/odu_libs/ksu.py +++ b/osm_lcm/odu_libs/ksu.py @@ -28,10 +28,8 @@ MAP_PROFILE = { async def create_ksus(self, op_id, op_params_list, content_list): - self.logger.info("Create KSU workflow Enter") - self.logger.info( - f"Operation {op_id}. Params: {op_params_list}. Content: {content_list}" - ) + self.logger.info(f"create_ksus Enter. Operation {op_id}. Params: {op_params_list}") + # self.logger.debug(f"Content: {content_list}") if len(content_list) > 1: raise Exception("There is no ODU workflow yet able to manage multiple KSUs") @@ -169,10 +167,8 @@ async def create_ksus(self, op_id, op_params_list, content_list): async def update_ksus(self, op_id, op_params_list, content_list): - self.logger.info("Update KSU workflow Enter") - self.logger.info( - f"Operation {op_id}. Params: {op_params_list}. Content: {content_list}" - ) + self.logger.info(f"update_ksus Enter. Operation {op_id}. Params: {op_params_list}") + # self.logger.debug(f"Content: {content_list}") if len(content_list) > 1: raise Exception("There is no ODU workflow yet able to manage multiple KSUs") @@ -308,10 +304,8 @@ async def update_ksus(self, op_id, op_params_list, content_list): async def delete_ksus(self, op_id, op_params_list, content_list): - self.logger.info("Delete KSU workflow Enter") - self.logger.info( - f"Operation {op_id}. Params: {op_params_list}. Content: {content_list}" - ) + self.logger.info(f"delete_ksus Enter. Operation {op_id}. Params: {op_params_list}") + # self.logger.debug(f"Content: {content_list}") if len(content_list) > 1: raise Exception("There is no ODU workflow yet able to manage multiple KSUs") @@ -356,24 +350,24 @@ async def delete_ksus(self, op_id, op_params_list, content_list): async def clone_ksu(self, op_id, op_params, content): - self.logger.info("Clone KSU workflow Enter") - self.logger.info(f"Operation {op_id}. Params: {op_params}. Content: {content}") + self.logger.info(f"clone_ksu Enter. Operation {op_id}. Params: {op_params}") + # self.logger.debug(f"Content: {content}") workflow_name = f"clone-ksu-{content['_id']}" return workflow_name async def move_ksu(self, op_id, op_params, content): - self.logger.info("Move KSU workflow Enter") - self.logger.info(f"Operation {op_id}. Params: {op_params}. Content: {content}") + self.logger.info(f"move_ksu Enter. Operation {op_id}. Params: {op_params}") + # self.logger.debug(f"Content: {content}") workflow_name = f"move-ksu-{content['_id']}" return workflow_name async def clean_items_ksu_create(self, op_id, op_params_list, content_list): - self.logger.info("Clean items ksu_create Enter") self.logger.info( - f"Operation {op_id}. Params: {op_params_list}. Content: {content_list}" + f"clean_items_ksu_create Enter. Operation {op_id}. Params: {op_params_list}" ) + # self.logger.debug(f"Content: {content_list}") try: if len(content_list) > 1: raise Exception("There is no ODU workflow yet able to manage multiple KSUs") @@ -404,10 +398,10 @@ async def clean_items_ksu_create(self, op_id, op_params_list, content_list): async def clean_items_ksu_update(self, op_id, op_params_list, content_list): - self.logger.info("Clean items ksu_update Enter") self.logger.info( - f"Operation {op_id}. Params: {op_params_list}. Content: {content_list}" + f"clean_items_ksu_update Enter. Operation {op_id}. Params: {op_params_list}" ) + # self.logger.debug(f"Content: {content_list}") return await self.clean_items_ksu_create(op_id, op_params_list, content_list) diff --git a/osm_lcm/odu_libs/oka.py b/osm_lcm/odu_libs/oka.py index ff247ea..e639a50 100644 --- a/osm_lcm/odu_libs/oka.py +++ b/osm_lcm/odu_libs/oka.py @@ -20,8 +20,8 @@ import yaml async def create_oka(self, op_id, op_params, content): - self.logger.info("Create OKA workflow Enter") - self.logger.info(f"Operation {op_id}. Params: {op_params}. Content: {content}") + self.logger.info(f"create_oka Enter. Operation {op_id}. Params: {op_params}") + # self.logger.debug(f"Content: {content}") workflow_template = "launcher-create-oka.j2" workflow_name = f"create-oka-{content['_id']}" @@ -79,8 +79,8 @@ async def create_oka(self, op_id, op_params, content): async def update_oka(self, op_id, op_params, content): - self.logger.info("Update OKA workflow Enter") - self.logger.info(f"Operation {op_id}. Params: {op_params}. Content: {content}") + self.logger.info(f"update_oka Enter. Operation {op_id}. Params: {op_params}") + # self.logger.debug(f"Content: {content}") workflow_template = "launcher-update-oka.j2" workflow_name = f"update-oka-{content['_id']}" @@ -135,8 +135,8 @@ async def update_oka(self, op_id, op_params, content): async def delete_oka(self, op_id, op_params, content): - self.logger.info("Delete OKA workflow Enter") - self.logger.info(f"Operation {op_id}. Params: {op_params}. Content: {content}") + self.logger.info(f"delete_oka Enter. Operation {op_id}. Params: {op_params}") + # self.logger.debug(f"Content: {content}") workflow_template = "launcher-delete-oka.j2" workflow_name = f"delete-oka-{content['_id']}" diff --git a/osm_lcm/odu_libs/profiles.py b/osm_lcm/odu_libs/profiles.py index fd22902..179bd3a 100644 --- a/osm_lcm/odu_libs/profiles.py +++ b/osm_lcm/odu_libs/profiles.py @@ -20,8 +20,8 @@ import yaml async def create_profile(self, op_id, op_params, content): - self.logger.info("Create profile workflow Enter") - self.logger.info(f"Operation {op_id}. Params: {op_params}. Content: {content}") + self.logger.info(f"create_profile Enter. Operation {op_id}. Params: {op_params}") + # self.logger.debug(f"Content: {content}") workflow_template = "launcher-create-profile.j2" workflow_name = f"create-profile-{content['_id']}" @@ -58,8 +58,8 @@ async def create_profile(self, op_id, op_params, content): async def delete_profile(self, op_id, op_params, content): - self.logger.info("Delete profile workflow Enter") - self.logger.info(f"Operation {op_id}. Params: {op_params}. Content: {content}") + self.logger.info(f"delete_profile Enter. Operation {op_id}. Params: {op_params}") + # self.logger.debug(f"Content: {content}") workflow_template = "launcher-delete-profile.j2" workflow_name = f"delete-profile-{content['_id']}" @@ -96,8 +96,10 @@ async def delete_profile(self, op_id, op_params, content): async def attach_profile_to_cluster(self, op_id, op_params, content): - self.logger.info("Attach profile to cluster workflow Enter") - self.logger.info(f"Operation {op_id}. Params: {op_params}. Content: {content}") + self.logger.info( + f"attach_profile_to_cluster Enter. Operation {op_id}. Params: {op_params}" + ) + # self.logger.debug(f"Content: {content}") profile = content["profile"] cluster = content["cluster"] @@ -138,8 +140,10 @@ async def attach_profile_to_cluster(self, op_id, op_params, content): async def detach_profile_from_cluster(self, op_id, op_params, content): - self.logger.info("Detach profile to cluster workflow Enter") - self.logger.info(f"Operation {op_id}. Params: {op_params}. Content: {content}") + self.logger.info( + f"detach_profile_from_cluster Enter. Operation {op_id}. Params: {op_params}" + ) + # self.logger.debug(f"Content: {content}") profile = content["profile"] cluster = content["cluster"] diff --git a/osm_lcm/odu_libs/vim_mgmt.py b/osm_lcm/odu_libs/vim_mgmt.py index 8014f0c..08633b0 100644 --- a/osm_lcm/odu_libs/vim_mgmt.py +++ b/osm_lcm/odu_libs/vim_mgmt.py @@ -23,8 +23,10 @@ from osm_lcm.lcm_utils import LcmException async def create_cloud_credentials(self, op_id, op_params, content): - self.logger.info("Create cloud_credentials workflow Enter") - self.logger.info(f"Operation {op_id}. Params: {op_params}. Content: {content}") + self.logger.info( + f"create_cloud_credentials Enter. Operation {op_id}. Params: {op_params}" + ) + # self.logger.debug(f"Content: {content}") workflow_template = "launcher-create-providerconfig.j2" workflow_name = f"create-providerconfig-{content['_id']}" @@ -95,8 +97,10 @@ async def create_cloud_credentials(self, op_id, op_params, content): async def delete_cloud_credentials(self, op_id, op_params, content): - self.logger.info("Delete cloud_credentials workflow Enter") - self.logger.info(f"Operation {op_id}. Params: {op_params}. Content: {content}") + self.logger.info( + f"delete_cloud_credentials Enter. Operation {op_id}. Params: {op_params}" + ) + # self.logger.debug(f"Content: {content}") workflow_template = "launcher-delete-providerconfig.j2" workflow_name = f"delete-providerconfig-{content['_id']}" @@ -136,8 +140,10 @@ async def delete_cloud_credentials(self, op_id, op_params, content): async def update_cloud_credentials(self, op_id, op_params, content): - self.logger.info("Update cloud_credentials workflow Enter") - self.logger.info(f"Operation {op_id}. Params: {op_params}. Content: {content}") + self.logger.info( + f"update_cloud_credentials Enter. Operation {op_id}. Params: {op_params}" + ) + # self.logger.debug(f"Content: {content}") workflow_template = "launcher-update-providerconfig.j2" workflow_name = f"update-providerconfig-{content['_id']}" @@ -205,7 +211,9 @@ async def update_cloud_credentials(self, op_id, op_params, content): async def clean_items_cloud_credentials_create(self, op_id, op_params, content): - self.logger.info("Clean items cloud_credentials_create Enter") + self.logger.info( + f"clean_items_cloud_credentials_create Enter. Operation {op_id}. Params: {op_params}" + ) items = { "secrets": [ { @@ -222,8 +230,9 @@ async def clean_items_cloud_credentials_create(self, op_id, op_params, content): async def clean_items_cloud_credentials_update(self, op_id, op_params, content): - self.logger.info("Clean items cloud_credentials_update Enter") - self.logger.info(f"Operation {op_id}. Params: {op_params}. Content: {content}") + self.logger.info( + f"clean_items_cloud_credentials_update Enter. Operation {op_id}. Params: {op_params}" + ) return await self.clean_items_cloud_credentials_create(op_id, op_params, content) -- 2.25.1