diff options
author | Amy Fong <amy.fong@windriver.com> | 2014-07-23 12:21:00 -0400 |
---|---|---|
committer | Bruce Ashfield <bruce.ashfield@windriver.com> | 2014-07-31 15:15:31 -0400 |
commit | 5cad5c174a84d5e56b412c50551441b50ff93a76 (patch) | |
tree | 6a8c0131a64e6cd444ed7915a7ed1ec39889622a | |
parent | d8d277a739125808a24826df541a974aa42ffa1a (diff) | |
download | meta-cloud-services-5cad5c174a84d5e56b412c50551441b50ff93a76.tar.gz |
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>
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 @@ | |||
1 | #!/usr/bin/python | ||
2 | |||
3 | import sys | ||
4 | import ConfigParser | ||
5 | import shutil | ||
6 | |||
7 | path = "/etc/keystone/keystone.conf" | ||
8 | |||
9 | if len(sys.argv) != 2: | ||
10 | sys.stderr.write("Usage: "+sys.argv[0]+" [sql|hybrid]\n") | ||
11 | sys.exit(1) | ||
12 | |||
13 | backend = sys.argv[1] | ||
14 | if backend == "hybrid": | ||
15 | identity_backend = 'keystone.identity.backends.hybrid_identity.Identity' | ||
16 | assignment_backend = 'keystone.assignment.backends.hybrid_assignment.Assignment' | ||
17 | elif backend == "sql": | ||
18 | identity_backend = 'keystone.identity.backends.sql.Identity' | ||
19 | assignment_backend = 'keystone.assignment.backends.sql.Assignment' | ||
20 | else: | ||
21 | sys.stderr.write("Usage: "+sys.argv[0]+" [sql|hybrid]\n") | ||
22 | sys.exit(1) | ||
23 | |||
24 | shutil.copyfile(path, path + ".bak") | ||
25 | |||
26 | cfg = ConfigParser.ConfigParser() | ||
27 | c = cfg.read(path) | ||
28 | |||
29 | if not cfg.has_section("identity"): | ||
30 | cfg.add_section("identity") | ||
31 | |||
32 | cfg.set("identity", "driver", identity_backend) | ||
33 | |||
34 | if not cfg.has_section("assignment"): | ||
35 | cfg.add_section("assignment") | ||
36 | |||
37 | cfg.set("assignment", "driver", assignment_backend) | ||
38 | |||
39 | fp = open(path, "w") | ||
40 | cfg.write(fp) | ||
41 | fp.close() | ||
42 | |||
43 | 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 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | /etc/keystone/convert_keystone_backend.py hybrid | ||
4 | |||
5 | /etc/init.d/openldap start | ||
6 | /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() | |||
98 | ADMIN_PASSWORD=%ADMIN_PASSWORD% \ | 98 | ADMIN_PASSWORD=%ADMIN_PASSWORD% \ |
99 | SERVICE_PASSWORD=%SERVICE_PASSWORD% \ | 99 | SERVICE_PASSWORD=%SERVICE_PASSWORD% \ |
100 | SERVICE_TENANT_NAME=%SERVICE_TENANT_NAME% \ | 100 | SERVICE_TENANT_NAME=%SERVICE_TENANT_NAME% \ |
101 | bash /etc/keystone/identity.sh | 101 | bash /etc/keystone/service-user-setup |
102 | } | 102 | } |
103 | 103 | ||
104 | case "$1" in | 104 | 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 be511e2..96ce440 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" | |||
4 | LICENSE = "Apache-2.0" | 4 | LICENSE = "Apache-2.0" |
5 | LIC_FILES_CHKSUM = "file://LICENSE;md5=1dece7821bf3fd70fe1309eaa37d52a2" | 5 | LIC_FILES_CHKSUM = "file://LICENSE;md5=1dece7821bf3fd70fe1309eaa37d52a2" |
6 | 6 | ||
7 | PR = "r1" | 7 | PR = "r2" |
8 | SRCNAME = "keystone" | 8 | SRCNAME = "keystone" |
9 | 9 | ||
10 | SRC_URI = "git://github.com/openstack/${SRCNAME}.git;branch=stable/havana \ | 10 | 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 \ | |||
15 | file://keystone-search-in-etc-directory-for-config-files.patch \ | 15 | file://keystone-search-in-etc-directory-for-config-files.patch \ |
16 | file://keystone-fix-location-of-files-for-tests.patch \ | 16 | file://keystone-fix-location-of-files-for-tests.patch \ |
17 | file://keystone-remove-git-commands-in-tests.patch \ | 17 | file://keystone-remove-git-commands-in-tests.patch \ |
18 | file://hybrid-backend-setup \ | ||
19 | file://convert_keystone_backend.py \ | ||
18 | " | 20 | " |
19 | 21 | ||
20 | SRCREV="e7c29874e5a0e43f4f0e9970556c701af508152f" | 22 | SRCREV="e7c29874e5a0e43f4f0e9970556c701af508152f" |
@@ -73,14 +75,6 @@ do_install_append() { | |||
73 | sed -e "s/%SERVICE_TENANT_NAME%/${SERVICE_TENANT_NAME}/g" -i ${D}${sysconfdir}/init.d/keystone | 75 | sed -e "s/%SERVICE_TENANT_NAME%/${SERVICE_TENANT_NAME}/g" -i ${D}${sysconfdir}/init.d/keystone |
74 | 76 | ||
75 | if ${@base_contains('DISTRO_FEATURES', 'OpenLDAP', 'true', 'false', d)}; then | 77 | if ${@base_contains('DISTRO_FEATURES', 'OpenLDAP', 'true', 'false', d)}; then |
76 | sed -i -e '/^\[identity\]/a \ | ||
77 | # Uncomment the following lines to enable the hybrid backend \ | ||
78 | # driver = keystone.identity.backends.hybrid_identity.Identity \ | ||
79 | #\ | ||
80 | # [assignment] \ | ||
81 | # driver = keystone.assignment.backends.hybrid_assignment.Assignment \ | ||
82 | ' ${D}/etc/keystone/keystone.conf | ||
83 | |||
84 | sed -i -e '/^\[ldap\]/a \ | 78 | sed -i -e '/^\[ldap\]/a \ |
85 | url = ldap://localhost \ | 79 | url = ldap://localhost \ |
86 | user = cn=Manager,${LDAP_DN} \ | 80 | user = cn=Manager,${LDAP_DN} \ |
@@ -111,6 +105,9 @@ role_id_attribute = cn \ | |||
111 | role_name_attribute = ou \ | 105 | role_name_attribute = ou \ |
112 | role_tree_dn = ou=Roles,${LDAP_DN} \ | 106 | role_tree_dn = ou=Roles,${LDAP_DN} \ |
113 | ' ${D}/etc/keystone/keystone.conf | 107 | ' ${D}/etc/keystone/keystone.conf |
108 | |||
109 | install -m 0755 ${WORKDIR}/hybrid-backend-setup ${D}${sysconfdir}/keystone/hybrid-backend-setup | ||
110 | install -m 0755 ${WORKDIR}/convert_keystone_backend.py ${D}${sysconfdir}/keystone/convert_keystone_backend.py | ||
114 | fi | 111 | fi |
115 | } | 112 | } |
116 | 113 | ||