aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmy Fong <amy.fong@windriver.com>2014-07-23 12:21:00 -0400
committerBruce Ashfield <bruce.ashfield@windriver.com>2014-07-30 10:46:55 -0400
commitc7901ea352dc1085a5480326c5fea5e5dd03e122 (patch)
tree18a3b79f4f909e9895308f79fbe0988f7daee98e
parent173db7893acbdad62b4938cbabb49a9d26f3598f (diff)
downloadmeta-cloud-services-c7901ea352dc1085a5480326c5fea5e5dd03e122.tar.gz
meta-cloud-services-c7901ea352dc1085a5480326c5fea5e5dd03e122.tar.bz2
meta-cloud-services-c7901ea352dc1085a5480326c5fea5e5dd03e122.zip
keystone: Add script to change backend to hybrid
Adding /etc/keystone/hybrid-backend-setup and convert_keystone_backend.py to set the backend for keystone to hybrid and starts openldap and restarts keystone. Signed-off-by: Amy Fong <amy.fong@windriver.com>
-rwxr-xr-xmeta-openstack/recipes-devtools/python/python-keystone/convert_keystone_backend.py43
-rwxr-xr-xmeta-openstack/recipes-devtools/python/python-keystone/hybrid-backend-setup6
-rw-r--r--meta-openstack/recipes-devtools/python/python-keystone/keystone2
-rw-r--r--meta-openstack/recipes-devtools/python/python-keystone_git.bb15
4 files changed, 56 insertions, 10 deletions
diff --git a/meta-openstack/recipes-devtools/python/python-keystone/convert_keystone_backend.py b/meta-openstack/recipes-devtools/python/python-keystone/convert_keystone_backend.py
new file mode 100755
index 0000000..eebd59d
--- /dev/null
+++ b/meta-openstack/recipes-devtools/python/python-keystone/convert_keystone_backend.py
@@ -0,0 +1,43 @@
+#!/usr/bin/python
+
+import sys
+import ConfigParser
+import shutil
+
+path = "/etc/keystone/keystone.conf"
+
+if len(sys.argv) != 2:
+ sys.stderr.write("Usage: "+sys.argv[0]+" [sql|hybrid]\n")
+ sys.exit(1)
+
+backend = sys.argv[1]
+if backend == "hybrid":
+ identity_backend = 'keystone.identity.backends.hybrid_identity.Identity'
+ assignment_backend = 'keystone.assignment.backends.hybrid_assignment.Assignment'
+elif backend == "sql":
+ identity_backend = 'keystone.identity.backends.sql.Identity'
+ assignment_backend = 'keystone.assignment.backends.sql.Assignment'
+else:
+ sys.stderr.write("Usage: "+sys.argv[0]+" [sql|hybrid]\n")
+ sys.exit(1)
+
+shutil.copyfile(path, path + ".bak")
+
+cfg = ConfigParser.ConfigParser()
+c = cfg.read(path)
+
+if not cfg.has_section("identity"):
+ cfg.add_section("identity")
+
+cfg.set("identity", "driver", identity_backend)
+
+if not cfg.has_section("assignment"):
+ cfg.add_section("assignment")
+
+cfg.set("assignment", "driver", assignment_backend)
+
+fp = open(path, "w")
+cfg.write(fp)
+fp.close()
+
+exit(0)
diff --git a/meta-openstack/recipes-devtools/python/python-keystone/hybrid-backend-setup b/meta-openstack/recipes-devtools/python/python-keystone/hybrid-backend-setup
new file mode 100755
index 0000000..d3f7eac
--- /dev/null
+++ b/meta-openstack/recipes-devtools/python/python-keystone/hybrid-backend-setup
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+/etc/keystone/convert_keystone_backend.py hybrid
+
+/etc/init.d/openldap start
+/etc/init.d/keystone restart
diff --git a/meta-openstack/recipes-devtools/python/python-keystone/keystone b/meta-openstack/recipes-devtools/python/python-keystone/keystone
index 6524fed..8953da8 100644
--- a/meta-openstack/recipes-devtools/python/python-keystone/keystone
+++ b/meta-openstack/recipes-devtools/python/python-keystone/keystone
@@ -98,7 +98,7 @@ reset()
ADMIN_PASSWORD=%ADMIN_PASSWORD% \
SERVICE_PASSWORD=%SERVICE_PASSWORD% \
SERVICE_TENANT_NAME=%SERVICE_TENANT_NAME% \
- bash /etc/keystone/identity.sh
+ bash /etc/keystone/service-user-setup
}
case "$1" in
diff --git a/meta-openstack/recipes-devtools/python/python-keystone_git.bb b/meta-openstack/recipes-devtools/python/python-keystone_git.bb
index dfeeb1f..43b2e33 100644
--- a/meta-openstack/recipes-devtools/python/python-keystone_git.bb
+++ b/meta-openstack/recipes-devtools/python/python-keystone_git.bb
@@ -4,7 +4,7 @@ SECTION = "devel/python"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=1dece7821bf3fd70fe1309eaa37d52a2"
-PR = "r0"
+PR = "r1"
SRCNAME = "keystone"
SRC_URI = "git://github.com/openstack/${SRCNAME}.git;branch=stable/havana \
@@ -15,6 +15,8 @@ SRC_URI = "git://github.com/openstack/${SRCNAME}.git;branch=stable/havana \
file://keystone-search-in-etc-directory-for-config-files.patch \
file://keystone-fix-location-of-files-for-tests.patch \
file://keystone-remove-git-commands-in-tests.patch \
+ file://hybrid-backend-setup \
+ file://convert_keystone_backend.py \
"
SRCREV="a96d1a44bc0f074729c312e5c2a0f0875edf1765"
@@ -73,14 +75,6 @@ do_install_append() {
sed -e "s/%SERVICE_TENANT_NAME%/${SERVICE_TENANT_NAME}/g" -i ${D}${sysconfdir}/init.d/keystone
if ${@base_contains('DISTRO_FEATURES', 'OpenLDAP', 'true', 'false', d)}; then
- sed -i -e '/^\[identity\]/a \
-# Uncomment the following lines to enable the hybrid backend \
-# driver = keystone.identity.backends.hybrid_identity.Identity \
-#\
-# [assignment] \
-# driver = keystone.assignment.backends.hybrid_assignment.Assignment \
-' ${D}/etc/keystone/keystone.conf
-
sed -i -e '/^\[ldap\]/a \
url = ldap://localhost \
user = cn=Manager,${LDAP_DN} \
@@ -111,6 +105,9 @@ role_id_attribute = cn \
role_name_attribute = ou \
role_tree_dn = ou=Roles,${LDAP_DN} \
' ${D}/etc/keystone/keystone.conf
+
+ install -m 0755 ${WORKDIR}/hybrid-backend-setup ${D}${sysconfdir}/keystone/hybrid-backend-setup
+ install -m 0755 ${WORKDIR}/convert_keystone_backend.py ${D}${sysconfdir}/keystone/convert_keystone_backend.py
fi
}