puppet 0.16.0 → 0.18.4
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of puppet might be problematic. Click here for more details.
- data/CHANGELOG +98 -0
- data/Rakefile +5 -1
- data/bin/puppet +1 -1
- data/bin/puppetca +25 -11
- data/bin/puppetd +189 -66
- data/bin/puppetdoc +79 -62
- data/bin/puppetmasterd +93 -49
- data/bin/puppetrun +385 -0
- data/conf/redhat/client.init +5 -2
- data/conf/redhat/fileserver.conf +1 -1
- data/conf/redhat/lsb-config.patch +51 -0
- data/conf/redhat/puppet.spec +45 -18
- data/conf/redhat/puppetd.conf +32 -4
- data/conf/redhat/server.init +5 -2
- data/conf/solaris/pkginfo +7 -0
- data/conf/solaris/smf/puppetd.xml +77 -0
- data/conf/solaris/smf/puppetmasterd.xml +77 -0
- data/conf/solaris/smf/svc-puppetd +66 -0
- data/conf/solaris/smf/svc-puppetmasterd +62 -0
- data/examples/code/failers/noobjectrvalue +1 -0
- data/examples/code/snippets/deepclassheirarchy.pp +23 -0
- data/examples/code/snippets/defineoverrides.pp +17 -0
- data/examples/code/snippets/emptyexec.pp +3 -0
- data/examples/code/snippets/selectorvalues.pp +6 -1
- data/examples/code/snippets/tagged.pp +35 -0
- data/ext/ldap/puppet.schema +2 -2
- data/install.rb +4 -2
- data/lib/puppet.rb +206 -15
- data/lib/puppet/client.rb +30 -20
- data/lib/puppet/client/ca.rb +2 -2
- data/lib/puppet/client/dipper.rb +5 -9
- data/lib/puppet/client/master.rb +224 -44
- data/lib/puppet/client/pelement.rb +54 -9
- data/lib/puppet/client/proxy.rb +3 -2
- data/lib/puppet/client/reporter.rb +34 -0
- data/lib/puppet/client/runner.rb +17 -0
- data/lib/puppet/config.rb +136 -55
- data/lib/puppet/daemon.rb +59 -37
- data/lib/puppet/element.rb +2 -1
- data/lib/puppet/event.rb +14 -3
- data/lib/puppet/filetype.rb +28 -19
- data/lib/puppet/log.rb +297 -132
- data/lib/puppet/metric.rb +31 -131
- data/lib/puppet/networkclient.rb +73 -46
- data/lib/puppet/parameter.rb +49 -1
- data/lib/puppet/parsedfile.rb +32 -12
- data/lib/puppet/parser/ast.rb +6 -1
- data/lib/puppet/parser/ast/astarray.rb +32 -6
- data/lib/puppet/parser/ast/collection.rb +91 -0
- data/lib/puppet/parser/ast/compdef.rb +2 -2
- data/lib/puppet/parser/ast/component.rb +24 -11
- data/lib/puppet/parser/ast/function.rb +50 -0
- data/lib/puppet/parser/ast/hostclass.rb +70 -22
- data/lib/puppet/parser/ast/node.rb +17 -8
- data/lib/puppet/parser/ast/nodedef.rb +1 -1
- data/lib/puppet/parser/ast/objectdef.rb +28 -10
- data/lib/puppet/parser/ast/selector.rb +4 -1
- data/lib/puppet/parser/functions.rb +145 -0
- data/lib/puppet/parser/interpreter.rb +243 -86
- data/lib/puppet/parser/lexer.rb +5 -4
- data/lib/puppet/parser/parser.rb +586 -505
- data/lib/puppet/parser/scope.rb +337 -187
- data/lib/puppet/rails.rb +115 -0
- data/lib/puppet/rails/database.rb +40 -0
- data/lib/puppet/rails/host.rb +83 -0
- data/lib/puppet/rails/rails_object.rb +42 -0
- data/lib/puppet/rails/rails_parameter.rb +5 -0
- data/lib/puppet/reports/rrdgraph.rb +20 -0
- data/lib/puppet/reports/tagmail.rb +94 -0
- data/lib/puppet/server.rb +20 -4
- data/lib/puppet/server/authconfig.rb +14 -3
- data/lib/puppet/server/authstore.rb +2 -2
- data/lib/puppet/server/ca.rb +23 -11
- data/lib/puppet/server/filebucket.rb +10 -10
- data/lib/puppet/server/fileserver.rb +4 -8
- data/lib/puppet/server/master.rb +19 -22
- data/lib/puppet/server/pelement.rb +28 -16
- data/lib/puppet/server/report.rb +184 -0
- data/lib/puppet/server/runner.rb +62 -0
- data/lib/puppet/server/servlet.rb +23 -9
- data/lib/puppet/sslcertificates/ca.rb +25 -1
- data/lib/puppet/statechange.rb +34 -53
- data/lib/puppet/storage.rb +1 -2
- data/lib/puppet/transaction.rb +305 -133
- data/lib/puppet/transaction/report.rb +42 -0
- data/lib/puppet/transportable.rb +57 -33
- data/lib/puppet/type.rb +260 -127
- data/lib/puppet/type/component.rb +9 -21
- data/lib/puppet/type/cron.rb +367 -116
- data/lib/puppet/type/exec.rb +15 -16
- data/lib/puppet/type/group.rb +9 -1
- data/lib/puppet/type/nameservice.rb +2 -5
- data/lib/puppet/type/nameservice/netinfo.rb +3 -0
- data/lib/puppet/type/nameservice/objectadd.rb +23 -10
- data/lib/puppet/type/nameservice/pw.rb +16 -3
- data/lib/puppet/type/package.rb +25 -75
- data/lib/puppet/type/package/apple.rb +15 -1
- data/lib/puppet/type/package/apt.rb +37 -2
- data/lib/puppet/type/package/blastwave.rb +136 -0
- data/lib/puppet/type/package/dpkg.rb +4 -4
- data/lib/puppet/type/package/gem.rb +119 -0
- data/lib/puppet/type/package/openbsd.rb +7 -6
- data/lib/puppet/type/package/ports.rb +7 -2
- data/lib/puppet/type/package/rpm.rb +1 -1
- data/lib/puppet/type/package/sun.rb +23 -9
- data/lib/puppet/type/package/sunfreeware.rb +7 -0
- data/lib/puppet/type/package/yum.rb +16 -9
- data/lib/puppet/type/parsedtype.rb +7 -5
- data/lib/puppet/type/parsedtype/mount.rb +55 -34
- data/lib/puppet/type/parsedtype/port.rb +7 -1
- data/lib/puppet/type/parsedtype/sshkey.rb +6 -16
- data/lib/puppet/type/pfile.rb +115 -23
- data/lib/puppet/type/pfile/checksum.rb +18 -5
- data/lib/puppet/type/pfile/content.rb +2 -2
- data/lib/puppet/type/pfile/ensure.rb +3 -3
- data/lib/puppet/type/pfile/group.rb +2 -2
- data/lib/puppet/type/pfile/source.rb +28 -17
- data/lib/puppet/type/pfile/target.rb +25 -17
- data/lib/puppet/type/pfilebucket.rb +25 -6
- data/lib/puppet/type/schedule.rb +6 -6
- data/lib/puppet/type/service.rb +24 -14
- data/lib/puppet/type/service/debian.rb +1 -1
- data/lib/puppet/type/service/redhat.rb +13 -10
- data/lib/puppet/type/service/smf.rb +3 -3
- data/lib/puppet/type/state.rb +1 -2
- data/lib/puppet/type/symlink.rb +3 -4
- data/lib/puppet/type/user.rb +22 -10
- data/lib/puppet/type/yumrepo.rb +6 -1
- data/lib/puppet/type/zone.rb +595 -0
- data/lib/puppet/util.rb +58 -12
- data/test/client/client.rb +2 -2
- data/test/client/master.rb +92 -3
- data/test/client/pelement.rb +99 -0
- data/test/executables/puppetbin.rb +3 -4
- data/test/executables/puppetca.rb +3 -3
- data/test/executables/puppetd.rb +3 -3
- data/test/executables/puppetmasterd.rb +1 -5
- data/test/executables/puppetmodule.rb +2 -2
- data/test/language/ast.rb +200 -11
- data/test/language/functions.rb +245 -0
- data/test/language/interpreter.rb +155 -6
- data/test/language/lexer.rb +35 -2
- data/test/language/node.rb +48 -1
- data/test/language/parser.rb +250 -1
- data/test/language/rails.rb +105 -0
- data/test/language/scope.rb +304 -10
- data/test/language/snippets.rb +54 -5
- data/test/language/transportable.rb +60 -28
- data/test/other/config.rb +214 -1
- data/test/other/events.rb +67 -9
- data/test/other/log.rb +31 -5
- data/test/other/metrics.rb +23 -21
- data/test/other/parsedfile.rb +29 -2
- data/test/other/puppet.rb +79 -0
- data/test/other/report.rb +106 -0
- data/test/other/storage.rb +2 -2
- data/test/other/transactions.rb +128 -2
- data/test/puppet/utiltest.rb +10 -5
- data/test/puppettest.rb +193 -21
- data/test/server/authstore.rb +13 -4
- data/test/server/bucket.rb +33 -8
- data/test/server/ca.rb +44 -6
- data/test/server/master.rb +6 -7
- data/test/server/pelement.rb +15 -5
- data/test/server/report.rb +93 -0
- data/test/server/runner.rb +107 -0
- data/test/server/server.rb +28 -1
- data/test/types/cron.rb +339 -31
- data/test/types/file.rb +256 -24
- data/test/types/filebucket.rb +6 -2
- data/test/types/filesources.rb +41 -92
- data/test/types/group.rb +31 -1
- data/test/types/host.rb +2 -1
- data/test/types/mount.rb +18 -1
- data/test/types/package.rb +200 -18
- data/test/types/service.rb +5 -1
- data/test/types/sshkey.rb +2 -1
- data/test/types/symlink.rb +3 -2
- data/test/types/type.rb +180 -1
- data/test/types/user.rb +65 -27
- data/test/types/yumrepo.rb +15 -0
- data/test/types/zone.rb +437 -0
- metadata +43 -4
- data/bin/cf2puppet +0 -186
- data/conf/redhat/puppetmasterd.conf +0 -5
data/test/puppet/utiltest.rb
CHANGED
@@ -164,17 +164,22 @@ class TestPuppetUtil < Test::Unit::TestCase
|
|
164
164
|
|
165
165
|
# First test it with the normal args
|
166
166
|
assert_nothing_raised do
|
167
|
-
val =
|
168
|
-
|
167
|
+
val = nil
|
168
|
+
result = Puppet::Util.benchmark(:notice, "Read file") do
|
169
|
+
val = File.read(path)
|
169
170
|
end
|
170
171
|
|
171
172
|
assert_equal(str, val)
|
173
|
+
|
174
|
+
assert_instance_of(Float, result)
|
175
|
+
|
172
176
|
end
|
173
177
|
|
174
178
|
# Now test it with a passed object
|
175
179
|
assert_nothing_raised do
|
176
|
-
val =
|
177
|
-
|
180
|
+
val = nil
|
181
|
+
Puppet::Util.benchmark(Puppet, :notice, "Read file") do
|
182
|
+
val = File.read(path)
|
178
183
|
end
|
179
184
|
|
180
185
|
assert_equal(str, val)
|
@@ -291,4 +296,4 @@ class TestPuppetUtil < Test::Unit::TestCase
|
|
291
296
|
end
|
292
297
|
end
|
293
298
|
|
294
|
-
# $Id: utiltest.rb
|
299
|
+
# $Id: utiltest.rb 1358 2006-07-04 16:07:47Z luke $
|
data/test/puppettest.rb
CHANGED
@@ -7,6 +7,12 @@ require 'puppet'
|
|
7
7
|
require 'test/unit'
|
8
8
|
|
9
9
|
module TestPuppet
|
10
|
+
include ObjectSpace
|
11
|
+
|
12
|
+
def gcdebug(type)
|
13
|
+
Puppet.warning "%s: %s" % [type, ObjectSpace.each_object(type) { |o| }]
|
14
|
+
end
|
15
|
+
|
10
16
|
def newcomp(*ary)
|
11
17
|
name = nil
|
12
18
|
if ary[0].is_a?(String)
|
@@ -18,7 +24,9 @@ module TestPuppet
|
|
18
24
|
comp = Puppet.type(:component).create(
|
19
25
|
:name => name
|
20
26
|
)
|
21
|
-
ary.each { |item|
|
27
|
+
ary.each { |item|
|
28
|
+
comp.push item
|
29
|
+
}
|
22
30
|
|
23
31
|
return comp
|
24
32
|
end
|
@@ -57,7 +65,8 @@ module TestPuppet
|
|
57
65
|
if $0 =~ /.+\.rb/ or Puppet[:debug]
|
58
66
|
Puppet::Log.newdestination :console
|
59
67
|
Puppet::Log.level = :debug
|
60
|
-
|
68
|
+
#$VERBOSE = 1
|
69
|
+
Puppet.info @method_name
|
61
70
|
else
|
62
71
|
Puppet::Log.close
|
63
72
|
Puppet::Log.newdestination tempfile()
|
@@ -130,6 +139,7 @@ module TestPuppet
|
|
130
139
|
@@tmppids.clear
|
131
140
|
Puppet::Type.allclear
|
132
141
|
Puppet::Storage.clear
|
142
|
+
Puppet::Rails.clear
|
133
143
|
Puppet.clear
|
134
144
|
|
135
145
|
@memoryatend = Puppet::Util.memory
|
@@ -160,7 +170,8 @@ module TestPuppet
|
|
160
170
|
@@tmpfilenum = 1
|
161
171
|
end
|
162
172
|
|
163
|
-
f = File.join(self.tmpdir(), self.class.to_s + "
|
173
|
+
f = File.join(self.tmpdir(), self.class.to_s + "_" + @method_name +
|
174
|
+
@@tmpfilenum.to_s)
|
164
175
|
@@tmpfiles << f
|
165
176
|
return f
|
166
177
|
end
|
@@ -171,7 +182,7 @@ module TestPuppet
|
|
171
182
|
else
|
172
183
|
@@testdirnum = 1
|
173
184
|
end
|
174
|
-
d = File.join(self.tmpdir(), self.class.to_s + "
|
185
|
+
d = File.join(self.tmpdir(), self.class.to_s + "_" + @method_name + @@testdirnum.to_s)
|
175
186
|
@@tmpfiles << d
|
176
187
|
return d
|
177
188
|
end
|
@@ -297,7 +308,6 @@ module TestPuppet
|
|
297
308
|
|
298
309
|
# If there are any fake data files, retrieve them
|
299
310
|
def fakedata(dir)
|
300
|
-
|
301
311
|
ary = [$puppetbase, "test"]
|
302
312
|
ary += dir.split("/")
|
303
313
|
dir = File.join(ary)
|
@@ -312,6 +322,16 @@ module TestPuppet
|
|
312
322
|
return files
|
313
323
|
end
|
314
324
|
|
325
|
+
def fakefile(name)
|
326
|
+
ary = [$puppetbase, "test"]
|
327
|
+
ary += name.split("/")
|
328
|
+
file = File.join(ary)
|
329
|
+
unless FileTest.exists?(file)
|
330
|
+
raise Puppet::DevError, "No fakedata file %s" % file
|
331
|
+
end
|
332
|
+
return file
|
333
|
+
end
|
334
|
+
|
315
335
|
# wrap how to retrieve the masked mode
|
316
336
|
def filemode(file)
|
317
337
|
File.stat(file).mode & 007777
|
@@ -331,14 +351,16 @@ module ServerTest
|
|
331
351
|
if defined? @@port
|
332
352
|
@@port += 1
|
333
353
|
else
|
334
|
-
@@port =
|
354
|
+
@@port = 20000
|
335
355
|
end
|
336
356
|
end
|
337
357
|
|
338
358
|
# create a simple manifest that just creates a file
|
339
359
|
def mktestmanifest
|
340
360
|
file = File.join(Puppet[:confdir], "%ssite.pp" % (self.class.to_s + "test"))
|
341
|
-
|
361
|
+
#@createdfile = File.join(tmpdir(), self.class.to_s + "manifesttesting" +
|
362
|
+
# "_" + @method_name)
|
363
|
+
@createdfile = tempfile()
|
342
364
|
|
343
365
|
File.open(file, "w") { |f|
|
344
366
|
f.puts "file { \"%s\": ensure => file, mode => 755 }\n" % @createdfile
|
@@ -454,6 +476,11 @@ module ExeTest
|
|
454
476
|
assert($? == 0, "Puppetmasterd exit status was %s" % $?)
|
455
477
|
sleep(1)
|
456
478
|
|
479
|
+
cleanup do
|
480
|
+
stopmasterd
|
481
|
+
sleep(1)
|
482
|
+
end
|
483
|
+
|
457
484
|
return manifest
|
458
485
|
end
|
459
486
|
|
@@ -474,8 +501,9 @@ module ExeTest
|
|
474
501
|
%x{#{ps}}.chomp.split(/\n/).each { |line|
|
475
502
|
if line =~ /ruby.+puppetmasterd/
|
476
503
|
next if line =~ /\.rb/ # skip the test script itself
|
504
|
+
next if line =~ /^puppet/ # skip masters running as 'puppet'
|
477
505
|
ary = line.sub(/^\s+/, '').split(/\s+/)
|
478
|
-
|
506
|
+
pid = ary[1].to_i
|
479
507
|
end
|
480
508
|
}
|
481
509
|
|
@@ -487,9 +515,11 @@ module ExeTest
|
|
487
515
|
if pid == $$
|
488
516
|
raise Puppet::Error, "Tried to kill own pid"
|
489
517
|
end
|
490
|
-
|
491
|
-
Process.kill(
|
492
|
-
|
518
|
+
begin
|
519
|
+
Process.kill(:INT, pid)
|
520
|
+
rescue
|
521
|
+
# ignore it
|
522
|
+
end
|
493
523
|
end
|
494
524
|
end
|
495
525
|
|
@@ -789,18 +819,31 @@ module ParserTesting
|
|
789
819
|
}
|
790
820
|
end
|
791
821
|
|
792
|
-
def
|
793
|
-
assert_nothing_raised("Could not create
|
822
|
+
def objectdef(type, name, params)
|
823
|
+
assert_nothing_raised("Could not create %s %s" % [type, name]) {
|
794
824
|
return AST::ObjectDef.new(
|
795
|
-
:file =>
|
796
|
-
:line =>
|
797
|
-
:name => stringobj(
|
798
|
-
:type => nameobj(
|
799
|
-
:params => objectinst(
|
825
|
+
:file => __FILE__,
|
826
|
+
:line => __LINE__,
|
827
|
+
:name => stringobj(name),
|
828
|
+
:type => nameobj(type),
|
829
|
+
:params => objectinst(params)
|
800
830
|
)
|
801
831
|
}
|
802
832
|
end
|
803
833
|
|
834
|
+
def fileobj(path, hash = {"owner" => "root"})
|
835
|
+
assert_nothing_raised("Could not create file %s" % path) {
|
836
|
+
return objectdef("file", path, hash)
|
837
|
+
# return AST::ObjectDef.new(
|
838
|
+
# :file => tempfile(),
|
839
|
+
# :line => rand(100),
|
840
|
+
# :name => stringobj(path),
|
841
|
+
# :type => nameobj("file"),
|
842
|
+
# :params => objectinst(hash)
|
843
|
+
# )
|
844
|
+
}
|
845
|
+
end
|
846
|
+
|
804
847
|
def nameobj(name)
|
805
848
|
assert_nothing_raised("Could not create name %s" % name) {
|
806
849
|
return AST::Name.new(
|
@@ -851,12 +894,16 @@ module ParserTesting
|
|
851
894
|
end
|
852
895
|
|
853
896
|
def objectparam(param, value)
|
897
|
+
# Allow them to pass non-strings in
|
898
|
+
if value.is_a?(String)
|
899
|
+
value = stringobj(value)
|
900
|
+
end
|
854
901
|
assert_nothing_raised("Could not create param %s" % param) {
|
855
902
|
return AST::ObjectParam.new(
|
856
903
|
:file => tempfile(),
|
857
904
|
:line => rand(100),
|
858
905
|
:param => nameobj(param),
|
859
|
-
:value =>
|
906
|
+
:value => value
|
860
907
|
)
|
861
908
|
}
|
862
909
|
end
|
@@ -870,12 +917,15 @@ module ParserTesting
|
|
870
917
|
end
|
871
918
|
|
872
919
|
def varobj(name, value)
|
920
|
+
unless value.is_a? AST
|
921
|
+
value = stringobj(value)
|
922
|
+
end
|
873
923
|
assert_nothing_raised("Could not create %s code" % name) {
|
874
924
|
return AST::VarDef.new(
|
875
925
|
:file => tempfile(),
|
876
926
|
:line => rand(100),
|
877
927
|
:name => nameobj(name),
|
878
|
-
:value =>
|
928
|
+
:value => value
|
879
929
|
)
|
880
930
|
}
|
881
931
|
end
|
@@ -923,6 +973,128 @@ module ParserTesting
|
|
923
973
|
)
|
924
974
|
}
|
925
975
|
end
|
976
|
+
|
977
|
+
def taggedobj(name, ftype = :statement)
|
978
|
+
functionobj("tagged", name, ftype)
|
979
|
+
end
|
980
|
+
|
981
|
+
def functionobj(function, name, ftype = :statement)
|
982
|
+
func = nil
|
983
|
+
assert_nothing_raised do
|
984
|
+
func = Puppet::Parser::AST::Function.new(
|
985
|
+
:name => function,
|
986
|
+
:ftype => ftype,
|
987
|
+
:arguments => AST::ASTArray.new(
|
988
|
+
:children => [nameobj(name)]
|
989
|
+
)
|
990
|
+
)
|
991
|
+
end
|
992
|
+
|
993
|
+
return func
|
994
|
+
end
|
995
|
+
|
996
|
+
# This assumes no nodes
|
997
|
+
def assert_creates(manifest, *files)
|
998
|
+
interp = nil
|
999
|
+
assert_nothing_raised {
|
1000
|
+
interp = Puppet::Parser::Interpreter.new(
|
1001
|
+
:Manifest => manifest,
|
1002
|
+
:UseNodes => false
|
1003
|
+
)
|
1004
|
+
}
|
1005
|
+
|
1006
|
+
config = nil
|
1007
|
+
assert_nothing_raised {
|
1008
|
+
config = interp.run(Facter["hostname"].value, {})
|
1009
|
+
}
|
1010
|
+
|
1011
|
+
comp = nil
|
1012
|
+
assert_nothing_raised {
|
1013
|
+
comp = config.to_type
|
1014
|
+
}
|
1015
|
+
|
1016
|
+
assert_apply(comp)
|
1017
|
+
end
|
1018
|
+
|
1019
|
+
def mk_transobject(file = "/etc/passwd")
|
1020
|
+
obj = nil
|
1021
|
+
assert_nothing_raised {
|
1022
|
+
obj = Puppet::TransObject.new("file", file)
|
1023
|
+
obj["owner"] = "root"
|
1024
|
+
obj["mode"] = "644"
|
1025
|
+
}
|
1026
|
+
|
1027
|
+
return obj
|
1028
|
+
end
|
1029
|
+
|
1030
|
+
def mk_transbucket(*objects)
|
1031
|
+
bucket = nil
|
1032
|
+
assert_nothing_raised {
|
1033
|
+
bucket = Puppet::TransBucket.new
|
1034
|
+
bucket.name = "yayname"
|
1035
|
+
bucket.type = "yaytype"
|
1036
|
+
}
|
1037
|
+
|
1038
|
+
objects.each { |o| bucket << o }
|
1039
|
+
|
1040
|
+
return bucket
|
1041
|
+
end
|
1042
|
+
|
1043
|
+
# Make a tree of objects, yielding if desired
|
1044
|
+
def mk_transtree(depth = 4, width = 2)
|
1045
|
+
top = nil
|
1046
|
+
assert_nothing_raised {
|
1047
|
+
top = Puppet::TransBucket.new
|
1048
|
+
top.name = "top"
|
1049
|
+
top.type = "bucket"
|
1050
|
+
}
|
1051
|
+
|
1052
|
+
bucket = top
|
1053
|
+
|
1054
|
+
file = tempfile()
|
1055
|
+
depth.times do |i|
|
1056
|
+
objects = []
|
1057
|
+
width.times do |j|
|
1058
|
+
path = tempfile + i.to_s
|
1059
|
+
obj = Puppet::TransObject.new("file", path)
|
1060
|
+
obj["owner"] = "root"
|
1061
|
+
obj["mode"] = "644"
|
1062
|
+
|
1063
|
+
# Yield, if they want
|
1064
|
+
if block_given?
|
1065
|
+
yield(obj, i, j)
|
1066
|
+
end
|
1067
|
+
|
1068
|
+
objects << obj
|
1069
|
+
end
|
1070
|
+
|
1071
|
+
newbucket = mk_transbucket(*objects)
|
1072
|
+
|
1073
|
+
bucket.push newbucket
|
1074
|
+
bucket = newbucket
|
1075
|
+
end
|
1076
|
+
|
1077
|
+
return top
|
1078
|
+
end
|
1079
|
+
|
1080
|
+
# Take a list of AST objects, evaluate them, and return the results
|
1081
|
+
def assert_evaluate(children)
|
1082
|
+
top = nil
|
1083
|
+
assert_nothing_raised("Could not create top object") {
|
1084
|
+
top = AST::ASTArray.new(
|
1085
|
+
:children => children
|
1086
|
+
)
|
1087
|
+
}
|
1088
|
+
|
1089
|
+
trans = nil
|
1090
|
+
scope = nil
|
1091
|
+
assert_nothing_raised {
|
1092
|
+
scope = Puppet::Parser::Scope.new()
|
1093
|
+
trans = scope.evaluate(:ast => top)
|
1094
|
+
}
|
1095
|
+
|
1096
|
+
return trans
|
1097
|
+
end
|
926
1098
|
end
|
927
1099
|
|
928
1100
|
class PuppetTestSuite
|
@@ -995,4 +1167,4 @@ def failers
|
|
995
1167
|
}
|
996
1168
|
end
|
997
1169
|
|
998
|
-
# $Id: puppettest.rb
|
1170
|
+
# $Id: puppettest.rb 1422 2006-07-22 03:32:56Z luke $
|
data/test/server/authstore.rb
CHANGED
@@ -114,9 +114,9 @@ class TestAuthStore < Test::Unit::TestCase
|
|
114
114
|
assert(store.allowed?("hosttest.com", ip), "IP %s not allowed" % ip)
|
115
115
|
}
|
116
116
|
|
117
|
-
assert_raise(Puppet::Server::AuthStoreError) {
|
118
|
-
|
119
|
-
}
|
117
|
+
#assert_raise(Puppet::Server::AuthStoreError) {
|
118
|
+
# store.allow("192.168.674.0")
|
119
|
+
#}
|
120
120
|
|
121
121
|
assert_raise(Puppet::Server::AuthStoreError) {
|
122
122
|
store.allow("192.168.0")
|
@@ -203,7 +203,16 @@ class TestAuthStore < Test::Unit::TestCase
|
|
203
203
|
assert(store.allowed?(*ary), "Failed to allow %s" % [ary.join(",")])
|
204
204
|
}
|
205
205
|
end
|
206
|
+
|
207
|
+
# Make sure people can specify TLDs
|
208
|
+
def test_match_tlds
|
209
|
+
store = mkstore
|
210
|
+
|
211
|
+
assert_nothing_raised {
|
212
|
+
store.allow("*.tld")
|
213
|
+
}
|
214
|
+
end
|
206
215
|
end
|
207
216
|
|
208
|
-
# $Id: authstore.rb
|
217
|
+
# $Id: authstore.rb 1271 2006-06-13 23:49:53Z luke $
|
209
218
|
|
data/test/server/bucket.rb
CHANGED
@@ -22,9 +22,10 @@ class TestBucket < Test::Unit::TestCase
|
|
22
22
|
@num = 1
|
23
23
|
end
|
24
24
|
|
25
|
-
Puppet.err "#{Process.pid}: %s: %s" % [@num, memory()]
|
26
|
-
|
25
|
+
#Puppet.err "#{Process.pid}: %s: %s" % [@num, memory()]
|
26
|
+
#gcdebug(String)
|
27
27
|
end
|
28
|
+
|
28
29
|
# run through all of the files and exercise the filebucket methods
|
29
30
|
def checkfiles(client)
|
30
31
|
files = filelist()
|
@@ -66,6 +67,9 @@ class TestBucket < Test::Unit::TestCase
|
|
66
67
|
assert(tsum == osum)
|
67
68
|
|
68
69
|
# modify our tmp file
|
70
|
+
unless FileTest.writable?(tmppath)
|
71
|
+
File.chmod(0644, tmppath)
|
72
|
+
end
|
69
73
|
File.open(tmppath,File::WRONLY|File::TRUNC) { |wf|
|
70
74
|
wf.print "This is some test text\n"
|
71
75
|
}
|
@@ -109,7 +113,7 @@ class TestBucket < Test::Unit::TestCase
|
|
109
113
|
end
|
110
114
|
|
111
115
|
%w{
|
112
|
-
who bash
|
116
|
+
who bash sh uname /etc/passwd /etc/syslog.conf /etc/hosts
|
113
117
|
}.each { |file|
|
114
118
|
# if it's fully qualified, just add it
|
115
119
|
if file =~ /^\//
|
@@ -136,9 +140,7 @@ class TestBucket < Test::Unit::TestCase
|
|
136
140
|
|
137
141
|
def setup
|
138
142
|
super
|
139
|
-
@bucket =
|
140
|
-
|
141
|
-
@@tmpfiles << @bucket
|
143
|
+
@bucket = tempfile()
|
142
144
|
end
|
143
145
|
|
144
146
|
#def teardown
|
@@ -234,8 +236,31 @@ class TestBucket < Test::Unit::TestCase
|
|
234
236
|
unless pid
|
235
237
|
raise "Uh, we don't have a child pid"
|
236
238
|
end
|
237
|
-
|
239
|
+
Process.kill("TERM", pid)
|
240
|
+
end
|
241
|
+
|
242
|
+
def test_no_path_duplicates
|
243
|
+
bucket = nil
|
244
|
+
assert_nothing_raised {
|
245
|
+
bucket = Puppet::Server::FileBucket.new(
|
246
|
+
:Bucket => @bucket
|
247
|
+
)
|
248
|
+
}
|
249
|
+
|
250
|
+
sum = nil
|
251
|
+
assert_nothing_raised {
|
252
|
+
sum = bucket.addfile("yayness", "/my/file")
|
253
|
+
}
|
254
|
+
assert_nothing_raised {
|
255
|
+
bucket.addfile("yayness", "/my/file")
|
256
|
+
}
|
257
|
+
|
258
|
+
pathfile = File.join(bucket.path, sum, "paths")
|
259
|
+
|
260
|
+
assert(FileTest.exists?(pathfile), "No path file at %s" % pathfile)
|
261
|
+
|
262
|
+
assert_equal("/my/file\n", File.read(pathfile))
|
238
263
|
end
|
239
264
|
end
|
240
265
|
|
241
|
-
# $Id: bucket.rb
|
266
|
+
# $Id: bucket.rb 1392 2006-07-11 20:58:25Z luke $
|