Project

Profile

Help

Issue #4896

[Ruby client] Chunked Uploads API doesn't recognize file parameter

Added by sajha 5 months ago. Updated 2 months ago.

Status:
MODIFIED
Priority:
Normal
Category:
-
Sprint/Milestone:
-
Start date:
Due date:
Severity:
1. Low
Version:
Platform Release:
Blocks Release:
OS:
Backwards Incompatible:
No
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Katello-P1
QA Contact:
Complexity:
Smash Test:
Verified:
No
Verification Required:
No
Sprint:
Sprint 56

Description

The Pulpcore API client has the UploadsAPI method uploads_create

For the below inputs:

file = File.new("/path/to/file")
file_chunk_string = "Random String chunk"

The calls below produce the following requests:

pulp3_api.uploads_create(file)

HTTP Request formed:
2019-05-31T02:18:09 [D|kat|] Calling API: UploadsApi.uploads_create ...
2019-05-31T02:18:09 [D|kat|] HTTP request body param ~BEGIN~
 | {"file"=>#<File:/home/vagrant/katello/Gemfile>}
 | ~END~

pulp3_api.uploads_create(file_chunk_string)

HTTP Request formed:
2019-05-31T02:18:09 [D|kat|] Calling API: UploadsApi.uploads_create ...
2019-05-31T02:18:09 [D|kat|] HTTP request body param ~BEGIN~
 | {"file"=>"Random String chunk"}
 | ~END~

In both cases, server returns:

PulpcoreClient::ApiError (Error message: the server returns an error)
HTTP status code: 400
Response headers: {"Server"=>"nginx/1.12.1", "Date"=>"Fri, 31 May 2019 02:18:10 GMT", "Content-Type"=>"application/json", "Content-Length"=>"40", "Connection"=>"keep-alive", "Vary"=>"Accept, Cookie", "Allow"=>"GET, POST, PUT, HEAD, OPTIONS", "X-Frame-Options"=>"SAMEORIGIN"}
Response body: {"detail":"No chunk file was submitted"}

PS:

The UploadsAPI has another method uploads_create_and_check which works with file (file = File.new("/path/to/file")) as an input.


Related issues

Related to Pulp - Story #4196: As a user, I can upload files in chunks. MODIFIED Actions
Related to Pulp - Test #4197: Test upload of large artifacts NEW Actions

Associated revisions

Revision 8487f0ed View on GitHub
Added by dkliban@redhat.com 4 months ago

Problem: OpenAPI schema for Uploads APIs is wrong

Solution: Add Content-Range header to the OpenAPI schema

Required PR: https://github.com/pulp/pulp-openapi-generator/pull/17

fixes: #4896
https://pulp.plan.io/issues/4896

Revision c2b713f3 View on GitHub
Added by dkliban@redhat.com 4 months ago

Problem: Uploads API bindings are not tested

Solution: Add a test for Uploads API bindings

Required PR: https://github.com/pulp/pulpcore/pull/168

re: #4896
https://pulp.plan.io/issues/4896

Revision 028b3332 View on GitHub
Added by dkliban@redhat.com 3 months ago

Problem: ruby client can't form-encode PUT requests

Solution: switch ruby client to use Faraday

This patch relies on a forked version of the openapi-generator-cli. Once the PR that
introduces this functionality is merged into openapi-generator, the ruby client
generation should be switched back to using the docker container for openapi-generator.

https://github.com/OpenAPITools/openapi-generator/pull/3405

Required PR: https://github.com/pulp/pulpcore/pull/226

re: #4896
https://pulp.plan.io/issues/4896

Revision d7489f6e View on GitHub
Added by dkliban@redhat.com 3 months ago

Problem: no script for testing Ruby bindings

Solution: add a script for testing with Ruby bindings

re: #4896
https://pulp.plan.io/issues/4896

Revision 7a3b7372 View on GitHub
Added by dkliban@redhat.com 3 months ago

Problem: ruby client is not tested

Solution: run the .travis/test_bindings.rb with each PR

re: #4896
https://pulp.plan.io/issues/4896

History

#1 Updated by amacdona@redhat.com 5 months ago

  • Triaged changed from No to Yes
  • Sprint set to Sprint 53

#2 Updated by kersom 5 months ago

  • Related to Story #4196: As a user, I can upload files in chunks. added

#3 Updated by kersom 5 months ago

  • Related to Test #4197: Test upload of large artifacts added

#4 Updated by amacdona@redhat.com 5 months ago

  • Sprint changed from Sprint 53 to Sprint 54

#5 Updated by dkliban@redhat.com 4 months ago

  • Status changed from NEW to ASSIGNED
  • Assignee set to dkliban@redhat.com

#7 Updated by dkliban@redhat.com 4 months ago

  • Status changed from POST to MODIFIED

#8 Updated by dkliban@redhat.com 4 months ago

  • Status changed from MODIFIED to ASSIGNED

The original problem reported still exists. This is only a problem for Ruby bindings. I filed an issue0 against openapi-generator after finding an existing issue1 in the library used to make requests in the Ruby client.

[0] https://github.com/OpenAPITools/openapi-generator/issues/3138
[1] https://github.com/typhoeus/typhoeus/issues/389

#9 Updated by dkliban@redhat.com 4 months ago

  • Subject changed from Chunked Uploads API doesn't recognize file parameter to [Ruby client] Chunked Uploads API doesn't recognize file parameter

#10 Updated by ttereshc 4 months ago

  • Sprint changed from Sprint 54 to Sprint 55

#11 Updated by jsherril@redhat.com 4 months ago

  • Tags Katello-P2 added
  • Tags deleted (Katello-P4)

#12 Updated by sajha 3 months ago

So I am seeing this on the latest dev box: Here are the steps to reproduce: https://gist.github.com/sjha4/65078285778b3d80891202ec4c3fb569

#13 Updated by dkliban@redhat.com 3 months ago

  • Sprint changed from Sprint 55 to Sprint 56

#14 Updated by dkliban@redhat.com 3 months ago

  • Tags Katello-P1 added
  • Tags deleted (Katello-P2)

#15 Updated by dkliban@redhat.com 3 months ago

  • Status changed from ASSIGNED to POST

#16 Updated by dkliban@redhat.com 2 months ago

  • Status changed from POST to MODIFIED

Please register to edit this issue

Also available in: Atom PDF