sanitize IPv6 in keystone provider
In keystone.rb provider, we need to make sure the ipv6 returned in clean_host method has brackets. If brackets are missing, the provider will fail to manage Keystone resources, because of parsing issue and the multiple ":" in the host value. Change-Id: Ibdb340642270afae64b1055ef5fb97281b17066d Closes-Bug: #1541512
This commit is contained in:
parent
d9cecd44a9
commit
f710bed6aa
@ -29,7 +29,12 @@ class Puppet::Provider::Keystone < Puppet::Provider::Openstack
|
|||||||
when '::0'
|
when '::0'
|
||||||
return '[::1]'
|
return '[::1]'
|
||||||
else
|
else
|
||||||
return host
|
# if ipv6, make sure ip address has brackets - LP#1541512
|
||||||
|
if host.include?(':') and !host.include?(']')
|
||||||
|
return "[" + host + "]"
|
||||||
|
else
|
||||||
|
return host
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -194,6 +194,14 @@ id="the_user_id"
|
|||||||
expect(klass.get_admin_endpoint).to eq('http://[::1]:5001')
|
expect(klass.get_admin_endpoint).to eq('http://[::1]:5001')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'should use [2620:52:0:23a9::25] in the admin endpoint if bind_host is 2620:52:0:23a9::25' do
|
||||||
|
mock = {'DEFAULT' => { 'admin_bind_host' => '2620:52:0:23a9::25', 'admin_port' => '5001' }}
|
||||||
|
File.expects(:exists?).with("/etc/keystone/keystone.conf").returns(true)
|
||||||
|
Puppet::Util::IniConfig::File.expects(:new).returns(mock)
|
||||||
|
mock.expects(:read).with('/etc/keystone/keystone.conf')
|
||||||
|
expect(klass.get_admin_endpoint).to eq('http://[2620:52:0:23a9::25]:5001')
|
||||||
|
end
|
||||||
|
|
||||||
it 'should use localhost in the admin endpoint if bind_host is unspecified' do
|
it 'should use localhost in the admin endpoint if bind_host is unspecified' do
|
||||||
mock = {'DEFAULT' => { 'admin_port' => '5001' }}
|
mock = {'DEFAULT' => { 'admin_port' => '5001' }}
|
||||||
File.expects(:exists?).with("/etc/keystone/keystone.conf").returns(true)
|
File.expects(:exists?).with("/etc/keystone/keystone.conf").returns(true)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user