This repository has been archived by the owner on Jan 29, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace old slack options and calls with chatops plugin
Replaced the old notify_slack method call in the deployments helpers with calls to the new PuppetWebhook::Chatops plugin. Replaced old Slack config defaults with new Chatops configuration options.
- Loading branch information
1 parent
2c2243c
commit 0dcd860
Showing
4 changed files
with
56 additions
and
18 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,29 @@ | ||
require 'chatops/slack' | ||
|
||
class PuppetWebhook | ||
# Chatops object for sending webhook notifications to chatops tools | ||
class Chatops | ||
def initialize(message, service, url, channel, user, **args) | ||
@message = message | ||
def initialize(service, url, channel, user, **args) | ||
@service = service | ||
@url = url | ||
@channel = channel | ||
@user = user | ||
@args = args | ||
end | ||
|
||
def notify | ||
def notify(message) | ||
case @service | ||
when 'slack' | ||
Chatops::Slack.new(@channel, @url, @user, @args[:icon_emoji], @args[:http_options]).notify | ||
Chatops::Slack.new(@channel, | ||
@url, | ||
@user, | ||
message, | ||
http_options: @args[:http_options], | ||
icon_emoji: @args[:icon_emoji] | ||
).notify | ||
else | ||
LOGGER.error("Service #{@service} is not currently supported") | ||
end | ||
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