From f1a6eb09eba8e946e530745cbd19f5f754f505ff Mon Sep 17 00:00:00 2001 From: Steve Kemp Date: Wed, 21 Jan 2015 16:49:43 +0000 Subject: Don't hard-wire redis as the queue-type. Read it from the configuration-file and don't expose the server flag which is now bogus. --- bin/custodian-enqueue | 16 ++++------------ bin/custodian-queue | 14 ++------------ 2 files changed, 6 insertions(+), 24 deletions(-) diff --git a/bin/custodian-enqueue b/bin/custodian-enqueue index 20654c1..672ace9 100755 --- a/bin/custodian-enqueue +++ b/bin/custodian-enqueue @@ -68,17 +68,10 @@ if __FILE__ == $0 then $help = false $manual = false - # - # The beanstalkd server address. - # - settings = Custodian::Settings.instance() - $SERVER = settings.queue_server - begin opts = GetoptLong.new( [ "--dump", "-d", GetoptLong::NO_ARGUMENT ], [ "--test", GetoptLong::NO_ARGUMENT ], - [ "--server", GetoptLong::REQUIRED_ARGUMENT ], [ "--file", "-f", GetoptLong::REQUIRED_ARGUMENT ], [ "--help", "-h", GetoptLong::NO_ARGUMENT ], [ "--manual","-m", GetoptLong::NO_ARGUMENT ] @@ -89,8 +82,6 @@ if __FILE__ == $0 then ENV["DUMP"] = "1" when "--test" then ENV["TEST"] = "1" - when "--server" then - $SERVER = arg when "--file" then ENV["FILE"] = arg when "--help" then @@ -136,11 +127,12 @@ if __FILE__ == $0 then # - # Connected to the server + # Connected to the queue - be it redis or beanstalkd # - queue = Custodian::QueueType.create( "redis" ) + settings = Custodian::Settings.instance() + queue = Custodian::QueueType.create( settings.queue_type() ) if ( ! queue ) - puts "Failed to connect to beanstalk server: #{$SERVER}" + puts "Failed to connect to the #{settings.queue_type()} queue" exit 1 end diff --git a/bin/custodian-queue b/bin/custodian-queue index 23f3841..0545df7 100755 --- a/bin/custodian-queue +++ b/bin/custodian-queue @@ -9,7 +9,6 @@ # [ -M | --monitor ] # [ -f | --flush ] # [ -s | --stats ] -# [ -S | --server 1.2.3.4:123 ] # # OPTIONS # @@ -23,8 +22,6 @@ # # -s, --stats Show the count of pending jobs. # -# -S, --server Specify the host:port for the beanstalkd queue. -# # # ABOUT # @@ -63,11 +60,6 @@ if __FILE__ == $0 then $manual = false $MONITOR = nil - # - # The beanstalkd server address. - # - settings = Custodian::Settings.instance() - $SERVER = settings.queue_server begin opts = GetoptLong.new( @@ -75,7 +67,6 @@ if __FILE__ == $0 then [ "--help", "-h", GetoptLong::NO_ARGUMENT ], [ "--manual", "-m", GetoptLong::NO_ARGUMENT ], [ "--monitor", "-M", GetoptLong::OPTIONAL_ARGUMENT ], - [ "--server", "-S", GetoptLong::REQUIRED_ARGUMENT ], [ "--stats", "-s", GetoptLong::NO_ARGUMENT ] ) opts.each do |opt, arg| @@ -90,8 +81,6 @@ if __FILE__ == $0 then $STATS = true when "--flush" then $FLUSH = true - when "--server" then - $SERVER = arg when "--help" then $help = true when "--manual" then @@ -135,7 +124,8 @@ if __FILE__ == $0 then # # Create the queue object. # - queue = Custodian::QueueType.create( "redis" ) + settings = Custodian::Settings.instance() + queue = Custodian::QueueType.create( settings.queue_type() ) # # Alerting on a queue that is too-full? -- cgit v1.2.1