From 29a7c9afce32e7acbd40b9e4a73140ef9e05e7f3 Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Tue, 22 Dec 2020 16:46:33 +0000 Subject: image: Unset properties rather than setting to None Currently, we attempt to unset an image property by setting it to None. This doesn't work for known properties and is rightly rejected by the Glance API with the following error: BadRequestException: 400: Client Error for url: http://172.20.4.87/image/v2/images/368c5751-2b0b-4a38-a255-fd146fe52d31, Bad Request The solution is to actually unset the field by deleting it. Change-Id: Ie156bedbe0f9244f82c81401679706f484caf9aa Signed-off-by: Stephen Finucane Story: #2008463 Task: #41493 --- openstackclient/image/v2/image.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'openstackclient/image') diff --git a/openstackclient/image/v2/image.py b/openstackclient/image/v2/image.py index 58d92f51..60811522 100644 --- a/openstackclient/image/v2/image.py +++ b/openstackclient/image/v2/image.py @@ -1166,7 +1166,7 @@ class UnsetImage(command.Command): if parsed_args.properties: for k in parsed_args.properties: if k in image: - kwargs[k] = None + delattr(image, k) elif k in image.properties: # Since image is an "evil" object from SDK POV we need to # pass modified properties object, so that SDK can figure -- cgit v1.2.1