Updates chef_installed variable names to be more functional
Signed-off-by: Collin McNeese <cmcneese@chef.io>
This commit is contained in:
parent
692cb1ae34
commit
0085124cd8
@ -7,12 +7,12 @@ module VagrantPlugins
|
||||
# @return [true, false]
|
||||
def self.chef_installed(machine, product, version)
|
||||
product_name = product == 'chef-workstation' ? 'chef-workstation' : 'chef'
|
||||
product_binary = product_name == 'chef-workstation' ? 'chef' : 'chef-client'
|
||||
test_binary = "/opt/#{product_name}/bin/#{product_binary}"
|
||||
command = "test -x #{test_binary}"
|
||||
verify_bin = product_name == 'chef-workstation' ? 'chef' : 'chef-client'
|
||||
verify_path = "/opt/#{product_name}/bin/#{verify_bin}"
|
||||
command = "test -x #{verify_path}"
|
||||
|
||||
if version != :latest
|
||||
command << "&& #{test_binary} --version | grep '#{version}'"
|
||||
command << "&& #{verify_path} --version | grep '#{version}'"
|
||||
end
|
||||
|
||||
machine.communicate.test(command, sudo: true)
|
||||
|
||||
@ -7,12 +7,12 @@ module VagrantPlugins
|
||||
# @return [true, false]
|
||||
def self.chef_installed(machine, product, version)
|
||||
product_name = product == 'chef-workstation' ? 'chef-workstation' : 'chef'
|
||||
product_binary = product_name == 'chef-workstation' ? 'chef' : 'chef-client'
|
||||
test_binary = "/opt/#{product_name}/bin/#{product_binary}"
|
||||
command = "test -x #{test_binary}"
|
||||
verify_bin = product_name == 'chef-workstation' ? 'chef' : 'chef-client'
|
||||
verify_path = "/opt/#{product_name}/bin/#{verify_bin}"
|
||||
command = "test -x #{verify_path}"
|
||||
|
||||
if version != :latest
|
||||
command << "&& #{test_binary} --version | grep '#{version}'"
|
||||
command << "&& #{verify_path} --version | grep '#{version}'"
|
||||
end
|
||||
|
||||
machine.communicate.test(command, sudo: true)
|
||||
|
||||
@ -8,12 +8,12 @@ module VagrantPlugins
|
||||
# @return [true, false]
|
||||
def self.chef_installed(machine, product, version)
|
||||
product_name = product == 'chef-workstation' ? 'chef-workstation' : 'chef'
|
||||
product_binary = product_name == 'chef-workstation' ? 'chef' : 'chef-client'
|
||||
test_binary = "/opt/#{product_name}/bin/#{product_binary}"
|
||||
command = "test -x #{test_binary}"
|
||||
verify_bin = product_name == 'chef-workstation' ? 'chef' : 'chef-client'
|
||||
verify_path = "/opt/#{product_name}/bin/#{verify_bin}"
|
||||
command = "test -x #{verify_path}"
|
||||
|
||||
if version != :latest
|
||||
command << "&& #{test_binary} --version | grep '#{version}'"
|
||||
command << "&& #{verify_path} --version | grep '#{version}'"
|
||||
end
|
||||
|
||||
machine.communicate.test(command, sudo: true)
|
||||
|
||||
@ -6,11 +6,11 @@ module VagrantPlugins
|
||||
# Check if Chef is installed at the given version.
|
||||
# @return [true, false]
|
||||
def self.chef_installed(machine, product, version)
|
||||
test_binary = product == 'chef-workstation' ? 'chef' : 'chef-client'
|
||||
verify_bin = product == 'chef-workstation' ? 'chef' : 'chef-client'
|
||||
if version != :latest
|
||||
command = 'if ((&' + test_binary + ' --version) -Match "' + version.to_s + '"){ exit 0 } else { exit 1 }'
|
||||
command = 'if ((&' + verify_bin + ' --version) -Match "' + version.to_s + '"){ exit 0 } else { exit 1 }'
|
||||
else
|
||||
command = 'if ((&' + test_binary + ' --version) -Match "Chef*"){ exit 0 } else { exit 1 }'
|
||||
command = 'if ((&' + verify_bin + ' --version) -Match "Chef*"){ exit 0 } else { exit 1 }'
|
||||
end
|
||||
machine.communicate.test(command, sudo: true)
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user