misc updates

  * Wait for salt-master and salt-minion to wake up after restart
  * fix aptly publisher config path
  * refactor cleanup
  * remove multiverse from ubuntu_base.
    It was never packed into offline - so, should be safe to remove.

Change-Id: Ic5bd8d8085af5db10d52063bff50be41031ef248
diff --git a/day01-image/scripts/cleanup.sh b/day01-image/scripts/cleanup.sh
deleted file mode 100644
index 0f5adec..0000000
--- a/day01-image/scripts/cleanup.sh
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/bin/bash -xe
-
-apt-get purge salt-formula-* -y
-apt-get -y autoremove --purge
-apt-get -y clean
-
-rm -rf /var/lib/ntp/ntp.conf.dhcp || true
-rm -rf /var/lib/apt/lists/*
-rm -rv /etc/apt/sources.list.d/* || true
-echo > /etc/apt/sources.list  || true
-rm -vf /usr/sbin/policy-rc.d || true
-
-
-echo "removeing all previously accepted salt keys"
-salt-key -D -y || true
-
-echo "cleaning up reclass"
-rm -rf /srv/salt/reclass || true
-rm -rf /srv/salt/scripts || true
-rm -rf /usr/share/salt-formulas/env || true
-#
-mkdir -p /srv/salt/reclass/
-mkdir -p /usr/share/salt-formulas/reclass/service/
-mkdir -p /usr/share/salt-formulas/env/
-
-echo "cleaning up hostname"
-sed -i "/.*ubuntu.*/d" /etc/hosts
-sed -i "/.*salt.*/d" /etc/hosts
-
-echo "cleaning up guest additions"
-rm -rf VBoxGuestAdditions_*.iso VBoxGuestAdditions_*.iso.? || true
-
-echo "cleaning up dhcp leases"
-rm -rf /var/lib/dhcp/* || true
-
-echo "cleaning up udev rules"
-rm -f /etc/udev/rules.d/70-persistent-net.rules || true
-rm -rf /dev/.udev/ || true
-rm -f /lib/udev/rules.d/75-persistent-net-generator.rules || true
-
-echo "cleaning up minion_id for salt"
-rm -f /etc/salt/minion_id || true
-
-echo "cleaning up resolvconf"
-sed -i '/172\.18\.208\.44/d' /etc/resolvconf/resolv.conf.d/base
-
-# stop and disable services, for healthy zerodisk
-# They should be enabled after cfg01 init
-stop_services="postgresql.service salt-api salt-master salt-minion jenkins maas-rackd.service maas-regiond.service bind9"
-for s in ${stop_services} ; do
-  systemctl stop ${s} || true
-  systemctl disable ${s} || true
-done
-
-echo 3 > /proc/sys/vm/drop_caches
-sync
diff --git a/day01-image/scripts/cleanup.sh b/day01-image/scripts/cleanup.sh
new file mode 120000
index 0000000..cf970b6
--- /dev/null
+++ b/day01-image/scripts/cleanup.sh
@@ -0,0 +1 @@
+../../common/ubuntu_cleanup.sh
\ No newline at end of file
diff --git a/day01-image/scripts/cleanup_day01.sh b/day01-image/scripts/cleanup_day01.sh
new file mode 100644
index 0000000..89cd6e7
--- /dev/null
+++ b/day01-image/scripts/cleanup_day01.sh
@@ -0,0 +1,12 @@
+#!/bin/bash -xe
+
+# stop and disable services, for healthy zerodisk
+# They should be enabled after cfg01 init
+stop_services="postgresql.service salt-api salt-master salt-minion jenkins maas-rackd.service maas-regiond.service bind9"
+for s in ${stop_services} ; do
+  systemctl stop ${s} || true
+  systemctl disable ${s} || true
+done
+
+echo 3 > /proc/sys/vm/drop_caches
+sync
diff --git a/day01-image/scripts/cleanup_salt.sh b/day01-image/scripts/cleanup_salt.sh
new file mode 120000
index 0000000..72d6f4e
--- /dev/null
+++ b/day01-image/scripts/cleanup_salt.sh
@@ -0,0 +1 @@
+../../common/ubuntu_cleanup_salt.sh
\ No newline at end of file
diff --git a/day01-image/template.json b/day01-image/template.json
index c4ff8de..cfaa73f 100644
--- a/day01-image/template.json
+++ b/day01-image/template.json
@@ -87,6 +87,8 @@
       "scripts": [
         "scripts/security.sh",
         "scripts/cleanup.sh",
+        "scripts/cleanup_salt.sh",
+        "scripts/cleanup_day01.sh",
         "scripts/info.sh",
         "scripts/zerodisk.sh"
       ]
@@ -135,7 +137,7 @@
       "ssh_password": "{{user `password`}}",
       "ssh_host_port_min": 7000,
       "ssh_host_port_max": 7050,
-      "shutdown_command": "shutdown -P now",
+      "shutdown_command": "pgrep -f 'sshd: root@' | xargs kill -9 ; shutdown -P now",
       "boot_wait": "2s",
       "ssh_wait_timeout": "360s"
     }