Use role assignment list instead of role list
openstack role list is deprecated since Newton and is removed in openstackclient-4.0.0 with [1]. Use role assignment list --names instead. [1] https://review.opendev.org/#/c/612798/ Change-Id: I7bb2d3573c4f7ba092e019a363116bab11cc7063
This commit is contained in:
parent
7d4c760446
commit
f16e26daa1
|
@ -45,14 +45,14 @@ Puppet::Type.type(:keystone_user_role).provide(
|
|||
end
|
||||
|
||||
def exists?
|
||||
roles_db = self.class.request('role', 'list', properties)
|
||||
roles_db = self.class.request('role assignment', 'list', ['--names'] + properties)
|
||||
@property_hash[:name] = resource[:name]
|
||||
if roles_db.empty?
|
||||
@property_hash[:ensure] = :absent
|
||||
else
|
||||
@property_hash[:ensure] = :present
|
||||
@property_hash[:roles] = roles_db.collect do |role|
|
||||
role[:name]
|
||||
role[:role]
|
||||
end
|
||||
end
|
||||
return @property_hash[:ensure] == :present
|
||||
|
|
|
@ -107,7 +107,7 @@ describe 'keystone server running with Apache/WSGI as Identity Provider' do
|
|||
end
|
||||
end
|
||||
it 'should find admin role' do
|
||||
shell("openstack #{auth_creds} --os-auth-url http://127.0.0.1:5000/v3 --os-identity-api-version 3 role list") do |r|
|
||||
shell("openstack #{auth_creds} --os-auth-url http://127.0.0.1:5000/v3 --os-identity-api-version 3 role assignment list --names") do |r|
|
||||
expect(r.stdout).to match(/admin/)
|
||||
expect(r.stderr).to be_empty
|
||||
end
|
||||
|
|
|
@ -105,7 +105,7 @@ describe 'keystone server running with Apache/WSGI as Service Provider with Shib
|
|||
end
|
||||
end
|
||||
it 'should find admin role' do
|
||||
shell("openstack #{auth_creds} --os-auth-url http://127.0.0.1:5000/v3 --os-identity-api-version 3 role list") do |r|
|
||||
shell("openstack #{auth_creds} --os-auth-url http://127.0.0.1:5000/v3 --os-identity-api-version 3 role assignment list --names") do |r|
|
||||
expect(r.stdout).to match(/admin/)
|
||||
expect(r.stderr).to be_empty
|
||||
end
|
||||
|
|
|
@ -101,7 +101,7 @@ describe 'keystone server running with Apache/WSGI with resources' do
|
|||
end
|
||||
end
|
||||
it 'should find admin role' do
|
||||
shell("openstack #{auth_creds} --os-auth-url http://127.0.0.1:5000/v3 --os-identity-api-version 3 role list") do |r|
|
||||
shell("openstack #{auth_creds} --os-auth-url http://127.0.0.1:5000/v3 --os-identity-api-version 3 role assignment list --names") do |r|
|
||||
expect(r.stdout).to match(/admin/)
|
||||
expect(r.stderr).to be_empty
|
||||
end
|
||||
|
|
|
@ -38,8 +38,8 @@ describe Puppet::Type.type(:keystone_user_role).provider(:openstack) do
|
|||
before(:each) do
|
||||
|
||||
described_class.expects(:openstack)
|
||||
.with('role', 'list', '--quiet', '--format', 'csv',
|
||||
['--project', 'project1_id', '--user', 'user1_id'])
|
||||
.with('role assignment', 'list', '--quiet', '--format', 'csv',
|
||||
['--names', '--project', 'project1_id', '--user', 'user1_id'])
|
||||
.returns('"ID","Name","Project","User"
|
||||
"role1_id","role1","project1","user1"
|
||||
"role2_id","role2","project1","user1"
|
||||
|
@ -124,8 +124,8 @@ id="project1_id"
|
|||
id="user1_id"
|
||||
')
|
||||
described_class.expects(:openstack)
|
||||
.with('role', 'list', '--quiet', '--format', 'csv',
|
||||
['--project', 'project1_id', '--user', 'user1_id'])
|
||||
.with('role assignment', 'list', '--quiet', '--format', 'csv',
|
||||
['--names', '--project', 'project1_id', '--user', 'user1_id'])
|
||||
.returns('"ID","Name","Project","User"
|
||||
')
|
||||
provider.destroy
|
||||
|
@ -136,8 +136,8 @@ id="user1_id"
|
|||
describe '#exists' do
|
||||
subject(:response) do
|
||||
described_class.expects(:openstack)
|
||||
.with('role', 'list', '--quiet', '--format', 'csv',
|
||||
['--project', 'project1_id', '--user', 'user1_id'])
|
||||
.with('role assignment', 'list', '--quiet', '--format', 'csv',
|
||||
['--names', '--project', 'project1_id', '--user', 'user1_id'])
|
||||
.returns('"ID","Name","Project","User"
|
||||
"role1_id","role1","project1","user1"
|
||||
"role2_id","role2","project1","user1"
|
||||
|
|
Loading…
Reference in New Issue