X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=ice_validator%2Fpreload%2Fenvironment.py;h=120e3c8240299e106d095ccb77989a2710d731e4;hb=4c2a2033d927552f7e9281e516afba38f146c242;hp=0477e661147d74276196229dee569d9edbdc41ca;hpb=ed4e48f967b1fccdd3fb142c0a166ee04ad6c2b0;p=vvp%2Fvalidation-scripts.git diff --git a/ice_validator/preload/environment.py b/ice_validator/preload/environment.py index 0477e66..120e3c8 100644 --- a/ice_validator/preload/environment.py +++ b/ice_validator/preload/environment.py @@ -1,3 +1,4 @@ +import os import re import tempfile from pathlib import Path @@ -50,6 +51,12 @@ class CloudServiceArchive: :param vf_module: name of Heat module (no path or file extension) :return: The definition of the module as a dict or None if not found """ + if ( + vf_module.endswith(".env") + or vf_module.endswith(".yaml") + or vf_module.endswith(".yml") + ): + vf_module = os.path.splitext(vf_module)[0] groups = self._service.get("topology_template", {}).get("groups", {}) for props in groups.values(): module_label = props.get("properties", {}).get("vf_module_label", "") @@ -102,7 +109,7 @@ class CloudServiceArchive: service_name = self.service_name instance_name = self.get_vf_module_resource_name(module) if service_name and instance_name: - return "{}/{}".format(service_name, instance_name) + return "{}/{} 0".format(service_name, instance_name) @property def vf_module_resource_names(self): @@ -286,7 +293,6 @@ class PreloadEnvironment: class EnvironmentFilePreloadInstance(AbstractPreloadInstance): - def __init__(self, env: PreloadEnvironment, module_label: str, module_params: dict): self.module_params = module_params self._module_label = module_label @@ -390,7 +396,6 @@ class EnvironmentFilePreloadInstance(AbstractPreloadInstance): class EnvironmentFileDataSource(AbstractPreloadDataSource): - def __init__(self, path: Path): super().__init__(path) check(path.is_dir(), f"{path} must be an existing directory")