From 4c3e2714e0991ace66c1ebc24a40411ec1c76ccf Mon Sep 17 00:00:00 2001 From: Justin Lambert Date: Sun, 24 Feb 2013 19:26:04 -0700 Subject: [PATCH] rename defines that should be classes --- manifests/client.pp | 11 ++++++----- manifests/rabbitmq.pp | 6 +++--- manifests/server.pp | 4 ++-- spec/{defines => classes}/sensu_client_spec.rb | 11 ++++++----- spec/{defines => classes}/sensu_rabbitmq_spec.rb | 2 +- spec/{defines => classes}/sensu_server_spec.rb | 6 +++--- 6 files changed, 21 insertions(+), 19 deletions(-) rename spec/{defines => classes}/sensu_client_spec.rb (88%) rename spec/{defines => classes}/sensu_rabbitmq_spec.rb (97%) rename spec/{defines => classes}/sensu_server_spec.rb (96%) diff --git a/manifests/client.pp b/manifests/client.pp index 4bbcf85a2b..3b614dfc45 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -1,11 +1,11 @@ -# = Define: sensu::client +# = Class: sensu::client # # Configures Sensu clients # # == Parameters # -define sensu::client( +class sensu::client( $rabbitmq_password, $rabbitmq_ssl_private_key = '', $rabbitmq_ssl_cert_chain = '', @@ -14,12 +14,13 @@ $rabbitmq_user = 'sensu', $rabbitmq_vhost = '/sensu', $address = $::ipaddress, - $subscriptions = [] + $subscriptions = [], + $client_name = $::fqdn ) { include sensu::package - sensu::rabbitmq { 'client': + class { 'sensu::rabbitmq': ssl_cert_chain => $rabbitmq_ssl_cert_chain, ssl_private_key => $rabbitmq_ssl_private_key, port => $rabbitmq_port, @@ -30,7 +31,7 @@ } sensu_client_config { $::fqdn: - client_name => $name, + client_name => $client_name, address => $address, subscriptions => $subscriptions, } diff --git a/manifests/rabbitmq.pp b/manifests/rabbitmq.pp index 0e5a1fc51e..6451959291 100644 --- a/manifests/rabbitmq.pp +++ b/manifests/rabbitmq.pp @@ -1,11 +1,11 @@ -# = Define: sensu::rabbitmq +# = Class: sensu::rabbitmq # -# Configures RabbitMQ for Sensu +# Configures Sensu for RabbitMQ # # == Parameters # -define sensu::rabbitmq( +class sensu::rabbitmq( $ssl_cert_chain, $ssl_private_key, $port, diff --git a/manifests/server.pp b/manifests/server.pp index d50ef5141c..a738bc8b49 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -5,7 +5,7 @@ # == Parameters # -define sensu::server( +class sensu::server( $rabbitmq_password, $rabbitmq_port = '5671', $rabbitmq_host = 'localhost', @@ -25,7 +25,7 @@ ) { include sensu::package - sensu::rabbitmq { 'server': + class { 'sensu::rabbitmq': ssl_cert_chain => $rabbitmq_ssl_cert_chain, ssl_private_key => $rabbitmq_ssl_private_key, port => $rabbitmq_port, diff --git a/spec/defines/sensu_client_spec.rb b/spec/classes/sensu_client_spec.rb similarity index 88% rename from spec/defines/sensu_client_spec.rb rename to spec/classes/sensu_client_spec.rb index dba97511b0..418958b235 100644 --- a/spec/defines/sensu_client_spec.rb +++ b/spec/classes/sensu_client_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe 'sensu::client', :type => :define do +describe 'sensu::client', :type => :class do let(:title) { 'myclient' } context 'defaults' do @@ -8,7 +8,7 @@ let(:params) { { :rabbitmq_password => 'asdfjkl' } } it { should include_class('sensu::package') } - it { should contain_sensu__rabbitmq('client').with( + it { should contain_class('sensu::rabbitmq').with( 'ssl_cert_chain' => '', 'ssl_private_key' => '', 'port' => '5671', @@ -19,7 +19,7 @@ ) } it { should contain_sensu_client_config('host.domain.com').with( - 'client_name' => 'myclient', + 'client_name' => 'host.domain.com', 'address' => '2.3.4.5', 'subscriptions' => [] ) } @@ -43,11 +43,12 @@ :rabbitmq_user => 'sensuuser', :rabbitmq_vhost => '/myvhost', :address => '1.2.3.4', - :subscriptions => ['all'] + :subscriptions => ['all'], + :client_name => 'myclient' } } it { should include_class('sensu::package') } - it { should contain_sensu__rabbitmq('client').with( + it { should contain_class('sensu::rabbitmq').with( 'ssl_cert_chain' => '/etc/sensu/ssl/chain.pem', 'ssl_private_key' => '/etc/sensu/ssl/key.pem', 'port' => '1234', diff --git a/spec/defines/sensu_rabbitmq_spec.rb b/spec/classes/sensu_rabbitmq_spec.rb similarity index 97% rename from spec/defines/sensu_rabbitmq_spec.rb rename to spec/classes/sensu_rabbitmq_spec.rb index 2c3148ee8c..afcc5e35d0 100644 --- a/spec/defines/sensu_rabbitmq_spec.rb +++ b/spec/classes/sensu_rabbitmq_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe 'sensu::rabbitmq', :type => :define do +describe 'sensu::rabbitmq', :type => :class do let(:title) { 'myrabbit' } let(:facts) { { :fqdn => 'hostname.domain.com' } } diff --git a/spec/defines/sensu_server_spec.rb b/spec/classes/sensu_server_spec.rb similarity index 96% rename from spec/defines/sensu_server_spec.rb rename to spec/classes/sensu_server_spec.rb index e1865be2ec..d5f596776e 100644 --- a/spec/defines/sensu_server_spec.rb +++ b/spec/classes/sensu_server_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe 'sensu::server', :type => :define do +describe 'sensu::server', :type => :class do let(:title) { 'sensu::server' } context 'defaults' do @@ -9,7 +9,7 @@ it { should include_class('sensu::package') } - it { should contain_sensu__rabbitmq('server').with( + it { should contain_class('sensu::rabbitmq').with( 'ssl_cert_chain' => '', 'ssl_private_key' => '', 'port' => '5671', @@ -82,7 +82,7 @@ it { should include_class('sensu::package') } - it { should contain_sensu__rabbitmq('server').with( + it { should contain_class('sensu::rabbitmq').with( 'ssl_cert_chain' => '/etc/rabbitmq/ssl/chain.pem', 'ssl_private_key' => '/etc/rabbitmq/ssl/key.pem', 'port' => '1234',