Enable alternative transport in os_transport_url

Change-Id: Ie6965dc5f7896587b5625e38cc758b5564e59bd4
Closes-Bug: 1651215
This commit is contained in:
Andrew Smith 2016-12-20 10:00:55 -05:00
parent 80981a4cc6
commit f9672b062f
3 changed files with 15 additions and 1 deletions

View File

@ -94,6 +94,8 @@ EOS
raise(Puppet::ParseError, 'os_transport_url(): cannot use both host and hosts.')
end
parts[:transport] = v['transport']
if v.include?('username') and (v['username'] != :undef) and (v['username'].to_s != '')
parts[:userinfo] = URI.escape(v['username'])
if v.include?('password') and (v['password'] != :undef) and (v['password'].to_s != '')

View File

@ -0,0 +1,4 @@
---
fixes:
- bug 1651215 The transport parameter was not being used so
transport was fixed value 'rabbit'

View File

@ -262,8 +262,16 @@ describe 'os_transport_url' do
'ssl' => 'False',
'query' => { 'read_timeout' => '60' },
}).and_return('rabbit://guest@127.0.0.1:5672/virt?read_timeout=60&ssl=0')
end
it 'with alternative transport and single host array for hosts' do
is_expected.to run.with_params({
'transport' => 'amqp',
'hosts' => [ '127.0.0.1' ],
'port' => '5672',
'username' => 'guest',
'password' => 's3cr3t',
}).and_return('amqp://guest:s3cr3t@127.0.0.1:5672/')
end
end