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/mirror-image/run.example.sh b/mirror-image/run.example.sh
old mode 100644
new mode 100755
index cab6393..eea8081
--- a/mirror-image/run.example.sh
+++ b/mirror-image/run.example.sh
@@ -12,6 +12,7 @@
# http/bootstrap.saltstack.com.sh https://github.com/saltstack/salt-bootstrap
#
+export IMAGE_NAME="mcp-offline-mirror-$(date '+%Y-%m-%d-%H-%M-%S')"
export PACKER_IMAGES_CACHE="${HOME}/packer_images_cache/"
#
export CLUSTER_MODEL="https://github.com/Mirantis/mcp-offline-model.git"
diff --git a/mirror-image/scripts/cleanup_salt.sh b/mirror-image/scripts/cleanup_salt.sh
new file mode 120000
index 0000000..72d6f4e
--- /dev/null
+++ b/mirror-image/scripts/cleanup_salt.sh
@@ -0,0 +1 @@
+../../common/ubuntu_cleanup_salt.sh
\ No newline at end of file
diff --git a/mirror-image/scripts/mirrors.sh b/mirror-image/scripts/mirrors.sh
index 764597a..8e4bcb3 100644
--- a/mirror-image/scripts/mirrors.sh
+++ b/mirror-image/scripts/mirrors.sh
@@ -9,7 +9,7 @@
salt-call ${SALT_OPTS} state.sls aptly.publisher
salt-call ${SALT_OPTS} state.sls aptly || salt-call ${SALT_OPTS} state.sls aptly
aptly_mirror_update.sh -sv
-aptly-publisher --url http://10.99.0.1:18084 --timeout=1200 publish -v -d -c /etc/aptly-publisher.yaml --architectures amd64 --recreate --force-overwrite
+aptly-publisher --url http://10.99.0.1:18084 --timeout=1200 publish -v -d -c /etc/aptly/publisher.yaml --architectures amd64 --recreate --force-overwrite
#docker registry
salt-call ${SALT_OPTS} state.sls docker.client.registry
diff --git a/mirror-image/scripts/salt.sh b/mirror-image/scripts/salt.sh
index 9655ec0..ea3d147 100644
--- a/mirror-image/scripts/salt.sh
+++ b/mirror-image/scripts/salt.sh
@@ -1,10 +1,11 @@
#!/bin/bash -xe
+# Wait for salt-master and salt-minion to wake up after restart
+# since we just perform 'reboot.sh'
+salt-call --timeout=120 test.ping
+
SALT_OPTS="-l debug -t 10 --retcode-passthrough --no-color"
-echo "deb [arch=amd64] ${APT_MIRANTIS_SALT_REPO}" > /etc/apt/sources.list.d/mcp_salt.list
-apt-get update
-apt-get install salt-formula* -y
salt-call saltutil.refresh_pillar
salt-call saltutil.sync_all
diff --git a/mirror-image/template.json b/mirror-image/template.json
index 5b942d0..71706f9 100644
--- a/mirror-image/template.json
+++ b/mirror-image/template.json
@@ -2,7 +2,7 @@
"variables": {
"user": "root",
"password": "r00tme",
- "disk_size": "100000",
+ "disk_size": "700000",
"images_cache": "{{ env `PACKER_IMAGES_CACHE` }}",
"do_api_token": "{{ env `DO_API_TOKEN` }}",
"image_name": "{{ env `IMAGE_NAME` }}",
@@ -79,7 +79,7 @@
"environment_vars": [
"APT_MIRANTIS_SALT_REPO={{ user `apt_mirantis_salt_repo` }}"
],
- "pause_before": "120s",
+ "pause_before": "60s",
"type": "shell",
"expect_disconnect": "true",
"scripts": [
@@ -92,12 +92,13 @@
"MCP_VERSION={{ user `mcp_version` }}"
],
"type": "shell",
- "pause_before": "120s",
+ "pause_before": "60s",
"scripts": [
"scripts/mirrors.sh",
"scripts/security.sh",
"scripts/info.sh",
"scripts/cleanup.sh",
+ "scripts/cleanup_salt.sh",
"scripts/zerodisk.sh"
]
},
@@ -161,7 +162,7 @@
"headless": true,
"ssh_username": "{{user `user`}}",
"ssh_password": "{{user `password`}}",
- "shutdown_command": "sync ; shutdown -P now",
+ "shutdown_command": "pgrep -f 'sshd: root@' | xargs kill -9 ; shutdown -P now",
"vnc_bind_address": "0.0.0.0",
"vnc_port_max": "5956",
"vnc_port_min": "5956",