diff options
author | danielsdeleo <dan@opscode.com> | 2013-06-24 17:30:27 -0700 |
---|---|---|
committer | danielsdeleo <dan@opscode.com> | 2013-06-26 10:47:47 -0700 |
commit | 34dd4d4730656141889dc0cf9eee45e979b0a141 (patch) | |
tree | 6bcf1bc2e4efe24e2709aea01791f3d39632e91a /lib/chef/resource/file.rb | |
parent | 283ab69016cb7e485ffaee0836ca486144d4de94 (diff) | |
download | chef-34dd4d4730656141889dc0cf9eee45e979b0a141.tar.gz |
Allow file resources to manage files via symlink
Fixes CHEF-4312 http://tickets.opscode.com/browse/CHEF-4312
Adds resource attribute `manage_symlink_source` to file resource and
descendents. When true, file resources will manage the source file
when a symlink exists at the destination path. When nil (default), the
source file is managed, but a warning is emitted. When false, symlinks
are not followed. In Chef 12, the default should be changed to false.
Diffstat (limited to 'lib/chef/resource/file.rb')
-rw-r--r-- | lib/chef/resource/file.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/chef/resource/file.rb b/lib/chef/resource/file.rb index 879d5f0c86..15adb9dae8 100644 --- a/lib/chef/resource/file.rb +++ b/lib/chef/resource/file.rb @@ -48,6 +48,7 @@ class Chef @provider = Chef::Provider::File @atomic_update = Chef::Config[:file_atomic_update] @force_unlink = false + @manage_symlink_source = nil @diff = nil end @@ -108,6 +109,14 @@ class Chef ) end + def manage_symlink_source(arg=nil) + set_or_return( + :manage_symlink_source, + arg, + :kind_of => [ TrueClass, FalseClass ] + ) + end + end end end |