Skip to content

Commit

Permalink
Merge pull request #15 from jlambert121/define_rename
Browse files Browse the repository at this point in the history
rename defines that should be classes
  • Loading branch information
jamtur01 committed Feb 25, 2013
2 parents 7ab31cc + 4c3e271 commit b80f3a4
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 19 deletions.
11 changes: 6 additions & 5 deletions manifests/client.pp
Original file line number Diff line number Diff line change
@@ -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 = '',
Expand All @@ -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,
Expand All @@ -30,7 +31,7 @@
}

sensu_client_config { $::fqdn:
client_name => $name,
client_name => $client_name,
address => $address,
subscriptions => $subscriptions,
}
Expand Down
6 changes: 3 additions & 3 deletions manifests/rabbitmq.pp
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
4 changes: 2 additions & 2 deletions manifests/server.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# == Parameters
#

define sensu::server(
class sensu::server(
$rabbitmq_password,
$rabbitmq_port = '5671',
$rabbitmq_host = 'localhost',
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
require 'spec_helper'

describe 'sensu::client', :type => :define do
describe 'sensu::client', :type => :class do
let(:title) { 'myclient' }

context 'defaults' do
let(:facts) { { :ipaddress => '2.3.4.5', :fqdn => 'host.domain.com' } }
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',
Expand All @@ -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' => []
) }
Expand All @@ -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',
Expand Down
Original file line number Diff line number Diff line change
@@ -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' } }

Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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',
Expand Down Expand Up @@ -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',
Expand Down

0 comments on commit b80f3a4

Please sign in to comment.