diff options
author | danielsdeleo <dan@opscode.com> | 2013-05-24 12:22:52 -0700 |
---|---|---|
committer | danielsdeleo <dan@opscode.com> | 2013-05-24 14:02:27 -0700 |
commit | 18259659df47983e52fd46c9a3c1656064c1361e (patch) | |
tree | 57596a6c918e05086e61bfe406ed3ad90b7df17c /lib/chef/provider/remote_file | |
parent | 7d6934e297a11354650529e6e3030f7a731818e0 (diff) | |
download | chef-18259659df47983e52fd46c9a3c1656064c1361e.tar.gz |
remove non-functional conditional fetch from local file
Local file's conditional fetch was based around the previous API where
the remote file provider set the last updated time. This was removed
because of issues with multiple URL/mirroring support.
Diffstat (limited to 'lib/chef/provider/remote_file')
-rw-r--r-- | lib/chef/provider/remote_file/local_file.rb | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/lib/chef/provider/remote_file/local_file.rb b/lib/chef/provider/remote_file/local_file.rb index c0f3af2495..233076ceb6 100644 --- a/lib/chef/provider/remote_file/local_file.rb +++ b/lib/chef/provider/remote_file/local_file.rb @@ -28,34 +28,18 @@ class Chef attr_reader :uri attr_reader :new_resource - attr_reader :last_modified def initialize(uri, new_resource, current_resource) @new_resource = new_resource - if current_resource.source && Util.uri_matches_string?(uri, current_resource.source[0]) - if new_resource.use_last_modified && current_resource.last_modified - Chef::Log.debug("#{new_resource} read last_modified time of #{current_resource.last_modified.strftime("%a, %d %b %Y %H:%M:%S %Z")}") - @last_modified = current_resource.last_modified - end - end @uri = uri end # Fetches the file at uri, returning a Tempfile-like File handle def fetch - mtime = ::File.mtime(uri.path) - Chef::Log.debug("#{new_resource} read mtime of #{mtime.strftime("%a, %d %b %Y %H:%M:%S %Z")} for #{uri.path}") - tempfile = - if mtime && last_modified && mtime.to_i <= last_modified.to_i - Chef::Log.debug("#{new_resource} mtime on #{uri.path} has not been updated, not deploying") - nil - else - tempfile = Chef::FileContentManagement::Tempfile.new(new_resource).tempfile - Chef::Log.debug("#{new_resource} staging #{uri.path} to #{tempfile.path}") - FileUtils.cp(uri.path, tempfile.path) - tempfile - end - return Chef::Provider::RemoteFile::Result.new(tempfile, nil, mtime) + tempfile = Chef::FileContentManagement::Tempfile.new(new_resource).tempfile + Chef::Log.debug("#{new_resource} staging #{uri.path} to #{tempfile.path}") + FileUtils.cp(uri.path, tempfile.path) + Chef::Provider::RemoteFile::Result.new(tempfile, nil, nil) end end |