puppet 0.25.4 → 0.25.5

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 (169) hide show
  1. data/CHANGELOG +679 -23
  2. data/LICENSE +2 -2
  3. data/README +2 -2
  4. data/README.queueing +1 -1
  5. data/README.rst +2 -2
  6. data/Rakefile +4 -2
  7. data/bin/filebucket +2 -2
  8. data/bin/pi +1 -1
  9. data/bin/puppet +2 -2
  10. data/bin/puppetca +2 -2
  11. data/bin/puppetd +5 -4
  12. data/bin/puppetdoc +4 -4
  13. data/bin/puppetmasterd +2 -2
  14. data/bin/puppetqd +2 -2
  15. data/bin/puppetrun +2 -2
  16. data/bin/ralsh +2 -2
  17. data/conf/epm.list +2 -2
  18. data/conf/gentoo/puppet/puppet.conf +0 -4
  19. data/conf/osx/PackageInfo.plist +1 -1
  20. data/conf/redhat/logrotate +1 -0
  21. data/conf/redhat/puppet.conf +0 -4
  22. data/conf/redhat/puppet.spec +16 -10
  23. data/conf/solaris/pkginfo +2 -2
  24. data/conf/solaris/smf/puppetd.xml +3 -3
  25. data/conf/solaris/smf/puppetmasterd.xml +3 -3
  26. data/conf/solaris/smf/svc-puppetd +1 -1
  27. data/conf/solaris/smf/svc-puppetmasterd +1 -1
  28. data/conf/suse/puppet.spec +16 -14
  29. data/conf/suse/puppet.suse.patch +16 -0
  30. data/examples/etc/puppet/fileserver.conf +5 -5
  31. data/examples/modules/sample-module/README.txt +3 -3
  32. data/examples/modules/sample-module/lib/puppet/parser/functions/hostname_to_dn.rb +1 -1
  33. data/ext/extlookup.rb +1 -1
  34. data/ext/nagios/check_puppet.rb +1 -1
  35. data/ext/nagios/naggen +2 -2
  36. data/ext/puppet-test +2 -2
  37. data/ext/puppetlast +1 -1
  38. data/ext/puppetstoredconfigclean.rb +1 -1
  39. data/ext/regexp_nodes/regexp_nodes.rb +4 -4
  40. data/ext/vim/syntax/puppet.vim +5 -3
  41. data/install.rb +11 -9
  42. data/lib/puppet.rb +1 -1
  43. data/lib/puppet/application/puppetd.rb +5 -4
  44. data/lib/puppet/configurer.rb +38 -31
  45. data/lib/puppet/defaults.rb +18 -13
  46. data/lib/puppet/file_serving/fileset.rb +2 -2
  47. data/lib/puppet/file_serving/terminus_helper.rb +1 -0
  48. data/lib/puppet/indirector/indirection.rb +20 -13
  49. data/lib/puppet/network/authstore.rb +3 -3
  50. data/lib/puppet/network/format_handler.rb +1 -1
  51. data/lib/puppet/network/handler/fileserver.rb +2 -2
  52. data/lib/puppet/network/handler/master.rb +1 -1
  53. data/lib/puppet/network/http_pool.rb +0 -2
  54. data/lib/puppet/network/http_server/webrick.rb +1 -1
  55. data/lib/puppet/parser/ast/casestatement.rb +4 -4
  56. data/lib/puppet/parser/ast/ifstatement.rb +2 -1
  57. data/lib/puppet/parser/ast/leaf.rb +1 -0
  58. data/lib/puppet/parser/ast/selector.rb +2 -3
  59. data/lib/puppet/parser/functions/generate.rb +3 -5
  60. data/lib/puppet/parser/functions/require.rb +8 -1
  61. data/lib/puppet/parser/functions/template.rb +1 -1
  62. data/lib/puppet/parser/lexer.rb +1 -7
  63. data/lib/puppet/parser/resource.rb +10 -4
  64. data/lib/puppet/parser/scope.rb +61 -9
  65. data/lib/puppet/provider/augeas/augeas.rb +23 -7
  66. data/lib/puppet/provider/macauthorization/macauthorization.rb +1 -1
  67. data/lib/puppet/provider/maillist/mailman.rb +2 -2
  68. data/lib/puppet/provider/package/portage.rb +2 -2
  69. data/lib/puppet/provider/service/debian.rb +2 -2
  70. data/lib/puppet/provider/service/redhat.rb +1 -1
  71. data/lib/puppet/provider/service/smf.rb +4 -1
  72. data/lib/puppet/provider/ssh_authorized_key/parsed.rb +9 -29
  73. data/lib/puppet/provider/user/user_role_add.rb +1 -1
  74. data/lib/puppet/reference/configuration.rb +1 -1
  75. data/lib/puppet/reference/providers.rb +1 -1
  76. data/lib/puppet/reports/tagmail.rb +1 -0
  77. data/lib/puppet/resource/catalog.rb +1 -8
  78. data/lib/puppet/simple_graph.rb +37 -12
  79. data/lib/puppet/ssl/certificate.rb +2 -3
  80. data/lib/puppet/ssl/certificate_authority.rb +1 -1
  81. data/lib/puppet/ssl/host.rb +19 -12
  82. data/lib/puppet/sslcertificates/ca.rb +5 -6
  83. data/lib/puppet/transaction.rb +11 -15
  84. data/lib/puppet/type/augeas.rb +2 -1
  85. data/lib/puppet/type/exec.rb +1 -1
  86. data/lib/puppet/type/file.rb +9 -2
  87. data/lib/puppet/type/file/checksum.rb +2 -1
  88. data/lib/puppet/type/file/source.rb +4 -4
  89. data/lib/puppet/type/maillist.rb +10 -0
  90. data/lib/puppet/type/mount.rb +5 -3
  91. data/lib/puppet/type/tidy.rb +36 -30
  92. data/lib/puppet/util/autoload.rb +2 -2
  93. data/lib/puppet/util/checksums.rb +5 -0
  94. data/lib/puppet/util/monkey_patches.rb +38 -0
  95. data/lib/puppet/util/nagios_maker.rb +1 -1
  96. data/lib/puppet/util/settings.rb +14 -4
  97. data/lib/puppet/util/suidmanager.rb +26 -2
  98. data/lib/puppet/util/zaml.rb +318 -0
  99. data/man/{man8/puppet.conf.8 → man5/puppet.conf.5} +594 -899
  100. data/man/man8/filebucket.8 +31 -45
  101. data/man/man8/pi.8 +16 -22
  102. data/man/man8/puppet.8 +26 -36
  103. data/man/man8/puppetca.8 +38 -51
  104. data/man/man8/puppetd.8 +48 -64
  105. data/man/man8/puppetdoc.8 +37 -48
  106. data/man/man8/puppetmasterd.8 +24 -32
  107. data/man/man8/puppetqd.8 +22 -27
  108. data/man/man8/puppetrun.8 +46 -58
  109. data/man/man8/ralsh.8 +43 -48
  110. data/spec/integration/bin/puppetmasterd.rb +20 -9
  111. data/spec/integration/defaults.rb +4 -0
  112. data/spec/integration/indirector/certificate/rest.rb +0 -1
  113. data/spec/integration/indirector/certificate_request/rest.rb +0 -1
  114. data/spec/integration/indirector/certificate_revocation_list/rest.rb +0 -1
  115. data/spec/integration/indirector/report/rest.rb +0 -1
  116. data/spec/integration/indirector/rest.rb +0 -1
  117. data/spec/integration/parser/functions/require.rb +18 -1
  118. data/spec/unit/application/filebucket.rb +2 -2
  119. data/spec/unit/application/puppetd.rb +4 -5
  120. data/spec/unit/configurer.rb +46 -8
  121. data/spec/unit/file_serving/fileset.rb +6 -0
  122. data/spec/unit/file_serving/terminus_helper.rb +10 -0
  123. data/spec/unit/indirector/indirection.rb +17 -28
  124. data/spec/unit/network/format_handler.rb +3 -2
  125. data/spec/unit/network/http_pool.rb +9 -17
  126. data/spec/unit/parser/ast/casestatement.rb +4 -12
  127. data/spec/unit/parser/ast/ifstatement.rb +2 -1
  128. data/spec/unit/parser/ast/leaf.rb +15 -2
  129. data/spec/unit/parser/ast/selector.rb +4 -12
  130. data/spec/unit/parser/functions/generate.rb +41 -0
  131. data/spec/unit/parser/functions/require.rb +23 -2
  132. data/spec/unit/parser/resource.rb +18 -0
  133. data/spec/unit/parser/scope.rb +94 -3
  134. data/spec/unit/provider/augeas/augeas.rb +27 -3
  135. data/spec/unit/provider/ssh_authorized_key/parsed.rb +30 -19
  136. data/spec/unit/resource/catalog.rb +16 -39
  137. data/spec/unit/simple_graph.rb +14 -0
  138. data/spec/unit/ssl/host.rb +55 -17
  139. data/spec/unit/type/file.rb +43 -11
  140. data/spec/unit/type/file/checksum.rb +28 -0
  141. data/spec/unit/type/tidy.rb +30 -1
  142. data/spec/unit/util/autoload.rb +2 -1
  143. data/spec/unit/util/checksums.rb +7 -1
  144. data/spec/unit/util/settings.rb +39 -2
  145. data/spec/unit/util/zaml.rb +38 -0
  146. data/tasks/rake/changelog.rake +1 -1
  147. data/tasks/rake/gem.rake +3 -3
  148. data/tasks/rake/git_workflow.rake +1 -1
  149. data/tasks/rake/sign.rake +1 -1
  150. data/tasks/rake/yard.rake +11 -0
  151. data/test/certmgr/certmgr.rb +1 -1
  152. data/test/data/providers/ssh_authorized_key/parsed/authorized_keys +1 -1
  153. data/test/lib/puppettest/support/utils.rb +2 -1
  154. data/test/network/handler/ca.rb +4 -4
  155. data/test/network/handler/fileserver.rb +15 -9
  156. data/test/other/transactions.rb +1 -6
  157. data/test/puppet/tc_suidmanager.rb +7 -2
  158. data/test/ral/providers/host/parsed.rb +6 -6
  159. data/test/ral/providers/package.rb +4 -0
  160. data/test/ral/providers/sshkey/parsed.rb +5 -5
  161. data/test/ral/type/file.rb +0 -21
  162. data/test/ral/type/host.rb +4 -4
  163. data/test/ral/type/resources.rb +0 -78
  164. data/test/ral/type/sshkey.rb +2 -2
  165. data/test/test +1 -1
  166. data/test/util/settings.rb +6 -6
  167. metadata +1065 -1050
  168. data/test/executables/puppetmodule.rb +0 -55
  169. data/test/ral/providers/service/debian.rb +0 -58
@@ -152,14 +152,6 @@ class Transaction
152
152
  }.uniq
153
153
  end
154
154
 
155
- # Do any necessary cleanup. If we don't get rid of the graphs, the
156
- # contained resources might never get cleaned up.
157
- def cleanup
158
- if defined? @generated
159
- catalog.remove_resource(*@generated)
160
- end
161
- end
162
-
163
155
  # Copy an important relationships from the parent to the newly-generated
164
156
  # child resource.
165
157
  def make_parent_child_relationship(resource, children)
@@ -215,14 +207,18 @@ class Transaction
215
207
  # Collect the targets of any subscriptions to those events. We pass
216
208
  # the parent resource in so it will override the source in the events,
217
209
  # since eval_generated children can't have direct relationships.
218
- relationship_graph.matching_edges(events, resource).each do |orig_edge|
219
- # We have to dup the label here, else we modify the original edge label,
220
- # which affects whether a given event will match on the next run, which is,
221
- # of course, bad.
222
- edge = orig_edge.class.new(orig_edge.source, orig_edge.target, orig_edge.label)
223
- edge.event = events.collect { |e| e.name }
224
- set_trigger(edge)
210
+ duration = thinmark do
211
+ b = relationship_graph.matching_edges(events, resource)
212
+ b.each do |orig_edge|
213
+ # We have to dup the label here, else we modify the original edge label,
214
+ # which affects whether a given event will match on the next run, which is,
215
+ # of course, bad.
216
+ edge = orig_edge.class.new(orig_edge.source, orig_edge.target, orig_edge.label)
217
+ edge.event = events.collect { |e| e.name }
218
+ set_trigger(edge)
219
+ end
225
220
  end
221
+ Puppet.debug("Time for triggering #{events.size} events to edges: #{duration}") if events.size > 0 and duration > 0
226
222
 
227
223
  # And return the events for collection
228
224
  events
@@ -71,6 +71,7 @@ Puppet::Type.newtype(:augeas) do
71
71
  get [AUGEAS_PATH] [COMPARATOR] [STRING]
72
72
  match [MATCH_PATH] size [COMPARATOR] [INT]
73
73
  match [MATCH_PATH] include [STRING]
74
+ match [MATCH_PATH] not_include [STRING]
74
75
  match [MATCH_PATH] == [AN_ARRAY]
75
76
  match [MATCH_PATH] != [AN_ARRAY]
76
77
 
@@ -144,7 +145,7 @@ Puppet::Type.newtype(:augeas) do
144
145
  end
145
146
 
146
147
  # if the onlyif resource is provided, then the value is parsed.
147
- # a return value of 0 will stop exection becuase it matches the
148
+ # a return value of 0 will stop exection because it matches the
148
149
  # default value.
149
150
  def retrieve
150
151
  if @resource.provider.need_to_run?()
@@ -52,7 +52,7 @@ module Puppet
52
52
  in the short term, it is highly recommended to migrate work from ``exec``
53
53
  to native Puppet types as quickly as possible. If you find that
54
54
  you are doing a lot of work with ``exec``, please at least notify
55
- us at Reductive Labs what you are doing, and hopefully we can work with
55
+ us at Puppet Labs what you are doing, and hopefully we can work with
56
56
  you to get a native resource type for the work you are doing."
57
57
 
58
58
  require 'open3'
@@ -22,7 +22,7 @@ module Puppet
22
22
 
23
23
  If you find that you are often copying files in from a central
24
24
  location, rather than using native resources, please contact
25
- Reductive Labs and we can hopefully work with you to develop a
25
+ Puppet Labs and we can hopefully work with you to develop a
26
26
  native resource to support what you are doing."
27
27
 
28
28
  newparam(:path) do
@@ -592,7 +592,14 @@ module Puppet
592
592
  end
593
593
 
594
594
  def perform_recursion(path)
595
- Puppet::FileServing::Metadata.search(path, :links => self[:links], :recurse => (self[:recurse] == :remote ? true : self[:recurse]), :recurselimit => self[:recurselimit], :ignore => self[:ignore])
595
+ params = {
596
+ :links => self[:links],
597
+ :recurse => (self[:recurse] == :remote ? true : self[:recurse]),
598
+ :recurselimit => self[:recurselimit],
599
+ :ignore => self[:ignore]
600
+ }
601
+ params[:checksum_type] = self[:checksum] if self[:checksum] == :none
602
+ Puppet::FileServing::Metadata.search(path, params)
596
603
  end
597
604
 
598
605
  # Remove any existing data. This is only used when dealing with
@@ -23,7 +23,7 @@ Puppet::Type.type(:file).newproperty(:checksum) do
23
23
 
24
24
  @unmanaged = true
25
25
 
26
- @validtypes = %w{md5 md5lite timestamp mtime time}
26
+ @validtypes = %w{md5 md5lite timestamp mtime time none}
27
27
 
28
28
  def self.validtype?(type)
29
29
  @validtypes.include?(type)
@@ -52,6 +52,7 @@ Puppet::Type.type(:file).newproperty(:checksum) do
52
52
  cache(type, sum)
53
53
  return type
54
54
  else
55
+ return :none if value.nil? or value.to_s == "" or value.to_s == "none"
55
56
  if FileTest.directory?(@resource[:path])
56
57
  return :time
57
58
  elsif @resource[:source] and value.to_s != "md5"
@@ -24,7 +24,7 @@ module Puppet
24
24
 
25
25
  class sendmail {
26
26
  file { \"/etc/mail/sendmail.cf\":
27
- source => \"puppet://server/module/sendmail.cf\"
27
+ source => \"puppet://server/modules/module_name/sendmail.cf\"
28
28
  }
29
29
  }
30
30
 
@@ -51,9 +51,9 @@ module Puppet
51
51
 
52
52
  file { \"/path/to/my/file\":
53
53
  source => [
54
- \"/nfs/files/file.$host\",
55
- \"/nfs/files/file.$operatingsystem\",
56
- \"/nfs/files/file\"
54
+ \"/modules/nfs/files/file.$host\",
55
+ \"/modules/nfs/files/file.$operatingsystem\",
56
+ \"/modules/nfs/files/file\"
57
57
  ]
58
58
  }
59
59
 
@@ -9,6 +9,16 @@ module Puppet
9
9
  newvalue(:purged) do
10
10
  provider.purge
11
11
  end
12
+
13
+ def change_to_s(current_value, newvalue)
14
+ return "Purged #{resource}" if newvalue == :purged
15
+ super
16
+ end
17
+
18
+ def insync?(is)
19
+ return true if is == :absent && should == :purged
20
+ super
21
+ end
12
22
  end
13
23
 
14
24
  newparam(:name, :namevar => true) do
@@ -140,8 +140,9 @@ module Puppet
140
140
  end
141
141
 
142
142
  newproperty(:dump) do
143
- desc "Whether to dump the mount. Not all platforms
144
- + support this. Valid values are ``1`` or ``0``. or ``2`` on FreeBSD, Default is ``0``."
143
+ desc "Whether to dump the mount. Not all platform support this.
144
+ Valid values are ``1`` or ``0``. or ``2`` on FreeBSD, Default is ``0``."
145
+
145
146
  if Facter["operatingsystem"].value == "FreeBSD"
146
147
  newvalue(%r{(0|1|2)})
147
148
  else
@@ -193,7 +194,8 @@ module Puppet
193
194
  newvalues(:true, :false)
194
195
  defaultto do
195
196
  case Facter.value(:operatingsystem)
196
- when "FreeBSD"; false
197
+ when "FreeBSD", "Darwin"
198
+ false
197
199
  else
198
200
  true
199
201
  end
@@ -19,6 +19,28 @@ Puppet::Type.newtype(:tidy) do
19
19
  isnamevar
20
20
  end
21
21
 
22
+ newparam(:recurse) do
23
+ desc "If target is a directory, recursively descend
24
+ into the directory looking for files to tidy."
25
+
26
+ newvalues(:true, :false, :inf, /^[0-9]+$/)
27
+
28
+ # Replace the validation so that we allow numbers in
29
+ # addition to string representations of them.
30
+ validate { |arg| }
31
+ munge do |value|
32
+ newval = super(value)
33
+ case newval
34
+ when :true, :inf; true
35
+ when :false; false
36
+ when Integer, Fixnum, Bignum; value
37
+ when /^\d+$/; Integer(value)
38
+ else
39
+ raise ArgumentError, "Invalid recurse value %s" % value.inspect
40
+ end
41
+ end
42
+ end
43
+
22
44
  newparam(:matches) do
23
45
  desc "One or more (shell type) file glob patterns, which restrict
24
46
  the list of files to be tidied to those whose basenames match
@@ -29,22 +51,28 @@ Puppet::Type.newtype(:tidy) do
29
51
 
30
52
  tidy { \"/tmp\":
31
53
  age => \"1w\",
32
- recurse => false,
54
+ recurse => 1,
33
55
  matches => [ \"[0-9]pub*.tmp\", \"*.temp\", \"tmpfile?\" ]
34
56
  }
35
57
 
36
58
  This removes files from \/tmp if they are one week old or older,
37
59
  are not in a subdirectory and match one of the shell globs given.
38
60
 
39
- Note that the patterns are matched against the
40
- basename of each file -- that is, your glob patterns should not
41
- have any '/' characters in them, since you are only specifying
42
- against the last bit of the file."
61
+ Note that the patterns are matched against the basename of each
62
+ file -- that is, your glob patterns should not have any '/'
63
+ characters in them, since you are only specifying against the last
64
+ bit of the file.
65
+
66
+ Finally, note that you must now specify a non-zero/non-false value
67
+ for recurse if matches is used, as matches only apply to files found
68
+ by recursion (there's no reason to use static patterns match against
69
+ a statically determined path). Requiering explicit recursion clears
70
+ up a common source of confusion."
43
71
 
44
72
  # Make sure we convert to an array.
45
73
  munge do |value|
46
- value = [value] unless value.is_a?(Array)
47
- value
74
+ fail "Tidy can't use matches with recurse 0, false, or undef" if "#{@resource[:recurse]}" =~ /^(0|false|)$/
75
+ [value].flatten
48
76
  end
49
77
 
50
78
  # Does a given path match our glob patterns, if any? Return true
@@ -139,7 +167,7 @@ Puppet::Type.newtype(:tidy) do
139
167
  end
140
168
 
141
169
  def tidy?(path, stat)
142
- if stat.size > value
170
+ if stat.size >= value
143
171
  return true
144
172
  else
145
173
  return false
@@ -170,28 +198,6 @@ Puppet::Type.newtype(:tidy) do
170
198
  defaultto :atime
171
199
  end
172
200
 
173
- newparam(:recurse) do
174
- desc "If target is a directory, recursively descend
175
- into the directory looking for files to tidy."
176
-
177
- newvalues(:true, :false, :inf, /^[0-9]+$/)
178
-
179
- # Replace the validation so that we allow numbers in
180
- # addition to string representations of them.
181
- validate { |arg| }
182
- munge do |value|
183
- newval = super(value)
184
- case newval
185
- when :true, :inf; true
186
- when :false; false
187
- when Integer, Fixnum, Bignum; value
188
- when /^\d+$/; Integer(value)
189
- else
190
- raise ArgumentError, "Invalid recurse value %s" % value.inspect
191
- end
192
- end
193
- end
194
-
195
201
  newparam(:rmdirs, :boolean => true) do
196
202
  desc "Tidy directories in addition to files; that is, remove
197
203
  directories whose age is older than the specified criteria.
@@ -156,7 +156,7 @@ class Puppet::Util::Autoload
156
156
  end
157
157
  end
158
158
 
159
- def search_directories
160
- [module_directories, Puppet[:libdir], $:].flatten
159
+ def search_directories(dummy_argument=:work_arround_for_ruby_GC_bug)
160
+ [module_directories, Puppet[:libdir].split(File::PATH_SEPARATOR), $:].flatten
161
161
  end
162
162
  end
@@ -68,6 +68,11 @@ module Puppet::Util::Checksums
68
68
  File.stat(filename).send(:ctime)
69
69
  end
70
70
 
71
+ # Return a "no checksum"
72
+ def none_file(filename)
73
+ ""
74
+ end
75
+
71
76
  private
72
77
 
73
78
  # Perform an incremental checksum on a file.
@@ -1,3 +1,5 @@
1
+ Process.maxgroups = 1024
2
+
1
3
  module RDoc
2
4
  def self.caller(skip=nil)
3
5
  in_gem_wrapper = false
@@ -6,3 +8,39 @@ module RDoc
6
8
  }
7
9
  end
8
10
  end
11
+
12
+
13
+ require "yaml"
14
+ require "puppet/util/zaml.rb"
15
+ class Symbol
16
+ def to_zaml(z)
17
+ z.emit("!ruby/sym ")
18
+ to_s.to_zaml(z)
19
+ end
20
+ end
21
+
22
+ [Object, Exception, Integer, Struct, Date, Time, Range, Regexp, Hash, Array, Float, String, FalseClass, TrueClass, Symbol, NilClass, Class].each { |cls|
23
+ cls.class_eval do
24
+ def to_yaml
25
+ ZAML.dump(self)
26
+ end
27
+ end
28
+ }
29
+
30
+ def YAML.dump(*args)
31
+ ZAML.dump(*args)
32
+ end
33
+
34
+ #
35
+ # Workaround for bug in MRI 1.8.7, see
36
+ # http://redmine.ruby-lang.org/issues/show/2708
37
+ # for details
38
+ #
39
+ if RUBY_VERSION == '1.8.7'
40
+ class NilClass
41
+ def closed?
42
+ true
43
+ end
44
+ end
45
+ end
46
+
@@ -55,7 +55,7 @@ module Puppet::Util::NagiosMaker
55
55
  You can purge Nagios resources using the ``resources`` type, but *only*
56
56
  in the default file locations. This is an architectural limitation.
57
57
 
58
- .. _naginator: http://projects.reductivelabs.com/projects/naginator
58
+ .. _naginator: http://projects.puppetlabs.com/projects/naginator
59
59
  "
60
60
  end
61
61
  end
@@ -67,7 +67,7 @@ class Puppet::Util::Settings
67
67
  unsafe_clear(exceptcli)
68
68
  end
69
69
  end
70
-
70
+
71
71
  # Remove all set values, potentially skipping cli values.
72
72
  def unsafe_clear(exceptcli = false)
73
73
  @values.each do |name, values|
@@ -147,6 +147,7 @@ class Puppet::Util::Settings
147
147
  @cache.clear
148
148
  value = munge_value(value) if value
149
149
  str = opt.sub(/^--/,'')
150
+
150
151
  bool = true
151
152
  newstr = str.sub(/^no-/, '')
152
153
  if newstr != str
@@ -155,13 +156,22 @@ class Puppet::Util::Settings
155
156
  end
156
157
  str = str.intern
157
158
 
158
- if value == "" or value.nil?
159
- value = bool
159
+ if @config[str].is_a?(Puppet::Util::Settings::BooleanSetting)
160
+ if value == "" or value.nil?
161
+ value = bool
162
+ end
160
163
  end
161
164
 
162
165
  set_value(str, value, :cli)
163
166
  end
164
167
 
168
+ def without_noop
169
+ old_noop = value(:noop,:cli) and set_value(:noop, false, :cli) if valid?(:noop)
170
+ yield
171
+ ensure
172
+ set_value(:noop, old_noop, :cli) if valid?(:noop)
173
+ end
174
+
165
175
  def include?(name)
166
176
  name = name.intern if name.is_a? String
167
177
  @config.include?(name)
@@ -675,7 +685,7 @@ Generated on #{Time.now}.
675
685
  end
676
686
  throw :foundval, nil
677
687
  end
678
-
688
+
679
689
  # If we didn't get a value, use the default
680
690
  val = @config[param].default if val.nil?
681
691
 
@@ -1,4 +1,3 @@
1
- require 'facter'
2
1
  require 'puppet/util/warnings'
3
2
  require 'forwardable'
4
3
 
@@ -6,14 +5,39 @@ module Puppet::Util::SUIDManager
6
5
  include Puppet::Util::Warnings
7
6
  extend Forwardable
8
7
 
8
+ # Note groups= is handled specially due to a bug in OS X 10.6
9
9
  to_delegate_to_process = [ :euid=, :euid, :egid=, :egid,
10
- :uid=, :uid, :gid=, :gid, :groups=, :groups ]
10
+ :uid=, :uid, :gid=, :gid, :groups ]
11
11
 
12
12
  to_delegate_to_process.each do |method|
13
13
  def_delegator Process, method
14
14
  module_function method
15
15
  end
16
16
 
17
+ def osx_maj_ver
18
+ return @osx_maj_ver unless @osx_maj_ver.nil?
19
+ require 'facter'
20
+ # 'kernel' is available without explicitly loading all facts
21
+ if Facter.value('kernel') != 'Darwin'
22
+ @osx_maj_ver = false
23
+ return @osx_maj_ver
24
+ end
25
+ # But 'macosx_productversion_major' requires it.
26
+ Facter.loadfacts
27
+ @osx_maj_ver = Facter.value('macosx_productversion_major')
28
+ return @osx_maj_ver
29
+ end
30
+ module_function :osx_maj_ver
31
+
32
+ def groups=(grouplist)
33
+ if osx_maj_ver == '10.6'
34
+ return true
35
+ else
36
+ return Process.groups = grouplist
37
+ end
38
+ end
39
+ module_function :groups=
40
+
17
41
  if Facter['kernel'].value == 'Darwin'
18
42
  # Cannot change real UID on Darwin so we set euid
19
43
  alias :uid :euid