summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2019-04-17 14:00:30 -0700
committerGitHub <noreply@github.com>2019-04-17 14:00:30 -0700
commit48b3702ed15148aac96ca25af9f81f96a26d2531 (patch)
treeed859f03ad3338200d5ea2a1646923da1e141362
parentf6f4100cdb1d78fd189325220e8600a15f7e9bff (diff)
parentb4fc5a1634f3312a5318ece9ccfc58d5aebb775d (diff)
downloadchef-48b3702ed15148aac96ca25af9f81f96a26d2531.tar.gz
Merge pull request #8389 from chef/better_error
Improve the error message when no config can be loaded
-rw-r--r--lib/chef/application.rb4
-rw-r--r--lib/chef/application/windows_service.rb2
-rw-r--r--spec/unit/application_spec.rb2
-rw-r--r--spec/unit/log/syslog_spec.rb4
-rw-r--r--spec/unit/log/winevt_spec.rb4
5 files changed, 8 insertions, 8 deletions
diff --git a/lib/chef/application.rb b/lib/chef/application.rb
index 817cdf051d..0eaf9721d9 100644
--- a/lib/chef/application.rb
+++ b/lib/chef/application.rb
@@ -132,10 +132,10 @@ class Chef
config[:config_file] = config_fetcher.expanded_path
if config[:config_file].nil?
- logger.warn("No config file found or specified on command line, using command line options.")
+ logger.warn("No config file found or specified on command line. Using command line options instead.")
elsif config_fetcher.config_missing?
logger.warn("*****************************************")
- logger.warn("Did not find config file: #{config[:config_file]}, using command line options.")
+ logger.warn("Did not find config file: #{config[:config_file]}. Using command line options instead.")
logger.warn("*****************************************")
else
config_content = config_fetcher.read_config
diff --git a/lib/chef/application/windows_service.rb b/lib/chef/application/windows_service.rb
index 26154f8b1e..a9da048ab8 100644
--- a/lib/chef/application/windows_service.rb
+++ b/lib/chef/application/windows_service.rb
@@ -313,7 +313,7 @@ class Chef
end
rescue Errno::ENOENT
Chef::Log.warn("*****************************************")
- Chef::Log.warn("Did not find config file: #{config[:config_file]}, using command line options.")
+ Chef::Log.warn("Did not find config file: #{config[:config_file]}. Using command line options instead.")
Chef::Log.warn("*****************************************")
Chef::Config.merge!(config)
diff --git a/spec/unit/application_spec.rb b/spec/unit/application_spec.rb
index ef28dbb21b..e76e21bddc 100644
--- a/spec/unit/application_spec.rb
+++ b/spec/unit/application_spec.rb
@@ -162,7 +162,7 @@ describe Chef::Application do
it "should emit a warning" do
expect(Chef::Config).not_to receive(:from_file).with("/etc/chef/default.rb")
- expect(Chef::Log).to receive(:warn).with("No config file found or specified on command line, using command line options.")
+ expect(Chef::Log).to receive(:warn).with("No config file found or specified on command line. Using command line options instead.")
@app.configure_chef
end
end
diff --git a/spec/unit/log/syslog_spec.rb b/spec/unit/log/syslog_spec.rb
index 4586503e88..a5219fa8fb 100644
--- a/spec/unit/log/syslog_spec.rb
+++ b/spec/unit/log/syslog_spec.rb
@@ -40,8 +40,8 @@ describe "Chef::Log::Syslog", unix_only: true do
end
it "should send message with severity warning to syslog." do
- expect(syslog).to receive(:add).with(2, "No config file found or specified on command line, using command line options.", nil)
- Chef::Log.warn("No config file found or specified on command line, using command line options.")
+ expect(syslog).to receive(:add).with(2, "No config file found or specified on command line. Using command line options instead.", nil)
+ Chef::Log.warn("No config file found or specified on command line. Using command line options instead.")
end
it "should fallback into send message with severity info to syslog when wrong format." do
diff --git a/spec/unit/log/winevt_spec.rb b/spec/unit/log/winevt_spec.rb
index c7cc49f40d..d2e7784701 100644
--- a/spec/unit/log/winevt_spec.rb
+++ b/spec/unit/log/winevt_spec.rb
@@ -43,8 +43,8 @@ describe Chef::Log::WinEvt do
end
it "should send message with severity warning to Windows Event Log." do
- expect(winevt).to receive(:add).with(2, "No config file found or specified on command line, using command line options.", nil)
- Chef::Log.warn("No config file found or specified on command line, using command line options.")
+ expect(winevt).to receive(:add).with(2, "No config file found or specified on command line. Using command line options instead.", nil)
+ Chef::Log.warn("No config file found or specified on command line. Using command line options instead.")
end
it "should fallback into send message with severity info to Windows Event Log when wrong format." do