Stop maas-proxy before time sync

Closes-Bug: #PROD-30629
Change-Id: Id6e85fc5c74f9199bd8171a43556e2014b36d203
diff --git a/tcp_tests/managers/saltmanager.py b/tcp_tests/managers/saltmanager.py
index a33bb11..617323a 100644
--- a/tcp_tests/managers/saltmanager.py
+++ b/tcp_tests/managers/saltmanager.py
@@ -285,26 +285,33 @@
         if not settings.SKIP_SYNC_TIME:
             cmd = ('service ntp stop;'
                    'if systemctl is-active --quiet maas-rackd; then'
-                   '  systemctl stop maas-rackd; RACKD=true;'
-                   'else'
-                   '  RACKD=false;'
+                   '  systemctl stop maas-rackd;'
+                   '  touch /tmp/maas-rackd.work;'
                    'fi;'
                    'if systemctl is-active --quiet maas-regiond; then'
-                   '  systemctl stop maas-regiond; REGIOND=true;'
-                   'else'
-                   '  REGIOND=false;'
+                   '  systemctl stop maas-regiond;'
+                   '  touch /tmp/maas-regiond.work;'
                    'fi;'
+                   'if systemctl is-active --quiet maas-proxy; then'
+                   '  systemctl stop maas-proxy;'
+                   '  touch /tmp/maas-proxy.work;'
+                   'fi;'
+                   'sleep 3;'
                    'if [ -x /usr/sbin/ntpdate ]; then'
                    '  ntpdate -s ntp.ubuntu.com;'
                    'else'
                    '  ntpd -gq;'
                    'fi;'
                    'service ntp start;'
-                   'if $RACKD; then systemctl start maas-rackd; fi;'
-                   'if $REGIOND; then systemctl start maas-regiond; fi;')
+                   'if [ -f /tmp/maas-proxy.work ]; then'
+                   '  systemctl start maas-proxy; fi;'
+                   'if [ -f /tmp/maas-rackd.work ]; then'
+                   '  systemctl start maas-rackd; fi;'
+                   'if [ -f /tmp/maas-regiond.work ]; then'
+                   '  systemctl start maas-regiond; fi;')
             self.run_state(
                 tgt,
-                'cmd.run', cmd)  # noqa
+                'cmd.run', cmd, timeout=3600)  # noqa
         new_time_res = self.run_state(tgt, 'cmd.run', 'date')
         for node_name, time in sorted(new_time_res[0]['return'][0].items()):
             LOG.info("{0}: {1}".format(node_name, time))