diff options
| -rw-r--r-- | lib/puppet/type/service.rb | 4 | ||||
| -rw-r--r-- | test/types/tc_service.rb | 9 |
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 |
