summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Chamberland <mchamberland@pbsc.com>2019-04-12 19:17:46 -0400
committerMarc Chamberland <mchamberland@pbsc.com>2019-04-19 19:02:36 -0400
commit3c31c4922148d720815afe03c56083bf84c56cdf (patch)
treeb518de696ecfdbb2fe8ad028e18dcbaa4436ca99
parentd2567df602b65102b908a918b5200898b137a614 (diff)
downloadchef-3c31c4922148d720815afe03c56083bf84c56cdf.tar.gz
reversing changes to knife
Signed-off-by: Marc Chamberland <mchamberland@pbsc.com>
-rw-r--r--lib/chef/application/knife.rb6
-rw-r--r--lib/chef/dist.rb3
-rw-r--r--lib/chef/knife.rb26
3 files changed, 16 insertions, 19 deletions
diff --git a/lib/chef/application/knife.rb b/lib/chef/application/knife.rb
index 5b84ffdf1a..bdf1b7e7a7 100644
--- a/lib/chef/application/knife.rb
+++ b/lib/chef/application/knife.rb
@@ -24,9 +24,9 @@ require "chef/dist"
class Chef::Application::Knife < Chef::Application
- NO_COMMAND_GIVEN = "You need to pass a sub-command (e.g., #{Chef::Dist::KNIFE} SUB-COMMAND)\n".freeze
+ NO_COMMAND_GIVEN = "You need to pass a sub-command (e.g., knife SUB-COMMAND)\n".freeze
- banner "Usage: #{Chef::Dist::KNIFE} sub-command (options)"
+ banner "Usage: knife sub-command (options)"
option :config_file,
short: "-c CONFIG",
@@ -119,7 +119,7 @@ class Chef::Application::Knife < Chef::Application
option :local_mode,
short: "-z",
long: "--local-mode",
- description: "Point #{Chef::Dist::KNIFE} commands at local repository instead of server",
+ description: "Point knife commands at local repository instead of server",
boolean: true
option :chef_zero_host,
diff --git a/lib/chef/dist.rb b/lib/chef/dist.rb
index bb69611e80..28c3f02afc 100644
--- a/lib/chef/dist.rb
+++ b/lib/chef/dist.rb
@@ -6,9 +6,6 @@ class Chef
# The client's alias (chef-client)
CLIENT = "chef-client".freeze
- # the server tool's name (knife)
- KNIFE = "knife".freeze
-
# Name used for certain directories. Merge with chef_executable?
GENERIC = "chef".freeze
diff --git a/lib/chef/knife.rb b/lib/chef/knife.rb
index a1b1d66255..b5b32cb193 100644
--- a/lib/chef/knife.rb
+++ b/lib/chef/knife.rb
@@ -36,7 +36,7 @@ require "chef/dist"
class Chef
class Knife
- Chef::HTTP::HTTPRequest.user_agent = "#{Chef::Dist::PRODUCT} #{Chef::Dist::KNIFE} #{Chef::HTTP::HTTPRequest::UA_COMMON}"
+ Chef::HTTP::HTTPRequest.user_agent = "#{Chef::Dist::PRODUCT} Knife#{Chef::HTTP::HTTPRequest::UA_COMMON}"
include Mixlib::CLI
include Chef::Mixin::PathSanity
@@ -183,7 +183,7 @@ class Chef
config_loader.profile = profile
config_loader.load
- ui.warn("No config.rb (formerly #{Chef::Dist::KNIFE}.rb) configuration file found. See https://docs.chef.io/config_rb_knife.html for details.") if config_loader.no_config_found?
+ ui.warn("No knife configuration file found. See https://docs.chef.io/config_rb_knife.html for details.") if config_loader.no_config_found?
config_loader
rescue Exceptions::ConfigurationError => e
@@ -240,7 +240,7 @@ class Chef
class << self
def list_commands(preferred_category = nil)
category_desc = preferred_category ? preferred_category + " " : ""
- msg "Available #{category_desc}subcommands: (for details, #{Chef::Dist::KNIFE} SUB-COMMAND --help)\n\n"
+ msg "Available #{category_desc}subcommands: (for details, knife SUB-COMMAND --help)\n\n"
subcommand_loader.list_commands(preferred_category).sort.each do |category, commands|
next if category =~ /deprecated/i
msg "** #{category.upcase} COMMANDS **"
@@ -267,7 +267,7 @@ class Chef
# Mention rehash when the subcommands cache(plugin_manifest.json) is used
if subcommand_loader.is_a?(Chef::Knife::SubcommandLoader::HashedCommandLoader)
- ui.info("If this is a recently installed plugin, please run '#{Chef::Dist::KNIFE} rehash' to update the subcommands cache.")
+ ui.info("If this is a recently installed plugin, please run 'knife rehash' to update the subcommands cache.")
end
if category_commands = guess_category(args)
@@ -439,7 +439,7 @@ class Chef
def run_with_pretty_exceptions(raise_exception = false)
unless respond_to?(:run)
- ui.error "You need to add a #run method to your #{Chef::Dist::KNIFE} command before you can use it"
+ ui.error "You need to add a #run method to your knife command before you can use it"
end
enforce_path_sanity
maybe_setup_fips
@@ -460,17 +460,17 @@ class Chef
humanize_http_exception(e)
when OpenSSL::SSL::SSLError
ui.error "Could not establish a secure connection to the server."
- ui.info "Use `#{Chef::Dist::KNIFE} ssl check` to troubleshoot your SSL configuration."
+ ui.info "Use `knife ssl check` to troubleshoot your SSL configuration."
ui.info "If your #{Chef::Dist::PRODUCT} Server uses a self-signed certificate, you can use"
- ui.info "`#{Chef::Dist::KNIFE} ssl fetch` to make #{Chef::Dist::KNIFE} trust the server's certificates."
+ ui.info "`knife ssl fetch` to make knife trust the server's certificates."
ui.info ""
ui.info "Original Exception: #{e.class.name}: #{e.message}"
when Errno::ECONNREFUSED, Timeout::Error, Errno::ETIMEDOUT, SocketError
ui.error "Network Error: #{e.message}"
- ui.info "Check your #{Chef::Dist::KNIFE} configuration and network settings"
+ ui.info "Check your knife configuration and network settings"
when NameError, NoMethodError
- ui.error "#{Chef::Dist::KNIFE} encountered an unexpected error"
- ui.info "This may be a bug in the '#{self.class.common_name}' #{Chef::Dist::KNIFE} command or plugin"
+ ui.error "knife encountered an unexpected error"
+ ui.info "This may be a bug in the '#{self.class.common_name}' knife command or plugin"
ui.info "Please collect the output of this command with the `-VVV` option before filing a bug report."
ui.info "Exception: #{e.class.name}: #{e.message}"
when Chef::Exceptions::PrivateKeyMissing
@@ -478,7 +478,7 @@ class Chef
ui.info "Check your configuration file and ensure that your private key is readable"
when Chef::Exceptions::InvalidRedirect
ui.error "Invalid Redirect: #{e.message}"
- ui.info "Change your server location in config.rb (formerly #{Chef::Dist::KNIFE}.rb) to the server's FQDN to avoid unwanted redirections."
+ ui.info "Change your server location in knife.rb to the server's FQDN to avoid unwanted redirections."
else
ui.error "#{e.class.name}: #{e.message}"
end
@@ -517,8 +517,8 @@ class Chef
client_api_version = version_header["request_version"]
min_server_version = version_header["min_version"]
max_server_version = version_header["max_version"]
- ui.error "The version of #{Chef::Dist::PRODUCT} that #{Chef::Dist::KNIFE} is using is not supported by the #{Chef::Dist::PRODUCT} server you sent this request to"
- ui.info "The request that #{Chef::Dist::KNIFE} sent was using API version #{client_api_version}"
+ ui.error "The version of #{Chef::Dist::PRODUCT} that Knife is using is not supported by the #{Chef::Dist::PRODUCT} server you sent this request to"
+ ui.info "The request that Knife sent was using API version #{client_api_version}"
ui.info "The #{Chef::Dist::PRODUCT} server you sent the request to supports a min API verson of #{min_server_version} and a max API version of #{max_server_version}"
ui.info "Please either update your #{Chef::Dist::PRODUCT} client or server to be a compatible set"
else