Skip to content
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

Add support for using the same source for different sensu handlers #471

Merged
merged 1 commit into from
Feb 15, 2016

Conversation

salimane
Copy link
Contributor

@salimane salimane commented Feb 1, 2016

Currently it's impossible to use the same source for different handlers. a duplicate file definition exception is thrown. This PR fixes that. With this PR, you can now do:

---
sensu::handlers:
  'hipchat_main_room':
    type: pipe
    source: "puppet:///modules/sensu_module/community-plugins/handlers/notification/hipchat.rb"
    config:
      apikey: my_long_key
      room: Big Alerts
  'hipchat_other_room':
    type: pipe
    source: "puppet:///modules/sensu_module/community-plugins/handlers/notification/hipchat.rb"
    config:
      apikey: my_other_long_key
      room: 'Small Alerts'

cc @jlambert121
Thanks

@jlambert121
Copy link
Contributor

I see the issue, but I'm struggling on putting each handler into its own directory for this somewhat edge case (I say edge because I haven't seen anything about hitting this issue before). What about just wrapping the file resource in handler.pp with an ensure_resource instead? I don't normally like using that because I don't think the code is as explicit, but this seems like it could be a prime use case.

@salimane
Copy link
Contributor Author

@jlambert121 , I've updated the changes and use ensure_resource instead.
Thanks

@jlambert121
Copy link
Contributor

Thanks!

jlambert121 added a commit that referenced this pull request Feb 15, 2016
Add support for using the same source for  different sensu handlers
@jlambert121 jlambert121 merged commit 6278ba9 into sensu:master Feb 15, 2016
@salimane salimane deleted the handlers branch February 16, 2016 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants