More cleanup around rc file names.

This commit is contained in:
Joshua Harlow 2012-02-16 22:17:05 -08:00
parent 1f3c6717ed
commit ed80a4e726
4 changed files with 18 additions and 14 deletions

@ -213,8 +213,7 @@ class KeystoneRuntime(comp.PythonRuntime):
LOG.info("Running (%s) command to initialize keystone." % (" ".join(setup_cmd)))
(sysout, stderr) = sh.execute(*setup_cmd, env_overrides=env, run_as_root=False)
if sysout:
ec2rcfn = self.cfg.getdefaulted("keystone", "ec2_rc_fn", EC2RC_FN)
sh.write_file(ec2rcfn, sysout)
sh.write_file(settings.EC2RC_FN, sysout)
LOG.debug("Removing (%s) file since we successfully initialized keystone." % (tgt_fn))
sh.unlink(tgt_fn)

@ -21,6 +21,8 @@ import subprocess
from devstack import date
from devstack import env
from devstack import settings
from devstack import shell as sh
#general extraction cfg keys
CFG_MAKE = {
@ -64,19 +66,22 @@ def _write_env(name, value, fh):
def _generate_extern_inc(fh):
_write_line('# External includes stuff', fh)
extern_inc = """
extern_tpl = """
# Use stored ec2 env variables
if [ -f ./ec2rc ]; then
source ./ec2rc
if [ -f "{ec2rc_fn}" ]; then
source "{ec2rc_fn}"
fi
# Allow local overrides of env variables
if [ -f ./localrc ]; then
source ./localrc
if [ -f "{localrc_fn}" ]; then
source "{localrc_fn}"
fi
"""
extern_inc = extern_tpl.format(ec2rc_fn=sh.abspth(settings.EC2RC_FN),
localrc_fn=sh.abspth(settings.LOCALRC_FN))
fh.write(extern_inc.strip())
_write_line("", fh)

@ -56,7 +56,7 @@ _NO_AUTO_STOP = [settings.DB, settings.RABBIT]
# For these actions we will attempt to make an rc file if it does not exist
_RC_FILE_MAKE_ACTIONS = [settings.INSTALL, settings.START]
_RC_FILE = 'openstackrc'
_RC_FILE = sh.abspth(settings.OSRC_FN)
# For these actions we will ensure the preq occurs first
_DEP_ACTIONS = {
@ -90,14 +90,9 @@ def _get_pkg_manager(distro, keep_packages):
return cls(distro, keep_packages)
def _get_rc_fn():
rc_fn = _RC_FILE
return sh.abspth(rc_fn)
def _pre_run(action_name, root_dir, pkg_manager, config, component_order, instances):
loaded_env = False
rc_fn = _get_rc_fn()
rc_fn = _RC_FILE
try:
if sh.isfile(rc_fn):
LOG.info("Attempting to load rc file at [%s] which has your environment settings." % (rc_fn))

@ -95,6 +95,11 @@ COMPONENT_TRACE_DIR = "traces"
COMPONENT_APP_DIR = "app"
COMPONENT_CONFIG_DIR = "config"
# RC files generated / used
EC2RC_FN = 'ec2rc'
LOCALRC_FN = 'localrc'
OSRC_FN = 'openstackrc'
# Program
# actions
INSTALL = "install"