How to use the iotedgedev.compat.FileNotFoundError function in iotedgedev

To help you get started, we’ve selected a few iotedgedev examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Azure / iotedgedev / iotedgedev / module.py View on Github external
def load_module_json(self):
        if os.path.exists(self.module_json_file):
            try:
                self.file_json_content = json.loads(Utility.get_file_contents(self.module_json_file, expandvars=True))
            except KeyError as e:
                raise KeyError("Error parsing {0} from module.json file : {1}".format(str(e), self.module_json_file))
            except IOError:
                raise IOError("Error loading module.json file : {0}".format(self.module_json_file))
        else:
            raise FileNotFoundError("No module.json file found. module.json file is required in the root of your module folder")
github Azure / iotedgedev / iotedgedev / deploymentmanifest.py View on Github external
self.output = output
        try:
            self.path = path
            self.is_template = is_template
            self.json = json.loads(Utility.get_file_contents(path, expandvars=expand_vars))
        except FileNotFoundError:
            if is_template:
                deployment_manifest_path = self.envvars.DEPLOYMENT_CONFIG_FILE_PATH
                if os.path.exists(deployment_manifest_path):
                    self.output.error('Deployment manifest template file "{0}" not found'.format(path))
                    if output.confirm('Would you like to make a copy of the deployment manifest file "{0}" as the deployment template file?'.format(deployment_manifest_path), default=True):
                        shutil.copyfile(deployment_manifest_path, path)
                        self.json = json.load(open(self.envvars.DEPLOYMENT_CONFIG_FILE_PATH))
                        self.envvars.save_envvar("DEPLOYMENT_CONFIG_TEMPLATE_FILE", path)
                else:
                    raise FileNotFoundError('Deployment manifest file "{0}" not found'.format(path))
            else:
                raise FileNotFoundError('Deployment manifest file "{0}" not found'.format(path))
github Azure / iotedgedev / iotedgedev / utility.py View on Github external
def check_dependency(self, params, description):
        try:
            self.exe_proc(params, shell=not self.envvars.is_posix(), suppress_out=True)
        except FileNotFoundError:
            raise FileNotFoundError("{0} is required by the Azure IoT Edge Dev Tool. For installation instructions, see https://aka.ms/iotedgedevwiki.".format(description))
github Azure / iotedgedev / iotedgedev / utility.py View on Github external
def check_dependency(self, params, description):
        try:
            self.exe_proc(params, shell=not self.envvars.is_posix(), suppress_out=True)
        except FileNotFoundError:
            raise FileNotFoundError("{0} is required by the Azure IoT Edge Dev Tool. For installation instructions, see https://aka.ms/iotedgedevwiki.".format(description))
github Azure / iotedgedev / iotedgedev / simulator.py View on Github external
def start_solution(self, manifest_file, default_platform, verbose=True, build=False):
        if build:
            mod = Modules(self.envvars, self.output)
            manifest_file = mod.build(manifest_file, default_platform)

        if not os.path.exists(manifest_file):
            raise FileNotFoundError("Deployment manifest {0} not found. Please build the solution before starting IoT Edge simulator.".format(self.envvars.DEPLOYMENT_CONFIG_FILE_PATH))

        self.output.header("Starting IoT Edge Simulator in Solution Mode")

        cmd = ["iotedgehubdev", "start", "-d", manifest_file]
        if verbose:
            cmd.append("-v")
        self.utility.call_proc(cmd)
github Azure / iotedgedev / iotedgedev / deploymentmanifest.py View on Github external
def __init__(self, envvars, output, utility, path, is_template, expand_vars=True):
        self.envvars = envvars
        self.utility = utility
        self.output = output
        try:
            self.path = path
            self.is_template = is_template
            self.json = json.loads(Utility.get_file_contents(path, expandvars=expand_vars))
        except FileNotFoundError:
            if is_template:
                deployment_manifest_path = self.envvars.DEPLOYMENT_CONFIG_FILE_PATH
                if os.path.exists(deployment_manifest_path):
                    self.output.error('Deployment manifest template file "{0}" not found'.format(path))
                    if output.confirm('Would you like to make a copy of the deployment manifest file "{0}" as the deployment template file?'.format(deployment_manifest_path), default=True):
                        shutil.copyfile(deployment_manifest_path, path)
                        self.json = json.load(open(self.envvars.DEPLOYMENT_CONFIG_FILE_PATH))
                        self.envvars.save_envvar("DEPLOYMENT_CONFIG_TEMPLATE_FILE", path)
                else:
                    raise FileNotFoundError('Deployment manifest file "{0}" not found'.format(path))
            else:
                raise FileNotFoundError('Deployment manifest file "{0}" not found'.format(path))
github Azure / iotedgedev / iotedgedev / modules.py View on Github external
try:
            for platform in module.platforms:
                # get the Dockerfile from module.json
                dockerfile = module.get_dockerfile_by_platform(platform)
                container_tag = "" if self.envvars.CONTAINER_TAG == "" else "-" + self.envvars.CONTAINER_TAG
                tag = "{0}:{1}{2}-{3}".format(module.repository.lower(), module.tag_version, container_tag, platform)
                placeholder_tag_map["${{{0}.{1}}}".format(placeholder_base, platform)] = tag
                placeholder_tag_map[tag] = tag

                if platform == default_platform:
                    placeholder_tag_map["${{{0}}}".format(placeholder_base)] = tag
                elif platform == default_platform + ".debug":
                    placeholder_tag_map["${{{0}.{1}}}".format(placeholder_base, "debug")] = tag

                tag_build_profile_map[tag] = BuildProfile(dockerfile, module.context_path, module.build_options)
        except FileNotFoundError:
            pass
github Azure / iotedgedev / iotedgedev / azurecli.py View on Github external
def set_modules(self, device_id, connection_string, config):
        self.output.status(f("Deploying '{config}' to '{device_id}'..."))

        config = os.path.join(os.getcwd(), config)

        if not os.path.exists(config):
            raise FileNotFoundError('Deployment manifest file "{0}" not found. Please run `iotedgedev build` first'.format(config))

        telemetry.add_extra_props({'iothubhostname': connection_string.iothub_host.name_hash, 'iothubhostnamesuffix': connection_string.iothub_host.name_suffix})

        return self.invoke_az_cli_outproc(["iot", "edge", "set-modules", "-d", device_id, "-n", connection_string.iothub_host.hub_name, "-k", config, "-l", connection_string.connection_string],
                                          error_message=f("Failed to deploy '{config}' to '{device_id}'..."), suppress_output=True)