Skip to content

Commit

Permalink
Add a missing command line option: --insecure
Browse files Browse the repository at this point in the history
This option allows to disable SSL certificates validation in HTTPClient.

Fixes bug 1153715

Change-Id: I2c5123c3b8482a932fa401c56827f1fffe9fa381
  • Loading branch information
Roman Podolyaka committed Mar 13, 2013
1 parent f96219d commit a13a87c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
7 changes: 5 additions & 2 deletions quantumclient/common/clientmanager.py
Expand Up @@ -54,7 +54,8 @@ def __init__(self, token=None, url=None,
username=None, password=None,
region_name=None,
api_version=None,
auth_strategy=None
auth_strategy=None,
insecure=False
):
self._token = token
self._url = url
Expand All @@ -67,6 +68,7 @@ def __init__(self, token=None, url=None,
self._api_version = api_version
self._service_catalog = None
self._auth_strategy = auth_strategy
self._insecure = insecure
return

def initialize(self):
Expand All @@ -75,7 +77,8 @@ def initialize(self):
tenant_name=self._tenant_name,
password=self._password,
region_name=self._region_name,
auth_url=self._auth_url)
auth_url=self._auth_url,
insecure=self._insecure)
httpclient.authenticate()
# Populate other password flow attributes
self._token = httpclient.auth_token
Expand Down
3 changes: 2 additions & 1 deletion quantumclient/quantum/client.py
Expand Up @@ -44,7 +44,8 @@ def make_client(instance):
auth_url=instance._auth_url,
endpoint_url=url,
token=instance._token,
auth_strategy=instance._auth_strategy)
auth_strategy=instance._auth_strategy,
insecure=instance._insecure)
return client
else:
raise exceptions.UnsupportedVersion("API version %s is not supported" %
Expand Down
12 changes: 11 additions & 1 deletion quantumclient/shell.py
Expand Up @@ -412,6 +412,15 @@ def build_option_parser(self, description, version):
'--os_url',
help=argparse.SUPPRESS)

parser.add_argument(
'--insecure',
action='store_true',
default=env('QUANTUMCLIENT_INSECURE', default=False),
help="Explicitly allow quantumclient to perform \"insecure\" "
"SSL (https) requests. The server's certificate will "
"not be verified against any certificate authorities. "
"This option should be used with caution.")

return parser

def _bash_completion(self):
Expand Down Expand Up @@ -572,7 +581,8 @@ def authenticate_user(self):
password=self.options.os_password,
region_name=self.options.os_region_name,
api_version=self.api_version,
auth_strategy=self.options.os_auth_strategy, )
auth_strategy=self.options.os_auth_strategy,
insecure=self.options.insecure, )
return

def initialize_app(self, argv):
Expand Down

0 comments on commit a13a87c

Please sign in to comment.