Update mirror|ubuntu templatest
* Use latest and more strict qcow2 path
* Be polite with pre-cloned repos in mirror
* Use correct checkout for tag checkout
Change-Id: I311e4f4e8be0d451cdcb9568cfc8b9baaf525db7
diff --git a/mirror-image/scripts/salt_bootstrap.sh b/mirror-image/scripts/salt_bootstrap.sh
index 453c3fb..cd9a487 100644
--- a/mirror-image/scripts/salt_bootstrap.sh
+++ b/mirror-image/scripts/salt_bootstrap.sh
@@ -7,19 +7,33 @@
APT_MIRANTIS_GPG=${APT_MIRANTIS_GPG:-"http://apt.mirantis.com/public.gpg"}
APT_MIRANTIS_SALT_REPO=${APT_MIRANTIS_SALT_REPO:-"http://apt.mirantis.com/xenial/ $FORMULA_VERSION salt"}
GIT_SALT_FORMULAS_SCRIPTS=${GIT_SALT_FORMULAS_SCRIPTS:-"https://github.com/salt-formulas/salt-formulas-scripts"}
+GIT_SALT_FORMULAS_SCRIPTS_REF=${GIT_SALT_FORMULAS_SCRIPTS_REF:-master}
wget -O - ${SALTSTACK_GPG} | sudo apt-key add -
wget -O - ${APT_MIRANTIS_GPG} | apt-key add -
echo "deb [arch=amd64] ${SALTSTACK_REPO}" > /etc/apt/sources.list.d/saltstack.list
apt-get update
apt-get install git-core -y
+
for g_host in ${CLUSTER_MODEL} ${GIT_SALT_FORMULAS_SCRIPTS} ; do
_tmp_host=$(echo ${g_host} | awk -F/ '{print $3}')
ssh-keyscan -T 1 -H ${_tmp_host} >> ~/.ssh/known_hosts || true
done
-git clone --recursive -b ${CLUSTER_MODEL_REF} ${CLUSTER_MODEL} /srv/salt/reclass || true
-git clone ${GIT_SALT_FORMULAS_SCRIPTS} /srv/salt/scripts || true
+if [[ ! -d /srv/salt/reclass ]]; then
+ git clone --recursive ${CLUSTER_MODEL} /srv/salt/reclass
+ pushd /srv/salt/reclass/
+ git checkout ${CLUSTER_MODEL_REF}
+ popd
+fi
+
+if [[ ! -d /srv/salt/scripts ]]; then
+ git clone --recursive ${GIT_SALT_FORMULAS_SCRIPTS} /srv/salt/scripts
+ pushd /srv/salt/scripts/
+ git checkout ${GIT_SALT_FORMULAS_SCRIPTS_REF}
+ popd
+fi
+
# bootstrap.sh opts
export FORMULAS_SOURCE=pkg
export HOSTNAME=apt01
@@ -34,4 +48,9 @@
export BOOTSTRAP_SALTSTACK_OPTS=${BOOTSTRAP_SALTSTACK_OPTS:- -dXr $BOOTSTRAP_SALTSTACK_VERSION }
fi
#
+
+if [[ ! -f /srv/salt/scripts/bootstrap.sh ]]; then
+ echo "ERROR: File /srv/salt/scripts/bootstrap.sh not found"
+ exit 1
+fi
bash -x /srv/salt/scripts/bootstrap.sh || true
diff --git a/mirror-image/template.json b/mirror-image/template.json
index f606787..1f12c3a 100644
--- a/mirror-image/template.json
+++ b/mirror-image/template.json
@@ -145,11 +145,11 @@
"format": "qcow2",
"accelerator": "kvm",
"disk_size": "{{ user `disk_size`}}",
- "iso_url": "http://cloud-images.ubuntu.com/xenial/20180224/xenial-server-cloudimg-amd64-disk1.img",
+ "iso_url": "http://cloud-images.ubuntu.com/releases/xenial/release-20180306/ubuntu-16.04-server-cloudimg-amd64-disk1.img",
"iso_target_path": "/root/isos/xenial-server-cloudimg-amd64-disk1.img",
"iso_checksum_type": "md5",
"disk_image": true,
- "iso_checksum": "697d8f9058ad118cea699d14ae414f8b",
+ "iso_checksum": "566efef1d6f12e7d3a994c2405bdb642",
"http_directory": "http",
"headless": true,
"ssh_username": "{{user `user`}}",
diff --git a/ubuntu-16.04/template.json b/ubuntu-16.04/template.json
index aa80d0a..fc05680 100644
--- a/ubuntu-16.04/template.json
+++ b/ubuntu-16.04/template.json
@@ -234,7 +234,7 @@
"format": "qcow2",
"iso_checksum": "566efef1d6f12e7d3a994c2405bdb642",
"iso_checksum_type": "md5",
- "iso_url": "https://cloud-images.ubuntu.com/releases/16.04/release-20180306/ubuntu-16.04-server-cloudimg-amd64-disk1.img",
+ "iso_url": "http://cloud-images.ubuntu.com/releases/xenial/release-20180306/ubuntu-16.04-server-cloudimg-amd64-disk1.img",
"disk_image": true,
"accelerator": "kvm",
"disk_size": "{{ user `disk_size`}}",