summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrenton Leanhardt <bleanhar@redhat.com>2016-02-25 10:52:26 -0500
committerBrenton Leanhardt <bleanhar@redhat.com>2016-03-03 09:05:42 -0500
commit9423af3e5feb8cd9bb5e1c43a22c01ac6b57a89f (patch)
treee84648f3bc24ee75f78b17075b8af2b9e11a2e15
parentf5a0cbee18986e45da24ff296e93fa918880bdab (diff)
downloadopenshift-9423af3e5feb8cd9bb5e1c43a22c01ac6b57a89f.tar.gz
openshift-9423af3e5feb8cd9bb5e1c43a22c01ac6b57a89f.tar.bz2
openshift-9423af3e5feb8cd9bb5e1c43a22c01ac6b57a89f.tar.xz
openshift-9423af3e5feb8cd9bb5e1c43a22c01ac6b57a89f.zip
Updating the containerized cli wrapper to work for both docker 1.8 and 1.9
-rw-r--r--roles/openshift_cli/templates/openshift.j223
1 files changed, 18 insertions, 5 deletions
diff --git a/roles/openshift_cli/templates/openshift.j2 b/roles/openshift_cli/templates/openshift.j2
index d2a3f066c..e9155e76d 100644
--- a/roles/openshift_cli/templates/openshift.j2
+++ b/roles/openshift_cli/templates/openshift.j2
@@ -20,13 +20,26 @@ See https://docs.openshift.org/latest/cli_reference/get_started_cli.html
=================================================================================
"""
-image=""
-if ! docker inspect -f {% raw %}'{{ .State.Status }}'{% endraw %} {{ openshift.common.service_type }}-master | grep running > /dev/null; then
->&2 echo """
+container="{{ openshift.common.service_type }}-master"
+is_running=false
-Warning: {{ openshift.common.service_type }}-master service is not running. Using the latest image.
-"""
+docker19_status=`docker inspect -f {% raw %}'{{ .State.Status }}'{% endraw %} $container`
+if [ "$docker19_status" == "<no value>" ]; then
+ if docker inspect -f {% raw %}'{{ .State.Running }}'{% endraw %} $container | grep -i true > /dev/null; then
+ is_running=true
+ fi
+elif [ "$docker19_status" == "running" ]; then
+ is_running=true
+fi
+
+if $is_running; then
image=:`docker inspect -f {% raw %}'{{ .Image }}'{% endraw %} {{ openshift.common.service_type }}-master`
+else
+ >&2 echo """
+
+Warning: {{ openshift.common.service_type }}-master service is not running. Using the latest image.
+ """
+ image=:latest
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} "${@}"