Class: Kitchen::Command::Doctor

Inherits:
Base
  • Object
show all
Defined in:
lib/kitchen/command/doctor.rb

Overview

Check for common system or configuration problems.

Instance Method Summary collapse

Methods inherited from Base

#initialize

Methods included from Logging

#banner, #debug, #error, #fatal, #info, #warn

Constructor Details

This class inherits a constructor from Kitchen::Command::Base

Instance Method Details

#callObject

Invoke the command.


23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/kitchen/command/doctor.rb', line 23

def call
  results = parse_subcommand(args.first)
  if results.empty?
    error("No instances configured, cannot check configuration. Please check your .kitchen.yml and confirm it has platform and suites sections.")
    exit(1)
  end
  # By default only doctor the first instance to avoid output spam.
  results = [results.first] unless options[:all]
  failed = results.any? do |instance|
    debug "Doctor on #{instance.name}."
    instance.doctor_action
  end
  exit(1) if failed
end