Pass insecure option to HTTPClient
This option was silently being ignored. Closes-Bug: #1538648 Change-Id: I3a1b5268e87cbc9803924be95b374d76b72a3a5d
This commit is contained in:
@@ -628,6 +628,8 @@ class OpenStackCinderShell(object):
|
||||
if not auth_plugin:
|
||||
auth_session = self._get_keystone_session()
|
||||
|
||||
insecure = self.options.insecure
|
||||
|
||||
self.cs = client.Client(options.os_volume_api_version, os_username,
|
||||
os_password, os_tenant_name, os_auth_url,
|
||||
region_name=os_region_name,
|
||||
@@ -640,6 +642,7 @@ class OpenStackCinderShell(object):
|
||||
bypass_url=bypass_url,
|
||||
retries=options.retries,
|
||||
http_log_debug=args.debug,
|
||||
insecure=insecure,
|
||||
cacert=cacert, auth_system=os_auth_system,
|
||||
auth_plugin=auth_plugin,
|
||||
session=auth_session)
|
||||
|
@@ -23,6 +23,7 @@ import requests
|
||||
from six import moves
|
||||
from testtools import matchers
|
||||
|
||||
import cinderclient
|
||||
from cinderclient import exceptions
|
||||
from cinderclient import auth_plugin
|
||||
from cinderclient import shell
|
||||
@@ -198,6 +199,21 @@ class ShellTest(utils.TestCase):
|
||||
allow_redirects=True,
|
||||
**self.TEST_REQUEST_BASE)
|
||||
|
||||
@mock.patch.object(cinderclient.client.HTTPClient, 'authenticate',
|
||||
side_effect=exceptions.Unauthorized('No'))
|
||||
# Easiest way to make cinderclient use httpclient is a None session
|
||||
@mock.patch.object(cinderclient.shell.OpenStackCinderShell,
|
||||
'_get_keystone_session', return_value=None)
|
||||
def test_http_client_insecure(self, mock_authenticate, mock_session):
|
||||
self.make_env(include={'CINDERCLIENT_INSECURE': True})
|
||||
|
||||
_shell = shell.OpenStackCinderShell()
|
||||
|
||||
# This "fails" but instantiates the client.
|
||||
self.assertRaises(exceptions.CommandError, _shell.main, ['list'])
|
||||
|
||||
self.assertEqual(False, _shell.cs.client.verify_cert)
|
||||
|
||||
|
||||
class CinderClientArgumentParserTest(utils.TestCase):
|
||||
|
||||
|
Reference in New Issue
Block a user