Ejemplo n.º 1
0
    def _callCli(self, path):
        cmd = [self.cli, "--config=%s" % self.config_file, "create", "-f", path]

        if self.dryrun:
            logger.info("Calling: %s", " ".join(cmd))
        else:
            Utils.run_cmd(cmd, checkexitcode=True)
Ejemplo n.º 2
0
    def _processTemplate(self, path):
        cmd = [self.cli, "--config=%s" % self.config_file, "process", "-f", path]

        name = "config-%s" % os.path.basename(path)
        output_path = os.path.join(self.path, name)
        if self.cli and not self.dryrun:
            ec, stdout, stderr = Utils.run_cmd(cmd, checkexitcode=True)
            logger.debug("Writing processed template to %s", output_path)
            with open(output_path, "w") as fp:
                fp.write(stdout)
        return name
Ejemplo n.º 3
0
    def _call(self, cmd):
        """Calls given command

        :arg cmd: Command to be called in a form of list
        :raises: Exception
        """

        if self.dryrun:
            logger.info("DRY-RUN: %s", " ".join(cmd))
        else:
            ec, stdout, stderr = Utils.run_cmd(cmd, checkexitcode=True)
            return stdout
Ejemplo n.º 4
0
    def _call(self, cmd):
        """Calls given command

        :arg cmd: Command to be called in a form of list
        :raises: Exception
        """

        if self.dryrun:
            logger.info("DRY-RUN: %s", " ".join(cmd))
        else:
            ec, stdout, stderr = Utils.run_cmd(cmd, checkexitcode=True)
            return stdout