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

Incorrect Docker API Version #333

Closed
jfining opened this issue Jan 26, 2022 · 0 comments · Fixed by #361
Closed

Incorrect Docker API Version #333

jfining opened this issue Jan 26, 2022 · 0 comments · Fixed by #361
Labels
Help Wanted We will be glad if somebody proposes a solution via PR

Comments

@jfining
Copy link

jfining commented Jan 26, 2022

When retrieving an existing docker respository with V2 enabled, there is a mismatch in Repository.docker_api_version and Repository.raw["dockerApiVersion"].

For example, create a new docker repository in the artifactory web console with V2 enabled. Then:

Retrieve the repository and enumerate the object's properties:

repo = artifactory_.find_repository("james-test")
print("raw_docker_version", repo.raw["dockerApiVersion"])
print("object_property_docker_version", repo.docker_api_version)

You'll see something like this:

raw_docker_version V2
object_property_docker_version V1

If you update the repo using repo.update() the result is that repo.docker_api_version is used and the repository is incorrectly changed to V1.
https://github.com/devopshq/artifactory/blob/0.8.0/dohq_artifactory/admin.py#L771

I believe the culprit is the init function of RepositoryLocal sets the version to V1:
https://github.com/devopshq/artifactory/blob/0.8.0/dohq_artifactory/admin.py#L734

And then _read_response does not grab the real value from the API response:
https://github.com/devopshq/artifactory/blob/0.8.0/dohq_artifactory/admin.py#L791

So the default value of V1 is always used.

Solution:

I propose the _read_response function should be changed to also update self.docker_api_version using the value from the api response.

@allburov allburov added the Help Wanted We will be glad if somebody proposes a solution via PR label Apr 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Help Wanted We will be glad if somebody proposes a solution via PR
Development

Successfully merging a pull request may close this issue.

2 participants