diff --git a/devstack/components/horizon.py b/devstack/components/horizon.py index 677fb27d..b3a37315 100644 --- a/devstack/components/horizon.py +++ b/devstack/components/horizon.py @@ -116,7 +116,7 @@ class HorizonInstaller(comp.PythonInstallComponent): links[source_fn] = sh.joinpths("/", "etc", "horizon", fn) src = self._get_target_config_name(HORIZON_APACHE_CONF) links[src] = APACHE_CONF_TARGETS[self.distro] - if settings.QUANTUM_CLIENT in self.instances: + if utils.service_enabled(settings.QUANTUM_CLIENT, self.instances, False): #TODO remove this junk, blah, puke that we have to do this qc = self.instances[settings.QUANTUM_CLIENT] src_pth = sh.joinpths(qc.appdir, 'quantum') @@ -171,7 +171,7 @@ class HorizonInstaller(comp.PythonInstallComponent): #Horizon currently imports quantum even if you aren't using it. #Instead of installing quantum we can create a simple module #that will pass the initial imports. - if settings.QUANTUM_CLIENT in self.instances: + if utils.service_enabled(settings.QUANTUM_CLIENT, self.instances, False): return else: #Make the fake quantum @@ -256,7 +256,7 @@ class HorizonInstaller(comp.PythonInstallComponent): mp['ERROR_LOG'] = sh.joinpths(self.log_dir, "error.log") else: #Enable quantum in dashboard, if requested - mp['QUANTUM_ENABLED'] = "%s" % (settings.QUANTUM_CLIENT in self.instances) + mp['QUANTUM_ENABLED'] = "%s" % (utils.service_enabled(settings.QUANTUM_CLIENT, self.instances, False)) mp['OPENSTACK_HOST'] = self.cfg.get('host', 'ip') return mp diff --git a/devstack/components/keystone.py b/devstack/components/keystone.py index 707d57ca..f8776540 100644 --- a/devstack/components/keystone.py +++ b/devstack/components/keystone.py @@ -180,9 +180,9 @@ class KeystoneInstaller(comp.PythonInstallComponent): #nothing modified so just return the original elif name == CATALOG_CONF: nlines = list() - if settings.SWIFT in self.instances or not self.instances: + if utils.service_enabled(settings.SWIFT, self.instances): nlines.extend(SWIFT_TEMPL_ADDS) - if settings.QUANTUM in self.instances or not self.instances: + if utils.service_enabled(settings.QUANTUM, self.instances): nlines.extend(QUANTUM_TEMPL_ADDS) if nlines: nlines.insert(0, "") diff --git a/devstack/components/nova.py b/devstack/components/nova.py index 5d2d4cb8..d011de69 100644 --- a/devstack/components/nova.py +++ b/devstack/components/nova.py @@ -318,7 +318,7 @@ class NovaInstaller(comp.PythonInstallComponent): mp['TEST_FLOATING_POOL'] = self.cfg.get('nova', 'test_floating_pool') mp['FIXED_NETWORK_SIZE'] = self.cfg.get('nova', 'fixed_network_size') mp['FIXED_RANGE'] = self.cfg.get('nova', 'fixed_range') - if settings.QUANTUM in self.instances: + if utils.service_enabled(settings.QUANTUM_CLIENT, self.instances, False): cmds = NETWORK_SETUP_CMDS[0:1] else: cmds = NETWORK_SETUP_CMDS @@ -370,7 +370,7 @@ class NovaInstaller(comp.PythonInstallComponent): def _config_adjust(self, contents, config_fn): if config_fn not in ADJUST_CONFIGS: return contents - if config_fn == PASTE_CONF and settings.KEYSTONE in self.instances: + if config_fn == PASTE_CONF and utils.service_enabled(settings.KEYSTONE, self.instances, False): newcontents = contents with io.BytesIO(contents) as stream: config = cfg.IgnoreMissingConfigParser() @@ -401,7 +401,10 @@ class NovaInstaller(comp.PythonInstallComponent): return (srcfn, contents) def _get_param_map(self, config_fn): - return keystone.get_shared_params(self.cfg) + mp = keystone.get_shared_params(self.cfg) + mp['SERVICE_PASSWORD'] = "???" + mp['SERVICE_USER'] = "???" + return mp def configure(self): configs_made = comp.PythonInstallComponent.configure(self) @@ -540,7 +543,7 @@ class NovaConfConfigurator(object): self.cfgdir = ni.cfgdir self.xvnc_enabled = ni.xvnc_enabled self.volumes_enabled = ni.volumes_enabled - self.novnc_enabled = settings.NOVNC in self.instances + self.novnc_enabled = utils.service_enabled(settings.NOVNC, self.instances) def _getbool(self, name): return self.cfg.getboolean('nova', name) @@ -705,7 +708,7 @@ class NovaConfConfigurator(object): nova_conf.add('iscsi_help', 'tgtadm') def _configure_network_settings(self, nova_conf): - if settings.QUANTUM in self.instances: + if utils.service_enabled(settings.QUANTUM_CLIENT, self.instances, False): nova_conf.add('network_manager', QUANTUM_MANAGER) nova_conf.add('quantum_connection_host', self.cfg.get('quantum', 'q_host')) nova_conf.add('quantum_connection_port', self.cfg.get('quantum', 'q_port')) @@ -715,7 +718,7 @@ class NovaConfConfigurator(object): nova_conf.add_simple(key) else: nova_conf.add(key, value) - if settings.MELANGE_CLIENT in self.instances: + if utils.service_enabled(settings.MELANGE_CLIENT, self.instances, False): nova_conf.add('quantum_ipam_lib', QUANTUM_IPAM_LIB) nova_conf.add_simple('use_melange_mac_generation') nova_conf.add('melange_host', self.cfg.get('melange', 'm_host')) diff --git a/devstack/components/novnc.py b/devstack/components/novnc.py index 98171816..0b6e679e 100644 --- a/devstack/components/novnc.py +++ b/devstack/components/novnc.py @@ -18,6 +18,7 @@ from devstack import component as comp from devstack import log as logging from devstack import settings from devstack import shell as sh +from devstack import utils from devstack.components import nova @@ -84,9 +85,9 @@ class NoVNCRuntime(comp.ProgramRuntime): def _get_param_map(self, app_name): root_params = comp.ProgramRuntime._get_param_map(self, app_name) - if app_name == VNC_PROXY_APP and settings.NOVA in self.instances: - nova_runtime = self.instances.get(settings.NOVA) + if app_name == VNC_PROXY_APP and utils.service_enabled(settings.NOVA, self.instances, False): #have to reach into the nova conf (puke) + nova_runtime = self.instances[settings.NOVA] root_params['NOVA_CONF'] = sh.joinpths(nova_runtime.cfgdir, nova.API_CONF) return root_params diff --git a/devstack/components/quantum.py b/devstack/components/quantum.py index c29060ca..4dd43b4d 100644 --- a/devstack/components/quantum.py +++ b/devstack/components/quantum.py @@ -198,7 +198,7 @@ class QuantumInstaller(comp.PkgInstallComponent): def post_install(self): comp.PkgInstallComponent.post_install(self) - if self.q_vswitch_service and settings.DB in self.instances: + if self.q_vswitch_service and utils.service_enabled(settings.DB, self.instances, False): self._setup_db() if self.q_vswitch_agent: self._setup_bridge() diff --git a/devstack/utils.py b/devstack/utils.py index e11b1dc4..79fcc7a3 100644 --- a/devstack/utils.py +++ b/devstack/utils.py @@ -304,6 +304,14 @@ def joinlinesep(*pieces): return os.linesep.join(pieces) +def service_enabled(name, components, empty_true=True): + if not components and empty_true: + return True + if name in components: + return True + return False + + def param_replace(text, replacements, ignore_missing=False): if not replacements: