Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_get_deployment_manifest_name():
assert Utility.get_deployment_manifest_name("config/deployment.template.json", "0.0.1", "amd64") == "deployment.json"
assert Utility.get_deployment_manifest_name("deployment.template.json", "0.0.1", "amd64") == "deployment.json"
assert Utility.get_deployment_manifest_name("deployment.debug.template.json", "0.0.1", "amd64") == "deployment.debug.json"
assert Utility.get_deployment_manifest_name("config/deployment.template.json", "1.0.0", "amd64") == "deployment.amd64.json"
assert Utility.get_deployment_manifest_name("deployment.template.json", "1.0.0", "amd64") == "deployment.amd64.json"
assert Utility.get_deployment_manifest_name("deployment.debug.template.json", "1.0.0", "amd64") == "deployment.debug.amd64.json"
assert Utility.get_deployment_manifest_name("", "", "") == "deployment.json"
os.environ["DEPLOYMENT_CONFIG_FILE"] = "foo.json"
assert Utility.get_deployment_manifest_name("deployment.debug.template.json", "1.0.0", "amd64") == "foo.json"
def test_get_deployment_manifest_name():
assert Utility.get_deployment_manifest_name("config/deployment.template.json", "0.0.1", "amd64") == "deployment.json"
assert Utility.get_deployment_manifest_name("deployment.template.json", "0.0.1", "amd64") == "deployment.json"
assert Utility.get_deployment_manifest_name("deployment.debug.template.json", "0.0.1", "amd64") == "deployment.debug.json"
assert Utility.get_deployment_manifest_name("config/deployment.template.json", "1.0.0", "amd64") == "deployment.amd64.json"
assert Utility.get_deployment_manifest_name("deployment.template.json", "1.0.0", "amd64") == "deployment.amd64.json"
assert Utility.get_deployment_manifest_name("deployment.debug.template.json", "1.0.0", "amd64") == "deployment.debug.amd64.json"
assert Utility.get_deployment_manifest_name("", "", "") == "deployment.json"
os.environ["DEPLOYMENT_CONFIG_FILE"] = "foo.json"
assert Utility.get_deployment_manifest_name("deployment.debug.template.json", "1.0.0", "amd64") == "foo.json"
def test_get_deployment_manifest_name():
assert Utility.get_deployment_manifest_name("config/deployment.template.json", "0.0.1", "amd64") == "deployment.json"
assert Utility.get_deployment_manifest_name("deployment.template.json", "0.0.1", "amd64") == "deployment.json"
assert Utility.get_deployment_manifest_name("deployment.debug.template.json", "0.0.1", "amd64") == "deployment.debug.json"
assert Utility.get_deployment_manifest_name("config/deployment.template.json", "1.0.0", "amd64") == "deployment.amd64.json"
assert Utility.get_deployment_manifest_name("deployment.template.json", "1.0.0", "amd64") == "deployment.amd64.json"
assert Utility.get_deployment_manifest_name("deployment.debug.template.json", "1.0.0", "amd64") == "deployment.debug.amd64.json"
assert Utility.get_deployment_manifest_name("", "", "") == "deployment.json"
os.environ["DEPLOYMENT_CONFIG_FILE"] = "foo.json"
assert Utility.get_deployment_manifest_name("deployment.debug.template.json", "1.0.0", "amd64") == "foo.json"
def test_get_deployment_manifest_name():
assert Utility.get_deployment_manifest_name("config/deployment.template.json", "0.0.1", "amd64") == "deployment.json"
assert Utility.get_deployment_manifest_name("deployment.template.json", "0.0.1", "amd64") == "deployment.json"
assert Utility.get_deployment_manifest_name("deployment.debug.template.json", "0.0.1", "amd64") == "deployment.debug.json"
assert Utility.get_deployment_manifest_name("config/deployment.template.json", "1.0.0", "amd64") == "deployment.amd64.json"
assert Utility.get_deployment_manifest_name("deployment.template.json", "1.0.0", "amd64") == "deployment.amd64.json"
assert Utility.get_deployment_manifest_name("deployment.debug.template.json", "1.0.0", "amd64") == "deployment.debug.amd64.json"
assert Utility.get_deployment_manifest_name("", "", "") == "deployment.json"
os.environ["DEPLOYMENT_CONFIG_FILE"] = "foo.json"
assert Utility.get_deployment_manifest_name("deployment.debug.template.json", "1.0.0", "amd64") == "foo.json"
def test_get_deployment_manifest_name():
assert Utility.get_deployment_manifest_name("config/deployment.template.json", "0.0.1", "amd64") == "deployment.json"
assert Utility.get_deployment_manifest_name("deployment.template.json", "0.0.1", "amd64") == "deployment.json"
assert Utility.get_deployment_manifest_name("deployment.debug.template.json", "0.0.1", "amd64") == "deployment.debug.json"
assert Utility.get_deployment_manifest_name("config/deployment.template.json", "1.0.0", "amd64") == "deployment.amd64.json"
assert Utility.get_deployment_manifest_name("deployment.template.json", "1.0.0", "amd64") == "deployment.amd64.json"
assert Utility.get_deployment_manifest_name("deployment.debug.template.json", "1.0.0", "amd64") == "deployment.debug.amd64.json"
assert Utility.get_deployment_manifest_name("", "", "") == "deployment.json"
os.environ["DEPLOYMENT_CONFIG_FILE"] = "foo.json"
assert Utility.get_deployment_manifest_name("deployment.debug.template.json", "1.0.0", "amd64") == "foo.json"
"username": self.envvars.CONTAINER_REGISTRY_MAP[registry_key].username,
"password": self.envvars.CONTAINER_REGISTRY_MAP[registry_key].password})
docker.process_api_response(response)
self.output.footer("BUILD COMPLETE", suppress=no_build)
self.output.footer("PUSH COMPLETE", suppress=no_push)
self.output.info("Expanding image placeholders")
deployment_manifest.expand_image_placeholders(replacements)
self.output.info("Converting createOptions")
deployment_manifest.convert_create_options()
self.output.info("Deleting template schema version")
template_schema_ver = deployment_manifest.get_template_schema_ver()
deployment_manifest.del_key(["$schema-template"])
self.utility.ensure_dir(self.envvars.CONFIG_OUTPUT_DIR)
gen_deployment_manifest_name = Utility.get_deployment_manifest_name(template_file, template_schema_ver, default_platform)
gen_deployment_manifest_path = os.path.join(self.envvars.CONFIG_OUTPUT_DIR, gen_deployment_manifest_name)
self.output.info("Expanding '{0}' to '{1}'".format(os.path.basename(template_file), gen_deployment_manifest_path))
deployment_manifest.dump(gen_deployment_manifest_path)
self.output.info("Validating generated deployment manifest %s" % gen_deployment_manifest_path)
validation_success = deployment_manifest.validate_deployment_manifest()
if fail_on_validation_error and not validation_success:
raise Exception("Deployment manifest validation failed. Please see previous logs for more details.")
return gen_deployment_manifest_path
if self.DEVICE_CONNECTION_STRING:
self.DEVICE_CONNECTION_INFO = DeviceConnectionString(self.DEVICE_CONNECTION_STRING)
except Exception as ex:
raise ValueError("Unable to parse DEVICE_CONNECTION_STRING Environment Variable. Please ensure that you have the right connection string set. {0}".format(str(ex)))
self.get_registries()
self.BYPASS_MODULES = self.get_envvar("BYPASS_MODULES", default="")
self.CONTAINER_TAG = self.get_envvar("CONTAINER_TAG", default="")
self.RUNTIME_TAG = self.get_envvar("RUNTIME_TAG", default="1.0")
self.CONFIG_OUTPUT_DIR = self.get_envvar("CONFIG_OUTPUT_DIR", default=Constants.default_config_folder)
self.DEPLOYMENT_CONFIG_TEMPLATE_FILE = self.get_envvar("DEPLOYMENT_CONFIG_TEMPLATE_FILE", default=Constants.default_deployment_template_file)
self.DEPLOYMENT_CONFIG_DEBUG_TEMPLATE_FILE = self.get_envvar("DEPLOYMENT_CONFIG_DEBUG_TEMPLATE_FILE", default=Constants.default_deployment_debug_template_file)
self.DEFAULT_PLATFORM = self.get_envvar("DEFAULT_PLATFORM", default=Constants.default_platform)
self.DEPLOYMENT_CONFIG_FILE = Utility.get_deployment_manifest_name(self.DEPLOYMENT_CONFIG_TEMPLATE_FILE, None, self.DEFAULT_PLATFORM)
self.MODULES_PATH = self.get_envvar("MODULES_PATH", default=Constants.default_modules_folder)
self.LOGS_PATH = self.get_envvar("LOGS_PATH", default="logs")
self.LOGS_CMD = self.get_envvar("LOGS_CMD", default="start /B start cmd.exe @cmd /k docker logs {0} -f")
self.SUBSCRIPTION_ID = self.get_envvar("SUBSCRIPTION_ID")
self.RESOURCE_GROUP_NAME = self.get_envvar("RESOURCE_GROUP_NAME")
self.RESOURCE_GROUP_LOCATION = self.get_envvar("RESOURCE_GROUP_LOCATION")
self.IOTHUB_NAME = self.get_envvar("IOTHUB_NAME")
self.IOTHUB_SKU = self.get_envvar("IOTHUB_SKU")
self.EDGE_DEVICE_ID = self.get_envvar("EDGE_DEVICE_ID")
self.CREDENTIALS = self.get_envvar("CREDENTIALS")
self.UPDATE_DOTENV = self.get_envvar("UPDATE_DOTENV")
except Exception as ex:
msg = "Environment variables not configured correctly. Run `iotedgedev new` to create a new solution with sample .env file. "
"Please see README for variable configuration options. Tip: You might just need to restart your command prompt to refresh your Environment Variables. "
"Variable that caused exception: {0}".format(str(ex))
raise ValueError(msg)