diff options
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 00000000..eebd59d9 --- /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 00000000..d3f7eac2 --- /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 6524fed3..8953da8c 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 dfeeb1fc..43b2e33e 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 } |