From 0a52b50b23440a418df46085be9a1b7a2bee687a Mon Sep 17 00:00:00 2001 From: David Alexander Date: Thu, 7 Nov 2019 16:27:41 -0500 Subject: [PATCH] Adds missing logging (v0.3.0 -> v0.3.1) --- CHANGELOG.md | 5 +++++ oc_auth/__init__.py | 2 +- oc_auth/cli/main.py | 9 +++++++-- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 89c49c1..4fd3603 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,11 @@ We follow [Semantic Versioning](http://semver.org/) as a way of measuring stability of an update. This means we will never make a backwards-incompatible change within a major version of the project. +## [0.3.1] - 2019-11-07 + +- Missing `--verbose` flag to crank up the logging +- Adds more logging statements for later troubleshooting, if need be + ## [0.3.0] - 2019-11-07 - Uses the TLS verification settings already present in the kube config diff --git a/oc_auth/__init__.py b/oc_auth/__init__.py index 0404d81..e1424ed 100644 --- a/oc_auth/__init__.py +++ b/oc_auth/__init__.py @@ -1 +1 @@ -__version__ = '0.3.0' +__version__ = '0.3.1' diff --git a/oc_auth/cli/main.py b/oc_auth/cli/main.py index 29c4b6d..1be36c0 100644 --- a/oc_auth/cli/main.py +++ b/oc_auth/cli/main.py @@ -34,11 +34,12 @@ def get_args(): help='The name of the credential in ~/.kube/config to update (OPTIONAL)') p.add_argument('--insecure', action='store_const', dest='verify', const=False, default=True) + p.add_argument('--verbose', action='store_const', dest='log_level', const=logging.DEBUG, default=logging.INFO) return p.parse_args() -def get_context_mapping(kube_config: KubeConfig, name=None, cluster=None, credential=None) -> KubeConfigDataSnippet: +def get_context_mapping(kube_config: KubeConfig, name=_missing, cluster=None, credential=None) -> KubeConfigDataSnippet: if name is _missing: name = kube_config.data.value.get('current-context') @@ -111,8 +112,12 @@ def disable_tls_verification(): def main(): - logging.basicConfig(level=logging.INFO, format='%(levelname)s: %(message)s') opts = get_args() + logging.basicConfig(level=opts.log_level, format='%(levelname)s: %(message)s') + logging.debug('Given context: {}'.format(opts.context)) + logging.debug('Given cluster: {}'.format(opts.cluster)) + logging.debug('Given credential: {}'.format(opts.credential)) + logging.debug('Given TLS verification: {}'.format('yes' if opts.verify else 'no')) kube_config = KubeConfig.find_from_env()