sport_ngin_aws_auditor 3.8.2 → 3.8.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 57b8658e2851778a2cb51a97a24abff4b3f7aaf0
4
- data.tar.gz: efbb6954e3bd4a5db327e65b995a59880380389d
3
+ metadata.gz: 61c18acb4a0425eecc7d1c34475b6f9e4782a591
4
+ data.tar.gz: b64e797ac47c77b29c8572336f0a096e293f785d
5
5
  SHA512:
6
- metadata.gz: ebceaccabab56682e8a33cc8c5c54d451227b8962740369b11db2c3bff689b3254c235d49066255d103dc99eee2078942b5e406e8d1157bf9b569784351dae94
7
- data.tar.gz: bc246c946109b27e7db5a0655e5ea6f3c13937d9773287e3ac35c1efd1a4a060d9f4a795325c9fa7151be878260a15df01b6a46c21da7610ff234091700678b9
6
+ metadata.gz: 65a9c6b87a00aa2b941b40876a2e2ff96c42ad0a2719fc05e8ebe57a21aa576ef99f1640e99adf81f5e95d48c0414e6cc409e7727759cacefee2f69e30787c39
7
+ data.tar.gz: be320dedfbd0384a24f185067e8b870e11c1566cf4aeb21aa2245821cdd6835ef6d2bd308fc84420cb35bf3def5161f1da704ebf65674e28365f623e19ddc24d
data/CHANGELOG.markdown CHANGED
@@ -1,3 +1,8 @@
1
+ #### v3.8.3
2
+ * Fixing bugs with outputs and counts
3
+
4
+ > Emma Sax: Tim Sandquist, Unknown User: https://github.com/sportngin/sport_ngin_aws_auditor/pull/23
5
+
1
6
  #### v3.8.2
2
7
  * Fixing bugs so that counts are accurate again
3
8
 
@@ -28,18 +28,28 @@ module SportNginAwsAuditor
28
28
  def add_instances_with_tag_to_hash(instances_to_add, instance_hash)
29
29
  instances_to_add.each do |instance|
30
30
  next if instance.nil?
31
- key = instance.to_s << " with tag"
31
+ key = instance.to_s.dup << " with tag (" << instance.name << ")"
32
32
  instance_result = []
33
- if instance_hash.has_key?(key)
34
- instance_result << instance_hash[key][0] + instance.count
33
+
34
+ if instance_hash.has_key?(instance.to_s) && instance_hash[instance.to_s][0] > 0
35
+ current_val = instance_hash[instance.to_s][0]
36
+ val = current_val - instance.count
37
+ new_val = val >= 0 ? val : 0
38
+ instance_hash[instance.to_s][0] = new_val
39
+
40
+ val = instance.count - current_val
41
+ new_val = val >= 0 ? val : 0
42
+ instance_result << new_val
35
43
  else
36
44
  instance_result << instance.count
37
45
  end
46
+
38
47
  instance_result << instance.name
39
48
  instance_result << instance.tag_reason
40
49
  instance_result << instance.tag_value
41
50
  instance_hash[key] = instance_result
42
51
  end if instances_to_add
52
+
43
53
  instance_hash
44
54
  end
45
55
 
@@ -91,7 +101,7 @@ module SportNginAwsAuditor
91
101
  instances.select do |instance|
92
102
  value = gather_instance_tag_date(instance)
93
103
  one_week_ago = (Date.today - 7).to_s
94
- if (value && (one_week_ago < value.to_s) && (value.to_s < Date.today.to_s))
104
+ if (value && (one_week_ago < value.to_s) && (value.to_s <= Date.today.to_s))
95
105
  return_array << RecentlyRetiredTag.new(value.to_s, instance.to_s, instance.name, instance.tag_reason)
96
106
  end
97
107
  end
@@ -84,9 +84,9 @@ module SportNginAwsAuditor
84
84
  color, rgb, prefix = color_chooser(instance)
85
85
  if instance.tagged?
86
86
  if instance.reason
87
- puts "#{prefix} #{name}: #{count} (expiring on #{instance.tag_value} because of #{instance.reason})".blue
87
+ puts "#{prefix} #{name}: (expiring on #{instance.tag_value} because of #{instance.reason})".blue
88
88
  else
89
- say "<%= color('#{prefix} #{name}: #{count} (expiring on #{instance.tag_value})', :#{color}) %>"
89
+ say "<%= color('#{prefix} #{name}: (expiring on #{instance.tag_value})', :#{color}) %>"
90
90
  end
91
91
  else
92
92
  say "<%= color('#{prefix} #{name}: #{count}', :#{color}) %>"
@@ -152,9 +152,9 @@ module SportNginAwsAuditor
152
152
  color, rgb, prefix = color_chooser(tagged)
153
153
 
154
154
  if tagged.reason
155
- text = "#{prefix} #{type}: #{count} (expiring on #{tagged.tag_value} because of #{tagged.reason})"
155
+ text = "#{prefix} #{type}: (expiring on #{tagged.tag_value} because of #{tagged.reason})"
156
156
  else
157
- text = "#{prefix} #{type}: #{count} (expiring on #{tagged.tag_value})"
157
+ text = "#{prefix} #{type}: (expiring on #{tagged.tag_value})"
158
158
  end
159
159
 
160
160
  slack_instances.attachments.push({"color" => rgb, "text" => text, "mrkdwn_in" => ["text"]})
@@ -1,3 +1,3 @@
1
1
  module SportNginAwsAuditor
2
- VERSION = "3.8.2"
2
+ VERSION = "3.8.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sport_ngin_aws_auditor
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.8.2
4
+ version: 3.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elliot Hursh
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-10-12 00:00:00.000000000 Z
13
+ date: 2016-11-10 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: aws-sdk