From 455fc24f605b4ecb88d8cd84e897d2eaebe19641 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sun, 22 Apr 2018 17:10:35 +0300 Subject: Fix: icktool --no-verify-tls --- ick2/client.py | 3 +++ icktool | 10 ++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ick2/client.py b/ick2/client.py index 7d0af57..3c0c7ec 100644 --- a/ick2/client.py +++ b/ick2/client.py @@ -140,6 +140,9 @@ class ControllerClient: def set_http_api(self, api): self._api = api + def get_http_api(self): + return self._api + def set_controller_url(self, url): self._url = url diff --git a/icktool b/icktool index f384814..ade9858 100755 --- a/icktool +++ b/icktool @@ -20,6 +20,7 @@ import json import logging import os import sys +import urllib3 import cliapp import yaml @@ -101,10 +102,6 @@ class Icktool(cliapp.Application): default=self._default_scopes, ) - def setup(self): - if not self.settings['verify-tls']: - logging.captureWarnings(True) - def cmd_scopes(self, args): for scope in self.settings['scope']: self.output.write('{}\n'.format(scope)) @@ -153,6 +150,10 @@ class Icktool(cliapp.Application): return klass(api, self.output) def _new_api(self): + if not self.settings['verify-tls']: + urllib3.disable_warnings() + logging.captureWarnings(True) + api = ick2.ControllerClient() api.set_verify_tls(self.settings['verify-tls']) api.set_controller_url(self.settings['controller']) @@ -163,6 +164,7 @@ class Icktool(cliapp.Application): client_id, client_secret = self._get_client_creds(url) ac = ick2.AuthClient() + ac.set_http_api(api.get_http_api()) ac.set_auth_url(url) ac.set_client_creds(client_id, client_secret) return ac -- cgit v1.2.1