From c4024b72d5aeebbd814a78c741658ca50eb4dc71 Mon Sep 17 00:00:00 2001 From: Azul Date: Thu, 27 Jun 2013 11:44:31 +0200 Subject: make git forget about the changes due to symlinking files Git normally tracks the dummy files we replace with symlinks. So we tell it to ignore these changes on deploy. --- puppet/modules/site_webapp/manifests/init.pp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'puppet/modules/site_webapp') diff --git a/puppet/modules/site_webapp/manifests/init.pp b/puppet/modules/site_webapp/manifests/init.pp index 4815bab4..ba7c7e0d 100644 --- a/puppet/modules/site_webapp/manifests/init.pp +++ b/puppet/modules/site_webapp/manifests/init.pp @@ -138,6 +138,12 @@ 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' + } + file { '/srv/leap/webapp/config/config.yml': content => template('site_webapp/config.yml.erb'), -- cgit v1.2.3 From b35146bf42bae91f1211b51dba568295f8d5b8f0 Mon Sep 17 00:00:00 2001 From: Azul Date: Mon, 26 Aug 2013 12:04:14 +0200 Subject: 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. --- puppet/modules/site_webapp/manifests/git.pp | 30 ++++++++++++++++++++++++++++ puppet/modules/site_webapp/manifests/init.pp | 13 ++++++++---- 2 files changed, 39 insertions(+), 4 deletions(-) create mode 100644 puppet/modules/site_webapp/manifests/git.pp (limited to 'puppet/modules/site_webapp') 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 { -- cgit v1.2.3 From 3aa062ecb934731aa5876e60bb7c9086bcbb5742 Mon Sep 17 00:00:00 2001 From: Azul Date: Mon, 26 Aug 2013 12:21:08 +0200 Subject: specify cwd when using git:changes --- puppet/modules/site_webapp/manifests/git.pp | 5 ++++- puppet/modules/site_webapp/manifests/init.pp | 11 +++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) (limited to 'puppet/modules/site_webapp') diff --git a/puppet/modules/site_webapp/manifests/git.pp b/puppet/modules/site_webapp/manifests/git.pp index 25862707..908bc1a4 100644 --- a/puppet/modules/site_webapp/manifests/git.pp +++ b/puppet/modules/site_webapp/manifests/git.pp @@ -1,11 +1,12 @@ # Usage # git::changes { name: +# cwd => "/path/to/git/" # user => "me", # ensure => {*assume-unchanged*, tracked} # } # -define git::changes ( $user, $ensure='assume-unchanged' ) { +define git::changes ( $cwd, $user, $ensure='assume-unchanged' ) { case $ensure { default: { err ( "unknown ensure value '${ensure}'" ) } @@ -13,6 +14,7 @@ define git::changes ( $user, $ensure='assume-unchanged' ) { assume-unchanged: { exec { "assume-unchanged ${name}": command => "/usr/bin/git update-index --assume-unchanged ${name}", + cwd => $cwd, user => $user, unless => "/usr/bin/git ls-files -v | grep '^[ch] ${name}'", } @@ -21,6 +23,7 @@ define git::changes ( $user, $ensure='assume-unchanged' ) { tracked: { exec { "assume-unchanged ${name}": command => "/usr/bin/git update-index --no-assume-unchanged ${name}", + cwd => $cwd, 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 a8807a1a..4bae2088 100644 --- a/puppet/modules/site_webapp/manifests/init.pp +++ b/puppet/modules/site_webapp/manifests/init.pp @@ -138,14 +138,17 @@ class site_webapp { source => $webapp['img_dir']; } - git:changes { - '/srv/leap/webapp/app/assets/stylesheets/head.scss': + git::changes { + 'app/assets/stylesheets/head.scss': + cwd => '/srv/leap/webapp', user => 'leap-webapp'; - '/srv/leap/webapp/app/assets/stylesheets/tail.scss': + 'app/assets/stylesheets/tail.scss': + cwd => '/srv/leap/webapp', user => 'leap-webapp'; - '/srv/leap/webapp/public/favicon.ico': + 'public/favicon.ico': + cwd => '/srv/leap/webapp', user => 'leap-webapp'; } -- cgit v1.2.3 From b1a8cfe5f82f2d96514fbfacff930fdd58dec5b8 Mon Sep 17 00:00:00 2001 From: Azul Date: Tue, 27 Aug 2013 14:16:00 +0200 Subject: move git::changes into git module, whitespace fix --- puppet/modules/site_webapp/manifests/git.pp | 33 ---------------------------- puppet/modules/site_webapp/manifests/init.pp | 2 +- 2 files changed, 1 insertion(+), 34 deletions(-) delete mode 100644 puppet/modules/site_webapp/manifests/git.pp (limited to 'puppet/modules/site_webapp') diff --git a/puppet/modules/site_webapp/manifests/git.pp b/puppet/modules/site_webapp/manifests/git.pp deleted file mode 100644 index 908bc1a4..00000000 --- a/puppet/modules/site_webapp/manifests/git.pp +++ /dev/null @@ -1,33 +0,0 @@ -# Usage -# git::changes { name: -# cwd => "/path/to/git/" -# user => "me", -# ensure => {*assume-unchanged*, tracked} -# } -# - -define git::changes ( $cwd, $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}", - cwd => $cwd, - 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}", - cwd => $cwd, - 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 4bae2088..1db52477 100644 --- a/puppet/modules/site_webapp/manifests/init.pp +++ b/puppet/modules/site_webapp/manifests/init.pp @@ -138,7 +138,7 @@ class site_webapp { source => $webapp['img_dir']; } - git::changes { + git::changes { 'app/assets/stylesheets/head.scss': cwd => '/srv/leap/webapp', user => 'leap-webapp'; -- cgit v1.2.3