def _setup_cleaner(self): LOG.info("Configuring cleaner template %s.", CLEANER_DATA_CONF) (_, contents) = utils.load_template(self.component_name, CLEANER_DATA_CONF) tgt_fn = sh.joinpths(self.bindir, CLEANER_DATA_CONF) sh.write_file(tgt_fn, contents) sh.chmod(tgt_fn, 0755) self.tracewriter.file_touched(tgt_fn)
def _setup_cleaner(self): LOG.info("Configuring cleaner template %s.", CLEANER_DATA_CONF) (_, contents) = utils.load_template(self.component_name, CLEANER_DATA_CONF) tgt_fn = sh.joinpths(self.bin_dir, CLEANER_DATA_CONF) sh.write_file(tgt_fn, contents) sh.chmod(tgt_fn, 0755) self.tracewriter.file_touched(tgt_fn)
def _setup_network_initer(self): LOG.info("Configuring nova network initializer template %s.", NET_INIT_CONF) (_, contents) = utils.load_template(self.component_name, NET_INIT_CONF) params = self._get_param_map(NET_INIT_CONF) contents = utils.param_replace(contents, params, True) tgt_fn = sh.joinpths(self.bindir, NET_INIT_CONF) sh.write_file(tgt_fn, contents) sh.chmod(tgt_fn, 0755) self.tracewriter.file_touched(tgt_fn)
def _setup_initer(self): LOG.info("Configuring keystone initializer template %s.", MANAGE_DATA_CONF) (_, contents) = utils.load_template(self.component_name, MANAGE_DATA_CONF) params = self._get_param_map(MANAGE_DATA_CONF) contents = utils.param_replace(contents, params, True) tgt_fn = sh.joinpths(self.bindir, MANAGE_DATA_CONF) sh.write_file(tgt_fn, contents) sh.chmod(tgt_fn, 0755) self.tracewriter.file_touched(tgt_fn)
def _setup_initer(self): LOG.info("Configuring keystone initializer template %r", MANAGE_DATA_CONF) (_, contents) = utils.load_template(self.component_name, MANAGE_DATA_CONF) mp = self._get_param_map(MANAGE_DATA_CONF) contents = utils.param_replace(contents, mp, True) # FIXME, stop placing in checkout dir... tgt_fn = sh.joinpths(self.bin_dir, MANAGE_DATA_CONF) sh.write_file(tgt_fn, contents) sh.chmod(tgt_fn, 0755) self.tracewriter.file_touched(tgt_fn)
def _setup_network_initer(self): LOG.info("Configuring nova network initializer template %s.", NET_INIT_CONF) (_, contents) = utils.load_template(self.component_name, NET_INIT_CONF) params = self._get_param_map(NET_INIT_CONF) contents = utils.param_replace(contents, params, True) tgt_fn = sh.joinpths(self.bin_dir, NET_INIT_CONF) sh.write_file(tgt_fn, contents) sh.chmod(tgt_fn, 0755) self.tracewriter.file_touched(tgt_fn)
def _get_source_config(self, config_fn): if config_fn == API_CONF: (fn, top) = utils.load_template(self.component_name, API_CONF) (_, bottom) = self._get_source_config(API_PASTE_CONF) combined = [top, "### Joined here on %s with file %s" % (date.rcf8222date(), API_PASTE_CONF), bottom] return (fn, utils.joinlinesep(*combined)) elif config_fn == REG_CONF: (fn, top) = utils.load_template(self.component_name, REG_CONF) (_, bottom) = self._get_source_config(REG_PASTE_CONF) combined = [top, "### Joined here on %s with file %s" % (date.rcf8222date(), REG_PASTE_CONF), bottom] return (fn, utils.joinlinesep(*combined)) elif config_fn == POLICY_JSON: fn = sh.joinpths(self.cfgdir, POLICY_JSON) contents = sh.load_file(fn) return (fn, contents) elif config_fn == LOGGING_CONF: fn = sh.joinpths(self.cfgdir, LOGGING_SOURCE_FN) contents = sh.load_file(fn) return (fn, contents) return comp.PythonInstallComponent._get_source_config(self, config_fn)
def _setup_initer(self): LOG.info("Configuring keystone initializer template %s.", MANAGE_DATA_CONF) (_, contents) = utils.load_template(self.component_name, MANAGE_DATA_CONF) params = self._get_param_map(MANAGE_DATA_CONF) contents = utils.param_replace(contents, params, True) tgt_fn = sh.joinpths(self.bin_dir, MANAGE_DATA_CONF) sh.write_file(tgt_fn, contents) sh.chmod(tgt_fn, 0755) self.tracewriter.file_touched(tgt_fn)
def _setup_data(self): LOG.info("Configuring data setup template %s", MANAGE_DATA_CONF) (src_fn, contents) = utils.load_template(self.component_name, MANAGE_DATA_CONF) params = self._get_param_map(MANAGE_DATA_CONF) contents = utils.param_replace(contents, params, True) tgt_fn = sh.joinpths(self.bindir, MANAGE_DATA_CONF) sh.write_file(tgt_fn, contents) # This environment additions are important # in that they eventually affect how this script runs env = dict() env['ENABLED_SERVICES'] = ",".join(self.instances.keys()) env['BIN_DIR'] = self.bindir setup_cmd = MANAGER_CMD_ROOT + [tgt_fn] LOG.info("Running (%s) command to setup keystone." % (" ".join(setup_cmd))) sh.execute(*setup_cmd, env_overrides=env)
def _do_upstart_configure(self, app_name, runtime_info): (app_pth, _, program_args) = runtime_info # TODO FIXME symlinks won't work. Need to copy the files there. # https://bugs.launchpad.net/upstart/+bug/665022 cfg_fn = sh.joinpths(CONF_ROOT, app_name + CONF_EXT) if sh.isfile(cfg_fn): LOG.info("Upstart config file already exists: %s" % (cfg_fn)) return LOG.debug("Loading upstart template to be used by: %s" % (cfg_fn)) (_, contents) = utils.load_template('general', UPSTART_CONF_TMPL) params = self._get_upstart_conf_params(app_pth, app_name, *program_args) adjusted_contents = utils.param_replace(contents, params) LOG.debug("Generated up start config for %s: %s" % (app_name, adjusted_contents)) with sh.Rooted(True): sh.write_file(cfg_fn, adjusted_contents) sh.chmod(cfg_fn, 0666)
def _do_upstart_configure(self, app_name, runtime_info): (app_pth, _, program_args) = runtime_info # TODO FIXME symlinks won't work. Need to copy the files there. # https://bugs.launchpad.net/upstart/+bug/665022 cfg_fn = sh.joinpths(CONF_ROOT, app_name + CONF_EXT) if sh.isfile(cfg_fn): LOG.debug("Upstart config file already exists: %s" % (cfg_fn)) return LOG.debug("Loading upstart template to be used by: %s" % (cfg_fn)) (_, contents) = utils.load_template('general', UPSTART_CONF_TMPL) params = self._get_upstart_conf_params(app_pth, app_name, *program_args) adjusted_contents = utils.param_replace(contents, params) LOG.debug("Generated up start config for %s: %s" % (app_name, adjusted_contents)) with sh.Rooted(True): sh.write_file(cfg_fn, adjusted_contents) sh.chmod(cfg_fn, 0666)
def _get_source_config(self, config_fn): return utils.load_template(self.component_name, config_fn)