Skip to content
This repository has been archived by the owner on Jan 29, 2022. It is now read-only.

Commit

Permalink
Only load chatops subclasses when needed
Browse files Browse the repository at this point in the history
  • Loading branch information
David Hollinger committed May 1, 2018
1 parent 3f9a986 commit c8c9111
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/plugins/chatops.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
require 'plugins/chatops/slack'

class PuppetWebhook
# Chatops object for sending webhook notifications to chatops tools
class Chatops
Expand All @@ -14,11 +12,13 @@ def initialize(service, url, channel, user, options = {})
def notify(message)
case @service
when 'slack'
require 'plugins/chatops/slack'
LOGGER.info("Sending Slack webhook message to #{@url}")
Chatops::Slack.new(
@channel, @url, @user, message, http_options: @args[:http_options] || {}, icon_emoji: @args[:icon_emoji]
).notify
when 'rocketchat'
require 'plugins/chatops/rocketchat'
LOGGER.info("Sending Rocket.Chat webhook message to #{@url}")
Chatops::Rocketchat.new(
@channel, @url, @user, message, http_options: @args[:http_options] || {}, icon_emoji: @args[:icon_emoji]
Expand Down

0 comments on commit c8c9111

Please sign in to comment.