Merge "Support --os-key option"
This commit is contained in:
commit
a4109cc3bf
cinderclient
releasenotes/notes
@ -802,6 +802,9 @@ class OpenStackCinderShell(object):
|
|||||||
# first create a Keystone session
|
# first create a Keystone session
|
||||||
cacert = self.options.os_cacert or None
|
cacert = self.options.os_cacert or None
|
||||||
cert = self.options.os_cert or None
|
cert = self.options.os_cert or None
|
||||||
|
if cert and self.options.os_key:
|
||||||
|
cert = cert, self.options.os_key
|
||||||
|
|
||||||
insecure = self.options.insecure or False
|
insecure = self.options.insecure or False
|
||||||
|
|
||||||
if insecure:
|
if insecure:
|
||||||
|
@ -214,6 +214,29 @@ class ShellTest(utils.TestCase):
|
|||||||
|
|
||||||
self.assertEqual(False, _shell.cs.client.verify_cert)
|
self.assertEqual(False, _shell.cs.client.verify_cert)
|
||||||
|
|
||||||
|
@mock.patch('keystoneclient.session.Session.__init__',
|
||||||
|
side_effect=RuntimeError())
|
||||||
|
def test_http_client_with_cert(self, mock_session):
|
||||||
|
_shell = shell.OpenStackCinderShell()
|
||||||
|
|
||||||
|
# We crash the command after Session instantiation because this test
|
||||||
|
# focuses only on arguments provided to Session.__init__
|
||||||
|
args = '--os-cert', 'minnie', 'list'
|
||||||
|
self.assertRaises(RuntimeError, _shell.main, args)
|
||||||
|
mock_session.assert_called_once_with(cert='minnie', verify=mock.ANY)
|
||||||
|
|
||||||
|
@mock.patch('keystoneclient.session.Session.__init__',
|
||||||
|
side_effect=RuntimeError())
|
||||||
|
def test_http_client_with_cert_and_key(self, mock_session):
|
||||||
|
_shell = shell.OpenStackCinderShell()
|
||||||
|
|
||||||
|
# We crash the command after Session instantiation because this test
|
||||||
|
# focuses only on arguments provided to Session.__init__
|
||||||
|
args = '--os-cert', 'minnie', '--os-key', 'mickey', 'list'
|
||||||
|
self.assertRaises(RuntimeError, _shell.main, args)
|
||||||
|
mock_session.assert_called_once_with(cert=('minnie', 'mickey'),
|
||||||
|
verify=mock.ANY)
|
||||||
|
|
||||||
|
|
||||||
class CinderClientArgumentParserTest(utils.TestCase):
|
class CinderClientArgumentParserTest(utils.TestCase):
|
||||||
|
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
Support --os-key option and OS_KEY environment variable which allows to
|
||||||
|
provide client cert and its private key separately.
|
Loading…
x
Reference in New Issue
Block a user