diff --git a/plugins/provisioners/chef/cap/freebsd/chef_installed.rb b/plugins/provisioners/chef/cap/freebsd/chef_installed.rb index 83b1985c3..c626de4bd 100644 --- a/plugins/provisioners/chef/cap/freebsd/chef_installed.rb +++ b/plugins/provisioners/chef/cap/freebsd/chef_installed.rb @@ -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) diff --git a/plugins/provisioners/chef/cap/linux/chef_installed.rb b/plugins/provisioners/chef/cap/linux/chef_installed.rb index a494d9be4..44d7173ee 100644 --- a/plugins/provisioners/chef/cap/linux/chef_installed.rb +++ b/plugins/provisioners/chef/cap/linux/chef_installed.rb @@ -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) diff --git a/plugins/provisioners/chef/cap/omnios/chef_installed.rb b/plugins/provisioners/chef/cap/omnios/chef_installed.rb index 2e2cf59dd..54f1f53ef 100644 --- a/plugins/provisioners/chef/cap/omnios/chef_installed.rb +++ b/plugins/provisioners/chef/cap/omnios/chef_installed.rb @@ -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) diff --git a/plugins/provisioners/chef/cap/windows/chef_installed.rb b/plugins/provisioners/chef/cap/windows/chef_installed.rb index dbfcc1c5f..0f62fc0ef 100644 --- a/plugins/provisioners/chef/cap/windows/chef_installed.rb +++ b/plugins/provisioners/chef/cap/windows/chef_installed.rb @@ -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