summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2021-09-22 15:56:51 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2021-09-22 15:56:51 -0700
commit78bff4860f2b6e12d4d49db37ed604bdecc49750 (patch)
tree2ae567e3ffc74bcccb7a8236423bed08a682aea2
parentd8dea6c5328e07d1093d0caa9f06acdb1b60abf5 (diff)
downloadchef-78bff4860f2b6e12d4d49db37ed604bdecc49750.tar.gz
add examples to remote_file
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
-rw-r--r--lib/chef/resource/remote_file.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/chef/resource/remote_file.rb b/lib/chef/resource/remote_file.rb
index 226cc1c0aa..774ca25af4 100644
--- a/lib/chef/resource/remote_file.rb
+++ b/lib/chef/resource/remote_file.rb
@@ -34,6 +34,36 @@ class Chef
description "Use the **remote_file** resource to transfer a file from a remote location using file specificity. This resource is similar to the **file** resource. Note: Fetching files from the `files/` directory in a cookbook should be done with the **cookbook_file** resource."
+ examples <<~DOC
+ **Download a file from an http server**:
+
+ ```ruby
+ remote_file '/tmp/remote.txt' do
+ source 'https://example.org/remote.txt'
+ end
+ ```
+
+ **Set Chef::HTTP options and configure the Net::HTTP object**
+
+ ```ruby
+ remote_file '/tmp/remote.txt' do
+ source 'https://example.org/remote.txt'
+ http_options({
+ http_retry_delay: 0,
+ http_retry_count: 0,
+ keepalives: false,
+ nethttp: {
+ continue_timeout: 5,
+ max_retries: 5,
+ read_timeout: 5,
+ write_timeout: 5,
+ ssl_timeout: 5,
+ },
+ })
+ end
+ ```
+ DOC
+
def initialize(name, run_context = nil)
super
@source = []