~ionutbalutoiu/charms/trusty/neutron-api/next

« back to all changes in this revision

Viewing changes to hooks/neutron_api_context.py

  • Committer: James Page
  • Date: 2015-09-04 11:03:14 UTC
  • mfrom: (39.7.35 trunk)
  • Revision ID: james.page@ubuntu.com-20150904110314-1iym0vseisumy5d0
[project-calico,r=james-page] Add support for Calico plugin

Show diffs side-by-side

added added

removed removed

Lines of Context:
240
240
        return ctxt
241
241
 
242
242
 
 
243
class EtcdContext(context.OSContextGenerator):
 
244
    interfaces = ['etcd-proxy']
 
245
 
 
246
    def __call__(self):
 
247
        ctxt = {'cluster': ''}
 
248
        cluster_string = ''
 
249
 
 
250
        if not config('neutron-plugin') == 'Calico':
 
251
            return ctxt
 
252
 
 
253
        for rid in relation_ids('etcd-proxy'):
 
254
            for unit in related_units(rid):
 
255
                rdata = relation_get(rid=rid, unit=unit)
 
256
                cluster_string = rdata.get('cluster')
 
257
                if cluster_string:
 
258
                    break
 
259
 
 
260
        ctxt['cluster'] = cluster_string
 
261
 
 
262
        return ctxt
 
263
 
 
264
 
243
265
class NeutronApiSDNContext(context.SubordinateConfigContext):
244
266
    interfaces = 'neutron-plugin-api-subordinate'
245
267