diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2014-03-05 14:41:16 -0800 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2014-03-05 14:41:16 -0800 |
commit | 7bd5a1248df8245695da5eda7522977f57646d18 (patch) | |
tree | 0e7b5f611fc819329c3fb040a24320d4fec153bf | |
parent | 442a81c4a52352e93c6621bf3dffbfe5a9a17bd2 (diff) | |
download | chef-7bd5a1248df8245695da5eda7522977f57646d18.tar.gz |
move exception message into object
-rw-r--r-- | lib/chef/client.rb | 5 | ||||
-rw-r--r-- | lib/chef/exceptions.rb | 8 |
2 files changed, 8 insertions, 5 deletions
diff --git a/lib/chef/client.rb b/lib/chef/client.rb index 5ea2d236b2..ac814333b4 100644 --- a/lib/chef/client.rb +++ b/lib/chef/client.rb @@ -296,10 +296,7 @@ class Chef name = Chef::Config[:node_name] || ohai[:fqdn] || ohai[:machinename] || ohai[:hostname] Chef::Config[:node_name] = name - unless name - msg = "Unable to determine node name: configure node_name or configure the system's hostname and fqdn" - raise Chef::Exceptions::CannotDetermineNodeName, msg - end + raise Chef::Exceptions::CannotDetermineNodeName unless name # node names > 90 bytes only work with authentication protocol >= 1.1 # see discussion in config.rb. diff --git a/lib/chef/exceptions.rb b/lib/chef/exceptions.rb index 3877e3d17a..f976263188 100644 --- a/lib/chef/exceptions.rb +++ b/lib/chef/exceptions.rb @@ -50,7 +50,13 @@ class Chef class Override < RuntimeError; end class UnsupportedAction < RuntimeError; end class MissingLibrary < RuntimeError; end - class CannotDetermineNodeName < RuntimeError; end + + class CannotDetermineNodeName < RuntimeError + def initialize + super "Unable to determine node name: configure node_name or configure the system's hostname and fqdn" + end + end + class User < RuntimeError; end class Group < RuntimeError; end class Link < RuntimeError; end |