Merge "Use identity_uri_transform for identiry_uri support"
This commit is contained in:
commit
e490254718
|
@ -104,6 +104,7 @@ identity_admin_endpoint = admin_endpoint 'identity-admin'
|
||||||
service_pass = get_password 'service', 'openstack-image'
|
service_pass = get_password 'service', 'openstack-image'
|
||||||
|
|
||||||
auth_uri = auth_uri_transform identity_endpoint.to_s, node['openstack']['image']['api']['auth']['version']
|
auth_uri = auth_uri_transform identity_endpoint.to_s, node['openstack']['image']['api']['auth']['version']
|
||||||
|
identity_uri = identity_uri_transform(identity_admin_endpoint)
|
||||||
|
|
||||||
db_user = node['openstack']['db']['image']['username']
|
db_user = node['openstack']['db']['image']['username']
|
||||||
db_pass = get_password 'db', 'glance'
|
db_pass = get_password 'db', 'glance'
|
||||||
|
@ -171,8 +172,8 @@ template '/etc/glance/glance-api.conf' do
|
||||||
sql_connection: sql_connection,
|
sql_connection: sql_connection,
|
||||||
glance_flavor: glance_flavor,
|
glance_flavor: glance_flavor,
|
||||||
auth_uri: auth_uri,
|
auth_uri: auth_uri,
|
||||||
|
identity_uri: identity_uri,
|
||||||
cinder_endpoint: cinder_endpoint,
|
cinder_endpoint: cinder_endpoint,
|
||||||
identity_admin_endpoint: identity_admin_endpoint,
|
|
||||||
service_pass: service_pass,
|
service_pass: service_pass,
|
||||||
rabbit_hosts: rabbit_hosts,
|
rabbit_hosts: rabbit_hosts,
|
||||||
swift_store_key: swift_store_key,
|
swift_store_key: swift_store_key,
|
||||||
|
|
|
@ -54,6 +54,7 @@ registry_bind = internal_endpoint 'image-registry-bind'
|
||||||
service_pass = get_password 'service', 'openstack-image'
|
service_pass = get_password 'service', 'openstack-image'
|
||||||
|
|
||||||
auth_uri = auth_uri_transform identity_endpoint.to_s, node['openstack']['image']['registry']['auth']['version']
|
auth_uri = auth_uri_transform identity_endpoint.to_s, node['openstack']['image']['registry']['auth']['version']
|
||||||
|
identity_uri = identity_uri_transform(identity_admin_endpoint)
|
||||||
|
|
||||||
glance_user = node['openstack']['image']['user']
|
glance_user = node['openstack']['image']['user']
|
||||||
glance_group = node['openstack']['image']['group']
|
glance_group = node['openstack']['image']['group']
|
||||||
|
@ -112,7 +113,7 @@ template '/etc/glance/glance-registry.conf' do
|
||||||
:registry_bind_port => registry_bind.port,
|
:registry_bind_port => registry_bind.port,
|
||||||
:sql_connection => sql_connection,
|
:sql_connection => sql_connection,
|
||||||
:auth_uri => auth_uri,
|
:auth_uri => auth_uri,
|
||||||
'identity_admin_endpoint' => identity_admin_endpoint,
|
:identity_uri => identity_uri,
|
||||||
notification_driver: node['openstack']['image']['notification_driver'],
|
notification_driver: node['openstack']['image']['notification_driver'],
|
||||||
mq_service_type: mq_service_type,
|
mq_service_type: mq_service_type,
|
||||||
mq_password: mq_password,
|
mq_password: mq_password,
|
||||||
|
|
|
@ -136,11 +136,15 @@ describe 'openstack-image::api' do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
%w(bind registry).each do |type|
|
it 'sets port and host attributes' do
|
||||||
%w(host port).each do |param|
|
[
|
||||||
it "has a #{type}_#{param}" do
|
/^bind_port = 9292$/,
|
||||||
expect(chef_run).to render_file(file.name).with_content(/^#{type}_#{param} = #{type}_#{param}_value$/)
|
/^bind_host = 127.0.0.1$/,
|
||||||
end
|
/^registry_port = 9191$/,
|
||||||
|
/^registry_host = 127.0.0.1$/
|
||||||
|
].each do |line|
|
||||||
|
expect(chef_run).to render_config_file(file.name)\
|
||||||
|
.with_section_content('DEFAULT', line)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -171,7 +175,7 @@ describe 'openstack-image::api' do
|
||||||
context 'cinder storage options' do
|
context 'cinder storage options' do
|
||||||
it 'sets default attributes' do
|
it 'sets default attributes' do
|
||||||
expect(chef_run).to render_file(file.name).with_content(/^cinder_catalog_info = volumev2:cinderv2:publicURL$/)
|
expect(chef_run).to render_file(file.name).with_content(/^cinder_catalog_info = volumev2:cinderv2:publicURL$/)
|
||||||
expect(chef_run).to render_file(file.name).with_content(%r{^cinder_endpoint_template = scheme://host:port/path$})
|
expect(chef_run).to render_file(file.name).with_content(%r{^cinder_endpoint_template = http://127.0.0.1:8776/v2/%\(tenant_id\)s$})
|
||||||
expect(chef_run).to render_file(file.name).with_content(/^cinder_ca_certificates_file = $/)
|
expect(chef_run).to render_file(file.name).with_content(/^cinder_ca_certificates_file = $/)
|
||||||
expect(chef_run).to render_file(file.name).with_content(/^cinder_api_insecure = false$/)
|
expect(chef_run).to render_file(file.name).with_content(/^cinder_api_insecure = false$/)
|
||||||
end
|
end
|
||||||
|
@ -230,7 +234,7 @@ describe 'openstack-image::api' do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'sets the auth address' do
|
it 'sets the auth address' do
|
||||||
expect(chef_run).to render_file(file.name).with_content(/^swift_store_auth_address = auth_uri_value$/)
|
expect(chef_run).to render_file(file.name).with_content(%r(^swift_store_auth_address = http://127.0.0.1:5000/v2.0$))
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'sets the auth version' do
|
it 'sets the auth version' do
|
||||||
|
@ -432,9 +436,13 @@ describe 'openstack-image::api' do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
%w(host port).each do |attr|
|
it 'sets port and host attributes' do
|
||||||
it "sets the registry #{attr} attribute" do
|
[
|
||||||
expect(chef_run).to render_file(file.name).with_content(/^registry_#{attr} = registry_#{attr}_value$/)
|
/^registry_port = 9191$/,
|
||||||
|
/^registry_host = 127.0.0.1$/
|
||||||
|
].each do |line|
|
||||||
|
expect(chef_run).to render_config_file(file.name)\
|
||||||
|
.with_section_content('DEFAULT', line)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -462,9 +470,13 @@ describe 'openstack-image::api' do
|
||||||
context 'template contents' do
|
context 'template contents' do
|
||||||
include_context 'endpoint-stubs'
|
include_context 'endpoint-stubs'
|
||||||
|
|
||||||
%w(host port).each do |attr|
|
it 'sets port and host attributes' do
|
||||||
it "sets the registry #{attr} attribute" do
|
[
|
||||||
expect(chef_run).to render_file(file.name).with_content(/^registry_#{attr} = registry_#{attr}_value$/)
|
/^registry_port = 9191$/,
|
||||||
|
/^registry_host = 127.0.0.1$/
|
||||||
|
].each do |line|
|
||||||
|
expect(chef_run).to render_config_file(file.name)\
|
||||||
|
.with_section_content('DEFAULT', line)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -92,12 +92,6 @@ describe 'openstack-image::registry' do
|
||||||
include_context 'endpoint-stubs'
|
include_context 'endpoint-stubs'
|
||||||
include_context 'sql-stubs'
|
include_context 'sql-stubs'
|
||||||
|
|
||||||
before do
|
|
||||||
allow_any_instance_of(Chef::Recipe).to receive(:internal_endpoint)
|
|
||||||
.with('image-registry-bind')
|
|
||||||
.and_return(double(host: 'registry_host_value', port: 'registry_port_value'))
|
|
||||||
end
|
|
||||||
|
|
||||||
it_behaves_like 'custom template banner displayer' do
|
it_behaves_like 'custom template banner displayer' do
|
||||||
let(:file_name) { file.name }
|
let(:file_name) { file.name }
|
||||||
end
|
end
|
||||||
|
@ -109,12 +103,15 @@ describe 'openstack-image::registry' do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
%w(host port).each do |attr|
|
it 'sets port and host attributes' do
|
||||||
it "sets the registry bind #{attr} attribute" do
|
[
|
||||||
expect(chef_run).to render_file(file.name).with_content(/^bind_#{attr} = registry_#{attr}_value$/)
|
/^bind_port = 9191$/,
|
||||||
|
/^bind_host = 127.0.0.1$/
|
||||||
|
].each do |line|
|
||||||
|
expect(chef_run).to render_config_file(file.name)\
|
||||||
|
.with_section_content('DEFAULT', line)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'sets the workers attribute' do
|
it 'sets the workers attribute' do
|
||||||
node.set['openstack']['image']['registry']['workers'] = 123
|
node.set['openstack']['image']['registry']['workers'] = 123
|
||||||
expect(chef_run).to render_file(file.name).with_content(/^workers = 123$/)
|
expect(chef_run).to render_file(file.name).with_content(/^workers = 123$/)
|
||||||
|
|
|
@ -154,30 +154,6 @@ end
|
||||||
|
|
||||||
shared_context 'endpoint-stubs' do
|
shared_context 'endpoint-stubs' do
|
||||||
before do
|
before do
|
||||||
allow_any_instance_of(Chef::Recipe).to receive(:internal_endpoint)
|
|
||||||
.with('image-registry')
|
|
||||||
.and_return(double(host: 'registry_host_value', port: 'registry_port_value'))
|
|
||||||
allow_any_instance_of(Chef::Recipe).to receive(:internal_endpoint)
|
|
||||||
.with('identity-internal')
|
|
||||||
.and_return('identity_endpoint_value')
|
|
||||||
identity_admin_endpoint = double(host: 'identity_admin_endpoint_host_value',
|
|
||||||
port: 'identity_admin_endpoint_port_value',
|
|
||||||
scheme: 'identity_admin_endpoint_protocol_value')
|
|
||||||
allow_any_instance_of(Chef::Recipe).to receive(:admin_endpoint)
|
|
||||||
.with('identity-admin')
|
|
||||||
.and_return(identity_admin_endpoint)
|
|
||||||
allow_any_instance_of(Chef::Recipe).to receive(:internal_endpoint)
|
|
||||||
.with('image-api-bind')
|
|
||||||
.and_return(double(host: 'bind_host_value', port: 'bind_port_value'))
|
|
||||||
allow_any_instance_of(Chef::Recipe).to receive(:internal_endpoint)
|
|
||||||
.with('block-storage-api')
|
|
||||||
.and_return(double(scheme: 'scheme', host: 'host', port: 'port', path: '/path'))
|
|
||||||
allow_any_instance_of(Chef::Recipe).to receive(:auth_uri_transform)
|
|
||||||
.with('identity_endpoint_value', 'v3.0')
|
|
||||||
.and_return('auth_uri_value')
|
|
||||||
allow_any_instance_of(Chef::Recipe).to receive(:auth_uri_transform)
|
|
||||||
.with('identity_endpoint_value', 'v2.0')
|
|
||||||
.and_return('auth_uri_value')
|
|
||||||
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
|
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
|
||||||
.with('service', 'openstack-image')
|
.with('service', 'openstack-image')
|
||||||
.and_return('admin_password_value')
|
.and_return('admin_password_value')
|
||||||
|
@ -210,13 +186,11 @@ end
|
||||||
|
|
||||||
shared_examples 'keystone attribute setter' do |version|
|
shared_examples 'keystone attribute setter' do |version|
|
||||||
it 'sets the auth_uri value' do
|
it 'sets the auth_uri value' do
|
||||||
expect(chef_run).to render_file(file.name).with_content(/^auth_uri = auth_uri_value$/)
|
expect(chef_run).to render_file(file.name).with_content(%r(^auth_uri = http://127.0.0.1:5000/v2.0$))
|
||||||
end
|
end
|
||||||
|
|
||||||
%w(host port protocol).each do |attr|
|
it 'sets the identity_uri value' do
|
||||||
it "sets the auth #{attr} attribute" do
|
expect(chef_run).to render_file(file.name).with_content(%r(^identity_uri = http://127.0.0.1:35357/$))
|
||||||
expect(chef_run).to render_file(file.name).with_content(/^auth_#{attr} = identity_admin_endpoint_#{attr}_value$/)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'auth version' do
|
context 'auth version' do
|
||||||
|
|
|
@ -689,9 +689,7 @@ disk_formats = <%= node["openstack"]["image"]["api"]["disk_formats"].join(",") %
|
||||||
|
|
||||||
[keystone_authtoken]
|
[keystone_authtoken]
|
||||||
auth_uri = <%= @auth_uri %>
|
auth_uri = <%= @auth_uri %>
|
||||||
auth_host = <%= @identity_admin_endpoint.host %>
|
identity_uri = <%= @identity_uri %>
|
||||||
auth_port = <%= @identity_admin_endpoint.port %>
|
|
||||||
auth_protocol = <%= @identity_admin_endpoint.scheme %>
|
|
||||||
auth_version = <%= node["openstack"]["image"]["api"]["auth"]["version"] %>
|
auth_version = <%= node["openstack"]["image"]["api"]["auth"]["version"] %>
|
||||||
admin_tenant_name = <%= node["openstack"]["image"]["service_tenant_name"] %>
|
admin_tenant_name = <%= node["openstack"]["image"]["service_tenant_name"] %>
|
||||||
admin_user = <%= node["openstack"]["image"]["service_user"] %>
|
admin_user = <%= node["openstack"]["image"]["service_user"] %>
|
||||||
|
|
|
@ -229,9 +229,7 @@ connection = <%= @sql_connection %>
|
||||||
# ================= Keystone authtoken ===============================
|
# ================= Keystone authtoken ===============================
|
||||||
[keystone_authtoken]
|
[keystone_authtoken]
|
||||||
auth_uri = <%= @auth_uri %>
|
auth_uri = <%= @auth_uri %>
|
||||||
auth_host = <%= @identity_admin_endpoint.host %>
|
identity_uri = <%= @identity_uri %>
|
||||||
auth_port = <%= @identity_admin_endpoint.port %>
|
|
||||||
auth_protocol = <%= @identity_admin_endpoint.scheme %>
|
|
||||||
auth_version = <%= node['openstack']['image']['registry']['auth']['version'] %>
|
auth_version = <%= node['openstack']['image']['registry']['auth']['version'] %>
|
||||||
admin_tenant_name = <%= node["openstack"]["image"]["service_tenant_name"] %>
|
admin_tenant_name = <%= node["openstack"]["image"]["service_tenant_name"] %>
|
||||||
admin_user = <%= node["openstack"]["image"]["service_user"] %>
|
admin_user = <%= node["openstack"]["image"]["service_user"] %>
|
||||||
|
|
Loading…
Reference in New Issue