openrc search failure
The old openrc code handled when identity role was not converged yet by looking at attributes. Add this support back in. Change-Id: I738c0f619b364548b5fff1f06cc48dce2c8f7e84 Closes-Bug: #1316236
This commit is contained in:
parent
86d0a574e4
commit
6fc8e58bab
|
@ -1,6 +1,9 @@
|
|||
# CHANGELOG for cookbook-openstack-common
|
||||
|
||||
This file is used to list changes made in each version of cookbook-openstack-common.
|
||||
## 9.2.2
|
||||
* Fixed openrc failure on role search
|
||||
|
||||
## 9.2.1
|
||||
* Fix package action to allow updates
|
||||
|
||||
|
|
|
@ -80,7 +80,9 @@ example, overriding `node['openstack']['endpoints']['identity']['host']`). If
|
|||
openrc
|
||||
----
|
||||
|
||||
Creates an /root/openrc file
|
||||
Creates an /root/openrc file. This requires the identity attributes for
|
||||
admin_user and admin_tenant_name, or for the identity_service_chef_role
|
||||
to be used on the identity server node.
|
||||
|
||||
|
||||
sysctl
|
||||
|
|
|
@ -4,7 +4,7 @@ maintainer_email 'cookbooks@lists.tfoundry.com'
|
|||
license 'Apache 2.0'
|
||||
description 'Common OpenStack attributes, libraries and recipes.'
|
||||
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
|
||||
version '9.2.1'
|
||||
version '9.2.2'
|
||||
|
||||
recipe 'openstack-common', 'Installs/Configures common recipes'
|
||||
recipe 'openstack-common::set_endpoints_by_interface', 'Set endpoints by interface'
|
||||
|
|
|
@ -22,13 +22,22 @@ class ::Chef::Recipe # rubocop:disable Documentation
|
|||
include ::Openstack
|
||||
end
|
||||
|
||||
identity_service_role = node['openstack']['identity_service_chef_role']
|
||||
keystone = search_for(identity_service_role).first
|
||||
# check attributes before searching
|
||||
if node['openstack']['identity'] && node['openstack']['identity']['admin_tenant_name'] && node['openstack']['identity']['admin_user']
|
||||
ksadmin_tenant_name = node['openstack']['identity']['admin_tenant_name']
|
||||
ksadmin_user = node['openstack']['identity']['admin_user']
|
||||
else
|
||||
identity_service_role = node['openstack']['identity_service_chef_role']
|
||||
keystone = search_for(identity_service_role).first
|
||||
|
||||
return if keystone.nil?
|
||||
if keystone.nil?
|
||||
Chef::Log.warn("openrc not created, identity role node not found: #{identity_service_role}")
|
||||
return
|
||||
end
|
||||
|
||||
ksadmin_tenant_name = keystone['openstack']['identity']['admin_tenant_name']
|
||||
ksadmin_user = keystone['openstack']['identity']['admin_user']
|
||||
ksadmin_tenant_name = keystone['openstack']['identity']['admin_tenant_name']
|
||||
ksadmin_user = keystone['openstack']['identity']['admin_user']
|
||||
end
|
||||
|
||||
ksadmin_pass = get_password 'user', ksadmin_user
|
||||
identity_endpoint = endpoint 'identity-api'
|
||||
|
|
|
@ -42,6 +42,17 @@ describe 'openstack-common::openrc' do
|
|||
expect(chef_run).to render_file(file.name).with_content(
|
||||
/^export MISC2=OPTION2$/)
|
||||
end
|
||||
|
||||
it 'contains overridden auth environment variables' do
|
||||
node.set['openstack']['identity']['admin_tenant_name'] = 'admin-tenant-name-override'
|
||||
node.set['openstack']['identity']['admin_user'] = 'admin-user-override'
|
||||
[
|
||||
/^export OS_USERNAME=admin-user-override$/,
|
||||
/^export OS_TENANT_NAME=admin-tenant-name-override$/
|
||||
].each do |line|
|
||||
expect(chef_run).to render_file(file.name).with_content(line)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -45,5 +45,8 @@ shared_context 'common-stubs' do
|
|||
Chef::Recipe.any_instance.stub(:get_password)
|
||||
.with('user', 'admin')
|
||||
.and_return('admin')
|
||||
Chef::Recipe.any_instance.stub(:get_password)
|
||||
.with('user', 'admin-user-override')
|
||||
.and_return('admin-user-override')
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue