anancarv / python-artifactory

Typed interactions with the Jfrog Artifactory REST API
MIT License
55 stars 50 forks source link

Explicit copy/move example or expressive failure reports #101

Open zink-chimaera opened 2 years ago

zink-chimaera commented 2 years ago

I'm struggling with the copy/move example. Could you make it more precise.

The artifacts.info is described as art.artifacts.info("<ARTIFACT_PATH_IN_ARTIFACTORY>"), which works when using:

art.artifacts.info(f"{repository_name}/{user_name}/{package_name}/{version}")

However, the copy/move operation is also described with <CURRENT_ARTIFACT_PATH_IN_ARTIFACTORY> and <NEW_ARTIFACT_PATH_IN_ARTIFACTORY> but does not work when using it via:

art.artifacts.move(
    "{repository_name_1}/{user_name}/{package_name}/{version}",
    "{repository_name_2}/{user_name}/{package_name}/{version}",
    dryrun=True
)

Describe the solution you'd like A few things:

anancarv commented 2 years ago

Hi @zink-chimaera , can you please share the error message raised when you perform the move ?

zink-chimaera commented 2 years ago

It is an 400 Client Error: Bad Request for url: https://localhost/artifactory/api/move/chimaera-ci/chimaera/zlib/1.2.11?to=/chimaera-testing/chimaera/zlib/1.2.11&dry=1

The full stack:

Traceback (most recent call last):
  File "/home/zink/Code/artifactory-connect/main.py", line 16, in <module>
    arti = art.artifacts.move(
  File "/home/zink/Code/artifactory-connect/venv/lib/python3.9/site-packages/pyartifactory/objects.py", line 963, in move
    self._post(f"api/move/{artifact_current_path}?to={artifact_new_path}&dry={dry}")
  File "/home/zink/Code/artifactory-connect/venv/lib/python3.9/site-packages/pyartifactory/artifactory_object.py", line 38, in _post
    return self._generic_http_method_request("post", route, **kwargs)
  File "/home/zink/Code/artifactory-connect/venv/lib/python3.9/site-packages/pyartifactory/artifactory_object.py", line 75, in _generic_http_method_request
    response.raise_for_status()
  File "/home/zink/Code/artifactory-connect/venv/lib/python3.9/site-packages/requests/models.py", line 953, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://localhost/artifactory/api/move/chimaera-ci/chimaera/zlib/1.2.11?to=/chimaera-testing/chimaera/zlib/1.2.11&dry=1