Skip to content

Commit

Permalink
Update to rubocop 0.73 (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
eheydrick authored Jul 31, 2019
1 parent f9aebb4 commit 14b84fc
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,7 @@ Metrics/ParameterLists:
# allow using $stderr
Style/StderrPuts:
Enabled: false

# disable naming check
Naming/FileName:
Enabled: false
2 changes: 1 addition & 1 deletion aws-cleaner.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Gem::Specification.new do |s|
s.add_development_dependency 'bundler', '~> 2.0'
s.add_development_dependency 'rake', '~> 12.0'
s.add_development_dependency 'rspec', '~> 3.5'
s.add_development_dependency 'rubocop', '~> 0.52.1'
s.add_development_dependency 'rubocop', '~> 0.73.0'

s.add_runtime_dependency 'aws-sdk-sqs', '~> 1'
s.add_runtime_dependency 'chef-api', '~> 0.5'
Expand Down
3 changes: 3 additions & 0 deletions bin/aws_cleaner.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

#
# Listen for AWS CloudWatch Events EC2 termination events delivered via SQS
# and remove the node from Chef and Sensu and send a notification
Expand Down Expand Up @@ -90,6 +92,7 @@ def chef(id, instance_id, chef_node)

def sensu(id, instance_id, chef_node)
return unless @config[:sensu][:enable]

if AwsCleaner::Sensu.in_sensu?(chef_node, @config)
if AwsCleaner::Sensu.remove_from_sensu(chef_node, @config)
@logger.info("Removed #{chef_node} from Sensu")
Expand Down
4 changes: 4 additions & 0 deletions lib/aws-cleaner.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# main aws_cleaner lib
class AwsCleaner
# SQS related stuff
Expand Down Expand Up @@ -32,6 +34,7 @@ def self.get_chef_node_name(instance_id, config)
chef = client(config)
results = chef.search.query(:node, "ec2_instance_id:#{instance_id} OR chef_provisioning_reference_server_id:#{instance_id}")
return false if results.rows.empty?

results.rows.first['name']
end

Expand All @@ -40,6 +43,7 @@ def self.get_chef_fqdn(instance_id, config)
chef = client(config)
results = chef.search.query(:node, "ec2_instance_id:#{instance_id} OR chef_provisioning_reference_server_id:#{instance_id}")
return false if results.rows.empty?

results.rows.first['automatic']['fqdn']
end

Expand Down

0 comments on commit 14b84fc

Please sign in to comment.