From fdb5aa7bb41c9a11a2dfdcdb12f00f95f37e2072 Mon Sep 17 00:00:00 2001 From: Steve Kemp Date: Fri, 22 Apr 2016 21:23:32 +0300 Subject: Updated to fix rubocop warnings. --- bin/custodian-dequeue | 14 +++++++------- bin/custodian-enqueue | 24 ++++++++++++------------ bin/custodian-queue | 14 +++++++------- bin/multi-ping | 4 ++-- 4 files changed, 28 insertions(+), 28 deletions(-) (limited to 'bin') diff --git a/bin/custodian-dequeue b/bin/custodian-dequeue index 8896b14..b066e18 100755 --- a/bin/custodian-dequeue +++ b/bin/custodian-dequeue @@ -29,12 +29,12 @@ if __FILE__ == $PROGRAM_NAME begin opts = GetoptLong.new( - ['--help', '-h', GetoptLong::NO_ARGUMENT], - ['--manual', '-m', GetoptLong::NO_ARGUMENT], - ['--fail', '-f', GetoptLong::NO_ARGUMENT], - ['--single', '-s', GetoptLong::NO_ARGUMENT], + ['--help', '-h', GetoptLong::NO_ARGUMENT], + ['--manual', '-m', GetoptLong::NO_ARGUMENT], + ['--fail', '-f', GetoptLong::NO_ARGUMENT], + ['--single', '-s', GetoptLong::NO_ARGUMENT], ['--verbose', '-v', GetoptLong::NO_ARGUMENT] - ) + ) opts.each do |opt, _arg| case opt when '--verbose' then @@ -73,7 +73,7 @@ if __FILE__ == $PROGRAM_NAME # # Single step? # - if ENV['SINGLE'] + if ENV['SINGLE'] worker.process_single_job exit(0) end @@ -81,7 +81,7 @@ if __FILE__ == $PROGRAM_NAME # # Run until we see a failure? # - if ENV['FAIL'] + if ENV['FAIL'] worker.process_until_fail exit(0) end diff --git a/bin/custodian-enqueue b/bin/custodian-enqueue index f4f9f0e..602b52a 100755 --- a/bin/custodian-enqueue +++ b/bin/custodian-enqueue @@ -24,12 +24,12 @@ if __FILE__ == $PROGRAM_NAME begin opts = GetoptLong.new( - ['--dump', '-d', GetoptLong::NO_ARGUMENT], - ['--test', GetoptLong::NO_ARGUMENT], - ['--file', '-f', GetoptLong::REQUIRED_ARGUMENT], - ['--help', '-h', GetoptLong::NO_ARGUMENT], + ['--dump', '-d', GetoptLong::NO_ARGUMENT], + ['--test', GetoptLong::NO_ARGUMENT], + ['--file', '-f', GetoptLong::REQUIRED_ARGUMENT], + ['--help', '-h', GetoptLong::NO_ARGUMENT], ['--manual', '-m', GetoptLong::NO_ARGUMENT] - ) + ) opts.each do |opt, arg| case opt when '--dump' then @@ -62,8 +62,8 @@ if __FILE__ == $PROGRAM_NAME # # Connected to the queue. # - queue = Custodian::RedisQueueType.new() - unless queue + queue = Custodian::RedisQueueType.new + unless queue puts "Failed to connect to the #{settings.queue_type} queue" exit 1 end @@ -91,18 +91,18 @@ if __FILE__ == $PROGRAM_NAME failed = false mon.jobs.each do |test| - if ENV['TEST'] + if ENV['TEST'] # nop - elsif ENV['DUMP'] + elsif ENV['DUMP'] puts test else failed = true unless queue.add(test.to_s) end end - if ( failed ) - puts "We failed to add at least one job to the queue." - exit( 1 ) + if failed + puts 'We failed to add at least one job to the queue.' + exit(1) end end diff --git a/bin/custodian-queue b/bin/custodian-queue index a78ae25..0369fad 100755 --- a/bin/custodian-queue +++ b/bin/custodian-queue @@ -25,15 +25,15 @@ if __FILE__ == $PROGRAM_NAME ['--manual', '-m', GetoptLong::NO_ARGUMENT], ['--monitor', '-M', GetoptLong::OPTIONAL_ARGUMENT], ['--stats', '-s', GetoptLong::NO_ARGUMENT] - ) + ) opts.each do |opt, arg| case opt when '--monitor' then - if arg - monitor = arg.to_i - else - monitor = 5000 - end + monitor = if arg + arg.to_i + else + 5000 + end when '--stats' then stats = true when '--flush' then @@ -62,7 +62,7 @@ if __FILE__ == $PROGRAM_NAME # # Create the queue object. # - queue = Custodian::RedisQueueType.new() + queue = Custodian::RedisQueueType.new # # Alerting on a queue that is too-full? diff --git a/bin/multi-ping b/bin/multi-ping index 7957565..6d905bb 100755 --- a/bin/multi-ping +++ b/bin/multi-ping @@ -49,7 +49,7 @@ hostname = ARGV.shift # # Abort if we don't have a hostname # -if hostname.nil? +if hostname.nil? puts "Usage: #{$PROGRAM_NAME} hostname" exit 1 end @@ -62,7 +62,7 @@ helper = Custodian::Util::Ping.new(hostname) # # Ping the host, via the helper # -if helper.run_ping +if helper.run_ping puts "#{hostname} - #{helper.address} - is alive." exit 0 else -- cgit v1.2.1