puppet 0.9.2 → 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of puppet might be problematic. Click here for more details.
- data/CHANGELOG +58 -0
- data/README +21 -18
- data/Rakefile +176 -36
- data/bin/puppet +34 -48
- data/bin/puppetca +41 -28
- data/bin/puppetd +87 -65
- data/bin/puppetdoc +99 -23
- data/bin/puppetmasterd +72 -91
- data/conf/redhat/client.init +80 -0
- data/conf/redhat/client.sysconfig +11 -0
- data/conf/redhat/fileserver.conf +12 -0
- data/conf/redhat/puppet.spec +130 -0
- data/conf/redhat/server.init +89 -0
- data/conf/redhat/server.sysconfig +9 -0
- data/examples/code/allatonce +2 -2
- data/examples/code/assignments +1 -1
- data/examples/code/classing +2 -2
- data/examples/code/components +2 -2
- data/examples/code/file.bl +5 -5
- data/examples/code/filedefaults +2 -2
- data/examples/code/fileparsing +1 -1
- data/examples/code/filerecursion +1 -1
- data/examples/code/functions +1 -1
- data/examples/code/groups +1 -1
- data/examples/code/importing +1 -1
- data/examples/code/nodes +1 -1
- data/examples/code/one +1 -1
- data/examples/code/relationships +2 -2
- data/examples/code/simpletests +5 -5
- data/examples/code/snippets/argumentdefaults +2 -2
- data/examples/code/snippets/casestatement +16 -8
- data/examples/code/snippets/classheirarchy.pp +4 -4
- data/examples/code/snippets/classincludes.pp +4 -4
- data/examples/code/snippets/classpathtest +2 -2
- data/examples/code/snippets/componentmetaparams.pp +11 -0
- data/examples/code/snippets/dirchmod +5 -5
- data/examples/code/snippets/emptyclass.pp +9 -0
- data/examples/code/snippets/failmissingexecpath.pp +1 -1
- data/examples/code/snippets/falsevalues.pp +1 -1
- data/examples/code/snippets/filecreate +5 -5
- data/examples/code/snippets/implicititeration +5 -5
- data/examples/code/snippets/multipleinstances +4 -4
- data/examples/code/snippets/namevartest +3 -3
- data/examples/code/snippets/scopetest +1 -1
- data/examples/code/snippets/selectorvalues.pp +3 -3
- data/examples/code/snippets/simpledefaults +2 -2
- data/examples/code/snippets/simpleselector +5 -5
- data/examples/code/snippets/singleary.pp +19 -0
- data/examples/root/etc/init.d/sleeper +3 -2
- data/ext/emacs/puppet-mode-init.el +6 -0
- data/ext/emacs/puppet-mode.el +189 -0
- data/ext/ldap/puppet.schema +17 -0
- data/ext/{module:puppet → module_puppet} +30 -31
- data/ext/vim/filetype.vim +9 -0
- data/ext/vim/puppet.vim +87 -0
- data/install.rb +63 -30
- data/lib/puppet.rb +216 -122
- data/lib/puppet/client.rb +51 -416
- data/lib/puppet/client/ca.rb +17 -0
- data/lib/puppet/client/dipper.rb +78 -0
- data/lib/puppet/client/file.rb +20 -0
- data/lib/puppet/client/log.rb +17 -0
- data/lib/puppet/client/master.rb +246 -0
- data/lib/puppet/client/proxy.rb +27 -0
- data/lib/puppet/client/status.rb +7 -0
- data/lib/puppet/config.rb +563 -13
- data/lib/puppet/daemon.rb +50 -22
- data/lib/puppet/element.rb +4 -4
- data/lib/puppet/event-loop.rb +1 -0
- data/lib/puppet/event-loop/better-definers.rb +367 -0
- data/lib/puppet/event-loop/event-loop.rb +355 -0
- data/lib/puppet/event-loop/signal-system.rb +220 -0
- data/lib/puppet/event.rb +9 -11
- data/lib/puppet/filetype.rb +195 -0
- data/lib/puppet/log.rb +35 -12
- data/lib/puppet/metric.rb +2 -2
- data/lib/puppet/networkclient.rb +145 -0
- data/lib/puppet/parameter.rb +335 -0
- data/lib/puppet/parser/ast.rb +42 -1453
- data/lib/puppet/parser/ast/astarray.rb +88 -0
- data/lib/puppet/parser/ast/branch.rb +47 -0
- data/lib/puppet/parser/ast/caseopt.rb +66 -0
- data/lib/puppet/parser/ast/casestatement.rb +78 -0
- data/lib/puppet/parser/ast/classdef.rb +78 -0
- data/lib/puppet/parser/ast/compdef.rb +111 -0
- data/lib/puppet/parser/ast/component.rb +105 -0
- data/lib/puppet/parser/ast/hostclass.rb +82 -0
- data/lib/puppet/parser/ast/leaf.rb +86 -0
- data/lib/puppet/parser/ast/node.rb +103 -0
- data/lib/puppet/parser/ast/nodedef.rb +68 -0
- data/lib/puppet/parser/ast/objectdef.rb +336 -0
- data/lib/puppet/parser/ast/objectparam.rb +30 -0
- data/lib/puppet/parser/ast/objectref.rb +76 -0
- data/lib/puppet/parser/ast/selector.rb +60 -0
- data/lib/puppet/parser/ast/typedefaults.rb +45 -0
- data/lib/puppet/parser/ast/vardef.rb +44 -0
- data/lib/puppet/parser/interpreter.rb +31 -14
- data/lib/puppet/parser/lexer.rb +2 -4
- data/lib/puppet/parser/parser.rb +332 -242
- data/lib/puppet/parser/scope.rb +55 -38
- data/lib/puppet/server.rb +43 -44
- data/lib/puppet/server/authstore.rb +3 -6
- data/lib/puppet/server/ca.rb +5 -2
- data/lib/puppet/server/filebucket.rb +2 -4
- data/lib/puppet/server/fileserver.rb +28 -12
- data/lib/puppet/server/logger.rb +15 -4
- data/lib/puppet/server/master.rb +62 -7
- data/lib/puppet/sslcertificates.rb +41 -607
- data/lib/puppet/sslcertificates/ca.rb +291 -0
- data/lib/puppet/sslcertificates/certificate.rb +283 -0
- data/lib/puppet/statechange.rb +6 -1
- data/lib/puppet/storage.rb +67 -56
- data/lib/puppet/transaction.rb +25 -9
- data/lib/puppet/transportable.rb +102 -22
- data/lib/puppet/type.rb +1096 -315
- data/lib/puppet/type/component.rb +30 -21
- data/lib/puppet/type/cron.rb +409 -448
- data/lib/puppet/type/exec.rb +234 -174
- data/lib/puppet/type/group.rb +65 -82
- data/lib/puppet/type/nameservice.rb +247 -3
- data/lib/puppet/type/nameservice/netinfo.rb +29 -40
- data/lib/puppet/type/nameservice/objectadd.rb +52 -66
- data/lib/puppet/type/nameservice/posix.rb +6 -194
- data/lib/puppet/type/package.rb +447 -295
- data/lib/puppet/type/package/apt.rb +51 -50
- data/lib/puppet/type/package/bsd.rb +82 -0
- data/lib/puppet/type/package/dpkg.rb +85 -88
- data/lib/puppet/type/package/rpm.rb +67 -63
- data/lib/puppet/type/package/sun.rb +119 -98
- data/lib/puppet/type/package/yum.rb +41 -37
- data/lib/puppet/type/parsedtype.rb +295 -0
- data/lib/puppet/type/parsedtype/host.rb +143 -0
- data/lib/puppet/type/parsedtype/port.rb +232 -0
- data/lib/puppet/type/parsedtype/sshkey.rb +129 -0
- data/lib/puppet/type/pfile.rb +484 -460
- data/lib/puppet/type/pfile/checksum.rb +237 -181
- data/lib/puppet/type/pfile/content.rb +67 -0
- data/lib/puppet/type/pfile/ensure.rb +212 -0
- data/lib/puppet/type/pfile/group.rb +106 -105
- data/lib/puppet/type/pfile/mode.rb +98 -101
- data/lib/puppet/type/pfile/source.rb +228 -209
- data/lib/puppet/type/pfile/type.rb +18 -21
- data/lib/puppet/type/pfile/uid.rb +127 -130
- data/lib/puppet/type/pfilebucket.rb +68 -63
- data/lib/puppet/type/schedule.rb +341 -0
- data/lib/puppet/type/service.rb +351 -255
- data/lib/puppet/type/service/base.rb +9 -14
- data/lib/puppet/type/service/debian.rb +32 -38
- data/lib/puppet/type/service/init.rb +130 -130
- data/lib/puppet/type/service/smf.rb +48 -20
- data/lib/puppet/type/state.rb +229 -16
- data/lib/puppet/type/symlink.rb +51 -63
- data/lib/puppet/type/tidy.rb +105 -102
- data/lib/puppet/type/user.rb +118 -180
- data/lib/puppet/util.rb +100 -6
- data/test/certmgr/certmgr.rb +0 -1
- data/test/client/client.rb +4 -4
- data/test/executables/puppetbin.rb +7 -14
- data/test/executables/puppetca.rb +18 -24
- data/test/executables/puppetd.rb +7 -16
- data/test/executables/puppetmasterd.rb +7 -9
- data/test/executables/puppetmodule.rb +11 -16
- data/test/language/ast.rb +11 -7
- data/test/language/interpreter.rb +1 -1
- data/test/language/scope.rb +2 -0
- data/test/language/snippets.rb +30 -5
- data/test/language/transportable.rb +77 -0
- data/test/other/config.rb +316 -0
- data/test/other/events.rb +22 -21
- data/test/other/log.rb +14 -14
- data/test/other/metrics.rb +4 -8
- data/test/other/overrides.rb +5 -5
- data/test/other/relationships.rb +4 -2
- data/test/other/storage.rb +64 -3
- data/test/other/transactions.rb +20 -20
- data/test/parser/parser.rb +7 -4
- data/test/puppet/conffiles.rb +12 -12
- data/test/puppet/defaults.rb +13 -11
- data/test/puppet/utiltest.rb +14 -11
- data/test/puppettest.rb +156 -48
- data/test/server/bucket.rb +2 -2
- data/test/server/fileserver.rb +6 -6
- data/test/server/logger.rb +19 -11
- data/test/server/master.rb +33 -4
- data/test/server/server.rb +2 -7
- data/test/types/basic.rb +5 -7
- data/test/types/component.rb +22 -18
- data/test/types/cron.rb +111 -44
- data/test/types/exec.rb +116 -59
- data/test/types/file.rb +262 -137
- data/test/types/filebucket.rb +13 -15
- data/test/types/fileignoresource.rb +12 -16
- data/test/types/filesources.rb +73 -48
- data/test/types/filetype.rb +13 -15
- data/test/types/group.rb +15 -13
- data/test/types/host.rb +146 -0
- data/test/types/package.rb +74 -63
- data/test/types/port.rb +139 -0
- data/test/types/query.rb +8 -8
- data/test/types/schedule.rb +335 -0
- data/test/types/service.rb +137 -21
- data/test/types/sshkey.rb +140 -0
- data/test/types/symlink.rb +3 -5
- data/test/types/tidy.rb +5 -14
- data/test/types/type.rb +67 -11
- data/test/types/user.rb +25 -23
- metadata +186 -122
- data/lib/puppet/type/pfile/create.rb +0 -108
- data/lib/puppet/type/pprocess.rb +0 -97
- data/lib/puppet/type/typegen.rb +0 -149
- data/lib/puppet/type/typegen/filerecord.rb +0 -243
- data/lib/puppet/type/typegen/filetype.rb +0 -316
- data/test/other/state.rb +0 -106
@@ -1,17 +1,12 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
else
|
11
|
-
raise Puppet::Error,
|
12
|
-
"Services must specify a start command or a binary"
|
13
|
-
end
|
14
|
-
end
|
1
|
+
Puppet.type(:service).newsvctype(:base) do
|
2
|
+
# The command used to start. Generated if the 'binary' argument
|
3
|
+
# is passed.
|
4
|
+
def startcmd
|
5
|
+
if self[:binary]
|
6
|
+
return self[:binary]
|
7
|
+
else
|
8
|
+
raise Puppet::Error,
|
9
|
+
"Services must specify a start command or a binary"
|
15
10
|
end
|
16
11
|
end
|
17
12
|
end
|
@@ -2,49 +2,43 @@ require 'puppet/type/service/init'
|
|
2
2
|
|
3
3
|
# Manage debian services. Start/stop is the same as InitSvc, but enable/disable
|
4
4
|
# is special.
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
# Remove the symlinks
|
11
|
-
def disable
|
12
|
-
output = %x{update-rc.d -f #{self.name} remove 2>/dev/null}
|
5
|
+
Puppet.type(:service).newsvctype(:debian, :init) do
|
6
|
+
# Remove the symlinks
|
7
|
+
def disable
|
8
|
+
output = %x{update-rc.d -f #{self.name} remove 2>/dev/null}
|
13
9
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
10
|
+
unless $? == 0
|
11
|
+
raise Puppet::Error, "Could not disable %s: %s" %
|
12
|
+
[self.name, output]
|
13
|
+
end
|
14
|
+
end
|
19
15
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
16
|
+
def enabled?
|
17
|
+
output = %x{update-rc.d -n -f #{self.name} remove 2>/dev/null}
|
18
|
+
unless $? == 0
|
19
|
+
raise Puppet::Error, "Could not check %s: %s" %
|
20
|
+
[self.name, output]
|
21
|
+
end
|
26
22
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
23
|
+
# If it's enabled, then it will print output showing removal of
|
24
|
+
# links.
|
25
|
+
if output =~ /etc\/rc\d.d/
|
26
|
+
return true
|
27
|
+
else
|
28
|
+
return false
|
29
|
+
end
|
30
|
+
end
|
35
31
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
32
|
+
def enable(runlevel)
|
33
|
+
if runlevel
|
34
|
+
raise Puppet::Error, "Specification of runlevels is not supported"
|
35
|
+
else
|
36
|
+
output = %x{update-rc.d #{self.name} defaults 2>/dev/null}
|
37
|
+
end
|
42
38
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
end
|
47
|
-
end
|
39
|
+
unless $? == 0
|
40
|
+
raise Puppet::Error, "Could not check %s: %s" %
|
41
|
+
[self.name, output]
|
48
42
|
end
|
49
43
|
end
|
50
44
|
end
|
@@ -1,145 +1,145 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
1
|
+
# The standard init-based service type. Many other service types are
|
2
|
+
# customizations of this module.
|
3
|
+
Puppet.type(:service).newsvctype(:init) do
|
4
|
+
|
5
|
+
# Set the default init directory.
|
6
|
+
Puppet.type(:service).attrclass(:path).defaultto do
|
7
|
+
case Facter["operatingsystem"].value
|
8
|
+
when "FreeBSD":
|
9
|
+
"/etc/rc.d"
|
10
|
+
else
|
11
|
+
#@defaultrc = "/etc/rc%s.d"
|
12
|
+
"/etc/init.d"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
# # Make sure we've got a search path set up. If they don't
|
16
|
+
# # specify one, try to determine one.
|
17
|
+
# def configchk
|
18
|
+
# unless defined? @searchpaths
|
19
|
+
# Puppet.notice "Initting search paths"
|
20
|
+
# @searchpaths = []
|
21
|
+
# end
|
22
|
+
# unless @searchpaths.length > 0
|
23
|
+
# if init = self.defaultinit
|
24
|
+
# self.notice "Adding default init"
|
25
|
+
# @searchpaths << init
|
26
|
+
# else
|
27
|
+
# self.notice "No default init for %s" %
|
28
|
+
# Facter["operatingsystem"].value
|
29
|
+
#
|
30
|
+
# raise Puppet::Error.new(
|
31
|
+
# "You must specify a valid search path for service %s" %
|
32
|
+
# self.name
|
33
|
+
# )
|
34
|
+
# end
|
35
|
+
# end
|
36
|
+
# end
|
37
|
+
#
|
38
|
+
# # Get the default init path.
|
39
|
+
# def defaultinit
|
40
|
+
# unless defined? @defaultinit
|
41
|
+
# case Facter["operatingsystem"].value
|
42
|
+
# when "FreeBSD":
|
43
|
+
# @defaultinit = "/etc/rc.d"
|
44
|
+
# else
|
45
|
+
# @defaultinit = "/etc/init.d"
|
46
|
+
# @defaultrc = "/etc/rc%s.d"
|
47
|
+
# end
|
48
|
+
# end
|
49
|
+
#
|
50
|
+
# return @defaultinit
|
51
|
+
# end
|
52
|
+
|
53
|
+
# Mark that our init script supports 'status' commands.
|
54
|
+
def hasstatus=(value)
|
55
|
+
case value
|
56
|
+
when true, "true": @parameters[:hasstatus] = true
|
57
|
+
when false, "false": @parameters[:hasstatus] = false
|
58
|
+
else
|
59
|
+
raise Puppet::Error, "Invalid 'hasstatus' value %s" %
|
60
|
+
value.inspect
|
61
|
+
end
|
62
|
+
end
|
57
63
|
|
58
|
-
|
59
|
-
|
64
|
+
# it'd be nice if i didn't throw the output away...
|
65
|
+
# this command returns true if the exit code is 0, and returns
|
66
|
+
# false otherwise
|
67
|
+
def initcmd(cmd)
|
68
|
+
script = self.initscript
|
60
69
|
|
61
|
-
|
62
|
-
|
70
|
+
self.debug "Executing '%s %s' as initcmd for '%s'" %
|
71
|
+
[script,cmd,self]
|
63
72
|
|
64
|
-
|
65
|
-
|
73
|
+
rvalue = Kernel.system("%s %s" %
|
74
|
+
[script,cmd])
|
66
75
|
|
76
|
+
self.debug "'%s' ran with exit status '%s'" %
|
77
|
+
[cmd,rvalue]
|
67
78
|
|
68
|
-
rvalue
|
69
|
-
end
|
70
79
|
|
71
|
-
|
72
|
-
|
73
|
-
if defined? @initscript
|
74
|
-
return @initscript
|
75
|
-
else
|
76
|
-
@initscript = self.search(self.name)
|
77
|
-
end
|
78
|
-
end
|
80
|
+
rvalue
|
81
|
+
end
|
79
82
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
File.directory?(dir)
|
89
|
-
}
|
90
|
-
end
|
83
|
+
# Where is our init script?
|
84
|
+
def initscript
|
85
|
+
if defined? @initscript
|
86
|
+
return @initscript
|
87
|
+
else
|
88
|
+
@initscript = self.search(self.name)
|
89
|
+
end
|
90
|
+
end
|
91
91
|
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
end
|
116
|
-
|
117
|
-
# if we've gotten this far, we found a valid script
|
118
|
-
return fqname
|
119
|
-
}
|
120
|
-
raise Puppet::Error, "Could not find init script for '%s'" % name
|
92
|
+
# Enable a service, so it's started at boot time. This basically
|
93
|
+
# just creates links in the RC directories, which means that, well,
|
94
|
+
# we need to know where the rc directories are.
|
95
|
+
# FIXME This should probably be a state or something, and
|
96
|
+
# it should actually create use Symlink objects...
|
97
|
+
# At this point, people should just link objects for enabling,
|
98
|
+
# if they're running on a system that doesn't have a tool to
|
99
|
+
# manage init script links.
|
100
|
+
#def enable
|
101
|
+
#end
|
102
|
+
|
103
|
+
#def disable
|
104
|
+
#end
|
105
|
+
|
106
|
+
def search(name)
|
107
|
+
self[:path].each { |path|
|
108
|
+
fqname = File.join(path,name)
|
109
|
+
begin
|
110
|
+
stat = File.stat(fqname)
|
111
|
+
rescue
|
112
|
+
# should probably rescue specific errors...
|
113
|
+
self.debug("Could not find %s in %s" % [name,path])
|
114
|
+
next
|
121
115
|
end
|
122
116
|
|
123
|
-
#
|
124
|
-
|
125
|
-
|
126
|
-
|
117
|
+
# if we've gotten this far, we found a valid script
|
118
|
+
return fqname
|
119
|
+
}
|
120
|
+
raise Puppet::Error, "Could not find init script for '%s'" % name
|
121
|
+
end
|
127
122
|
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
if self[:hasstatus]
|
133
|
-
return self.initscript + " status"
|
134
|
-
else
|
135
|
-
return false
|
136
|
-
end
|
137
|
-
end
|
123
|
+
# The start command is just the init scriptwith 'start'.
|
124
|
+
def startcmd
|
125
|
+
self.initscript + " start"
|
126
|
+
end
|
138
127
|
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
128
|
+
# If it was specified that the init script has a 'status' command, then
|
129
|
+
# we just return that; otherwise, we return false, which causes it to
|
130
|
+
# fallback to other mechanisms.
|
131
|
+
def statuscmd
|
132
|
+
if self[:hasstatus]
|
133
|
+
return self.initscript + " status"
|
134
|
+
else
|
135
|
+
return false
|
143
136
|
end
|
144
137
|
end
|
138
|
+
|
139
|
+
# The stop command is just the init script with 'stop'.
|
140
|
+
def stopcmd
|
141
|
+
self.initscript + " stop"
|
142
|
+
end
|
145
143
|
end
|
144
|
+
|
145
|
+
# $Id: init.rb 796 2006-01-10 14:38:39Z luke $
|
@@ -1,29 +1,57 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
# Solaris 10 SMF-style services. This is not yet implemented, which is probably
|
2
|
+
# somewhat obvious.
|
3
|
+
Puppet.type(:service).newsvctype(:smf) do
|
4
|
+
def restartcmd
|
5
|
+
"svcadm restart %s" % self.name
|
6
|
+
end
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
end
|
8
|
+
def startcmd
|
9
|
+
"svcadm enable %s" % self.name
|
10
|
+
end
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
12
|
+
def status
|
13
|
+
if self[:status]
|
14
|
+
super
|
15
|
+
return
|
16
|
+
end
|
17
|
+
%x{/usr/bin/svcs -l #{self.name} 2>/dev/null}.split("\n").each { |line|
|
18
|
+
var = nil
|
19
|
+
value = nil
|
20
|
+
if line =~ /^(\w+)\s+(.+)/
|
21
|
+
var = $1
|
22
|
+
value = $2
|
23
|
+
else
|
24
|
+
Puppet.err "Could not match %s" % line.inspect
|
25
|
+
end
|
26
|
+
case var
|
27
|
+
when "state":
|
28
|
+
case value
|
29
|
+
when "online":
|
30
|
+
#self.warning "matched running %s" % line.inspect
|
31
|
+
return :running
|
32
|
+
when "offline", "disabled":
|
33
|
+
#self.warning "matched stopped %s" % line.inspect
|
34
|
+
return :stopped
|
35
|
+
when "legacy_run":
|
36
|
+
raise Puppet::Error,
|
37
|
+
"Cannot manage legacy services through SMF"
|
18
38
|
else
|
19
|
-
|
39
|
+
raise Puppet::Error,
|
40
|
+
"Unmanageable state %s on service %s" %
|
41
|
+
[value, self.name]
|
20
42
|
end
|
21
43
|
end
|
44
|
+
}
|
22
45
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
end
|
46
|
+
if $? != 0
|
47
|
+
raise Puppet::Error,
|
48
|
+
"Could not get status on service %s" % self.name
|
27
49
|
end
|
28
50
|
end
|
51
|
+
|
52
|
+
def stopcmd
|
53
|
+
"svcadm disable %s" % self.name
|
54
|
+
end
|
29
55
|
end
|
56
|
+
|
57
|
+
# $Id: smf.rb 809 2006-01-12 07:08:19Z luke $
|