diff options
author | Phil Dibowitz <phil@ipom.com> | 2019-04-25 11:11:10 -0700 |
---|---|---|
committer | Phil Dibowitz <phil@ipom.com> | 2019-04-29 11:16:20 -0700 |
commit | 9ea76290936316ce6fe2d40621581210b2006572 (patch) | |
tree | 1a8c9d00ea427a307f1c955d27581edfa9c59498 /lib/chef/win32 | |
parent | da8bc7a3a5bad59fe5f228d7d0c272ea1e2c469b (diff) | |
download | chef-9ea76290936316ce6fe2d40621581210b2006572.tar.gz |
Tell people what file a link is pointing at.
In the event you are managing a file `/etc/file` with a `file` resource,
but it turns out to be a link to `/etc/passwd` and you are trying to figure
out what overwrite `/etc/passwd`, there is no indication in the logs. Let's add
one.
Signed-off-by: Phil Dibowitz <phil@ipom.com>
Diffstat (limited to 'lib/chef/win32')
-rw-r--r-- | lib/chef/win32/file.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/chef/win32/file.rb b/lib/chef/win32/file.rb index 03d4496fa8..422cc194dc 100644 --- a/lib/chef/win32/file.rb +++ b/lib/chef/win32/file.rb @@ -89,6 +89,14 @@ class Chef is_symlink end + def self.realpath(file_name) + if symlink?(file_name) + readlink(file_name) + else + file_name + end + end + # Returns the path of the of the symbolic link referred to by +file+. # # Requires Windows Vista or later. On older versions of Windows it |