puppet 0.13.0 → 0.13.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.
- data/CHANGELOG +5 -0
- data/Rakefile +2 -0
- data/bin/puppetd +2 -3
- data/bin/puppetmasterd +1 -3
- data/conf/redhat/client.init +3 -3
- data/conf/redhat/client.sysconfig +1 -1
- data/conf/redhat/logrotate +8 -0
- data/conf/redhat/puppet.spec +26 -2
- data/conf/redhat/puppetd.conf +5 -0
- data/conf/redhat/puppetmasterd.conf +5 -0
- data/conf/redhat/server.init +3 -3
- data/examples/code/snippets/aliastest.pp +16 -0
- data/ext/module_puppet +10 -11
- data/lib/puppet.rb +5 -4
- data/lib/puppet/client.rb +4 -4
- data/lib/puppet/daemon.rb +3 -2
- data/lib/puppet/filetype.rb +18 -6
- data/lib/puppet/lock.rb +64 -0
- data/lib/puppet/parser/ast/objectdef.rb +2 -2
- data/lib/puppet/parser/scope.rb +5 -1
- data/lib/puppet/sslcertificates/ca.rb +1 -3
- data/lib/puppet/statechange.rb +6 -5
- data/lib/puppet/storage.rb +9 -11
- data/lib/puppet/transportable.rb +46 -19
- data/lib/puppet/type.rb +108 -41
- data/lib/puppet/type/cron.rb +45 -17
- data/lib/puppet/type/parsedtype.rb +3 -2
- data/lib/puppet/type/pfile.rb +7 -1
- data/lib/puppet/type/pfile/checksum.rb +1 -2
- data/lib/puppet/util.rb +106 -57
- data/test/language/ast.rb +6 -6
- data/test/language/snippets.rb +6 -0
- data/test/puppet/utiltest.rb +34 -1
- data/test/puppettest.rb +9 -1
- data/test/types/cron.rb +40 -1
- data/test/types/schedule.rb +2 -2
- data/test/types/type.rb +26 -1
- metadata +7 -2
data/test/puppet/utiltest.rb
CHANGED
@@ -10,6 +10,39 @@ require 'test/unit'
|
|
10
10
|
|
11
11
|
class TestPuppetUtil < Test::Unit::TestCase
|
12
12
|
include TestPuppet
|
13
|
+
|
14
|
+
# we're getting corrupt files, probably because multiple processes
|
15
|
+
# are reading or writing the file at once
|
16
|
+
# so we need to test that
|
17
|
+
def test_multiwrite
|
18
|
+
file = tempfile()
|
19
|
+
File.open(file, "w") { |f| f.puts "starting" }
|
20
|
+
|
21
|
+
value = {:a => :b}
|
22
|
+
threads = []
|
23
|
+
sync = Sync.new
|
24
|
+
9.times { |a|
|
25
|
+
threads << Thread.new {
|
26
|
+
9.times { |b|
|
27
|
+
assert_nothing_raised {
|
28
|
+
sync.synchronize(Sync::SH) {
|
29
|
+
Puppet::Util.readlock(file) { |f|
|
30
|
+
f.read
|
31
|
+
}
|
32
|
+
}
|
33
|
+
sleep 0.01
|
34
|
+
sync.synchronize(Sync::EX) {
|
35
|
+
Puppet::Util.writelock(file) { |f|
|
36
|
+
f.puts "%s %s" % [a, b]
|
37
|
+
}
|
38
|
+
}
|
39
|
+
}
|
40
|
+
}
|
41
|
+
}
|
42
|
+
}
|
43
|
+
threads.each { |th| th.join }
|
44
|
+
end
|
45
|
+
|
13
46
|
unless Process.uid == 0
|
14
47
|
$stderr.puts "Run as root to perform Utility tests"
|
15
48
|
def test_nothing
|
@@ -120,4 +153,4 @@ class TestPuppetUtil < Test::Unit::TestCase
|
|
120
153
|
end
|
121
154
|
end
|
122
155
|
|
123
|
-
# $Id: utiltest.rb
|
156
|
+
# $Id: utiltest.rb 897 2006-02-12 18:08:39Z luke $
|
data/test/puppettest.rb
CHANGED
@@ -57,6 +57,14 @@ module TestPuppet
|
|
57
57
|
Puppet[:ignoreschedules] = true
|
58
58
|
end
|
59
59
|
|
60
|
+
def newobj(type, name, hash)
|
61
|
+
transport = Puppet::TransObject.new(name, "file")
|
62
|
+
transport[:path] = path
|
63
|
+
transport[:ensure] = "file"
|
64
|
+
assert_nothing_raised {
|
65
|
+
file = transport.to_type
|
66
|
+
}
|
67
|
+
end
|
60
68
|
|
61
69
|
def spin
|
62
70
|
# Just disable spin, unless we really need it
|
@@ -879,4 +887,4 @@ def failers
|
|
879
887
|
}
|
880
888
|
end
|
881
889
|
|
882
|
-
# $Id: puppettest.rb
|
890
|
+
# $Id: puppettest.rb 896 2006-02-10 22:00:30Z luke $
|
data/test/types/cron.rb
CHANGED
@@ -323,6 +323,45 @@ class TestCron < Test::Unit::TestCase
|
|
323
323
|
}
|
324
324
|
}
|
325
325
|
end
|
326
|
+
|
327
|
+
# Test that we can read and write cron tabs
|
328
|
+
def test_crontab
|
329
|
+
Puppet.type(:cron).filetype = Puppet.type(:cron).defaulttype
|
330
|
+
type = nil
|
331
|
+
unless type = Puppet.type(:cron).filetype
|
332
|
+
$stderr.puts "No crontab type; skipping test"
|
333
|
+
end
|
334
|
+
|
335
|
+
obj = nil
|
336
|
+
assert_nothing_raised {
|
337
|
+
obj = type.new(Process.uid)
|
338
|
+
}
|
339
|
+
|
340
|
+
txt = nil
|
341
|
+
assert_nothing_raised {
|
342
|
+
txt = obj.read
|
343
|
+
}
|
344
|
+
|
345
|
+
assert_nothing_raised {
|
346
|
+
obj.write(txt)
|
347
|
+
}
|
348
|
+
end
|
349
|
+
|
350
|
+
# Verify that comma-separated numbers are not resulting in rewrites
|
351
|
+
def test_norewrite
|
352
|
+
cron = nil
|
353
|
+
assert_nothing_raised {
|
354
|
+
cron = Puppet.type(:cron).create(
|
355
|
+
:command => "/bin/date > /dev/null",
|
356
|
+
:minute => [0, 30],
|
357
|
+
:name => "crontest"
|
358
|
+
)
|
359
|
+
}
|
360
|
+
|
361
|
+
assert_events([:cron_created], cron)
|
362
|
+
cron.retrieve
|
363
|
+
assert_events([], cron)
|
364
|
+
end
|
326
365
|
end
|
327
366
|
|
328
|
-
# $Id: cron.rb
|
367
|
+
# $Id: cron.rb 899 2006-02-13 17:48:33Z luke $
|
data/test/types/schedule.rb
CHANGED
@@ -145,7 +145,7 @@ class TestSchedule < Test::Unit::TestCase
|
|
145
145
|
"%s matched %s incorrectly" % [value.inspect, @now])
|
146
146
|
}
|
147
147
|
|
148
|
-
assert_nothing_raised("Could not parse %s" % values) {
|
148
|
+
assert_nothing_raised("Could not parse %s" % [values]) {
|
149
149
|
s[:range] = values
|
150
150
|
}
|
151
151
|
|
@@ -332,4 +332,4 @@ class TestSchedule < Test::Unit::TestCase
|
|
332
332
|
end
|
333
333
|
end
|
334
334
|
|
335
|
-
# $Id: schedule.rb
|
335
|
+
# $Id: schedule.rb 897 2006-02-12 18:08:39Z luke $
|
data/test/types/type.rb
CHANGED
@@ -186,6 +186,31 @@ class TestType < Test::Unit::TestCase
|
|
186
186
|
|
187
187
|
assert(twoobj.requires?(oneobj), "Requirement was not created")
|
188
188
|
end
|
189
|
+
|
190
|
+
# Verify that names are aliases, not equivalents
|
191
|
+
def test_nameasalias
|
192
|
+
file = nil
|
193
|
+
path = tempfile()
|
194
|
+
name = "a test file"
|
195
|
+
transport = Puppet::TransObject.new(name, "file")
|
196
|
+
transport[:path] = path
|
197
|
+
transport[:ensure] = "file"
|
198
|
+
assert_nothing_raised {
|
199
|
+
file = transport.to_type
|
200
|
+
}
|
201
|
+
|
202
|
+
assert_equal(path, file[:path])
|
203
|
+
assert_equal([name], file[:alias])
|
204
|
+
|
205
|
+
assert_nothing_raised {
|
206
|
+
file.retrieve
|
207
|
+
}
|
208
|
+
|
209
|
+
assert_apply(file)
|
210
|
+
|
211
|
+
assert(Puppet.type(:file)[name], "Could not look up object by name")
|
212
|
+
#assert(Puppet.type(:file)[path], "Could not look up object by path")
|
213
|
+
end
|
189
214
|
end
|
190
215
|
|
191
|
-
# $Id: type.rb
|
216
|
+
# $Id: type.rb 896 2006-02-10 22:00:30Z luke $
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
|
|
3
3
|
specification_version: 1
|
4
4
|
name: puppet
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.13.
|
7
|
-
date: 2006-02-
|
6
|
+
version: 0.13.1
|
7
|
+
date: 2006-02-13 00:00:00 -06:00
|
8
8
|
summary: Puppet is a server configuration management tool.
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -45,6 +45,7 @@ files:
|
|
45
45
|
- lib/puppet/daemon.rb
|
46
46
|
- lib/puppet/server.rb
|
47
47
|
- lib/puppet/transaction.rb
|
48
|
+
- lib/puppet/lock.rb
|
48
49
|
- lib/puppet/filetype.rb
|
49
50
|
- lib/puppet/event-loop.rb
|
50
51
|
- lib/puppet/log.rb
|
@@ -249,6 +250,7 @@ files:
|
|
249
250
|
- examples/code/snippets/classincludes.pp
|
250
251
|
- examples/code/snippets/scopetest
|
251
252
|
- examples/code/snippets/multipleinstances
|
253
|
+
- examples/code/snippets/aliastest.pp
|
252
254
|
- examples/code/snippets/classheirarchy.pp
|
253
255
|
- examples/code/snippets/implicititeration
|
254
256
|
- examples/code/snippets/simpledefaults
|
@@ -271,11 +273,14 @@ files:
|
|
271
273
|
- examples/root/etc/puppet/fileserver.conf
|
272
274
|
- examples/root/etc/puppet/puppetmasterd.conf
|
273
275
|
- conf/redhat
|
276
|
+
- conf/redhat/puppetd.conf
|
274
277
|
- conf/redhat/fileserver.conf
|
275
278
|
- conf/redhat/client.init
|
276
279
|
- conf/redhat/server.init
|
277
280
|
- conf/redhat/client.sysconfig
|
281
|
+
- conf/redhat/logrotate
|
278
282
|
- conf/redhat/puppet.spec
|
283
|
+
- conf/redhat/puppetmasterd.conf
|
279
284
|
- conf/redhat/server.sysconfig
|
280
285
|
test_files:
|
281
286
|
- test/test
|