~macgreagoir/charms/trusty/nova-cloud-controller/check-nova-services

« back to all changes in this revision

Viewing changes to hooks/charmhelpers/contrib/openstack/context.py

  • Committer: Mick Gregg
  • Date: 2015-07-03 14:57:16 UTC
  • Revision ID: mick.gregg@canonical.com-20150703145716-4zhpxduzm0e2cy4q
Sync with ~macgreagoir/charm-helpers/check-nova-services

Show diffs side-by-side

added added

removed removed

Lines of Context:
122
122
         of specifying multiple key value pairs within the same string. For
123
123
         example, a string in the format of 'key1=value1, key2=value2' will
124
124
         return a dict of:
125
 
         {'key1': 'value1',
126
 
          'key2': 'value2'}.
 
125
 
 
126
             {'key1': 'value1',
 
127
              'key2': 'value2'}.
127
128
 
128
129
      2. A string in the above format, but supporting a comma-delimited list
129
130
         of values for the same key. For example, a string in the format of
130
131
         'key1=value1, key2=value3,value4,value5' will return a dict of:
131
 
         {'key1', 'value1',
132
 
          'key2', 'value2,value3,value4'}
 
132
 
 
133
             {'key1', 'value1',
 
134
              'key2', 'value2,value3,value4'}
133
135
 
134
136
      3. A string containing a colon character (:) prior to an equal
135
137
         character (=) will be treated as yaml and parsed as such. This can be
136
138
         used to specify more complex key value pairs. For example,
137
139
         a string in the format of 'key1: subkey1=value1, subkey2=value2' will
138
140
         return a dict of:
139
 
         {'key1', 'subkey1=value1, subkey2=value2'}
 
141
 
 
142
             {'key1', 'subkey1=value1, subkey2=value2'}
140
143
 
141
144
    The provided config_flags string may be a list of comma-separated values
142
145
    which themselves may be comma-separated list of values.
240
243
        if self.relation_prefix:
241
244
            password_setting = self.relation_prefix + '_password'
242
245
 
243
 
        for rid in relation_ids('shared-db'):
 
246
        for rid in relation_ids(self.interfaces[0]):
244
247
            for unit in related_units(rid):
245
248
                rdata = relation_get(rid=rid, unit=unit)
246
249
                host = rdata.get('db_host')
459
462
 
460
463
                ctxt['rabbitmq_hosts'] = ','.join(sorted(rabbitmq_hosts))
461
464
 
 
465
        oslo_messaging_flags = conf.get('oslo-messaging-flags', None)
 
466
        if oslo_messaging_flags:
 
467
            ctxt['oslo_messaging_flags'] = config_flags_parser(
 
468
                oslo_messaging_flags)
 
469
 
462
470
        if not context_complete(ctxt):
463
471
            return {}
464
472
 
808
816
 
809
817
        return ovs_ctxt
810
818
 
 
819
    def nuage_ctxt(self):
 
820
        driver = neutron_plugin_attribute(self.plugin, 'driver',
 
821
                                          self.network_manager)
 
822
        config = neutron_plugin_attribute(self.plugin, 'config',
 
823
                                          self.network_manager)
 
824
        nuage_ctxt = {'core_plugin': driver,
 
825
                      'neutron_plugin': 'vsp',
 
826
                      'neutron_security_groups': self.neutron_security_groups,
 
827
                      'local_ip': unit_private_ip(),
 
828
                      'config': config}
 
829
 
 
830
        return nuage_ctxt
 
831
 
811
832
    def nvp_ctxt(self):
812
833
        driver = neutron_plugin_attribute(self.plugin, 'driver',
813
834
                                          self.network_manager)
891
912
            ctxt.update(self.n1kv_ctxt())
892
913
        elif self.plugin == 'Calico':
893
914
            ctxt.update(self.calico_ctxt())
 
915
        elif self.plugin == 'vsp':
 
916
            ctxt.update(self.nuage_ctxt())
894
917
 
895
918
        alchemy_flags = config('neutron-alchemy-flags')
896
919
        if alchemy_flags: