Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions lib/gooddata/rest/connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -527,14 +527,22 @@ def create_webdav_dir_if_needed(url)
def do_stream_file(uri, filename, _options = {})
GoodData.logger.info "Uploading file user storage #{uri}"

request = RestClient::Request.new(:method => :put,
:url => uri.to_s,
:verify_ssl => verify_ssl,
:headers => @webdav_headers.merge(:x_gdc_authtt => headers[:x_gdc_authtt]),
:payload => File.new(filename, 'rb'))
# Build the request inside the retryable block so that, after a token
# refresh triggered by a 401, the new x_gdc_authtt header is picked up
# and a fresh file handle is used for the retried upload.
b = proc do
request = RestClient::Request.new(:method => :put,
:url => uri.to_s,
:verify_ssl => verify_ssl,
:headers => @webdav_headers.merge(:x_gdc_authtt => headers[:x_gdc_authtt]),
:payload => File.new(filename, 'rb'))
request.execute
end

begin
request.execute
GoodData::Rest::Connection.retryable(:tries => Helpers::GD_MAX_RETRY, :refresh_token => proc { refresh_token }) do
b.call
end
rescue => e
raise "Error when uploading file #{filename}. Error: #{e}"
end
Expand Down
2 changes: 1 addition & 1 deletion spec/project/full_process_schedule_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@
end
end

xit "should be possible to download deployed process" do
it "should be possible to download deployed process" do
process = @project.deploy_process('./spec/data/hello_world_process/hello_world.zip',
type: 'RUBY',
name: 'Test ETL zipped file Process')
Expand Down
Loading