Some small clean ups and a forgetten/missed keystone sync command.

This commit is contained in:
Joshua Harlow 2012-01-27 12:11:30 -08:00
parent 8bfe820417
commit 109211ce0c
5 changed files with 28 additions and 20 deletions

@ -25,6 +25,8 @@ $BIN_DIR/keystone-manage role add KeystoneAdmin
$BIN_DIR/keystone-manage role add KeystoneServiceAdmin
$BIN_DIR/keystone-manage role add sysadmin
$BIN_DIR/keystone-manage role add netadmin
# Grants
$BIN_DIR/keystone-manage role grant admin admin admin
$BIN_DIR/keystone-manage role grant Member demo demo
$BIN_DIR/keystone-manage role grant sysadmin demo demo
@ -44,7 +46,7 @@ if [[ "$ENABLED_SERVICES" =~ "swift" ]]; then
$BIN_DIR/keystone-manage service add swift object-store "Swift Service"
fi
#endpointTemplates
# endpointTemplates for those templates
$BIN_DIR/keystone-manage $* endpointTemplates add RegionOne nova http://%SERVICE_HOST%:8774/v1.1/%tenant_id% http://%SERVICE_HOST%:8774/v1.1/%tenant_id% http://%SERVICE_HOST%:8774/v1.1/%tenant_id% 1 1
$BIN_DIR/keystone-manage $* endpointTemplates add RegionOne ec2 http://%SERVICE_HOST%:8773/services/Cloud http://%SERVICE_HOST%:8773/services/Admin http://%SERVICE_HOST%:8773/services/Cloud 1 1
$BIN_DIR/keystone-manage $* endpointTemplates add RegionOne glance http://%SERVICE_HOST%:9292/v1 http://%SERVICE_HOST%:9292/v1 http://%SERVICE_HOST%:9292/v1 1 1

@ -31,6 +31,12 @@ PW_TMPL = "Enter a password for %s: "
ENV_PAT = re.compile(r"^\s*\$\{([\w\d]+):\-(.*)\}\s*$")
SUB_MATCH = re.compile(r"(?:\$\(([\w\d]+):([\w\d]+))\)")
CACHE_MSG = "(value will now be internally cached)"
PW_PROMPTS = {
'horizon_keystone_admin': "Enter a password to use for horizon and keystone (20 chars or less): ",
'service_token': 'Enter a token to use for the service admin token: ',
'sql': 'Enter a password to use for your sql database user: ',
'rabbit': 'Enter a password to use for your rabbit user: ',
}
class IgnoreMissingConfigParser(ConfigParser.RawConfigParser):
@ -100,7 +106,10 @@ class EnvConfigParser(ConfigParser.RawConfigParser):
elif section == 'passwords':
key = self._makekey(section, option)
LOG.debug("Being forced to ask for password for \"%s\" since the configuration/environment value is empty.", key)
pw = sh.password(PW_TMPL % (key))
prompt = PW_PROMPTS.get(option)
if not prompt:
prompt = PW_TMPL % (key)
pw = sh.password(prompt)
self.pws[key] = pw
return pw
else:
@ -163,13 +172,13 @@ class EnvConfigParser(ConfigParser.RawConfigParser):
return extracted_val
def get_dbdsn(self, dbname):
#check the dsn cache
if dbname in self.db_dsns:
return self.db_dsns[dbname]
user = self.get("db", "sql_user")
host = self.get("db", "sql_host")
port = self.get("db", "port")
pw = self.get("passwords", "sql")
#check the dsn cache
if dbname in self.db_dsns:
return self.db_dsns[dbname]
#form the dsn (from components we have...)
#dsn = "<driver>://<username>:<password>@<host>:<port>/<database>"
if not host:

@ -168,9 +168,12 @@ class PythonInstallComponent(PkgInstallComponent):
})
return py_dirs
def _get_pip_list(self):
return utils.get_pip_list(self.distro, self.component_name)
def _install_pips(self):
#install any need pip items
pips = utils.get_pip_list(self.distro, self.component_name)
pips = self._get_pip_list()
if pips:
LOG.info("Setting up %s pips (%s)" % (len(pips), ", ".join(pips.keys())))
pip.install(pips)
@ -435,12 +438,6 @@ class PythonRuntime(ProgramRuntime):
def __init__(self, component_name, *args, **kargs):
ProgramRuntime.__init__(self, component_name, *args, **kargs)
def status(self):
return STATUS_UNKNOWN
def restart(self):
return 0
def _was_installed(self):
parent_result = ProgramRuntime._was_installed(self)
if not parent_result:

@ -45,6 +45,9 @@ CFG_SECTION = 'DEFAULT'
MANAGE_DATA_CONF = 'keystone_data.sh'
MANAGER_CMD_ROOT = [sh.joinpths("/", "bin", 'bash')]
#sync db command
SYNC_DB_CMD = ['keystone-manage', 'sync_database']
#what to start
APP_OPTIONS = {
'keystone': ['--config-file', sh.joinpths('%ROOT%', CONFIG_DIR, ROOT_CONF),
@ -79,9 +82,14 @@ class KeystoneInstaller(comp.PythonInstallComponent):
def post_install(self):
parent_result = comp.PythonInstallComponent.post_install(self)
self._setup_db()
self._sync_db()
self._setup_data()
return parent_result
def _sync_db(self):
LOG.info("Syncing keystone to database named %s", DB_NAME)
sh.execute(*SYNC_CMD, cwd=self.bindir)
def _get_config_files(self):
return list(CONFIGS)

@ -43,14 +43,6 @@ class NovaClientInstaller(comp.PythonInstallComponent):
})
return places
def _get_param_map(self, config_fn):
#this dict will be used to fill in the configuration
#params with actual values
mp = dict()
mp['DEST'] = self.appdir
mp['OPENSTACK_HOST'] = self.cfg.get('host', 'ip')
return mp
class NovaClientRuntime(comp.EmptyRuntime):
def __init__(self, *args, **kargs):