From 9ac4380bc1c6c4c88392c371cd3f4b306c3879d9 Mon Sep 17 00:00:00 2001 From: elijah Date: Mon, 29 Jul 2013 17:12:28 -0700 Subject: try::file bugfixes -- add refreshonly to chmod/chown, ensure old file is replaced even if it is a link --- puppet/modules/try/manifests/file.pp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'puppet/modules/try') 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}"]] } } -- cgit v1.2.3