From 50b9eefd2b6266b29755e37090138096a2aebc31 Mon Sep 17 00:00:00 2001 From: Brenton Leanhardt Date: Wed, 17 Feb 2016 13:05:12 -0500 Subject: First past at the upgrade process --- roles/openshift_cli/tasks/main.yml | 7 +------ roles/openshift_cli/templates/openshift.j2 | 11 ++++++++++- 2 files changed, 11 insertions(+), 7 deletions(-) (limited to 'roles/openshift_cli') diff --git a/roles/openshift_cli/tasks/main.yml b/roles/openshift_cli/tasks/main.yml index a6b6b1925..e9d7f4afe 100644 --- a/roles/openshift_cli/tasks/main.yml +++ b/roles/openshift_cli/tasks/main.yml @@ -9,11 +9,6 @@ action: "{{ ansible_pkg_mgr }} name={{ openshift.common.service_type }}-clients state=present" when: not openshift.common.is_containerized | bool -- name: Pull CLI Image - command: > - docker pull {{ openshift.common.cli_image }} - when: openshift.common.is_containerized | bool - - name: Create /usr/local/bin/openshift cli wrapper template: src: openshift.j2 @@ -30,4 +25,4 @@ - /usr/local/bin/oadm - /usr/local/bin/oc - /usr/local/bin/kubectl - when: openshift.common.is_containerized | bool \ No newline at end of file + when: openshift.common.is_containerized | bool diff --git a/roles/openshift_cli/templates/openshift.j2 b/roles/openshift_cli/templates/openshift.j2 index a7c148a22..d2a3f066c 100644 --- a/roles/openshift_cli/templates/openshift.j2 +++ b/roles/openshift_cli/templates/openshift.j2 @@ -20,4 +20,13 @@ See https://docs.openshift.org/latest/cli_reference/get_started_cli.html ================================================================================= """ -docker run -i --privileged --net=host --user=${user}:${group} -v ~/.kube:/root/.kube -v /tmp:/tmp -v {{ openshift.common.config_base}}:{{ openshift.common.config_base }} -e KUBECONFIG=/root/.kube/config --entrypoint ${cmd} --rm {{ openshift.common.cli_image }} "${@}" +image="" +if ! docker inspect -f {% raw %}'{{ .State.Status }}'{% endraw %} {{ openshift.common.service_type }}-master | grep running > /dev/null; then +>&2 echo """ + +Warning: {{ openshift.common.service_type }}-master service is not running. Using the latest image. +""" + image=:`docker inspect -f {% raw %}'{{ .Image }}'{% endraw %} {{ openshift.common.service_type }}-master` +fi + +docker run -i --privileged --net=host --user=${user}:${group} -v ~/.kube:/root/.kube -v /tmp:/tmp -v {{ openshift.common.config_base}}:{{ openshift.common.config_base }} -e KUBECONFIG=/root/.kube/config --entrypoint ${cmd} --rm {{ openshift.common.cli_image }}${image} "${@}" -- cgit v1.2.1