diff options
Diffstat (limited to 'meta-openstack/recipes-devtools/python/python-keystone')
3 files changed, 50 insertions, 1 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 |
