diff options
author | Azul <azul@riseup.net> | 2013-08-26 12:04:14 +0200 |
---|---|---|
committer | Azul <azul@riseup.net> | 2013-08-27 14:16:54 +0200 |
commit | b35146bf42bae91f1211b51dba568295f8d5b8f0 (patch) | |
tree | 762a556e4bec271ee57f22c975d0d6ad1d68d5e7 /puppet/modules/site_webapp | |
parent | c4024b72d5aeebbd814a78c741658ca50eb4dc71 (diff) |
git:changes expect changes to certain files
You can either ensure assume-unchanged or ensure those changes are tracked.
Used to keep the git status clean.
Diffstat (limited to 'puppet/modules/site_webapp')
-rw-r--r-- | puppet/modules/site_webapp/manifests/git.pp | 30 | ||||
-rw-r--r-- | puppet/modules/site_webapp/manifests/init.pp | 13 |
2 files changed, 39 insertions, 4 deletions
diff --git a/puppet/modules/site_webapp/manifests/git.pp b/puppet/modules/site_webapp/manifests/git.pp new file mode 100644 index 00000000..25862707 --- /dev/null +++ b/puppet/modules/site_webapp/manifests/git.pp @@ -0,0 +1,30 @@ +# Usage +# git::changes { name: +# user => "me", +# ensure => {*assume-unchanged*, tracked} +# } +# + +define git::changes ( $user, $ensure='assume-unchanged' ) { + + case $ensure { + default: { err ( "unknown ensure value '${ensure}'" ) } + + assume-unchanged: { + exec { "assume-unchanged ${name}": + command => "/usr/bin/git update-index --assume-unchanged ${name}", + user => $user, + unless => "/usr/bin/git ls-files -v | grep '^[ch] ${name}'", + } + } + + tracked: { + exec { "assume-unchanged ${name}": + command => "/usr/bin/git update-index --no-assume-unchanged ${name}", + user => $user, + onlyif => "/usr/bin/git ls-files -v | grep '^[ch] ${name}'", + } + } + } +} + diff --git a/puppet/modules/site_webapp/manifests/init.pp b/puppet/modules/site_webapp/manifests/init.pp index ba7c7e0d..a8807a1a 100644 --- a/puppet/modules/site_webapp/manifests/init.pp +++ b/puppet/modules/site_webapp/manifests/init.pp @@ -138,10 +138,15 @@ class site_webapp { source => $webapp['img_dir']; } - exec { 'git-assume-unchanged': - cwd => '/srv/leap/webapp', - command => '/bin/bash -c "/usr/bin/git update-index --assume-unchanged app/assets/stylesheets/head.scss app/assets/stylesheets/tail.scss public/favicon.ico"', - user => 'leap-webapp' + git:changes { + '/srv/leap/webapp/app/assets/stylesheets/head.scss': + user => 'leap-webapp'; + + '/srv/leap/webapp/app/assets/stylesheets/tail.scss': + user => 'leap-webapp'; + + '/srv/leap/webapp/public/favicon.ico': + user => 'leap-webapp'; } file { |