X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osmclient%2Fcommon%2Futils.py;h=aed7d2964a36359c130f4e64ee9749ed582ab73b;hb=1ad0860dfe31be33ea8b82e0f3e4bb327d0390d3;hp=94bd72f9c762c84cca5de6d24cb404301a715b66;hpb=15b8b64b9b3134b13f9b229329f0cc1f508aad38;p=osm%2Fosmclient.git diff --git a/osmclient/common/utils.py b/osmclient/common/utils.py index 94bd72f..aed7d29 100644 --- a/osmclient/common/utils.py +++ b/osmclient/common/utils.py @@ -59,8 +59,7 @@ def get_key_val_from_pkg(descriptor_file): tar = tarfile.open(descriptor_file) yamlfile = None for member in tar.getmembers(): - if (re.match('.*.yaml', member.name) and - len(member.name.split('/')) == 2): + if re.match(".*.yaml", member.name) and len(member.name.split("/")) == 2: yamlfile = member.name break if yamlfile is None: @@ -69,25 +68,25 @@ def get_key_val_from_pkg(descriptor_file): dict = yaml.safe_load(tar.extractfile(yamlfile)) result = {} for k in dict: - if 'nsd' in k: - result['type'] = 'nsd' + if "nsd" in k: + result["type"] = "nsd" else: - result['type'] = 'vnfd' - if 'type' not in result: + result["type"] = "vnfd" + if "type" not in result: for k1, v1 in list(dict.items()): - if not k1.endswith('-catalog'): + if not k1.endswith("-catalog"): continue for k2, v2 in v1.items(): - if not k2.endswith('nsd') and not k2.endswith('vnfd'): + if not k2.endswith("nsd") and not k2.endswith("vnfd"): continue - if 'nsd' in k2: - result['type'] = 'nsd' + if "nsd" in k2: + result["type"] = "nsd" else: - result['type'] = 'vnfd' + result["type"] = "vnfd" for entry in v2: for k3, v3 in list(entry.items()): # strip off preceeding chars before : - key_name = k3.split(':').pop() + key_name = k3.split(":").pop() result[key_name] = v3 tar.close()