Merge hloeung's admin relation code into current trunk.

This is meant to fix up https://code.launchpad.net/~hloeung/charms/precise/keystone/add-admin-relation/+merge/212759 to work with the current trusty/icehouse version of the charm.
This commit is contained in:
Nick Moffitt 2014-05-06 14:13:30 +01:00
commit 71cb3d9285
6 changed files with 27 additions and 1 deletions

1
.bzrignore Normal file
View File

@ -0,0 +1 @@
revision

View File

@ -0,0 +1 @@
keystone_hooks.py

View File

@ -0,0 +1 @@
keystone_hooks.py

View File

@ -51,6 +51,7 @@ from keystone_utils import (
CLUSTER_RES,
KEYSTONE_CONF,
SSH_USER,
stored_passwd,
)
from charmhelpers.contrib.hahelpers.cluster import (
@ -242,6 +243,27 @@ def ha_changed():
service_host=config('vip'))
@hooks.hook('identity-admin-relation-joined')
def admin_relation_joined():
""" Do nothing until we get information about requested service """
pass
@hooks.hook('identity-admin-relation-changed')
def admin_relation_changed():
relation_data = {
'service_hostname': config('hostname'),
'service_port': config('service-port'),
'service_username': config('admin-user'),
'service_tenant_name': config('admin-role'),
'service_region': config('region'),
}
if os.path.isfile(stored_passwd):
with open(stored_passwd) as f:
relation_data['service_password'] = f.readline().strip('\n')
relation_set(**relation_data)
def configure_https():
'''
Enables SSL API Apache config if appropriate and kicks identity-service

View File

@ -9,6 +9,8 @@ categories: ["misc"]
provides:
identity-service:
interface: keystone
identity-admin:
interface: keystone-admin
requires:
shared-db:
interface: mysql-shared

View File

@ -1 +0,0 @@
230