aws-cleaner 2.2.0 → 2.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/aws-cleaner.rb +16 -16
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 80481ad1bbad492ed7a78e64b32ed31e8f8d76e3
4
- data.tar.gz: d4925c9b50c0d2cb1380fae10d7be3d5f1bfd552
3
+ metadata.gz: a88504d1196ccc539ecd4ad7c76bb900a760b8f2
4
+ data.tar.gz: e775a96820ae0656d0d112755cf88f33c62accde
5
5
  SHA512:
6
- metadata.gz: 97bacc126598670d7884803c370d58cc2629c534d51090e9a7b580bb7196f05de14daf767c10e077015bb97e07ab5d52c949b8b8559f82762b0501e0edf6841d
7
- data.tar.gz: ee53322b71a5d4a0c28f3323479f3fa0ab452ee59175ecbfd24c56b332a75c1026cc4e2667147118440467ba239aa37b2ba6a11aafd828db62949a94bcb14068
6
+ metadata.gz: 73b82755cd2b6243c6de3e42f3d4a5555770284dcd8ec1da9633ae86580d201ab1cb86a5925152bbb7567a42cd278fb83e795796c0ea0a3646d6e1476ef673e1
7
+ data.tar.gz: 54bf287440defe954ef1a6927185fad067decfeb99feaf101905ff3b88ce03694dc8b556ceb6741209c4de54bb14a9a70e1179b4b7726724537bd2b28330290c
data/lib/aws-cleaner.rb CHANGED
@@ -150,12 +150,12 @@ class AwsCleaner
150
150
  else
151
151
  raise 'Unknown templating method'
152
152
  end
153
- item.gsub!(/{#{template_variable}}/, replacement)
153
+ replaced_item = item.gsub(/{#{template_variable}}/, replacement)
154
154
  rescue StandardError => e
155
155
  puts "Error generating template: #{e.message}"
156
156
  return false
157
157
  else
158
- item
158
+ replaced_item
159
159
  end
160
160
 
161
161
  # call an HTTP endpoint
@@ -175,21 +175,21 @@ class AwsCleaner
175
175
  end
176
176
 
177
177
  hook = { method: hook_config[:method].to_sym, url: url }
178
- r = RestClient::Request.execute(hook)
179
- if r.code != 200
178
+ begin
179
+ RestClient::Request.execute(hook)
180
+ rescue RestClient::ExceptionWithResponse => e
180
181
  return false
181
- else
182
- # notify chat when webhook is successful
183
- if hook_config[:chat][:enable]
184
- msg = AwsCleaner::Webhooks.generate_template(
185
- hook_config[:chat][:message],
186
- hook_config[:chat][:method],
187
- hook_config[:chat][:variable],
188
- config,
189
- instance_id
190
- )
191
- AwsCleaner::Notify.notify_chat(msg, config)
192
- end
182
+ end
183
+ # notify chat when webhook is successful
184
+ if hook_config[:chat][:enable]
185
+ msg = AwsCleaner::Webhooks.generate_template(
186
+ hook_config[:chat][:message],
187
+ hook_config[:chat][:method],
188
+ hook_config[:chat][:variable],
189
+ config,
190
+ instance_id
191
+ )
192
+ AwsCleaner::Notify.notify_chat(msg, config)
193
193
  return true
194
194
  end
195
195
  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: 2.2.0
4
+ version: 2.2.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: 2018-02-21 00:00:00.000000000 Z
11
+ date: 2018-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler