diff options
-rw-r--r-- | .coafile | 11 | ||||
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | ansible/library/rancher_k8s_environment.py | 1 | ||||
-rw-r--r-- | build/download/__init__.py | 1 | ||||
-rwxr-xr-x | build/download/clean_docker_images.py | 1 | ||||
-rwxr-xr-x | build/download/pypi_downloader.py | 2 | ||||
-rwxr-xr-x | build/download/rpm_downloader.py | 2 | ||||
-rw-r--r-- | build/download/tox.ini | 7 | ||||
-rw-r--r-- | build/tox.ini | 7 | ||||
-rwxr-xr-x | tools/helm_deployment_status.py | 30 | ||||
-rwxr-xr-x | tools/remove_runtime_images.py | 1 | ||||
-rw-r--r-- | tox.ini | 19 |
12 files changed, 63 insertions, 21 deletions
diff --git a/.coafile b/.coafile new file mode 100644 index 00000000..3e55d459 --- /dev/null +++ b/.coafile @@ -0,0 +1,11 @@ +[py] +bears = PyLintBear +pylint_disable = all +pylint_enable = + bad-indentation, trailing-whitespace, unused-wildcard-import, unused-import, + unnecessary-semicolon, unnecessary-semicolon, undefined-variable, + syntax-error, unused-variable, using-constant-test,unused-argument, + len-as-condition, trailing-newlines, missing-final-newline, reimported, + too-many-function-args, singleton-comparison +ignore = + .tox/** @@ -2,3 +2,5 @@ doc /package.info /ansible/log/ /*.log +.tox/ +__pycache__/ diff --git a/ansible/library/rancher_k8s_environment.py b/ansible/library/rancher_k8s_environment.py index d3d8ac02..00bb7d49 100644 --- a/ansible/library/rancher_k8s_environment.py +++ b/ansible/library/rancher_k8s_environment.py @@ -338,4 +338,3 @@ def run_module(): if __name__ == '__main__': run_module() - diff --git a/build/download/__init__.py b/build/download/__init__.py index b1ef8d99..4f259ea7 100644 --- a/build/download/__init__.py +++ b/build/download/__init__.py @@ -17,4 +17,3 @@ # limitations under the License. # COPYRIGHT NOTICE ENDS HERE - diff --git a/build/download/clean_docker_images.py b/build/download/clean_docker_images.py index 186bfd60..42157490 100755 --- a/build/download/clean_docker_images.py +++ b/build/download/clean_docker_images.py @@ -68,4 +68,3 @@ def main(): if __name__ == '__main__': main() - diff --git a/build/download/pypi_downloader.py b/build/download/pypi_downloader.py index 10ac7b9f..aa2a46e0 100755 --- a/build/download/pypi_downloader.py +++ b/build/download/pypi_downloader.py @@ -47,7 +47,7 @@ class PyPiDownloader(CommandDownloader): log.warning('Check mode for pypi is not implemented.') return '' - def _is_missing(self, item): + def _is_missing(self, item): # pylint: disable=W0613 """ Check if item is missing :param item: item to check diff --git a/build/download/rpm_downloader.py b/build/download/rpm_downloader.py index 415f9483..2b94e167 100755 --- a/build/download/rpm_downloader.py +++ b/build/download/rpm_downloader.py @@ -66,7 +66,7 @@ class RpmDownloader(CommandDownloader): self._missing[dst].add(item) return self._missing - def _is_missing(self, item): + def _is_missing(self, item): # pylint: disable=W0613 """ Check if item is missing :param item: item to check diff --git a/build/download/tox.ini b/build/download/tox.ini new file mode 100644 index 00000000..e4616fff --- /dev/null +++ b/build/download/tox.ini @@ -0,0 +1,7 @@ +[tox] +envlist = download +skipsdist = true + +[testenv:download] +basepython = python3 +deps = -r{toxinidir}/requirements.txt diff --git a/build/tox.ini b/build/tox.ini new file mode 100644 index 00000000..e14a29c3 --- /dev/null +++ b/build/tox.ini @@ -0,0 +1,7 @@ +[tox] +envlist = package +skipsdist = true + +[testenv:package] +basepython = python3 +deps = -r{toxinidir}/requirements.txt 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() - diff --git a/tox.ini b/tox.ini new file mode 100644 index 00000000..8237e045 --- /dev/null +++ b/tox.ini @@ -0,0 +1,19 @@ +[tox] +minversion = 3.2.0 +envlist = py +skipsdist = true +requires = pip >= 8 + +[testenv] +basepython = python3 +whitelist_externals = + git + bash +deps = + coala-bears + +[testenv:py] +commands_pre = + /bin/sh -c "git --no-pager diff HEAD HEAD^ --name-only '*.py' > /tmp/.coalist_py" +commands = + /bin/bash -c "coala --non-interactive --disable-caching --no-autoapply-warn py --files $(</tmp/.coalist_py) \ " |