CORD-3133 Fix openstack-helm install to specific commit(s)

Change-Id: I42520319c11805ab62416a315654dd8424a87a67
diff --git a/mcord/mcord-in-a-box.sh b/mcord/mcord-in-a-box.sh
index d0b5b50..0e1a258 100755
--- a/mcord/mcord-in-a-box.sh
+++ b/mcord/mcord-in-a-box.sh
@@ -16,8 +16,22 @@
 
 set -xe
 
-# This script assumes the following repos exist
+# This script assumes the following repos exist and will create them if not
 # ~/cord/automation-tools
+# ~/cord/helm-charts
+
+# Sanity tests
+if [[ $UID == 0 ]]; then
+    echo "Please run this script as non-root user"
+    exit 1
+fi
+
+if ! sudo -n true; then
+    echo "Please configure passwordless sudo on this account"
+    exit 1
+fi
+
+
 
 # Location of 'cord' directory for checkouts on the local system
 CORDDIR="${CORDDIR:-${HOME}/cord}"
@@ -47,7 +61,8 @@
 # Install charts for M-CORD
 cd "$CORDDIR"/helm-charts
 helm dep update ./xos-core
-helm upgrade --install xos-core ./xos-core
+helm upgrade --install xos-core ./xos-core \
+    --set xos-gui.xos_projectName="M-CORD"
 ~/openstack-helm/tools/deployment/common/wait-for-pods.sh default
 
 helm dep update ./xos-profiles/base-openstack
diff --git a/openstack-helm/openstack-helm-dev-setup.sh b/openstack-helm/openstack-helm-dev-setup.sh
index fa34fde..50d9f26 100755
--- a/openstack-helm/openstack-helm-dev-setup.sh
+++ b/openstack-helm/openstack-helm-dev-setup.sh
@@ -23,6 +23,10 @@
 
 # CORD versioning
 OPENSTACK_HELM_BRANCH="${OPENSTACK_HELM_BRANCH:-master}"
+OPENSTACK_HELM_COMMIT="${OPENSTACK_HELM_COMMIT:-5cfa1501a2e4912860f5393e81e72f37688e919f}"
+OPENSTACK_HELM_INFRA_BRANCH="${OPENSTACK_HELM_BRANCH:-master}"
+OPENSTACK_HELM_INFRA_COMMIT="${OPENSTACK_HELM_INFRA_COMMIT:-b0c34c4468633af62e88a604d6e27c53343d4686}"
+
 
 # openstack-helm steps to execute
 STEPS="000-install-packages 010-deploy-k8s 020-setup-client 030-ingress 040-ceph 045-ceph-ns-activate 050-mariadb 060-rabbitmq 070-memcached 080-keystone 090-heat 110-ceph-radosgateway 120-glance 140-openvswitch 150-libvirt 160-compute-kit"
@@ -36,9 +40,28 @@
   "$DIR"/cloudlab-disk-setup.sh
 fi
 
-cd ~
-[ ! -e openstack-helm-infra ] && git clone https://git.openstack.org/openstack/openstack-helm-infra.git -b "${OPENSTACK_HELM_BRANCH}"
-[ ! -e openstack-helm ] && git clone https://git.openstack.org/openstack/openstack-helm.git -b "${OPENSTACK_HELM_BRANCH}" && sed -i 's/--remote=db:Open_vSwitch,Open_vSwitch,manager_options/--remote=db:Open_vSwitch,Open_vSwitch,manager_options --remote=ptcp:6641/' openstack-helm/openvswitch/templates/bin/_openvswitch-db-server.sh.tpl
+if [ ! -e ~/openstack-helm-infra ]
+then
+  cd ~
+  git clone https://git.openstack.org/openstack/openstack-helm-infra.git -b "${OPENSTACK_HELM_INFRA_BRANCH}"
+  if [ ! -z "${OPENSTACK_HELM_INFRA_COMMIT}" ]
+  then
+    cd openstack-helm-infra
+    git reset --hard "${OPENSTACK_HELM_INFRA_COMMIT}"
+  fi
+fi
+
+if [ ! -e ~/openstack-helm ]
+then
+  cd ~
+  git clone https://git.openstack.org/openstack/openstack-helm.git -b "${OPENSTACK_HELM_BRANCH}"
+  if [ ! -z "${OPENSTACK_HELM_COMMIT}" ]
+  then
+    cd openstack-helm
+    git reset --hard "${OPENSTACK_HELM_COMMIT}"
+  fi
+  sed -i 's/--remote=db:Open_vSwitch,Open_vSwitch,manager_options/--remote=db:Open_vSwitch,Open_vSwitch,manager_options --remote=ptcp:6641/' ~/openstack-helm/openvswitch/templates/bin/_openvswitch-db-server.sh.tpl
+fi
 
 # Customizations for CORD
 cat <<EOF > /tmp/glance-cord.yaml