Class: VagrantPlugins::Berkshelf::BerksCommandFailed

Inherits:
Vagrant::Errors::VagrantError
  • Object
show all
Defined in:
lib/vagrant-berkshelf/errors.rb

Instance Method Summary collapse

Constructor Details

#initialize(command, stdout, stderr) ⇒ BerksCommandFailed

Returns a new instance of BerksCommandFailed.



25
26
27
28
# File 'lib/vagrant-berkshelf/errors.rb', line 25

def initialize(command, stdout, stderr)
  @command, @stdout, @stderr = command, stdout, stderr
  super
end

Instance Method Details

#chefdk?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/vagrant-berkshelf/errors.rb', line 30

def chefdk?
  @command.include?("chefdk")
end

#error_messageObject



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/vagrant-berkshelf/errors.rb', line 44

def error_message
  base = <<-EOH
The following berks command failed to execute:

    #{@command}

The stdout and stderr are shown below:

    stdout: #{@stdout}
    stderr: #{@stderr}
EOH

  base << "\n#{not_chefdk_message}" if !chefdk?
  base
end

#not_chefdk_messageObject



34
35
36
37
38
39
40
41
42
# File 'lib/vagrant-berkshelf/errors.rb', line 34

def not_chefdk_message
  <<-EOH
It appears that you are not using the ChefDK. Please note that Vagrant Berkshelf
works best when used with the ChefDK, and other installation methods are not
officially supported.

#{INSTALL_CHEFDK_INSTRUCTIONS}
EOH
end