diff options
author | adamedx <adamedx@gmail.com> | 2016-05-06 23:26:43 -0700 |
---|---|---|
committer | nimisha <nimisha.sharad@msystechnologies.com> | 2017-02-02 18:00:35 +0530 |
commit | dd75bf444a73bc35c226aabaf4f5ea26b8528285 (patch) | |
tree | fac3274342f14f63fc72056e550b6b3f203e3b6c /lib/chef/provider/script.rb | |
parent | b9dfe0489447bc7b86daf26abf93cfef0c17140e (diff) | |
download | chef-dd75bf444a73bc35c226aabaf4f5ea26b8528285.tar.gz |
Alternate user execute resource code review feedack
Diffstat (limited to 'lib/chef/provider/script.rb')
-rw-r--r-- | lib/chef/provider/script.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/chef/provider/script.rb b/lib/chef/provider/script.rb index 3f89672f21..5df31786bd 100644 --- a/lib/chef/provider/script.rb +++ b/lib/chef/provider/script.rb @@ -67,17 +67,21 @@ class Chef end def set_owner_and_group - # FileUtils itself implements a no-op if +user+ or +group+ are nil - # You can prove this by running FileUtils.chown(nil,nil,'/tmp/file') - # as an unprivileged user. if ! Chef::Platform.windows? + # FileUtils itself implements a no-op if +user+ or +group+ are nil + # You can prove this by running FileUtils.chown(nil,nil,'/tmp/file') + # as an unprivileged user. FileUtils.chown(new_resource.user, new_resource.group, script_file.path) else + # And on Windows also this is a no-op if there is no user specified. grant_alternate_user_read_access end end def grant_alternate_user_read_access + # Do nothing if an alternate user isn't specified -- the file + # will already have the correct permissions for the user as part + # of the default ACL behavior on Windows. return if new_resource.user.nil? # Duplicate the script file's existing DACL |