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/types/group.rb
CHANGED
@@ -4,7 +4,7 @@ if __FILE__ == $0
|
|
4
4
|
$puppetbase = "../../../../language/trunk"
|
5
5
|
end
|
6
6
|
|
7
|
-
# $Id: group.rb
|
7
|
+
# $Id: group.rb 1416 2006-07-21 19:05:30Z luke $
|
8
8
|
|
9
9
|
require 'etc'
|
10
10
|
require 'puppet/type'
|
@@ -28,6 +28,16 @@ class TestGroup < Test::Unit::TestCase
|
|
28
28
|
super
|
29
29
|
end
|
30
30
|
|
31
|
+
def mkgroup(name, hash = {})
|
32
|
+
group = nil
|
33
|
+
hash[:name] = name
|
34
|
+
assert_nothing_raised {
|
35
|
+
group = Puppet.type(:group).create(hash)
|
36
|
+
}
|
37
|
+
|
38
|
+
return group
|
39
|
+
end
|
40
|
+
|
31
41
|
case Facter["operatingsystem"].value
|
32
42
|
when "Darwin":
|
33
43
|
def missing?(group)
|
@@ -287,6 +297,26 @@ class TestGroup < Test::Unit::TestCase
|
|
287
297
|
|
288
298
|
assert(missing?(name), "Group %s is still present" % name)
|
289
299
|
end
|
300
|
+
|
301
|
+
# groupadd -o is broken in FreeBSD.
|
302
|
+
unless Facter["operatingsystem"].value == "FreeBSD"
|
303
|
+
def test_duplicateIDs
|
304
|
+
group1 = mkgroup("group1", :gid => 125)
|
305
|
+
group2 = mkgroup("group2", :gid => 125)
|
306
|
+
|
307
|
+
assert_apply(group1)
|
308
|
+
|
309
|
+
# Not all OSes fail here, so we can't test that it doesn't work with
|
310
|
+
# it off, only that it does work with it on.
|
311
|
+
assert_nothing_raised {
|
312
|
+
group2[:allowdupe] = true
|
313
|
+
}
|
314
|
+
assert_apply(group2)
|
315
|
+
group2.retrieve
|
316
|
+
assert_equal(:present, group2.state(:ensure).is,
|
317
|
+
"Group did not get created")
|
318
|
+
end
|
319
|
+
end
|
290
320
|
else
|
291
321
|
$stderr.puts "Not running as root; skipping group creation tests."
|
292
322
|
end
|
data/test/types/host.rb
CHANGED
@@ -21,6 +21,7 @@ class TestHost < Test::Unit::TestCase
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def teardown
|
24
|
+
Puppet::FileType.filetype(:ram).clear
|
24
25
|
@hosttype.filetype = @oldhosttype
|
25
26
|
Puppet.type(:file).clear
|
26
27
|
super
|
@@ -182,4 +183,4 @@ class TestHost < Test::Unit::TestCase
|
|
182
183
|
end
|
183
184
|
end
|
184
185
|
|
185
|
-
# $Id: host.rb
|
186
|
+
# $Id: host.rb 1421 2006-07-21 23:12:51Z luke $
|
data/test/types/mount.rb
CHANGED
@@ -93,6 +93,7 @@ class TestMounts < Test::Unit::TestCase
|
|
93
93
|
|
94
94
|
unless Facter["operatingsystem"].value == "Darwin"
|
95
95
|
def test_mountsparse
|
96
|
+
use_fake_fstab
|
96
97
|
assert_nothing_raised {
|
97
98
|
@mounttype.retrieve
|
98
99
|
}
|
@@ -104,6 +105,7 @@ class TestMounts < Test::Unit::TestCase
|
|
104
105
|
|
105
106
|
def test_rootfs
|
106
107
|
fs = nil
|
108
|
+
use_fake_fstab
|
107
109
|
assert_nothing_raised {
|
108
110
|
Puppet.type(:mount).retrieve
|
109
111
|
}
|
@@ -121,6 +123,7 @@ class TestMounts < Test::Unit::TestCase
|
|
121
123
|
|
122
124
|
# Make sure it reads and writes correctly.
|
123
125
|
def test_readwrite
|
126
|
+
use_fake_fstab
|
124
127
|
assert_nothing_raised {
|
125
128
|
Puppet::Type.type(:mount).retrieve
|
126
129
|
}
|
@@ -272,6 +275,20 @@ class TestMounts < Test::Unit::TestCase
|
|
272
275
|
end
|
273
276
|
end
|
274
277
|
end
|
278
|
+
|
279
|
+
def use_fake_fstab
|
280
|
+
os = Facter['operatingsystem']
|
281
|
+
if os == "Solaris"
|
282
|
+
name = "solaris.fstab"
|
283
|
+
elsif os == "FreeBSD"
|
284
|
+
name = "freebsd.fstab"
|
285
|
+
else
|
286
|
+
# Catchall for other fstabs
|
287
|
+
name = "linux.fstab"
|
288
|
+
end
|
289
|
+
fstab = fakefile(File::join("data/types/mount", name))
|
290
|
+
Puppet::Type.type(:mount).path = fstab
|
291
|
+
end
|
275
292
|
end
|
276
293
|
|
277
|
-
# $Id: mount.rb
|
294
|
+
# $Id: mount.rb 1343 2006-06-30 01:43:02Z lutter $
|
data/test/types/package.rb
CHANGED
@@ -15,18 +15,6 @@ unless Puppet.type(:package).default
|
|
15
15
|
puts "No default package type for %s; skipping package tests" % $platform
|
16
16
|
else
|
17
17
|
|
18
|
-
class TestPackageSource < Test::Unit::TestCase
|
19
|
-
include TestPuppet
|
20
|
-
def test_filesource
|
21
|
-
path = tempfile()
|
22
|
-
system("touch %s" % path)
|
23
|
-
assert_equal(
|
24
|
-
path,
|
25
|
-
Puppet::PackageSource.get("file://#{path}")
|
26
|
-
)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
18
|
class TestPackages < Test::Unit::TestCase
|
31
19
|
include FileTesting
|
32
20
|
def setup
|
@@ -61,10 +49,13 @@ class TestPackages < Test::Unit::TestCase
|
|
61
49
|
end
|
62
50
|
end
|
63
51
|
|
64
|
-
def mkpkgs(list = nil)
|
52
|
+
def mkpkgs(list = nil, useensure = true)
|
65
53
|
list ||= tstpkgs()
|
66
54
|
list.each { |pkg, source|
|
67
|
-
hash = {:name => pkg
|
55
|
+
hash = {:name => pkg}
|
56
|
+
if useensure
|
57
|
+
hash[:ensure] = "latest"
|
58
|
+
end
|
68
59
|
if source
|
69
60
|
source = source[0] if source.is_a? Array
|
70
61
|
hash[:source] = source
|
@@ -150,7 +141,8 @@ class TestPackages < Test::Unit::TestCase
|
|
150
141
|
obj = nil
|
151
142
|
assert_nothing_raised {
|
152
143
|
obj = Puppet.type(:package).create(
|
153
|
-
:name => "thispackagedoesnotexist"
|
144
|
+
:name => "thispackagedoesnotexist",
|
145
|
+
:ensure => :installed
|
154
146
|
)
|
155
147
|
}
|
156
148
|
|
@@ -162,6 +154,18 @@ class TestPackages < Test::Unit::TestCase
|
|
162
154
|
|
163
155
|
assert_equal(:absent, obj.is(:ensure),
|
164
156
|
"Somehow retrieved unknown pkg's version")
|
157
|
+
|
158
|
+
state = obj.state(:ensure)
|
159
|
+
assert(state, "Could not retrieve ensure state")
|
160
|
+
|
161
|
+
# Add a fake state, for those that need it
|
162
|
+
file = tempfile()
|
163
|
+
File.open(file, "w") { |f| f.puts :yayness }
|
164
|
+
obj[:source] = file
|
165
|
+
assert_raise(Puppet::PackageError,
|
166
|
+
"Successfully installed nonexistent package") {
|
167
|
+
state.sync
|
168
|
+
}
|
165
169
|
end
|
166
170
|
|
167
171
|
def test_specifypkgtype
|
@@ -180,7 +184,8 @@ class TestPackages < Test::Unit::TestCase
|
|
180
184
|
mkpkgs { |pkg|
|
181
185
|
next unless pkg.respond_to? :latest
|
182
186
|
assert_nothing_raised {
|
183
|
-
assert(pkg.latest,
|
187
|
+
assert(pkg.latest,
|
188
|
+
"Package %s did not return value for 'latest'" % pkg.name)
|
184
189
|
}
|
185
190
|
}
|
186
191
|
end
|
@@ -208,7 +213,7 @@ class TestPackages < Test::Unit::TestCase
|
|
208
213
|
pkg.retrieve
|
209
214
|
}
|
210
215
|
|
211
|
-
if pkg.insync?
|
216
|
+
if pkg.insync? or pkg.is(:ensure) != :absent
|
212
217
|
Puppet.notice "Test package %s is already installed; please choose a different package for testing" % pkg
|
213
218
|
next
|
214
219
|
end
|
@@ -256,6 +261,25 @@ class TestPackages < Test::Unit::TestCase
|
|
256
261
|
}
|
257
262
|
end
|
258
263
|
|
264
|
+
# Make sure that a default is used for 'ensure'
|
265
|
+
def test_ensuredefault
|
266
|
+
# Tell mkpkgs not to set 'ensure'.
|
267
|
+
mkpkgs(nil, false) { |pkg|
|
268
|
+
assert_nothing_raised {
|
269
|
+
pkg.retrieve
|
270
|
+
}
|
271
|
+
|
272
|
+
assert(!pkg.insync?, "Package thinks it's in sync")
|
273
|
+
|
274
|
+
assert_apply(pkg)
|
275
|
+
pkg.retrieve
|
276
|
+
assert(pkg.insync?, "Package does not think it's in sync")
|
277
|
+
|
278
|
+
pkg[:ensure] = :absent
|
279
|
+
assert_apply(pkg)
|
280
|
+
}
|
281
|
+
end
|
282
|
+
|
259
283
|
def test_upgradepkg
|
260
284
|
tstpkgs.each do |name, sources|
|
261
285
|
unless sources and sources.is_a? Array
|
@@ -349,8 +373,166 @@ class TestPackages < Test::Unit::TestCase
|
|
349
373
|
assert(FileTest.exists?("/tmp/pkgtesting/file"), "File did not get created")
|
350
374
|
end
|
351
375
|
end
|
376
|
+
|
377
|
+
# Yay, gems. They're special because any OS can test them.
|
378
|
+
if %x{which gem 2>/dev/null}.chomp != ""
|
379
|
+
def test_list_gems
|
380
|
+
gems = nil
|
381
|
+
assert_nothing_raised {
|
382
|
+
gems = Puppet::Type.type(:package).pkgtype(:gem).list
|
383
|
+
}
|
384
|
+
|
385
|
+
gems.each do |gem|
|
386
|
+
assert_equal(:gem, gem[:type],
|
387
|
+
"Type was not set correctly")
|
388
|
+
end
|
389
|
+
end
|
390
|
+
|
391
|
+
def test_install_gems
|
392
|
+
gem = nil
|
393
|
+
name = "wxrubylayouts"
|
394
|
+
assert_nothing_raised {
|
395
|
+
gem = Puppet::Type.newpackage(
|
396
|
+
:name => name,
|
397
|
+
:version => "0.0.2",
|
398
|
+
:ensure => "installed",
|
399
|
+
:type => :gem
|
400
|
+
)
|
401
|
+
}
|
402
|
+
|
403
|
+
assert_nothing_raised {
|
404
|
+
gem.retrieve
|
405
|
+
}
|
406
|
+
|
407
|
+
if gem.is(:ensure) != :absent
|
408
|
+
$stderr.puts "Cannot test gem installation; %s is already installed" %
|
409
|
+
name
|
410
|
+
return
|
411
|
+
end
|
412
|
+
|
413
|
+
assert_events([:package_created], gem)
|
414
|
+
|
415
|
+
assert_nothing_raised {
|
416
|
+
gem.retrieve
|
417
|
+
}
|
418
|
+
|
419
|
+
assert_equal("0.0.2", gem.is(:ensure),
|
420
|
+
"Incorrect version was installed")
|
421
|
+
|
422
|
+
latest = nil
|
423
|
+
assert_nothing_raised {
|
424
|
+
latest = gem.latest
|
425
|
+
}
|
426
|
+
|
427
|
+
assert(latest != gem[:version], "Did not correctly find latest value")
|
428
|
+
|
429
|
+
gem[:ensure] = :latest
|
430
|
+
assert_events([:package_changed], gem)
|
431
|
+
|
432
|
+
gem.retrieve
|
433
|
+
|
434
|
+
assert("0.0.2" != gem.is(:ensure),
|
435
|
+
"Package was not updated.")
|
436
|
+
|
437
|
+
gem[:ensure] = :absent
|
438
|
+
|
439
|
+
assert_events([:package_removed], gem)
|
440
|
+
end
|
441
|
+
|
442
|
+
else
|
443
|
+
def test_nogems_nofailures
|
444
|
+
obj = nil
|
445
|
+
assert_nothing_raised do
|
446
|
+
Puppet::Type.newpackage(
|
447
|
+
:name => "yayness",
|
448
|
+
:type => "gem",
|
449
|
+
:ensure => "installed"
|
450
|
+
)
|
451
|
+
end
|
452
|
+
|
453
|
+
assert_nil(Puppet::Type.type(:package)["yayness"],
|
454
|
+
"Invalid gem package got created")
|
455
|
+
end
|
456
|
+
end
|
457
|
+
end
|
458
|
+
if ["Fedora", "RedHat", "CentOS"].include?(Facter["operatingsystem"].value) and
|
459
|
+
FileTest.exists?("/home/luke/rpm/RPMS/i386/puppet-server-0.16.1-1.i386.rpm")
|
460
|
+
|
461
|
+
# We have a special test here, because we don't actually want to install the
|
462
|
+
# package, just make sure it's getting the "latest" value.
|
463
|
+
def test_rpmlatest
|
464
|
+
pkg = nil
|
465
|
+
assert_nothing_raised {
|
466
|
+
pkg = Puppet::Type.type(:package).create(
|
467
|
+
:type => :rpm,
|
468
|
+
:name => "puppet-server",
|
469
|
+
:source => "/home/luke/rpm/RPMS/i386/puppet-server-0.16.1-1.i386.rpm"
|
470
|
+
)
|
471
|
+
}
|
472
|
+
|
473
|
+
assert_equal("0.16.1-1", pkg.latest, "RPM did not provide correct value for latest")
|
474
|
+
end
|
475
|
+
end
|
476
|
+
|
477
|
+
if Facter["operatingsystem"].value == "Solaris"
|
478
|
+
if pkgget = %x{which pkg-get 2>/dev/null}.chomp and pkgget != ""
|
479
|
+
# FIXME The packaging crap needs to be rewritten to support testing
|
480
|
+
# multiple package types on the same platform.
|
481
|
+
def test_list_blastwave
|
482
|
+
pkgs = nil
|
483
|
+
assert_nothing_raised {
|
484
|
+
pkgs = Puppet::Type.type(:package).pkgtype(:blastwave).list
|
485
|
+
}
|
486
|
+
|
487
|
+
pkgs.each do |pkg|
|
488
|
+
if pkg[:name] =~ /^CSW/
|
489
|
+
assert_equal(:blastwave, pkg[:type],
|
490
|
+
"Type was not set correctly")
|
491
|
+
end
|
492
|
+
end
|
493
|
+
end
|
494
|
+
|
495
|
+
def test_install_blastwave
|
496
|
+
pkg = nil
|
497
|
+
name = "cabextract"
|
498
|
+
assert_nothing_raised {
|
499
|
+
pkg = Puppet::Type.newpackage(
|
500
|
+
:name => name,
|
501
|
+
:ensure => "installed",
|
502
|
+
:type => :blastwave
|
503
|
+
)
|
504
|
+
}
|
505
|
+
|
506
|
+
assert_nothing_raised {
|
507
|
+
pkg.retrieve
|
508
|
+
}
|
509
|
+
|
510
|
+
if pkg.is(:ensure) != :absent
|
511
|
+
p pkg.is(:ensure)
|
512
|
+
$stderr.puts "Cannot test pkg installation; %s is already installed" %
|
513
|
+
name
|
514
|
+
return
|
515
|
+
end
|
516
|
+
|
517
|
+
assert_events([:package_created], pkg)
|
518
|
+
|
519
|
+
assert_nothing_raised {
|
520
|
+
pkg.retrieve
|
521
|
+
}
|
522
|
+
|
523
|
+
latest = nil
|
524
|
+
assert_nothing_raised {
|
525
|
+
latest = pkg.latest
|
526
|
+
}
|
527
|
+
pkg[:ensure] = :absent
|
528
|
+
|
529
|
+
assert_events([:package_removed], pkg)
|
530
|
+
end
|
531
|
+
else
|
532
|
+
$stderr.puts "No pkg-get scripting; skipping blastwave tests"
|
533
|
+
end
|
352
534
|
end
|
353
535
|
end
|
354
536
|
end
|
355
537
|
|
356
|
-
# $Id: package.rb
|
538
|
+
# $Id: package.rb 1356 2006-07-04 05:45:28Z luke $
|
data/test/types/service.rb
CHANGED
@@ -37,6 +37,8 @@ class TestInitService
|
|
37
37
|
case Facter["operatingsystem"].value.downcase
|
38
38
|
when "solaris":
|
39
39
|
return ["smtp", "xf"]
|
40
|
+
when "redhat":
|
41
|
+
return ["sshd"]
|
40
42
|
end
|
41
43
|
end
|
42
44
|
|
@@ -134,6 +136,8 @@ class TestLocalService < Test::Unit::TestCase
|
|
134
136
|
return {"hddtemp" => {}}
|
135
137
|
when "centos":
|
136
138
|
return {"cups" => {:hasstatus => true}}
|
139
|
+
when "redhat":
|
140
|
+
return {"saslauthd" => {:hasstatus => true}}
|
137
141
|
end
|
138
142
|
|
139
143
|
Puppet.notice "No test services for %s-%s" %
|
@@ -303,4 +307,4 @@ class TestLocalService < Test::Unit::TestCase
|
|
303
307
|
end
|
304
308
|
end
|
305
309
|
|
306
|
-
# $Id: service.rb
|
310
|
+
# $Id: service.rb 1265 2006-06-13 22:55:14Z luke $
|
data/test/types/sshkey.rb
CHANGED
@@ -22,6 +22,7 @@ class TestSSHKey < Test::Unit::TestCase
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def teardown
|
25
|
+
Puppet::FileType.filetype(:ram).clear
|
25
26
|
@sshtype.filetype = @oldfiletype
|
26
27
|
Puppet.type(:file).clear
|
27
28
|
super
|
@@ -178,4 +179,4 @@ class TestSSHKey < Test::Unit::TestCase
|
|
178
179
|
end
|
179
180
|
end
|
180
181
|
|
181
|
-
# $Id: sshkey.rb
|
182
|
+
# $Id: sshkey.rb 1421 2006-07-21 23:12:51Z luke $
|
data/test/types/symlink.rb
CHANGED
@@ -8,7 +8,7 @@ require 'puppet'
|
|
8
8
|
require 'puppettest'
|
9
9
|
require 'test/unit'
|
10
10
|
|
11
|
-
# $Id: symlink.rb
|
11
|
+
# $Id: symlink.rb 1256 2006-06-13 15:57:06Z luke $
|
12
12
|
|
13
13
|
class TestSymlink < Test::Unit::TestCase
|
14
14
|
include FileTesting
|
@@ -41,6 +41,7 @@ class TestSymlink < Test::Unit::TestCase
|
|
41
41
|
unless hash.include?(:ensure)
|
42
42
|
hash[:ensure] = mktmpfile()
|
43
43
|
end
|
44
|
+
|
44
45
|
link = Puppet.type(:symlink).create(hash)
|
45
46
|
return link
|
46
47
|
end
|
@@ -73,7 +74,7 @@ class TestSymlink < Test::Unit::TestCase
|
|
73
74
|
assert_nothing_raised {
|
74
75
|
link = newlink(:ensure => source, :recurse => true)
|
75
76
|
}
|
76
|
-
comp = newcomp(
|
77
|
+
comp = newcomp(link)
|
77
78
|
cycle(comp)
|
78
79
|
|
79
80
|
path = link.name
|