Prior to this commit, the chef_installed capability was looking for a string that has recently changed in newer versions of chef. This commit fixes that by instead just looking for the right version that was configured for the chef client, rather than the specific string that could change again in the future.
24 lines
674 B
Ruby
24 lines
674 B
Ruby
module VagrantPlugins
|
|
module Chef
|
|
module Cap
|
|
module OmniOS
|
|
module ChefInstalled
|
|
# TODO: this is the same code as cap/linux/chef_installed, consider merging
|
|
# Check if Chef is installed at the given version.
|
|
# @return [true, false]
|
|
def self.chef_installed(machine, product, version)
|
|
knife = "/opt/#{product}/bin/knife"
|
|
command = "test -x #{knife}"
|
|
|
|
if version != :latest
|
|
command << "&& #{knife} --version | grep '#{version}'"
|
|
end
|
|
|
|
machine.communicate.test(command, sudo: true)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|