Ignore onwer_specifed.* properties in images

Since Ussuri release, openstackclient uses OpenStackSDK instead of
glanceclient to create an image[1]. This switch made "openstack image
create" command to create images with owner_specified.* properties.

This patch makes glance_image type filter out these properties to avoid
false changes in image properties.

[1] 60e7c51df4cf061ebbb435a959ad63c7d3a296bf

Change-Id: I0439509589a7b28daf96d5a88ae2f5e01a27cf40
(cherry picked from commit 15d4c59153)
This commit is contained in:
Takashi Kajinami 2020-08-27 11:57:23 +09:00
parent 6d91c6f253
commit 1622ed1e70
1 changed files with 9 additions and 1 deletions

View File

@ -145,7 +145,7 @@ Puppet::Type.type(:glance_image).provide(
:disk_format => attrs[:disk_format],
:min_disk => attrs[:min_disk],
:min_ram => attrs[:min_ram],
:properties => exclude_readonly_props(properties),
:properties => exclude_owner_specified_props(exclude_readonly_props(properties)),
:image_tag => attrs[:image_tag]
)
end
@ -189,6 +189,14 @@ Puppet::Type.type(:glance_image).provide(
return rv
end
def self.exclude_owner_specified_props(props)
if props == nil
return nil
end
rv = props.select { |k, v| not k.start_with?('owner_specified.') }
return rv
end
def props_to_s(props)
hidden = ['os_hash_algo', 'os_hash_value', 'os_hidden']
props.flat_map{ |k, v|