~ec0/charms/trusty/glance-sync-slave/layer-metadata-fixes

« back to all changes in this revision

Viewing changes to reactive/glance-sync-slave.py

  • Committer: Alvaro Uría
  • Date: 2017-02-22 18:04:08 UTC
  • Revision ID: alvaro.uria@canonical.com-20170222180408-uly9cet83ewmmn2d
added extra params to config.yaml and reactive logic (config-changed not calling @when)

Show diffs side-by-side

added added

removed removed

Lines of Context:
152
152
def configure_custom_novarc():
153
153
    configure_novarc()
154
154
 
 
155
@when('config.changed.master_{password,auth_url,glance_url,region}')
 
156
def configure_master_novarc():
 
157
    context = {}
 
158
    for i in ('master_password', 'master_auth_url',
 
159
              'master_glance_url', 'master_region'):
 
160
        value = hookenv.config(i)
 
161
        if not value:
 
162
            hookenv.status_set('blocked', 'master service credentials '
 
163
                               'missing')
 
164
            return
 
165
        context[i] = value
 
166
 
 
167
    glancesync_novarc_file = os.path.join(config_dir, 'glancesync.novarc')
 
168
 
 
169
    templating.render(source='glancesync.novarc.j2',
 
170
                      target=glancesync_novarc_file,
 
171
                      owner='ubuntu',
 
172
                      perms=0o600,
 
173
                      context=relation)
 
174
    hookenv.status_set('active', 'glancesync.novarc configured')
155
175
 
156
176
@hook('{requires:keystone-admin}-relation-{joined,changed}')
157
177
def configure_relation_novarc(relation=None):