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.

@@ -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 816 2006-01-12 21:04:06Z luke $
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 873 2006-02-07 23:12:33Z luke $
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 831 2006-01-16 20:01:20Z luke $
367
+ # $Id: cron.rb 899 2006-02-13 17:48:33Z luke $
@@ -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 858 2006-01-30 19:22:25Z luke $
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 832 2006-01-17 07:11:50Z luke $
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.0
7
- date: 2006-02-08 00:00:00 -06:00
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