Module: VagrantPlugins::GuestOmniOS::Cap::ChefInstalled

Defined in:
lib/vagrant-guest-omnios/cap/chef_installed.rb

Class Method Summary collapse

Class Method Details

.chef_installed(machine, version) ⇒ true, false

Check if Chef is installed at the given version.

Returns:

  • (true, false)


7
8
9
10
11
12
13
14
15
16
# File 'lib/vagrant-guest-omnios/cap/chef_installed.rb', line 7

def self.chef_installed(machine, version)
  knife = "/opt/chef/bin/knife"
  command = "test -x #{knife}"

  if version != :latest
    command << "&& #{knife} --version | grep 'Chef: #{version}'"
  end

  machine.communicate.test(command, sudo: true)         
end