522d06ba8b
Recent openstack cli supports loading user credentials from clouds.yaml instead of passing each parameters by environment variables or command options. This allows us to manage user credentials more flexibly. The biggest benefit of the clouds.yaml file is that it supports managing multiple credentials in a single file. When SRBAC is enforced, each API request should be made with the proper scope credential, and we need to switch credentials for different scopes(project, domain and system) according. Usage of clouds.yaml helps this use case hugely because it allows us to store credentials for each scope in a single file and switch them by the single OS_CLOUD environment variable(or the --os-cloud option). Change-Id: Ie8246aa18d90ba506fe708be13c9a5afa3e5d2fd
42 lines
909 B
Ruby
42 lines
909 B
Ruby
require 'spec_helper'
|
|
|
|
describe 'openstacklib::clouds' do
|
|
shared_examples 'openstacklib::clouds' do
|
|
let :title do
|
|
'/etc/openstack/clouds.yaml'
|
|
end
|
|
|
|
context 'with the required parameters' do
|
|
let :params do
|
|
{
|
|
:username => 'admin',
|
|
:password => 'secrete',
|
|
:auth_url => 'http://127.0.0.1:5000/',
|
|
:project_name => 'demo',
|
|
}
|
|
end
|
|
|
|
it 'creates a clouds.yaml file' do
|
|
should contain_file('/etc/openstack/clouds.yaml').with(
|
|
:mode => '0600',
|
|
:owner => 'root',
|
|
:group => 'root',
|
|
)
|
|
end
|
|
end
|
|
end
|
|
|
|
on_supported_os({
|
|
:supported_os => OSDefaults.get_supported_os
|
|
}).each do |os,facts|
|
|
context "on #{os}" do
|
|
let (:facts) do
|
|
facts.merge!(OSDefaults.get_facts())
|
|
end
|
|
|
|
it_behaves_like 'openstacklib::clouds'
|
|
end
|
|
end
|
|
|
|
end
|