Resync helpers, tidy lint
This commit is contained in:
parent
aa89fb1539
commit
fecd775e8a
@ -25,6 +25,7 @@ from charmhelpers.core.hookenv import (
|
|||||||
unit_get,
|
unit_get,
|
||||||
unit_private_ip,
|
unit_private_ip,
|
||||||
ERROR,
|
ERROR,
|
||||||
|
INFO
|
||||||
)
|
)
|
||||||
|
|
||||||
from charmhelpers.contrib.hahelpers.cluster import (
|
from charmhelpers.contrib.hahelpers.cluster import (
|
||||||
@ -714,7 +715,7 @@ class SubordinateConfigContext(OSContextGenerator):
|
|||||||
self.interface = interface
|
self.interface = interface
|
||||||
|
|
||||||
def __call__(self):
|
def __call__(self):
|
||||||
ctxt = {}
|
ctxt = {'sections': {}}
|
||||||
for rid in relation_ids(self.interface):
|
for rid in relation_ids(self.interface):
|
||||||
for unit in related_units(rid):
|
for unit in related_units(rid):
|
||||||
sub_config = relation_get('subordinate_configuration',
|
sub_config = relation_get('subordinate_configuration',
|
||||||
@ -740,10 +741,14 @@ class SubordinateConfigContext(OSContextGenerator):
|
|||||||
|
|
||||||
sub_config = sub_config[self.config_file]
|
sub_config = sub_config[self.config_file]
|
||||||
for k, v in sub_config.iteritems():
|
for k, v in sub_config.iteritems():
|
||||||
ctxt[k] = v
|
if k == 'sections':
|
||||||
|
for section, config_dict in v.iteritems():
|
||||||
|
log("adding section '%s'" % (section))
|
||||||
|
ctxt[k][section] = config_dict
|
||||||
|
else:
|
||||||
|
ctxt[k] = v
|
||||||
|
|
||||||
if not ctxt:
|
log("%d section(s) found" % (len(ctxt['sections'])), level=INFO)
|
||||||
ctxt['sections'] = {}
|
|
||||||
|
|
||||||
return ctxt
|
return ctxt
|
||||||
|
|
||||||
|
@ -78,5 +78,6 @@ class ApacheSSLContext(SSLContext):
|
|||||||
|
|
||||||
|
|
||||||
class LoggingConfigContext(OSContextGenerator):
|
class LoggingConfigContext(OSContextGenerator):
|
||||||
|
|
||||||
def __call__(self):
|
def __call__(self):
|
||||||
return {'debug': config('debug'), 'verbose': config('verbose')}
|
return {'debug': config('debug'), 'verbose': config('verbose')}
|
||||||
|
@ -81,7 +81,7 @@ def install_hook():
|
|||||||
execd_preinstall()
|
execd_preinstall()
|
||||||
src = config('openstack-origin')
|
src = config('openstack-origin')
|
||||||
if (lsb_release()['DISTRIB_CODENAME'] == 'precise' and
|
if (lsb_release()['DISTRIB_CODENAME'] == 'precise' and
|
||||||
src == 'distro'):
|
src == 'distro'):
|
||||||
src = 'cloud:precise-folsom'
|
src = 'cloud:precise-folsom'
|
||||||
|
|
||||||
configure_installation_source(src)
|
configure_installation_source(src)
|
||||||
@ -243,7 +243,7 @@ def keystone_joined(relation_id=None):
|
|||||||
'public_url': public_url,
|
'public_url': public_url,
|
||||||
'admin_url': admin_url,
|
'admin_url': admin_url,
|
||||||
'internal_url': internal_url, }
|
'internal_url': internal_url, }
|
||||||
|
|
||||||
relation_set(relation_id=relation_id, **relation_data)
|
relation_set(relation_id=relation_id, **relation_data)
|
||||||
|
|
||||||
|
|
||||||
@ -313,7 +313,7 @@ def upgrade_charm():
|
|||||||
@hooks.hook('ha-relation-joined')
|
@hooks.hook('ha-relation-joined')
|
||||||
def ha_relation_joined():
|
def ha_relation_joined():
|
||||||
config = get_hacluster_config()
|
config = get_hacluster_config()
|
||||||
|
|
||||||
resources = {
|
resources = {
|
||||||
'res_glance_haproxy': 'lsb:haproxy'
|
'res_glance_haproxy': 'lsb:haproxy'
|
||||||
}
|
}
|
||||||
@ -329,10 +329,10 @@ def ha_relation_joined():
|
|||||||
vip_key = 'res_glance_{}_vip'.format(iface)
|
vip_key = 'res_glance_{}_vip'.format(iface)
|
||||||
resources[vip_key] = 'ocf:heartbeat:IPaddr2'
|
resources[vip_key] = 'ocf:heartbeat:IPaddr2'
|
||||||
resource_params[vip_key] = (
|
resource_params[vip_key] = (
|
||||||
'params ip="{vip}" cidr_netmask="{netmask}"'
|
'params ip="{vip}" cidr_netmask="{netmask}"'
|
||||||
' nic="{iface}"'.format(vip=vip,
|
' nic="{iface}"'.format(vip=vip,
|
||||||
iface=iface,
|
iface=iface,
|
||||||
netmask=get_netmask_for_address(vip))
|
netmask=get_netmask_for_address(vip))
|
||||||
)
|
)
|
||||||
vip_group.append(vip_key)
|
vip_group.append(vip_key)
|
||||||
|
|
||||||
|
@ -454,7 +454,7 @@ class GlanceRelationTests(CharmTestCase):
|
|||||||
'res_glance_haproxy': 'lsb:haproxy'},
|
'res_glance_haproxy': 'lsb:haproxy'},
|
||||||
'resource_params': {
|
'resource_params': {
|
||||||
'res_glance_eth1_vip': 'params ip="10.10.10.10"'
|
'res_glance_eth1_vip': 'params ip="10.10.10.10"'
|
||||||
' cidr_netmask="255.255.0.0" nic="eth1"',
|
' cidr_netmask="255.255.0.0" nic="eth1"',
|
||||||
'res_glance_haproxy': 'op monitor interval="5s"'},
|
'res_glance_haproxy': 'op monitor interval="5s"'},
|
||||||
'clones': {'cl_glance_haproxy': 'res_glance_haproxy'}
|
'clones': {'cl_glance_haproxy': 'res_glance_haproxy'}
|
||||||
}
|
}
|
||||||
|
@ -80,9 +80,9 @@ class TestConfig(object):
|
|||||||
return self.config
|
return self.config
|
||||||
|
|
||||||
def set(self, attr, value):
|
def set(self, attr, value):
|
||||||
if attr not in self.config:
|
if attr not in self.config:
|
||||||
raise KeyError
|
raise KeyError
|
||||||
self.config[attr] = value
|
self.config[attr] = value
|
||||||
|
|
||||||
|
|
||||||
class TestRelation(object):
|
class TestRelation(object):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user