From 17108b7d952215d79f5980ef9194eccaf4be3ea7 Mon Sep 17 00:00:00 2001 From: chengli3 Date: Tue, 8 Jan 2019 12:33:55 +0800 Subject: [PATCH] Correct the test for proxy.http proxy.http | trim returns "None" instead of "". To test if proxy should be used, when: proxy.http should be good enough. We don't have to test if proxy.http is defined or not. Because it is alredy defined in defaults/main.yaml. Change-Id: Ia6330907d22c3f46586aec16db3eefab1a5bbac9 Task: 28755 Story: 2004717 --- roles/build-images/tasks/kubeadm-aio.yaml | 4 ++-- roles/deploy-docker/tasks/main.yaml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/roles/build-images/tasks/kubeadm-aio.yaml b/roles/build-images/tasks/kubeadm-aio.yaml index c6d345e9f..f6e3e3738 100644 --- a/roles/build-images/tasks/kubeadm-aio.yaml +++ b/roles/build-images/tasks/kubeadm-aio.yaml @@ -41,7 +41,7 @@ # HELM_VERSION: "{{ version.helm }}" # CHARTS: "calico,flannel,tiller,kube-dns" - name: Kubeadm-AIO image build path with proxy - when: proxy.http is defined and (proxy.http | trim != "") + when: proxy.http shell: |- set -e docker build \ @@ -70,7 +70,7 @@ chdir: "{{ kubeadm_aio_path.stdout }}/" executable: /bin/bash - name: Kubeadm-AIO image build path - when: proxy.http is undefined or (proxy.http | trim == "") + when: not proxy.http shell: |- set -e docker build \ diff --git a/roles/deploy-docker/tasks/main.yaml b/roles/deploy-docker/tasks/main.yaml index 68597f99e..e3aca074b 100644 --- a/roles/deploy-docker/tasks/main.yaml +++ b/roles/deploy-docker/tasks/main.yaml @@ -40,13 +40,13 @@ # NOTE: (lamt) Setting up the proxy before installing docker - name: ensure docker.service.d directory exists - when: proxy.http is defined and (proxy.http | trim != "") + when: proxy.http file: path: /etc/systemd/system/docker.service.d state: directory - name: proxy | moving proxy systemd unit into place - when: proxy.http is defined and (proxy.http | trim != "") + when: proxy.http template: src: http-proxy.conf.j2 dest: /etc/systemd/system/docker.service.d/http-proxy.conf