From 06be94efdf23f6eae6e2edd941032495e71462c8 Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Wed, 7 Mar 2012 12:39:24 -0800 Subject: [PATCH] more attempts at fixing keystone init --- conf/templates/keystone/keystone_init.sh.tpl | 15 +++--- devstack/cfg.py | 5 +- tools/list_epels.py | 50 ++++++++++++++++++++ 3 files changed, 59 insertions(+), 11 deletions(-) create mode 100644 tools/list_epels.py diff --git a/conf/templates/keystone/keystone_init.sh.tpl b/conf/templates/keystone/keystone_init.sh.tpl index b6f20869..e78c1f19 100644 --- a/conf/templates/keystone/keystone_init.sh.tpl +++ b/conf/templates/keystone/keystone_init.sh.tpl @@ -22,9 +22,9 @@ # Variables set before calling this script: # # SERVICE_TOKEN - aka admin_token in keystone.conf -# SERVICE_ENDPOINT - local Keystone admin endpoint +# AUTH_ENDPOINT - local Keystone admin endpoint # SERVICE_TENANT_NAME - name of tenant containing service accounts -# ENABLED_SERVICES - devstackPY's list of services being activated +# ENABLED_SERVICES - devstack's list of services being activated set -e @@ -37,7 +37,8 @@ export SERVICE_PASSWORD SERVICE_TOKEN=%SERVICE_TOKEN% export SERVICE_TOKEN -SERVICE_ENDPOINT=%SERVICE_ENDPOINT% +# This is really the AUTH_ENDPOINT (wtf) +SERVICE_ENDPOINT=%AUTH_ENDPOINT% export SERVICE_ENDPOINT SERVICE_TENANT_NAME=%SERVICE_TENANT_NAME% @@ -122,11 +123,9 @@ qq keystone user-role-add --tenant_id $SERVICE_TENANT \ --user $GLANCE_USER \ --role $ADMIN_ROLE -if [[ "$ENABLED_SERVICES" =~ "n-vol" ]]; then - qq keystone service-create --name="nova-volume" \ - --type=volume \ - --description="Nova Volume Service" -fi +qq keystone service-create --name="nova-volume" \ + --type=volume \ + --description="Nova Volume Service" if [[ "$ENABLED_SERVICES" =~ "swift" ]]; then qq keystone service-create --name=swift \ diff --git a/devstack/cfg.py b/devstack/cfg.py index a3bc4472..4cb29aca 100644 --- a/devstack/cfg.py +++ b/devstack/cfg.py @@ -102,10 +102,9 @@ class StackConfigParser(IgnoreMissingConfigParser): LOG.debug("Host ip from configuration/environment was empty, programatically attempting to determine it.") value_gotten = utils.get_host_ip() LOG.debug("Determined your host ip to be: \"%s\"" % (value_gotten)) - elif section in PW_SECTIONS and auto_pw and len(value_gotten) == 0: + if section in PW_SECTIONS and auto_pw and len(value_gotten) == 0: LOG.debug("Being forced to ask for password for \"%s\" since the configuration value is empty.", key) - prompt = PW_PROMPTS.get(option, PW_TMPL % (key)) - value_gotten = sh.password(prompt) + value_gotten = sh.password(PW_PROMPTS.get(option, PW_TMPL % (key))) self.pws[key] = value_gotten return value_gotten diff --git a/tools/list_epels.py b/tools/list_epels.py new file mode 100644 index 00000000..a4fd52b8 --- /dev/null +++ b/tools/list_epels.py @@ -0,0 +1,50 @@ +import os +import sys +import tempfile + +possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), os.pardir, os.pardir)) +sys.path.insert(0, possible_topdir) + +from devstack import utils +from devstack import settings +from devstack import component +from devstack.progs import common + +EPEL_DISTRO = settings.RHEL6 + +def get_epels(c, distro): + cls = common.get_action_cls(settings.INSTALL, c) + dummy_config = common.get_config() + dummy_root = tempfile.gettempdir() + instance = cls(instances=set(), distro=distro, + packager=None, config=dummy_config, + root=dummy_root, opts=list(), + keep_old=False) + if not isinstance(instance, component.PkgInstallComponent): + return None + else: + pkgs = instance._get_pkgs_expanded() + epel_pkgs = dict() + for (name, info) in pkgs.items(): + meta = info.get("meta") or dict() + if meta and meta.get("epel"): + epel_pkgs[name] = info + return epel_pkgs + + +if __name__ == "__main__": + me = os.path.basename(sys.argv[0]) + distro = EPEL_DISTRO + for c in sorted(settings.COMPONENT_NAMES): + print("Packages for %s:" % (utils.color_text(c, 'green', bold=True, underline=True))) + pkgs = get_epels(c, distro) + if not pkgs: + print("\t- %s" % (utils.color_text('N/A', 'red'))) + else: + names = sorted(pkgs.keys()) + for name in names: + real_name = name + info = pkgs.get(name) or dict() + if 'version' in info: + real_name = "%s (%s)" % (name, utils.color_text(str(info.get('version')), 'blue', bold=True)) + print("\t- %s" % real_name)