2012-01-11 12:47:33 -08:00
|
|
|
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
|
|
|
|
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
|
|
# not use this file except in compliance with the License. You may obtain
|
|
|
|
# a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
# License for the specific language governing permissions and limitations
|
|
|
|
# under the License.
|
|
|
|
|
|
|
|
import os
|
|
|
|
import os.path
|
|
|
|
|
2012-01-13 15:08:48 -08:00
|
|
|
import Pip
|
2012-01-13 12:07:41 -08:00
|
|
|
from Util import (KEYSTONE,
|
|
|
|
CONFIG_DIR, STACK_CONFIG_DIR,
|
|
|
|
NOVA, GLANCE, SWIFT,
|
2012-01-13 15:08:48 -08:00
|
|
|
get_pkg_list, get_pip_list,
|
|
|
|
get_dbdsn,
|
2012-01-12 20:30:48 -08:00
|
|
|
param_replace, get_host_ip,
|
|
|
|
execute_template)
|
2012-01-11 12:47:33 -08:00
|
|
|
import Logger
|
|
|
|
import Downloader
|
2012-01-12 17:35:41 -08:00
|
|
|
import Db
|
2012-01-13 12:07:41 -08:00
|
|
|
from Trace import (TraceWriter, TraceReader,
|
|
|
|
touch_trace,
|
|
|
|
IN_TRACE, PY_TRACE)
|
2012-01-11 12:47:33 -08:00
|
|
|
from Shell import (execute, mkdirslist, write_file,
|
2012-01-11 13:19:58 -08:00
|
|
|
load_file, joinpths, touch_file,
|
2012-01-12 17:35:41 -08:00
|
|
|
unlink, deldir)
|
|
|
|
from Component import (ComponentBase, RuntimeComponent,
|
|
|
|
UninstallComponent, InstallComponent)
|
2012-01-11 12:47:33 -08:00
|
|
|
|
|
|
|
LOG = Logger.getLogger("install.keystone")
|
2012-01-12 17:35:41 -08:00
|
|
|
|
2012-01-11 12:47:33 -08:00
|
|
|
TYPE = KEYSTONE
|
|
|
|
PY_INSTALL = ['python', 'setup.py', 'develop']
|
2012-01-12 17:35:41 -08:00
|
|
|
PY_UNINSTALL = ['python', 'setup.py', 'develop', '--uninstall']
|
2012-01-11 12:47:33 -08:00
|
|
|
ROOT_CONF = "keystone.conf"
|
|
|
|
CONFIGS = [ROOT_CONF]
|
|
|
|
BIN_DIR = "bin"
|
|
|
|
DB_NAME = "keystone"
|
|
|
|
|
2012-01-11 13:19:58 -08:00
|
|
|
|
2012-01-12 17:35:41 -08:00
|
|
|
class KeystoneBase(ComponentBase):
|
2012-01-11 12:47:33 -08:00
|
|
|
def __init__(self, *args, **kargs):
|
2012-01-12 17:35:41 -08:00
|
|
|
ComponentBase.__init__(self, TYPE, *args, **kargs)
|
2012-01-13 12:07:41 -08:00
|
|
|
self.cfgdir = joinpths(self.appdir, CONFIG_DIR)
|
2012-01-11 12:47:33 -08:00
|
|
|
self.bindir = joinpths(self.appdir, BIN_DIR)
|
|
|
|
|
|
|
|
|
2012-01-12 17:35:41 -08:00
|
|
|
class KeystoneUninstaller(KeystoneBase, UninstallComponent):
|
2012-01-11 12:47:33 -08:00
|
|
|
def __init__(self, *args, **kargs):
|
|
|
|
KeystoneBase.__init__(self, *args, **kargs)
|
2012-01-13 12:07:41 -08:00
|
|
|
self.tracereader = TraceReader(self.tracedir, IN_TRACE)
|
2012-01-12 20:30:48 -08:00
|
|
|
|
2012-01-12 17:35:41 -08:00
|
|
|
def unconfigure(self):
|
|
|
|
#get rid of all files configured
|
|
|
|
cfgfiles = self.tracereader.files_configured()
|
|
|
|
if(len(cfgfiles)):
|
|
|
|
LOG.info("Removing %s configuration files" % (len(cfgfiles)))
|
|
|
|
for fn in cfgfiles:
|
|
|
|
if(len(fn)):
|
|
|
|
unlink(fn)
|
|
|
|
LOG.info("Removed %s" % (fn))
|
|
|
|
|
|
|
|
def uninstall(self):
|
|
|
|
#clean out removeable packages
|
|
|
|
pkgsfull = self.tracereader.packages_installed()
|
|
|
|
if(len(pkgsfull)):
|
|
|
|
LOG.info("Potentially removing %s packages" % (len(pkgsfull)))
|
|
|
|
self.packager.remove_batch(pkgsfull)
|
2012-01-13 15:08:48 -08:00
|
|
|
#clean out pips
|
|
|
|
pipsfull = self.tracereader.pips_installed()
|
|
|
|
if(len(pipsfull)):
|
|
|
|
LOG.info("Potentially removing %s pips" % (len(pipsfull)))
|
|
|
|
Pip.uninstall(pipsfull)
|
2012-01-12 17:35:41 -08:00
|
|
|
#clean out files touched
|
|
|
|
filestouched = self.tracereader.files_touched()
|
|
|
|
if(len(filestouched)):
|
|
|
|
LOG.info("Removing %s touched files" % (len(filestouched)))
|
|
|
|
for fn in filestouched:
|
|
|
|
if(len(fn)):
|
|
|
|
unlink(fn)
|
|
|
|
LOG.info("Removed %s" % (fn))
|
|
|
|
#undevelop python???
|
|
|
|
#how should this be done??
|
|
|
|
pylisting = self.tracereader.py_listing()
|
|
|
|
if(pylisting != None):
|
|
|
|
execute(*PY_UNINSTALL, cwd=self.appdir, run_as_root=True)
|
|
|
|
#clean out dirs created
|
|
|
|
dirsmade = self.tracereader.dirs_made()
|
|
|
|
if(len(dirsmade)):
|
|
|
|
LOG.info("Removing %s created directories" % (len(dirsmade)))
|
|
|
|
for dirname in dirsmade:
|
|
|
|
deldir(dirname)
|
|
|
|
LOG.info("Removed %s" % (dirname))
|
|
|
|
|
|
|
|
|
|
|
|
class KeystoneInstaller(KeystoneBase, InstallComponent):
|
2012-01-11 12:47:33 -08:00
|
|
|
def __init__(self, *args, **kargs):
|
|
|
|
KeystoneBase.__init__(self, *args, **kargs)
|
|
|
|
self.gitloc = self.cfg.get("git", "keystone_repo")
|
|
|
|
self.brch = self.cfg.get("git", "keystone_branch")
|
2012-01-13 12:07:41 -08:00
|
|
|
self.tracewriter = TraceWriter(self.tracedir, IN_TRACE)
|
2012-01-11 12:47:33 -08:00
|
|
|
|
|
|
|
def download(self):
|
|
|
|
dirsmade = Downloader.download(self.appdir, self.gitloc, self.brch)
|
2012-01-12 10:49:25 -08:00
|
|
|
#this trace isn't used yet but could be
|
2012-01-11 12:47:33 -08:00
|
|
|
self.tracewriter.downloaded(self.appdir, self.gitloc)
|
2012-01-12 10:49:25 -08:00
|
|
|
#this trace is used to remove the dirs created
|
2012-01-11 12:47:33 -08:00
|
|
|
self.tracewriter.dir_made(*dirsmade)
|
|
|
|
return self.tracedir
|
|
|
|
|
2012-01-12 20:30:48 -08:00
|
|
|
def _do_install(self, pkgs):
|
2012-01-13 15:08:48 -08:00
|
|
|
LOG.debug("Installing packages %s" % (", ".join(pkgs.keys())))
|
2012-01-12 20:30:48 -08:00
|
|
|
self.packager.pre_install(pkgs)
|
|
|
|
self.packager.install_batch(pkgs)
|
|
|
|
self.packager.post_install(pkgs)
|
|
|
|
|
2012-01-11 12:47:33 -08:00
|
|
|
def install(self):
|
2012-01-13 15:08:48 -08:00
|
|
|
#install needed pkgs
|
2012-01-11 12:47:33 -08:00
|
|
|
pkgs = get_pkg_list(self.distro, TYPE)
|
2012-01-13 15:08:48 -08:00
|
|
|
if(len(pkgs)):
|
|
|
|
#do the install
|
|
|
|
self._do_install(pkgs)
|
|
|
|
#this trace is used to remove the pkgs installed
|
|
|
|
for name in pkgs.keys():
|
|
|
|
self.tracewriter.package_install(name, pkgs.get(name))
|
|
|
|
#install the needed pips
|
|
|
|
pips = get_pip_list(self.distro, TYPE)
|
|
|
|
if(len(pips)):
|
|
|
|
Pip.install(pips)
|
|
|
|
#this trace is used to remove the pips installed
|
|
|
|
for name in pips.keys():
|
|
|
|
self.tracewriter.pip_install(name, pips.get(name))
|
2012-01-12 10:49:25 -08:00
|
|
|
#this trace is used to remove the dirs created
|
2012-01-13 15:08:48 -08:00
|
|
|
dirsmade = mkdirslist(self.tracedir)
|
2012-01-11 12:47:33 -08:00
|
|
|
self.tracewriter.dir_made(*dirsmade)
|
2012-01-13 12:07:41 -08:00
|
|
|
recordwhere = touch_trace(self.tracedir, PY_TRACE)
|
2012-01-12 10:49:25 -08:00
|
|
|
#this trace is used to remove the trace created
|
2012-01-11 12:47:33 -08:00
|
|
|
self.tracewriter.py_install(recordwhere)
|
|
|
|
(sysout, stderr) = execute(*PY_INSTALL, cwd=self.appdir, run_as_root=True)
|
|
|
|
write_file(recordwhere, sysout)
|
|
|
|
#adjust db
|
|
|
|
self._setup_db()
|
|
|
|
#setup any data
|
|
|
|
self._setup_data()
|
|
|
|
return self.tracedir
|
|
|
|
|
|
|
|
def configure(self):
|
|
|
|
dirsmade = mkdirslist(self.cfgdir)
|
|
|
|
self.tracewriter.dir_made(*dirsmade)
|
|
|
|
for fn in CONFIGS:
|
2012-01-13 12:07:41 -08:00
|
|
|
sourcefn = joinpths(STACK_CONFIG_DIR, TYPE, fn)
|
2012-01-11 12:47:33 -08:00
|
|
|
tgtfn = joinpths(self.cfgdir, fn)
|
|
|
|
LOG.info("Configuring template file %s" % (sourcefn))
|
|
|
|
contents = load_file(sourcefn)
|
2012-01-12 17:35:41 -08:00
|
|
|
pmap = self._get_param_map()
|
2012-01-11 12:47:33 -08:00
|
|
|
LOG.info("Replacing parameters in file %s" % (sourcefn))
|
|
|
|
LOG.debug("Replacements = %s" % (pmap))
|
|
|
|
contents = param_replace(contents, pmap)
|
|
|
|
LOG.debug("Applying side-effects of param replacement for template %s" % (sourcefn))
|
|
|
|
self._config_apply(contents, fn)
|
|
|
|
LOG.info("Writing configuration file %s" % (tgtfn))
|
|
|
|
write_file(tgtfn, contents)
|
2012-01-12 10:49:25 -08:00
|
|
|
#this trace is used to remove the files configured
|
2012-01-11 12:47:33 -08:00
|
|
|
self.tracewriter.cfg_write(tgtfn)
|
|
|
|
return self.tracedir
|
|
|
|
|
|
|
|
def _setup_db(self):
|
2012-01-12 17:35:41 -08:00
|
|
|
Db.drop_db(self.cfg, DB_NAME)
|
|
|
|
Db.create_db(self.cfg, DB_NAME)
|
2012-01-11 12:47:33 -08:00
|
|
|
|
|
|
|
def _setup_data(self):
|
2012-01-12 20:30:48 -08:00
|
|
|
params = self._get_param_map()
|
2012-01-12 23:42:25 -08:00
|
|
|
cmds = _keystone_setup_cmds(self.othercomponents)
|
2012-01-12 20:35:25 -08:00
|
|
|
execute_template(*cmds, params=params, ignore_missing=True)
|
2012-01-11 12:47:33 -08:00
|
|
|
|
|
|
|
def _config_apply(self, contents, fn):
|
|
|
|
lines = contents.splitlines()
|
|
|
|
for line in lines:
|
|
|
|
cleaned = line.strip()
|
|
|
|
if(len(cleaned) == 0 or cleaned[0] == '#' or cleaned[0] == '['):
|
|
|
|
#not useful to examine these
|
|
|
|
continue
|
|
|
|
pieces = cleaned.split("=", 1)
|
|
|
|
if(len(pieces) != 2):
|
|
|
|
continue
|
|
|
|
key = pieces[0].strip()
|
|
|
|
val = pieces[1].strip()
|
|
|
|
if(len(key) == 0 or len(val) == 0):
|
|
|
|
continue
|
|
|
|
#now we take special actions
|
|
|
|
if(key == 'log_file'):
|
|
|
|
# Ensure that we can write to the log file
|
|
|
|
dirname = os.path.dirname(val)
|
|
|
|
if(len(dirname)):
|
|
|
|
dirsmade = mkdirslist(dirname)
|
|
|
|
# This trace is used to remove the dirs created
|
|
|
|
self.tracewriter.dir_made(*dirsmade)
|
|
|
|
# Destroy then recreate it
|
|
|
|
unlink(val)
|
|
|
|
touch_file(val)
|
|
|
|
self.tracewriter.file_touched(val)
|
|
|
|
|
2012-01-12 17:35:41 -08:00
|
|
|
def _get_param_map(self):
|
2012-01-13 15:08:48 -08:00
|
|
|
#these be used to fill in the configuration/cmds +
|
2012-01-12 10:49:25 -08:00
|
|
|
#params with actual values
|
2012-01-11 12:47:33 -08:00
|
|
|
mp = dict()
|
|
|
|
mp['DEST'] = self.appdir
|
|
|
|
mp['SQL_CONN'] = get_dbdsn(self.cfg, DB_NAME)
|
2012-01-12 17:35:41 -08:00
|
|
|
mp['ADMIN_PASSWORD'] = self.cfg.getpw('passwords', 'horizon_keystone_admin')
|
2012-01-13 12:07:41 -08:00
|
|
|
mp['HOST_IP'] = get_host_ip(self.cfg)
|
|
|
|
mp['SERVICE_TOKEN'] = self.cfg.getpw("passwords", "service_token")
|
|
|
|
mp['BIN_DIR'] = self.bindir
|
2012-01-13 15:08:48 -08:00
|
|
|
mp['CONFIG_FILE'] = joinpths(self.cfgdir, ROOT_CONF)
|
2012-01-11 12:47:33 -08:00
|
|
|
return mp
|
|
|
|
|
|
|
|
|
2012-01-12 17:35:41 -08:00
|
|
|
class KeystoneRuntime(KeystoneBase, RuntimeComponent):
|
2012-01-11 12:47:33 -08:00
|
|
|
def __init__(self, *args, **kargs):
|
|
|
|
KeystoneBase.__init__(self, *args, **kargs)
|
2012-01-12 23:42:25 -08:00
|
|
|
|
|
|
|
|
|
|
|
# Keystone setup commands are the the following
|
|
|
|
def _keystone_setup_cmds(components):
|
|
|
|
|
|
|
|
# See http://keystone.openstack.org/man/keystone-manage.html
|
|
|
|
|
2012-01-13 15:08:48 -08:00
|
|
|
root_cmd = ["%BIN_DIR%/keystone-manage", '--config-file=%CONFIG_FILE%']
|
|
|
|
|
2012-01-12 23:42:25 -08:00
|
|
|
# Tenants
|
|
|
|
tenant_cmds = [
|
|
|
|
{
|
2012-01-13 15:08:48 -08:00
|
|
|
"cmd": root_cmd + ["tenant", "add", "admin"],
|
2012-01-12 23:42:25 -08:00
|
|
|
},
|
|
|
|
{
|
2012-01-13 15:08:48 -08:00
|
|
|
"cmd": root_cmd + ["tenant", "add", "demo"]
|
2012-01-12 23:42:25 -08:00
|
|
|
},
|
|
|
|
{
|
2012-01-13 15:08:48 -08:00
|
|
|
"cmd": root_cmd + ["tenant", "add", "invisible_to_admin"]
|
2012-01-12 23:42:25 -08:00
|
|
|
},
|
|
|
|
]
|
|
|
|
|
|
|
|
# Users
|
|
|
|
user_cmds = [
|
|
|
|
{
|
2012-01-13 15:08:48 -08:00
|
|
|
"cmd": root_cmd + ["user", "add", "admin", "%ADMIN_PASSWORD%"]
|
2012-01-12 23:42:25 -08:00
|
|
|
},
|
|
|
|
{
|
2012-01-13 15:08:48 -08:00
|
|
|
"cmd": root_cmd + ["user", "add", "demo", "%ADMIN_PASSWORD%"]
|
2012-01-12 23:42:25 -08:00
|
|
|
},
|
|
|
|
]
|
|
|
|
|
|
|
|
# Roles
|
|
|
|
role_cmds = [
|
|
|
|
{
|
2012-01-13 15:08:48 -08:00
|
|
|
"cmd": root_cmd + ["role", "add", "Admin"]
|
2012-01-12 23:42:25 -08:00
|
|
|
},
|
|
|
|
{
|
2012-01-13 15:08:48 -08:00
|
|
|
"cmd": root_cmd + ["role", "add", "Member"]
|
2012-01-12 23:42:25 -08:00
|
|
|
},
|
|
|
|
{
|
2012-01-13 15:08:48 -08:00
|
|
|
"cmd": root_cmd + ["role", "add", "KeystoneAdmin"]
|
2012-01-12 23:42:25 -08:00
|
|
|
},
|
|
|
|
{
|
2012-01-13 15:08:48 -08:00
|
|
|
"cmd": root_cmd + ["role", "add", "KeystoneServiceAdmin"]
|
2012-01-12 23:42:25 -08:00
|
|
|
},
|
|
|
|
{
|
2012-01-13 15:08:48 -08:00
|
|
|
"cmd": root_cmd + ["role", "add", "sysadmin"]
|
2012-01-12 23:42:25 -08:00
|
|
|
},
|
|
|
|
{
|
2012-01-13 15:08:48 -08:00
|
|
|
"cmd": root_cmd + ["role", "add", "netadmin"]
|
2012-01-12 23:42:25 -08:00
|
|
|
},
|
|
|
|
{
|
2012-01-13 15:08:48 -08:00
|
|
|
"cmd": root_cmd + ["role", "grant", "Admin", "admin", "admin"]
|
2012-01-12 23:42:25 -08:00
|
|
|
},
|
|
|
|
{
|
2012-01-13 15:08:48 -08:00
|
|
|
"cmd": root_cmd + ["role", "grant", "Member", "demo", "demo"]
|
2012-01-12 23:42:25 -08:00
|
|
|
},
|
|
|
|
{
|
2012-01-13 15:08:48 -08:00
|
|
|
"cmd": root_cmd + ["role", "grant", "sysadmin", "demo", "demo"]
|
2012-01-12 23:42:25 -08:00
|
|
|
},
|
|
|
|
{
|
2012-01-13 15:08:48 -08:00
|
|
|
"cmd": root_cmd + ["role", "grant", "netadmin", "demo", "demo"]
|
2012-01-12 23:42:25 -08:00
|
|
|
},
|
|
|
|
{
|
2012-01-13 15:08:48 -08:00
|
|
|
"cmd": root_cmd + ["role", "grant", "Member", "demo", "invisible_to_admin"]
|
2012-01-12 23:42:25 -08:00
|
|
|
},
|
|
|
|
{
|
2012-01-13 15:08:48 -08:00
|
|
|
"cmd": root_cmd + ["role", "grant", "Admin", "admin", "demo"]
|
2012-01-12 23:42:25 -08:00
|
|
|
},
|
|
|
|
{
|
2012-01-13 15:08:48 -08:00
|
|
|
"cmd": root_cmd + ["role", "grant", "Admin", "admin"]
|
2012-01-12 23:42:25 -08:00
|
|
|
},
|
|
|
|
{
|
2012-01-13 15:08:48 -08:00
|
|
|
"cmd": root_cmd + ["role", "grant", "KeystoneAdmin", "admin"]
|
2012-01-12 23:42:25 -08:00
|
|
|
},
|
|
|
|
{
|
2012-01-13 15:08:48 -08:00
|
|
|
"cmd": root_cmd + ["role", "grant", "KeystoneServiceAdmin", "admin"]
|
2012-01-12 23:42:25 -08:00
|
|
|
}
|
|
|
|
]
|
|
|
|
|
|
|
|
# Services
|
|
|
|
services = []
|
|
|
|
services.append({
|
2012-01-13 15:08:48 -08:00
|
|
|
"cmd": root_cmd + ["service", "add", "keystone", "identity", "Keystone Identity Service"]
|
2012-01-12 23:42:25 -08:00
|
|
|
})
|
|
|
|
|
2012-01-13 12:07:41 -08:00
|
|
|
if(NOVA in components):
|
2012-01-12 23:42:25 -08:00
|
|
|
services.append({
|
2012-01-13 15:08:48 -08:00
|
|
|
"cmd": root_cmd + ["service", "add", "nova", "compute", "Nova Compute Service"]
|
2012-01-12 23:42:25 -08:00
|
|
|
})
|
|
|
|
services.append({
|
2012-01-13 15:08:48 -08:00
|
|
|
"cmd": root_cmd + ["service", "add", "ec2", "ec2", "EC2 Compatability Layer"]
|
2012-01-12 23:42:25 -08:00
|
|
|
})
|
|
|
|
|
2012-01-13 12:07:41 -08:00
|
|
|
if(GLANCE in components):
|
2012-01-12 23:42:25 -08:00
|
|
|
services.append({
|
2012-01-13 15:08:48 -08:00
|
|
|
"cmd": root_cmd + ["service", "add", "glance", "image", "Glance Image Service"]
|
2012-01-12 23:42:25 -08:00
|
|
|
})
|
|
|
|
|
2012-01-13 12:07:41 -08:00
|
|
|
if(SWIFT in components):
|
2012-01-12 23:42:25 -08:00
|
|
|
services.append({
|
2012-01-13 15:08:48 -08:00
|
|
|
"cmd": root_cmd + ["service", "add", "swift", "object-store", "Swift Service"]
|
2012-01-12 23:42:25 -08:00
|
|
|
})
|
|
|
|
|
|
|
|
# Endpoint templates
|
|
|
|
endpoint_templates = list()
|
|
|
|
endpoint_templates.append({
|
2012-01-13 15:08:48 -08:00
|
|
|
"cmd": root_cmd + ["endpointTemplates", "add",
|
2012-01-12 23:42:25 -08:00
|
|
|
"RegionOne", "keystone",
|
|
|
|
"http://%HOST_IP%:5000/v2.0",
|
|
|
|
"http://%HOST_IP%:35357/v2.0",
|
|
|
|
"http://%HOST_IP%:5000/v2.0",
|
|
|
|
"1",
|
|
|
|
"1"
|
2012-01-13 15:08:48 -08:00
|
|
|
]
|
2012-01-12 23:42:25 -08:00
|
|
|
})
|
|
|
|
|
2012-01-13 12:07:41 -08:00
|
|
|
if(NOVA in components):
|
2012-01-12 23:42:25 -08:00
|
|
|
endpoint_templates.append({
|
2012-01-13 15:08:48 -08:00
|
|
|
"cmd": root_cmd + ["endpointTemplates", "add",
|
2012-01-12 23:42:25 -08:00
|
|
|
"RegionOne", "nova",
|
|
|
|
"http://%HOST_IP%:8774/v1.1/%tenant_id%",
|
|
|
|
"http://%HOST_IP%:8774/v1.1/%tenant_id%",
|
|
|
|
"http://%HOST_IP%:8774/v1.1/%tenant_id%",
|
|
|
|
"1",
|
|
|
|
"1"
|
|
|
|
]
|
|
|
|
})
|
|
|
|
endpoint_templates.append({
|
2012-01-13 15:08:48 -08:00
|
|
|
"cmd": root_cmd + ["endpointTemplates", "add",
|
2012-01-12 23:42:25 -08:00
|
|
|
"RegionOne", "ec2",
|
|
|
|
"http://%HOST_IP%:8773/services/Cloud",
|
|
|
|
"http://%HOST_IP%:8773/services/Admin",
|
|
|
|
"http://%HOST_IP%:8773/services/Cloud",
|
|
|
|
"1",
|
|
|
|
"1"
|
|
|
|
]
|
|
|
|
})
|
|
|
|
|
2012-01-13 12:07:41 -08:00
|
|
|
if(GLANCE in components):
|
2012-01-12 23:42:25 -08:00
|
|
|
endpoint_templates.append({
|
2012-01-13 15:08:48 -08:00
|
|
|
"cmd": root_cmd + ["endpointTemplates", "add",
|
2012-01-12 23:42:25 -08:00
|
|
|
"RegionOne", "glance",
|
|
|
|
"http://%HOST_IP%:9292/v1.1/%tenant_id%",
|
|
|
|
"http://%HOST_IP%:9292/v1.1/%tenant_id%",
|
|
|
|
"http://%HOST_IP%:9292/v1.1/%tenant_id%",
|
|
|
|
"1",
|
|
|
|
"1"
|
|
|
|
]
|
|
|
|
})
|
|
|
|
|
2012-01-13 12:07:41 -08:00
|
|
|
if(SWIFT in components):
|
2012-01-12 23:42:25 -08:00
|
|
|
endpoint_templates.append({
|
2012-01-13 15:08:48 -08:00
|
|
|
"cmd": root_cmd + ["endpointTemplates", "add",
|
2012-01-12 23:42:25 -08:00
|
|
|
"RegionOne", "swift",
|
|
|
|
"http://%HOST_IP%:8080/v1/AUTH_%tenant_id%",
|
|
|
|
"http://%HOST_IP%:8080/",
|
|
|
|
"http://%HOST_IP%:8080/v1/AUTH_%tenant_id%",
|
|
|
|
"1",
|
|
|
|
"1"
|
|
|
|
]
|
|
|
|
})
|
|
|
|
|
|
|
|
# Tokens
|
|
|
|
tokens = [
|
|
|
|
{
|
2012-01-13 15:08:48 -08:00
|
|
|
"cmd": root_cmd + ["token", "add", "%SERVICE_TOKEN%", "admin", "admin", "2015-02-05T00:00"]
|
2012-01-12 23:42:25 -08:00
|
|
|
},
|
|
|
|
]
|
|
|
|
|
|
|
|
# EC2 related creds - note we are setting the secret key to ADMIN_PASSWORD
|
|
|
|
# but keystone doesn't parse them - it is just a blob from keystone's
|
|
|
|
# point of view
|
|
|
|
ec2_creds = []
|
2012-01-13 12:07:41 -08:00
|
|
|
if(NOVA in components):
|
2012-01-12 23:42:25 -08:00
|
|
|
ec2_creds = [
|
|
|
|
{
|
2012-01-13 15:08:48 -08:00
|
|
|
"cmd": root_cmd + ["credentials", "add",
|
|
|
|
"admin", "EC2", "admin", "%ADMIN_PASSWORD%", "admin" ]
|
2012-01-12 23:42:25 -08:00
|
|
|
},
|
|
|
|
{
|
2012-01-13 15:08:48 -08:00
|
|
|
"cmd": root_cmd + ["credentials", "add",
|
|
|
|
"demo", "EC2", "demo", "%ADMIN_PASSWORD%", "demo"]
|
2012-01-12 23:42:25 -08:00
|
|
|
}
|
|
|
|
]
|
|
|
|
|
2012-01-13 15:08:48 -08:00
|
|
|
# Order matters here...
|
|
|
|
all_cmds = tenant_cmds + user_cmds + role_cmds + services + endpoint_templates + tokens + ec2_creds
|
2012-01-12 23:42:25 -08:00
|
|
|
return all_cmds
|