summaryrefslogtreecommitdiffstats
path: root/meta-openstack/recipes-devtools/python/python-keystone/convert_keystone_backend.py
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-31 15:15:31 -0400
commit5cad5c174a84d5e56b412c50551441b50ff93a76 (patch)
tree6a8c0131a64e6cd444ed7915a7ed1ec39889622a /meta-openstack/recipes-devtools/python/python-keystone/convert_keystone_backend.py
parentd8d277a739125808a24826df541a974aa42ffa1a (diff)
downloadmeta-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>
Diffstat (limited to 'meta-openstack/recipes-devtools/python/python-keystone/convert_keystone_backend.py')
-rwxr-xr-xmeta-openstack/recipes-devtools/python/python-keystone/convert_keystone_backend.py43
1 files changed, 43 insertions, 0 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
3import sys
4import ConfigParser
5import shutil
6
7path = "/etc/keystone/keystone.conf"
8
9if len(sys.argv) != 2:
10 sys.stderr.write("Usage: "+sys.argv[0]+" [sql|hybrid]\n")
11 sys.exit(1)
12
13backend = sys.argv[1]
14if backend == "hybrid":
15 identity_backend = 'keystone.identity.backends.hybrid_identity.Identity'
16 assignment_backend = 'keystone.assignment.backends.hybrid_assignment.Assignment'
17elif backend == "sql":
18 identity_backend = 'keystone.identity.backends.sql.Identity'
19 assignment_backend = 'keystone.assignment.backends.sql.Assignment'
20else:
21 sys.stderr.write("Usage: "+sys.argv[0]+" [sql|hybrid]\n")
22 sys.exit(1)
23
24shutil.copyfile(path, path + ".bak")
25
26cfg = ConfigParser.ConfigParser()
27c = cfg.read(path)
28
29if not cfg.has_section("identity"):
30 cfg.add_section("identity")
31
32cfg.set("identity", "driver", identity_backend)
33
34if not cfg.has_section("assignment"):
35 cfg.add_section("assignment")
36
37cfg.set("assignment", "driver", assignment_backend)
38
39fp = open(path, "w")
40cfg.write(fp)
41fp.close()
42
43exit(0)