From 0085124cd804bf1c43ea11ab51b13cffc69e56de Mon Sep 17 00:00:00 2001 From: Collin McNeese Date: Sun, 24 Oct 2021 12:32:37 -0500 Subject: [PATCH] Updates chef_installed variable names to be more functional Signed-off-by: Collin McNeese --- plugins/provisioners/chef/cap/freebsd/chef_installed.rb | 8 ++++---- plugins/provisioners/chef/cap/linux/chef_installed.rb | 8 ++++---- plugins/provisioners/chef/cap/omnios/chef_installed.rb | 8 ++++---- plugins/provisioners/chef/cap/windows/chef_installed.rb | 6 +++--- 4 files changed, 15 insertions(+), 15 deletions(-) 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