aws-cleaner 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/aws_cleaner.rb +13 -6
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67474a14055387fa8416c92892bcc73d236d76f0
|
4
|
+
data.tar.gz: 544af743776d8bc8a68157813a3327926454baeb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c0fc65ffcc9377f19a99cfffaa746835abb9d1cd966e0535443c1316fabdc7b6cc04446ee196bfea927d50ab5256ff7f918d10ee7576eea4e50866d6047e51f
|
7
|
+
data.tar.gz: 87a062ea6578a0a6b8c97d959a9a5d19839954aa5fbbe2daec88f0cd1f78ad30bf42ea1ea6dae5bb4e15ca41991051a1418f94d78ac10e77b25b957d65103689
|
data/bin/aws_cleaner.rb
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
# and remove the node from Chef and Sensu and send a notification
|
5
5
|
# to Hipchat
|
6
6
|
#
|
7
|
-
# Copyright (c) 2015 Eric Heydrick
|
7
|
+
# Copyright (c) 2015, 2106 Eric Heydrick
|
8
8
|
# Licensed under The MIT License
|
9
9
|
#
|
10
10
|
|
@@ -94,7 +94,7 @@ end
|
|
94
94
|
# check if the node exists in Sensu
|
95
95
|
def in_sensu?(node_name)
|
96
96
|
begin
|
97
|
-
RestClient.
|
97
|
+
RestClient::Request.execute(url: "#{@config[:sensu][:url]}/clients/#{node_name}", method: :get, timeout: 5, open_timeout: 5)
|
98
98
|
rescue RestClient::ResourceNotFound
|
99
99
|
return false
|
100
100
|
rescue => e
|
@@ -107,7 +107,7 @@ end
|
|
107
107
|
|
108
108
|
# call the Sensu API to remove the node
|
109
109
|
def remove_from_sensu(node_name)
|
110
|
-
response = RestClient.
|
110
|
+
response = RestClient::Request.execute(url: "#{@config[:sensu][:url]}/clients/#{node_name}", method: :delete, timeout: 5, open_timeout: 5)
|
111
111
|
case response.code
|
112
112
|
when 202
|
113
113
|
notify_hipchat('Removed ' + node_name + ' from Sensu') if @config[:hipchat][:enable]
|
@@ -143,9 +143,15 @@ end
|
|
143
143
|
|
144
144
|
# generate the URL for the webhook
|
145
145
|
def generate_template(item, template_variable_method, template_variable_argument, template_variable)
|
146
|
-
|
147
|
-
|
148
|
-
|
146
|
+
begin
|
147
|
+
replacement = send(template_variable_method, eval(template_variable_argument))
|
148
|
+
item.gsub!(/{#{template_variable}}/, replacement)
|
149
|
+
rescue Exception => e
|
150
|
+
puts "Error generating template: #{e.message}"
|
151
|
+
return false
|
152
|
+
else
|
153
|
+
item
|
154
|
+
end
|
149
155
|
end
|
150
156
|
|
151
157
|
# call an HTTP endpoint
|
@@ -158,6 +164,7 @@ def fire_webhook(config)
|
|
158
164
|
config[:template_variables][:argument],
|
159
165
|
config[:template_variables][:variable]
|
160
166
|
)
|
167
|
+
return false unless url
|
161
168
|
else
|
162
169
|
url = config[:url]
|
163
170
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aws-cleaner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Heydrick
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-04-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-core
|
@@ -108,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
108
|
version: '0'
|
109
109
|
requirements: []
|
110
110
|
rubyforge_project:
|
111
|
-
rubygems_version: 2.0.14
|
111
|
+
rubygems_version: 2.0.14.1
|
112
112
|
signing_key:
|
113
113
|
specification_version: 4
|
114
114
|
summary: AWS Cleaner cleans up after EC2 instances are terminated
|