Fix for get_logs and for telemetry addresses

- mdb01 address intersects with prx01 node .121 , patch [1]
- fix xargs arguments replacements, by using 'for' instead
- sync the file caches after 'eatmydata'

[1] https://gerrit.mcp.mirantis.net/#/c/17086/

Change-Id: I2476637127b79993fee2ff0dc0e822e8f420345a
diff --git a/tcp_tests/managers/underlay_ssh_manager.py b/tcp_tests/managers/underlay_ssh_manager.py
index 85d5eb5..3b64300 100644
--- a/tcp_tests/managers/underlay_ssh_manager.py
+++ b/tcp_tests/managers/underlay_ssh_manager.py
@@ -428,12 +428,14 @@
             "docker ps > /root/$(hostname -f)/dump_docker_ps.txt;"
             "docker service ls > "
             "  /root/$(hostname -f)/dump_docker_services_ls.txt;"
-            "docker service ls | awk '{ print $2 }' | "
-            "  xargs -I SERVICE docker service ps --no-trunc 2>&1 SERVICE >> "
-            "  /root/$(hostname -f)/dump_docker_service_ps.txt;"
-            "docker service ls | awk '{ print $2 }' | "
-            "  xargs -I SERVICE docker service logs 2>&1 SERVICE > "
-            "  /root/$(hostname -f)/dump_docker_service_SERVICE_logs;"
+            "for SERVICE in $(docker service ls | awk '{ print $2 }'); "
+            "  do docker service ps --no-trunc 2>&1 $SERVICE >> "
+            "    /root/$(hostname -f)/dump_docker_service_ps.txt;"
+            "  done;"
+            "for SERVICE in $(docker service ls | awk '{ print $2 }'); "
+            "  do docker service logs 2>&1 $SERVICE > "
+            "    /root/$(hostname -f)/dump_docker_service_${SERVICE}_logs;"
+            "  done;"
             "vgdisplay > /root/$(hostname -f)/dump_vgdisplay.txt;"
             "lvdisplay > /root/$(hostname -f)/dump_lvdisplay.txt;"
             "ip a > /root/$(hostname -f)/dump_ip_a.txt;"
diff --git a/tcp_tests/templates/shared-salt.yaml b/tcp_tests/templates/shared-salt.yaml
index 438fd94..907f8a0 100644
--- a/tcp_tests/templates/shared-salt.yaml
+++ b/tcp_tests/templates/shared-salt.yaml
@@ -63,6 +63,7 @@
     echo "{{ UBUNTU_UPDATES_REPOSITORY }}" > /etc/apt/sources.list.d/ubuntu_updates.list
     echo "{{ UBUNTU_SECURITY_REPOSITORY }}" > /etc/apt/sources.list.d/ubuntu_security.list
     eatmydata apt-get clean && apt-get update;
+    sync;
   node_name: {{ NODE_NAME }}
   retry: {count: 1, delay: 5}
   skip_fail: false
@@ -93,6 +94,7 @@
     eatmydata apt-get install -y --allow-unauthenticated reclass salt-master
     # Install common packages
     eatmydata apt-get install -y python-pip git curl at tmux byobu iputils-ping traceroute htop tree mc
+    sync;
   node_name: {{ HOSTNAME_CFG01 }}
   retry: {count: 1, delay: 1}
   skip_fail: false
@@ -444,7 +446,7 @@
     [ ! -d /srv/salt/reclass/classes/service ] && mkdir -p /srv/salt/reclass/classes/service;
     declare -a formula_services=({{ FORMULA_SERVICES }});
     echo -e "\nInstalling all required salt formulas\n";
-    eatmydata apt-get install -y "${formula_services[@]/#/salt-formula-}";
+    apt-get install -y "${formula_services[@]/#/salt-formula-}";
     for formula_service in "${formula_services[@]}"; do
       echo -e "\nLink service metadata for formula ${formula_service} ...\n";
       [ ! -L "/srv/salt/reclass/classes/service/${formula_service}" ] && ln -s ${FORMULA_PATH}/reclass/service/${formula_service} /srv/salt/reclass/classes/service/${formula_service};
@@ -522,7 +524,7 @@
     eatmydata apt-get install -y salt-minion;
     # Install common packages
     eatmydata apt-get install -y python-pip git curl tmux byobu iputils-ping traceroute htop tree mc
-
+    sync
     # Restart salt-minion if it was already installed
     service salt-minion restart
   node_name: {{ ssh['node_name'] }}
diff --git a/tcp_tests/templates/virtual-mcp-pike-ovs/underlay.yaml b/tcp_tests/templates/virtual-mcp-pike-ovs/underlay.yaml
index f90dceb..9e8899b 100644
--- a/tcp_tests/templates/virtual-mcp-pike-ovs/underlay.yaml
+++ b/tcp_tests/templates/virtual-mcp-pike-ovs/underlay.yaml
@@ -43,9 +43,9 @@
             default_{{ HOSTNAME_CTL03 }}: +103
             default_{{ HOSTNAME_CMP01 }}: +105
             default_{{ HOSTNAME_CMP02 }}: +106
-            default_{{ HOSTNAME_MDB01 }}: +121
-            default_{{ HOSTNAME_MDB02 }}: +122
-            default_{{ HOSTNAME_MDB03 }}: +123
+            default_{{ HOSTNAME_MDB01 }}: +45
+            default_{{ HOSTNAME_MDB02 }}: +46
+            default_{{ HOSTNAME_MDB03 }}: +47
             default_{{ HOSTNAME_GTW01 }}: +110
             default_{{ HOSTNAME_PRX01 }}: +121
           ip_ranges:
@@ -63,9 +63,9 @@
             default_{{ HOSTNAME_CTL03 }}: +103
             default_{{ HOSTNAME_CMP01 }}: +105
             default_{{ HOSTNAME_CMP02 }}: +106
-            default_{{ HOSTNAME_MDB01 }}: +121
-            default_{{ HOSTNAME_MDB02 }}: +122
-            default_{{ HOSTNAME_MDB03 }}: +123
+            default_{{ HOSTNAME_MDB01 }}: +45
+            default_{{ HOSTNAME_MDB02 }}: +46
+            default_{{ HOSTNAME_MDB03 }}: +47
             default_{{ HOSTNAME_GTW01 }}: +110
             default_{{ HOSTNAME_PRX01 }}: +121
           ip_ranges:
@@ -83,9 +83,9 @@
             default_{{ HOSTNAME_CTL03 }}: +103
             default_{{ HOSTNAME_CMP01 }}: +105
             default_{{ HOSTNAME_CMP02 }}: +106
-            default_{{ HOSTNAME_MDB01 }}: +121
-            default_{{ HOSTNAME_MDB02 }}: +122
-            default_{{ HOSTNAME_MDB03 }}: +123
+            default_{{ HOSTNAME_MDB01 }}: +45
+            default_{{ HOSTNAME_MDB02 }}: +46
+            default_{{ HOSTNAME_MDB03 }}: +47
             default_{{ HOSTNAME_GTW01 }}: +110
             default_{{ HOSTNAME_PRX01 }}: +121
           ip_ranges:
@@ -103,9 +103,9 @@
             default_{{ HOSTNAME_CTL03 }}: +103
             default_{{ HOSTNAME_CMP01 }}: +105
             default_{{ HOSTNAME_CMP02 }}: +106
-            default_{{ HOSTNAME_MDB01 }}: +121
-            default_{{ HOSTNAME_MDB02 }}: +122
-            default_{{ HOSTNAME_MDB03 }}: +123
+            default_{{ HOSTNAME_MDB01 }}: +45
+            default_{{ HOSTNAME_MDB02 }}: +46
+            default_{{ HOSTNAME_MDB03 }}: +47
             default_{{ HOSTNAME_GTW01 }}: +110
             default_{{ HOSTNAME_PRX01 }}: +121
           ip_ranges: