Updating so that we don't write config files to the checked out code

This commit is contained in:
Joshua Harlow 2012-03-26 16:58:22 -07:00
parent 29c9ff69b0
commit f72e9deffb
10 changed files with 34 additions and 73 deletions

View File

@ -512,7 +512,10 @@ class ProgramRuntime(ComponentBase):
def _get_param_map(self, app_name):
return {
'ROOT': self.app_dir,
'COMPONENT_DIR': self.component_dir,
'APP_DIR': self.app_dir,
'CONFIG_DIR': self.cfg_dir,
'TRACE_DIR': self.trace_dir,
}
def pre_start(self):
@ -582,7 +585,6 @@ class ProgramRuntime(ComponentBase):
if cmd == settings.RUN_TYPE_TYPE and action:
killcls = RUNNER_CLS_MAPPING.get(action)
break
# Did we find a class that can do it?
if killcls:
if killcls in killer_instances:

View File

@ -54,9 +54,9 @@ DB_NAME = "glance"
# What applications to start
APP_OPTIONS = {
'glance-api': ['--config-file', sh.joinpths('%ROOT%', "etc", API_CONF)],
'glance-registry': ['--config-file', sh.joinpths('%ROOT%', "etc", REG_CONF)],
'glance-scrubber': ['--config-file', sh.joinpths('%ROOT%', "etc", REG_CONF)],
'glance-api': ['--config-file', sh.joinpths('%CONFIG_DIR%', API_CONF)],
'glance-registry': ['--config-file', sh.joinpths('%CONFIG_DIR%', REG_CONF)],
'glance-scrubber': ['--config-file', sh.joinpths('%CONFIG_DIR%', REG_CONF)],
}
# How the subcompoent small name translates to an actual app
@ -67,14 +67,12 @@ SUB_TO_APP = {
}
# Subdirs of the downloaded (we are overriding the original)
CONFIG_DIR = 'etc'
BIN_DIR = 'bin'
class GlanceUninstaller(comp.PythonUninstallComponent):
def __init__(self, *args, **kargs):
comp.PythonUninstallComponent.__init__(self, *args, **kargs)
self.cfg_dir = sh.joinpths(self.app_dir, CONFIG_DIR)
def known_subsystems(self):
return SUB_TO_APP.keys()
@ -83,7 +81,6 @@ class GlanceUninstaller(comp.PythonUninstallComponent):
class GlanceInstaller(comp.PythonInstallComponent):
def __init__(self, *args, **kargs):
comp.PythonInstallComponent.__init__(self, *args, **kargs)
self.cfg_dir = sh.joinpths(self.app_dir, CONFIG_DIR)
def _get_download_locations(self):
places = list()
@ -110,11 +107,11 @@ class GlanceInstaller(comp.PythonInstallComponent):
def _get_source_config(self, config_fn):
if config_fn == POLICY_JSON:
fn = sh.joinpths(self.cfg_dir, POLICY_JSON)
fn = sh.joinpths(self.app_dir, 'etc', POLICY_JSON)
contents = sh.load_file(fn)
return (fn, contents)
elif config_fn == LOGGING_CONF:
fn = sh.joinpths(self.cfg_dir, LOGGING_SOURCE_FN)
fn = sh.joinpths(self.app_dir, 'etc', LOGGING_SOURCE_FN)
contents = sh.load_file(fn)
return (fn, contents)
return comp.PythonInstallComponent._get_source_config(self, config_fn)
@ -181,7 +178,6 @@ class GlanceInstaller(comp.PythonInstallComponent):
class GlanceRuntime(comp.PythonRuntime):
def __init__(self, *args, **kargs):
comp.PythonRuntime.__init__(self, *args, **kargs)
self.cfg_dir = sh.joinpths(self.app_dir, CONFIG_DIR)
self.bin_dir = sh.joinpths(self.app_dir, BIN_DIR)
self.wait_time = max(self.cfg.getint('default', 'service_wait_seconds'), 1)

View File

@ -104,6 +104,7 @@ class HorizonInstaller(comp.PythonInstallComponent):
def _get_target_config_name(self, config_name):
if config_name == HORIZON_PY_CONF:
# FIXME don't write to checked out locations...
return sh.joinpths(self.dash_dir, *HORIZON_PY_CONF_TGT)
else:
return comp.PythonInstallComponent._get_target_config_name(self, config_name)

View File

@ -33,7 +33,6 @@ DB_NAME = "keystone"
# Subdirs of the git checkout
BIN_DIR = "bin"
CONFIG_DIR = "etc"
# Simple confs
ROOT_CONF = "keystone.conf"
@ -56,9 +55,9 @@ SYNC_DB_CMD = [sh.joinpths('%BINDIR%', MANAGE_APP_NAME), 'db_sync']
# What to start
APP_NAME = 'keystone-all'
APP_OPTIONS = {
APP_NAME: ['--config-file', sh.joinpths('%ROOT%', CONFIG_DIR, ROOT_CONF),
APP_NAME: ['--config-file', sh.joinpths('%CONFIG_DIR%', ROOT_CONF),
"--debug", '-d',
'--log-config=' + sh.joinpths('%ROOT%', CONFIG_DIR, 'logging.cnf')]
'--log-config=' + sh.joinpths('%CONFIG_DIR%', LOGGING_CONF)]
}
@ -81,14 +80,11 @@ QUANTUM_TEMPL_ADDS = ['catalog.RegionOne.network.publicURL = http://%SERVICE_HOS
class KeystoneUninstaller(comp.PythonUninstallComponent):
def __init__(self, *args, **kargs):
comp.PythonUninstallComponent.__init__(self, *args, **kargs)
self.cfg_dir = sh.joinpths(self.app_dir, CONFIG_DIR)
self.bin_dir = sh.joinpths(self.app_dir, BIN_DIR)
class KeystoneInstaller(comp.PythonInstallComponent):
def __init__(self, *args, **kargs):
comp.PythonInstallComponent.__init__(self, *args, **kargs)
self.cfg_dir = sh.joinpths(self.app_dir, CONFIG_DIR)
self.bin_dir = sh.joinpths(self.app_dir, BIN_DIR)
def _get_download_locations(self):
@ -172,7 +168,7 @@ class KeystoneInstaller(comp.PythonInstallComponent):
def _get_source_config(self, config_fn):
if config_fn == LOGGING_CONF:
fn = sh.joinpths(self.cfg_dir, LOGGING_SOURCE_FN)
fn = sh.joinpths(self.app_dir, 'etc', LOGGING_SOURCE_FN)
contents = sh.load_file(fn)
return (fn, contents)
return comp.PythonInstallComponent._get_source_config(self, config_fn)
@ -200,7 +196,6 @@ class KeystoneInstaller(comp.PythonInstallComponent):
class KeystoneRuntime(comp.PythonRuntime):
def __init__(self, *args, **kargs):
comp.PythonRuntime.__init__(self, *args, **kargs)
self.cfg_dir = sh.joinpths(self.app_dir, CONFIG_DIR)
self.bin_dir = sh.joinpths(self.app_dir, BIN_DIR)
self.wait_time = max(self.cfg.getint('default', 'service_wait_seconds'), 1)

View File

@ -36,7 +36,6 @@ BIN_DIR = 'bin'
ROOT_CONF = 'melange.conf.sample'
ROOT_CONF_REAL_NAME = 'melange.conf'
CONFIGS = [ROOT_CONF]
CFG_LOC = ['etc', 'melange']
# Sensible defaults
DEF_CIDR_RANGE = 'FE-EE-DD-00-00-00/24'
@ -53,7 +52,7 @@ CIDR_CREATE_CMD = [
# What to start
APP_OPTIONS = {
'melange-server': ['--config-file', '%CFG_FILE%'],
'melange-server': ['--config-file=%CFG_FILE%'],
}
@ -66,7 +65,6 @@ class MelangeInstaller(comp.PythonInstallComponent):
def __init__(self, *args, **kargs):
comp.PythonInstallComponent.__init__(self, *args, **kargs)
self.bin_dir = sh.joinpths(self.app_dir, BIN_DIR)
self.cfg_dir = sh.joinpths(self.app_dir, *CFG_LOC)
def _get_download_locations(self):
places = list()
@ -115,11 +113,10 @@ class MelangeInstaller(comp.PythonInstallComponent):
def _get_source_config(self, config_fn):
if config_fn == ROOT_CONF:
srcfn = sh.joinpths(self.cfg_dir, config_fn)
contents = sh.load_file(srcfn)
return (srcfn, contents)
else:
return comp.PythonInstallComponent._get_source_config(self, config_fn)
fn = sh.joinpths(self.app_dir, 'etc', 'melange', config_fn)
contents = sh.load_file(fn)
return (fn, contents)
return comp.PythonInstallComponent._get_source_config(self, config_fn)
def _get_target_config_name(self, config_fn):
if config_fn == ROOT_CONF:
@ -132,7 +129,6 @@ class MelangeRuntime(comp.PythonRuntime):
def __init__(self, *args, **kargs):
comp.PythonRuntime.__init__(self, *args, **kargs)
self.bin_dir = sh.joinpths(self.app_dir, BIN_DIR)
self.cfg_dir = sh.joinpths(self.app_dir, *CFG_LOC)
self.wait_time = max(self.cfg.getint('default', 'service_wait_seconds'), 1)
def _get_apps_to_start(self):

View File

@ -122,7 +122,6 @@ SUB_COMPONENT_NAME_MAP = {
# Subdirs of the checkout/download
BIN_DIR = 'bin'
CONFIG_DIR = "etc"
# Network class/driver/manager templs
QUANTUM_MANAGER = 'nova.network.quantum.manager.QuantumManager'
@ -201,7 +200,6 @@ class NovaUninstaller(comp.PythonUninstallComponent):
def __init__(self, *args, **kargs):
comp.PythonUninstallComponent.__init__(self, *args, **kargs)
self.bin_dir = sh.joinpths(self.app_dir, BIN_DIR)
self.cfg_dir = sh.joinpths(self.app_dir, CONFIG_DIR)
self.virsh = lv.Virsh(self.cfg, self.distro)
def known_subsystems(self):
@ -236,7 +234,6 @@ class NovaInstaller(comp.PythonInstallComponent):
def __init__(self, *args, **kargs):
comp.PythonInstallComponent.__init__(self, *args, **kargs)
self.bin_dir = sh.joinpths(self.app_dir, BIN_DIR)
self.cfg_dir = sh.joinpths(self.app_dir, CONFIG_DIR)
self.paste_conf_fn = self._get_target_config_name(PASTE_CONF)
self.volumes_enabled = False
if NVOL in self.desired_subsystems:
@ -329,15 +326,13 @@ class NovaInstaller(comp.PythonInstallComponent):
self.tracewriter.cfg_file_written(sh.write_file(conf_fn, nova_conf_contents))
def _get_source_config(self, config_fn):
name = config_fn
if config_fn == PASTE_CONF:
# Return the paste api template
return comp.PythonInstallComponent._get_source_config(self, PASTE_SOURCE_FN)
elif config_fn == LOGGING_CONF:
name = LOGGING_SOURCE_FN
srcfn = sh.joinpths(self.cfg_dir, "nova", name)
contents = sh.load_file(srcfn)
return (srcfn, contents)
if config_fn == LOGGING_CONF:
config_fn = LOGGING_SOURCE_FN
fn = sh.joinpths(self.app_dir, 'etc', "nova", config_fn)
contents = sh.load_file(fn)
return (fn, contents)
def _get_param_map(self, config_fn):
mp = dict()
@ -363,7 +358,6 @@ class NovaInstaller(comp.PythonInstallComponent):
class NovaRuntime(comp.PythonRuntime):
def __init__(self, *args, **kargs):
comp.PythonRuntime.__init__(self, *args, **kargs)
self.cfg_dir = sh.joinpths(self.app_dir, CONFIG_DIR)
self.bin_dir = sh.joinpths(self.app_dir, BIN_DIR)
self.wait_time = max(self.cfg.getint('default', 'service_wait_seconds'), 1)
self.virsh = lv.Virsh(self.cfg, self.distro)

View File

@ -35,7 +35,6 @@ PLUGIN_CONF = "plugins.ini"
QUANTUM_CONF = 'quantum.conf'
PLUGIN_LOC = ['etc']
AGENT_CONF = 'ovs_quantum_plugin.ini'
AGENT_LOC = ["etc", "quantum", "plugins", "openvswitch"]
AGENT_BIN_LOC = ["quantum", "plugins", "openvswitch", 'agent']
CONFIG_FILES = [PLUGIN_CONF, AGENT_CONF]
@ -48,10 +47,6 @@ OVS_BRIDGE_ADD = ['ovs-vsctl', '--no-wait', 'add-br', '%OVS_BRIDGE%']
OVS_BRIDGE_EXTERN_ID = ['ovs-vsctl', '--no-wait', 'br-set-external-id', '%OVS_BRIDGE%', 'bridge-id', '%OVS_EXTERNAL_ID%']
OVS_BRIDGE_CMDS = [OVS_BRIDGE_DEL, OVS_BRIDGE_ADD, OVS_BRIDGE_EXTERN_ID]
# Subdirs of the downloaded
CONFIG_DIR = 'etc'
BIN_DIR = 'bin'
# What to start (only if openvswitch enabled)
APP_Q_SERVER = 'quantum-server'
APP_Q_AGENT = 'ovs_quantum_agent.py'
@ -60,6 +55,7 @@ APP_OPTIONS = {
APP_Q_AGENT: ["%OVS_CONFIG_FILE%", "-v"],
}
class QuantumMixin(object):
def known_options(self):
@ -96,16 +92,6 @@ class QuantumInstaller(QuantumMixin, comp.PkgInstallComponent):
self.q_vswitch_agent = True
self.q_vswitch_service = True
def _get_target_config_name(self, config_fn):
if config_fn == PLUGIN_CONF:
tgt_loc = [self.app_dir] + PLUGIN_LOC + [config_fn]
return sh.joinpths(*tgt_loc)
elif config_fn == AGENT_CONF:
tgt_loc = [self.app_dir] + AGENT_LOC + [config_fn]
return sh.joinpths(*tgt_loc)
else:
return comp.PkgInstallComponent._get_target_config_name(self, config_fn)
def _config_adjust(self, contents, config_fn):
if config_fn == PLUGIN_CONF and self.q_vswitch_service:
# Need to fix the "Quantum plugin provider module"
@ -173,13 +159,11 @@ class QuantumInstaller(QuantumMixin, comp.PkgInstallComponent):
def _get_source_config(self, config_fn):
if config_fn == PLUGIN_CONF:
srcloc = [self.app_dir] + PLUGIN_LOC + [config_fn]
srcfn = sh.joinpths(*srcloc)
srcfn = sh.joinpths(self.app_dir, 'etc', config_fn)
contents = sh.load_file(srcfn)
return (srcfn, contents)
elif config_fn == AGENT_CONF:
srcloc = [self.app_dir] + AGENT_LOC + [config_fn]
srcfn = sh.joinpths(*srcloc)
srcfn = sh.joinpths(self.app_dir, 'etc', 'quantum', 'plugins', 'openvswitch', config_fn)
contents = sh.load_file(srcfn)
return (srcfn, contents)
else:
@ -201,14 +185,14 @@ class QuantumRuntime(QuantumMixin, comp.ProgramRuntime):
app_list = comp.ProgramRuntime._get_apps_to_start(self)
if self.q_vswitch_service:
app_list.append({
'name': APP_Q_SERVER,
'path': sh.joinpths(self.app_dir, BIN_DIR, APP_Q_SERVER),
'name': APP_Q_SERVER,
'path': sh.joinpths(self.app_dir, 'bin', APP_Q_SERVER),
})
if self.q_vswitch_agent:
full_pth = [self.app_dir] + AGENT_BIN_LOC + [APP_Q_AGENT]
app_list.append({
'name': APP_Q_AGENT,
'path': sh.joinpths(*full_pth)
'name': APP_Q_AGENT,
# WHY U SO BURIED....
'path': sh.joinpths(self.app_dir, "quantum", "plugins", "openvswitch", 'agent', APP_Q_AGENT)
})
return app_list
@ -218,8 +202,7 @@ class QuantumRuntime(QuantumMixin, comp.ProgramRuntime):
def _get_param_map(self, app_name):
param_dict = comp.ProgramRuntime._get_param_map(self, app_name)
if app_name == APP_Q_AGENT:
tgt_loc = [self.app_dir] + AGENT_LOC + [AGENT_CONF]
param_dict['OVS_CONFIG_FILE'] = sh.joinpths(*tgt_loc)
param_dict['OVS_CONFIG_FILE'] = sh.joinpths(self.cfg_dir, AGENT_CONF)
elif app_name == APP_Q_SERVER:
param_dict['QUANTUM_CONFIG_FILE'] = sh.joinpths(self.app_dir, CONFIG_DIR, QUANTUM_CONF)
param_dict['QUANTUM_CONFIG_FILE'] = sh.joinpths(self.cfg_dir, QUANTUM_CONF)
return param_dict

View File

@ -60,7 +60,6 @@ FS_TYPE = "xfs"
# Subdirs of the git checkout
BIN_DIR = 'bin'
CONFIG_DIR = 'etc'
LOG_DIR = 'logs'
# Config keys we warm up so u won't be prompted later
@ -72,7 +71,6 @@ class SwiftUninstaller(comp.PythonUninstallComponent):
def __init__(self, *args, **kargs):
comp.PythonUninstallComponent.__init__(self, *args, **kargs)
self.datadir = sh.joinpths(self.app_dir, self.cfg.getdefaulted('swift', 'data_location', 'data'))
self.cfg_dir = sh.joinpths(self.app_dir, CONFIG_DIR)
self.bin_dir = sh.joinpths(self.app_dir, BIN_DIR)
self.logdir = sh.joinpths(self.datadir, LOG_DIR)
@ -88,7 +86,6 @@ class SwiftUninstaller(comp.PythonUninstallComponent):
class SwiftInstaller(comp.PythonInstallComponent):
def __init__(self, *args, **kargs):
comp.PythonInstallComponent.__init__(self, *args, **kargs)
self.cfg_dir = sh.joinpths(self.app_dir, CONFIG_DIR)
self.bin_dir = sh.joinpths(self.app_dir, BIN_DIR)
self.datadir = sh.joinpths(self.app_dir, self.cfg.getdefaulted('swift', 'data_location', 'data'))
self.logdir = sh.joinpths(self.datadir, LOG_DIR)
@ -203,7 +200,6 @@ class SwiftRuntime(comp.PythonRuntime):
def __init__(self, *args, **kargs):
comp.PythonRuntime.__init__(self, *args, **kargs)
self.datadir = sh.joinpths(self.app_dir, self.cfg.getdefaulted('swift', 'data_location', 'data'))
self.cfg_dir = sh.joinpths(self.app_dir, CONFIG_DIR)
self.bin_dir = sh.joinpths(self.app_dir, BIN_DIR)
self.logdir = sh.joinpths(self.datadir, LOG_DIR)

View File

@ -26,8 +26,6 @@ from devstack.components import db
from devstack.components import horizon
from devstack.components import nova
from devstack.packaging import yum
LOG = logging.getLogger(__name__)
SOCKET_CONF = "/etc/httpd/conf.d/wsgi-socket-prefix.conf"

View File

@ -111,7 +111,7 @@ class YumPackagerWithRelinks(yum.YumPackager):
if response:
options = pkg.get('packager_options', {})
links = options.get('links', [])
for src, tgt in links:
for (_, tgt) in links:
if sh.islink(tgt):
sh.unlink(tgt)
return response