Improve logs in readiness_loop for each iteration

Change-Id: If1b78eb4619cebf2b85cad6f4fc4b2efde66633c
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
diff --git a/osm_lcm/k8s.py b/osm_lcm/k8s.py
index dda07fb..fd3667d 100644
--- a/osm_lcm/k8s.py
+++ b/osm_lcm/k8s.py
@@ -2054,7 +2054,7 @@
         for db_cluster in dbcluster_list:
             try:
                 self.logger.info(
-                    f"Checking status of KSU in cluster {db_cluster['name']}."
+                    f"Checking status of KSU {db_ksu['name']} in cluster {db_cluster['name']}."
                 )
                 cluster_kubectl = self.cluster_kubectl(db_cluster)
                 checkings_list = [
diff --git a/osm_lcm/odu_libs/workflows.py b/osm_lcm/odu_libs/workflows.py
index cf09e8f..1b5d5cc 100644
--- a/osm_lcm/odu_libs/workflows.py
+++ b/osm_lcm/odu_libs/workflows.py
@@ -107,7 +107,7 @@
             if deleted:
                 if generic_object:
                     self.logger.info(
-                        f"Found {api_plural}. Name: {name}. Namespace: '{namespace}'. API: {api_group}/{api_version}"
+                        f"Iteration {counter}/{max_iterations}: Found {api_plural}. Name: {name}. Namespace: '{namespace}'. API: {api_group}/{api_version}"
                     )
                 else:
                     self.logger.info(
@@ -118,29 +118,41 @@
                 if not condition:
                     return True, "Nothing to check"
                 if generic_object:
+                    # If there is object, conditions must be checked
                     # self.logger.debug(f"{yaml.safe_dump(generic_object)}")
                     conditions = generic_object.get("status", {}).get("conditions", [])
-                    self.logger.info(f"{item} status conditions: {conditions}")
+                    self.logger.info(
+                        f"Iteration {counter}/{max_iterations}. Object found: {item} status conditions: {conditions}"
+                    )
+                    jsonpath_expr = parse(condition["jsonpath_filter"])
+                    match = jsonpath_expr.find(generic_object)
+                    if match:
+                        value = match[0].value
+                        condition_function = condition.get(
+                            "function", lambda x, y: x == y
+                        )
+                        if condition_function(condition["value"], value):
+                            self.logger.info(
+                                f"{item} {name} met the condition {condition} with {value} in {counter} iterations (aprox {counter*retry_time} seconds)"
+                            )
+                            return True, "COMPLETED"
+                        else:
+                            self.logger.info(
+                                f"Iteration {counter}/{max_iterations}: {item} {name} did not meet the condition {condition} with value {value}"
+                            )
+                    else:
+                        self.logger.info(
+                            f"Iteration {counter}/{max_iterations}. No match for filter {condition.get('jsonpath_filter', '-')} in {item} {name}"
+                        )
                 else:
                     self.logger.info(
-                        f"Could not find {api_plural}. Name: {name}. Namespace: '{namespace}'. API: {api_group}/{api_version}"
+                        f"Iteration {counter}/{max_iterations}: Could not find {api_plural}. Name: {name}. Namespace: '{namespace}'. API: {api_group}/{api_version}"
                     )
-                    conditions = []
-                jsonpath_expr = parse(condition["jsonpath_filter"])
-                match = jsonpath_expr.find(generic_object)
-                if match:
-                    value = match[0].value
-                    condition_function = condition.get("function", lambda x, y: x == y)
-                    if condition_function(condition["value"], value):
-                        self.logger.info(
-                            f"{item} {name} met the condition {condition} in {counter} iterations (aprox {counter*retry_time} seconds)"
-                        )
-                        return True, "COMPLETED"
         except Exception as e:
             self.logger.error(f"Exception: {e}")
         await asyncio.sleep(retry_time)
         counter += 1
     return (
         False,
-        "{item} {name} was not ready after {max_iterations} iterations (aprox {timeout} seconds)",
+        f"{item} {name} was not ready after {max_iterations} iterations (aprox {timeout} seconds)",
     )