From 4e11e3fe4e0e62d5cde64c883160eb5af1f7f368 Mon Sep 17 00:00:00 2001 From: Tobias Urdin Date: Sun, 21 Oct 2018 16:53:51 +0200 Subject: [PATCH] Fix rabbitmq README and examples Change-Id: Ic8d6fd0c75384ef272fe54af009a329df67e9d45 --- README.md | 6 ++---- examples/ironic.pp | 24 +++++++++++++----------- spec/classes/ironic_init_spec.rb | 22 +++++++--------------- 3 files changed, 22 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index 0ee3c894..4ba742f5 100644 --- a/README.md +++ b/README.md @@ -46,10 +46,8 @@ To utilize the ironic module's functionality you will need to declare multiple r ```puppet # enable Ironic resources class { '::ironic': - rabbit_userid => 'ironic', - rabbit_password => 'an_even_bigger_secret', - rabbit_host => '127.0.0.1', - database_connection => 'mysql://ironic:a_big_secret@127.0.0.1/ironic?charset=utf8', + default_transport_url => 'rabbit://ironic:an_even_bigger_secret@127.0.0.1:5672/ironic', + database_connection => 'mysql://ironic:a_big_secret@127.0.0.1/ironic?charset=utf8', } class { '::ironic::db::mysql': diff --git a/examples/ironic.pp b/examples/ironic.pp index 1c9de95f..84c12859 100644 --- a/examples/ironic.pp +++ b/examples/ironic.pp @@ -81,17 +81,19 @@ node 'db' { node 'controller' { class { '::ironic': - db_password => $db_password, - db_name => $db_name, - db_user => $db_username, - db_host => $db_host, - - rabbit_password => $rabbit_password, - rabbit_userid => $rabbit_user, - rabbit_virtual_host => $rabbit_vhost, - rabbit_hosts => $rabbit_hosts, - - glance_api_servers => $glance_api_servers, + db_password => $db_password, + db_name => $db_name, + db_user => $db_username, + db_host => $db_host, + default_transport_url => os_transport_url({ + 'transport' => 'rabbit', + 'hosts' => $rabbit_hosts, + 'port' => $rabbit_port, + 'username' => $rabbit_user, + 'password' => $rabbit_password, + 'virtual_host' => $rabbit_vhost, + }), + glance_api_servers => $glance_api_servers, } class { '::ironic::api': } diff --git a/spec/classes/ironic_init_spec.rb b/spec/classes/ironic_init_spec.rb index 4b721181..bfbea760 100644 --- a/spec/classes/ironic_init_spec.rb +++ b/spec/classes/ironic_init_spec.rb @@ -36,27 +36,19 @@ describe 'ironic' do shared_examples_for 'ironic' do - context 'and if rabbit_host parameter is provided' do + context 'ironic setup' do it_configures 'a ironic base installation' it_configures 'with SSL disabled' it_configures 'with SSL enabled without kombu' it_configures 'with SSL enabled with kombu' it_configures 'with amqp_durable_queues disabled' it_configures 'with amqp_durable_queues enabled' + it_configures 'without rabbit HA' end - context 'and if rabbit_hosts parameter is provided' do - - context 'with one server' do - it_configures 'a ironic base installation' - it_configures 'rabbit HA with a single virtual host' - end - - context 'with multiple servers' do - before { params.merge!( :rabbit_ha_queues => true ) } - it_configures 'a ironic base installation' - it_configures 'rabbit HA with multiple hosts' - end + context 'ironic setup with rabbit HA' do + before { params.merge!( :rabbit_ha_queues => true ) } + it_configures 'with rabbit HA' end context 'with amqp messaging' do @@ -121,13 +113,13 @@ describe 'ironic' do end end - shared_examples_for 'rabbit HA with a single virtual host' do + shared_examples_for 'without rabbit HA' do it 'in ironic.conf' do is_expected.to contain_ironic_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('') end end - shared_examples_for 'rabbit HA with multiple hosts' do + shared_examples_for 'with rabbit HA' do it 'in ironic.conf' do is_expected.to contain_ironic_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value(true) end