Cleanups around common symlink code.
This commit is contained in:
parent
4caac8ba86
commit
f6743bdef0
@ -52,6 +52,9 @@ STOPPER_CLS_MAPPING = {
|
|||||||
settings.RUN_TYPE_SCREEN: screen.ScreenRunner,
|
settings.RUN_TYPE_SCREEN: screen.ScreenRunner,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#where symlinks will go
|
||||||
|
BASE_LINK_DIR = "/etc"
|
||||||
|
|
||||||
|
|
||||||
class ComponentBase(object):
|
class ComponentBase(object):
|
||||||
def __init__(self, component_name, **kargs):
|
def __init__(self, component_name, **kargs):
|
||||||
@ -167,8 +170,15 @@ class PkgInstallComponent(ComponentBase):
|
|||||||
def _get_source_config(self, config_fn):
|
def _get_source_config(self, config_fn):
|
||||||
return utils.load_template(self.component_name, config_fn)
|
return utils.load_template(self.component_name, config_fn)
|
||||||
|
|
||||||
|
def _get_link_dir(self):
|
||||||
|
return sh.joinpths(BASE_LINK_DIR, self.component_name)
|
||||||
|
|
||||||
def _get_symlinks(self):
|
def _get_symlinks(self):
|
||||||
return dict()
|
links = dict()
|
||||||
|
for fn in self._get_config_files():
|
||||||
|
source_fn = self._get_target_config_name(fn)
|
||||||
|
links[source_fn] = sh.joinpths(self._get_link_dir(), fn)
|
||||||
|
return links
|
||||||
|
|
||||||
def _configure_files(self):
|
def _configure_files(self):
|
||||||
configs = self._get_config_files()
|
configs = self._get_config_files()
|
||||||
|
@ -110,13 +110,6 @@ class GlanceInstaller(comp.PythonInstallComponent):
|
|||||||
def _get_pkgs(self):
|
def _get_pkgs(self):
|
||||||
return list(REQ_PKGS)
|
return list(REQ_PKGS)
|
||||||
|
|
||||||
def _get_symlinks(self):
|
|
||||||
links = dict()
|
|
||||||
for fn in self._get_config_files():
|
|
||||||
source_fn = self._get_target_config_name(fn)
|
|
||||||
links[source_fn] = sh.joinpths("/", "etc", "glance", fn)
|
|
||||||
return links
|
|
||||||
|
|
||||||
def post_install(self):
|
def post_install(self):
|
||||||
comp.PythonInstallComponent.post_install(self)
|
comp.PythonInstallComponent.post_install(self)
|
||||||
self._setup_db()
|
self._setup_db()
|
||||||
|
@ -110,10 +110,7 @@ class HorizonInstaller(comp.PythonInstallComponent):
|
|||||||
self._check_ug()
|
self._check_ug()
|
||||||
|
|
||||||
def _get_symlinks(self):
|
def _get_symlinks(self):
|
||||||
links = dict()
|
links = comp.PythonInstallComponent._get_symlinks(self)
|
||||||
for fn in self._get_config_files():
|
|
||||||
source_fn = self._get_target_config_name(fn)
|
|
||||||
links[source_fn] = sh.joinpths("/", "etc", "horizon", fn)
|
|
||||||
src = self._get_target_config_name(HORIZON_APACHE_CONF)
|
src = self._get_target_config_name(HORIZON_APACHE_CONF)
|
||||||
links[src] = APACHE_CONF_TARGETS[self.distro]
|
links[src] = APACHE_CONF_TARGETS[self.distro]
|
||||||
if utils.service_enabled(settings.QUANTUM_CLIENT, self.instances, False):
|
if utils.service_enabled(settings.QUANTUM_CLIENT, self.instances, False):
|
||||||
|
@ -120,13 +120,6 @@ class KeystoneInstaller(comp.PythonInstallComponent):
|
|||||||
def _get_pkgs(self):
|
def _get_pkgs(self):
|
||||||
return list(REQ_PKGS)
|
return list(REQ_PKGS)
|
||||||
|
|
||||||
def _get_symlinks(self):
|
|
||||||
links = dict()
|
|
||||||
for fn in self._get_config_files():
|
|
||||||
source_fn = self._get_target_config_name(fn)
|
|
||||||
links[source_fn] = sh.joinpths("/", "etc", "keystone", fn)
|
|
||||||
return links
|
|
||||||
|
|
||||||
def post_install(self):
|
def post_install(self):
|
||||||
comp.PythonInstallComponent.post_install(self)
|
comp.PythonInstallComponent.post_install(self)
|
||||||
self._setup_db()
|
self._setup_db()
|
||||||
|
@ -89,13 +89,6 @@ class MelangeInstaller(comp.PythonInstallComponent):
|
|||||||
db.drop_db(self.cfg, DB_NAME)
|
db.drop_db(self.cfg, DB_NAME)
|
||||||
db.create_db(self.cfg, DB_NAME)
|
db.create_db(self.cfg, DB_NAME)
|
||||||
|
|
||||||
def _get_symlinks(self):
|
|
||||||
links = dict()
|
|
||||||
for fn in self._get_config_files():
|
|
||||||
source_fn = self._get_target_config_name(fn)
|
|
||||||
links[source_fn] = sh.joinpths("/", "etc", "melange", fn)
|
|
||||||
return links
|
|
||||||
|
|
||||||
def _get_pkgs(self):
|
def _get_pkgs(self):
|
||||||
return list(REQ_PKGS)
|
return list(REQ_PKGS)
|
||||||
|
|
||||||
|
@ -210,6 +210,19 @@ QUANTUM_OPENSWITCH_OPS = {
|
|||||||
CLEANER_DATA_CONF = 'nova-clean.sh'
|
CLEANER_DATA_CONF = 'nova-clean.sh'
|
||||||
CLEANER_CMD_ROOT = [sh.joinpths("/", "bin", 'bash')]
|
CLEANER_CMD_ROOT = [sh.joinpths("/", "bin", 'bash')]
|
||||||
|
|
||||||
|
#rhel6/fedora libvirt policy
|
||||||
|
#http://wiki.libvirt.org/page/SSHPolicyKitSetup
|
||||||
|
LIBVIRT_POLICY_FN = "/etc/polkit-1/localauthority/50-local.d/50-libvirt-remote-access.pkla"
|
||||||
|
LIBVIRT_POLICY_CONTENTS = """
|
||||||
|
[libvirt Management Access]
|
||||||
|
Identity=unix-group:libvirtd
|
||||||
|
Action=org.libvirt.unix.manage
|
||||||
|
ResultAny=yes
|
||||||
|
ResultInactive=yes
|
||||||
|
ResultActive=yes
|
||||||
|
"""
|
||||||
|
POLICY_DISTROS = [settings.RHEL6, settings.FEDORA16]
|
||||||
|
|
||||||
#xenserver specific defaults
|
#xenserver specific defaults
|
||||||
XS_DEF_INTERFACE = 'eth1'
|
XS_DEF_INTERFACE = 'eth1'
|
||||||
XA_CONNECTION_ADDR = '169.254.0.1'
|
XA_CONNECTION_ADDR = '169.254.0.1'
|
||||||
@ -305,12 +318,9 @@ class NovaInstaller(comp.PythonInstallComponent):
|
|||||||
return pkgs
|
return pkgs
|
||||||
|
|
||||||
def _get_symlinks(self):
|
def _get_symlinks(self):
|
||||||
links = dict()
|
links = comp.PythonInstallComponent._get_symlinks(self)
|
||||||
for fn in self._get_config_files():
|
|
||||||
source_fn = self._get_target_config_name(fn)
|
|
||||||
links[source_fn] = sh.joinpths("/", "etc", "nova", fn)
|
|
||||||
source_fn = sh.joinpths(self.cfgdir, API_CONF)
|
source_fn = sh.joinpths(self.cfgdir, API_CONF)
|
||||||
links[source_fn] = sh.joinpths("/", "etc", "nova", API_CONF)
|
links[source_fn] = sh.joinpths(self._get_link_dir(), API_CONF)
|
||||||
return links
|
return links
|
||||||
|
|
||||||
def _get_pips(self):
|
def _get_pips(self):
|
||||||
@ -436,7 +446,17 @@ class NovaInstaller(comp.PythonInstallComponent):
|
|||||||
def configure(self):
|
def configure(self):
|
||||||
configs_made = comp.PythonInstallComponent.configure(self)
|
configs_made = comp.PythonInstallComponent.configure(self)
|
||||||
self._generate_nova_conf()
|
self._generate_nova_conf()
|
||||||
return configs_made + 1
|
configs_made += 1
|
||||||
|
# TODO: maybe this should be a subclass that handles these differences
|
||||||
|
driver_canon = _canon_virt_driver(self.cfg.get('nova', 'virt_driver'))
|
||||||
|
if (self.distro in POLICY_DISTROS) and driver_canon == virsh.VIRT_TYPE:
|
||||||
|
with sh.Rooted(True):
|
||||||
|
dirsmade = sh.mkdirslist(sh.dirname(LIBVIRT_POLICY_FN))
|
||||||
|
sh.write_file(LIBVIRT_POLICY_FN, LIBVIRT_POLICY_CONTENTS)
|
||||||
|
self.tracewriter.dir_made(*dirsmade)
|
||||||
|
self.tracewriter.cfg_write(LIBVIRT_POLICY_FN)
|
||||||
|
configs_made += 1
|
||||||
|
return configs_made
|
||||||
|
|
||||||
|
|
||||||
class NovaRuntime(comp.PythonRuntime):
|
class NovaRuntime(comp.PythonRuntime):
|
||||||
|
@ -113,13 +113,6 @@ class QuantumInstaller(comp.PkgInstallComponent):
|
|||||||
add_deps.append(settings.DB)
|
add_deps.append(settings.DB)
|
||||||
return common_deps + add_deps
|
return common_deps + add_deps
|
||||||
|
|
||||||
def _get_symlinks(self):
|
|
||||||
links = dict()
|
|
||||||
for fn in self._get_config_files():
|
|
||||||
source_fn = self._get_target_config_name(fn)
|
|
||||||
links[source_fn] = sh.joinpths("/", "etc", "quantum", fn)
|
|
||||||
return links
|
|
||||||
|
|
||||||
def _get_pkgs(self):
|
def _get_pkgs(self):
|
||||||
pkglist = list(REQ_PKGS)
|
pkglist = list(REQ_PKGS)
|
||||||
if self.q_vswitch_service:
|
if self.q_vswitch_service:
|
||||||
|
@ -115,13 +115,6 @@ class SwiftInstaller(comp.PythonInstallComponent):
|
|||||||
def _get_pkgs(self):
|
def _get_pkgs(self):
|
||||||
return list(REQ_PKGS)
|
return list(REQ_PKGS)
|
||||||
|
|
||||||
def _get_symlinks(self):
|
|
||||||
links = dict()
|
|
||||||
for fn in self._get_config_files():
|
|
||||||
source_fn = self._get_target_config_name(fn)
|
|
||||||
links[source_fn] = sh.joinpths("/", "etc", "swift", fn)
|
|
||||||
return links
|
|
||||||
|
|
||||||
def warm_configs(self):
|
def warm_configs(self):
|
||||||
for pw_key in WARMUP_PWS:
|
for pw_key in WARMUP_PWS:
|
||||||
self.cfg.get("passwords", pw_key)
|
self.cfg.get("passwords", pw_key)
|
||||||
|
Loading…
Reference in New Issue
Block a user