summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Allen <bda@icgroup.com>2009-04-09 17:20:53 -0400
committerJames Turnbull <james@lovedthanlost.net>2009-04-24 16:13:46 +1000
commit68ba1f135a587d2dbfbf7a371540a83908c9d590 (patch)
tree8c4cca4be972e2d9bbfd0ed08928d33d7261ae45
parentf1f0a57e4cafc5a9a4378f367022f7cc591033d7 (diff)
downloadpuppet-68ba1f135a587d2dbfbf7a371540a83908c9d590.tar.gz
puppet-68ba1f135a587d2dbfbf7a371540a83908c9d590.tar.xz
puppet-68ba1f135a587d2dbfbf7a371540a83908c9d590.zip
SMF import support working and documentation update
-rwxr-xr-xlib/puppet/provider/service/smf.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/puppet/provider/service/smf.rb b/lib/puppet/provider/service/smf.rb
index 965c9a17c..83c99f21a 100755
--- a/lib/puppet/provider/service/smf.rb
+++ b/lib/puppet/provider/service/smf.rb
@@ -6,6 +6,9 @@ Puppet::Type.type(:service).provide :smf, :parent => :base do
only support for starting and stopping services, which also enables and
disables them, respectively.
+ By specifying manifest => \"/path/to/service.xml\", the SMF manifest will
+ be imported if it does not exist.
+
"
defaultfor :operatingsystem => :solaris
@@ -13,6 +16,21 @@ Puppet::Type.type(:service).provide :smf, :parent => :base do
confine :operatingsystem => :solaris
commands :adm => "/usr/sbin/svcadm", :svcs => "/usr/bin/svcs"
+ commands :svccfg => "/usr/sbin/svccfg"
+
+ def setupservice
+ begin
+ if resource[:manifest]
+ [command(:svcs), "-l", @resource[:name]]
+ if $?.exitstatus == 1
+ Puppet.notice "Importing %s for %s" % [ @resource[:manifest], @resource[:name] ]
+ svccfg :import, resource[:manifest]
+ end
+ end
+ rescue Puppet::ExecutionFailure => detail
+ raise Puppet::Error.new( "Cannot config %s to enable it: %s" % [ self.service, detail ] )
+ end
+ end
def enable
self.start
@@ -36,6 +54,7 @@ Puppet::Type.type(:service).provide :smf, :parent => :base do
end
def startcmd
+ self.setupservice
[command(:adm), :enable, @resource[:name]]
end
@@ -44,6 +63,7 @@ Puppet::Type.type(:service).provide :smf, :parent => :base do
super
return
end
+
begin
output = svcs "-l", @resource[:name]
rescue Puppet::ExecutionFailure