diff --git a/modules/tftp/server.rb b/modules/tftp/server.rb index 98218d8bd..2476ba78b 100644 --- a/modules/tftp/server.rb +++ b/modules/tftp/server.rb @@ -165,10 +165,11 @@ def self.fetch_boot_file(dst, src) def self.choose_protocol_and_fetch(src, destination) case URI(src).scheme when 'http', 'https', 'ftp' - ::Proxy::HttpDownload.new(src.to_s, destination.to_s, - connect_timeout: Proxy::TFTP::Plugin.settings.tftp_connect_timeout, - verify_server_cert: Proxy::TFTP::Plugin.settings.verify_server_cert).start - + thread = ::Proxy::HttpDownload.new(src.to_s, destination.to_s, + connect_timeout: Proxy::TFTP::Plugin.settings.tftp_connect_timeout, + verify_server_cert: Proxy::TFTP::Plugin.settings.verify_server_cert) + thread.start + thread when 'nfs' logger.debug "NFS as a protocol for installation medium detected." else diff --git a/modules/tftp/tftp_api.rb b/modules/tftp/tftp_api.rb index 1bc6276c7..3fc175a27 100644 --- a/modules/tftp/tftp_api.rb +++ b/modules/tftp/tftp_api.rb @@ -35,7 +35,16 @@ def create_default(variant) end post "/fetch_boot_file" do - log_halt(400, "TFTP: Failed to fetch boot file: ") { Proxy::TFTP.fetch_boot_file(params[:prefix], params[:path]) } + log_halt(400, "TFTP: Failed to fetch boot file: ") do + result = Proxy::TFTP.fetch_boot_file(params[:prefix], params[:path]) + + # fetch_boot_file may start a thread + # This waits for a bit before telling the client we've accepted it + # TODO: implement a mechanism to poll for completion + if result.respond_to(:join) + 202 unless result.join(5) + end + end end post "/:variant/create_default" do |variant|