class Kitchen::Command::Diagnose
Command
to log into to instance.
@author Fletcher Nichol <fnichol@nichol.ca>
Public Instance Methods
call()
click to toggle source
Invoke the command.
# File lib/kitchen/command/diagnose.rb, line 30 def call instances = record_failure { load_instances } loader = record_failure { load_loader } puts YAML.dump(Kitchen::Diagnostic.new( loader: loader, instances: instances, plugins: plugins? ).read) end
Private Instance Methods
load_instances()
click to toggle source
Loads and returns instances if they are requested.
@return [Array<Instance>] an array of instances or an empty array @api private
# File lib/kitchen/command/diagnose.rb, line 50 def load_instances if options[:all] || options[:instances] parse_subcommand(args.first) else [] end end
load_loader()
click to toggle source
Loads and returns loader configuration if it is requested.
@return [Hash,nil] a hash or nil @api private
# File lib/kitchen/command/diagnose.rb, line 62 def load_loader @loader if options[:all] || options[:loader] end
plugins?()
click to toggle source
# File lib/kitchen/command/diagnose.rb, line 42 def plugins? options[:all] || options[:plugins] end
record_failure() { || ... }
click to toggle source
Returns a hash with exception detail if an exception is raised in the yielded block.
@return [yield,Hash] the result of the yielded block or an error hash @api private
# File lib/kitchen/command/diagnose.rb, line 71 def record_failure yield rescue => e { error: { exception: e.inspect, message: e.message, backtrace: e.backtrace, }, } end