diff --git a/lib/plugins/chatops.rb b/lib/plugins/chatops.rb index 5db08c9..8a4724d 100644 --- a/lib/plugins/chatops.rb +++ b/lib/plugins/chatops.rb @@ -1,5 +1,3 @@ -require 'plugins/chatops/slack' - class PuppetWebhook # Chatops object for sending webhook notifications to chatops tools class Chatops @@ -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]