~openstack-charmers-archive/charms/trusty/glance/next

« back to all changes in this revision

Viewing changes to hooks/glance_relations.py

  • Committer: David Ames
  • Date: 2015-11-02 18:10:22 UTC
  • mfrom: (151.1.1 glance)
  • Revision ID: david.ames@canonical.com-20151102181022-x6fd5nlhbuyh9b37
[ionutbalutoiu, r=thedac] Adds additional variables to the image-service relation. These are available only when a relation with Swift object storage is present.
In case any charm needs to generate temporary URLs from Glance with Swift backend, it needs a temp-url-key which must be posted to Swift with the glance account. (Details: http://docs.openstack.org/liberty/config-reference/content/object-storage-tempurl.html)
This is needed for OpenStack Ironic charm (http://bazaar.launchpad.net/~cloudbaseit/charms/trusty/ironic/trunk/view/head:/hooks/ironic_context.py#L76), but might also be generally useful.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
    setup_ipv6,
27
27
    REQUIRED_INTERFACES,
28
28
    check_optional_relations,
 
29
    swift_temp_url_key
29
30
)
30
31
from charmhelpers.core.hookenv import (
31
32
    config,
222
223
    juju_log("%s: image-service_joined: To peer glance-api-server=%s" %
223
224
             (CHARM, relation_data['glance-api-server']))
224
225
 
 
226
    if ('object-store' in CONFIGS.complete_contexts() and
 
227
       'identity-service' in CONFIGS.complete_contexts()):
 
228
        relation_data.update({
 
229
            'swift-temp-url-key': swift_temp_url_key(),
 
230
            'swift-container': 'glance'
 
231
        })
 
232
 
225
233
    relation_set(relation_id=relation_id, **relation_data)
226
234
 
227
235
 
238
246
        juju_log('swift relation incomplete')
239
247
        return
240
248
 
 
249
    [image_service_joined(rid) for rid in relation_ids('image-service')]
 
250
 
241
251
    CONFIGS.write(GLANCE_API_CONF)
242
252
 
243
253