Class: Dribbled::CLI
Constant Summary collapse
- COMMANDS =
%w(show check snap watch)
- COMPONENTS =
%w(resources)
- DEFAULT_CONFIG_FILE =
File.join(ENV['HOME'],"/.senedsa/config")
- STATUS =
{ :ok => OpenStruct.new({ :num => 0, :str => "OK", }), :warning => OpenStruct.new({ :num => 1, :str => "WARNING", }), :critical => OpenStruct.new({ :num => 2, :str => "CRITICAL", }), :unknown => OpenStruct.new({ :num => 3, :str => "UNKNOWN" }) }
Instance Method Summary collapse
-
#initialize(arguments) ⇒ CLI
constructor
A new instance of CLI.
- #run ⇒ Object
Constructor Details
#initialize(arguments) ⇒ CLI
Returns a new instance of CLI.
25 26 27 28 29 30 31 32 33 |
# File 'lib/dribbled/cli.rb', line 25 def initialize(arguments) @arguments = arguments @whoami = File.basename($PROGRAM_NAME).to_sym @global_options = { :debug => false, :drbdadm => 'drbdadm', :xmldump => nil, :procdrbd => '/proc/drbd', :hostname => nil } @action_options = { :monitor => :nagios, :mode => :active, :suffix => nil, :directory => '/tmp' } @action_arguments = {} @action = nil end |
Instance Method Details
#run ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/dribbled/cli.rb', line 35 def run begin @log = Dribbled::Logger.instance.log @log.level = Log4r::INFO unless @global_options[:debug] @global_options[:log] = @log arguments_valid? process_arguments process_command rescue => e if @global_options[:debug] "#{e.}\n #{e.backtrace.join("\n ")}",3 else e.,3 end end end |