Merge pull request #7078 from donaldguy/chefdk_detection_fix
Correctly detect chefdk install
This commit is contained in:
commit
c441de57f3
|
@ -5,8 +5,8 @@ module VagrantPlugins
|
||||||
module ChefInstalled
|
module ChefInstalled
|
||||||
# Check if Chef is installed at the given version.
|
# Check if Chef is installed at the given version.
|
||||||
# @return [true, false]
|
# @return [true, false]
|
||||||
def self.chef_installed(machine, version)
|
def self.chef_installed(machine, product, version)
|
||||||
knife = "/opt/chef/bin/knife"
|
knife = "/opt/#{product}/bin/knife"
|
||||||
command = "test -x #{knife}"
|
command = "test -x #{knife}"
|
||||||
|
|
||||||
if version != :latest
|
if version != :latest
|
||||||
|
|
|
@ -6,10 +6,10 @@ module VagrantPlugins
|
||||||
# TODO: this is the same code as cap/linux/chef_installed, consider merging
|
# TODO: this is the same code as cap/linux/chef_installed, consider merging
|
||||||
# Check if Chef is installed at the given version.
|
# Check if Chef is installed at the given version.
|
||||||
# @return [true, false]
|
# @return [true, false]
|
||||||
def self.chef_installed(machine, version)
|
def self.chef_installed(machine, product, version)
|
||||||
knife = "/opt/chef/bin/knife"
|
knife = "/opt/#{product}/bin/knife"
|
||||||
command = "test -x #{knife}"
|
command = "test -x #{knife}"
|
||||||
|
|
||||||
if version != :latest
|
if version != :latest
|
||||||
command << "&& #{knife} --version | grep 'Chef: #{version}'"
|
command << "&& #{knife} --version | grep 'Chef: #{version}'"
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,7 +5,7 @@ module VagrantPlugins
|
||||||
module ChefInstalled
|
module ChefInstalled
|
||||||
# Check if Chef is installed at the given version.
|
# Check if Chef is installed at the given version.
|
||||||
# @return [true, false]
|
# @return [true, false]
|
||||||
def self.chef_installed(machine, version)
|
def self.chef_installed(machine, product, version)
|
||||||
if version != :latest
|
if version != :latest
|
||||||
command = 'if ((&knife --version) -Match "Chef: ' + version.to_s + '"){ exit 0 } else { exit 1 }'
|
command = 'if ((&knife --version) -Match "Chef: ' + version.to_s + '"){ exit 0 } else { exit 1 }'
|
||||||
else
|
else
|
||||||
|
|
|
@ -31,7 +31,7 @@ module VagrantPlugins
|
||||||
version: @version.to_s))
|
version: @version.to_s))
|
||||||
@machine.guest.capability(:chef_install, @product, @version, @channel, @options)
|
@machine.guest.capability(:chef_install, @product, @version, @channel, @options)
|
||||||
|
|
||||||
if !@machine.guest.capability(:chef_installed, @version)
|
if !@machine.guest.capability(:chef_installed, @product, @version)
|
||||||
raise Provisioner::Base::ChefError, :install_failed
|
raise Provisioner::Base::ChefError, :install_failed
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -40,7 +40,7 @@ module VagrantPlugins
|
||||||
# option is given or if the guest does not have Chef installed at the
|
# option is given or if the guest does not have Chef installed at the
|
||||||
# proper version.
|
# proper version.
|
||||||
def should_install_chef?
|
def should_install_chef?
|
||||||
@force || !@machine.guest.capability(:chef_installed, @version)
|
@force || !@machine.guest.capability(:chef_installed, @product, @version)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue