"Error cannot read from repository {} '{}': {}".format(
repository["name"], repository["url"], e
),
- exc_info=True
+ exc_info=True,
)
continue
artifacts = []
directories = []
for f in listdir(origin):
- if isfile(join(origin, f)) and f.endswith('.tar.gz'):
+ if isfile(join(origin, f)) and f.endswith(".tar.gz"):
artifacts.append(f)
- elif isdir(join(origin, f)) and f != destination.split('/')[-1] and not f.startswith('.'):
- directories.append(f) # TODO: Document that nested directories are not supported
+ elif (
+ isdir(join(origin, f))
+ and f != destination.split("/")[-1]
+ and not f.startswith(".")
+ ):
+ directories.append(
+ f
+ ) # TODO: Document that nested directories are not supported
else:
self._logger.debug(f"Ignoring {f}")
for artifact in artifacts:
if descriptor_dict.get("vnfd-catalog", False):
aux_dict = descriptor_dict.get("vnfd-catalog", {}).get("vnfd", [{}])[0]
elif descriptor_dict.get("vnfd:vnfd-catalog"):
- aux_dict = descriptor_dict.get("vnfd:vnfd-catalog", {}).get("vnfd", [{}])[0]
+ aux_dict = descriptor_dict.get("vnfd:vnfd-catalog", {}).get(
+ "vnfd", [{}]
+ )[0]
elif descriptor_dict.get("vnfd"):
aux_dict = descriptor_dict["vnfd"]
if aux_dict.get("vnfd"):
- aux_dict = aux_dict['vnfd'][0]
+ aux_dict = aux_dict["vnfd"][0]
else:
msg = f"Unexpected descriptor format {descriptor_dict}"
self._logger.error(msg)
raise ValueError(msg)
- self._logger.debug(f"Extracted descriptor info for {package_type}: {aux_dict}")
+ self._logger.debug(
+ f"Extracted descriptor info for {package_type}: {aux_dict}"
+ )
images = []
- for vdu in aux_dict.get("vdu", aux_dict.get('kdu', ())):
- images.append(vdu.get("image", vdu.get('name')))
+ for vdu in aux_dict.get("vdu", aux_dict.get("kdu", ())):
+ images.append(vdu.get("image", vdu.get("name")))
fields["images"] = images
elif package_type == "ns":
if descriptor_dict.get("nsd-catalog", False):
aux_dict = descriptor_dict.get("nsd-catalog", {}).get("nsd", [{}])[0]
elif descriptor_dict.get("nsd:nsd-catalog"):
- aux_dict = descriptor_dict.get("nsd:nsd-catalog", {}).get("nsd", [{}])[0]
+ aux_dict = descriptor_dict.get("nsd:nsd-catalog", {}).get("nsd", [{}])[
+ 0
+ ]
elif descriptor_dict.get("nsd"):
- aux_dict = descriptor_dict['nsd']
+ aux_dict = descriptor_dict["nsd"]
if aux_dict.get("nsd"):
aux_dict = descriptor_dict["nsd"]["nsd"][0]
else:
for vnf in aux_dict.get("constituent-vnfd", ()):
vnfs.append(vnf.get("vnfd-id-ref"))
else:
- vnfs = aux_dict.get('vnfd-id')
+ vnfs = aux_dict.get("vnfd-id")
self._logger.debug("Used VNFS in the NSD: " + str(vnfs))
fields["vnfd-id-ref"] = vnfs
- elif package_type == 'nst':
+ elif package_type == "nst":
if descriptor_dict.get("nst-catalog", False):
aux_dict = descriptor_dict.get("nst-catalog", {}).get("nst", [{}])[0]
elif descriptor_dict.get("nst:nst-catalog"):
- aux_dict = descriptor_dict.get("nst:nst-catalog", {}).get("nst", [{}])[0]
+ aux_dict = descriptor_dict.get("nst:nst-catalog", {}).get("nst", [{}])[
+ 0
+ ]
elif descriptor_dict.get("nst"):
- aux_dict = descriptor_dict['nst']
+ aux_dict = descriptor_dict["nst"]
if aux_dict.get("nst"):
aux_dict = descriptor_dict["nst"]["nst"][0]
nsds = []