Renamed image property protected to is_protected

OpenStack SDK removed support for the deprecated image property
protected in commit afb49692 [1][2]. This replaces the usage of
protected with is_protected in openstack.cloud.image but adds
protected as an alias to not break backward compatibility for
user code. This breaks backward compatibility to older OpenStack
SDK releases though.

Ref.:
[1] afb49692f5
[2] https://review.opendev.org/c/openstack/openstacksdk/+/820926

Change-Id: I5044c927e90c650234fbc22375f44e6841a485a1
This commit is contained in:
Jakob Meng 2022-04-22 11:38:07 +02:00
parent ecf4897a55
commit bb25330ddc
1 changed files with 5 additions and 4 deletions

View File

@ -57,9 +57,10 @@ options:
- Whether the image can be accessed publicly. Note that publicizing an image requires admin role by default.
type: bool
default: false
protected:
is_protected:
description:
- Prevent image from being deleted
aliases: ['protected']
type: bool
default: false
filename:
@ -173,7 +174,7 @@ class ImageModule(OpenStackModule):
min_disk=dict(type='int', default=0),
min_ram=dict(type='int', default=0),
is_public=dict(type='bool', default=False),
protected=dict(type='bool', default=False),
is_protected=dict(type='bool', default=False, aliases=['protected']),
filename=dict(type='str'),
ramdisk=dict(type='str'),
kernel=dict(type='str'),
@ -210,7 +211,7 @@ class ImageModule(OpenStackModule):
wait=self.params['wait'],
timeout=self.params['timeout'],
is_public=self.params['is_public'],
protected=self.params['protected'],
is_protected=self.params['is_protected'],
min_disk=self.params['min_disk'],
min_ram=self.params['min_ram'],
volume=self.params['volume'],
@ -225,7 +226,7 @@ class ImageModule(OpenStackModule):
image=image,
kernel=self.params['kernel'],
ramdisk=self.params['ramdisk'],
protected=self.params['protected'],
is_protected=self.params['is_protected'],
**self.params['properties'])
if self.params['tags']:
self.conn.image.update_image(image.id, tags=self.params['tags'])