From 492daa7a0b86286ec295c8b60d9de1a416d92f1e Mon Sep 17 00:00:00 2001 From: Alfredo Moralejo Date: Tue, 1 Oct 2024 15:56:29 +0200 Subject: [PATCH] Fix message format for openstackclient >= 7.0.0 Follow-up of [1]. The actual message has capitalized User: $ /bin/openstack --os-cloud system user show --format shell demo --domain default No User found for demo [1] https://review.opendev.org/c/openstack/puppet-keystone/+/930900 Change-Id: I64887877bd656f86d0fc181cf3d3044dc12fe21c --- lib/puppet/provider/keystone.rb | 4 ++-- spec/unit/provider/keystone_spec.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/puppet/provider/keystone.rb b/lib/puppet/provider/keystone.rb index c6120c4c7..16cf066d9 100644 --- a/lib/puppet/provider/keystone.rb +++ b/lib/puppet/provider/keystone.rb @@ -144,7 +144,7 @@ class Puppet::Provider::Keystone < Puppet::Provider::Openstack [name, '--domain', domain], { # TODO(tkajinam): Remove the first item after 2024.2 release. - :no_retry_exception_msgs => [/No user with a name or ID/, /No user found for/] + :no_retry_exception_msgs => [/No user with a name or ID/, /No User found for/] }) # The description key is only set if it exists if user and user.key?(:id) and !user.key?(:description) @@ -152,7 +152,7 @@ class Puppet::Provider::Keystone < Puppet::Provider::Openstack end user rescue Puppet::ExecutionFailure => e - raise e unless (e.message =~ /No user with a name or ID/ or e.message =~ /No user found for/) + raise e unless (e.message =~ /No user with a name or ID/ or e.message =~ /No User found for/) end def self.get_auth_url diff --git a/spec/unit/provider/keystone_spec.rb b/spec/unit/provider/keystone_spec.rb index d4c7100a1..95e284055 100644 --- a/spec/unit/provider/keystone_spec.rb +++ b/spec/unit/provider/keystone_spec.rb @@ -88,7 +88,7 @@ id="newid" expect(klass).to receive(:openstack) .with('user', 'show', '--format', 'shell', ['no_user', '--domain', 'Default']) .exactly(1).times - .and_raise(Puppet::ExecutionFailure, "Execution of '/usr/bin/openstack user show --format shell no_user' returned 1: No user found for no_user") + .and_raise(Puppet::ExecutionFailure, "Execution of '/usr/bin/openstack user show --format shell no_user' returned 1: No User found for no_user") expect(klass.fetch_user('no_user', 'Default')).to be_falsey end