vagrant/plugins/provisioners/chef/cap/linux/chef_installed.rb

23 lines
583 B
Ruby
Raw Normal View History

module VagrantPlugins
module Chef
module Cap
module Linux
module ChefInstalled
# Check if Chef is installed at the given version.
# @return [true, false]
2016-02-26 00:42:58 +00:00
def self.chef_installed(machine, product, version)
knife = "/opt/#{product}/bin/knife"
command = "test -x #{knife}"
if version != :latest
command << "&& #{knife} --version | grep 'Chef: #{version}'"
end
machine.communicate.test(command, sudo: true)
end
end
end
end
end
end