1 Puppet::Type.type(:archive).provide(:wget, parent: :ruby) do
4 def wget_params(params)
5 params += optional_switch(resource[:username], ['--user=%s'])
6 params += optional_switch(resource[:password], ['--password=%s'])
7 params += optional_switch(resource[:cookie], ['--header="Cookie: %s"'])
8 params += optional_switch(resource[:proxy_server], ['-e use_proxy=yes', "-e #{resource[:proxy_type]}_proxy=#{resource[:proxy_server]}"])
9 params += ['--no-check-certificate'] if resource[:allow_insecure]
10 params += resource[:download_options] if resource[:download_options]
15 def download(filepath)
18 Shellwords.shellescape(resource[:source]),
26 # Do NOT use wget(params) until https://tickets.puppetlabs.com/browse/PUP-6066 is resolved.
27 command = "wget #{params.join(' ')}"
28 Puppet::Util::Execution.execute(command)
35 Shellwords.shellescape(resource[:checksum_url]),
40 command = "wget #{params.join(' ')}"
41 Puppet::Util::Execution.execute(command)[%r{\b[\da-f]{32,128}\b}i]