~james-page/charms/trusty/neutron-gateway/lp1531102

« back to all changes in this revision

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

  • Committer: Liam Young
  • Date: 2015-10-20 08:50:45 UTC
  • mfrom: (151.2.4 neutron-gateway)
  • Revision ID: liam.young@canonical.com-20151020085045-4hesf82vqf5s3c7c
Tags: 15.10
[1chb1n, r=gnuoy] wait for workload status before testing; add service and relations to satisfy workload status. enable wily test

Show diffs side-by-side

added added

removed removed

Lines of Context:
952
952
                    'config': config}
953
953
        return ovs_ctxt
954
954
 
 
955
    def midonet_ctxt(self):
 
956
        driver = neutron_plugin_attribute(self.plugin, 'driver',
 
957
                                          self.network_manager)
 
958
        midonet_config = neutron_plugin_attribute(self.plugin, 'config',
 
959
                                                  self.network_manager)
 
960
        mido_ctxt = {'core_plugin': driver,
 
961
                     'neutron_plugin': 'midonet',
 
962
                     'neutron_security_groups': self.neutron_security_groups,
 
963
                     'local_ip': unit_private_ip(),
 
964
                     'config': midonet_config}
 
965
 
 
966
        return mido_ctxt
 
967
 
955
968
    def __call__(self):
956
969
        if self.network_manager not in ['quantum', 'neutron']:
957
970
            return {}
973
986
            ctxt.update(self.nuage_ctxt())
974
987
        elif self.plugin == 'plumgrid':
975
988
            ctxt.update(self.pg_ctxt())
 
989
        elif self.plugin == 'midonet':
 
990
            ctxt.update(self.midonet_ctxt())
976
991
 
977
992
        alchemy_flags = config('neutron-alchemy-flags')
978
993
        if alchemy_flags:
1105
1120
 
1106
1121
        ctxt = {
1107
1122
            ... other context ...
1108
 
            'subordinate_config': {
 
1123
            'subordinate_configuration': {
1109
1124
                'DEFAULT': {
1110
1125
                    'key1': 'value1',
1111
1126
                },
1146
1161
                    try:
1147
1162
                        sub_config = json.loads(sub_config)
1148
1163
                    except:
1149
 
                        log('Could not parse JSON from subordinate_config '
1150
 
                            'setting from %s' % rid, level=ERROR)
 
1164
                        log('Could not parse JSON from '
 
1165
                            'subordinate_configuration setting from %s'
 
1166
                            % rid, level=ERROR)
1151
1167
                        continue
1152
1168
 
1153
1169
                    for service in self.services:
1154
1170
                        if service not in sub_config:
1155
 
                            log('Found subordinate_config on %s but it contained'
1156
 
                                'nothing for %s service' % (rid, service),
1157
 
                                level=INFO)
 
1171
                            log('Found subordinate_configuration on %s but it '
 
1172
                                'contained nothing for %s service'
 
1173
                                % (rid, service), level=INFO)
1158
1174
                            continue
1159
1175
 
1160
1176
                        sub_config = sub_config[service]
1161
1177
                        if self.config_file not in sub_config:
1162
 
                            log('Found subordinate_config on %s but it contained'
1163
 
                                'nothing for %s' % (rid, self.config_file),
1164
 
                                level=INFO)
 
1178
                            log('Found subordinate_configuration on %s but it '
 
1179
                                'contained nothing for %s'
 
1180
                                % (rid, self.config_file), level=INFO)
1165
1181
                            continue
1166
1182
 
1167
1183
                        sub_config = sub_config[self.config_file]