From 1622ed1e703bf605a603a300866102805c188b59 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Thu, 27 Aug 2020 11:57:23 +0900 Subject: [PATCH] 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 15d4c5915351fdaa32aec0eb47616eaf824251f7) --- lib/puppet/provider/glance_image/openstack.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/puppet/provider/glance_image/openstack.rb b/lib/puppet/provider/glance_image/openstack.rb index 05325c4e..15f09a54 100644 --- a/lib/puppet/provider/glance_image/openstack.rb +++ b/lib/puppet/provider/glance_image/openstack.rb @@ -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|