From f9672b062f8bdafe77786c47ed40c3ac60c95d8b Mon Sep 17 00:00:00 2001 From: Andrew Smith Date: Tue, 20 Dec 2016 10:00:55 -0500 Subject: [PATCH] Enable alternative transport in os_transport_url Change-Id: Ie6965dc5f7896587b5625e38cc758b5564e59bd4 Closes-Bug: 1651215 --- lib/puppet/parser/functions/os_transport_url.rb | 2 ++ .../os_transport-alt-transport-7cd300380ece2fc9.yaml | 4 ++++ spec/functions/os_transport_url_spec.rb | 10 +++++++++- 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/os_transport-alt-transport-7cd300380ece2fc9.yaml diff --git a/lib/puppet/parser/functions/os_transport_url.rb b/lib/puppet/parser/functions/os_transport_url.rb index 0612c918..28c9c573 100644 --- a/lib/puppet/parser/functions/os_transport_url.rb +++ b/lib/puppet/parser/functions/os_transport_url.rb @@ -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 != '') diff --git a/releasenotes/notes/os_transport-alt-transport-7cd300380ece2fc9.yaml b/releasenotes/notes/os_transport-alt-transport-7cd300380ece2fc9.yaml new file mode 100644 index 00000000..94ef534a --- /dev/null +++ b/releasenotes/notes/os_transport-alt-transport-7cd300380ece2fc9.yaml @@ -0,0 +1,4 @@ +--- +fixes: + - bug 1651215 The transport parameter was not being used so + transport was fixed value 'rabbit' diff --git a/spec/functions/os_transport_url_spec.rb b/spec/functions/os_transport_url_spec.rb index cdfc9f7c..327c347b 100644 --- a/spec/functions/os_transport_url_spec.rb +++ b/spec/functions/os_transport_url_spec.rb @@ -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