diff options
author | Thom May <thom@chef.io> | 2018-03-23 13:05:13 +0000 |
---|---|---|
committer | Tim Smith <tsmith@chef.io> | 2018-03-26 10:34:39 -0700 |
commit | 97c1dd6f1cac6d97e85d05039cad8b28596141ba (patch) | |
tree | d8a97c0f7016986a2cc264aa50ae345638ed026c /lib/chef/provider/remote_file | |
parent | 1b81f35e023bcdc87e410c641545e849298de5c3 (diff) | |
download | chef-97c1dd6f1cac6d97e85d05039cad8b28596141ba.tar.gz |
mechanical conversion of most debug log statements to trace
Signed-off-by: Thom May <thom@chef.io>
Diffstat (limited to 'lib/chef/provider/remote_file')
-rw-r--r-- | lib/chef/provider/remote_file/cache_control_data.rb | 2 | ||||
-rw-r--r-- | lib/chef/provider/remote_file/content.rb | 8 | ||||
-rw-r--r-- | lib/chef/provider/remote_file/http.rb | 8 | ||||
-rw-r--r-- | lib/chef/provider/remote_file/local_file.rb | 2 | ||||
-rw-r--r-- | lib/chef/provider/remote_file/network_file.rb | 2 |
5 files changed, 12 insertions, 10 deletions
diff --git a/lib/chef/provider/remote_file/cache_control_data.rb b/lib/chef/provider/remote_file/cache_control_data.rb index 8d7de5c370..32c1542d57 100644 --- a/lib/chef/provider/remote_file/cache_control_data.rb +++ b/lib/chef/provider/remote_file/cache_control_data.rb @@ -153,7 +153,7 @@ class Chef if Chef::FileCache.has_key?(old_path) # We found an old cache control data file. We started using sha256 instead of md5 # to name these. Upgrade the file to the new name. - Chef::Log.debug("Found old cache control data file at #{old_path}. Moving to #{path}.") + Chef::Log.trace("Found old cache control data file at #{old_path}. Moving to #{path}.") Chef::FileCache.load(old_path).tap do |data| Chef::FileCache.store(path, data) Chef::FileCache.delete(old_path) diff --git a/lib/chef/provider/remote_file/content.rb b/lib/chef/provider/remote_file/content.rb index 983285307a..4cf2c32287 100644 --- a/lib/chef/provider/remote_file/content.rb +++ b/lib/chef/provider/remote_file/content.rb @@ -32,10 +32,10 @@ class Chef include Chef::Mixin::Uris def file_for_provider - Chef::Log.debug("#{@new_resource} checking for changes") + logger.trace("#{@new_resource} checking for changes") if current_resource_matches_target_checksum? - Chef::Log.debug("#{@new_resource} checksum matches target checksum (#{@new_resource.checksum}) - not updating") + logger.trace("#{@new_resource} checksum matches target checksum (#{@new_resource.checksum}) - not updating") else sources = @new_resource.source raw_file = try_multiple_sources(sources) @@ -55,9 +55,9 @@ class Chef end raw_file = grab_file_from_uri(uri) rescue SocketError, Errno::ECONNREFUSED, Errno::ENOENT, Errno::EACCES, Timeout::Error, Net::HTTPServerException, Net::HTTPFatalError, Net::FTPError, Errno::ETIMEDOUT => e - Chef::Log.warn("#{@new_resource} cannot be downloaded from #{source}: #{e}") + logger.warn("#{@new_resource} cannot be downloaded from #{source}: #{e}") if source = sources.shift - Chef::Log.info("#{@new_resource} trying to download from another mirror") + logger.info("#{@new_resource} trying to download from another mirror") retry else raise e diff --git a/lib/chef/provider/remote_file/http.rb b/lib/chef/provider/remote_file/http.rb index 8dfa84ee2a..2122142608 100644 --- a/lib/chef/provider/remote_file/http.rb +++ b/lib/chef/provider/remote_file/http.rb @@ -31,12 +31,14 @@ class Chef attr_reader :uri attr_reader :new_resource attr_reader :current_resource + attr_reader :logger # Parse the uri into instance variables - def initialize(uri, new_resource, current_resource) + def initialize(uri, new_resource, current_resource, logger = Chef::Log.with_child) @uri = uri @new_resource = new_resource @current_resource = current_resource + @logger = logger end def events @@ -55,7 +57,7 @@ class Chef if (etag = cache_control_data.etag) && want_etag_cache_control? cache_control_headers["if-none-match"] = etag end - Chef::Log.debug("Cache control headers: #{cache_control_headers.inspect}") + logger.trace("Cache control headers: #{cache_control_headers.inspect}") cache_control_headers end @@ -129,7 +131,7 @@ class Chef # case you'd end up with a tar archive (no gzip) named, e.g., foo.tgz, # which is not what you wanted. if uri.to_s =~ /gz$/ - Chef::Log.debug("Turning gzip compression off due to filename ending in gz") + logger.trace("Turning gzip compression off due to filename ending in gz") opts[:disable_gzip] = true end opts diff --git a/lib/chef/provider/remote_file/local_file.rb b/lib/chef/provider/remote_file/local_file.rb index 613db02337..0719e5dbf7 100644 --- a/lib/chef/provider/remote_file/local_file.rb +++ b/lib/chef/provider/remote_file/local_file.rb @@ -48,7 +48,7 @@ class Chef # Fetches the file at uri, returning a Tempfile-like File handle def fetch tempfile = Chef::FileContentManagement::Tempfile.new(new_resource).tempfile - Chef::Log.debug("#{new_resource} staging #{source_path} to #{tempfile.path}") + Chef::Log.trace("#{new_resource} staging #{source_path} to #{tempfile.path}") FileUtils.cp(source_path, tempfile.path) tempfile.close if tempfile tempfile diff --git a/lib/chef/provider/remote_file/network_file.rb b/lib/chef/provider/remote_file/network_file.rb index f9dc7b0e7b..ffd2d0bbce 100644 --- a/lib/chef/provider/remote_file/network_file.rb +++ b/lib/chef/provider/remote_file/network_file.rb @@ -41,7 +41,7 @@ class Chef def fetch begin tempfile = Chef::FileContentManagement::Tempfile.new(new_resource).tempfile - Chef::Log.debug("#{new_resource} staging #{@source} to #{tempfile.path}") + Chef::Log.trace("#{new_resource} staging #{@source} to #{tempfile.path}") with_user_context(new_resource.remote_user, new_resource.remote_password, new_resource.remote_domain, new_resource.authentication) do ::File.open(@source, "rb") do |remote_file| |