~openstack-charmers/charms/precise/keystone/ha-support

« back to all changes in this revision

Viewing changes to hooks/keystone_hooks.py

  • Committer: Adam Gandelman
  • Date: 2013-04-09 16:42:43 UTC
  • mfrom: (62.2.8 keystone_charm)
  • Revision ID: adamg@canonical.com-20130409164243-2o7hv99uak9rf88v
Merge association of requested_role /w service_user from Yolanda.

Show diffs side-by-side

added added

removed removed

Lines of Context:
211
211
    settings = utils.relation_get_dict(relation_id=relation_id,
212
212
                                       remote_unit=remote_unit)
213
213
 
214
 
    # Allow the remote service to request creation of any additional roles.
215
 
    # Currently used by Swift.
216
 
    if 'requested_roles' in settings and settings['requested_roles'] != 'None':
217
 
        roles = settings['requested_roles'].split(',')
218
 
        utils.juju_log('INFO',
219
 
                       "Creating requested roles: %s" % roles)
220
 
        for role in roles:
221
 
            create_role(role, user=config['admin-user'], tenant='admin')
222
 
 
223
214
    # the minimum settings needed per endpoint
224
215
    single = set(['service', 'region', 'public_url', 'admin_url',
225
216
                  'internal_url'])
315
306
    grant_role(service_username, config['admin-role'],
316
307
               config['service-tenant'])
317
308
 
 
309
    # Allow the remote service to request creation of any additional roles.
 
310
    # Currently used by Swift and Ceilometer.
 
311
    if 'requested_roles' in settings and settings['requested_roles'] != 'None':
 
312
        roles = settings['requested_roles'].split(',')
 
313
        utils.juju_log('INFO',
 
314
                       "Creating requested roles: %s" % roles)
 
315
        for role in roles:
 
316
            create_role(role, service_username, config['service-tenant'])
 
317
            grant_role(service_username, role, config['service-tenant'])
 
318
 
318
319
    # As of https://review.openstack.org/#change,4675, all nodes hosting
319
320
    # an endpoint(s) needs a service username and password assigned to
320
321
    # the service tenant and granted admin role.