예제 #1
0
    def spawn_instance(self, cfg_file, nolog_list=None):
        """
        Create and configure a new Dogtag instance using pkispawn.
        Passes in a configuration file with IPA-specific
        parameters.
        """
        subsystem = self.subsystem

        # Define the things we don't want logged
        if nolog_list is None:
            nolog_list = []
        nolog = tuple(nolog_list) + (self.admin_password, self.dm_password)

        args = [paths.PKISPAWN,
                "-s", subsystem,
                "-f", cfg_file]

        with open(cfg_file) as f:
            self.log.debug(
                'Contents of pkispawn configuration file (%s):\n%s',
                cfg_file, ipautil.nolog_replace(f.read(), nolog))

        try:
            ipautil.run(args, nolog=nolog)
        except ipautil.CalledProcessError as e:
            self.handle_setup_error(e)
예제 #2
0
    def spawn_instance(self, cfg_file, nolog_list=None):
        """
        Create and configure a new Dogtag instance using pkispawn.
        Passes in a configuration file with IPA-specific
        parameters.
        """
        subsystem = self.subsystem

        # Define the things we don't want logged
        if nolog_list is None:
            nolog_list = []
        nolog = tuple(nolog_list) + (self.admin_password, self.dm_password)

        args = [paths.PKISPAWN,
                "-s", subsystem,
                "-f", cfg_file]

        with open(cfg_file) as f:
            self.log.debug(
                'Contents of pkispawn configuration file (%s):\n%s',
                cfg_file, ipautil.nolog_replace(f.read(), nolog))

        try:
            ipautil.run(args, nolog=nolog)
        except ipautil.CalledProcessError, e:
            self.handle_setup_error(e)
예제 #3
0
    def spawn_instance(self, cfg_file, nolog_list=()):
        """
        Create and configure a new Dogtag instance using pkispawn.
        Passes in a configuration file with IPA-specific
        parameters.
        """
        subsystem = self.subsystem
        spawn_env = os.environ.copy()
        timeout = str(api.env.startup_timeout)
        spawn_env["PKISPAWN_STARTUP_TIMEOUT_SECONDS"] = timeout

        args = [paths.PKISPAWN, "-s", subsystem, "-f", cfg_file, "--debug"]

        # specify --log-file <path> on PKI 11.0.0 or later

        pki_version = pki.util.Version(pki.specification_version())
        if pki_version >= pki.util.Version("11.0.0"):
            timestamp = time.strftime("%Y%m%d%H%M%S",
                                      time.localtime(time.time()))
            log_file = os.path.join(
                paths.VAR_LOG_PKI_DIR,
                "pki-%s-spawn.%s.log" % (self.subsystem.lower(), timestamp))
            args.extend(["--log-file", log_file])

        with open(cfg_file) as f:
            logger.debug('Contents of pkispawn configuration file (%s):\n%s',
                         cfg_file, ipautil.nolog_replace(f.read(), nolog_list))

        try:
            ipautil.run(args, nolog=nolog_list, env=spawn_env)
        except ipautil.CalledProcessError as e:
            self.handle_setup_error(e)
예제 #4
0
    def spawn_instance(self, cfg_file, nolog_list=()):
        """
        Create and configure a new Dogtag instance using pkispawn.
        Passes in a configuration file with IPA-specific
        parameters.
        """
        subsystem = self.subsystem
        args = [paths.PKISPAWN, "-s", subsystem, "-f", cfg_file]

        with open(cfg_file) as f:
            logger.debug('Contents of pkispawn configuration file (%s):\n%s',
                         cfg_file, ipautil.nolog_replace(f.read(), nolog_list))

        try:
            ipautil.run(args, nolog=nolog_list)
        except ipautil.CalledProcessError as e:
            self.handle_setup_error(e)
예제 #5
0
    def spawn_instance(self, cfg_file, nolog_list=()):
        """
        Create and configure a new Dogtag instance using pkispawn.
        Passes in a configuration file with IPA-specific
        parameters.
        """
        subsystem = self.subsystem
        args = [paths.PKISPAWN,
                "-s", subsystem,
                "-f", cfg_file]

        with open(cfg_file) as f:
            self.log.debug(
                'Contents of pkispawn configuration file (%s):\n%s',
                cfg_file, ipautil.nolog_replace(f.read(), nolog_list))

        try:
            ipautil.run(args, nolog=nolog_list)
        except ipautil.CalledProcessError as e:
            self.handle_setup_error(e)
예제 #6
0
    def spawn_instance(self, cfg_file, nolog_list=()):
        """
        Create and configure a new Dogtag instance using pkispawn.
        Passes in a configuration file with IPA-specific
        parameters.
        """
        subsystem = self.subsystem
        spawn_env = os.environ.copy()
        timeout = str(api.env.startup_timeout)
        spawn_env["PKISPAWN_STARTUP_TIMEOUT_SECONDS"] = timeout

        args = [paths.PKISPAWN, "-s", subsystem, "-f", cfg_file, "--debug"]

        with open(cfg_file) as f:
            logger.debug('Contents of pkispawn configuration file (%s):\n%s',
                         cfg_file, ipautil.nolog_replace(f.read(), nolog_list))

        try:
            ipautil.run(args, nolog=nolog_list, env=spawn_env)
        except ipautil.CalledProcessError as e:
            self.handle_setup_error(e)