Parse the leader_get output
Because laeder_get only deals with stringy types, it is unsound to evaluate them as booleans to toggle something on or off. Change-Id: I18c3763dce53d1d652185f9fba73523a5c5a65a6 Closes-Bug: #1847769
This commit is contained in:
parent
030189a81d
commit
7e3d74c6b0
@ -105,7 +105,7 @@ class IdentityServiceContext(context.IdentityServiceContext):
|
||||
if config('admin-roles'):
|
||||
ctxt['user_roles'] += (',' + config('admin-roles'))
|
||||
ctxt['cache_size'] = config('cache-size')
|
||||
ctxt['namespace_tenants'] = leader_get('namespace_tenants')
|
||||
ctxt['namespace_tenants'] = leader_get('namespace_tenants') == 'True'
|
||||
if self.context_complete(ctxt):
|
||||
return ctxt
|
||||
return {}
|
||||
|
@ -176,7 +176,7 @@ def install():
|
||||
|
||||
@hooks.hook('upgrade-charm.real')
|
||||
def upgrade_charm():
|
||||
if is_leader() and not leader_get('namespace_tenants'):
|
||||
if is_leader() and not leader_get('namespace_tenants') == 'True':
|
||||
leader_set(namespace_tenants=False)
|
||||
|
||||
|
||||
@ -302,7 +302,7 @@ def identity_joined(relid=None):
|
||||
|
||||
port = config('port')
|
||||
admin_url = '%s:%i/swift' % (canonical_url(CONFIGS, ADMIN), port)
|
||||
if leader_get('namespace_tenants'):
|
||||
if leader_get('namespace_tenants') == 'True':
|
||||
internal_url = '%s:%s/swift/v1/AUTH_$(project_id)s' % \
|
||||
(canonical_url(CONFIGS, INTERNAL), port)
|
||||
public_url = '%s:%s/swift/v1/AUTH_$(project_id)s' % \
|
||||
|
@ -75,7 +75,7 @@ class IdentityServiceContextTest(CharmTestCase):
|
||||
self.config.side_effect = self.test_config.get
|
||||
self.maxDiff = None
|
||||
self.cmp_pkgrevno.return_value = 1
|
||||
self.leader_get.return_value = False
|
||||
self.leader_get.return_value = 'False'
|
||||
|
||||
@patch.object(charmhelpers.contrib.openstack.context,
|
||||
'filter_installed_packages', return_value=['absent-pkg'])
|
||||
@ -167,7 +167,7 @@ class IdentityServiceContextTest(CharmTestCase):
|
||||
_rids.return_value = 'rid1'
|
||||
_runits.return_value = 'runit'
|
||||
_ctxt_comp.return_value = True
|
||||
self.leader_get.return_value = True
|
||||
self.leader_get.return_value = 'True'
|
||||
id_data = {
|
||||
'service_port': 9876,
|
||||
'service_host': '127.0.0.4',
|
||||
|
@ -254,7 +254,7 @@ class CephRadosGWTests(CharmTestCase):
|
||||
@patch('charmhelpers.contrib.openstack.ip.config')
|
||||
def test_identity_joined_early_version(self, _config, _leader_get):
|
||||
self.cmp_pkgrevno.return_value = -1
|
||||
_leader_get.return_value = False
|
||||
_leader_get.return_value = 'False'
|
||||
ceph_hooks.identity_joined()
|
||||
self.sys.exit.assert_called_with(1)
|
||||
|
||||
@ -271,7 +271,7 @@ class CephRadosGWTests(CharmTestCase):
|
||||
_resolve_address.return_value = 'myserv'
|
||||
_config.side_effect = self.test_config.get
|
||||
self.test_config.set('region', 'region1')
|
||||
_leader_get.return_value = False
|
||||
_leader_get.return_value = 'False'
|
||||
ceph_hooks.identity_joined(relid='rid')
|
||||
self.relation_set.assert_called_with(
|
||||
service='swift',
|
||||
@ -306,7 +306,7 @@ class CephRadosGWTests(CharmTestCase):
|
||||
_resolve_address.return_value = 'myserv'
|
||||
_config.side_effect = self.test_config.get
|
||||
self.test_config.set('region', 'region1')
|
||||
_leader_get.return_value = True
|
||||
_leader_get.return_value = 'True'
|
||||
ceph_hooks.identity_joined(relid='rid')
|
||||
self.relation_set.assert_called_with(
|
||||
service='swift',
|
||||
@ -339,7 +339,7 @@ class CephRadosGWTests(CharmTestCase):
|
||||
self.test_config.set('os-public-hostname', 'files.example.com')
|
||||
_unit_get.return_value = 'myserv'
|
||||
_is_clustered.return_value = False
|
||||
_leader_get.return_value = False
|
||||
_leader_get.return_value = 'False'
|
||||
ceph_hooks.identity_joined(relid='rid')
|
||||
self.relation_set.assert_called_with(
|
||||
service='swift',
|
||||
|
Loading…
Reference in New Issue
Block a user