From 90dbd4d6d070c32287c13d8a4dad8fb256a165fc Mon Sep 17 00:00:00 2001 From: Eric Heydrick Date: Sun, 1 Dec 2019 19:54:55 -0800 Subject: [PATCH] Remove Hipchat support (#32) Hipchat has been discontinued --- README.md | 2 +- aws-cleaner.gemspec | 1 - bin/aws_cleaner.rb | 5 ++--- config.yml.sample | 4 ---- lib/aws-cleaner.rb | 14 +------------- 5 files changed, 4 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 851b3ab..7cd4479 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![Gem Version](https://badge.fury.io/rb/aws-cleaner.svg)](http://badge.fury.io/rb/aws-cleaner) AWS Cleaner listens for EC2 termination events produced by AWS [CloudWatch Events](http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/WhatIsCloudWatchEvents.html) -and removes the instances from Chef. It can optionally remove the node from Sensu Monitoring (defaults true), fire off webhooks, and send notifications via Hipchat & Slack when actions occur. +and removes the instances from Chef. It can optionally remove the node from Sensu Monitoring (defaults true), fire off webhooks, and send notifications via Slack when actions occur. ![aws-cleaner](https://raw.github.com/eheydrick/aws-cleaner/master/aws-cleaner.png) diff --git a/aws-cleaner.gemspec b/aws-cleaner.gemspec index c3e21e0..812c927 100644 --- a/aws-cleaner.gemspec +++ b/aws-cleaner.gemspec @@ -17,7 +17,6 @@ Gem::Specification.new do |s| s.add_runtime_dependency 'aws-sdk-sqs', '~> 1' s.add_runtime_dependency 'chef-infra-api', '~> 0.9' - s.add_runtime_dependency 'hipchat', '~> 1.5' s.add_runtime_dependency 'optimist', '~> 3.0' s.add_runtime_dependency 'rest-client', '~> 2' s.add_runtime_dependency 'slack-poster', '~> 2.2' diff --git a/bin/aws_cleaner.rb b/bin/aws_cleaner.rb index 5d08e1c..445ffe1 100755 --- a/bin/aws_cleaner.rb +++ b/bin/aws_cleaner.rb @@ -4,9 +4,9 @@ # # Listen for AWS CloudWatch Events EC2 termination events delivered via SQS # and remove the node from Chef and Sensu and send a notification -# to Hipchat or Slack +# to Slack # -# Copyright (c) 2015-2017 Eric Heydrick +# Copyright (c) 2015-2019 Eric Heydrick # Licensed under The MIT License # @@ -16,7 +16,6 @@ require 'yaml' require 'aws-sdk-sqs' require 'chef-api' - require 'hipchat' require 'rest-client' require 'optimist' require 'slack/poster' diff --git a/config.yml.sample b/config.yml.sample index 9b42a01..29a99f5 100644 --- a/config.yml.sample +++ b/config.yml.sample @@ -12,10 +12,6 @@ :url: 'https://chef.example.com/organizations/example' :client: 'somebody' :key: '/path/to/client.pem' -:hipchat: - :api_token: 'Hipchat API token' - :room: 'Notifications' - :enable: false :slack: :webhook_url: 'https://hooks.slack.com/services/XXXXXXXX/YYYYYYY/ZZZZZZZZZZZZZZZZ' :channel: '#notifications' diff --git a/lib/aws-cleaner.rb b/lib/aws-cleaner.rb index fd95a7d..ecf3ca6 100644 --- a/lib/aws-cleaner.rb +++ b/lib/aws-cleaner.rb @@ -115,16 +115,6 @@ def process_message(message_body) end module Notify - # notify hipchat - def self.notify_hipchat(msg, config) - hipchat = HipChat::Client.new( - config[:hipchat][:api_token], - api_version: 'v2' - ) - room = config[:hipchat][:room] - hipchat[room].send('AWS Cleaner', msg) - end - # notify slack def self.notify_slack(msg, config) slack = Slack::Poster.new(config[:slack][:webhook_url]) @@ -136,9 +126,7 @@ def self.notify_slack(msg, config) # generic chat notification method def self.notify_chat(msg, config) - if config[:hipchat][:enable] - notify_hipchat(msg, config) - elsif config[:slack][:enable] + if config[:slack][:enable] notify_slack(msg, config) end end