summaryrefslogtreecommitdiff
path: root/lib/chef/resource/remote_file.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chef/resource/remote_file.rb')
-rw-r--r--lib/chef/resource/remote_file.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/chef/resource/remote_file.rb b/lib/chef/resource/remote_file.rb
index 524e00186b..df055ab6b4 100644
--- a/lib/chef/resource/remote_file.rb
+++ b/lib/chef/resource/remote_file.rb
@@ -33,6 +33,8 @@ class Chef
@resource_name = :remote_file
@action = "create"
@source = []
+ @etag = nil
+ @last_modified = nil
@ftp_active_mode = false
@provider = Chef::Provider::RemoteFile
end
@@ -55,6 +57,31 @@ class Chef
)
end
+ def etag(args=nil)
+ # Only store the etag itself, skip the quotes (and leading W/ if it's there)
+ if args.is_a?(String) && args.include?('"')
+ args = args.split('"')[1]
+ end
+ set_or_return(
+ :etag,
+ args,
+ :kind_of => String
+ )
+ end
+
+ def last_modified(args=nil)
+ if args.is_a?(String)
+ args = Time.parse(args).gmtime
+ elsif args.is_a?(Time)
+ args.gmtime
+ end
+ set_or_return(
+ :last_modified,
+ args,
+ :kind_of => Time
+ )
+ end
+
def ftp_active_mode(args=nil)
set_or_return(
:ftp_active_mode,