move password queries to the start of the program
This commit is contained in:
parent
a676894033
commit
bb799d1952
devstack
utils
@ -66,6 +66,9 @@ class ComponentBase(object):
|
||||
def is_installed(self):
|
||||
return tr.TraceReader(self.tracedir, tr.IN_TRACE).exists()
|
||||
|
||||
def _get_passwords(self):
|
||||
return []
|
||||
|
||||
|
||||
class PkgInstallComponent(ComponentBase):
|
||||
def __init__(self, component_name, *args, **kargs):
|
||||
|
@ -134,6 +134,9 @@ class DBInstaller(comp.PkgInstallComponent):
|
||||
}
|
||||
return out
|
||||
|
||||
def _get_passwords(self):
|
||||
return ['sql']
|
||||
|
||||
def _configure_db_confs(self):
|
||||
dbtype = self.cfg.get("db", "type")
|
||||
if self.distro == settings.RHEL6 and dbtype == MYSQL:
|
||||
|
@ -93,7 +93,6 @@ class KeystoneInstaller(comp.PythonInstallComponent):
|
||||
def _get_symlinks(self):
|
||||
return {sh.joinpths(self.cfgdir, ROOT_CONF): '/etc/keystone/keystone.conf'}
|
||||
|
||||
|
||||
def post_install(self):
|
||||
parent_result = comp.PythonInstallComponent.post_install(self)
|
||||
self._setup_db()
|
||||
@ -158,6 +157,9 @@ class KeystoneInstaller(comp.PythonInstallComponent):
|
||||
#nothing modified so just return the original
|
||||
return contents
|
||||
|
||||
def _get_passwords(self):
|
||||
return ['horizon_keystone_admin', 'service_token']
|
||||
|
||||
def _get_param_map(self, config_fn):
|
||||
#these be used to fill in the configuration/cmds +
|
||||
#params with actual values
|
||||
|
@ -212,6 +212,9 @@ class NovaInstaller(comp.PythonInstallComponent):
|
||||
})
|
||||
return places
|
||||
|
||||
def _get_passwords(self):
|
||||
return ['rabbit']
|
||||
|
||||
def _get_config_files(self):
|
||||
return list(CONFIGS)
|
||||
|
||||
|
@ -68,6 +68,9 @@ class RabbitInstaller(comp.PkgInstallComponent):
|
||||
comp.PkgInstallComponent.__init__(self, TYPE, *args, **kargs)
|
||||
self.runtime = RabbitRuntime(*args, **kargs)
|
||||
|
||||
def _get_passwords(self):
|
||||
return ['rabbit']
|
||||
|
||||
def _setup_pw(self):
|
||||
LOG.info("Setting up your rabbit-mq guest password.")
|
||||
self.runtime.restart()
|
||||
|
@ -82,6 +82,9 @@ class SwiftInstaller(comp.PythonInstallComponent):
|
||||
def _get_pkgs(self):
|
||||
return list(REQ_PKGS)
|
||||
|
||||
def _get_passwords(self):
|
||||
return ['service_token', 'swift_hash']
|
||||
|
||||
def _get_param_map(self, config_fn):
|
||||
return {
|
||||
'USER': self.cfg.get('swift', 'swift_user'),
|
||||
|
@ -234,6 +234,10 @@ def _run_components(action_name, component_order, components, distro, root_dir,
|
||||
root=root_dir,
|
||||
opts=components.get(component, list()))
|
||||
all_instances[component] = instance
|
||||
# ask for passwords on top of execution
|
||||
for pwd in instance._get_passwords():
|
||||
config.get('passwords', pwd)
|
||||
|
||||
#run anything before it gets going...
|
||||
_pre_run(action_name, root_dir=root_dir, pkg=pkg_manager, cfg=config)
|
||||
results = list()
|
||||
@ -289,7 +293,7 @@ def _run_components(action_name, component_order, components, distro, root_dir,
|
||||
|
||||
_uninstall(component, instance, force)
|
||||
if not sh.exists(_RC_FILE):
|
||||
generate_local_rc(_RC_FILE)
|
||||
generate_local_rc(_RC_FILE, config)
|
||||
end_time = time.time()
|
||||
#display any configs touched...
|
||||
_print_cfgs(config, action_name)
|
||||
|
@ -87,14 +87,14 @@ def generate_os_env(fh, cfg):
|
||||
write_env('OS_PASSWORD', cfg.get('passwords', 'horizon_keystone_admin'), fh)
|
||||
write_env('OS_TENANT_NAME', 'demo', fh)
|
||||
write_env('OS_USERNAME', 'demo', fh)
|
||||
write_env('OS_AUTH_URL', 'http://%s:5000/v2.0', fh)
|
||||
write_env('OS_AUTH_URL', 'http://%s:5000/v2.0' % ip, fh)
|
||||
|
||||
|
||||
def generate_local_rc(fn=None):
|
||||
def generate_local_rc(fn=None, cfg=None):
|
||||
if not fn:
|
||||
fn = DEF_FN
|
||||
utils.welcome(PROG_NAME)
|
||||
cfg = common.get_config()
|
||||
if not cfg:
|
||||
cfg = common.get_config()
|
||||
with open(fn, "w") as fh:
|
||||
for (out_name, cfg_data) in CFG_MAKE.items():
|
||||
section = cfg_data[0]
|
||||
@ -111,6 +111,7 @@ def main():
|
||||
opts.add_option("-o", "--output", dest="filename",
|
||||
help="write output to FILE", metavar="FILE")
|
||||
(options, args) = opts.parse_args()
|
||||
utils.welcome(PROG_NAME)
|
||||
generate_local_rc(options.filename)
|
||||
print("Check file \"%s\" for your environment configuration." \
|
||||
% (os.path.normpath(options.filename)))
|
||||
|
Loading…
x
Reference in New Issue
Block a user