diff options
author | elijah <elijah@riseup.net> | 2013-07-29 17:12:28 -0700 |
---|---|---|
committer | elijah <elijah@riseup.net> | 2013-07-29 17:12:28 -0700 |
commit | 9ac4380bc1c6c4c88392c371cd3f4b306c3879d9 (patch) | |
tree | 8b5f270830b855ef5962643717827890610d7637 | |
parent | 701c66c8de081f8148ab63c09f52fe97b122f54a (diff) |
try::file bugfixes -- add refreshonly to chmod/chown, ensure old file is replaced even if it is a link
-rw-r--r-- | puppet/modules/try/manifests/file.pp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/puppet/modules/try/manifests/file.pp b/puppet/modules/try/manifests/file.pp index 4cefef2f..56a7c997 100644 --- a/puppet/modules/try/manifests/file.pp +++ b/puppet/modules/try/manifests/file.pp @@ -10,6 +10,7 @@ # * $restore does not work for directories # * only file:// $source is supported # * $content is not supported, only $target or $source. +# * does not auto-require all the parent directories like 'file' does # define try::file ( $ensure = undef, @@ -32,14 +33,17 @@ define try::file ( "chmod_${name}": command => "/bin/chmod -R ${mode} '${name}'", onlyif => "/usr/bin/test $mode", + refreshonly => true, loglevel => debug; "chown_${name}": command => "/bin/chown -R ${owner} '${name}'", onlyif => "/usr/bin/test $owner", + refreshonly => true, loglevel => debug; "chgrp_${name}": command => "/bin/chgrp -R ${group} '${name}'", onlyif => "/usr/bin/test $group", + refreshonly => true, loglevel => debug; } @@ -67,9 +71,9 @@ define try::file ( } } else { exec { "cp_${name}": - command => "/bin/cp '${source}' '${name}'", + command => "/bin/cp --remove-destination '${source}' '${name}'", onlyif => "/usr/bin/test -e '${source}'", - unless => "/usr/bin/diff -q '${source}' '${name}'", + unless => "/usr/bin/test ! -h '${name}' && /usr/bin/diff -q '${source}' '${name}'", notify => [Exec["chmod_${name}"], Exec["chown_${name}"], Exec["chgrp_${name}"]] } } |