lib/vagrant/util/uploader.rb in vagrant-unbundled-2.2.10.0 vs lib/vagrant/util/uploader.rb in vagrant-unbundled-2.2.14.0

- old
+ new

@@ -11,13 +11,15 @@ # This class uploads files using various protocols by subprocessing # to cURL. cURL is a much more capable and complete download tool than # a hand-rolled Ruby library, so we defer to its expertise. class Uploader - # @param [String] destination - valid URL to upload file to - # @param [String] file - location of file to upload on disk - # @param [Hash] options + # @param [String] destination Valid URL to upload file to + # @param [String] file Location of file to upload on disk + # @param [Hash] options + # @option options [Vagrant::UI] :ui UI interface for output + # @option options [String, Symbol] :method Request method for upload def initialize(destination, file, options=nil) options ||= {} @logger = Log4r::Logger.new("vagrant::util::uploader") @destination = destination.to_s @file = file.to_s @@ -25,10 +27,11 @@ @request_method = options[:method] if !@request_method @request_method = "PUT" end + @request_method = @request_method.to_s.upcase end def upload! data_proc = Vagrant::Util::CurlHelper.capture_output_proc(@logger, @ui) @@ -49,10 +52,10 @@ end protected def build_options - options = [@destination, "--request", @request_method, "--upload-file", @file] + options = [@destination, "--request", @request_method, "--upload-file", @file, "--fail"] return options end def execute_curl(options, subprocess_options, &data_proc) options = options.dup