Determine layered deployment by schema layout

This commit is contained in:
Eliise 2021-08-12 14:25:27 +00:00
Родитель 2eb11296a6
Коммит 419f926542
3 изменённых файлов: 11 добавлений и 15 удалений

Просмотреть файл

@ -31,7 +31,6 @@ CONTAINER_REGISTRY_PASSWORD=""
#
EDGE_RUNTIME_VERSION="1.0"
LAYERED_RUNTIME_TAG="1.0"
#
# MODULES

Просмотреть файл

@ -86,10 +86,6 @@ class DeploymentManifest:
except KeyError as err:
raise KeyError("Missing key {0} in file {1}".format(err, self.path))
def has_system_modules(self):
"""Check if system modules exist in the deployment manifest"""
return self.has_desired_property("$edgeAgent", "systemModules")
def get_all_modules(self):
all_modules = {}
all_modules.update(self.get_user_modules())
@ -101,12 +97,16 @@ class DeploymentManifest:
def get_desired_property(self, module, prop):
return self._get_module_content()[module]["properties.desired"][prop]
def has_desired_property(self, module, prop):
return prop in self._get_module_content()[module]["properties.desired"]
def get_template_schema_ver(self):
return self.json.get("$schema-template", "")
def has_system_modules(self):
"""Check if system modules exist in the deployment manifest"""
return self.has_desired_property("$edgeAgent", "systemModules")
def has_desired_property(self, module, prop):
return prop in self._get_module_content()[module]["properties.desired"]
def convert_create_options(self):
modules = self.get_all_modules()
for module_name, module_info in modules.items():
@ -159,7 +159,7 @@ class DeploymentManifest:
def validate_deployment_manifest(self):
validation_success = True
try:
if not self.envvars.LAYERED_RUNTIME_TAG:
if self.is_layered_deployment_schema():
validation_success = self._validate_deployment_manifest_schema()
validation_success &= self._validate_create_options()
except Exception as err:
@ -167,6 +167,9 @@ class DeploymentManifest:
return validation_success
def is_layered_deployment_schema(self):
return "content" in self.json
@staticmethod
def get_image_placeholder(module_name, is_debug=False):
return "${{MODULES.{0}}}".format(module_name + ".debug" if is_debug else module_name)

Просмотреть файл

@ -19,12 +19,6 @@
},
"$edgeHub": {
"properties.desired.routes.upstream": "FROM /messages/* INTO $upstream"
},
"LayeredDeploymentTempSensor": {
"properties.desired": {
"SendData": true,
"SendInterval": 5
}
}
}
}