puppet 0.16.0 → 0.18.4

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.

Files changed (185) hide show
  1. data/CHANGELOG +98 -0
  2. data/Rakefile +5 -1
  3. data/bin/puppet +1 -1
  4. data/bin/puppetca +25 -11
  5. data/bin/puppetd +189 -66
  6. data/bin/puppetdoc +79 -62
  7. data/bin/puppetmasterd +93 -49
  8. data/bin/puppetrun +385 -0
  9. data/conf/redhat/client.init +5 -2
  10. data/conf/redhat/fileserver.conf +1 -1
  11. data/conf/redhat/lsb-config.patch +51 -0
  12. data/conf/redhat/puppet.spec +45 -18
  13. data/conf/redhat/puppetd.conf +32 -4
  14. data/conf/redhat/server.init +5 -2
  15. data/conf/solaris/pkginfo +7 -0
  16. data/conf/solaris/smf/puppetd.xml +77 -0
  17. data/conf/solaris/smf/puppetmasterd.xml +77 -0
  18. data/conf/solaris/smf/svc-puppetd +66 -0
  19. data/conf/solaris/smf/svc-puppetmasterd +62 -0
  20. data/examples/code/failers/noobjectrvalue +1 -0
  21. data/examples/code/snippets/deepclassheirarchy.pp +23 -0
  22. data/examples/code/snippets/defineoverrides.pp +17 -0
  23. data/examples/code/snippets/emptyexec.pp +3 -0
  24. data/examples/code/snippets/selectorvalues.pp +6 -1
  25. data/examples/code/snippets/tagged.pp +35 -0
  26. data/ext/ldap/puppet.schema +2 -2
  27. data/install.rb +4 -2
  28. data/lib/puppet.rb +206 -15
  29. data/lib/puppet/client.rb +30 -20
  30. data/lib/puppet/client/ca.rb +2 -2
  31. data/lib/puppet/client/dipper.rb +5 -9
  32. data/lib/puppet/client/master.rb +224 -44
  33. data/lib/puppet/client/pelement.rb +54 -9
  34. data/lib/puppet/client/proxy.rb +3 -2
  35. data/lib/puppet/client/reporter.rb +34 -0
  36. data/lib/puppet/client/runner.rb +17 -0
  37. data/lib/puppet/config.rb +136 -55
  38. data/lib/puppet/daemon.rb +59 -37
  39. data/lib/puppet/element.rb +2 -1
  40. data/lib/puppet/event.rb +14 -3
  41. data/lib/puppet/filetype.rb +28 -19
  42. data/lib/puppet/log.rb +297 -132
  43. data/lib/puppet/metric.rb +31 -131
  44. data/lib/puppet/networkclient.rb +73 -46
  45. data/lib/puppet/parameter.rb +49 -1
  46. data/lib/puppet/parsedfile.rb +32 -12
  47. data/lib/puppet/parser/ast.rb +6 -1
  48. data/lib/puppet/parser/ast/astarray.rb +32 -6
  49. data/lib/puppet/parser/ast/collection.rb +91 -0
  50. data/lib/puppet/parser/ast/compdef.rb +2 -2
  51. data/lib/puppet/parser/ast/component.rb +24 -11
  52. data/lib/puppet/parser/ast/function.rb +50 -0
  53. data/lib/puppet/parser/ast/hostclass.rb +70 -22
  54. data/lib/puppet/parser/ast/node.rb +17 -8
  55. data/lib/puppet/parser/ast/nodedef.rb +1 -1
  56. data/lib/puppet/parser/ast/objectdef.rb +28 -10
  57. data/lib/puppet/parser/ast/selector.rb +4 -1
  58. data/lib/puppet/parser/functions.rb +145 -0
  59. data/lib/puppet/parser/interpreter.rb +243 -86
  60. data/lib/puppet/parser/lexer.rb +5 -4
  61. data/lib/puppet/parser/parser.rb +586 -505
  62. data/lib/puppet/parser/scope.rb +337 -187
  63. data/lib/puppet/rails.rb +115 -0
  64. data/lib/puppet/rails/database.rb +40 -0
  65. data/lib/puppet/rails/host.rb +83 -0
  66. data/lib/puppet/rails/rails_object.rb +42 -0
  67. data/lib/puppet/rails/rails_parameter.rb +5 -0
  68. data/lib/puppet/reports/rrdgraph.rb +20 -0
  69. data/lib/puppet/reports/tagmail.rb +94 -0
  70. data/lib/puppet/server.rb +20 -4
  71. data/lib/puppet/server/authconfig.rb +14 -3
  72. data/lib/puppet/server/authstore.rb +2 -2
  73. data/lib/puppet/server/ca.rb +23 -11
  74. data/lib/puppet/server/filebucket.rb +10 -10
  75. data/lib/puppet/server/fileserver.rb +4 -8
  76. data/lib/puppet/server/master.rb +19 -22
  77. data/lib/puppet/server/pelement.rb +28 -16
  78. data/lib/puppet/server/report.rb +184 -0
  79. data/lib/puppet/server/runner.rb +62 -0
  80. data/lib/puppet/server/servlet.rb +23 -9
  81. data/lib/puppet/sslcertificates/ca.rb +25 -1
  82. data/lib/puppet/statechange.rb +34 -53
  83. data/lib/puppet/storage.rb +1 -2
  84. data/lib/puppet/transaction.rb +305 -133
  85. data/lib/puppet/transaction/report.rb +42 -0
  86. data/lib/puppet/transportable.rb +57 -33
  87. data/lib/puppet/type.rb +260 -127
  88. data/lib/puppet/type/component.rb +9 -21
  89. data/lib/puppet/type/cron.rb +367 -116
  90. data/lib/puppet/type/exec.rb +15 -16
  91. data/lib/puppet/type/group.rb +9 -1
  92. data/lib/puppet/type/nameservice.rb +2 -5
  93. data/lib/puppet/type/nameservice/netinfo.rb +3 -0
  94. data/lib/puppet/type/nameservice/objectadd.rb +23 -10
  95. data/lib/puppet/type/nameservice/pw.rb +16 -3
  96. data/lib/puppet/type/package.rb +25 -75
  97. data/lib/puppet/type/package/apple.rb +15 -1
  98. data/lib/puppet/type/package/apt.rb +37 -2
  99. data/lib/puppet/type/package/blastwave.rb +136 -0
  100. data/lib/puppet/type/package/dpkg.rb +4 -4
  101. data/lib/puppet/type/package/gem.rb +119 -0
  102. data/lib/puppet/type/package/openbsd.rb +7 -6
  103. data/lib/puppet/type/package/ports.rb +7 -2
  104. data/lib/puppet/type/package/rpm.rb +1 -1
  105. data/lib/puppet/type/package/sun.rb +23 -9
  106. data/lib/puppet/type/package/sunfreeware.rb +7 -0
  107. data/lib/puppet/type/package/yum.rb +16 -9
  108. data/lib/puppet/type/parsedtype.rb +7 -5
  109. data/lib/puppet/type/parsedtype/mount.rb +55 -34
  110. data/lib/puppet/type/parsedtype/port.rb +7 -1
  111. data/lib/puppet/type/parsedtype/sshkey.rb +6 -16
  112. data/lib/puppet/type/pfile.rb +115 -23
  113. data/lib/puppet/type/pfile/checksum.rb +18 -5
  114. data/lib/puppet/type/pfile/content.rb +2 -2
  115. data/lib/puppet/type/pfile/ensure.rb +3 -3
  116. data/lib/puppet/type/pfile/group.rb +2 -2
  117. data/lib/puppet/type/pfile/source.rb +28 -17
  118. data/lib/puppet/type/pfile/target.rb +25 -17
  119. data/lib/puppet/type/pfilebucket.rb +25 -6
  120. data/lib/puppet/type/schedule.rb +6 -6
  121. data/lib/puppet/type/service.rb +24 -14
  122. data/lib/puppet/type/service/debian.rb +1 -1
  123. data/lib/puppet/type/service/redhat.rb +13 -10
  124. data/lib/puppet/type/service/smf.rb +3 -3
  125. data/lib/puppet/type/state.rb +1 -2
  126. data/lib/puppet/type/symlink.rb +3 -4
  127. data/lib/puppet/type/user.rb +22 -10
  128. data/lib/puppet/type/yumrepo.rb +6 -1
  129. data/lib/puppet/type/zone.rb +595 -0
  130. data/lib/puppet/util.rb +58 -12
  131. data/test/client/client.rb +2 -2
  132. data/test/client/master.rb +92 -3
  133. data/test/client/pelement.rb +99 -0
  134. data/test/executables/puppetbin.rb +3 -4
  135. data/test/executables/puppetca.rb +3 -3
  136. data/test/executables/puppetd.rb +3 -3
  137. data/test/executables/puppetmasterd.rb +1 -5
  138. data/test/executables/puppetmodule.rb +2 -2
  139. data/test/language/ast.rb +200 -11
  140. data/test/language/functions.rb +245 -0
  141. data/test/language/interpreter.rb +155 -6
  142. data/test/language/lexer.rb +35 -2
  143. data/test/language/node.rb +48 -1
  144. data/test/language/parser.rb +250 -1
  145. data/test/language/rails.rb +105 -0
  146. data/test/language/scope.rb +304 -10
  147. data/test/language/snippets.rb +54 -5
  148. data/test/language/transportable.rb +60 -28
  149. data/test/other/config.rb +214 -1
  150. data/test/other/events.rb +67 -9
  151. data/test/other/log.rb +31 -5
  152. data/test/other/metrics.rb +23 -21
  153. data/test/other/parsedfile.rb +29 -2
  154. data/test/other/puppet.rb +79 -0
  155. data/test/other/report.rb +106 -0
  156. data/test/other/storage.rb +2 -2
  157. data/test/other/transactions.rb +128 -2
  158. data/test/puppet/utiltest.rb +10 -5
  159. data/test/puppettest.rb +193 -21
  160. data/test/server/authstore.rb +13 -4
  161. data/test/server/bucket.rb +33 -8
  162. data/test/server/ca.rb +44 -6
  163. data/test/server/master.rb +6 -7
  164. data/test/server/pelement.rb +15 -5
  165. data/test/server/report.rb +93 -0
  166. data/test/server/runner.rb +107 -0
  167. data/test/server/server.rb +28 -1
  168. data/test/types/cron.rb +339 -31
  169. data/test/types/file.rb +256 -24
  170. data/test/types/filebucket.rb +6 -2
  171. data/test/types/filesources.rb +41 -92
  172. data/test/types/group.rb +31 -1
  173. data/test/types/host.rb +2 -1
  174. data/test/types/mount.rb +18 -1
  175. data/test/types/package.rb +200 -18
  176. data/test/types/service.rb +5 -1
  177. data/test/types/sshkey.rb +2 -1
  178. data/test/types/symlink.rb +3 -2
  179. data/test/types/type.rb +180 -1
  180. data/test/types/user.rb +65 -27
  181. data/test/types/yumrepo.rb +15 -0
  182. data/test/types/zone.rb +437 -0
  183. metadata +43 -4
  184. data/bin/cf2puppet +0 -186
  185. data/conf/redhat/puppetmasterd.conf +0 -5
@@ -103,7 +103,12 @@ module Puppet
103
103
  if hash.include?(sumtype)
104
104
  #self.notice "Found checksum %s for %s" %
105
105
  # [hash[sumtype] ,@parent[:path]]
106
- return hash[sumtype]
106
+ sum = hash[sumtype]
107
+
108
+ unless sum =~ /^\{\w+\}/
109
+ sum = "{%s}%s" % [sumtype, sum]
110
+ end
111
+ return sum
107
112
  elsif hash.empty?
108
113
  #self.notice "Could not find sum of type %s" % sumtype
109
114
  return :nosum
@@ -133,11 +138,13 @@ module Puppet
133
138
  begin
134
139
  File.open(@parent[:path]) { |file|
135
140
  text = nil
136
- if checktype == "md5"
141
+ case checktype
142
+ when :md5
137
143
  text = file.read
138
- else
144
+ when :md5lite
139
145
  text = file.read(512)
140
146
  end
147
+
141
148
  if text.nil?
142
149
  self.debug "Not checksumming empty file %s" %
143
150
  @parent[:path]
@@ -215,7 +222,13 @@ module Puppet
215
222
  # Even though they can specify multiple checksums, the insync?
216
223
  # mechanism can really only test against one, so we'll just retrieve
217
224
  # the first specified sum type.
218
- def retrieve
225
+ def retrieve(usecache = false)
226
+ # When the 'source' is retrieving, it passes "true" here so
227
+ # that we aren't reading the file twice in quick succession, yo.
228
+ if usecache and @is
229
+ return @is
230
+ end
231
+
219
232
  unless defined? @checktypes
220
233
  @checktypes = ["md5"]
221
234
  end
@@ -297,4 +310,4 @@ module Puppet
297
310
  end
298
311
  end
299
312
 
300
- # $Id: checksum.rb 1126 2006-04-20 20:55:02Z luke $
313
+ # $Id: checksum.rb 1147 2006-04-28 17:19:45Z luke $
@@ -3,7 +3,7 @@ module Puppet
3
3
  desc "Specify the contents of a file as a string. Newlines, tabs, and spaces
4
4
  can be specified using the escaped syntax (e.g., \\n for a newline). The
5
5
  primary purpose of this parameter is to provide a kind of limited
6
- templating::
6
+ templating:
7
7
 
8
8
  define resolve(nameserver1, nameserver2, domain, search) {
9
9
  $str = \"search $search
@@ -67,4 +67,4 @@ module Puppet
67
67
  end
68
68
  end
69
69
 
70
- # $Id: content.rb 1125 2006-04-20 19:38:48Z luke $
70
+ # $Id: content.rb 1300 2006-06-19 19:12:54Z luke $
@@ -7,7 +7,7 @@ module Puppet
7
7
  although currently this will not recursively delete directories.
8
8
 
9
9
  Anything other than those values will be considered to be a symlink.
10
- For instance, the following text creates a link::
10
+ For instance, the following text creates a link:
11
11
 
12
12
  # Useful on solaris
13
13
  file { \"/etc/inetd.conf\":
@@ -82,7 +82,7 @@ module Puppet
82
82
  self.set_directory
83
83
  return :directory_created
84
84
  else
85
- return state.sync
85
+ return state.mklink
86
86
  end
87
87
  else
88
88
  self.fail "Cannot create a symlink without a target"
@@ -152,4 +152,4 @@ module Puppet
152
152
  end
153
153
  end
154
154
 
155
- # $Id: ensure.rb 1123 2006-04-20 05:14:13Z luke $
155
+ # $Id: ensure.rb 1300 2006-06-19 19:12:54Z luke $
@@ -88,7 +88,7 @@ module Puppet
88
88
  self.retrieve
89
89
 
90
90
  if @is == :absent
91
- self.info "File '%s' does not exist; cannot chgrp" %
91
+ self.debug "File '%s' does not exist; cannot chgrp" %
92
92
  @parent[:path]
93
93
  return nil
94
94
  end
@@ -116,4 +116,4 @@ module Puppet
116
116
  end
117
117
  end
118
118
 
119
- # $Id: group.rb 988 2006-03-06 19:54:59Z luke $
119
+ # $Id: group.rb 1384 2006-07-11 16:53:59Z luke $
@@ -1,7 +1,9 @@
1
+ require 'puppet/server/fileserver'
2
+
1
3
  module Puppet
2
4
  # Copy files from a local or remote source.
3
5
  Puppet.type(:file).newstate(:source) do
4
- PINPARAMS = [:mode, :type, :owner, :group, :checksum]
6
+ PINPARAMS = Puppet::Server::FileServer::CHECKPARAMS
5
7
 
6
8
  attr_accessor :source, :local
7
9
  desc "Copy a file over the current file. Uses ``checksum`` to
@@ -12,7 +14,7 @@ module Puppet
12
14
  This is one of the primary mechanisms for getting content into
13
15
  applications that Puppet does not directly support and is very
14
16
  useful for those configuration files that don't change much across
15
- sytems. For instance::
17
+ sytems. For instance:
16
18
 
17
19
  class sendmail {
18
20
  file { \"/etc/mail/sendmail.cf\":
@@ -20,11 +22,11 @@ module Puppet
20
22
  }
21
23
  }
22
24
 
23
- See the `fileserver docs`_ for information on how to configure
25
+ See the [fileserver docs][] for information on how to configure
24
26
  and use file services within Puppet.
25
27
 
26
28
 
27
- .. _fileserver docs: /projects/puppet/documentation/fsconfigref
29
+ [fileserver docs]: fsconfigref.html
28
30
 
29
31
  "
30
32
 
@@ -71,7 +73,7 @@ module Puppet
71
73
  # of the local states appropriately. If the remote file is a normal
72
74
  # file then we set it to copy; if it's a directory, then we just mark
73
75
  # that the local directory should be created.
74
- def retrieve
76
+ def retrieve(remote = true)
75
77
  sum = nil
76
78
 
77
79
  unless defined? @shouldorig
@@ -79,16 +81,21 @@ module Puppet
79
81
  @parent.name
80
82
  end
81
83
 
82
- @source = nil
83
-
84
- # Find the first source that exists. @shouldorig contains
85
- # the sources as specified by the user.
86
- @shouldorig.each { |source|
87
- if @stats = self.describe(source)
88
- @source = source
89
- break
90
- end
91
- }
84
+ @source = nil unless defined? @source
85
+
86
+ # This is set to false by the File#retrieve function on the second
87
+ # retrieve, so that we do not do two describes.
88
+ if remote
89
+ @source = nil
90
+ # Find the first source that exists. @shouldorig contains
91
+ # the sources as specified by the user.
92
+ @shouldorig.each { |source|
93
+ if @stats = self.describe(source)
94
+ @source = source
95
+ break
96
+ end
97
+ }
98
+ end
92
99
 
93
100
  if @stats.nil? or @stats[:type].nil?
94
101
  @is = :notdescribed
@@ -102,7 +109,7 @@ module Puppet
102
109
  if sum = @parent.state(:checksum)
103
110
  if sum.is
104
111
  if sum.is == :absent
105
- sum.retrieve
112
+ sum.retrieve(true)
106
113
  end
107
114
  @is = sum.is
108
115
  else
@@ -176,6 +183,10 @@ module Puppet
176
183
  # here doesn't really matter, because the @should values will be
177
184
  # overridden when we 'retrieve'.
178
185
  munge do |source|
186
+ if source.is_a? Symbol
187
+ return source
188
+ end
189
+
179
190
  # Remove any trailing slashes
180
191
  source.sub!(/\/$/, '')
181
192
  unless @parent.uri2obj(source)
@@ -256,4 +267,4 @@ module Puppet
256
267
  end
257
268
  end
258
269
 
259
- # $Id: source.rb 1123 2006-04-20 05:14:13Z luke $
270
+ # $Id: source.rb 1300 2006-06-19 19:12:54Z luke $
@@ -12,32 +12,40 @@ module Puppet
12
12
 
13
13
  # Anything else, basically
14
14
  newvalue(/./) do
15
+ if @parent.state(:ensure).insync?
16
+ mklink()
17
+ end
18
+ end
19
+
20
+ # Create our link.
21
+ def mklink
15
22
  target = self.should
16
23
 
17
24
  if stat = @parent.stat
18
- unless stat.ftype == "link"
19
- self.fail "Not replacing non-symlink"
25
+ unless @parent.handlebackup
26
+ self.fail "Could not back up; will not replace with link"
27
+ end
28
+
29
+ case stat.ftype
30
+ when "directory":
31
+ FileUtils.rmtree(@parent[:path])
32
+ else
33
+ File.unlink(@parent[:path])
20
34
  end
21
- File.unlink(@parent[:path])
22
35
  end
23
36
  Dir.chdir(File.dirname(@parent[:path])) do
24
- unless FileTest.exists?(target)
25
- self.debug "Not linking to non-existent '%s'" % target
26
- :nochange # Grrr, can't return
27
- else
28
- Puppet::Util.asuser(@parent.asuser()) do
29
- mode = @parent.should(:mode)
30
- if mode
31
- Puppet::Util.withumask(000) do
32
- File.symlink(target, @parent[:path])
33
- end
34
- else
37
+ Puppet::Util.asuser(@parent.asuser()) do
38
+ mode = @parent.should(:mode)
39
+ if mode
40
+ Puppet::Util.withumask(000) do
35
41
  File.symlink(target, @parent[:path])
36
42
  end
43
+ else
44
+ File.symlink(target, @parent[:path])
37
45
  end
38
-
39
- :link_created
40
46
  end
47
+
48
+ :link_created
41
49
  end
42
50
  end
43
51
 
@@ -78,4 +86,4 @@ module Puppet
78
86
  end
79
87
  end
80
88
 
81
- # $Id: target.rb 1125 2006-04-20 19:38:48Z luke $
89
+ # $Id: target.rb 1303 2006-06-20 01:34:24Z luke $
@@ -2,8 +2,6 @@ require 'puppet/server/filebucket'
2
2
 
3
3
  module Puppet
4
4
  newtype(:filebucket) do
5
- attr_reader :bucket
6
-
7
5
  @doc = "A repository for backing up files. If no filebucket is
8
6
  defined, then files will be backed up in their current directory,
9
7
  but the filebucket can be either a host- or site-global repository
@@ -16,7 +14,20 @@ module Puppet
16
14
  accidentally removed files (e.g., you look in the log for the md5
17
15
  sum and retrieve the file with that sum from the filebucket), but
18
16
  when transactions are fully supported filebuckets will be used to
19
- undo transactions."
17
+ undo transactions.
18
+
19
+ You will normally want to define a single filebucket for your
20
+ whole network and then use that as the default backup location:
21
+
22
+ # Define the bucket
23
+ filebucket { main: server => puppet }
24
+
25
+ # Specify it as the default target
26
+ File { backup => main }
27
+
28
+ Puppetmaster servers create a filebucket by default, so this will
29
+ work in a default configuration.
30
+ "
20
31
 
21
32
  @states = []
22
33
 
@@ -42,6 +53,8 @@ module Puppet
42
53
  desc "The path to the local filebucket. If this is
43
54
  not specified, then the bucket is remote and *server* must be
44
55
  specified."
56
+
57
+ defaultto { Puppet[:bucketdir] }
45
58
  end
46
59
 
47
60
  # get the actual filebucket object
@@ -57,9 +70,15 @@ module Puppet
57
70
  self.collect do |obj| obj.name end
58
71
  end
59
72
 
60
- def initialize(hash)
61
- super
73
+ def bucket
74
+ unless defined? @bucket
75
+ mkbucket()
76
+ end
77
+
78
+ @bucket
79
+ end
62
80
 
81
+ def mkbucket
63
82
  if self[:server]
64
83
  begin
65
84
  @bucket = Puppet::Client::Dipper.new(
@@ -91,4 +110,4 @@ module Puppet
91
110
  end
92
111
  end
93
112
 
94
- # $Id: pfilebucket.rb 1124 2006-04-20 07:00:10Z luke $
113
+ # $Id: pfilebucket.rb 1373 2006-07-06 04:39:59Z luke $
@@ -16,7 +16,7 @@ module Puppet
16
16
  Thus, it behooves you to use wider scheduling (e.g., over a couple of
17
17
  hours) combined with periods and repetitions. For instance, if you
18
18
  wanted to restrict certain elements to only running once, between
19
- the hours of two and 4 AM, then you would use this schedule::
19
+ the hours of two and 4 AM, then you would use this schedule:
20
20
 
21
21
  schedule { maint:
22
22
  range => \"2 - 4\",
@@ -33,7 +33,7 @@ module Puppet
33
33
  Puppet automatically creates a schedule for each valid period with the
34
34
  same name as that period (e.g., hourly and daily). Additionally,
35
35
  a schedule named *puppet* is created and used as the default,
36
- with the following attributes::
36
+ with the following attributes:
37
37
 
38
38
  schedule { puppet:
39
39
  period => hourly,
@@ -47,7 +47,7 @@ module Puppet
47
47
 
48
48
  newparam(:name) do
49
49
  desc "The name of the schedule. This name is used to retrieve the
50
- schedule when assigning it to an object::
50
+ schedule when assigning it to an object:
51
51
 
52
52
  schedule { daily:
53
53
  period => daily,
@@ -67,7 +67,7 @@ module Puppet
67
67
  is always a range within a 24 hour period, and hours must be
68
68
  specified in numbers between 0 and 23, inclusive. Minutes and
69
69
  seconds can be provided, using the normal colon as a separator.
70
- For instance::
70
+ For instance:
71
71
 
72
72
  schedule { maintenance:
73
73
  range => \"1:30 - 4:30\"
@@ -200,7 +200,7 @@ module Puppet
200
200
  If the provided periods are not sufficient, you can provide a
201
201
  value to the *repeat* attribute, which will cause Puppet to
202
202
  schedule the affected elements evenly in the period the
203
- specified number of times. Take this schedule::
203
+ specified number of times. Take this schedule:
204
204
 
205
205
  schedule { veryoften:
206
206
  period => hourly,
@@ -342,4 +342,4 @@ module Puppet
342
342
  end
343
343
  end
344
344
 
345
- # $Id: schedule.rb 1125 2006-04-20 19:38:48Z luke $
345
+ # $Id: schedule.rb 1300 2006-06-19 19:12:54Z luke $
@@ -29,7 +29,7 @@ module Puppet
29
29
  newvalue(:true) do
30
30
  unless @parent.respond_to?(:enable)
31
31
  raise Puppet::Error, "Service %s does not support enabling" %
32
- self.name
32
+ @parent.name
33
33
  end
34
34
  @parent.enable
35
35
  end
@@ -37,7 +37,7 @@ module Puppet
37
37
  newvalue(:false) do
38
38
  unless @parent.respond_to?(:disable)
39
39
  raise Puppet::Error, "Service %s does not support enabling" %
40
- self.name
40
+ @parent.name
41
41
  end
42
42
  @parent.disable
43
43
  end
@@ -45,7 +45,7 @@ module Puppet
45
45
  def retrieve
46
46
  unless @parent.respond_to?(:enabled?)
47
47
  raise Puppet::Error, "Service %s does not support enabling" %
48
- self.name
48
+ @parent.name
49
49
  end
50
50
  @is = @parent.enabled?
51
51
  end
@@ -154,11 +154,11 @@ module Puppet
154
154
  sense to set this parameter, as the default is based on
155
155
  the builtin service facilities. The service types available are:
156
156
 
157
- * ``base``: You must specify everything.
158
- * ``init``: Assumes ``start`` and ``stop`` commands exist, but you
157
+ * **base**: You must specify everything.
158
+ * **init**: Assumes ``start`` and ``stop`` commands exist, but you
159
159
  must specify everything else.
160
- * ``debian``: Debian's own specific version of ``init``.
161
- * ``smf``: Solaris 10's new Service Management Facility.
160
+ * **debian**: Debian's own specific version of ``init``.
161
+ * **smf**: Solaris 10's new Service Management Facility.
162
162
  "
163
163
 
164
164
  defaultto { @parent.class.defaulttype }
@@ -219,11 +219,13 @@ module Puppet
219
219
  if FileTest.directory?(path)
220
220
  next
221
221
  end
222
- unless FileTest.directory?(path)
223
- @parent.info("Search path %s is not a directory" % [path])
224
- end
225
- unless FileTest.exists?(path)
226
- @parent.info("Search path %s does not exist" % [path])
222
+ if FileTest.exists?(path)
223
+ unless FileTest.directory?(path)
224
+ @parent.debug "Search path %s is not a directory" %
225
+ [path]
226
+ end
227
+ else
228
+ @parent.debug("Search path %s does not exist" % [path])
227
229
  end
228
230
  paths.delete(path)
229
231
  end
@@ -242,7 +244,10 @@ module Puppet
242
244
  of a service, then the service name will be used instead.
243
245
 
244
246
  The pattern can be a simple string or any legal Ruby pattern."
245
- defaultto { @parent[:name] }
247
+
248
+ defaultto {
249
+ @parent[:binary] || @parent[:name]
250
+ }
246
251
  end
247
252
  newparam(:restart) do
248
253
  desc "Specify a *restart* command manually. If left
@@ -374,6 +379,9 @@ module Puppet
374
379
 
375
380
  mod.module_eval(&block)
376
381
 
382
+ # Extend the service type with the util stuff
383
+ mod.send(:include, Puppet::Util)
384
+
377
385
  #unless mod.respond_to? :list
378
386
  # Puppet.debug "Service type %s has no list method" % name
379
387
  #end
@@ -454,6 +462,7 @@ module Puppet
454
462
  )
455
463
  end
456
464
  regex = Regexp.new(self[:pattern])
465
+ self.debug "Executing '#{ps}'"
457
466
  IO.popen(ps) { |table|
458
467
  table.each { |line|
459
468
  if regex.match(line)
@@ -519,6 +528,7 @@ module Puppet
519
528
  return :stopped
520
529
  end
521
530
  elsif pid = self.getpid
531
+ self.debug "PID is %s" % pid
522
532
  return :running
523
533
  else
524
534
  return :stopped
@@ -566,4 +576,4 @@ require 'puppet/type/service/debian'
566
576
  require 'puppet/type/service/redhat'
567
577
  require 'puppet/type/service/smf'
568
578
 
569
- # $Id: service.rb 1125 2006-04-20 19:38:48Z luke $
579
+ # $Id: service.rb 1295 2006-06-17 02:04:50Z luke $