aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2015-10-26 14:08:14 -0200
committerSilvio Rhatto <rhatto@riseup.net>2015-10-26 14:08:14 -0200
commitfc08d8d4e96fb638e3ac8c2a50c973322c278d84 (patch)
tree11e187c89788959beabfc573117b04e4ab237f4f
parent89cc9aa997958d7c19e6453699ffdc48a118038b (diff)
downloadpuppet-bootstrap-fc08d8d4e96fb638e3ac8c2a50c973322c278d84.tar.gz
puppet-bootstrap-fc08d8d4e96fb638e3ac8c2a50c973322c278d84.tar.bz2
Deploy: apply patches before deployment
-rwxr-xr-xbin/deploy23
-rw-r--r--files/patches/trusty/puppet-stack-level.md (renamed from files/patches/README.md)5
-rw-r--r--files/patches/trusty/puppet-stack-level.patch (renamed from files/patches/puppet-stack-level-trusty.patch)0
3 files changed, 25 insertions, 3 deletions
diff --git a/bin/deploy b/bin/deploy
index 8d296e9..22e3ea8 100755
--- a/bin/deploy
+++ b/bin/deploy
@@ -33,6 +33,29 @@ for package in $DEPLOY_DEPENDENCIES; do
provision_package $package
done
+# Parameters that needed dependencies installed
+DIST="`facter lsbdistcodename`"
+
+# Apply patches
+if [ -d "$BASEDIR/puppet/files/patches/$DIST" ]; then
+ (
+ # Patches should be generated relativelly to the root folder
+ cd /
+
+ # Only apply if needed
+ # Thanks https://unix.stackexchange.com/questions/55780/check-if-a-file-or-folder-has-been-patched-already
+ for patch in `ls $BASEDIR/puppet/files/patches/$DIST`; do
+ patch -p0 -N --dry-run --silent < $patch 2> /dev/null
+ # If the patch has not been applied then the $? which is the exit status
+ # for last command would have a success status code = 0
+ if [ "$?" == "0" ]; then
+ # Apply the patch
+ patch -p0 -N < $patch
+ fi
+ done
+ )
+fi
+
# Run puppet apply
PUPPET_OPTS="--confdir=$BASEDIR/puppet --modulepath=$BASEDIR/puppet/modules"
$SUDO LC_ALL=C puppet apply $PUPPET_OPTS $PUPPET_MANIFEST"
diff --git a/files/patches/README.md b/files/patches/trusty/puppet-stack-level.md
index 649bdf6..9a3f4d7 100644
--- a/files/patches/README.md
+++ b/files/patches/trusty/puppet-stack-level.md
@@ -1,4 +1,3 @@
-Patches
-=======
+# Puppet stack level patch
-* [Puppet master fails with 'stack level too deep' error when storeconfigs = true](https://bugs.launchpad.net/ubuntu/+source/puppet/+bug/1313595): puppet-stack-level-trusty.patch.
+* [Puppet master fails with 'stack level too deep' error when storeconfigs = true](https://bugs.launchpad.net/ubuntu/+source/puppet/+bug/1313595).
diff --git a/files/patches/puppet-stack-level-trusty.patch b/files/patches/trusty/puppet-stack-level.patch
index 1d112f7..1d112f7 100644
--- a/files/patches/puppet-stack-level-trusty.patch
+++ b/files/patches/trusty/puppet-stack-level.patch