diff options
author | Marc Chamberland <mchamberland@pbsc.com> | 2019-04-25 23:58:27 -0400 |
---|---|---|
committer | Marc Chamberland <mchamberland@pbsc.com> | 2019-04-26 00:24:33 -0400 |
commit | 0fb79f0a5f8d2c8ca1f9ddb0d0b0267b300dc81f (patch) | |
tree | 7984d75e847846eb31923fd26ef51e625d55a0d5 /lib/chef/knife | |
parent | 66c0fdeb65c19d267bd501550e60cd16d7bb4901 (diff) | |
download | chef-0fb79f0a5f8d2c8ca1f9ddb0d0b0267b300dc81f.tar.gz |
chef-client => Chef::Dist::CLIENT
Signed-off-by: Marc Chamberland <mchamberland@pbsc.com>
Diffstat (limited to 'lib/chef/knife')
-rw-r--r-- | lib/chef/knife/bootstrap.rb | 15 | ||||
-rw-r--r-- | lib/chef/knife/bootstrap/templates/chef-full.erb | 2 | ||||
-rw-r--r-- | lib/chef/knife/bootstrap/templates/windows-chef-client-msi.erb | 10 | ||||
-rw-r--r-- | lib/chef/knife/core/bootstrap_context.rb | 3 | ||||
-rw-r--r-- | lib/chef/knife/core/windows_bootstrap_context.rb | 3 |
5 files changed, 18 insertions, 15 deletions
diff --git a/lib/chef/knife/bootstrap.rb b/lib/chef/knife/bootstrap.rb index b68fb1aa1e..daca0957d4 100644 --- a/lib/chef/knife/bootstrap.rb +++ b/lib/chef/knife/bootstrap.rb @@ -22,6 +22,7 @@ require "erubis" require "chef/knife/bootstrap/chef_vault_handler" require "chef/knife/bootstrap/client_builder" require "chef/util/path_helper" +require "chef/dist" class Chef class Knife @@ -251,14 +252,14 @@ class Chef option :first_boot_attributes, short: "-j JSON_ATTRIBS", long: "--json-attributes", - description: "A JSON string to be added to the first run of chef-client", + description: "A JSON string to be added to the first run of #{Chef::Dist::CLIENT}", proc: lambda { |o| Chef::JSONCompat.parse(o) }, default: nil # bootstrap template option :first_boot_attributes_from_file, long: "--json-attribute-file FILE", - description: "A JSON file to be used to the first run of chef-client", + description: "A JSON file to be used to the first run of #{Chef::Dist::CLIENT}", proc: lambda { |o| Chef::JSONCompat.parse(File.read(o)) }, default: nil @@ -296,25 +297,25 @@ class Chef # bootstrap override: Do this instead of our own setup.sh from omnitruck. Causes bootstrap_url to be ignored. option :bootstrap_install_command, long: "--bootstrap-install-command COMMANDS", - description: "Custom command to install chef-client", + description: "Custom command to install #{Chef::Dist::CLIENT}", proc: Proc.new { |ic| Chef::Config[:knife][:bootstrap_install_command] = ic } # bootstrap template: Run this command first in the bootstrap script option :bootstrap_preinstall_command, long: "--bootstrap-preinstall-command COMMANDS", - description: "Custom commands to run before installing chef-client", + description: "Custom commands to run before installing #{Chef::Dist::CLIENT}", proc: Proc.new { |preic| Chef::Config[:knife][:bootstrap_preinstall_command] = preic } # bootstrap template option :bootstrap_wget_options, long: "--bootstrap-wget-options OPTIONS", - description: "Add options to wget when installing chef-client", + description: "Add options to wget when installing #{Chef::Dist::CLIENT}", proc: Proc.new { |wo| Chef::Config[:knife][:bootstrap_wget_options] = wo } # bootstrap template option :bootstrap_curl_options, long: "--bootstrap-curl-options OPTIONS", - description: "Add options to curl when install chef-client", + description: "Add options to curl when install #{Chef::Dist::CLIENT}", proc: Proc.new { |co| Chef::Config[:knife][:bootstrap_curl_options] = co } # chef_vault_handler @@ -417,7 +418,7 @@ class Chef # @return [String] Default bootstrap template def default_bootstrap_template if target_host.base_os == :windows - "windows-chef-client-msi" + "windows-#{Chef::Dist::CLIENT}-msi" else "chef-full" end diff --git a/lib/chef/knife/bootstrap/templates/chef-full.erb b/lib/chef/knife/bootstrap/templates/chef-full.erb index ec1f7e72c9..58a64a23b8 100644 --- a/lib/chef/knife/bootstrap/templates/chef-full.erb +++ b/lib/chef/knife/bootstrap/templates/chef-full.erb @@ -172,7 +172,7 @@ do_download() { <%= knife_config[:bootstrap_install_command] %> <% else %> install_sh="<%= knife_config[:bootstrap_url] ? knife_config[:bootstrap_url] : "https://omnitruck.chef.io/chef/install.sh" %>" - if test -f /usr/bin/chef-client; then + if test -f /usr/bin/<%= Chef::Dist::CLIENT %>}; then echo "-----> Existing <%= Chef::Dist::PRODUCT %> installation detected" else echo "-----> Installing Chef Omnibus (<%= latest_current_chef_version_string %>)" diff --git a/lib/chef/knife/bootstrap/templates/windows-chef-client-msi.erb b/lib/chef/knife/bootstrap/templates/windows-chef-client-msi.erb index 37fcf15682..fd7b48f28d 100644 --- a/lib/chef/knife/bootstrap/templates/windows-chef-client-msi.erb +++ b/lib/chef/knife/bootstrap/templates/windows-chef-client-msi.erb @@ -110,7 +110,7 @@ goto chef_installed :chef_installed @echo Checking for existing chef installation -WHERE chef-client >nul 2>nul +WHERE <%= Chef::Dist::CLIENT %> >nul 2>nul If !ERRORLEVEL!==0 ( @echo Existing Chef installation detected, skipping download goto key_create @@ -120,14 +120,14 @@ If !ERRORLEVEL!==0 ( ) :install -@rem If user has provided the custom installation command for chef-client then execute it +@rem If user has provided the custom installation command for <%= Chef::Dist::CLIENT %> then execute it <% if @chef_config[:knife][:bootstrap_install_command] %> <%= @chef_config[:knife][:bootstrap_install_command] %> <% else %> - @rem Install Chef using chef-client MSI installer + @rem Install Chef using <%= Chef::Dist::CLIENT %> MSI installer @set "LOCAL_DESTINATION_MSI_PATH=<%= local_download_path %>" - @set "CHEF_CLIENT_MSI_LOG_PATH=%TEMP%\chef-client-msi%RANDOM%.log" + @set "CHEF_CLIENT_MSI_LOG_PATH=%TEMP%\<%= Chef::Dist::CLIENT %>-msi%RANDOM%.log" @rem Clear any pre-existing downloads @echo Checking for existing downloaded package at "%LOCAL_DESTINATION_MSI_PATH%" @@ -197,7 +197,7 @@ If !ERRORLEVEL!==0 ( <%= install_chef %> @if ERRORLEVEL 1 ( - echo Chef-client package failed to install with status code !ERRORLEVEL!. > "&2" + echo <%= Chef::Dist::CLIENT %> package failed to install with status code !ERRORLEVEL!. > "&2" echo See installation log for additional detail: %CHEF_CLIENT_MSI_LOG_PATH%. > "&2" ) else ( @echo Installation completed successfully diff --git a/lib/chef/knife/core/bootstrap_context.rb b/lib/chef/knife/core/bootstrap_context.rb index 355978c79d..5e987745e6 100644 --- a/lib/chef/knife/core/bootstrap_context.rb +++ b/lib/chef/knife/core/bootstrap_context.rb @@ -19,6 +19,7 @@ require "chef/run_list" require "chef/util/path_helper" require "pathname" +require "chef/dist" class Chef class Knife @@ -169,7 +170,7 @@ class Chef def start_chef # If the user doesn't have a client path configure, let bash use the PATH for what it was designed for - client_path = @chef_config[:chef_client_path] || "chef-client" + client_path = @chef_config[:chef_client_path] || "#{Chef::Dist::CLIENT}" s = "#{client_path} -j /etc/chef/first-boot.json" if @config[:verbosity] && @config[:verbosity] >= 3 s << " -l trace" diff --git a/lib/chef/knife/core/windows_bootstrap_context.rb b/lib/chef/knife/core/windows_bootstrap_context.rb index c7b8666ed0..df69399074 100644 --- a/lib/chef/knife/core/windows_bootstrap_context.rb +++ b/lib/chef/knife/core/windows_bootstrap_context.rb @@ -18,6 +18,7 @@ require "chef/knife/core/bootstrap_context" require "chef/util/path_helper" +require "chef/dist" class Chef class Knife @@ -268,7 +269,7 @@ class Chef end def local_download_path - "%TEMP%\\chef-client-latest.msi" + "%TEMP%\\#{Chef::Dist::CLIENT}-latest.msi" end def msi_url(machine_os = nil, machine_arch = nil, download_context = nil) |