Added logger.debug lines to remaining functions, useful for debugging 69/10069/2
authorgarciadeblas <gerardo.garciadeblas@telefonica.com>
Wed, 2 Dec 2020 14:43:08 +0000 (14:43 +0000)
committergarciadeblas <gerardo.garciadeblas@telefonica.com>
Thu, 3 Dec 2020 14:29:38 +0000 (14:29 +0000)
Change-Id: I617f5fe4a49bff2fff70baf2e1803ce831735413
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
osmclient/common/package_tool.py
osmclient/sol005/osmrepo.py

index 7d582ec..568880c 100644 (file)
@@ -174,7 +174,7 @@ class PackageTool(object):
                 - package_type: is the type of package to be created
             :return: None
         """
-
+        self._logger.debug("")
         for folder in folders:
             try:
                 # print("Folder {} == package_type {}".format(folder[1], package_type))
@@ -193,6 +193,7 @@ class PackageTool(object):
                 - file_body: is the content of the file
             :return: None
         """
+        self._logger.debug("")
         print("Creating file:  \t{}".format(file_name))
         try:
             with open(file_name, "w+") as f:
@@ -206,6 +207,7 @@ class PackageTool(object):
 
             :returns: readme content
         """
+        self._logger.debug("")
         return """# Descriptor created by OSM descriptor package generated\n\n**Created on {} **""".format(
                time.strftime("%m/%d/%Y, %H:%M:%S", time.localtime()))
 
@@ -450,6 +452,7 @@ class PackageTool(object):
         return charms_list
 
     def _charms_search_on_osm_im_dict(self, osm_im_dict, desc_type):
+        self._logger.debug("")
         charms_list = []
         for k1, v1 in osm_im_dict.items():
             for k2, v2 in v1.items():
@@ -469,6 +472,7 @@ class PackageTool(object):
         return charms_list
 
     def _charms_search_on_sol006_dict(self, sol006_dict, desc_type):
+        self._logger.debug("")
         charms_list = []
         for k1, v1 in sol006_dict.items():
             for k2, v2 in v1.items():
index c2bb0c9..efd2207 100644 (file)
@@ -150,6 +150,7 @@ class OSMRepo(Repo):
             :param origin: origin directory for getting all the artifacts
             :param destination: destination folder for create and index the valid artifacts
         """
+        self._logger.debug("")
         if destination == '.':
             if origin == destination:
                 destination = 'repository'
@@ -179,6 +180,7 @@ class OSMRepo(Repo):
             :param fname: file path
             :return: checksum string
         """
+        self._logger.debug("")
         hash_md5 = hashlib.md5()
         with open(fname, "rb") as f:
             for chunk in iter(lambda: f.read(4096), b""):
@@ -193,6 +195,7 @@ class OSMRepo(Repo):
             :param package_type: type of artifact (vnf or ns)
             :return: fields
         """
+        self._logger.debug("")
         fields = {}
         base_path = '/{}/'.format(package_type)
         aux_dict = {}
@@ -252,6 +255,7 @@ class OSMRepo(Repo):
             :param path: file path
             :return: status details, status, fields, package_type
         """
+        self._logger.debug("")
         package_type = ''
         folder = ''
         try:
@@ -291,6 +295,7 @@ class OSMRepo(Repo):
             file: VNF or NS
             destination: path for index creation
         """
+        self._logger.debug("")
         pt = PackageTool()
         compresed = False
         try:
@@ -320,6 +325,7 @@ class OSMRepo(Repo):
             :param package_type: package type (vnf, ns)
             :param fields: dict with the required values
         """
+        self._logger.debug("")
         data_ind = {'name': fields.get('name'), 'description': fields.get('description'),
                     'vendor': fields.get('vendor'), 'path': fields.get('path')}
 
@@ -360,6 +366,7 @@ class OSMRepo(Repo):
             Datetime Generator
             :return: Datetime as string with the following structure "2020-04-29T08:41:07.681653Z"
         """
+        self._logger.debug("")
         return time.strftime('%Y-%m-%dT%H:%M:%S.%sZ')
 
     def init_directory(self, destination):
@@ -368,6 +375,7 @@ class OSMRepo(Repo):
             :param destination:
             :return:
         """
+        self._logger.debug("")
         if not isdir(destination):
             mkdir(destination)
         if not isfile(join(destination, 'index.yaml')):
@@ -377,3 +385,4 @@ class OSMRepo(Repo):
                           'ns_packages': {}}
             with open(join(destination, 'index.yaml'), 'w') as outfile:
                 ruamel.yaml.dump(index_data, outfile, default_flow_style=False)
+