Merge "Create user and some fixes for ec2 credentials provider."
This commit is contained in:
commit
3ab06c2b3b
@ -8,12 +8,14 @@ Puppet::Type.type(:tempest_ec2_credentials).provide(
|
||||
@credentials = Puppet::Provider::Openstack::CredentialsV3.new
|
||||
|
||||
def exists?
|
||||
lines.each do |l|
|
||||
l.chomp!
|
||||
if access_line == l
|
||||
access_found = false
|
||||
secret_found = false
|
||||
lines.each do |line|
|
||||
l = line.chomp
|
||||
if /^aws_access *=/ =~ l
|
||||
access_found = true
|
||||
end
|
||||
if secret_line == l
|
||||
if /^aws_secret *=/ =~ l
|
||||
secret_found = true
|
||||
end
|
||||
end
|
||||
@ -36,9 +38,9 @@ Puppet::Type.type(:tempest_ec2_credentials).provide(
|
||||
if resource[:ensure] == :present or resource[:ensure].nil?
|
||||
if @ec2_credentials.nil?
|
||||
@ec2_credentials = self.class.request('ec2 credentials', 'create',
|
||||
["--user #{resource[:user]}",
|
||||
"--project #{resource[:project]}"],
|
||||
file_path)
|
||||
['--user', "#{resource[:user]}",
|
||||
'--project', "#{resource[:project]}"],
|
||||
file_path)
|
||||
end
|
||||
elsif resource[:ensure] != :absent
|
||||
raise(Puppet::Error, "Cannot ensure to #{resource[:ensure]}")
|
||||
|
@ -477,6 +477,7 @@ class tempest(
|
||||
'service_available/trove': value => $trove_available;
|
||||
'service_available/ironic': value => $ironic_available;
|
||||
'service_available/zaqar': value => $zaqar_available;
|
||||
'service_available/ec2api': value => $ec2api_available;
|
||||
'whitebox/db_uri': value => $whitebox_db_uri;
|
||||
'cli/cli_dir': value => $cli_dir;
|
||||
'scenario/img_dir': value => $img_dir;
|
||||
@ -699,15 +700,22 @@ be provided.')
|
||||
}
|
||||
|
||||
if $ec2api_available {
|
||||
tempest_config {
|
||||
'aws/ec2_url': value => 'http://127.0.0.1:8788/';
|
||||
keystone_user { 'ec2api-tester' :
|
||||
ensure => present,
|
||||
enabled => true,
|
||||
}
|
||||
keystone_user_role { 'ec2api-tester@openstack' :
|
||||
ensure => present,
|
||||
roles => ['Member'],
|
||||
}
|
||||
tempest_ec2_credentials { 'ec2_test_creds':
|
||||
ensure => present,
|
||||
tempest_conf_path => $tempest_conf,
|
||||
user => $username,
|
||||
project => $project_name_real,
|
||||
user => 'ec2api-tester',
|
||||
project => 'openstack',
|
||||
}
|
||||
Tempest_config<||> -> Tempest_ec2_credentials['ec2_test_creds']
|
||||
Keystone_user_role<||> -> Tempest_ec2_credentials['ec2_test_creds']
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -130,21 +130,15 @@ describe 'tempest' do
|
||||
let :params do
|
||||
{ :ec2api_available => true,
|
||||
:configure_images => false,
|
||||
:username => "testuser",
|
||||
:project_name => "testproject",
|
||||
}
|
||||
end
|
||||
|
||||
it 'sets aws configs' do
|
||||
is_expected.to contain_tempest_config('aws/ec2_url').with_value('http://127.0.0.1:8788/')
|
||||
end
|
||||
|
||||
it 'creates ec2 credentials' do
|
||||
is_expected.to contain_tempest_ec2_credentials('ec2_test_creds').with(
|
||||
:ensure => 'present',
|
||||
:tempest_conf_path => '/var/lib/tempest/etc/tempest.conf',
|
||||
:user => 'testuser',
|
||||
:project => 'testproject'
|
||||
:user => 'ec2api-tester',
|
||||
:project => 'openstack'
|
||||
)
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user