puppet 0.23.0 → 0.23.1

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 (125) hide show
  1. data/CHANGELOG +58 -0
  2. data/Rakefile +1 -1
  3. data/bin/filebucket +6 -6
  4. data/bin/puppetca +11 -1
  5. data/bin/puppetmasterd +7 -6
  6. data/conf/redhat/client.init +1 -0
  7. data/conf/redhat/{puppetd.conf → puppet.conf} +1 -1
  8. data/conf/redhat/puppet.spec +43 -31
  9. data/conf/redhat/server.init +1 -0
  10. data/lib/puppet.rb +3 -3
  11. data/lib/puppet/configuration.rb +16 -5
  12. data/lib/puppet/metatype/attributes.rb +12 -19
  13. data/lib/puppet/metatype/evaluation.rb +10 -1
  14. data/lib/puppet/metatype/instances.rb +39 -15
  15. data/lib/puppet/metatype/manager.rb +1 -28
  16. data/lib/puppet/metatype/metaparams.rb +20 -16
  17. data/lib/puppet/metatype/providers.rb +8 -2
  18. data/lib/puppet/metatype/schedules.rb +14 -19
  19. data/lib/puppet/{modules.rb → module.rb} +2 -0
  20. data/lib/puppet/network/authstore.rb +5 -1
  21. data/lib/puppet/network/client/dipper.rb +2 -2
  22. data/lib/puppet/network/client/master.rb +18 -9
  23. data/lib/puppet/network/handler/fileserver.rb +3 -6
  24. data/lib/puppet/network/handler/report.rb +2 -1
  25. data/lib/puppet/network/server/mongrel.rb +4 -2
  26. data/lib/puppet/network/xmlrpc/client.rb +10 -3
  27. data/lib/puppet/parameter.rb +11 -4
  28. data/lib/puppet/parser/ast/collexpr.rb +10 -10
  29. data/lib/puppet/parser/ast/hostclass.rb +2 -2
  30. data/lib/puppet/parser/ast/resourceparam.rb +4 -3
  31. data/lib/puppet/parser/ast/resourceref.rb +16 -2
  32. data/lib/puppet/parser/collector.rb +8 -4
  33. data/lib/puppet/parser/functions.rb +5 -2
  34. data/lib/puppet/parser/interpreter.rb +48 -9
  35. data/lib/puppet/parser/lexer.rb +2 -1
  36. data/lib/puppet/parser/parser.rb +669 -589
  37. data/lib/puppet/parser/resource.rb +20 -11
  38. data/lib/puppet/parser/resource/param.rb +21 -10
  39. data/lib/puppet/parser/resource/reference.rb +2 -2
  40. data/lib/puppet/parser/scope.rb +22 -10
  41. data/lib/puppet/{type/property.rb → property.rb} +48 -15
  42. data/lib/puppet/propertychange.rb +3 -3
  43. data/lib/puppet/provider/cron/crontab.rb +38 -36
  44. data/lib/puppet/provider/host/netinfo.rb +1 -2
  45. data/lib/puppet/provider/mailalias/aliases.rb +31 -0
  46. data/lib/puppet/provider/maillist/mailman.rb +113 -0
  47. data/lib/puppet/provider/mount.rb +5 -11
  48. data/lib/puppet/provider/mount/parsed.rb +2 -2
  49. data/lib/puppet/provider/package/appdmg.rb +1 -2
  50. data/lib/puppet/provider/package/apt.rb +3 -1
  51. data/lib/puppet/provider/package/aptrpm.rb +14 -4
  52. data/lib/puppet/provider/package/blastwave.rb +6 -4
  53. data/lib/puppet/provider/package/dpkg.rb +12 -4
  54. data/lib/puppet/provider/package/pkgdmg.rb +2 -2
  55. data/lib/puppet/provider/package/rpm.rb +11 -1
  56. data/lib/puppet/provider/package/rug.rb +1 -0
  57. data/lib/puppet/provider/package/urpmi.rb +11 -1
  58. data/lib/puppet/provider/package/yum.rb +12 -2
  59. data/lib/puppet/provider/parsedfile.rb +36 -6
  60. data/lib/puppet/rails.rb +9 -2
  61. data/lib/puppet/rails/param_name.rb +2 -3
  62. data/lib/puppet/rails/param_value.rb +20 -1
  63. data/lib/puppet/rails/resource.rb +8 -2
  64. data/lib/puppet/reference/configuration.rb +14 -16
  65. data/lib/puppet/reference/type.rb +4 -4
  66. data/lib/puppet/transaction.rb +4 -4
  67. data/lib/puppet/type.rb +19 -6
  68. data/lib/puppet/type/component.rb +9 -3
  69. data/lib/puppet/type/cron.rb +10 -4
  70. data/lib/puppet/type/exec.rb +9 -5
  71. data/lib/puppet/type/group.rb +2 -3
  72. data/lib/puppet/type/mailalias.rb +50 -0
  73. data/lib/puppet/type/maillist.rb +57 -0
  74. data/lib/puppet/type/mount.rb +25 -11
  75. data/lib/puppet/type/package.rb +6 -27
  76. data/lib/puppet/type/pfile.rb +5 -6
  77. data/lib/puppet/type/pfile/source.rb +8 -2
  78. data/lib/puppet/type/pfilebucket.rb +4 -3
  79. data/lib/puppet/type/resources.rb +1 -3
  80. data/lib/puppet/type/schedule.rb +16 -16
  81. data/lib/puppet/type/service.rb +4 -1
  82. data/lib/puppet/type/tidy.rb +1 -2
  83. data/lib/puppet/type/user.rb +2 -3
  84. data/lib/puppet/type/yumrepo.rb +2 -2
  85. data/lib/puppet/util.rb +29 -4
  86. data/lib/puppet/util/autoload.rb +45 -16
  87. data/lib/puppet/util/fileparsing.rb +23 -6
  88. data/lib/puppet/util/filetype.rb +12 -1
  89. data/lib/puppet/util/log.rb +2 -2
  90. data/lib/puppet/util/log_paths.rb +16 -0
  91. data/lib/puppet/util/reference.rb +2 -2
  92. data/test/language/ast/hostclass.rb +21 -4
  93. data/test/language/ast/resourceref.rb +95 -0
  94. data/test/language/functions.rb +5 -5
  95. data/test/language/interpreter.rb +129 -1
  96. data/test/language/node.rb +13 -2
  97. data/test/language/resource.rb +26 -1
  98. data/test/language/scope.rb +25 -5
  99. data/test/lib/puppettest/support/collection.rb +2 -2
  100. data/test/network/client/master.rb +28 -42
  101. data/test/network/server/mongrel_test.rb +7 -1
  102. data/test/other/propertychange.rb +2 -2
  103. data/test/other/transactions.rb +44 -5
  104. data/test/puppet/modules.rb +2 -1
  105. data/test/rails/ast.rb +7 -8
  106. data/test/rails/collection.rb +2 -2
  107. data/test/rails/railsresource.rb +21 -5
  108. data/test/ral/manager/attributes.rb +33 -1
  109. data/test/ral/manager/instances.rb +33 -6
  110. data/test/ral/manager/type.rb +29 -49
  111. data/test/ral/providers/cron/crontab.rb +61 -13
  112. data/test/ral/providers/mailalias/aliases.rb +57 -0
  113. data/test/ral/providers/mount/parsed.rb +4 -4
  114. data/test/ral/providers/package/apt.rb +13 -1
  115. data/test/ral/providers/parsedfile.rb +20 -7
  116. data/test/ral/types/cron.rb +17 -1
  117. data/test/ral/types/mailalias.rb +50 -0
  118. data/test/ral/types/mount.rb +35 -2
  119. data/test/ral/types/package.rb +10 -2
  120. data/test/ral/types/parameter.rb +4 -4
  121. data/test/ral/types/property.rb +39 -1
  122. data/test/util/autoload.rb +33 -18
  123. data/test/util/filetype.rb +49 -3
  124. metadata +13 -6
  125. data/lib/puppet/element.rb +0 -52
@@ -398,17 +398,17 @@ class TestLangFunctions < Test::Unit::TestCase
398
398
  interp = mkinterp
399
399
  scope = mkscope(:interp => interp)
400
400
 
401
- fun = interp.newdefine("fun::test")
401
+ fun = interp.newdefine("yay::ness")
402
402
  foo = interp.newdefine("foo::bar")
403
403
 
404
404
  search = Puppet::Parser::Functions.function(:search)
405
405
  assert_nothing_raised do
406
- scope.function_search(["foo", "fun"])
406
+ scope.function_search(["foo", "yay"])
407
407
  end
408
408
 
409
409
  ffun = ffoo = nil
410
- assert_nothing_raised do
411
- ffun = scope.finddefine("test")
410
+ assert_nothing_raised("Search path change did not work") do
411
+ ffun = scope.finddefine("ness")
412
412
  ffoo = scope.finddefine('bar')
413
413
  end
414
414
 
@@ -529,4 +529,4 @@ class TestLangFunctions < Test::Unit::TestCase
529
529
  end
530
530
  end
531
531
 
532
- # $Id: functions.rb 2401 2007-04-20 15:59:09Z luke $
532
+ # $Id: functions.rb 2714 2007-07-19 18:12:20Z luke $
@@ -853,8 +853,22 @@ class TestInterpreter < PuppetTest::TestCase
853
853
 
854
854
  assert(scope.classlist.include?("sub"), "NodeDef did not evaluate class")
855
855
  assert(scope.classlist.include?("other"), "NodeDef did not evaluate other class")
856
+
857
+ # Now make sure nodedef doesn't fail when some classes are not defined (#687).
858
+ assert_nothing_raised("Could not create a node definition with some invalid classes") do
859
+ node = NodeDef.new :name => "yay", :classes => %w{base unknown}
860
+ end
861
+
862
+ scope = mkscope :interp => interp
863
+ assert_nothing_raised("Could not evaluate the node definition with some invalid classes") do
864
+ node.evaluate(:scope => scope)
865
+ end
866
+
867
+ assert(scope.classlist.include?("base"), "NodeDef did not evaluate class")
856
868
  end
857
869
 
870
+ # This can stay in the main test suite because it doesn't actually use ldapsearch,
871
+ # it just overrides the method so it behaves as though it were hitting ldap.
858
872
  def test_ldapnodes
859
873
  interp = mkinterp
860
874
 
@@ -910,6 +924,120 @@ class TestInterpreter < PuppetTest::TestCase
910
924
  assert_equal(%w{one two three four five}.sort, node.classes.sort, "node classes were not set correctly with the top node")
911
925
  assert_equal({"base" => "true", "center" => "boo", "master" => "far"}, node.parameters, "node parameters were not set correctly with the top node")
912
926
  end
927
+
928
+ # Setup a module.
929
+ def mk_module(name, files = {})
930
+ mdir = File.join(@dir, name)
931
+ mandir = File.join(mdir, "manifests")
932
+ FileUtils.mkdir_p mandir
933
+
934
+ if defs = files[:define]
935
+ files.delete(:define)
936
+ end
937
+ Dir.chdir(mandir) do
938
+ files.each do |file, classes|
939
+ File.open("%s.pp" % file, "w") do |f|
940
+ classes.each { |klass|
941
+ if defs
942
+ f.puts "define %s {}" % klass
943
+ else
944
+ f.puts "class %s {}" % klass
945
+ end
946
+ }
947
+ end
948
+ end
949
+ end
950
+ end
951
+
952
+ # #596 - make sure classes and definitions load automatically if they're in modules, so we don't have to manually load each one.
953
+ def test_module_autoloading
954
+ @dir = tempfile
955
+ Puppet[:modulepath] = @dir
956
+
957
+ FileUtils.mkdir_p @dir
958
+
959
+ interp = mkinterp
960
+
961
+ # Make sure we fail like normal for actually missing classes
962
+ assert_nil(interp.findclass("", "nosuchclass"), "Did not return nil on missing classes")
963
+
964
+ # test the simple case -- the module class itself
965
+ name = "simple"
966
+ mk_module(name, :init => [name])
967
+
968
+ # Try to load the module automatically now
969
+ klass = interp.findclass("", name)
970
+ assert_instance_of(AST::HostClass, klass, "Did not autoload class from module init file")
971
+ assert_equal(name, klass.classname, "Incorrect class was returned")
972
+
973
+ # Try loading the simple module when we're in something other than the base namespace.
974
+ interp = mkinterp
975
+ klass = interp.findclass("something::else", name)
976
+ assert_instance_of(AST::HostClass, klass, "Did not autoload class from module init file")
977
+ assert_equal(name, klass.classname, "Incorrect class was returned")
978
+
979
+ # Now try it with a definition as the base file
980
+ name = "simpdef"
981
+ mk_module(name, :define => true, :init => [name])
982
+
983
+ klass = interp.finddefine("", name)
984
+ assert_instance_of(AST::Component, klass, "Did not autoload class from module init file")
985
+ assert_equal(name, klass.classname, "Incorrect class was returned")
986
+
987
+ # Now try it with namespace classes where both classes are in the init file
988
+ interp = mkinterp
989
+ modname = "both"
990
+ name = "sub"
991
+ mk_module(modname, :init => %w{both both::sub})
992
+
993
+ # First try it with a namespace
994
+ klass = interp.findclass("both", name)
995
+ assert_instance_of(AST::HostClass, klass, "Did not autoload sub class from module init file with a namespace")
996
+ assert_equal("both::sub", klass.classname, "Incorrect class was returned")
997
+
998
+ # Now try it using the fully qualified name
999
+ interp = mkinterp
1000
+ klass = interp.findclass("", "both::sub")
1001
+ assert_instance_of(AST::HostClass, klass, "Did not autoload sub class from module init file with no namespace")
1002
+ assert_equal("both::sub", klass.classname, "Incorrect class was returned")
1003
+
1004
+
1005
+ # Now try it with the class in a different file
1006
+ interp = mkinterp
1007
+ modname = "separate"
1008
+ name = "sub"
1009
+ mk_module(modname, :init => %w{separate}, :sub => %w{separate::sub})
1010
+
1011
+ # First try it with a namespace
1012
+ klass = interp.findclass("separate", name)
1013
+ assert_instance_of(AST::HostClass, klass, "Did not autoload sub class from separate file with a namespace")
1014
+ assert_equal("separate::sub", klass.classname, "Incorrect class was returned")
1015
+
1016
+ # Now try it using the fully qualified name
1017
+ interp = mkinterp
1018
+ klass = interp.findclass("", "separate::sub")
1019
+ assert_instance_of(AST::HostClass, klass, "Did not autoload sub class from separate file with no namespace")
1020
+ assert_equal("separate::sub", klass.classname, "Incorrect class was returned")
1021
+
1022
+ # Now make sure we don't get a failure when there's no module file
1023
+ interp = mkinterp
1024
+ modname = "alone"
1025
+ name = "sub"
1026
+ mk_module(modname, :sub => %w{alone::sub})
1027
+
1028
+ # First try it with a namespace
1029
+ assert_nothing_raised("Could not autoload file when module file is missing") do
1030
+ klass = interp.findclass("alone", name)
1031
+ end
1032
+ assert_instance_of(AST::HostClass, klass, "Did not autoload sub class from alone file with a namespace")
1033
+ assert_equal("alone::sub", klass.classname, "Incorrect class was returned")
1034
+
1035
+ # Now try it using the fully qualified name
1036
+ interp = mkinterp
1037
+ klass = interp.findclass("", "alone::sub")
1038
+ assert_instance_of(AST::HostClass, klass, "Did not autoload sub class from alone file with no namespace")
1039
+ assert_equal("alone::sub", klass.classname, "Incorrect class was returned")
1040
+ end
913
1041
  end
914
1042
 
915
1043
  class LdapNodeTest < PuppetTest::TestCase
@@ -1043,4 +1171,4 @@ class LdapReconnectTests < PuppetTest::TestCase
1043
1171
  end
1044
1172
  end
1045
1173
 
1046
- # $Id: interpreter.rb 2597 2007-06-17 21:41:50Z luke $
1174
+ # $Id: interpreter.rb 2686 2007-07-12 19:49:41Z luke $
@@ -17,16 +17,26 @@ class TestParser < Test::Unit::TestCase
17
17
  def test_simple_hostname
18
18
  check_parseable "host1"
19
19
  check_parseable "'host2'"
20
+ check_parseable "\"host3\""
20
21
  check_parseable [ "'host1'", "host2" ]
21
22
  check_parseable [ "'host1'", "'host2'" ]
23
+ check_parseable [ "'host1'", "\"host2\"" ]
24
+ check_parseable [ "\"host1\"", "host2" ]
25
+ check_parseable [ "\"host1\"", "'host2'" ]
26
+ check_parseable [ "\"host1\"", "\"host2\"" ]
22
27
  end
23
28
 
24
29
  def test_qualified_hostname
25
30
  check_parseable "'host.example.com'"
31
+ check_parseable "\"host.example.com\""
26
32
  check_parseable [ "'host.example.com'", "host1" ]
33
+ check_parseable [ "\"host.example.com\"", "host1" ]
27
34
  check_parseable "'host-1.37examples.example.com'"
35
+ check_parseable "\"host-1.37examples.example.com\""
28
36
  check_parseable "'svn.23.nu'"
37
+ check_parseable "\"svn.23.nu\""
29
38
  check_parseable "'HOST'"
39
+ check_parseable "\"HOST\""
30
40
  end
31
41
 
32
42
  def test_inherits_from_default
@@ -36,9 +46,10 @@ class TestParser < Test::Unit::TestCase
36
46
  def test_reject_hostname
37
47
  check_nonparseable "host.example.com"
38
48
  check_nonparseable "host@example.com"
39
- check_nonparseable "\"host\""
40
49
  check_nonparseable "'$foo.example.com'"
50
+ check_nonparseable "\"$foo.example.com\""
41
51
  check_nonparseable "'host1 host2'"
52
+ check_nonparseable "\"host1 host2\""
42
53
  check_nonparseable "HOST"
43
54
  end
44
55
 
@@ -54,7 +65,7 @@ class TestParser < Test::Unit::TestCase
54
65
  interp = mkinterp :Code => code
55
66
  }
56
67
  # Strip quotes
57
- hostnames.map! { |s| s.sub(/^'(.*)'$/, "\\1") }
68
+ hostnames.map! { |s| s.sub(/^['"](.*)['"]$/, "\\1") }
58
69
 
59
70
  # parse
60
71
  assert_nothing_raised {
@@ -69,6 +69,31 @@ class TestResource < PuppetTest::TestCase
69
69
  end
70
70
  end
71
71
 
72
+ def check_paramadd(val1, val2, merged_val)
73
+ res = mkresource :params => {"one" => val1}
74
+ assert_nothing_raised do
75
+ res.set Parser::Resource::Param.new(
76
+ :name => "one", :value => val2,
77
+ :add => true, :source => @scope.findclass("sub1"))
78
+ end
79
+ assert_equal(merged_val, res[:one])
80
+ end
81
+
82
+ def test_paramadd
83
+ check_paramadd([], [], [])
84
+ check_paramadd([], "rah", ["rah"])
85
+ check_paramadd([], ["rah", "bah"], ["rah", "bah"])
86
+
87
+ check_paramadd("yay", [], ["yay"])
88
+ check_paramadd("yay", "rah", ["yay", "rah"])
89
+ check_paramadd("yay", ["rah", "bah"], ["yay", "rah", "bah"])
90
+
91
+ check_paramadd(["yay", "boo"], [], ["yay", "boo"])
92
+ check_paramadd(["yay", "boo"], "rah", ["yay", "boo", "rah"])
93
+ check_paramadd(["yay", "boo"], ["rah", "bah"],
94
+ ["yay", "boo", "rah", "bah"])
95
+ end
96
+
72
97
  def test_merge
73
98
  # Start with the normal one
74
99
  res = mkresource
@@ -498,4 +523,4 @@ class TestResource < PuppetTest::TestCase
498
523
  end
499
524
  end
500
525
 
501
- # $Id: resource.rb 2597 2007-06-17 21:41:50Z luke $
526
+ # $Id: resource.rb 2670 2007-07-10 15:31:19Z luke $
@@ -325,13 +325,13 @@ class TestScope < Test::Unit::TestCase
325
325
 
326
326
  base = scope.findclass("base")
327
327
  assert(base, "Could not find base class")
328
- assert(! scope.setclass?(base), "Class incorrectly set")
328
+ assert(! scope.class_scope(base), "Class incorrectly set")
329
329
  assert(! scope.classlist.include?("base"), "Class incorrectly in classlist")
330
330
  assert_nothing_raised do
331
331
  scope.setclass base
332
332
  end
333
333
 
334
- assert(scope.setclass?(base), "Class incorrectly unset")
334
+ assert(scope.class_scope(base), "Class incorrectly unset")
335
335
  assert(scope.classlist.include?("base"), "Class not in classlist")
336
336
 
337
337
  # Make sure we can retrieve the scope.
@@ -344,7 +344,7 @@ class TestScope < Test::Unit::TestCase
344
344
  scope.setclass "string"
345
345
  end
346
346
 
347
- assert(! scope.setclass?("string"), "string incorrectly set")
347
+ assert(! scope.class_scope("string"), "string incorrectly set")
348
348
 
349
349
  # Set "" in the class list, and make sure it doesn't show up in the return
350
350
  top = scope.findclass("")
@@ -411,7 +411,7 @@ class TestScope < Test::Unit::TestCase
411
411
  end
412
412
 
413
413
  [myclass, otherclass].each do |klass|
414
- assert(scope.setclass?(klass),
414
+ assert(scope.class_scope(klass),
415
415
  "%s was not set" % klass.classname)
416
416
  end
417
417
  end
@@ -760,6 +760,26 @@ Host <<||>>"
760
760
  assert_equal("", scope.lookupvar("testing", true),
761
761
  "undef was not returned as '' when string")
762
762
  end
763
+
764
+ # #620 - Nodes and classes should conflict, else classes don't get evaluated
765
+ def test_nodes_and_classes_name_conflict
766
+ scope = mkscope
767
+
768
+ node = AST::Node.new :classname => "test", :namespace => ""
769
+ scope.setclass(node)
770
+
771
+ assert(scope.nodescope?, "Scope was not marked a node scope when a node was set")
772
+
773
+ # Now make a subscope that will be a class scope
774
+ klass = AST::HostClass.new :classname => "test", :namespace => ""
775
+ kscope = klass.subscope(scope)
776
+
777
+ # Now make sure we throw a failure, because we're trying to do a class and node
778
+ # with the same name
779
+ assert_raise(Puppet::ParseError, "Did not fail on class and node with same name") do
780
+ kscope.class_scope(klass)
781
+ end
782
+ end
763
783
  end
764
784
 
765
- # $Id: scope.rb 2523 2007-05-17 21:51:36Z luke $
785
+ # $Id: scope.rb 2646 2007-07-04 21:06:26Z luke $
@@ -1,7 +1,7 @@
1
1
 
2
2
  module PuppetTest::Support::Collection
3
3
  def run_collection_queries(form)
4
- {true => [%{title == "/tmp/testing"}, %{(title == "/tmp/testing")},
4
+ {true => [%{title == "/tmp/testing"}, %{(title == "/tmp/testing")}, %{group == bin},
5
5
  %{title == "/tmp/testing" and group == bin}, %{title == bin or group == bin},
6
6
  %{title == "/tmp/testing" or title == bin}, %{title == "/tmp/testing"},
7
7
  %{(title == "/tmp/testing" or title == bin) and group == bin}],
@@ -27,4 +27,4 @@ module PuppetTest::Support::Collection
27
27
  end
28
28
  end
29
29
 
30
- # $Id: collection.rb 2597 2007-06-17 21:41:50Z luke $
30
+ # $Id: collection.rb 2705 2007-07-18 17:32:46Z luke $
@@ -261,65 +261,41 @@ class TestMasterClient < Test::Unit::TestCase
261
261
  end
262
262
 
263
263
  def test_getplugins
264
+ Puppet[:filetimeout] = -1
264
265
  Puppet[:pluginsource] = tempfile()
265
266
  Dir.mkdir(Puppet[:pluginsource])
267
+ Dir.mkdir(File.join(Puppet[:pluginsource], "testing"))
266
268
 
267
- myplugin = File.join(Puppet[:pluginsource], "myplugin.rb")
269
+ $loaded = []
270
+ loader = Puppet::Util::Autoload.new(self, "testing")
271
+
272
+ myplugin = File.join(Puppet[:pluginsource], "testing", "myplugin.rb")
268
273
  File.open(myplugin, "w") do |f|
269
- f.puts %{Puppet::Type.newtype(:myplugin) do
270
- newparam(:argument) do
271
- isnamevar
272
- end
273
- end
274
- }
274
+ f.puts %{$loaded << :myplugin}
275
275
  end
276
276
 
277
- assert_nothing_raised {
277
+ assert_nothing_raised("Could not get plugins") {
278
278
  Puppet::Network::Client.master.getplugins
279
279
  }
280
280
 
281
- destfile = File.join(Puppet[:plugindest], "myplugin.rb")
281
+ destfile = File.join(Puppet[:plugindest], "testing", "myplugin.rb")
282
282
 
283
283
  assert(File.exists?(destfile), "Did not get plugin")
284
284
 
285
- obj = Puppet::Type.type(:myplugin)
286
-
287
- assert(obj, "Did not define type")
285
+ assert(loader.load(:myplugin), "Did not load downloaded plugin")
288
286
 
289
- assert(obj.validattr?(:argument),
290
- "Did not get namevar")
287
+ assert($loaded.include?(:myplugin), "Downloaded code was not evaluated")
291
288
 
292
289
  # Now modify the file and make sure the type is replaced
293
290
  File.open(myplugin, "w") do |f|
294
- f.puts %{Puppet::Type.newtype(:myplugin) do
295
- newparam(:yayness) do
296
- isnamevar
297
- end
298
-
299
- newparam(:rahness) do
300
- end
301
- end
302
- }
291
+ f.puts %{$loaded << :changed}
303
292
  end
304
293
 
305
- assert_nothing_raised {
294
+ assert_nothing_raised("Could not get plugin changes") {
306
295
  Puppet::Network::Client.master.getplugins
307
296
  }
308
297
 
309
- destfile = File.join(Puppet[:pluginpath], "myplugin.rb")
310
-
311
- obj = Puppet::Type.type(:myplugin)
312
-
313
- assert(obj, "Did not define type")
314
-
315
- assert(obj.validattr?(:yayness),
316
- "Did not get namevar")
317
-
318
- assert(obj.validattr?(:rahness),
319
- "Did not get other var")
320
-
321
- assert(! obj.validattr?(:argument),
322
- "Old namevar is still valid")
298
+ assert($loaded.include?(:changed), "Changed code was not evaluated")
323
299
 
324
300
  # Now try it again, to make sure we don't have any objects lying around
325
301
  assert_nothing_raised {
@@ -328,6 +304,7 @@ end
328
304
  end
329
305
 
330
306
  def test_getfacts
307
+ Puppet[:filetimeout] = -1
331
308
  Puppet[:factsource] = tempfile()
332
309
  Dir.mkdir(Puppet[:factsource])
333
310
  hostname = Facter.value(:hostname)
@@ -616,9 +593,7 @@ end
616
593
  end
617
594
  end
618
595
 
619
- assert_raise(ArgumentError, "did not fail") do
620
- master.run
621
- end
596
+ master.run
622
597
 
623
598
  assert(! master.send(:lockfile).locked?,
624
599
  "Master is still locked after failure")
@@ -723,6 +698,17 @@ end
723
698
  assert(FileTest.exists?(@createdfile), "File does not exist on disk")
724
699
  assert_nil(ftype[@createdfile], "file object was not removed from memory")
725
700
  end
701
+
702
+ # #685
703
+ def test_http_failures_do_not_kill_puppetd
704
+ client = mkclient
705
+
706
+ client.meta_def(:getconfig) { raise "A failure" }
707
+
708
+ assert_nothing_raised("Failure in getconfig threw an error") do
709
+ client.run
710
+ end
711
+ end
726
712
  end
727
713
 
728
- # $Id: master.rb 2545 2007-05-31 22:47:01Z luke $
714
+ # $Id: master.rb 2669 2007-07-10 04:17:07Z luke $