lib/flapjack/cli/maintenance.rb in flapjack-1.2.0rc1 vs lib/flapjack/cli/maintenance.rb in flapjack-1.2.0rc2

- old
+ new

@@ -1,15 +1,14 @@ #!/usr/bin/env ruby -require 'eventmachine' -require 'em-synchrony' require 'redis' -require 'redis/connection/synchrony' +require 'hiredis' require 'flapjack/configuration' require 'flapjack/data/event' require 'flapjack/data/entity_check' +require 'flapjack/data/migration' require 'terminal-table' module Flapjack module CLI class Maintenance @@ -24,11 +23,11 @@ if @config_env.nil? || @config_env.empty? exit_now! "No config data for environment '#{FLAPJACK_ENV}' found in '#{global_options[:config]}'" end - @redis_options = config.for_redis.merge(:driver => :ruby) + @redis_options = config.for_redis @options[:redis] = redis end def show exit_now!("state must be one of 'ok', 'warning', 'critical', 'unknown'") unless @options[:state].nil? || %w(ok warning critical unknown).include?(@options[:state].downcase) @@ -65,10 +64,13 @@ end private def redis - @redis ||= Redis.new(@redis_options) + return @redis unless @redis.nil? + @redis = Redis.new(@redis_options.merge(:driver => :hiredis)) + Flapjack::Data::Migration.migrate_entity_check_data_if_required(:redis => @redis) + @redis end end end end