diff options
author | Pete Higgins <pete@peterhiggins.org> | 2020-06-16 10:18:44 -0700 |
---|---|---|
committer | Pete Higgins <pete@peterhiggins.org> | 2020-06-16 16:45:26 -0700 |
commit | 3144cdf8e2041ee3dde162a6ba62d852500919b2 (patch) | |
tree | 5528d826e805cf29245f63ea456a6715b6d2e226 /lib/chef/resource.rb | |
parent | 164e0a8e87f35b1752d2d3b4db58accdb7ac3a91 (diff) | |
download | chef-3144cdf8e2041ee3dde162a6ba62d852500919b2.tar.gz |
Simplify with_umask code.
Signed-off-by: Pete Higgins <pete@peterhiggins.org>
Diffstat (limited to 'lib/chef/resource.rb')
-rw-r--r-- | lib/chef/resource.rb | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/lib/chef/resource.rb b/lib/chef/resource.rb index fb743a18d2..872d0184db 100644 --- a/lib/chef/resource.rb +++ b/lib/chef/resource.rb @@ -618,17 +618,10 @@ class Chef end def with_umask - if umask.nil? - yield - return - end - - old_value = ::File.umask(umask.oct) - begin - yield - ensure - ::File.umask(old_value) - end + old_value = ::File.umask(umask.oct) if umask + yield + ensure + ::File.umask(old_value) if umask end # |