lib/beaker-pe/install/pe_utils.rb in beaker-pe-2.11.24 vs lib/beaker-pe/install/pe_utils.rb in beaker-pe-2.12.0

- old
+ new

@@ -376,12 +376,12 @@ def fetch_pe_on_unix(host, opts) path = host['pe_dir'] || opts[:pe_dir] local = File.directory?(path) filename = "#{host['dist']}" if local - extension = File.exists?("#{path}/#{filename}.tar.gz") ? ".tar.gz" : ".tar" - if not File.exists?("#{path}/#{filename}#{extension}") + extension = File.exist?("#{path}/#{filename}.tar.gz") ? ".tar.gz" : ".tar" + unless File.exist?("#{path}/#{filename}#{extension}") raise "attempting installation on #{host}, #{path}/#{filename}#{extension} does not exist" end scp_to host, "#{path}/#{filename}#{extension}", "#{host['working_dir']}/#{filename}#{extension}" if extension =~ /gz/ on host, "cd #{host['working_dir']}; gunzip #{filename}#{extension}" @@ -402,19 +402,26 @@ end if host['platform'] =~ /eos/ host.get_remote_file("#{path}/#{filename}#{extension}") else - unpack = 'tar -xvf -' - unpack = extension =~ /gz/ ? 'gunzip | ' + unpack : unpack if opts[:fetch_local_then_push_to_host] fetch_and_push_pe(host, path, filename, extension) command_file_push = 'cat ' else curlopts = opts[:use_proxy] ? "--proxy #{opts[:proxy_hostname]}:3128 " : "" - command_file_push = "curl -L #{curlopts}#{path}/" + command_file_push = "curl --fail --location --output #{filename}#{extension} #{curlopts}#{path}/" end - on host, "cd #{host['working_dir']}; #{command_file_push}#{filename}#{extension} | #{unpack}" + + retry_requirements = { + desired_exit_codes: [0], + max_retries: 3, + verbose: 'true' + } + fetch_tarball_command = "cd #{host['working_dir']}; #{command_file_push}#{filename}#{extension}" + retry_on(host, fetch_tarball_command, retry_requirements) + on host, "cd #{host['working_dir']}; tar -xvf #{filename}#{extension}" + gpg_key_overwrite(host, 'tarball') end end end