Add missing bit to the user prefetch removal.

Those are improvement based on last comment in the "Remove user/role
prefetch to support multi-domain.".  Namely:

  1. remove useless comments;
  2. improve the spec to reflect the actual error;

Change-Id: I1f622a14b41876be4b0b6d15cf78e28d76b6360e
This commit is contained in:
Sofer Athlan-Guyot 2016-04-15 11:27:34 +02:00
parent 64100bb284
commit fef6467537
2 changed files with 3 additions and 12 deletions

View File

@ -103,17 +103,6 @@ class Puppet::Provider::Keystone < Puppet::Provider::Openstack
resource_to_name(*name_to_resource(name), false) resource_to_name(*name_to_resource(name), false)
end end
# def self.roles_assignement_for_userid(user_id)
# unless @role_assignement_table
# @role_assignement_table = request('role assignment', 'list')
# end
# roles_id = []
# @role_assignement_table.each do |row|
# roles_id << row[:role] if row[:user] == user_id
# end
# roles_id
# end
def self.user_id_from_name_and_domain_name(name, domain_name) def self.user_id_from_name_and_domain_name(name, domain_name)
@users_name ||= {} @users_name ||= {}
id_str = "#{name}_#{domain_name}" id_str = "#{name}_#{domain_name}"

View File

@ -79,7 +79,9 @@ username="user1"
described_class.expects(:openstack) described_class.expects(:openstack)
.with('user', 'show', '--format', 'shell', .with('user', 'show', '--format', 'shell',
['user1', '--domain', 'domain1_id']) ['user1', '--domain', 'domain1_id'])
.returns('') .twice
.raises(Puppet::ExecutionFailure,
"No user with a name or ID of 'user1' exists.")
expect(provider.exists?).to be_falsey expect(provider.exists?).to be_falsey
end end
end end