From 1a20a28119b245054d8d4c6ebd4230b61b1bf901 Mon Sep 17 00:00:00 2001 From: Chris Dent Date: Thu, 29 May 2014 11:10:06 +0100 Subject: [PATCH] safely handle git clone from alien directory git clone can experience permission errors if called from a cwd which is not the parent of the target for the clone. This is hard to replicate, but seems to have something to do with the underlying user executing puppet not being 'stack' (e.g. 'vagrant'). When the user is 'stack' the cwd is probably /home/stack anyway. In any case, this fixes it. --- puppet/modules/base/files/git_clone.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/puppet/modules/base/files/git_clone.sh b/puppet/modules/base/files/git_clone.sh index 485978a..25325b6 100755 --- a/puppet/modules/base/files/git_clone.sh +++ b/puppet/modules/base/files/git_clone.sh @@ -46,6 +46,9 @@ function git_clone { local GIT_DEST=$2 local GIT_REF=$3 + # Avoid git exiting when in some other dir than the typical /home/stack + cd $(dirname $GIT_DEST) + # do a full clone only if the directory doesn't exist if [[ ! -d $GIT_DEST ]]; then git_timed clone $GIT_REMOTE $GIT_DEST