From 7175ef6ae676c415d7043e314b63da8b19c967e5 Mon Sep 17 00:00:00 2001
From: Jesse Pretorius <jesse.pretorius@rackspace.co.uk>
Date: Mon, 21 Jan 2019 16:45:35 +0000
Subject: [PATCH] Improve docker API version retrieval

The current method does not work due to CLI output formatting
changes. We improve it to render the client output using toml,
which should be more future proof.

This change also disables pinging of the neutron router during
tempest tests, a combined patch is required to pass tests.

Change-Id: I7f611ffd095ca690baba3a987d8eb0b8407fade1
---
 tasks/zun_post_install.yml          | 7 +++++--
 tests/group_vars/all_containers.yml | 2 ++
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/tasks/zun_post_install.yml b/tasks/zun_post_install.yml
index 8b7a70f..8fbed79 100644
--- a/tasks/zun_post_install.yml
+++ b/tasks/zun_post_install.yml
@@ -16,14 +16,17 @@
 - name: Define the docker api
   block:
     - name: Get docker api version
-      command: "docker version"
+      command: >-
+        {% raw %}
+        docker version -f "{{.Client.APIVersion }}"
+        {% endraw %}
       failed_when: false
       changed_when: false
       register: docker_version
 
     - name: Set docker api version fact
       set_fact:
-        zun_docker_api_version: "{{ (docker_version.stdout | from_yaml)['Client']['API version'] }}"
+        zun_docker_api_version: "{{ docker_version.stdout | trim }}"
   when:
     - zun_services['zun-compute']['group'] in group_names
 
diff --git a/tests/group_vars/all_containers.yml b/tests/group_vars/all_containers.yml
index 0a2006e..5ea0555 100644
--- a/tests/group_vars/all_containers.yml
+++ b/tests/group_vars/all_containers.yml
@@ -13,6 +13,8 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+tempest_network_ping_gateway: False
+
 container_networks:
   management_address:
     address: "{{ ansible_host }}"