ContainerRegistryClient update methods do nothing
See original GitHub issue- Package Name: azure-containerregistryclient
- Package Version: 1.0.0b7
- Operating System: MacOS Monterey 12.1 on M1
- Python Version: 3.8
Describe the bug
azure.containerregistry.ContainerRegistryClient
has 3 update methods, none of which work. The get/list methods work fine.
To Reproduce
Suppose a repository with the name myrepo
exists with the tag mytag
at https://myacr.azurecr.io
.
Let’s attempt to update the last updated time of some objects. NB this fails on any field e.g. name, but last updated time is common to all 3 and easy to understand.
from azure.containerregistry import ContainerRegistryClient, RepositoryProperties, ArtifactTagProperties, ArtifactManifestProperties
from datetime import datetime
client = ContainerRegistryClient("https://myacr.azurecr.io", DefaultAzureCredential(), audience="https://management.azure.com")
now = datetime.now()
# All 3 of these calls run without any exception raised, but nothing changes in ACR
client.update_repository_properties('myrepo', RepositoryProperties(last_updated_on=now, can_delete=True, can_read=True, can_list=True, can_write=True))
client.update_tag_properties('myrepo', 'mytag', ArtifactTagProperties(last_updated_on=now, can_delete=True, can_read=True, can_list=True, can_write=True))
client.update_manifest_properties('myrepo', 'mytag', ArtifactManifestProperties(last_updated_on=now, can_delete=True, can_read=True, can_list=True, can_write=True))
Nothing changes on ACR, even though these calls ran without errors.
I don’t believe this is a permissions issue, because various other calls e.g. client.get_repository_properties('myrepo')
work fine and return correct values.
Interestingly, errors are raised as expected when e.g. setting a non-existent repo or tag name.
Expected behavior
The properties of the selected object change, or an exception is raised explaining what is wrong.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (4 by maintainers)
Thanks @theoturner! I have opened a PR to get these docstrings improved for clarity. I think the intention of the name
update_properties
was to allow the methods to grow should more updatable settings become available.Thank you for the fast replies. An update to the docstring is great, though the functions should probably be named
update_object_permissions
to avoid confusion.For future reference, to update actual properties delete the old repo/tag and create a new one.