Class: Flapjack::CLI::Simulate
- Inherits:
-
Object
- Object
- Flapjack::CLI::Simulate
- Defined in:
- lib/flapjack/cli/simulate.rb
Instance Method Summary collapse
- #_fail ⇒ Object
- #fail_and_recover ⇒ Object
-
#initialize(global_options, options) ⇒ Simulate
constructor
A new instance of Simulate.
- #ok ⇒ Object
Constructor Details
#initialize(global_options, options) ⇒ Simulate
Returns a new instance of Simulate.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/flapjack/cli/simulate.rb', line 12 def initialize(, ) @global_options = @options = if @global_options[:'force-utf8'] Encoding.default_external = 'UTF-8' Encoding.default_internal = 'UTF-8' end config = Flapjack::Configuration.new config.load([:config]) @config_env = config.all if @config_env.nil? || @config_env.empty? exit_now! "No config data found in '#{[:config]}'" end Flapjack::RedisProxy.config = config.for_redis Zermelo.redis = Flapjack.redis end |
Instance Method Details
#_fail ⇒ Object
33 34 35 36 37 |
# File 'lib/flapjack/cli/simulate.rb', line 33 def _fail events(:state => @options[:state], :recover => false, :check => @options[:check], :minutes => @options[:time].to_f, :interval => @options[:interval].to_f) end |
#fail_and_recover ⇒ Object
39 40 41 42 43 |
# File 'lib/flapjack/cli/simulate.rb', line 39 def fail_and_recover events(:state => @options[:state], :recover => true, :check => @options[:check], :minutes => @options[:time].to_f, :interval => @options[:interval].to_f) end |
#ok ⇒ Object
45 46 47 48 49 |
# File 'lib/flapjack/cli/simulate.rb', line 45 def ok events(:state => 'ok', :recover => false, :check => @options[:check], :minutes => @options[:time].to_f, :interval => @options[:interval].to_f) end |