summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2005-08-04 18:56:46 +0000
committerLuke Kanies <luke@madstop.com>2005-08-04 18:56:46 +0000
commitf3c1487c1183a97a45c8e63eef37251ca6360afb (patch)
tree695d201859ad60806dbbb6b58e69cbd294b60de9
parent77e1cf050e8a4cf82925d3d86cc4dc2cd8f4ea58 (diff)
downloadpuppet-f3c1487c1183a97a45c8e63eef37251ca6360afb.tar.gz
puppet-f3c1487c1183a97a45c8e63eef37251ca6360afb.tar.xz
puppet-f3c1487c1183a97a45c8e63eef37251ca6360afb.zip
adding better error handling for missing paths
git-svn-id: https://reductivelabs.com/svn/puppet/library/trunk@500 980ebf18-57e1-0310-9a29-db15c13687c0
-rw-r--r--lib/puppet/type/service.rb4
-rw-r--r--test/types/tc_service.rb9
2 files changed, 11 insertions, 2 deletions
diff --git a/lib/puppet/type/service.rb b/lib/puppet/type/service.rb
index 6d11dae99..a50af8ead 100644
--- a/lib/puppet/type/service.rb
+++ b/lib/puppet/type/service.rb
@@ -130,8 +130,8 @@ module Puppet
def initialize(hash)
super
- unless @searchpaths.length >= 0
- raise Puppet::Error(
+ unless defined? @searchpaths and @searchpaths.length >= 0
+ raise Puppet::Error.new(
"You must specify a valid search path for service %s" %
self.name
)
diff --git a/test/types/tc_service.rb b/test/types/tc_service.rb
index 7a4799b24..a46f158a1 100644
--- a/test/types/tc_service.rb
+++ b/test/types/tc_service.rb
@@ -75,6 +75,15 @@ class TestService < Test::Unit::TestCase
}
assert(@sleeper.insync?)
end
+
+ def testFailOnNoPath
+ assert_raise(Puppet::Error) {
+ Puppet::Type::Service.new(
+ :name => "sleeper"
+ )
+ }
+ end
+
def teardown
Kernel.system("pkill sleeper")
end