summaryrefslogtreecommitdiff
path: root/puppet/modules/site_webapp/manifests
diff options
context:
space:
mode:
Diffstat (limited to 'puppet/modules/site_webapp/manifests')
-rw-r--r--puppet/modules/site_webapp/manifests/git.pp30
-rw-r--r--puppet/modules/site_webapp/manifests/init.pp13
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 {