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:
@@ -144,7 +144,7 @@ class Puppet::Provider::Keystone < Puppet::Provider::Openstack
|
|||||||
[name, '--domain', domain],
|
[name, '--domain', domain],
|
||||||
{
|
{
|
||||||
# TODO(tkajinam): Remove the first item after 2024.2 release.
|
# 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
|
# The description key is only set if it exists
|
||||||
if user and user.key?(:id) and !user.key?(:description)
|
if user and user.key?(:id) and !user.key?(:description)
|
||||||
@@ -152,7 +152,7 @@ class Puppet::Provider::Keystone < Puppet::Provider::Openstack
|
|||||||
end
|
end
|
||||||
user
|
user
|
||||||
rescue Puppet::ExecutionFailure => e
|
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
|
end
|
||||||
|
|
||||||
def self.get_auth_url
|
def self.get_auth_url
|
||||||
|
@@ -88,7 +88,7 @@ id="newid"
|
|||||||
expect(klass).to receive(:openstack)
|
expect(klass).to receive(:openstack)
|
||||||
.with('user', 'show', '--format', 'shell', ['no_user', '--domain', 'Default'])
|
.with('user', 'show', '--format', 'shell', ['no_user', '--domain', 'Default'])
|
||||||
.exactly(1).times
|
.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
|
expect(klass.fetch_user('no_user', 'Default')).to be_falsey
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user