Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move request reports 200, but package not moved #84

Open
romangg opened this issue Jul 11, 2024 · 5 comments
Open

Move request reports 200, but package not moved #84

romangg opened this issue Jul 11, 2024 · 5 comments
Assignees
Labels
bug Something isn't working Daemon Changes related to the backend
Milestone

Comments

@romangg
Copy link
Contributor

romangg commented Jul 11, 2024

I tested the move request and expected the package uploaded to multilib to be moved to extra.

Am I misunderstanding your example ?

When uploading a package one need six form parts

  • packageN.file
  • packageN.signatureFile
  • packageN.section
  • to_delete
  • do_move
  • to_copy

When sending a move an element to_move is required, containing a json object array consisting of at least one named element with source and destination

Trying to move the package from above upload (arch-install-scripts)

upload_form : 
{('to_move',
  '[{"name": "arch-install-scripts-28-1-any.pkg.tar.zst", "from_section": '
  '{"branch": "stable", "repository": "multilib", "architecture": "x86_64"}, '
  '"to_section": {"branch": "stable", "repository": "extra", "architecture": '
  '"x86_64"}}]')}
request begin -->  2024-07-07 07:28:31
response recv -->  2024-07-07 07:28:31
          headers  {'Alt-Svc': 'h3=":443"; ma=2592000', 'Content-Length': '15', 'Content-Type': 'application/json; charset=utf-8', 'Date': 'Sun, 07 Jul 2024 05:28:31 GMT', 'Server': 'Caddy, drogon/1.8.2'}
          status   200

returns 200 but the package doesn't move.

Originally posted by @fhdk in #80 (comment)

@fhdk
Copy link
Collaborator

fhdk commented Jul 11, 2024

I have created some simple tests in the bxtctl repo https://github.com/fhdk/bxtctl

@fhdk fhdk mentioned this issue Jul 11, 2024
@LordTermor LordTermor added bug Something isn't working Daemon Changes related to the backend labels Jul 12, 2024
@fhdk
Copy link
Collaborator

fhdk commented Jul 19, 2024

updated tests/20_pkg_move.py

Response is OK but nothing happens on the endpoint - from the output from test script - the request should go through

Corrected for permission for the bxtctl user

bxt_move_pkg : 
req headers : {'Authorization': 'Bearer *****', 'Accept': 'application/json', 'Content-Type': 'multipart/form-data', 'Content-Length': '341'}
req url     : https://bxt.staging.manjaro.org/api/packages/commit
req data    : b'--5e33262c1fbe4bffcc3a5081e7863730\r\nContent-Disposition: form-data; name="to_move"\r\n\r\n[{"name": "arch-install-scripts", "from_section": {"branch": "unstable", "repository": "multilib", "architecture": "x86_64"}, "to_section": {"branch": "testing", "repository": "multilib", "architecture": "x86_64"}}]\r\n--5e33262c1fbe4bffcc3a5081e7863730--\r\n': 
move request begin -->  2024-07-19 09:40:10
response recv -->  2024-07-19 09:40:10
      headers -->  {'Alt-Svc': 'h3=":443"; ma=2592000', 'Content-Length': '15', 'Content-Type': 'application/json; charset=utf-8', 'Date': 'Fri, 19 Jul 2024 07:40:10 GMT', 'Server': 'Caddy, drogon/1.8.2'}
       status -->  200

@LordTermor LordTermor moved this to Ready in bxt pre-production Aug 1, 2024
@romangg romangg added this to the v0.3.0 milestone Aug 1, 2024
@fhdk
Copy link
Collaborator

fhdk commented Sep 2, 2024

Just a followup - move a package - service responds with OK - but nothing happens.

POST /api/packages/commit HTTP/1.1
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXUyJ9.eyJleHAiOjE3MjUyODE5OTAsImlhdCI6MTcyNTI4MTA5MCwiaXNzIjoiYnh0Iiwia2luZCI6ImFjY2Vzc190b2tlbiIsInN0b3JhZ2UiOiJiZWFyZXIiLCJ1c2VybmFtZSI6ImJ4dGN0bCJ9.ODR59J2sqveWUlZOZW2wtBdyY1P_BesC5h0yGCu28D4
User-Agent: PostmanRuntime/7.38.0
Accept: */*
Postman-Token: 9e9c3830-c1b5-4966-9dbd-b237145196f1
Host: bxt.staging.manjaro.org
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Content-Type: multipart/form-data; boundary=--------------------------907285369569507472035194
Content-Length: 379
 
----------------------------907285369569507472035194
Content-Disposition: form-data; name="to_move"
Content-Type: application/json
[{"name": "a-dummy1", "from_section":{"branch":"testing","repository":"extra","architecture":"x86_64"}, "to_section":{"branch":"testing","repository":"extra","architecture":"aarch64"}}]
----------------------------907285369569507472035194--
 
HTTP/1.1 200 OK
Alt-Svc: h3=":443"; ma=2592000
Content-Length: 15
Content-Type: application/json; charset=utf-8
Date: Mon, 02 Sep 2024 12:50:14 GMT
Server: Caddy
Server: drogon/1.8.2
 
{"status":"ok"}

@fhdk
Copy link
Collaborator

fhdk commented Sep 5, 2024

Tested today - the move transaction request is accepted with 200 OK - but no packages are moved

bxt_move_pkg  : BearerAuth
req headers   : {'User-Agent': 'bxtctl/0.6alpha', 'Authorization': 'Bearer eyJhbGciOiJIUzI...UDGnV02_CJ060bM', 'x-bxtctl-token': 'fcf39669-052c-48e6-8bea-fc1b94698c5a', 'Content-Length': '749', 'Content-Type': 'multipart/form-data; boundary=087b0460581041e3adda58e208a9a5b2'}
req url       : https://bxt.staging.manjaro.org/api/packages/commit
req body      : b'--087b0460581041e3adda58e208a9a5b2\r\nContent-Disposition: form-data; name="to_move"\r\nContent-Type: application/json\r\n\r\n[{"name": "a-dummy1", "from_section": {"branch": "testing", "repository": "extra", "architecture": "x86_64"}, "to_section": {"branch": "testing", "repository": "extra", "architecture": "aarch64"}}, {"name": "a-dummy2", "from_section": {"branch": "testing", "repository": "extra", "architecture": "x86_64"}, "to_section": {"branch": "testing", "repository": "extra", "architecture": "aarch64"}}, {"name": "a-dummy3", "from_section": {"branch": "testing", "repository": "extra", "architecture": "x86_64"}, "to_section": {"branch": "testing", "repository": "extra", "architecture": "aarch64"}}]\r\n--087b0460581041e3adda58e208a9a5b2--\r\n'
--------------------------------------------------------------
request begin    -->  2024-09-05 17:00:47
response recv    -->  2024-09-05 17:00:47
response headers -->  {'Alt-Svc': 'h3=":443"; ma=2592000', 'Content-Length': '15', 'Content-Type': 'application/json; charset=utf-8', 'Date': 'Thu, 05 Sep 2024 15:00:47 GMT', 'Server': 'Caddy, drogon/1.8.2'}
response status  -->  200
response content -->  b'{"status":"ok"}'

@fhdk
Copy link
Collaborator

fhdk commented Sep 8, 2024

I have stumpled upon why the move transaction is weird

I did

  • Create 3 packages - noted the version.
  • Using testing/extra
  • Upload the packages to x86_64
  • Excute a copy transaction for the three packages from x86_64 to aarch64
  • Verify packages is in both repo
  • Create three new packages
  • Upload the packages to x86_64 (verify the version)
  • Execute a move transaction to aarch64
  • One would expect x86_64 to be empty - but instead it is aarch64 that is empty

To me it looks like the daemon got it opposite of what the form says

run the following script sequence and watch the output

package versions and section content (please pull before you test - I have renamed the files - removed the using_bearer - not necessary any more.

pkgbuild/recreate_packages.sh
scratchpads/0010_pkg_upload.py
scratchpads/0050_list_section_content.py
scratchpads/0030_pkg_copy.py
scratchpads/0050_list_section_content.py
pkgbuild/recreate_packages.sh
scratchpads/0010_pkg_upload.py
scratchpads/0050_list_section_content.py
scratchpads/0020_pkg_move.py
scratchpads/0050_list_section_content.py

@LordTermor LordTermor modified the milestones: v0.3.0, post-1.0 Dec 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Daemon Changes related to the backend
Projects
Status: In progress
Development

No branches or pull requests

3 participants