From 9724f2523adc7c969d501ef17e529a5616a08de3 Mon Sep 17 00:00:00 2001 From: Vlad Surugiu Date: Fri, 18 Oct 2019 14:34:42 +0300 Subject: [PATCH 1/5] added exception when cluster.fqdn missing --- src/ops/cli/helmfile.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ops/cli/helmfile.py b/src/ops/cli/helmfile.py index e2799771..9b5efb82 100644 --- a/src/ops/cli/helmfile.py +++ b/src/ops/cli/helmfile.py @@ -87,6 +87,8 @@ def setup_kube_config(self, data): file_location = self.generate_eks_kube_config( cluster_name, aws_profile, region) os.environ['KUBECONFIG'] = file_location + else: + raise Exception("Unable to generate EKS kube config. Missing key cluster.fqdn in generated config") def generate_eks_kube_config(self, cluster_name, aws_profile, region): file_location = self.get_tmp_file() From 29a5c578db14da2101ad356e2a6eebcf98c7a0c0 Mon Sep 17 00:00:00 2001 From: Vlad Surugiu Date: Fri, 18 Oct 2019 14:43:13 +0300 Subject: [PATCH 2/5] [RELEASE] - Release version 1.11.8 --- .bumpversion.cfg | 2 +- README.md | 6 +++--- build_scripts/docker_push.sh | 4 ++-- setup.py | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index d7756ebd..3dd51e2d 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 1.11.7 +current_version = 1.11.8 commit = True tag = True tag_name = {new_version} diff --git a/README.md b/README.md index c5460998..f49d260a 100644 --- a/README.md +++ b/README.md @@ -143,7 +143,7 @@ workon ops # uninstall previous `ops` version (if you have it) pip uninstall ops --yes -# install ops-cli v1.11.7 stable release +# install ops-cli v1.11.8 stable release pip install --upgrade ops-cli ``` @@ -162,7 +162,7 @@ source ops/bin/activate # uninstall previous `ops` version (if you have it) pip uninstall ops --yes -# install ops-cli v1.11.7 stable release +# install ops-cli v1.11.8 stable release pip2 install --upgrade ops-cli ``` @@ -178,7 +178,7 @@ You can try out `ops-cli`, by using docker. The docker image has all required pr To start out a container, running the latest `ops-cli` docker image run: ```sh -docker run -it adobe/ops-cli:1.11.7 bash +docker run -it adobe/ops-cli:1.11.8 bash ``` After the container has started, you can start using `ops-cli`: diff --git a/build_scripts/docker_push.sh b/build_scripts/docker_push.sh index 51c929a3..7db93951 100644 --- a/build_scripts/docker_push.sh +++ b/build_scripts/docker_push.sh @@ -2,5 +2,5 @@ set -e echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin -docker tag ops adobe/ops-cli:1.11.7 -docker push adobe/ops-cli:1.11.7 +docker tag ops adobe/ops-cli:1.11.8 +docker push adobe/ops-cli:1.11.8 diff --git a/setup.py b/setup.py index 37f1a1e3..db7cf85e 100644 --- a/setup.py +++ b/setup.py @@ -23,7 +23,7 @@ _requires = [r for r in open(os.path.sep.join((_mydir, 'requirements.txt')), "r").read().split('\n') if len(r) > 1] setup( name='ops-cli', - version='1.11.7', + version='1.11.8', description='Ops - wrapper for Terraform, Ansible, and SSH for cloud automation', long_description=_readme + '\n\n', long_description_content_type='text/markdown', From bdd72e755b8971d2c1d33f667422a478d913a6da Mon Sep 17 00:00:00 2001 From: Vlad Surugiu Date: Fri, 18 Oct 2019 17:33:16 +0300 Subject: [PATCH 3/5] added option to continue with current context --- src/ops/cli/helmfile.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/ops/cli/helmfile.py b/src/ops/cli/helmfile.py index 9b5efb82..2e204e17 100644 --- a/src/ops/cli/helmfile.py +++ b/src/ops/cli/helmfile.py @@ -11,7 +11,10 @@ import logging import os +import six +import sys +from kubernetes import config from ops.cli.parser import SubParserConfig from ops.hierarchical.composition_config_generator import CompositionConfigGenerator @@ -88,7 +91,15 @@ def setup_kube_config(self, data): cluster_name, aws_profile, region) os.environ['KUBECONFIG'] = file_location else: - raise Exception("Unable to generate EKS kube config. Missing key cluster.fqdn in generated config") + logger.info('cluster.fqdn key missing in cluster definition' + '\n unable to generate EKS kubeconfig' + '\n current default context is:\n %s ' + '\n do you want to proceed with this context?', + config.list_kube_config_contexts()[1]) + answer = six.moves.input("Only 'yes' will be accepted to approve.\n Enter a value:") + if answer != "yes": + sys.exit() + def generate_eks_kube_config(self, cluster_name, aws_profile, region): file_location = self.get_tmp_file() From 8352baeb9f8f4bd6cf2a048a9e972beb7f2065da Mon Sep 17 00:00:00 2001 From: Vlad Surugiu Date: Fri, 18 Oct 2019 18:24:41 +0300 Subject: [PATCH 4/5] added exception error msg --- src/ops/cli/helmfile.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/ops/cli/helmfile.py b/src/ops/cli/helmfile.py index 2e204e17..77737698 100644 --- a/src/ops/cli/helmfile.py +++ b/src/ops/cli/helmfile.py @@ -92,10 +92,19 @@ def setup_kube_config(self, data): os.environ['KUBECONFIG'] = file_location else: logger.info('cluster.fqdn key missing in cluster definition' - '\n unable to generate EKS kubeconfig' - '\n current default context is:\n %s ' + '\n unable to generate EKS kubeconfig\n ' + 'looking for system kubernetes context') + + try: + contexts, active_context = config.list_kube_config_contexts() + except Exception as ex: + logger.error('could not find system kubeconfig context') + logger.error(ex) + sys.exit() + + logger.info('current default context is:\n %s ' '\n do you want to proceed with this context?', - config.list_kube_config_contexts()[1]) + active_context) answer = six.moves.input("Only 'yes' will be accepted to approve.\n Enter a value:") if answer != "yes": sys.exit() From 0453616f90f57f398d132f6880a725ce37a3899e Mon Sep 17 00:00:00 2001 From: Vlad Surugiu Date: Fri, 18 Oct 2019 21:08:20 +0300 Subject: [PATCH 5/5] Revert "[RELEASE] - Release version 1.11.8" This reverts commit 29a5c578db14da2101ad356e2a6eebcf98c7a0c0. --- .bumpversion.cfg | 2 +- README.md | 6 +++--- build_scripts/docker_push.sh | 4 ++-- setup.py | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 3dd51e2d..d7756ebd 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 1.11.8 +current_version = 1.11.7 commit = True tag = True tag_name = {new_version} diff --git a/README.md b/README.md index f49d260a..c5460998 100644 --- a/README.md +++ b/README.md @@ -143,7 +143,7 @@ workon ops # uninstall previous `ops` version (if you have it) pip uninstall ops --yes -# install ops-cli v1.11.8 stable release +# install ops-cli v1.11.7 stable release pip install --upgrade ops-cli ``` @@ -162,7 +162,7 @@ source ops/bin/activate # uninstall previous `ops` version (if you have it) pip uninstall ops --yes -# install ops-cli v1.11.8 stable release +# install ops-cli v1.11.7 stable release pip2 install --upgrade ops-cli ``` @@ -178,7 +178,7 @@ You can try out `ops-cli`, by using docker. The docker image has all required pr To start out a container, running the latest `ops-cli` docker image run: ```sh -docker run -it adobe/ops-cli:1.11.8 bash +docker run -it adobe/ops-cli:1.11.7 bash ``` After the container has started, you can start using `ops-cli`: diff --git a/build_scripts/docker_push.sh b/build_scripts/docker_push.sh index 7db93951..51c929a3 100644 --- a/build_scripts/docker_push.sh +++ b/build_scripts/docker_push.sh @@ -2,5 +2,5 @@ set -e echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin -docker tag ops adobe/ops-cli:1.11.8 -docker push adobe/ops-cli:1.11.8 +docker tag ops adobe/ops-cli:1.11.7 +docker push adobe/ops-cli:1.11.7 diff --git a/setup.py b/setup.py index db7cf85e..37f1a1e3 100644 --- a/setup.py +++ b/setup.py @@ -23,7 +23,7 @@ _requires = [r for r in open(os.path.sep.join((_mydir, 'requirements.txt')), "r").read().split('\n') if len(r) > 1] setup( name='ops-cli', - version='1.11.8', + version='1.11.7', description='Ops - wrapper for Terraform, Ansible, and SSH for cloud automation', long_description=_readme + '\n\n', long_description_content_type='text/markdown',