Update images build with repos checkout from gerrit

Change-Id: I27d19e248a1ded6b2a6a2a30b2955da57f23bc3f
diff --git a/mirror-image/run.example.sh b/mirror-image/run.example.sh
index f1d39be..8a51c73 100755
--- a/mirror-image/run.example.sh
+++ b/mirror-image/run.example.sh
@@ -30,6 +30,7 @@
 export APT_MIRANTIS_SALT_REPO="http://apt.mirantis.com/xenial/ ${BINARY_MCP_VERSION} salt "
 #
 export GIT_SALT_FORMULAS_SCRIPTS="https://github.com/salt-formulas/salt-formulas-scripts.git"
+export SCRIPTS_REF="master"
 #
 export APT_REPOSITORY=" deb [arch=amd64] ${APT_MIRANTIS_SALT_REPO} "
 export APT_REPOSITORY_GPG=${APT_MIRANTIS_GPG}
@@ -48,7 +49,25 @@
 mkdir -p "${PACKER_IMAGES_CACHE}"
 
 export PACKER_LOG=1
+pushd config-drive
+  [ -d model ] && rm -rf model
+  git clone ${CLUSTER_MODEL} model/
+  pushd model
+    git fetch ${CLUSTER_MODEL} ${CLUSTER_MODEL_REF} && git checkout FETCH_HEAD
+    pushd classes/system
+      git submodule init
+      git submodule update
+    popd
+  popd
+  [ -d salt_scripts ] && rm -rf salt_scripts
+  git clone ${GIT_SALT_FORMULAS_SCRIPTS} salt_scripts/
+  pushd salt_scripts
+    git fetch ${GIT_SALT_FORMULAS_SCRIPTS} ${SCRIPTS_REF} && git checkout FETCH_HEAD
+  popd
+popd
+
+[ -f config-drive/cloudata.iso ] && rm -v config-drive/cloudata.iso
+mkisofs -o config-drive/cloudata.iso -V cidata -r -J --quiet config-drive
 # For qemu test-build:
-cloud-localds  --hostname apt01 --dsmode local config-drive/cloudata.iso  config-drive/user-data.yaml
 packer build -only=qemu -parallel=false -on-error=ask template.json
 # rm -rf ~/.packer.d/