summaryrefslogtreecommitdiff
path: root/lib/chef
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chef')
-rw-r--r--lib/chef/audit/runner.rb2
-rw-r--r--lib/chef/config.rb79
-rw-r--r--lib/chef/resource_reporter.rb3
-rw-r--r--lib/chef/run_context.rb8
4 files changed, 46 insertions, 46 deletions
diff --git a/lib/chef/audit/runner.rb b/lib/chef/audit/runner.rb
index 4017593c55..7ef17a4301 100644
--- a/lib/chef/audit/runner.rb
+++ b/lib/chef/audit/runner.rb
@@ -16,8 +16,6 @@
# limitations under the License.
#
-require 'chef/config'
-
class Chef
class Audit
class Runner
diff --git a/lib/chef/config.rb b/lib/chef/config.rb
index 9bf9e9d48e..453a8f83da 100644
--- a/lib/chef/config.rb
+++ b/lib/chef/config.rb
@@ -271,7 +271,7 @@ class Chef
# * :fatal
# These work as you'd expect. There is also a special `:auto` setting.
# When set to :auto, Chef will auto adjust the log verbosity based on
- # context. When a tty is available (usually becase the user is running chef
+ # context. When a tty is available (usually because the user is running chef
# in a console), the log level is set to :warn, and output formatters are
# used as the primary mode of output. When a tty is not available, the
# logger is the primary mode of output, and the log level is set to :info
@@ -317,6 +317,7 @@ class Chef
default :why_run, false
default :color, false
default :client_fork, true
+ default :ez, false
default :enable_reporting, true
default :enable_reporting_url_fatals, false
# Possible values for :audit_mode
@@ -568,10 +569,12 @@ class Chef
# used to update files.
default :file_atomic_update, true
- # If false file staging is will be done via tempfiles that are
- # created under ENV['TMP'] otherwise tempfiles will be created in
- # the directory that files are going to reside.
- default :file_staging_uses_destdir, true
+ # There are 3 possible values for this configuration setting.
+ # true => file staging is done in the destination directory
+ # false => file staging is done via tempfiles under ENV['TMP']
+ # :auto => file staging will try using destination directory if possible and
+ # will fall back to ENV['TMP'] if destination directory is not usable.
+ default :file_staging_uses_destdir, :auto
# Exit if another run is in progress and the chef-client is unable to
# get the lock before time expires. If nil, no timeout is enforced. (Exits
@@ -631,44 +634,44 @@ class Chef
#
# If there is no 'locale -a' then we return 'en_US.UTF-8' since that is the most commonly
# available English UTF-8 locale. However, all modern POSIXen should support 'locale -a'.
- default :internal_locale do
- begin
- # https://github.com/opscode/chef/issues/2181
- # Some systems have the `locale -a` command, but the result has
- # invalid characters for the default encoding.
- #
- # For example, on CentOS 6 with ENV['LANG'] = "en_US.UTF-8",
- # `locale -a`.split fails with ArgumentError invalid UTF-8 encoding.
- locales = shell_out_with_systems_locale("locale -a").stdout.split
- case
- when locales.include?('C.UTF-8')
- 'C.UTF-8'
- when locales.include?('en_US.UTF-8'), locales.include?('en_US.utf8')
- 'en_US.UTF-8'
- when locales.include?('en.UTF-8')
- 'en.UTF-8'
- else
- # Will match en_ZZ.UTF-8, en_ZZ.utf-8, en_ZZ.UTF8, en_ZZ.utf8
- guesses = locales.select { |l| l =~ /^en_.*UTF-?8$/i }
- unless guesses.empty?
- guessed_locale = guesses.first
- # Transform into the form en_ZZ.UTF-8
- guessed_locale.gsub(/UTF-?8$/i, "UTF-8")
- else
- Chef::Log.warn "Please install an English UTF-8 locale for Chef to use, falling back to C locale and disabling UTF-8 support."
- 'C'
- end
- end
- rescue
- if Chef::Platform.windows?
- Chef::Log.debug "Defaulting to locale en_US.UTF-8 on Windows, until it matters that we do something else."
+ def self.guess_internal_locale
+ # https://github.com/opscode/chef/issues/2181
+ # Some systems have the `locale -a` command, but the result has
+ # invalid characters for the default encoding.
+ #
+ # For example, on CentOS 6 with ENV['LANG'] = "en_US.UTF-8",
+ # `locale -a`.split fails with ArgumentError invalid UTF-8 encoding.
+ locales = shell_out_with_systems_locale!("locale -a").stdout.split
+ case
+ when locales.include?('C.UTF-8')
+ 'C.UTF-8'
+ when locales.include?('en_US.UTF-8'), locales.include?('en_US.utf8')
+ 'en_US.UTF-8'
+ when locales.include?('en.UTF-8')
+ 'en.UTF-8'
+ else
+ # Will match en_ZZ.UTF-8, en_ZZ.utf-8, en_ZZ.UTF8, en_ZZ.utf8
+ guesses = locales.select { |l| l =~ /^en_.*UTF-?8$/i }
+ unless guesses.empty?
+ guessed_locale = guesses.first
+ # Transform into the form en_ZZ.UTF-8
+ guessed_locale.gsub(/UTF-?8$/i, "UTF-8")
else
- Chef::Log.debug "No usable locale -a command found, assuming you have en_US.UTF-8 installed."
+ Chef::Log.warn "Please install an English UTF-8 locale for Chef to use, falling back to C locale and disabling UTF-8 support."
+ 'C'
end
- 'en_US.UTF-8'
end
+ rescue
+ if Chef::Platform.windows?
+ Chef::Log.debug "Defaulting to locale en_US.UTF-8 on Windows, until it matters that we do something else."
+ else
+ Chef::Log.debug "No usable locale -a command found, assuming you have en_US.UTF-8 installed."
+ end
+ 'en_US.UTF-8'
end
+ default :internal_locale, guess_internal_locale
+
# Force UTF-8 Encoding, for when we fire up in the 'C' locale or other strange locales (e.g.
# japanese windows encodings). If we do not do this, then knife upload will fail when a cookbook's
# README.md has UTF-8 characters that do not encode in whatever surrounding encoding we have been
diff --git a/lib/chef/resource_reporter.rb b/lib/chef/resource_reporter.rb
index a673f4aa58..1816fc857d 100644
--- a/lib/chef/resource_reporter.rb
+++ b/lib/chef/resource_reporter.rb
@@ -20,8 +20,7 @@
#
require 'uri'
-require 'zlib'
-require 'chef/monkey_patches/securerandom'
+require 'securerandom'
require 'chef/event_dispatch/base'
class Chef
diff --git a/lib/chef/run_context.rb b/lib/chef/run_context.rb
index d14035da2f..6803dc5796 100644
--- a/lib/chef/run_context.rb
+++ b/lib/chef/run_context.rb
@@ -104,7 +104,7 @@ class Chef
if nr.instance_of?(Chef::Resource)
@immediate_notification_collection[nr.name] << notification
else
- @immediate_notification_collection[nr.to_s] << notification
+ @immediate_notification_collection[nr.declared_key] << notification
end
end
@@ -115,7 +115,7 @@ class Chef
if nr.instance_of?(Chef::Resource)
@delayed_notification_collection[nr.name] << notification
else
- @delayed_notification_collection[nr.to_s] << notification
+ @delayed_notification_collection[nr.declared_key] << notification
end
end
@@ -123,7 +123,7 @@ class Chef
if resource.instance_of?(Chef::Resource)
return @immediate_notification_collection[resource.name]
else
- return @immediate_notification_collection[resource.to_s]
+ return @immediate_notification_collection[resource.declared_key]
end
end
@@ -131,7 +131,7 @@ class Chef
if resource.instance_of?(Chef::Resource)
return @delayed_notification_collection[resource.name]
else
- return @delayed_notification_collection[resource.to_s]
+ return @delayed_notification_collection[resource.declared_key]
end
end