Skip to content

Instantly share code, notes, and snippets.

@rchrd2
Created June 22, 2014 21:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rchrd2/bc6f8f17705c00b19481 to your computer and use it in GitHub Desktop.
Save rchrd2/bc6f8f17705c00b19481 to your computer and use it in GitHub Desktop.
example puppet unless for git changes
exec { 'pull-changes':
# This unless command makes it so this exec only runs when the branch is behind the head
unless => [
"/bin/bash -c 'cd /var/www/django/django \
&& CURRBRANCH=$(/usr/bin/git rev-parse --abbrev-ref HEAD)\
&& /usr/bin/git fetch origin \$CURRBRANCH \
&& /usr/bin/git rev-list HEAD...origin/\$CURRBRANCH --count'\
| /bin/grep '0'"
],
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment