[meta-virtualization] [m-c-s][PATCH] python-keystone: generate admin-openrc

Mark Asselstine mark.asselstine at windriver.com
Fri Dec 1 12:13:33 PST 2017


In order to interact with the openstack CLI commands it is common
practice to source *openrc files which populate the environment with a
base set of values. See

https://docs.openstack.org/keystone/pike/install/keystone-openrc-obs.html

We used to do this as part of nova but it makes more sense to create
these as part of keystone. This makes them available early in the
setup process and also maps with the keystone bootstrapping.

Signed-off-by: Mark Asselstine <mark.asselstine at windriver.com>
---
 .../recipes-devtools/python/python-keystone/admin-openrc     | 12 ++++++++++++
 .../recipes-devtools/python/python-keystone_git.bb           |  8 ++++++++
 2 files changed, 20 insertions(+)
 create mode 100644 meta-openstack/recipes-devtools/python/python-keystone/admin-openrc

diff --git a/meta-openstack/recipes-devtools/python/python-keystone/admin-openrc b/meta-openstack/recipes-devtools/python/python-keystone/admin-openrc
new file mode 100644
index 0000000..4b459d7
--- /dev/null
+++ b/meta-openstack/recipes-devtools/python/python-keystone/admin-openrc
@@ -0,0 +1,12 @@
+#
+# Matches bootstrap data in keystone-init
+#
+export OS_PROJECT_DOMAIN_NAME=Default
+export OS_USER_DOMAIN_NAME=Default
+export OS_PROJECT_NAME=admin
+export OS_USERNAME=%ADMIN_USER%
+export OS_PASSWORD=%ADMIN_PASSWORD%
+export OS_AUTH_URL=http://%CONTROLLER_IP%:35357/v3
+export OS_IDENTITY_API_VERSION=3
+export OS_IMAGE_API_VERSION=2
+export OS_REGION_NAME=RegionOne
diff --git a/meta-openstack/recipes-devtools/python/python-keystone_git.bb b/meta-openstack/recipes-devtools/python/python-keystone_git.bb
index c3437cd..118574b 100644
--- a/meta-openstack/recipes-devtools/python/python-keystone_git.bb
+++ b/meta-openstack/recipes-devtools/python/python-keystone_git.bb
@@ -13,6 +13,7 @@ SRC_URI = "git://github.com/openstack/${SRCNAME}.git;branch=stable/pike \
            file://identity.sh \
            file://convert_keystone_backend.py \
            file://wsgi-keystone.conf \
+           file://admin-openrc \
            "
 
 # TBD: update or drop
@@ -92,6 +93,13 @@ do_install_append() {
     sed -e "s:%ADMIN_PASSWORD%:${ADMIN_PASSWORD}:g" -i ${KS_INIT_FILE}
     sed -e "s:%ADMIN_ROLE%:${ADMIN_ROLE}:g" -i ${KS_INIT_FILE}
 
+    # Setup the admin-openrc file
+    KS_OPENRC_FILE=${KEYSTONE_CONF_DIR}/admin-openrc
+    install -m 600 ${WORKDIR}/admin-openrc ${KS_OPENRC_FILE}
+    sed -e "s:%CONTROLLER_IP%:${CONTROLLER_IP}:g" -i ${KS_OPENRC_FILE}
+    sed -e "s:%ADMIN_USER%:${ADMIN_USER}:g" -i ${KS_OPENRC_FILE}
+    sed -e "s:%ADMIN_PASSWORD%:${ADMIN_PASSWORD}:g" -i ${KS_OPENRC_FILE}
+
     # Install various configuration files. We have to select suitable
     # permissions as packages such as Apache require read access.
     #
-- 
2.7.4



More information about the meta-virtualization mailing list