puppet 2.6.4 → 2.6.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 (221) hide show
  1. data/CHANGELOG +147 -0
  2. data/LICENSE +2 -2
  3. data/Rakefile +3 -4
  4. data/lib/puppet.rb +1 -1
  5. data/lib/puppet/application.rb +22 -5
  6. data/lib/puppet/application/apply.rb +2 -18
  7. data/lib/puppet/application/doc.rb +1 -4
  8. data/lib/puppet/application/inspect.rb +178 -0
  9. data/lib/puppet/configurer.rb +9 -11
  10. data/lib/puppet/configurer/plugin_handler.rb +0 -2
  11. data/lib/puppet/defaults.rb +12 -3
  12. data/lib/puppet/external/pson/pure/generator.rb +1 -22
  13. data/lib/puppet/file_bucket/dipper.rb +9 -3
  14. data/lib/puppet/file_bucket/file.rb +14 -94
  15. data/lib/puppet/indirector.rb +4 -0
  16. data/lib/puppet/indirector/catalog/active_record.rb +1 -1
  17. data/lib/puppet/indirector/file_bucket_file/file.rb +64 -75
  18. data/lib/puppet/indirector/indirection.rb +18 -8
  19. data/lib/puppet/indirector/resource/ral.rb +7 -2
  20. data/lib/puppet/indirector/rest.rb +19 -2
  21. data/lib/puppet/network/http/api/v1.rb +3 -0
  22. data/lib/puppet/network/http/handler.rb +16 -1
  23. data/lib/puppet/network/http/rack/rest.rb +1 -3
  24. data/lib/puppet/network/rest_authconfig.rb +4 -12
  25. data/lib/puppet/network/rights.rb +28 -14
  26. data/lib/puppet/parser/ast.rb +4 -0
  27. data/lib/puppet/parser/compiler.rb +18 -3
  28. data/lib/puppet/parser/functions/defined.rb +28 -6
  29. data/lib/puppet/parser/functions/fqdn_rand.rb +6 -3
  30. data/lib/puppet/parser/templatewrapper.rb +1 -0
  31. data/lib/puppet/property.rb +16 -1
  32. data/lib/puppet/property/keyvalue.rb +0 -2
  33. data/lib/puppet/property/list.rb +0 -2
  34. data/lib/puppet/provider/file/posix.rb +1 -3
  35. data/lib/puppet/provider/file/win32.rb +1 -3
  36. data/lib/puppet/provider/maillist/mailman.rb +3 -5
  37. data/lib/puppet/provider/mount.rb +2 -0
  38. data/lib/puppet/provider/nameservice/directoryservice.rb +2 -2
  39. data/lib/puppet/provider/package/freebsd.rb +2 -2
  40. data/lib/puppet/provider/zone/solaris.rb +1 -1
  41. data/lib/puppet/reference/configuration.rb +2 -2
  42. data/lib/puppet/reference/function.rb +4 -0
  43. data/lib/puppet/relationship.rb +4 -0
  44. data/lib/puppet/reports/store.rb +1 -19
  45. data/lib/puppet/resource.rb +11 -2
  46. data/lib/puppet/resource/status.rb +24 -3
  47. data/lib/puppet/resource/type.rb +24 -16
  48. data/lib/puppet/resource/type_collection.rb +4 -1
  49. data/lib/puppet/simple_graph.rb +4 -0
  50. data/lib/puppet/transaction.rb +1 -28
  51. data/lib/puppet/transaction/event.rb +9 -4
  52. data/lib/puppet/transaction/report.rb +42 -22
  53. data/lib/puppet/transaction/resource_harness.rb +99 -71
  54. data/lib/puppet/type.rb +22 -9
  55. data/lib/puppet/type/cron.rb +1 -5
  56. data/lib/puppet/type/exec.rb +4 -34
  57. data/lib/puppet/type/file.rb +19 -26
  58. data/lib/puppet/type/file/checksum.rb +1 -1
  59. data/lib/puppet/type/file/content.rb +2 -1
  60. data/lib/puppet/type/file/ctime.rb +18 -0
  61. data/lib/puppet/type/file/ensure.rb +1 -1
  62. data/lib/puppet/type/file/mode.rb +10 -44
  63. data/lib/puppet/type/file/mtime.rb +17 -0
  64. data/lib/puppet/type/file/owner.rb +1 -1
  65. data/lib/puppet/type/file/source.rb +0 -1
  66. data/lib/puppet/type/file/target.rb +1 -1
  67. data/lib/puppet/type/file/type.rb +5 -12
  68. data/lib/puppet/type/host.rb +1 -1
  69. data/lib/puppet/type/mount.rb +2 -2
  70. data/lib/puppet/type/package.rb +0 -2
  71. data/lib/puppet/type/service.rb +11 -5
  72. data/lib/puppet/type/user.rb +7 -9
  73. data/lib/puppet/type/yumrepo.rb +2 -2
  74. data/lib/puppet/type/zpool.rb +0 -4
  75. data/lib/puppet/util/checksums.rb +24 -1
  76. data/lib/puppet/util/command_line.rb +6 -2
  77. data/lib/puppet/util/command_line/puppet +5 -1
  78. data/lib/puppet/util/command_line/puppetca +2 -2
  79. data/lib/puppet/util/command_line/puppetd +11 -9
  80. data/lib/puppet/util/command_line/puppetdoc +2 -2
  81. data/lib/puppet/util/command_line/puppetmasterd +5 -0
  82. data/lib/puppet/util/log.rb +15 -8
  83. data/lib/puppet/util/log/destinations.rb +2 -0
  84. data/lib/puppet/util/log_paths.rb +1 -1
  85. data/lib/puppet/util/logging.rb +1 -1
  86. data/lib/puppet/util/metric.rb +1 -0
  87. data/lib/puppet/util/reference.rb +1 -10
  88. data/lib/puppet/util/settings.rb +1 -1
  89. data/lib/puppet/util/zaml.rb +30 -31
  90. data/spec/fixtures/unit/provider/mount/mount-output.aix.txt +7 -0
  91. data/spec/integration/application/apply_spec.rb +1 -2
  92. data/spec/integration/defaults_spec.rb +1 -0
  93. data/spec/integration/indirector/catalog/queue_spec.rb +1 -4
  94. data/spec/integration/indirector/report/rest_spec.rb +13 -17
  95. data/spec/integration/network/formats_spec.rb +2 -5
  96. data/spec/integration/network/server/mongrel_spec.rb +1 -2
  97. data/spec/integration/provider/mailalias/aliases_spec.rb +0 -1
  98. data/spec/integration/provider/package_spec.rb +1 -3
  99. data/spec/integration/provider/service/init_spec.rb +3 -9
  100. data/spec/integration/reference/providers_spec.rb +2 -2
  101. data/spec/integration/resource/catalog_spec.rb +1 -2
  102. data/spec/integration/transaction/report_spec.rb +1 -1
  103. data/spec/monkey_patches/alias_should_to_must.rb +2 -0
  104. data/spec/shared_behaviours/file_server_terminus.rb +1 -1
  105. data/spec/shared_behaviours/file_serving.rb +1 -1
  106. data/spec/shared_behaviours/memory_terminus.rb +1 -1
  107. data/spec/spec_helper.rb +8 -6
  108. data/spec/unit/application/agent_spec.rb +1 -0
  109. data/spec/unit/application/apply_spec.rb +7 -7
  110. data/spec/unit/application/doc_spec.rb +2 -2
  111. data/spec/unit/application/filebucket_spec.rb +1 -0
  112. data/spec/unit/application/inspect_spec.rb +278 -0
  113. data/spec/unit/application/kick_spec.rb +1 -3
  114. data/spec/unit/application/master_spec.rb +1 -3
  115. data/spec/unit/application/queue_spec.rb +1 -0
  116. data/spec/unit/application_spec.rb +63 -5
  117. data/spec/unit/configurer/plugin_handler_spec.rb +5 -1
  118. data/spec/unit/configurer_spec.rb +33 -49
  119. data/spec/unit/file_bucket/dipper_spec.rb +69 -77
  120. data/spec/unit/file_bucket/file_spec.rb +12 -127
  121. data/spec/unit/file_serving/fileset_spec.rb +1 -0
  122. data/spec/unit/file_serving/metadata_spec.rb +4 -4
  123. data/spec/unit/indirector/active_record_spec.rb +1 -0
  124. data/spec/unit/indirector/catalog/active_record_spec.rb +29 -13
  125. data/spec/unit/indirector/facts/active_record_spec.rb +2 -3
  126. data/spec/unit/indirector/facts/couch_spec.rb +1 -2
  127. data/spec/unit/indirector/file_bucket_file/file_spec.rb +202 -218
  128. data/spec/unit/indirector/file_server_spec.rb +6 -7
  129. data/spec/unit/indirector/indirection_spec.rb +71 -2
  130. data/spec/unit/indirector/ldap_spec.rb +2 -6
  131. data/spec/unit/indirector/node/active_record_spec.rb +1 -3
  132. data/spec/unit/indirector/queue_spec.rb +1 -3
  133. data/spec/unit/indirector/rest_spec.rb +37 -1
  134. data/spec/unit/indirector/ssl_file_spec.rb +5 -5
  135. data/spec/unit/indirector_spec.rb +6 -1
  136. data/spec/unit/module_spec.rb +1 -3
  137. data/spec/unit/network/formats_spec.rb +2 -5
  138. data/spec/unit/network/http/api/v1_spec.rb +4 -0
  139. data/spec/unit/network/http/compression_spec.rb +1 -3
  140. data/spec/unit/network/http/handler_spec.rb +39 -0
  141. data/spec/unit/network/http/mongrel/rest_spec.rb +1 -2
  142. data/spec/unit/network/http/mongrel_spec.rb +3 -9
  143. data/spec/unit/network/http/rack/rest_spec.rb +1 -3
  144. data/spec/unit/network/http/rack/xmlrpc_spec.rb +2 -3
  145. data/spec/unit/network/http/rack_spec.rb +2 -3
  146. data/spec/unit/network/http/webrick_spec.rb +1 -0
  147. data/spec/unit/network/rest_authconfig_spec.rb +1 -1
  148. data/spec/unit/network/rights_spec.rb +43 -23
  149. data/spec/unit/network/xmlrpc/client_spec.rb +1 -0
  150. data/spec/unit/parameter_spec.rb +1 -2
  151. data/spec/unit/parser/collector_spec.rb +3 -6
  152. data/spec/unit/parser/compiler_spec.rb +90 -5
  153. data/spec/unit/parser/lexer_spec.rb +3 -2
  154. data/spec/unit/parser/templatewrapper_spec.rb +1 -0
  155. data/spec/unit/property/keyvalue_spec.rb +5 -5
  156. data/spec/unit/property/list_spec.rb +7 -7
  157. data/spec/unit/provider/mount/parsed_spec.rb +1 -2
  158. data/spec/unit/provider/mount_spec.rb +8 -0
  159. data/spec/unit/provider/nameservice/directoryservice_spec.rb +38 -0
  160. data/spec/unit/provider/package/freebsd_spec.rb +55 -0
  161. data/spec/unit/provider/service/init_spec.rb +2 -0
  162. data/spec/unit/rails/host_spec.rb +1 -3
  163. data/spec/unit/rails/param_value_spec.rb +2 -3
  164. data/spec/unit/rails/resource_spec.rb +2 -3
  165. data/spec/unit/rails_spec.rb +5 -15
  166. data/spec/unit/relationship_spec.rb +2 -6
  167. data/spec/unit/reports/http_spec.rb +1 -1
  168. data/spec/unit/reports/store_spec.rb +31 -0
  169. data/spec/unit/reports/tagmail_spec.rb +1 -1
  170. data/spec/unit/resource/catalog_spec.rb +2 -6
  171. data/spec/unit/resource/status_spec.rb +53 -3
  172. data/spec/unit/resource/type_collection_spec.rb +0 -8
  173. data/spec/unit/resource/type_spec.rb +50 -4
  174. data/spec/unit/resource_spec.rb +10 -6
  175. data/spec/unit/ssl/certificate_authority/interface_spec.rb +1 -1
  176. data/spec/unit/transaction/event_spec.rb +21 -2
  177. data/spec/unit/transaction/report_spec.rb +91 -35
  178. data/spec/unit/transaction/resource_harness_spec.rb +289 -208
  179. data/spec/unit/transaction_spec.rb +1 -6
  180. data/spec/unit/type/augeas_spec.rb +1 -3
  181. data/spec/unit/type/file/content_spec.rb +63 -10
  182. data/spec/unit/type/file/ctime.rb +35 -0
  183. data/spec/unit/type/file/ensure_spec.rb +8 -7
  184. data/spec/unit/type/file/group_spec.rb +5 -5
  185. data/spec/unit/type/file/mtime.rb +35 -0
  186. data/spec/unit/type/file/owner_spec.rb +7 -7
  187. data/spec/unit/type/file/selinux_spec.rb +2 -2
  188. data/spec/unit/type/file/source_spec.rb +3 -3
  189. data/spec/unit/type/file/type.rb +20 -0
  190. data/spec/unit/type/file_spec.rb +131 -8
  191. data/spec/unit/type/mount_spec.rb +4 -4
  192. data/spec/unit/type/package_spec.rb +3 -3
  193. data/spec/unit/type/ssh_authorized_key_spec.rb +1 -1
  194. data/spec/unit/type/user_spec.rb +31 -3
  195. data/spec/unit/type/zpool_spec.rb +12 -12
  196. data/spec/unit/type_spec.rb +2 -2
  197. data/spec/unit/util/checksums_spec.rb +9 -1
  198. data/spec/unit/util/command_line_spec.rb +29 -0
  199. data/spec/unit/util/log/destinations_spec.rb +13 -0
  200. data/spec/unit/util/log_spec.rb +24 -12
  201. data/spec/unit/util/logging_spec.rb +1 -1
  202. data/spec/unit/util/metric_spec.rb +7 -7
  203. data/spec/unit/util/pson_spec.rb +15 -0
  204. data/spec/unit/util/queue/stomp_spec.rb +2 -6
  205. data/spec/unit/util/settings/file_setting_spec.rb +1 -3
  206. data/spec/unit/util/zaml_spec.rb +51 -0
  207. data/test/language/snippets.rb +3 -0
  208. data/test/lib/puppettest/fileparsing.rb +2 -0
  209. data/test/lib/puppettest/reporttesting.rb +1 -1
  210. data/test/lib/puppettest/support/utils.rb +1 -1
  211. data/test/network/server/mongrel_test.rb +0 -6
  212. data/test/other/report.rb +1 -1
  213. data/test/ral/providers/cron/crontab.rb +4 -1
  214. data/test/ral/type/file.rb +1 -1
  215. data/test/ral/type/filesources.rb +1 -4
  216. metadata +1119 -1113
  217. data/lib/puppet/transaction/change.rb +0 -87
  218. data/spec/Rakefile +0 -91
  219. data/spec/monkey_patches/add_confine_and_runnable_to_rspec_dsl.rb +0 -46
  220. data/spec/spec_specs/runnable_spec.rb +0 -95
  221. data/spec/unit/transaction/change_spec.rb +0 -193
@@ -0,0 +1,18 @@
1
+ module Puppet
2
+ Puppet::Type.type(:file).newproperty(:ctime) do
3
+ desc "A read-only state to check the file ctime."
4
+
5
+ def retrieve
6
+ current_value = :absent
7
+ if stat = @resource.stat(false)
8
+ current_value = stat.ctime
9
+ end
10
+ current_value
11
+ end
12
+
13
+ validate do
14
+ fail "ctime is read-only"
15
+ end
16
+ end
17
+ end
18
+
@@ -66,7 +66,7 @@ module Puppet
66
66
  end
67
67
  if mode
68
68
  Puppet::Util.withumask(000) do
69
- Dir.mkdir(@resource[:path],mode)
69
+ Dir.mkdir(@resource[:path], mode.to_i(8))
70
70
  end
71
71
  else
72
72
  Dir.mkdir(@resource[:path])
@@ -25,60 +25,26 @@ module Puppet
25
25
 
26
26
  @event = :file_changed
27
27
 
28
- # Our modes are octal, so make sure they print correctly. Other
29
- # valid values are symbols, basically
30
- def is_to_s(currentvalue)
31
- case currentvalue
32
- when Integer
33
- return "%o" % currentvalue
34
- when Symbol
35
- return currentvalue
36
- else
37
- raise Puppet::DevError, "Invalid current value for mode: #{currentvalue.inspect}"
38
- end
39
- end
40
-
41
- def should_to_s(newvalue = @should)
42
- case newvalue
43
- when Integer
44
- return "%o" % newvalue
45
- when Symbol
46
- return newvalue
47
- else
48
- raise Puppet::DevError, "Invalid 'should' value for mode: #{newvalue.inspect}"
49
- end
50
- end
51
-
52
28
  munge do |should|
53
- # this is pretty hackish, but i need to make sure the number is in
54
- # octal, yet the number can only be specified as a string right now
55
- value = should
56
- if value.is_a?(String)
57
- unless value =~ /^\d+$/
58
- raise Puppet::Error, "File modes can only be numbers, not #{value.inspect}"
59
- end
60
- # Make sure our number looks like octal.
61
- unless value =~ /^0/
62
- value = "0#{value}"
63
- end
64
- old = value
65
- begin
66
- value = Integer(value)
67
- rescue ArgumentError => detail
68
- raise Puppet::DevError, "Could not convert #{old.inspect} to integer"
29
+ if should.is_a?(String)
30
+ unless should =~ /^[0-7]+$/
31
+ raise Puppet::Error, "File modes can only be octal numbers, not #{should.inspect}"
69
32
  end
33
+ should.to_i(8).to_s(8)
34
+ else
35
+ should.to_s(8)
70
36
  end
71
-
72
- return value
73
37
  end
74
38
 
75
39
  # If we're a directory, we need to be executable for all cases
76
40
  # that are readable. This should probably be selectable, but eh.
77
41
  def dirmask(value)
78
42
  if FileTest.directory?(@resource[:path])
43
+ value = value.to_i(8)
79
44
  value |= 0100 if value & 0400 != 0
80
45
  value |= 010 if value & 040 != 0
81
46
  value |= 01 if value & 04 != 0
47
+ value = value.to_s(8)
82
48
  end
83
49
 
84
50
  value
@@ -101,7 +67,7 @@ module Puppet
101
67
  unless defined?(@fixed)
102
68
  @should &&= @should.collect { |s| self.dirmask(s) }
103
69
  end
104
- return stat.mode & 007777
70
+ return (stat.mode & 007777).to_s(8)
105
71
  else
106
72
  return :absent
107
73
  end
@@ -111,7 +77,7 @@ module Puppet
111
77
  mode = self.should
112
78
 
113
79
  begin
114
- File.chmod(mode, @resource[:path])
80
+ File.chmod(mode.to_i(8), @resource[:path])
115
81
  rescue => detail
116
82
  error = Puppet::Error.new("failed to chmod #{@resource[:path]}: #{detail.message}")
117
83
  error.set_backtrace detail.backtrace
@@ -0,0 +1,17 @@
1
+ module Puppet
2
+ Puppet::Type.type(:file).newproperty(:mtime) do
3
+ desc "A read-only state to check the file mtime."
4
+
5
+ def retrieve
6
+ current_value = :absent
7
+ if stat = @resource.stat(false)
8
+ current_value = stat.mtime
9
+ end
10
+ current_value
11
+ end
12
+
13
+ validate do
14
+ fail "mtime is read-only"
15
+ end
16
+ end
17
+ end
@@ -6,7 +6,7 @@ module Puppet
6
6
  @event = :file_changed
7
7
 
8
8
  def insync?(current)
9
- provider.insync?(current, @should)
9
+ provider.is_owner_insync?(current, @should)
10
10
  end
11
11
 
12
12
  # We want to print names, not numbers
@@ -169,7 +169,6 @@ module Puppet
169
169
  checks.delete(:checksum)
170
170
 
171
171
  resource[:audit] = checks
172
- resource[:checksum] = :md5 unless resource.property(:checksum)
173
172
  end
174
173
 
175
174
  def local?
@@ -14,7 +14,7 @@ module Puppet
14
14
 
15
15
  # Only call mklink if ensure didn't call us in the first place.
16
16
  currentensure = @resource.property(:ensure).retrieve
17
- mklink if @resource.property(:ensure).insync?(currentensure)
17
+ mklink if @resource.property(:ensure).safe_insync?(currentensure)
18
18
  end
19
19
 
20
20
  # Create our link.
@@ -3,23 +3,16 @@ module Puppet
3
3
  require 'etc'
4
4
  desc "A read-only state to check the file type."
5
5
 
6
- #munge do |value|
7
- # raise Puppet::Error, ":type is read-only"
8
- #end
9
-
10
6
  def retrieve
11
- currentvalue = :absent
7
+ current_value = :absent
12
8
  if stat = @resource.stat(false)
13
- currentvalue = stat.ftype
9
+ current_value = stat.ftype
14
10
  end
15
- # so this state is never marked out of sync
16
- @should = [currentvalue]
17
- currentvalue
11
+ current_value
18
12
  end
19
13
 
20
-
21
- def sync
22
- raise Puppet::Error, ":type is read-only"
14
+ validate do
15
+ fail "type is read-only"
23
16
  end
24
17
  end
25
18
  end
@@ -66,7 +66,7 @@ module Puppet
66
66
 
67
67
  newproperty(:target) do
68
68
  desc "The file in which to store service information. Only used by
69
- those providers that write to disk."
69
+ those providers that write to disk. On most systems this defaults to `/etc/hosts`."
70
70
 
71
71
  defaultto { if @resource.class.defaultprovider.ancestors.include?(Puppet::Provider::ParsedFile)
72
72
  @resource.class.defaultprovider.default_target
@@ -89,7 +89,7 @@ module Puppet
89
89
  if prop.name == :ensure
90
90
  false
91
91
  else
92
- ! prop.insync?(currentvalues[prop])
92
+ ! prop.safe_insync?(currentvalues[prop])
93
93
  end
94
94
  end.each { |prop| prop.sync }.length
95
95
  @resource.flush if oos > 0
@@ -200,7 +200,7 @@ module Puppet
200
200
  newvalues(:true, :false)
201
201
  defaultto do
202
202
  case Facter.value(:operatingsystem)
203
- when "FreeBSD", "Darwin"
203
+ when "FreeBSD", "Darwin", "AIX"
204
204
  false
205
205
  else
206
206
  true
@@ -109,8 +109,6 @@ module Puppet
109
109
  # Override the parent method, because we've got all kinds of
110
110
  # funky definitions of 'in sync'.
111
111
  def insync?(is)
112
- @should ||= []
113
-
114
112
  @latest ||= nil
115
113
  @lateststamp ||= (Time.now.to_i - 1000)
116
114
  # Iterate across all of the should values, and see how they
@@ -73,7 +73,7 @@ module Puppet
73
73
 
74
74
  if property = @resource.property(:enable)
75
75
  val = property.retrieve
76
- property.sync unless property.insync?(val)
76
+ property.sync unless property.safe_insync?(val)
77
77
  end
78
78
 
79
79
  event
@@ -144,10 +144,16 @@ module Puppet
144
144
  specified."
145
145
  end
146
146
  newparam(:status) do
147
- desc "Specify a *status* command manually. If left
148
- unspecified, the status method will be determined
149
- automatically, usually by looking for the service in the
150
- process table."
147
+ desc "Specify a *status* command manually. This command must
148
+ return 0 if the service is running and a nonzero value otherwise.
149
+ Ideally, these return codes should conform to
150
+ [the LSB's specification for init script status actions](http://refspecs.freestandards.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-generic/iniscrptact.html),
151
+ but puppet only considers the difference between 0 and nonzero
152
+ to be relevant.
153
+
154
+ If left unspecified, the status method will be determined
155
+ automatically, usually by looking for the service in the process
156
+ table."
151
157
  end
152
158
 
153
159
  newparam(:stop) do
@@ -72,6 +72,11 @@ module Puppet
72
72
  end
73
73
  end
74
74
 
75
+ newproperty(:home) do
76
+ desc "The home directory of the user. The directory must be created
77
+ separately and is not currently checked for existence."
78
+ end
79
+
75
80
  newproperty(:uid) do
76
81
  desc "The user ID. Must be specified numerically. For new users
77
82
  being created, if no user ID is specified then one will be
@@ -107,8 +112,6 @@ module Puppet
107
112
  end
108
113
 
109
114
  def insync?(is)
110
- return true unless self.should
111
-
112
115
  # We know the 'is' is a number, so we need to convert the 'should' to a number,
113
116
  # too.
114
117
  @should.each do |value|
@@ -138,11 +141,6 @@ module Puppet
138
141
  desc "A description of the user. Generally is a user's full name."
139
142
  end
140
143
 
141
- newproperty(:home) do
142
- desc "The home directory of the user. The directory must be created
143
- separately and is not currently checked for existence."
144
- end
145
-
146
144
  newproperty(:shell) do
147
145
  desc "The user's login shell. The shell must exist and be
148
146
  executable."
@@ -177,7 +175,7 @@ module Puppet
177
175
  end
178
176
 
179
177
  validate do |value|
180
- if value.to_s !~ /^\d+$/
178
+ if value.to_s !~ /^-?\d+$/
181
179
  raise ArgumentError, "Password minimum age must be provided as a number"
182
180
  end
183
181
  end
@@ -196,7 +194,7 @@ module Puppet
196
194
  end
197
195
 
198
196
  validate do |value|
199
- if value.to_s !~ /^\d+$/
197
+ if value.to_s !~ /^-?\d+$/
200
198
  raise ArgumentError, "Password maximum age must be provided as a number"
201
199
  end
202
200
  end
@@ -7,14 +7,14 @@ module Puppet
7
7
  class IniProperty < Puppet::Property
8
8
  def insync?(is)
9
9
  # A should property of :absent is the same as nil
10
- if is.nil? && (should.nil? || should == :absent)
10
+ if is.nil? && should == :absent
11
11
  return true
12
12
  end
13
13
  super(is)
14
14
  end
15
15
 
16
16
  def sync
17
- if insync?(retrieve)
17
+ if safe_insync?(retrieve)
18
18
  result = nil
19
19
  else
20
20
  result = set(self.should)
@@ -8,8 +8,6 @@ module Puppet
8
8
  end
9
9
 
10
10
  def insync?(is)
11
- return true unless self.should
12
-
13
11
  return @should == [:absent] if is == :absent
14
12
 
15
13
  flatten_and_sort(is) == flatten_and_sort(@should)
@@ -18,8 +16,6 @@ module Puppet
18
16
 
19
17
  class MultiVDev < VDev
20
18
  def insync?(is)
21
- return true unless self.should
22
-
23
19
  return @should == [:absent] if is == :absent
24
20
 
25
21
  return false unless is.length == @should.length
@@ -1,6 +1,12 @@
1
1
  # A stand-alone module for calculating checksums
2
2
  # in a generic way.
3
3
  module Puppet::Util::Checksums
4
+ class FakeChecksum
5
+ def <<(*args)
6
+ self
7
+ end
8
+ end
9
+
4
10
  # Is the provided string a checksum?
5
11
  def checksum?(string)
6
12
  string =~ /^\{(\w{3,5})\}\S+/
@@ -55,11 +61,16 @@ module Puppet::Util::Checksums
55
61
  end
56
62
 
57
63
  # by definition this doesn't exist
64
+ # but we still need to execute the block given
58
65
  def mtime_stream
66
+ noop_digest = FakeChecksum.new
67
+ yield noop_digest
59
68
  nil
60
69
  end
61
70
 
62
- alias :ctime_stream :mtime_stream
71
+ def mtime(content)
72
+ ""
73
+ end
63
74
 
64
75
  # Calculate a checksum using Digest::SHA1.
65
76
  def sha1(content)
@@ -99,12 +110,24 @@ module Puppet::Util::Checksums
99
110
  File.stat(filename).send(:ctime)
100
111
  end
101
112
 
113
+ alias :ctime_stream :mtime_stream
114
+
115
+ def ctime(content)
116
+ ""
117
+ end
118
+
102
119
  # Return a "no checksum"
103
120
  def none_file(filename)
104
121
  ""
105
122
  end
106
123
 
107
124
  def none_stream
125
+ noop_digest = FakeChecksum.new
126
+ yield noop_digest
127
+ ""
128
+ end
129
+
130
+ def none(content)
108
131
  ""
109
132
  end
110
133
 
@@ -33,8 +33,12 @@ module Puppet
33
33
  end
34
34
 
35
35
  def available_subcommands
36
- absolute_appdir = $LOAD_PATH.collect { |x| File.join(x,'puppet','application') }.detect{ |x| File.directory?(x) }
37
- Dir[File.join(absolute_appdir, '*.rb')].map{|fn| File.basename(fn, '.rb')}
36
+ absolute_appdirs = $LOAD_PATH.collect do |x|
37
+ File.join(x,'puppet','application')
38
+ end.select{ |x| File.directory?(x) }
39
+ absolute_appdirs.inject([]) do |commands, dir|
40
+ commands + Dir[File.join(dir, '*.rb')].map{|fn| File.basename(fn, '.rb')}
41
+ end.uniq
38
42
  end
39
43
 
40
44
  def usage_message
@@ -7,7 +7,7 @@
7
7
  # = Usage
8
8
  #
9
9
  # puppet apply [-h|--help] [-V|--version] [-d|--debug] [-v|--verbose] [-e|--execute]
10
- # [--detailed-exitcodes] [-l|--logdest <file>] <file>
10
+ # [--detailed-exitcodes] [-l|--logdest <file>] [--apply catalog] <file>
11
11
  #
12
12
  # = Description
13
13
  #
@@ -53,6 +53,10 @@
53
53
  # verbose::
54
54
  # Print extra information.
55
55
  #
56
+ # apply::
57
+ # Capability to apply JSON catalog (such as one generated with --compile on the Puppet master).
58
+ # You can either specify a JSON catalog file or pipe in JSON from standard input.
59
+ #
56
60
  # = Example
57
61
  #
58
62
  # puppet -l /tmp/manifest.log manifest.pp
@@ -27,7 +27,7 @@
27
27
  # parameter, so you can specify '--ssldir <directory>' as an argument.
28
28
  #
29
29
  # See the configuration file documentation at
30
- # http://reductivelabs.com/projects/puppet/reference/configref.html for
30
+ # http://docs.puppetlabs.com/references/stable/configuration.html for
31
31
  # the full list of acceptable parameters. A commented list of all
32
32
  # configuration options can also be generated by running puppet cert with
33
33
  # '--genconfig'.
@@ -45,7 +45,7 @@
45
45
  # Remove all files related to a host from puppet cert's storage. This is
46
46
  # useful when rebuilding hosts, since new certificate signing requests
47
47
  # will only be honored if puppet cert does not have a copy of a signed
48
- # certificate for that host. The certificate of the host remains valid.
48
+ # certificate for that host. The certificate of the host is also revoked.
49
49
  # If '--all' is specified then all host certificates, both signed and
50
50
  # unsigned, will be removed.
51
51
  #