diff --git a/bin/prepare-vagrant-conf b/bin/prepare-vagrant-conf --- a/bin/prepare-vagrant-conf +++ b/bin/prepare-vagrant-conf @@ -7,21 +7,25 @@ FACTS_DIR="${OCD_BASE}/facts" function usage { - echo "usage: $0 [-b/--branch branch]" + echo "usage: $0 [-b/--branch branch] [-t/--tmpdir tmp-dir] " } -CLEAN_TMPDIR=true USE_REMOTE_REPOS=false FROM=production TO=staging HOSTS=() OCTOCATALOG_DIFF_ARGS= R10K_ARGS= -CLEAN_TMPDIR=false UNCOMMITTED=false +# default value +TMPDIR=/var/tmp/puppet while (( "$#" )); do case "$1" in + -t|--tmpdir) + TMPDIR=$2 + shift + ;; -b|--branch) BRANCH=$2 shift @@ -36,9 +40,8 @@ shift done -TMPDIR=/tmp/puppet -mkdir -p /tmp/puppet -rm -rf /tmp/puppet/environments/ +mkdir -p $TMPDIR +rm -rf $TMPDIR/environments/ function template { sed -e "s#@PUPPET_ENV@#${PUPPET_ENV}#g" -e "s#@TMPDIR@#${TMPDIR}#g" $1 > $2 diff --git a/bin/sync-vagrant-conf b/bin/sync-vagrant-conf --- a/bin/sync-vagrant-conf +++ b/bin/sync-vagrant-conf @@ -8,9 +8,10 @@ set -ex WD=$(dirname $0) +TMPDIR=${1-/var/tmp/puppet} -if [ ! -d /tmp/puppet ]; then - $WD/prepare-vagrant-conf +if [ ! -d $TMPDIR ]; then + $WD/prepare-vagrant-conf --tmpdir $TMPDIR fi -$WD/watch-vagrant-conf +$WD/watch-vagrant-conf $TMPDIR diff --git a/bin/watch-vagrant-conf b/bin/watch-vagrant-conf --- a/bin/watch-vagrant-conf +++ b/bin/watch-vagrant-conf @@ -2,6 +2,7 @@ set -e +TMPDIR=${1-/var/tmp/puppet} PUPPET_ENV=$(readlink -f $(dirname $0)/..) RSYNC_PARAMS="-a --progress" @@ -17,9 +18,9 @@ function sync_puppet_conf { branch=$1 - rsync $RSYNC_PARAMS $EXCLUDES_PARAMS swh-site/data/ /tmp/puppet/environments/${branch}/data - rsync $RSYNC_PARAMS $EXCLUDES_PARAMS swh-site/site-modules/ /tmp/puppet/environments/${branch}/site-modules/ - rsync $RSYNC_PARAMS $EXCLUDES_PARAMS private/swh-private-data-censored/ /tmp/puppet/environments/${branch}/data/private + rsync $RSYNC_PARAMS $EXCLUDES_PARAMS swh-site/data/ $TMPDIR/environments/${branch}/data + rsync $RSYNC_PARAMS $EXCLUDES_PARAMS swh-site/site-modules/ $TMPDIR/environments/${branch}/site-modules/ + rsync $RSYNC_PARAMS $EXCLUDES_PARAMS private/swh-private-data-censored/ $TMPDIR/environments/${branch}/data/private } # Initial sync