summaryrefslogtreecommitdiff
path: root/lib/chef/provider/file.rb
diff options
context:
space:
mode:
authorLamont Granquist <lamont@opscode.com>2013-03-18 16:50:30 -0700
committerLamont Granquist <lamont@opscode.com>2013-03-18 16:50:30 -0700
commit277ad361a77d2b7bb8c196046f170d3c83ef76ab (patch)
tree45b0453646a87a8c0d1fb271459259bf374a794f /lib/chef/provider/file.rb
parenta70ae4a83d217617d598ee6685ef1721ef246b4b (diff)
downloadchef-277ad361a77d2b7bb8c196046f170d3c83ef76ab.tar.gz
avoid trying to load current modes if the file does not exist
Diffstat (limited to 'lib/chef/provider/file.rb')
-rw-r--r--lib/chef/provider/file.rb8
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/chef/provider/file.rb b/lib/chef/provider/file.rb
index b21651ee05..db06c8f53b 100644
--- a/lib/chef/provider/file.rb
+++ b/lib/chef/provider/file.rb
@@ -61,7 +61,9 @@ class Chef
@current_resource ||= Chef::Resource::File.new(@new_resource.name)
@new_resource.path.gsub!(/\\/, "/") # for Windows
@current_resource.path(@new_resource.path)
- load_resource_attributes_from_file(@current_resource)
+ if ::File.exists?(@current_resource.path)
+ load_resource_attributes_from_file(@current_resource)
+ end
@current_resource
end
@@ -219,9 +221,6 @@ class Chef
checksum.slice(0,6)
end
- # if you are using a tempfile before creating, you must
- # override the default with the tempfile, since the
- # file at @new_resource.path will not be updated on converge
def load_resource_attributes_from_file(resource)
if resource.respond_to?(:checksum)
if ::File.exists?(resource.path) && !::File.directory?(resource.path)
@@ -237,7 +236,6 @@ class Chef
# Windows.
return
end
-
acl_scanner = ScanAccessControl.new(@new_resource, resource)
acl_scanner.set_all!
end