diff options
author | Serdar Sutay <serdar@opscode.com> | 2014-11-17 10:07:08 -0800 |
---|---|---|
committer | Serdar Sutay <serdar@opscode.com> | 2014-11-17 13:59:00 -0800 |
commit | 2e11be7fdd5748159cf9824fc20c2042879f1c8b (patch) | |
tree | 9ad01e5969548967abf48e863944eaff08778ed1 | |
parent | f7ca9bf15b2c1e786ada6500e3a94cf8d78a49eb (diff) | |
download | chef-2e11be7fdd5748159cf9824fc20c2042879f1c8b.tar.gz |
Dedicated error for content staging issues. Comment fixes in config.rb.
-rw-r--r-- | lib/chef/config.rb | 4 | ||||
-rw-r--r-- | lib/chef/exceptions.rb | 7 | ||||
-rw-r--r-- | lib/chef/file_content_management/tempfile.rb | 4 |
3 files changed, 11 insertions, 4 deletions
diff --git a/lib/chef/config.rb b/lib/chef/config.rb index 877abcc2ba..a47e42abda 100644 --- a/lib/chef/config.rb +++ b/lib/chef/config.rb @@ -563,8 +563,8 @@ class Chef # 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 ENV['TMP'] if possible and - # will fall back to destination directory if ENV['TMP'] is not usable. + # :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 diff --git a/lib/chef/exceptions.rb b/lib/chef/exceptions.rb index 25f08455fc..93fdd414e4 100644 --- a/lib/chef/exceptions.rb +++ b/lib/chef/exceptions.rb @@ -126,6 +126,13 @@ class Chef class CannotDetermineHomebrewOwner < Package; end + # Can not create staging file during file deployment + class FileContentStagingError < RuntimeError + def initialize(errors) + super "Staging tempfile can not be created during file deployment.\n Errors: #{errors.join('\n')}!" + end + end + # A different version of a cookbook was added to a # VersionedRecipeList than the one already there. class CookbookVersionConflict < ArgumentError ; end diff --git a/lib/chef/file_content_management/tempfile.rb b/lib/chef/file_content_management/tempfile.rb index 88ef984553..2dde0ce21b 100644 --- a/lib/chef/file_content_management/tempfile.rb +++ b/lib/chef/file_content_management/tempfile.rb @@ -49,7 +49,7 @@ class Chef end end - raise "Staging tempfile can not be created during file deployment.\n Errors: #{errors.join('\n')}!" if tf.nil? + raise Chef::Exceptions::FileContentStagingError(errors) if tf.nil? # We always process the tempfile in binmode so that we # preserve the line endings of the content. @@ -86,7 +86,7 @@ class Chef when false [ Dir.tmpdir ] else - raise "Unknown setting '#{Chef::Config[:file_staging_uses_destdir]}' for Chef::Config[:file_staging_uses_destdir]. Possible values are :auto, true or false." + raise Chef::Exceptions::ConfigurationError, "Unknown setting '#{Chef::Config[:file_staging_uses_destdir]}' for Chef::Config[:file_staging_uses_destdir]. Possible values are :auto, true or false." end end end |