mirror-image updates
* Check exit code from salt states
EME-372
Change-Id: Ie92f0487d2ee353488925f5129479492895118e0
diff --git a/mirror-image/scripts/mirrors.sh b/mirror-image/scripts/mirrors.sh
index fe7101f..764597a 100644
--- a/mirror-image/scripts/mirrors.sh
+++ b/mirror-image/scripts/mirrors.sh
@@ -1,19 +1,22 @@
#!/bin/bash -xe
+SALT_OPTS="-l debug -t 10 --retcode-passthrough --no-color"
+
#aptly
-salt-call -t 5 --no-color state.sls aptly.server
-salt-call -t 5 --no-color state.sls aptly.publisher
-salt-call -t 5 --no-color state.sls aptly
-salt-call -t 5 --retcode-passthrough --no-color state.sls aptly
+# FIXME: remove duplicate run after fix: PROD-21387
+# RC: aptly may fail to import gpg key's randomly(most probably,nw issue), so lets run it twice
+salt-call ${SALT_OPTS} state.sls aptly.server || salt-call ${SALT_OPTS} state.sls aptly.server
+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
#docker registry
-salt-call -t 5 --retcode-passthrough state.sls docker.client.registry
-docker system prune --all --force
+salt-call ${SALT_OPTS} state.sls docker.client.registry
+docker system prune --all --force || true
#debmirror
-salt-call -t 5 --no-color state.sls debmirror
+salt-call ${SALT_OPTS} state.sls debmirror
#git
-salt-call -t 5 --retcode-passthrough --no-color state.sls git.server
+salt-call ${SALT_OPTS} state.sls git.server