From fc08d8d4e96fb638e3ac8c2a50c973322c278d84 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Mon, 26 Oct 2015 14:08:14 -0200 Subject: Deploy: apply patches before deployment --- bin/deploy | 23 +++++++++++++++++++++++ files/patches/README.md | 4 ---- files/patches/puppet-stack-level-trusty.patch | 15 --------------- files/patches/trusty/puppet-stack-level.md | 3 +++ files/patches/trusty/puppet-stack-level.patch | 15 +++++++++++++++ 5 files changed, 41 insertions(+), 19 deletions(-) delete mode 100644 files/patches/README.md delete mode 100644 files/patches/puppet-stack-level-trusty.patch create mode 100644 files/patches/trusty/puppet-stack-level.md create mode 100644 files/patches/trusty/puppet-stack-level.patch 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/README.md deleted file mode 100644 index 649bdf6..0000000 --- a/files/patches/README.md +++ /dev/null @@ -1,4 +0,0 @@ -Patches -======= - -* [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. diff --git a/files/patches/puppet-stack-level-trusty.patch b/files/patches/puppet-stack-level-trusty.patch deleted file mode 100644 index 1d112f7..0000000 --- a/files/patches/puppet-stack-level-trusty.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- /usr/lib/ruby/vendor_ruby/puppet/rails/resource.rb.orig 2015-10-19 17:19:13.500193213 -0200 -+++ /usr/lib/ruby/vendor_ruby/puppet/rails/resource.rb 2015-10-19 17:19:58.972194943 -0200 -@@ -84,7 +84,11 @@ - end - - def [](param) -- super || parameter(param) -+ if param == 'id' -+ super -+ else -+ super || parameter(param) -+ end - end - - # Make sure this resource is equivalent to the provided Parser resource. diff --git a/files/patches/trusty/puppet-stack-level.md b/files/patches/trusty/puppet-stack-level.md new file mode 100644 index 0000000..9a3f4d7 --- /dev/null +++ b/files/patches/trusty/puppet-stack-level.md @@ -0,0 +1,3 @@ +# 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). diff --git a/files/patches/trusty/puppet-stack-level.patch b/files/patches/trusty/puppet-stack-level.patch new file mode 100644 index 0000000..1d112f7 --- /dev/null +++ b/files/patches/trusty/puppet-stack-level.patch @@ -0,0 +1,15 @@ +--- /usr/lib/ruby/vendor_ruby/puppet/rails/resource.rb.orig 2015-10-19 17:19:13.500193213 -0200 ++++ /usr/lib/ruby/vendor_ruby/puppet/rails/resource.rb 2015-10-19 17:19:58.972194943 -0200 +@@ -84,7 +84,11 @@ + end + + def [](param) +- super || parameter(param) ++ if param == 'id' ++ super ++ else ++ super || parameter(param) ++ end + end + + # Make sure this resource is equivalent to the provided Parser resource. -- cgit v1.2.3