bin/metrics-ec2-count.rb in sensu-plugins-aws-2.1.0 vs bin/metrics-ec2-count.rb in sensu-plugins-aws-2.1.1

- old
+ new

@@ -79,15 +79,15 @@ status = {} unless total.nil? data[:instance_status_set].each do |value| stat = value[:instance_state][:name] - if status[stat].nil? - status[stat] = 1 - else - status[stat] = status[stat] + 1 - end + status[stat] = if status[stat].nil? + 1 + else + status[stat] + 1 + end end end unless data.nil? # rubocop: disable Style/GuardClause # We only return data when we have some to return @@ -107,14 +107,14 @@ instances = client.describe_instances instances[:reservation_set].each do |i| i[:instances_set].each do |instance| type = instance[:instance_type] - if data[type].nil? - data[type] = 1 - else - data[type] = data[type] + 1 - end + data[type] = if data[type].nil? + 1 + else + data[type] + 1 + end end end unless data.nil? # rubocop: disable Style/GuardClause # We only return data when we have some to return