BigSwitch: Fix cfg.Error format in exception
Fixes an incorrectly formatted call to cfg.Error in an exception handling routine in the Big Switch server manager module. Closes-Bug: #1289134 Change-Id: I9a1137d7395412ff6f061aacbe85f9b26269a1da
This commit is contained in:
parent
6d5de6cba8
commit
546f7719b0
@ -356,8 +356,8 @@ class ServerPool(object):
|
||||
except Exception as e:
|
||||
raise cfg.Error(_('Could not retrieve initial '
|
||||
'certificate from controller %(server)s. '
|
||||
'Error details: %(error)s'),
|
||||
{'server': server, 'error': e.strerror})
|
||||
'Error details: %(error)s') %
|
||||
{'server': server, 'error': str(e)})
|
||||
|
||||
LOG.warning(_("Storing to certificate for host %(server)s "
|
||||
"at %(path)s") % {'server': server,
|
||||
|
@ -14,8 +14,10 @@
|
||||
#
|
||||
# @author: Kevin Benton, kevin.benton@bigswitch.com
|
||||
#
|
||||
import mock
|
||||
from oslo.config import cfg
|
||||
|
||||
from neutron.manager import NeutronManager
|
||||
from neutron.plugins.bigswitch import servermanager
|
||||
from neutron.tests.unit.bigswitch import test_restproxy_plugin as test_rp
|
||||
|
||||
@ -29,3 +31,17 @@ class ServerManagerTests(test_rp.BigSwitchProxyPluginV2TestCase):
|
||||
def test_malformed_servers(self):
|
||||
cfg.CONF.set_override('servers', ['a:b:c'], 'RESTPROXY')
|
||||
self.assertRaises(cfg.Error, servermanager.ServerPool)
|
||||
|
||||
def test_sticky_cert_fetch_fail(self):
|
||||
pl = NeutronManager.get_plugin()
|
||||
pl.servers.ssl = True
|
||||
with mock.patch(
|
||||
'ssl.get_server_certificate',
|
||||
side_effect=Exception('There is no more entropy in the universe')
|
||||
) as sslgetmock:
|
||||
self.assertRaises(
|
||||
cfg.Error,
|
||||
pl.servers._get_combined_cert_for_server,
|
||||
*('example.org', 443)
|
||||
)
|
||||
sslgetmock.assert_has_calls([mock.call(('example.org', 443))])
|
||||
|
Loading…
x
Reference in New Issue
Block a user