puppet 0.22.4 → 0.23.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.

Files changed (266) hide show
  1. data/CHANGELOG +156 -0
  2. data/README +2 -2
  3. data/Rakefile +6 -6
  4. data/bin/filebucket +212 -0
  5. data/bin/puppet +2 -0
  6. data/bin/puppetca +2 -4
  7. data/bin/puppetd +16 -15
  8. data/bin/puppetdoc +46 -496
  9. data/bin/puppetmasterd +3 -5
  10. data/bin/puppetrun +8 -3
  11. data/bin/ralsh +271 -0
  12. data/conf/redhat/client.init +1 -1
  13. data/conf/redhat/puppet.spec +13 -2
  14. data/conf/solaris/pkginfo +1 -1
  15. data/ext/puppet-test +374 -0
  16. data/install.rb +40 -31
  17. data/lib/puppet.rb +39 -4
  18. data/lib/puppet/config_stores/rest.rb +60 -0
  19. data/lib/puppet/configuration.rb +312 -17
  20. data/lib/puppet/external/event-loop/event-loop.rb +4 -0
  21. data/lib/puppet/external/gratr/rdot.rb +1 -1
  22. data/lib/puppet/fact_stores/yaml.rb +42 -0
  23. data/lib/puppet/feature/base.rb +4 -1
  24. data/lib/puppet/metatype/attributes.rb +20 -43
  25. data/lib/puppet/metatype/container.rb +1 -36
  26. data/lib/puppet/metatype/evaluation.rb +48 -19
  27. data/lib/puppet/metatype/instances.rb +35 -1
  28. data/lib/puppet/metatype/metaparams.rb +23 -19
  29. data/lib/puppet/metatype/providers.rb +25 -38
  30. data/lib/puppet/network/client/ca.rb +8 -5
  31. data/lib/puppet/network/client/master.rb +59 -17
  32. data/lib/puppet/network/handler.rb +18 -1
  33. data/lib/puppet/network/handler/ca.rb +9 -3
  34. data/lib/puppet/network/handler/facts.rb +70 -0
  35. data/lib/puppet/network/handler/filebucket.rb +4 -1
  36. data/lib/puppet/network/handler/fileserver.rb +65 -21
  37. data/lib/puppet/network/handler/master.rb +6 -3
  38. data/lib/puppet/network/handler/report.rb +12 -26
  39. data/lib/puppet/network/handler/resource.rb +14 -2
  40. data/lib/puppet/network/handler/runner.rb +5 -1
  41. data/lib/puppet/network/handler/status.rb +5 -1
  42. data/lib/puppet/network/server/mongrel.rb +4 -4
  43. data/lib/puppet/network/server/webrick.rb +14 -3
  44. data/lib/puppet/parameter.rb +30 -25
  45. data/lib/puppet/parser/ast.rb +1 -6
  46. data/lib/puppet/parser/ast/component.rb +23 -20
  47. data/lib/puppet/parser/ast/hostclass.rb +7 -11
  48. data/lib/puppet/parser/ast/leaf.rb +4 -1
  49. data/lib/puppet/parser/ast/node.rb +6 -8
  50. data/lib/puppet/parser/functions.rb +7 -4
  51. data/lib/puppet/parser/interpreter.rb +155 -205
  52. data/lib/puppet/parser/lexer.rb +35 -2
  53. data/lib/puppet/parser/parser.rb +705 -612
  54. data/lib/puppet/parser/resource.rb +91 -48
  55. data/lib/puppet/parser/resource/param.rb +52 -29
  56. data/lib/puppet/parser/scope.rb +28 -23
  57. data/lib/puppet/pgraph.rb +26 -21
  58. data/lib/puppet/propertychange.rb +12 -12
  59. data/lib/puppet/provider.rb +102 -31
  60. data/lib/puppet/provider/cron/crontab.rb +7 -8
  61. data/lib/puppet/provider/group/groupadd.rb +4 -4
  62. data/lib/puppet/provider/group/pw.rb +3 -3
  63. data/lib/puppet/provider/mount.rb +8 -8
  64. data/lib/puppet/provider/mount/netinfo.rb +5 -5
  65. data/lib/puppet/provider/mount/parsed.rb +2 -2
  66. data/lib/puppet/provider/nameservice.rb +19 -31
  67. data/lib/puppet/provider/nameservice/netinfo.rb +14 -14
  68. data/lib/puppet/provider/nameservice/objectadd.rb +4 -4
  69. data/lib/puppet/provider/nameservice/pw.rb +4 -4
  70. data/lib/puppet/provider/package.rb +31 -0
  71. data/lib/puppet/provider/package/appdmg.rb +118 -0
  72. data/lib/puppet/provider/package/apple.rb +18 -16
  73. data/lib/puppet/provider/package/apt.rb +13 -15
  74. data/lib/puppet/provider/package/aptitude.rb +5 -3
  75. data/lib/puppet/provider/package/aptrpm.rb +9 -11
  76. data/lib/puppet/provider/package/blastwave.rb +9 -9
  77. data/lib/puppet/provider/package/darwinport.rb +12 -11
  78. data/lib/puppet/provider/package/dpkg.rb +20 -12
  79. data/lib/puppet/provider/package/fink.rb +87 -0
  80. data/lib/puppet/provider/package/freebsd.rb +10 -11
  81. data/lib/puppet/provider/package/gem.rb +15 -15
  82. data/lib/puppet/provider/package/openbsd.rb +12 -17
  83. data/lib/puppet/provider/package/pkgdmg.rb +90 -16
  84. data/lib/puppet/provider/package/portage.rb +20 -14
  85. data/lib/puppet/provider/package/ports.rb +15 -13
  86. data/lib/puppet/provider/package/rpm.rb +20 -23
  87. data/lib/puppet/provider/package/rug.rb +6 -8
  88. data/lib/puppet/provider/package/sun.rb +20 -18
  89. data/lib/puppet/provider/package/sunfreeware.rb +2 -2
  90. data/lib/puppet/provider/package/up2date.rb +6 -10
  91. data/lib/puppet/provider/package/urpmi.rb +51 -0
  92. data/lib/puppet/provider/package/yum.rb +15 -13
  93. data/lib/puppet/provider/parsedfile.rb +53 -63
  94. data/lib/puppet/provider/service/base.rb +13 -15
  95. data/lib/puppet/provider/service/debian.rb +4 -4
  96. data/lib/puppet/provider/service/gentoo.rb +4 -4
  97. data/lib/puppet/provider/service/init.rb +22 -15
  98. data/lib/puppet/provider/service/redhat.rb +6 -6
  99. data/lib/puppet/provider/service/smf.rb +6 -6
  100. data/lib/puppet/provider/user/netinfo.rb +5 -5
  101. data/lib/puppet/provider/user/pw.rb +10 -5
  102. data/lib/puppet/provider/user/useradd.rb +9 -14
  103. data/lib/puppet/provider/zone/solaris.rb +80 -45
  104. data/lib/puppet/rails.rb +3 -34
  105. data/lib/puppet/rails/database/schema.rb +45 -24
  106. data/lib/puppet/rails/fact_value.rb +1 -0
  107. data/lib/puppet/rails/host.rb +69 -40
  108. data/lib/puppet/rails/param_name.rb +3 -8
  109. data/lib/puppet/rails/param_value.rb +2 -1
  110. data/lib/puppet/rails/puppet_class.rb +0 -2
  111. data/lib/puppet/rails/puppet_tag.rb +5 -0
  112. data/lib/puppet/rails/resource.rb +41 -17
  113. data/lib/puppet/rails/resource_tag.rb +4 -0
  114. data/lib/puppet/reference/configuration.rb +149 -0
  115. data/lib/puppet/reference/function.rb +13 -0
  116. data/lib/puppet/reference/network.rb +37 -0
  117. data/lib/puppet/reference/providers.rb +118 -0
  118. data/lib/puppet/reference/report.rb +21 -0
  119. data/lib/puppet/reference/type.rb +152 -0
  120. data/lib/puppet/reports/rrdgraph.rb +21 -7
  121. data/lib/puppet/reports/tagmail.rb +4 -1
  122. data/lib/puppet/sslcertificates.rb +1 -49
  123. data/lib/puppet/sslcertificates/ca.rb +2 -79
  124. data/lib/puppet/sslcertificates/inventory.rb +0 -10
  125. data/lib/puppet/transaction.rb +24 -41
  126. data/lib/puppet/transaction/report.rb +27 -1
  127. data/lib/puppet/type.rb +7 -43
  128. data/lib/puppet/type/component.rb +198 -124
  129. data/lib/puppet/type/cron.rb +51 -42
  130. data/lib/puppet/type/exec.rb +20 -19
  131. data/lib/puppet/type/group.rb +6 -55
  132. data/lib/puppet/type/host.rb +16 -37
  133. data/lib/puppet/type/mount.rb +30 -17
  134. data/lib/puppet/type/notify.rb +7 -8
  135. data/lib/puppet/type/package.rb +44 -80
  136. data/lib/puppet/type/pfile.rb +50 -41
  137. data/lib/puppet/type/pfile/checksum.rb +82 -95
  138. data/lib/puppet/type/pfile/content.rb +21 -25
  139. data/lib/puppet/type/pfile/ensure.rb +32 -30
  140. data/lib/puppet/type/pfile/group.rb +21 -26
  141. data/lib/puppet/type/pfile/mode.rb +25 -32
  142. data/lib/puppet/type/pfile/owner.rb +23 -27
  143. data/lib/puppet/type/pfile/source.rb +42 -33
  144. data/lib/puppet/type/pfile/target.rb +20 -18
  145. data/lib/puppet/type/pfile/type.rb +6 -7
  146. data/lib/puppet/type/pfilebucket.rb +3 -3
  147. data/lib/puppet/type/port.rb +5 -7
  148. data/lib/puppet/type/property.rb +58 -61
  149. data/lib/puppet/type/resources.rb +12 -8
  150. data/lib/puppet/type/schedule.rb +8 -8
  151. data/lib/puppet/type/service.rb +26 -33
  152. data/lib/puppet/type/sshkey.rb +6 -7
  153. data/lib/puppet/type/tidy.rb +41 -35
  154. data/lib/puppet/type/user.rb +34 -67
  155. data/lib/puppet/type/yumrepo.rb +27 -12
  156. data/lib/puppet/type/zone.rb +71 -110
  157. data/lib/puppet/util.rb +46 -61
  158. data/lib/puppet/util/autoload.rb +59 -47
  159. data/lib/puppet/util/config.rb +160 -18
  160. data/lib/puppet/util/config_store.rb +61 -0
  161. data/lib/puppet/util/fact_store.rb +60 -0
  162. data/lib/puppet/util/instance_loader.rb +74 -0
  163. data/lib/puppet/util/loadedfile.rb +5 -8
  164. data/lib/puppet/util/metric.rb +17 -25
  165. data/lib/puppet/util/posix.rb +39 -7
  166. data/lib/puppet/util/provider_features.rb +9 -1
  167. data/lib/puppet/util/rails/collection_merger.rb +16 -1
  168. data/lib/puppet/util/reference.rb +189 -0
  169. data/lib/puppet/util/storage.rb +2 -2
  170. data/lib/puppet/util/subclass_loader.rb +9 -2
  171. data/test/language/ast.rb +4 -148
  172. data/test/language/ast/component.rb +10 -1
  173. data/test/language/collector.rb +1 -191
  174. data/test/language/interpreter.rb +284 -327
  175. data/test/language/lexer.rb +13 -1
  176. data/test/language/node.rb +1 -1
  177. data/test/language/parser.rb +17 -4
  178. data/test/language/resource.rb +67 -101
  179. data/test/language/scope.rb +18 -3
  180. data/test/language/snippets.rb +114 -151
  181. data/test/lib/puppettest.rb +13 -0
  182. data/test/lib/puppettest/exetest.rb +7 -0
  183. data/test/lib/puppettest/fakes.rb +39 -28
  184. data/test/lib/puppettest/railstesting.rb +1 -1
  185. data/test/lib/puppettest/support/assertions.rb +2 -2
  186. data/test/lib/puppettest/support/collection.rb +30 -0
  187. data/test/network/client/ca.rb +27 -1
  188. data/test/network/client/client.rb +3 -3
  189. data/test/network/client/master.rb +102 -1
  190. data/test/network/handler/ca.rb +35 -1
  191. data/test/network/handler/facts.rb +112 -0
  192. data/test/network/handler/fileserver.rb +25 -1
  193. data/test/network/handler/handler.rb +2 -2
  194. data/test/network/handler/master.rb +2 -49
  195. data/test/network/handler/resource.rb +5 -6
  196. data/test/network/server/mongrel_test.rb +65 -0
  197. data/test/network/server/webrick.rb +2 -2
  198. data/test/network/xmlrpc/client.rb +2 -1
  199. data/test/network/xmlrpc/processor.rb +2 -1
  200. data/test/other/pgraph.rb +6 -5
  201. data/test/other/propertychange.rb +11 -12
  202. data/test/other/report.rb +44 -27
  203. data/test/other/transactions.rb +17 -16
  204. data/test/puppet/tc_suidmanager.rb +2 -2
  205. data/test/rails/ast.rb +74 -0
  206. data/test/rails/collection.rb +214 -0
  207. data/test/rails/host.rb +49 -24
  208. data/test/rails/interpreter.rb +91 -0
  209. data/test/rails/railsparameter.rb +22 -11
  210. data/test/rails/railsresource.rb +140 -7
  211. data/test/ral/manager/attributes.rb +37 -13
  212. data/test/ral/manager/instances.rb +82 -0
  213. data/test/ral/manager/provider.rb +60 -22
  214. data/test/ral/manager/type.rb +9 -6
  215. data/test/ral/providers/cron/crontab.rb +59 -7
  216. data/test/ral/providers/group.rb +7 -7
  217. data/test/ral/providers/host/netinfo.rb +5 -6
  218. data/test/ral/providers/host/parsed.rb +4 -4
  219. data/test/ral/providers/mount/parsed.rb +11 -6
  220. data/test/ral/providers/nameservice.rb +2 -2
  221. data/test/ral/providers/package.rb +39 -14
  222. data/test/ral/providers/package/apt.rb +72 -3
  223. data/test/ral/providers/package/aptitude.rb +15 -12
  224. data/test/ral/providers/package/aptrpm.rb +3 -3
  225. data/test/ral/providers/package/dpkg.rb +2 -2
  226. data/test/ral/providers/parsedfile.rb +114 -88
  227. data/test/ral/providers/{parsedport.rb → port/parsed.rb} +1 -1
  228. data/test/ral/providers/provider.rb +93 -13
  229. data/test/ral/providers/service.rb +52 -26
  230. data/test/ral/providers/sshkey/parsed.rb +3 -3
  231. data/test/ral/providers/user.rb +19 -20
  232. data/test/ral/providers/user/useradd.rb +1 -5
  233. data/test/ral/types/cron.rb +49 -36
  234. data/test/ral/types/file.rb +38 -35
  235. data/test/ral/types/file/target.rb +4 -4
  236. data/test/ral/types/filesources.rb +24 -22
  237. data/test/ral/types/group.rb +4 -2
  238. data/test/ral/types/host.rb +17 -10
  239. data/test/ral/types/mount.rb +40 -23
  240. data/test/ral/types/package.rb +62 -5
  241. data/test/ral/types/parameter.rb +2 -2
  242. data/test/ral/types/property.rb +27 -20
  243. data/test/ral/types/resources.rb +4 -16
  244. data/test/ral/types/schedule.rb +2 -2
  245. data/test/ral/types/service.rb +2 -3
  246. data/test/ral/types/sshkey.rb +3 -3
  247. data/test/ral/types/tidy.rb +6 -15
  248. data/test/ral/types/user.rb +17 -17
  249. data/test/ral/types/yumrepo.rb +2 -2
  250. data/test/ral/types/zone.rb +71 -87
  251. data/test/util/autoload.rb +6 -21
  252. data/test/util/config.rb +201 -101
  253. data/test/util/fact_store.rb +67 -0
  254. data/test/util/features.rb +9 -6
  255. data/test/util/instance_loader.rb +53 -0
  256. data/test/util/loadedfile.rb +17 -1
  257. data/test/util/metrics.rb +54 -57
  258. data/test/util/posixtest.rb +8 -11
  259. data/test/util/utiltest.rb +31 -2
  260. metadata +520 -492
  261. data/TODO +0 -4
  262. data/lib/puppet/network/client/logger.rb +0 -6
  263. data/lib/puppet/network/handler/logger.rb +0 -52
  264. data/lib/puppet/rails/database/001_add_indexes.rb +0 -38
  265. data/lib/puppet/type/parsedtype.rb +0 -219
  266. data/test/network/handler/logger.rb +0 -183
@@ -31,6 +31,7 @@ class TestFile < Test::Unit::TestCase
31
31
  super
32
32
  @file = Puppet::Type.type(:file)
33
33
  $method = @method_name
34
+ Puppet[:filetimeout] = -1
34
35
  end
35
36
 
36
37
  def teardown
@@ -237,15 +238,15 @@ class TestFile < Test::Unit::TestCase
237
238
  }
238
239
  assert(changes.length > 0)
239
240
  assert_apply(file)
240
- file.retrieve
241
- assert(file.insync?())
241
+ currentvalue = file.retrieve
242
+ assert(file.insync?(currentvalue))
242
243
  assert_nothing_raised() {
243
244
  file[:owner] = uid
244
245
  }
245
246
  assert_apply(file)
246
- file.retrieve
247
+ currentvalue = file.retrieve
247
248
  # make sure changing to number doesn't cause a sync
248
- assert(file.insync?())
249
+ assert(file.insync?(currentvalue))
249
250
  }
250
251
 
251
252
  # We no longer raise an error here, because we check at run time
@@ -269,8 +270,8 @@ class TestFile < Test::Unit::TestCase
269
270
  assert(file.property(:group))
270
271
  assert(file.property(:group).should)
271
272
  assert_apply(file)
272
- file.retrieve
273
- assert(file.insync?())
273
+ currentvalue = file.retrieve
274
+ assert(file.insync?(currentvalue))
274
275
  assert_nothing_raised() {
275
276
  file.delete(:group)
276
277
  }
@@ -311,7 +312,7 @@ class TestFile < Test::Unit::TestCase
311
312
  assert_events([:file_created], file)
312
313
  assert_events([], file)
313
314
  assert(FileTest.file?(path), "File does not exist")
314
- assert(file.insync?())
315
+ assert(file.insync?(file.retrieve))
315
316
  @@tmpfiles.push path
316
317
  }
317
318
  end
@@ -331,7 +332,7 @@ class TestFile < Test::Unit::TestCase
331
332
  [path])
332
333
  assert_events([:directory_created], file)
333
334
  assert_events([], file)
334
- assert(file.insync?())
335
+ assert(file.insync?(file.retrieve))
335
336
  assert(FileTest.directory?(path))
336
337
  @@tmpfiles.push path
337
338
  }
@@ -348,7 +349,7 @@ class TestFile < Test::Unit::TestCase
348
349
  assert_events([:file_changed], file)
349
350
  assert_events([], file)
350
351
 
351
- assert(file.insync?())
352
+ assert(file.insync?(file.retrieve))
352
353
 
353
354
  assert_nothing_raised() {
354
355
  file.delete(:mode)
@@ -387,11 +388,11 @@ class TestFile < Test::Unit::TestCase
387
388
  }
388
389
  trans = nil
389
390
 
390
- file.retrieve
391
+ currentvalues = file.retrieve
391
392
 
392
393
  if file.title !~ /nonexists/
393
394
  sum = file.property(:checksum)
394
- assert(sum.insync?, "file is not in sync")
395
+ assert(sum.insync?(currentvalues[sum]), "file is not in sync")
395
396
  end
396
397
 
397
398
  events = assert_apply(file)
@@ -424,10 +425,11 @@ class TestFile < Test::Unit::TestCase
424
425
 
425
426
  # Run it a few times to make sure we aren't getting
426
427
  # spurious changes.
428
+ sum = nil
427
429
  assert_nothing_raised do
428
- file.property(:checksum).retrieve
430
+ sum = file.property(:checksum).retrieve
429
431
  end
430
- assert(file.property(:checksum).insync?,
432
+ assert(file.property(:checksum).insync?(sum),
431
433
  "checksum is not in sync")
432
434
 
433
435
  sleep 1.1 if type =~ /time/
@@ -713,7 +715,7 @@ class TestFile < Test::Unit::TestCase
713
715
  file.evaluate
714
716
  }
715
717
 
716
- assert_equal("directory", file.property(:type).is)
718
+ assert_equal("directory", file.property(:type).retrieve)
717
719
 
718
720
  # And then check files
719
721
  assert_nothing_raised {
@@ -727,15 +729,16 @@ class TestFile < Test::Unit::TestCase
727
729
  file[:check] = "type"
728
730
  assert_apply(file)
729
731
 
730
- assert_equal("file", file.property(:type).is)
732
+ assert_equal("file", file.property(:type).retrieve)
731
733
 
732
734
  file[:type] = "directory"
733
735
 
734
- assert_nothing_raised { file.retrieve }
736
+ currentvalues = {}
737
+ assert_nothing_raised { currentvalues = file.retrieve }
735
738
 
736
739
  # The 'retrieve' method sets @should to @is, so they're never
737
740
  # out of sync. It's a read-only class.
738
- assert(file.insync?)
741
+ assert(file.insync?(currentvalues))
739
742
  end
740
743
 
741
744
  def test_remove
@@ -840,13 +843,13 @@ class TestFile < Test::Unit::TestCase
840
843
  )
841
844
  }
842
845
 
843
- assert(!obj.insync?, "Object is incorrectly in sync")
846
+ assert(!obj.insync?(obj.retrieve), "Object is incorrectly in sync")
844
847
 
845
848
  assert_events([:file_created], obj)
846
849
 
847
- obj.retrieve
850
+ currentvalues = obj.retrieve
848
851
 
849
- assert(obj.insync?, "Object is not in sync")
852
+ assert(obj.insync?(currentvalues), "Object is not in sync")
850
853
 
851
854
  text = File.read(file)
852
855
 
@@ -856,7 +859,7 @@ class TestFile < Test::Unit::TestCase
856
859
 
857
860
  obj[:content] = newstr
858
861
 
859
- assert(!obj.insync?, "Object is incorrectly in sync")
862
+ assert(!obj.insync?(obj.retrieve), "Object is incorrectly in sync")
860
863
 
861
864
  assert_events([:file_changed], obj)
862
865
 
@@ -864,8 +867,8 @@ class TestFile < Test::Unit::TestCase
864
867
 
865
868
  assert_equal(newstr, text, "Content did not copy correctly")
866
869
 
867
- obj.retrieve
868
- assert(obj.insync?, "Object is not in sync")
870
+ currentvalues = obj.retrieve
871
+ assert(obj.insync?(currentvalues), "Object is not in sync")
869
872
  end
870
873
 
871
874
  # Unfortunately, I know this fails
@@ -943,7 +946,7 @@ class TestFile < Test::Unit::TestCase
943
946
  )
944
947
  }
945
948
 
946
- file.retrieve
949
+ currentvalues = file.retrieve
947
950
 
948
951
  assert_events([:file_created], file)
949
952
  file.retrieve
@@ -1218,21 +1221,21 @@ class TestFile < Test::Unit::TestCase
1218
1221
 
1219
1222
  file = Puppet::Type.newfile(:path => path, :ensure => :present)
1220
1223
 
1221
- file.retrieve
1222
- assert(! file.insync?, "File incorrectly in sync")
1224
+ currentvalues = file.retrieve
1225
+ assert(! file.insync?(currentvalues), "File incorrectly in sync")
1223
1226
 
1224
1227
  # Now make a file
1225
1228
  File.open(path, "w") { |f| f.puts "yay" }
1226
1229
 
1227
- file.retrieve
1228
- assert(file.insync?, "File not in sync")
1230
+ currentvalues = file.retrieve
1231
+ assert(file.insync?(currentvalues), "File not in sync")
1229
1232
 
1230
1233
  # Now make a directory
1231
1234
  File.unlink(path)
1232
1235
  Dir.mkdir(path)
1233
1236
 
1234
- file.retrieve
1235
- assert(file.insync?, "Directory not considered 'present'")
1237
+ currentvalues = file.retrieve
1238
+ assert(file.insync?(currentvalues), "Directory not considered 'present'")
1236
1239
 
1237
1240
  Dir.rmdir(path)
1238
1241
 
@@ -1242,8 +1245,8 @@ class TestFile < Test::Unit::TestCase
1242
1245
  otherfile = tempfile()
1243
1246
  File.symlink(otherfile, path)
1244
1247
 
1245
- file.retrieve
1246
- assert(file.insync?, "Symlink not considered 'present'")
1248
+ currentvalues = file.retrieve
1249
+ assert(file.insync?(currentvalues), "Symlink not considered 'present'")
1247
1250
  File.unlink(path)
1248
1251
 
1249
1252
  # Now set some content, and make sure it works
@@ -1459,8 +1462,8 @@ class TestFile < Test::Unit::TestCase
1459
1462
 
1460
1463
  property = obj.property(:ensure)
1461
1464
 
1462
- property.retrieve
1463
- unless property.insync?
1465
+ currentvalue = property.retrieve
1466
+ unless property.insync?(currentvalue)
1464
1467
  assert_nothing_raised do
1465
1468
  property.sync
1466
1469
  end
@@ -1796,4 +1799,4 @@ class TestFile < Test::Unit::TestCase
1796
1799
  end
1797
1800
  end
1798
1801
 
1799
- # $Id: file.rb 2436 2007-04-30 17:29:02Z luke $
1802
+ # $Id: file.rb 2629 2007-06-19 22:18:55Z luke $
@@ -222,19 +222,19 @@ class TestFileTarget < Test::Unit::TestCase
222
222
 
223
223
  prop = obj.send(:property, :target)
224
224
  prop.send(:instance_variable_set, "@should", [:nochange])
225
- assert(prop.insync?,
225
+ assert(prop.insync?(prop.retrieve),
226
226
  "Property not in sync with should == :nochange")
227
227
 
228
228
  prop = obj.send(:property, :target)
229
229
  prop.send(:instance_variable_set, "@should", [:notlink])
230
- assert(prop.insync?,
230
+ assert(prop.insync?(prop.retrieve),
231
231
  "Property not in sync with should == :nochange")
232
232
 
233
233
  # Lastly, make sure that we don't try to do anything when we're
234
234
  # recursing, since 'ensure' does the work.
235
235
  obj[:recurse] = true
236
236
  prop.should = dest
237
- assert(prop.insync?,
237
+ assert(prop.insync?(prop.retrieve),
238
238
  "Still out of sync during recursion")
239
239
  end
240
240
 
@@ -360,4 +360,4 @@ class TestFileTarget < Test::Unit::TestCase
360
360
  end
361
361
  end
362
362
 
363
- # $Id: target.rb 2270 2007-03-08 07:37:43Z luke $
363
+ # $Id: target.rb 2487 2007-05-09 01:51:20Z ballman $
@@ -16,6 +16,7 @@ class TestFileSources < Test::Unit::TestCase
16
16
  @port = 12345
17
17
  end
18
18
  @file = Puppet::Type.type(:file)
19
+ Puppet[:filetimeout] = -1
19
20
  end
20
21
 
21
22
  def use_storage
@@ -143,26 +144,27 @@ class TestFileSources < Test::Unit::TestCase
143
144
  assert_equal([source], property.should, "munging changed the source")
144
145
 
145
146
  # First try it with a missing source
147
+ currentvalue = nil
146
148
  assert_nothing_raised do
147
- property.retrieve
149
+ currentvalue = property.retrieve
148
150
  end
149
151
 
150
152
  # And make sure the property considers itself in sync, since there's nothing
151
153
  # to do
152
- assert(property.insync?, "source thinks there's work to do with no file or dest")
154
+ assert(property.insync?(currentvalue), "source thinks there's work to do with no file or dest")
153
155
 
154
156
  # Now make the dest a directory, and make sure the object sets :ensure
155
157
  # up to create a directory
156
158
  Dir.mkdir(source)
157
159
  assert_nothing_raised do
158
- property.retrieve
160
+ currentvalue = property.retrieve
159
161
  end
160
162
  assert_equal(:directory, file.should(:ensure),
161
163
  "Did not set to create directory")
162
164
 
163
165
  # And make sure the source property won't try to do anything with a
164
166
  # remote dir
165
- assert(property.insync?, "Source was out of sync even tho remote is dir")
167
+ assert(property.insync?(currentvalue), "Source was out of sync even tho remote is dir")
166
168
 
167
169
  # Now remove the source, and make sure :ensure was not modified
168
170
  Dir.rmdir(source)
@@ -205,29 +207,29 @@ class TestFileSources < Test::Unit::TestCase
205
207
  assert(property, "did not get source property")
206
208
 
207
209
  # Try it with no source at all
208
- file.retrieve
209
- assert(property.insync?, "source property not in sync with missing source")
210
+ currentvalues = file.retrieve
211
+ assert(property.insync?(currentvalues[property]), "source property not in sync with missing source")
210
212
 
211
213
  # with a directory
212
214
  Dir.mkdir(source)
213
- file.retrieve
214
- assert(property.insync?, "source property not in sync with directory as source")
215
+ currentvalues = file.retrieve
216
+ assert(property.insync?(currentvalues[property]), "source property not in sync with directory as source")
215
217
  Dir.rmdir(source)
216
218
 
217
219
  # with a file
218
220
  File.open(source, "w") { |f| f.puts "yay" }
219
- file.retrieve
220
- assert(!property.insync?, "source property was in sync when file was missing")
221
+ currentvalues = file.retrieve
222
+ assert(!property.insync?(currentvalues[property]), "source property was in sync when file was missing")
221
223
 
222
224
  # With a different file
223
225
  File.open(dest, "w") { |f| f.puts "foo" }
224
- file.retrieve
225
- assert(!property.insync?, "source property was in sync with different file")
226
+ currentvalues = file.retrieve
227
+ assert(!property.insync?(currentvalues[property]), "source property was in sync with different file")
226
228
 
227
229
  # with matching files
228
230
  File.open(dest, "w") { |f| f.puts "yay" }
229
- file.retrieve
230
- assert(property.insync?, "source property was not in sync with matching file")
231
+ currentvalues = file.retrieve
232
+ assert(property.insync?(currentvalues[property]), "source property was not in sync with matching file")
231
233
  end
232
234
 
233
235
  def test_source_sync
@@ -240,8 +242,8 @@ class TestFileSources < Test::Unit::TestCase
240
242
 
241
243
  File.open(source, "w") { |f| f.puts "yay" }
242
244
 
243
- file.retrieve
244
- assert(! property.insync?, "source thinks it's in sync")
245
+ currentvalues = file.retrieve
246
+ assert(! property.insync?(currentvalues[property]), "source thinks it's in sync")
245
247
 
246
248
  event = nil
247
249
  assert_nothing_raised do
@@ -253,8 +255,8 @@ class TestFileSources < Test::Unit::TestCase
253
255
 
254
256
  # Now write something different
255
257
  File.open(source, "w") { |f| f.puts "rah" }
256
- file.retrieve
257
- assert(! property.insync?, "source should be out of sync")
258
+ currentvalues = file.retrieve
259
+ assert(! property.insync?(currentvalues[property]), "source should be out of sync")
258
260
  assert_nothing_raised do
259
261
  event = property.sync
260
262
  end
@@ -692,12 +694,12 @@ class TestFileSources < Test::Unit::TestCase
692
694
  )
693
695
  }
694
696
 
695
- file.retrieve
697
+ currentvalue = file.retrieve
696
698
 
697
- assert(file.is(:checksum), "File does not have a checksum property")
699
+ assert(currentvalue[file.property(:checksum)],
700
+ "File does not have a checksum property")
698
701
 
699
702
  assert_equal(0, file.evaluate.length, "File produced changes")
700
-
701
703
  end
702
704
 
703
705
  def test_sourcepaths
@@ -1043,4 +1045,4 @@ class TestFileSources < Test::Unit::TestCase
1043
1045
  end
1044
1046
  end
1045
1047
 
1046
- # $Id: filesources.rb 2436 2007-04-30 17:29:02Z luke $
1048
+ # $Id: filesources.rb 2629 2007-06-19 22:18:55Z luke $
@@ -125,11 +125,13 @@ class TestGroup < Test::Unit::TestCase
125
125
  # Set a fake gid
126
126
  gobj.provider.gid = rand(100)
127
127
 
128
+ current_values = nil
128
129
  assert_nothing_raised {
129
- gobj.retrieve
130
+ current_values = gobj.retrieve
130
131
  }
131
132
 
132
- assert(gobj.is(:gid), "Failed to retrieve gid")
133
+ assert(current_values[gobj.property(:gid)],
134
+ "Failed to retrieve gid")
133
135
  }
134
136
  end
135
137
 
@@ -79,20 +79,21 @@ class TestHost < Test::Unit::TestCase
79
79
  )
80
80
  }
81
81
 
82
- host.retrieve
82
+ current_values = nil
83
+ assert_nothing_raised { current_values = host.retrieve }
83
84
  assert_events([:host_created], host)
84
85
 
85
- assert_nothing_raised { host.retrieve }
86
+ assert_nothing_raised { current_values = host.retrieve }
86
87
 
87
- assert_equal(:present, host.is(:ensure))
88
+ assert_equal(:present, current_values[host.property(:ensure)])
88
89
 
89
90
  host[:ensure] = :absent
90
91
 
91
92
  assert_events([:host_removed], host)
92
93
 
93
- assert_nothing_raised { host.retrieve }
94
+ assert_nothing_raised { current_values = host.retrieve }
94
95
 
95
- assert_equal(:absent, host.is(:ensure))
96
+ assert_equal(:absent, current_values[host.property(:ensure)])
96
97
  end
97
98
 
98
99
  def test_moddinghost
@@ -111,18 +112,24 @@ class TestHost < Test::Unit::TestCase
111
112
 
112
113
  assert_events([:host_created], host)
113
114
 
114
- host.retrieve
115
+ current_values = nil
116
+ assert_nothing_raised {
117
+ current_values = host.retrieve
118
+ }
115
119
 
116
120
  # This was a hard bug to track down.
117
- assert_instance_of(String, host.is(:ip))
121
+ assert_instance_of(String, current_values[host.property(:ip)])
118
122
 
119
123
  host[:alias] = %w{madstop kirby yayness}
120
124
 
121
125
  assert_events([:host_changed], host)
122
126
 
123
- host.retrieve
127
+ assert_nothing_raised {
128
+ current_values = host.retrieve
129
+ }
124
130
 
125
- assert_equal(%w{madstop kirby yayness}, host.is(:alias))
131
+ assert_equal(%w{madstop kirby yayness},
132
+ current_values[host.property(:alias)])
126
133
 
127
134
  host[:ensure] = :absent
128
135
  assert_events([:host_removed], host)
@@ -152,4 +159,4 @@ class TestHost < Test::Unit::TestCase
152
159
  end
153
160
  end
154
161
 
155
- # $Id: host.rb 2170 2007-02-07 17:21:52Z luke $
162
+ # $Id: host.rb 2487 2007-05-09 01:51:20Z ballman $
@@ -18,10 +18,14 @@ class TestMounts < Test::Unit::TestCase
18
18
  :yayness
19
19
  end
20
20
 
21
+ def self.instances
22
+ []
23
+ end
24
+
21
25
  def create
22
26
  @ensure = :present
23
- @model.class.validproperties.each do |property|
24
- if value = @model.should(property)
27
+ @resource.class.validproperties.each do |property|
28
+ if value = @resource.should(property)
25
29
  self.send(property.to_s + "=", value)
26
30
  end
27
31
  end
@@ -178,38 +182,51 @@ class TestMounts < Test::Unit::TestCase
178
182
  assert_events([:mount_mounted, :triggered], obj)
179
183
  assert_events([], obj)
180
184
 
181
- obj.retrieve
182
- assert_equal(:mounted, obj.is(:ensure))
185
+ current_values = nil
186
+ assert_nothing_raised { current_values = obj.retrieve }
187
+ assert_equal(:mounted, current_values[obj.property(:ensure)])
183
188
 
184
- obj.retrieve
189
+ assert_nothing_raised { current_values = obj.retrieve }
185
190
  assert(obj.provider.mounted?, "Object is not mounted")
186
191
  end
192
+
193
+ def test_defaults
194
+ obj = mkmount
195
+ args = mkmount_args
196
+ args.delete(:pass)
197
+ args.delete(:dump)
198
+ mount = nil
199
+
200
+ assert_nothing_raised {
201
+ mount = Puppet.type(:mount).create(args)
202
+ }
203
+
204
+ assert_equal(0, mount.should(:pass), "Did not set default for pass")
205
+ assert_equal(0, mount.should(:dump), "Did not set default for dump")
206
+ end
187
207
 
188
208
  # Darwin doesn't put its mount table into netinfo
189
209
  unless Facter.value(:operatingsystem) == "Darwin"
190
- def test_list
191
- list = nil
192
- assert(@mount.respond_to?(:list),
193
- "No list method defined for mount")
210
+ def test_instances
211
+ instances = nil
212
+ assert(@mount.respond_to?(:instances),
213
+ "No instances method defined for mount")
194
214
 
195
215
  assert_nothing_raised do
196
- list = Puppet::Type.type(:mount).list
216
+ instances = Puppet::Type.type(:mount).instances
197
217
  end
198
218
 
199
- assert(list.length > 0, "Did not return any mounts")
200
-
201
- root = list.find { |o| o[:name] == "/" }
202
- assert(root, "Could not find root root filesystem in list results")
203
-
204
- assert(root.is(:device), "Device was not set")
205
- assert(root.property(:device).value, "Device was not returned by value method")
219
+ assert(instances.length > 0, "Did not return any mounts")
206
220
 
221
+ root = instances.find { |o| o[:name] == "/" }
222
+ assert(root, "Could not find root root filesystem in instances results")
223
+
224
+ current_values = nil
207
225
  assert_nothing_raised do
208
- root.retrieve
226
+ current_values = root.retrieve
209
227
  end
210
228
 
211
- assert(root.is(:device), "Device was not set")
212
- assert(root.property(:device).value, "Device was not returned by value method")
229
+ assert(current_values[root.property(:device)], "Device was not set")
213
230
  end
214
231
  end
215
232
 
@@ -247,8 +264,8 @@ class TestMounts < Test::Unit::TestCase
247
264
  assert_events([], mount)
248
265
 
249
266
  # Now try listing and making sure the object is actually gone.
250
- list = mount.provider.class.list
251
- assert(! list.find { |r| r[:name] == mount[:name] },
267
+ instances = mount.provider.class.instances
268
+ assert(! instances.find { |r| r[:name] == mount[:name] },
252
269
  "Mount was not actually removed")
253
270
  end
254
271
  end
@@ -309,4 +326,4 @@ class TestMounts < Test::Unit::TestCase
309
326
  end
310
327
  end
311
328
 
312
- # $Id: mount.rb 2377 2007-03-31 06:35:23Z luke $
329
+ # $Id: mount.rb 2563 2007-06-11 22:30:00Z luke $