-
Notifications
You must be signed in to change notification settings - Fork 289
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(#495) Notify Service[sensu-enterprise] from Sensu::Check resources #720
Merged
ghoneycutt
merged 3 commits into
sensu:master
from
jeffmccune:495_check_should_notify_sensu-enterprise
Jul 10, 2017
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
require 'spec_helper' | ||
|
||
describe Puppet::Type.type(:sensu_check_config) do | ||
let(:resource_hash) do | ||
{ | ||
:title => 'foo.example.com', | ||
:catalog => Puppet::Resource::Catalog.new | ||
} | ||
end | ||
|
||
describe 'notifications' do | ||
context 'when managing sensu-enterprise (#495)' do | ||
let(:service_resource) do | ||
Puppet::Type.type(:service).new(name: 'sensu-enterprise') | ||
end | ||
let(:resource_hash) do | ||
c = Puppet::Resource::Catalog.new | ||
c.add_resource(service_resource) | ||
{ | ||
:title => 'foo.example.com', | ||
:catalog => c | ||
} | ||
end | ||
|
||
it 'notifies Service[sensu-enterprise]' do | ||
notify_list = described_class.new(resource_hash)[:notify] | ||
# compare the resource reference strings, the object identities differ. | ||
expect(notify_list.map(&:ref)).to eq [service_resource.ref] | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
require 'spec_helper' | ||
|
||
describe Puppet::Type.type(:sensu_extension) do | ||
let(:resource_hash) do | ||
{ | ||
:title => 'Emanon', | ||
:catalog => Puppet::Resource::Catalog.new | ||
} | ||
end | ||
|
||
describe 'notifications' do | ||
context 'when managing sensu-enterprise (#495)' do | ||
let(:service_resource) do | ||
Puppet::Type.type(:service).new(name: 'sensu-enterprise') | ||
end | ||
let(:resource_hash) do | ||
c = Puppet::Resource::Catalog.new | ||
c.add_resource(service_resource) | ||
{ | ||
:title => 'Emanon', | ||
:catalog => c | ||
} | ||
end | ||
|
||
it 'notifies Service[sensu-enterprise]' do | ||
notify_list = described_class.new(resource_hash)[:notify] | ||
# compare the resource reference strings, the object identities differ. | ||
expect(notify_list.map(&:ref)).to eq [service_resource.ref] | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
require 'spec_helper' | ||
|
||
describe Puppet::Type.type(:sensu_handler) do | ||
let(:resource_hash) do | ||
{ | ||
:title => 'myhandler', | ||
:catalog => Puppet::Resource::Catalog.new | ||
} | ||
end | ||
|
||
describe 'notifications' do | ||
context 'when managing sensu-enterprise (#495)' do | ||
let(:service_resource) do | ||
Puppet::Type.type(:service).new(name: 'sensu-enterprise') | ||
end | ||
let(:resource_hash) do | ||
c = Puppet::Resource::Catalog.new | ||
c.add_resource(service_resource) | ||
{ | ||
:title => 'myhandler', | ||
:catalog => c | ||
} | ||
end | ||
|
||
it 'notifies Service[sensu-enterprise]' do | ||
notify_list = described_class.new(resource_hash)[:notify] | ||
# compare the resource reference strings, the object identities differ. | ||
expect(notify_list.map(&:ref)).to eq [service_resource.ref] | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
require 'spec_helper' | ||
|
||
describe Puppet::Type.type(:sensu_mutator) do | ||
let(:resource_hash) do | ||
{ | ||
:title => 'mymutator', | ||
:catalog => Puppet::Resource::Catalog.new | ||
} | ||
end | ||
|
||
describe 'notifications' do | ||
context 'when managing sensu-enterprise (#495)' do | ||
let(:service_resource) do | ||
Puppet::Type.type(:service).new(name: 'sensu-enterprise') | ||
end | ||
let(:resource_hash) do | ||
c = Puppet::Resource::Catalog.new | ||
c.add_resource(service_resource) | ||
{ | ||
:title => 'mymutator', | ||
:catalog => c | ||
} | ||
end | ||
|
||
it 'notifies Service[sensu-enterprise]' do | ||
notify_list = described_class.new(resource_hash)[:notify] | ||
# compare the resource reference strings, the object identities differ. | ||
expect(notify_list.map(&:ref)).to eq [service_resource.ref] | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,18 +9,19 @@ | |
mode => '0600', | ||
} | ||
|
||
# NOTE: When testing sensu enterprise, provide the SE_USER and SE_PASS to use | ||
# with the online repository using the FACTER_SE_USER and FACTER_SE_PASS | ||
# environment variables. An effective way to manage this is with `direnv` | ||
class { '::sensu': | ||
install_repo => true, | ||
server => true, | ||
enterprise => true, | ||
enterprise_user => $facts['se_user'], | ||
enterprise_pass => $facts['se_pass'], | ||
manage_services => true, | ||
manage_user => true, | ||
rabbitmq_password => 'correct-horse-battery-staple', | ||
rabbitmq_vhost => '/sensu', | ||
api => true, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why was the API portion removed? |
||
api_user => 'admin', | ||
api_password => 'secret', | ||
client_address => $::ipaddress_eth1, | ||
# enterprise options | ||
api_ssl_port => '4568', | ||
api_ssl_keystore_file => '/etc/sensu/api.keystore', | ||
api_ssl_keystore_password => 'sensutest', | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if Service[sensu-enterprise] is not in the catalog, because we aren't using enterprise, does this cause a problem?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I expect no problem because
Array#select
filters out the resource ref when absent from the catalog.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you verified with
vagrant up
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, will do so now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ghoneycutt I modified the provisioning manifest for
sensu-server-enterprise
to manage Service[sensu-enterprise] instead of Service[sensu-server]. Take a look at this change in 1d694e4, I assumedtests/sensu-server-enterprise.pp
is intended to setup sensu-enterprise.With
vagrant up sensu-server
, the notification doesn't cause a problem as we expect. Withvagrant up sensu-server-enterprise
, the notification does properly notifyService[sensu-enterprise]
when a managedsensu::check
resource changes state.