]> gitweb.fluxo.info Git - puppet-bootstrap.git/commitdiff
Deploy: apply patches before deployment
authorSilvio Rhatto <rhatto@riseup.net>
Mon, 26 Oct 2015 16:08:14 +0000 (14:08 -0200)
committerSilvio Rhatto <rhatto@riseup.net>
Mon, 26 Oct 2015 16:08:14 +0000 (14:08 -0200)
bin/deploy
files/patches/trusty/puppet-stack-level.md [moved from files/patches/README.md with 65% similarity]
files/patches/trusty/puppet-stack-level.patch [moved from files/patches/puppet-stack-level-trusty.patch with 100% similarity]

index 8d296e99621ad6abfe9713c8d545e7a76842eb35..22e3ea8937e1f02769ebd8f635e1f5a474fa0c37 100755 (executable)
@@ -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"
similarity index 65%
rename from files/patches/README.md
rename to files/patches/trusty/puppet-stack-level.md
index 649bdf6e3c5a710aeffe499bf6e72bfa0a36c476..9a3f4d7b4c1dcc75537fb489bee1dad7dc9ed9ae 100644 (file)
@@ -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).