Files
puppet-openstack/spec/classes/openstack_auth_file_spec.rb
Daneyon Hansen 8b37baa366 Fix Keystone 'token-get' Error
Previously, users would receive an error similar to the one below
after sourcing keystone authentication variables
(i.e. source openrc) and running the puppet agent:

debug: Puppet::Type::Keystone_user::ProviderKeystone:
Executing '/usr/bin/keystone --os-auth-url
http://127.0.0.1:35357/v2.0/ token-get'
err: /Stage[main]/Nova::Keystone::Auth/Keystone_user[nova]:
Could not evaluate: Execution of '/usr/bin/keystone --os-auth-url
http://127.0.0.1:35357/v2.0/ token-get' returned 1: Configuration
error: Client configured to run without a service catalog.
Run the client using --os-auth-url or OS_AUTH_URL, instead of
--os-endpoint or OS_SERVICE_ENDPOINT, for example.
WARNING: Bypassing authentication using a token & endpoint
(authentication credentials are being ignored).

Even though the OS_AUTH_URL was being provided in the auth file,
Keystone will ignore it and other variables related to user/pswd
based authnetication.  This is because only one form of auth
(token or user/password) can be used at a time and Keystone
will prefer token-based auth if both are provided.

This change introduces the new parameter use_token_auth to set
the Keystone auth file based on user/password or token-based
authentication.  Defaults to false for backwards compatibility
and to use user/password authentication.

Additional Information:
  http://docs.openstack.org/developer/keystone/configuration.html
  https://lists.launchpad.net/openstack/msg22356.html

Additionally, Region support was added through the region_name
parameter.  Defaults to RegionOne for backwards compatibility and
to use the default region named RegionOne.

Change-Id: I913d8da5b753c8db40a05ba2ae1784750f722a5b
2013-08-01 18:26:20 +00:00

45 lines
987 B
Ruby

require 'spec_helper'
describe 'openstack::auth_file' do
describe "when only passing default class parameters" do
let :params do
{ :admin_password => 'admin' }
end
it 'should create a openrc file' do
should contain_file('/root/openrc').with_content(
'
export OS_NO_CACHE=true
export OS_TENANT_NAME=admin
export OS_USERNAME=admin
export OS_PASSWORD=\'admin\'
export OS_AUTH_URL="http://127.0.0.1:5000/v2.0/"
export OS_AUTH_STRATEGY=keystone
export OS_REGION_NAME=RegionOne
'
)
end
end
describe 'when overridding' do
let :params do
{
:controller_node => '127.0.0.2',
:keystone_admin_token => 'keystone',
}
end
it 'should create a openrc file' do
should contain_file('/root/openrc').with_content(
'
export OS_SERVICE_TOKEN=keystone
export OS_SERVICE_ENDPOINT=http://127.0.0.2:35357/v2.0/
'
)
end
end
end