Always pass --name when flushing keystone_service

Running "openstack service set <id> --description="
will throw an error [1].

The error occurs because the request to Keystone must include any
of enabled, name or type to satisfy the minProperties of the patch
request.

This patch always sets the --name parameter when calling the openstack
command so that we satisfy this requirement.

[1] http://paste.openstack.org/show/795869/

Change-Id: Ie4e2fe62ee7734f657f765c352ba542360c0e1d7
(cherry picked from commit fc30737487)
(cherry picked from commit d33843dc19)
(cherry picked from commit 09b61ff817)
(cherry picked from commit 906178cf1f)
This commit is contained in:
Tobias Urdin 2020-07-13 10:19:41 +02:00 committed by Takashi Kajinami
parent 6e29624320
commit d7f55ede44
1 changed files with 3 additions and 0 deletions

View File

@ -95,6 +95,9 @@ Puppet::Type.type(:keystone_service).provide(
def flush
options = []
if @property_flush && !@property_flush.empty?
# NOTE(tobias.urdin): Always pass --name to make sure we satisfy the minProperties
# for the request to Keystone.
options << "--name=#{resource[:name]}"
options << "--description=#{resource[:description]}" if @property_flush[:description]
options << "--type=#{resource[:type]}" if @property_flush[:type]
self.class.request('service', 'set', [@property_hash[:id]] + options) unless options.empty?