diff options
author | Bartek Grzybowski <b.grzybowski@partner.samsung.com> | 2020-07-29 15:36:15 +0200 |
---|---|---|
committer | Bartek Grzybowski <b.grzybowski@partner.samsung.com> | 2020-07-29 15:36:15 +0200 |
commit | c45b184d4c43b736fb8ffcb2f0f89eb7dcef005f (patch) | |
tree | 8b06d8cb0a18f4442e4060f6820c6b4220d2d73f /tools | |
parent | 2173fd4f1721ccf1ca88c80ee525838e8e04ae8c (diff) |
Fix linting issues in Python scripts
Change-Id: I198340670f808d42aa6fb16de573db4a65005985
Issue-ID: INT-1667
Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/helm_deployment_status.py | 30 | ||||
-rwxr-xr-x | tools/remove_runtime_images.py | 1 |
2 files changed, 15 insertions, 16 deletions
diff --git a/tools/helm_deployment_status.py b/tools/helm_deployment_status.py index 8917e992..f92773db 100755 --- a/tools/helm_deployment_status.py +++ b/tools/helm_deployment_status.py @@ -111,20 +111,20 @@ def exec_healthcheck(hp_script, namespace, hp_mode): return hc.returncode def check_readiness(k8s, verbosity): - k8s_controllers, not_ready_controllers = get_k8s_controllers(k8s) - - # check pods only when it is explicitly wanted (judging readiness by deployment status) - if verbosity > 1: - pods = k8s.get_resources('api/v1', 'pods') - unready_pods = chain.from_iterable( - get_names(not_ready_pods( - pods_by_parent(pods, x))) - for x in not_ready_controllers) - else: - unready_pods = [] + k8s_controllers, not_ready_controllers = get_k8s_controllers(k8s) + + # check pods only when it is explicitly wanted (judging readiness by deployment status) + if verbosity > 1: + pods = k8s.get_resources('api/v1', 'pods') + unready_pods = chain.from_iterable( + get_names(not_ready_pods( + pods_by_parent(pods, x))) + for x in not_ready_controllers) + else: + unready_pods = [] - print_status(verbosity, k8s_controllers, unready_pods) - return not not_ready_controllers + print_status(verbosity, k8s_controllers, unready_pods) + return not not_ready_controllers def check_in_loop(k8s, max_time, sleep_time, verbosity): max_end_time = datetime.datetime.now() + datetime.timedelta(minutes=max_time) @@ -224,7 +224,7 @@ class Kubernetes: req = requests.get(url, verify=False) else: req = requests.get(url, verify=self.crt_tmp_file.name, cert=self.crt_tmp_file.name) - except requests.exceptions.ConnectionError as err: + except requests.exceptions.ConnectionError: sys.exit('Error: Could not connect to {}'.format(self.url)) if req.status_code == 200: json = req.json() @@ -264,7 +264,7 @@ class Kubernetes: config['users'][0]['user']['client-certificate-data']))) certs.update(dict(client_key=b64decode( config['users'][0]['user']['client-key-data']))) - except KeyError as err: + except KeyError: print('Warning: could not get Kubernetes config for certificates. ' \ 'Turning off SSL authentication.') self.no_ssl_auth = True diff --git a/tools/remove_runtime_images.py b/tools/remove_runtime_images.py index 67d732bb..40f38eb1 100755 --- a/tools/remove_runtime_images.py +++ b/tools/remove_runtime_images.py @@ -76,4 +76,3 @@ def run_cli(): if __name__ == '__main__': run_cli() - |