Sync helpers.
This commit is contained in:
parent
a6b2e18f33
commit
0d668bc455
|
@ -97,12 +97,14 @@ def https():
|
|||
return True
|
||||
for r_id in relation_ids('identity-service'):
|
||||
for unit in relation_list(r_id):
|
||||
if None not in [
|
||||
rel_state = [
|
||||
relation_get('https_keystone', rid=r_id, unit=unit),
|
||||
relation_get('ssl_cert', rid=r_id, unit=unit),
|
||||
relation_get('ssl_key', rid=r_id, unit=unit),
|
||||
relation_get('ca_cert', rid=r_id, unit=unit),
|
||||
]:
|
||||
]
|
||||
# NOTE: works around (LP: #1203241)
|
||||
if (None not in rel_state) and ('' not in rel_state):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ from charmhelpers.core.hookenv import (
|
|||
related_units,
|
||||
unit_get,
|
||||
unit_private_ip,
|
||||
WARNING,
|
||||
)
|
||||
|
||||
from charmhelpers.contrib.hahelpers.cluster import (
|
||||
|
@ -354,34 +355,15 @@ class NeutronContext(object):
|
|||
|
||||
def ovs_ctxt(self):
|
||||
driver = neutron_plugin_attribute(self.plugin, 'driver',
|
||||
self.network_manager),
|
||||
self.network_manager)
|
||||
|
||||
ovs_ctxt = {
|
||||
'neutron_plugin': 'ovs',
|
||||
# quantum.conf
|
||||
'core_plugin': driver,
|
||||
# NOTE: network api class in template for each release.
|
||||
# nova.conf
|
||||
#'libvirt_vif_driver': n_driver,
|
||||
#'libvirt_use_virtio_for_bridges': True,
|
||||
# ovs config
|
||||
'neutron_plugin': 'ovs',
|
||||
'neutron_security_groups': self.neutron_security_groups,
|
||||
'local_ip': unit_private_ip(),
|
||||
}
|
||||
|
||||
if self.neutron_security_groups:
|
||||
ovs_ctxt['neutron_security_groups'] = True
|
||||
|
||||
fw_driver = ('%s.agent.linux.iptables_firewall.'
|
||||
'OVSHybridIptablesFirewallDriver' %
|
||||
self.network_manager)
|
||||
|
||||
ovs_ctxt.update({
|
||||
# IN TEMPLATE:
|
||||
# - security_group_api=quantum in nova.conf for >= g
|
||||
# nova_firewall_driver=nova.virt.firewall.NoopFirewallDriver'
|
||||
'neutron_firewall_driver': fw_driver,
|
||||
})
|
||||
|
||||
return ovs_ctxt
|
||||
|
||||
def __call__(self):
|
||||
|
@ -401,3 +383,25 @@ class NeutronContext(object):
|
|||
|
||||
self._save_flag_file()
|
||||
return ctxt
|
||||
|
||||
|
||||
class OSConfigFlagContext(OSContextGenerator):
|
||||
'''
|
||||
Responsible adding user-defined config-flags in charm config to a
|
||||
to a template context.
|
||||
'''
|
||||
def __call__(self):
|
||||
config_flags = config('config-flags')
|
||||
if not config_flags:
|
||||
return {}
|
||||
config_flags = config_flags.split(',')
|
||||
flags = {}
|
||||
for flag in config_flags:
|
||||
if '=' not in flag:
|
||||
log('Improperly formatted config-flag, expected k=v '
|
||||
' got %s' % flag, level=WARNING)
|
||||
continue
|
||||
k, v = flag.split('=')
|
||||
flags[k.strip()] = v
|
||||
ctxt = {'user_config_flags': flags}
|
||||
return ctxt
|
||||
|
|
|
@ -19,7 +19,6 @@ def quantum_plugins():
|
|||
'driver': 'quantum.plugins.openvswitch.ovs_quantum_plugin.'
|
||||
'OVSQuantumPluginV2',
|
||||
'contexts': [
|
||||
context.NeutronContext(),
|
||||
context.SharedDBContext(user=config('neutron-database-user'),
|
||||
database=config('neutron-database'),
|
||||
relation_prefix='neutron')],
|
||||
|
|
Loading…
Reference in New Issue