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
This commit is contained in:
Alfredo Moralejo 2024-10-01 15:56:29 +02:00
parent a9a4bdf0f3
commit 492daa7a0b
2 changed files with 3 additions and 3 deletions

View File

@ -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

View File

@ -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