puppet 0.23.1 → 0.23.2
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 +31 -0
- data/bin/puppetd +2 -1
- data/conf/redhat/puppet.spec +9 -6
- data/conf/redhat/server.init +4 -5
- data/examples/code/mac_dscl.pp +28 -0
- data/examples/code/mac_dscl_revert.pp +26 -0
- data/examples/code/mac_netinfo.pp +5 -0
- data/examples/code/mac_pkgdmg.pp +7 -0
- data/ext/puppet-test +69 -2
- data/lib/puppet.rb +2 -2
- data/lib/puppet/configuration.rb +5 -1
- data/lib/puppet/network/server/mongrel.rb +3 -3
- data/lib/puppet/parser/ast.rb +2 -2
- data/lib/puppet/parser/ast/component.rb +3 -3
- data/lib/puppet/parser/ast/node.rb +2 -2
- data/lib/puppet/parser/collector.rb +2 -2
- data/lib/puppet/parser/interpreter.rb +38 -215
- data/lib/puppet/parser/parser.rb +11 -228
- data/lib/puppet/parser/parser_support.rb +447 -0
- data/lib/puppet/parser/resource/param.rb +2 -2
- data/lib/puppet/provider.rb +5 -3
- data/lib/puppet/provider/cron/crontab.rb +22 -9
- data/lib/puppet/provider/group/directoryservice.rb +23 -0
- data/lib/puppet/provider/interface/redhat.rb +251 -0
- data/lib/puppet/provider/interface/sunos.rb +116 -0
- data/lib/puppet/provider/mount.rb +4 -1
- data/lib/puppet/provider/nameservice/directoryservice.rb +341 -0
- data/lib/puppet/provider/package/dpkg.rb +2 -2
- data/lib/puppet/provider/package/openbsd.rb +2 -2
- data/lib/puppet/provider/package/rpm.rb +2 -4
- data/lib/puppet/provider/package/sun.rb +2 -2
- data/lib/puppet/provider/parsedfile.rb +32 -29
- data/lib/puppet/provider/user/directoryservice.rb +116 -0
- data/lib/puppet/rails/host.rb +1 -1
- data/lib/puppet/reference/configuration.rb +7 -4
- data/lib/puppet/type/interface.rb +57 -0
- data/lib/puppet/type/pfile/group.rb +2 -2
- data/lib/puppet/util/config.rb +10 -3
- data/lib/puppet/util/fileparsing.rb +2 -2
- data/test/language/ast/hostclass.rb +1 -17
- data/test/language/interpreter.rb +18 -388
- data/test/language/node.rb +8 -8
- data/test/language/parser.rb +444 -45
- data/test/lib/puppettest/parsertesting.rb +2 -2
- data/test/lib/puppettest/support/collection.rb +2 -2
- data/test/network/server/mongrel_test.rb +24 -3
- data/test/rails/collection.rb +34 -1
- data/test/ral/providers/cron/crontab.rb +198 -40
- data/test/ral/providers/mount/parsed.rb +69 -46
- data/test/ral/providers/parsedfile.rb +20 -28
- data/test/ral/types/cron.rb +20 -24
- data/test/ral/types/interface.rb +40 -0
- data/test/ral/types/package.rb +6 -2
- data/test/util/config.rb +106 -30
- metadata +14 -2
@@ -35,7 +35,7 @@ class TestParsedFile < Test::Unit::TestCase
|
|
35
35
|
|
36
36
|
# A simple block to skip the complexity of a full transaction.
|
37
37
|
def apply(resource)
|
38
|
-
[:one, :two, :ensure].each do |st|
|
38
|
+
[:one, :two, :ensure, :target].each do |st|
|
39
39
|
Puppet.info "Setting %s: %s => %s" %
|
40
40
|
[resource[:name], st, resource.should(st)]
|
41
41
|
resource.provider.send(st.to_s + "=", resource.should(st))
|
@@ -202,44 +202,36 @@ class TestParsedFile < Test::Unit::TestCase
|
|
202
202
|
prov.target_object(:default).write "will b d\n"
|
203
203
|
|
204
204
|
# Create some resources for some of those demo files
|
205
|
-
|
206
|
-
|
205
|
+
bill = mkresource "bill", :target => :file1, :one => "b", :two => "c"
|
206
|
+
will = mkresource "will", :target => :default, :one => "b", :two => "d"
|
207
207
|
|
208
|
-
resources = {"bill" =>
|
208
|
+
resources = {"bill" => bill, "will" => will}
|
209
|
+
prov_ids = {"bill" => bill.provider.object_id, "will" => will.provider.object_id}
|
209
210
|
|
210
211
|
assert_nothing_raised do
|
211
212
|
prov.prefetch(resources)
|
212
213
|
end
|
213
214
|
|
214
|
-
|
215
|
-
|
216
|
-
assert_equal("c", resource.provider.two, "did not prefetch resource from file1")
|
217
|
-
assert_equal("b", default.provider.one, "did not prefetch resource from default")
|
218
|
-
assert_equal("d", default.provider.two, "did not prefetch resource from default")
|
219
|
-
|
220
|
-
# Now list all of them and make sure we get everything back
|
221
|
-
providers = nil
|
222
|
-
assert_nothing_raised do
|
223
|
-
providers = prov.instances
|
224
|
-
end
|
225
|
-
|
226
|
-
providers.each do |provider|
|
227
|
-
assert_instance_of(prov, provider, "'instances' class method did not return providers")
|
228
|
-
end
|
215
|
+
assert(bill.provider.object_id != prov_ids["bill"], "provider was not replaced in resource")
|
216
|
+
assert(will.provider.object_id != prov_ids["will"], "provider was not replaced in resource")
|
229
217
|
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
218
|
+
# Make sure we prefetched our resources.
|
219
|
+
assert_equal("b", bill.provider.one, "did not prefetch resource from file1")
|
220
|
+
assert_equal("c", bill.provider.two, "did not prefetch resource from file1")
|
221
|
+
assert_equal("b", will.provider.one, "did not prefetch resource from default")
|
222
|
+
assert_equal("d", will.provider.two, "did not prefetch resource from default")
|
234
223
|
|
235
224
|
# Now modify our resources and write them out, making sure that prefetching
|
236
225
|
# hasn't somehow destroyed this ability
|
237
|
-
|
238
|
-
|
226
|
+
bill[:one] = "a"
|
227
|
+
will[:one] = "a"
|
239
228
|
|
229
|
+
assert_apply(bill)
|
230
|
+
assert_apply(will)
|
240
231
|
|
241
|
-
|
242
|
-
|
232
|
+
prov.prefetch(resources)
|
233
|
+
assert_equal("a", bill.provider.one, "did not prefetch resource from file1")
|
234
|
+
assert_equal("a", will.provider.one, "did not prefetch resource from default")
|
243
235
|
|
244
236
|
assert_equal("bill a c\njill b d\n", prov.target_object(:file1).read,
|
245
237
|
"Did not write changed resource correctly")
|
@@ -703,5 +695,5 @@ class TestParsedFile < Test::Unit::TestCase
|
|
703
695
|
end
|
704
696
|
end
|
705
697
|
|
706
|
-
# $Id: parsedfile.rb
|
698
|
+
# $Id: parsedfile.rb 2750 2007-08-06 17:59:37Z luke $
|
707
699
|
|
data/test/ral/types/cron.rb
CHANGED
@@ -25,10 +25,12 @@ class TestCron < Test::Unit::TestCase
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def teardown
|
28
|
+
super
|
28
29
|
@crontype.defaultprovider = nil
|
29
30
|
if defined? @oldfiletype
|
30
31
|
@provider.filetype = @oldfiletype
|
31
32
|
end
|
33
|
+
Puppet::Util::FileType.filetype(:ram).clear
|
32
34
|
end
|
33
35
|
|
34
36
|
def eachprovider
|
@@ -138,11 +140,17 @@ class TestCron < Test::Unit::TestCase
|
|
138
140
|
property = cron.send(:property, :command)
|
139
141
|
cron.provider.command = command
|
140
142
|
cron.provider.ensure = :present
|
143
|
+
cron.provider.user = @me
|
141
144
|
cron.provider.month = ["4"]
|
142
145
|
cron.provider.class.prefetch
|
143
146
|
currentvalue = cron.retrieve
|
144
147
|
|
145
|
-
|
148
|
+
currentvalue.each do |prop, value|
|
149
|
+
# We're only interested in comparing the command.
|
150
|
+
next unless prop.name.to_s == "command"
|
151
|
+
assert(prop.insync?(value), "Property %s is not considered in sync with value %s" % [prop.name, value.inspect])
|
152
|
+
end
|
153
|
+
|
146
154
|
@crontype.clear
|
147
155
|
end
|
148
156
|
end
|
@@ -232,14 +240,18 @@ class TestCron < Test::Unit::TestCase
|
|
232
240
|
)
|
233
241
|
}
|
234
242
|
|
235
|
-
|
243
|
+
|
236
244
|
cron.provider.ensure = :present
|
237
245
|
cron.provider.command = '/bin/date > /dev/null'
|
238
246
|
cron.provider.minute = %w{0 30}
|
239
247
|
cron.provider.class.prefetch
|
240
248
|
currentvalue = cron.retrieve
|
241
249
|
|
242
|
-
|
250
|
+
currentvalue.each do |prop, value|
|
251
|
+
# We're only interested in comparing minutes.
|
252
|
+
next unless prop.name.to_s == "minute"
|
253
|
+
assert(prop.insync?(value), "Property %s is not considered in sync with value %s" % [prop.name, value.inspect])
|
254
|
+
end
|
243
255
|
@crontype.clear
|
244
256
|
end
|
245
257
|
end
|
@@ -309,23 +321,6 @@ class TestCron < Test::Unit::TestCase
|
|
309
321
|
end
|
310
322
|
end
|
311
323
|
|
312
|
-
# Disabled, since we no longer have naming requirements.
|
313
|
-
def disabled_test_names
|
314
|
-
cron = mkcron("nametest")
|
315
|
-
|
316
|
-
["bad name", "bad.name"].each do |name|
|
317
|
-
assert_raise(ArgumentError) do
|
318
|
-
cron[:name] = name
|
319
|
-
end
|
320
|
-
end
|
321
|
-
|
322
|
-
["good-name", "good-name", "AGoodName"].each do |name|
|
323
|
-
assert_nothing_raised do
|
324
|
-
cron[:name] = name
|
325
|
-
end
|
326
|
-
end
|
327
|
-
end
|
328
|
-
|
329
324
|
def test_divisionnumbers
|
330
325
|
cron = mkcron("divtest")
|
331
326
|
cron[:minute] = "*/5"
|
@@ -468,7 +463,7 @@ class TestCron < Test::Unit::TestCase
|
|
468
463
|
end
|
469
464
|
|
470
465
|
# Make sure the user stuff defaults correctly.
|
471
|
-
def
|
466
|
+
def test_default_user
|
472
467
|
crontab = @crontype.provider(:crontab)
|
473
468
|
if crontab.suitable?
|
474
469
|
inst = @crontype.create(
|
@@ -491,11 +486,12 @@ class TestCron < Test::Unit::TestCase
|
|
491
486
|
# #705 - make sure extra spaces don't screw things up
|
492
487
|
def test_spaces_in_command
|
493
488
|
string = "echo multiple spaces"
|
494
|
-
cron = @crontype.create(:name => "testing", :command => string)
|
489
|
+
cron = @crontype.create(:name => "space testing", :command => string)
|
495
490
|
assert_apply(cron)
|
496
491
|
|
497
492
|
cron.class.clear
|
498
|
-
cron = @crontype.create(:name => "testing", :command => string)
|
493
|
+
cron = @crontype.create(:name => "space testing", :command => string)
|
494
|
+
|
499
495
|
# Now make sure that it's correctly in sync
|
500
496
|
cron.provider.class.prefetch("testing" => cron)
|
501
497
|
properties = cron.retrieve
|
@@ -506,4 +502,4 @@ class TestCron < Test::Unit::TestCase
|
|
506
502
|
end
|
507
503
|
|
508
504
|
|
509
|
-
# $Id: cron.rb
|
505
|
+
# $Id: cron.rb 2750 2007-08-06 17:59:37Z luke $
|
@@ -0,0 +1,40 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
$:.unshift("../../lib") if __FILE__ =~ /\.rb$/
|
4
|
+
|
5
|
+
require 'puppettest'
|
6
|
+
require 'mocha'
|
7
|
+
|
8
|
+
class TestInterfaceType < PuppetTest::TestCase
|
9
|
+
confine "Could not find suitable interface provider" => Puppet::Type.type(:interface).suitableprovider.length > 0
|
10
|
+
|
11
|
+
def setup
|
12
|
+
super
|
13
|
+
@type = Puppet::Type.type(:interface)
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_prefetch
|
17
|
+
interface = @type.create(:name => "127.0.0.1", :interface => "lo0", :check => :all)
|
18
|
+
|
19
|
+
@type.suitableprovider.each do |provider|
|
20
|
+
assert_nothing_raised("Could not prefetch interfaces from %s provider" % provider.name) do
|
21
|
+
provider.prefetch("eth0" => interface)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_instances
|
27
|
+
@type.suitableprovider.each do |provider|
|
28
|
+
list = nil
|
29
|
+
assert_nothing_raised("Could not get instance list from %s" % provider.name) do
|
30
|
+
list = provider.instances
|
31
|
+
end
|
32
|
+
assert(list.length > 0, "Did not get any instances from %s" % provider.name)
|
33
|
+
list.each do |interface|
|
34
|
+
assert_instance_of(provider, interface, "%s provider returned something other than a provider instance" % provider.name)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
# $Id: interface.rb 2750 2007-08-06 17:59:37Z luke $
|
data/test/ral/types/package.rb
CHANGED
@@ -86,7 +86,11 @@ class TestPackages < Test::Unit::TestCase
|
|
86
86
|
# Make sure we can prefetch and retrieve packages
|
87
87
|
def test_package_instances
|
88
88
|
providers = []
|
89
|
-
|
89
|
+
instances = nil
|
90
|
+
assert_nothing_raised("Could not get package instances") do
|
91
|
+
instances = @type.instances
|
92
|
+
end
|
93
|
+
instances.each do |resource|
|
90
94
|
# Just do one of each type
|
91
95
|
next if providers.include?(resource.provider.class)
|
92
96
|
providers << resource.provider.class
|
@@ -147,4 +151,4 @@ class TestPackages < Test::Unit::TestCase
|
|
147
151
|
end
|
148
152
|
end
|
149
153
|
|
150
|
-
# $Id: package.rb
|
154
|
+
# $Id: package.rb 2753 2007-08-07 02:38:45Z luke $
|
data/test/util/config.rb
CHANGED
@@ -3,9 +3,8 @@
|
|
3
3
|
$:.unshift("../lib").unshift("../../lib") if __FILE__ =~ /\.rb$/
|
4
4
|
|
5
5
|
require 'mocha'
|
6
|
-
require 'puppet'
|
7
|
-
require 'puppet/util/config'
|
8
6
|
require 'puppettest'
|
7
|
+
require 'puppet/util/config'
|
9
8
|
require 'puppettest/parsertesting'
|
10
9
|
|
11
10
|
class TestConfig < Test::Unit::TestCase
|
@@ -17,6 +16,22 @@ class TestConfig < Test::Unit::TestCase
|
|
17
16
|
@config = mkconfig
|
18
17
|
end
|
19
18
|
|
19
|
+
def set_configs(config = nil)
|
20
|
+
config ||= @config
|
21
|
+
config.setdefaults("main",
|
22
|
+
:one => ["a", "one"],
|
23
|
+
:two => ["a", "two"],
|
24
|
+
:yay => ["/default/path", "boo"],
|
25
|
+
:mkusers => [true, "uh, yeah"],
|
26
|
+
:name => ["testing", "a"]
|
27
|
+
)
|
28
|
+
|
29
|
+
config.setdefaults("section1",
|
30
|
+
:attr => ["a", "one"],
|
31
|
+
:attrdir => ["/another/dir", "two"],
|
32
|
+
:attr3 => ["$attrdir/maybe", "boo"]
|
33
|
+
)
|
34
|
+
end
|
20
35
|
|
21
36
|
def check_for_users
|
22
37
|
count = Puppet::Type.type(:user).inject(0) { |c,o|
|
@@ -25,10 +40,11 @@ class TestConfig < Test::Unit::TestCase
|
|
25
40
|
assert(count > 0, "Found no users")
|
26
41
|
end
|
27
42
|
|
28
|
-
def
|
43
|
+
def test_to_transportable
|
44
|
+
set_configs
|
29
45
|
trans = nil
|
30
46
|
assert_nothing_raised("Could not convert to a transportable") {
|
31
|
-
trans = config.to_transportable
|
47
|
+
trans = @config.to_transportable
|
32
48
|
}
|
33
49
|
|
34
50
|
comp = nil
|
@@ -36,17 +52,16 @@ class TestConfig < Test::Unit::TestCase
|
|
36
52
|
comp = trans.to_type
|
37
53
|
}
|
38
54
|
|
39
|
-
check_for_users()
|
40
|
-
|
41
55
|
assert_nothing_raised("Could not retrieve transported config") {
|
42
56
|
comp.retrieve
|
43
57
|
}
|
44
58
|
end
|
45
59
|
|
46
|
-
def
|
60
|
+
def test_to_manifest
|
61
|
+
set_configs
|
47
62
|
manifest = nil
|
48
63
|
assert_nothing_raised("Could not convert to a manifest") {
|
49
|
-
manifest = config.to_manifest
|
64
|
+
manifest = @config.to_manifest
|
50
65
|
}
|
51
66
|
|
52
67
|
Puppet[:parseonly] = true
|
@@ -63,32 +78,51 @@ class TestConfig < Test::Unit::TestCase
|
|
63
78
|
assert_nothing_raised("Could not instantiate objects") {
|
64
79
|
trans.to_type
|
65
80
|
}
|
66
|
-
check_for_users()
|
67
81
|
end
|
68
82
|
|
69
|
-
def
|
83
|
+
def test_to_comp
|
84
|
+
set_configs
|
70
85
|
comp = nil
|
71
86
|
assert_nothing_raised("Could not convert to a component") {
|
72
|
-
comp = config.to_component
|
87
|
+
comp = @config.to_component
|
73
88
|
}
|
74
89
|
|
75
90
|
assert_nothing_raised("Could not retrieve component") {
|
76
91
|
comp.retrieve
|
77
92
|
}
|
78
|
-
|
79
|
-
check_for_users()
|
80
93
|
end
|
81
94
|
|
82
|
-
def
|
83
|
-
|
95
|
+
def test_to_config
|
96
|
+
set_configs
|
97
|
+
|
98
|
+
newc = mkconfig
|
99
|
+
set_configs(newc)
|
100
|
+
|
101
|
+
# Reset all of the values, so we know they're changing.
|
102
|
+
newc.each do |name, obj|
|
103
|
+
next if name == :name
|
104
|
+
newc[name] = true
|
105
|
+
end
|
84
106
|
|
85
107
|
newfile = tempfile()
|
86
|
-
File.open(newfile, "w") { |f|
|
108
|
+
File.open(newfile, "w") { |f|
|
109
|
+
@config.to_config.split("\n").each do |line|
|
110
|
+
# Uncomment the settings, so they actually take.
|
111
|
+
if line =~ / = /
|
112
|
+
f.puts line.sub(/^\s*#/, '')
|
113
|
+
else
|
114
|
+
f.puts line
|
115
|
+
end
|
116
|
+
end
|
117
|
+
}
|
118
|
+
|
87
119
|
assert_nothing_raised("Could not parse generated configuration") {
|
88
120
|
newc.parse(newfile)
|
89
121
|
}
|
90
122
|
|
91
|
-
|
123
|
+
@config.each do |name, object|
|
124
|
+
assert_equal(@config[name], newc[name], "Parameter %s is not the same" % name)
|
125
|
+
end
|
92
126
|
end
|
93
127
|
|
94
128
|
def mkconfig
|
@@ -316,28 +350,28 @@ yay = /a/path
|
|
316
350
|
assert_nothing_raised("Could not create transportable config") {
|
317
351
|
@config.to_transportable
|
318
352
|
}
|
319
|
-
|
320
|
-
check_to_comp(@config)
|
321
|
-
Puppet::Type.allclear
|
322
|
-
check_to_manifest(@config)
|
323
|
-
Puppet::Type.allclear
|
324
|
-
check_to_config(@config)
|
325
|
-
Puppet::Type.allclear
|
326
|
-
check_to_transportable(@config)
|
327
353
|
end
|
328
354
|
|
329
355
|
def test_parse
|
330
356
|
result = {
|
331
|
-
:main => {:main => "main", :bad => "invalid"},
|
332
|
-
:puppet => {:other => "puppet"},
|
333
|
-
:puppetd => {:other => "puppetd"}
|
357
|
+
:main => {:main => "main", :bad => "invalid", :cliparam => "reset"},
|
358
|
+
:puppet => {:other => "puppet", :cliparam => "reset"},
|
359
|
+
:puppetd => {:other => "puppetd", :cliparam => "reset"}
|
334
360
|
}
|
335
361
|
# Set our defaults, so they're valid. Don't define 'bad', since we want to test for failures.
|
336
362
|
@config.setdefaults(:main,
|
337
363
|
:main => ["whatever", "a"],
|
364
|
+
:cliparam => ["default", "y"],
|
338
365
|
:other => ["a", "b"],
|
339
366
|
:name => ["puppet", "b"] # our default name
|
340
367
|
)
|
368
|
+
@config.setdefaults(:other,
|
369
|
+
:one => ["whatever", "a"],
|
370
|
+
:two => ["default", "y"],
|
371
|
+
:apple => ["a", "b"],
|
372
|
+
:shoe => ["puppet", "b"] # our default name
|
373
|
+
)
|
374
|
+
@config.handlearg("--cliparam", "changed")
|
341
375
|
@config.expects(:parse_file).returns(result).times(2)
|
342
376
|
|
343
377
|
# First do it with our name being 'puppet'
|
@@ -349,9 +383,10 @@ yay = /a/path
|
|
349
383
|
|
350
384
|
assert_equal("main", @config[:main], "Did not get main value")
|
351
385
|
assert_equal("puppet", @config[:other], "Did not get name value")
|
386
|
+
assert_equal("changed", @config[:cliparam], "CLI values were overridden by config")
|
352
387
|
|
353
388
|
# Now switch names and make sure the parsing switches, too.
|
354
|
-
@config.clear
|
389
|
+
@config.clear(true)
|
355
390
|
@config[:name] = :puppetd
|
356
391
|
assert_nothing_raised("Could not handle parse results") do
|
357
392
|
@config.parse(tempfile)
|
@@ -360,6 +395,7 @@ yay = /a/path
|
|
360
395
|
|
361
396
|
assert_equal("main", @config[:main], "Did not get main value")
|
362
397
|
assert_equal("puppetd", @config[:other], "Did not get name value")
|
398
|
+
assert_equal("changed", @config[:cliparam], "CLI values were overridden by config")
|
363
399
|
end
|
364
400
|
|
365
401
|
# Make sure we can extract file options correctly.
|
@@ -1167,6 +1203,46 @@ inttest = 27
|
|
1167
1203
|
assert_equal("oneval/twoval/oneval/twoval", @config[:three],
|
1168
1204
|
"Did not interpolate curlied variables")
|
1169
1205
|
end
|
1206
|
+
|
1207
|
+
# Discovered from #734
|
1208
|
+
def test_set_parameter_hash
|
1209
|
+
@config.setdefaults(:section,
|
1210
|
+
:unchanged => ["unval", "yay"],
|
1211
|
+
:normal => ["normalval", "yay"],
|
1212
|
+
:cliparam => ["clival", "yay"],
|
1213
|
+
:file => ["/my/file", "yay"]
|
1214
|
+
)
|
1215
|
+
|
1216
|
+
# Set the cli param using the cli method
|
1217
|
+
@config.handlearg("--cliparam", "other")
|
1218
|
+
|
1219
|
+
# Make sure missing params just throw warnings, not errors
|
1220
|
+
assert_nothing_raised("Could not call set_parameter_hash with an invalid option") do
|
1221
|
+
@config.send(:set_parameter_hash, :missing => "something")
|
1222
|
+
end
|
1223
|
+
|
1224
|
+
# Make sure normal values get set
|
1225
|
+
assert_nothing_raised("Could not call set_parameter_hash with a normal value") do
|
1226
|
+
@config.send(:set_parameter_hash, :normal => "abnormal")
|
1227
|
+
end
|
1228
|
+
assert_equal("abnormal", @config[:normal], "Value did not get set")
|
1229
|
+
|
1230
|
+
# Make sure cli-set values don't get overridden
|
1231
|
+
assert_nothing_raised("Could not call set_parameter_hash with an override of a cli value") do
|
1232
|
+
@config.send(:set_parameter_hash, :cliparam => "something else")
|
1233
|
+
end
|
1234
|
+
assert_equal("other", @config[:cliparam], "CLI value was overridden by config value")
|
1235
|
+
|
1236
|
+
# Make sure the meta stuff works
|
1237
|
+
assert_nothing_raised("Could not call set_parameter_hash with meta info") do
|
1238
|
+
@config.send(:set_parameter_hash, :file => "/other/file", :_meta => {:file => {:mode => "0755"}})
|
1239
|
+
end
|
1240
|
+
assert_equal("/other/file", @config[:file], "value with meta info was overridden by config value")
|
1241
|
+
assert_equal("0755", @config.element(:file).mode, "Did not set mode from meta info")
|
1242
|
+
|
1243
|
+
# And make sure other params are unchanged
|
1244
|
+
assert_equal("unval", @config[:unchanged], "Unchanged value has somehow changed")
|
1245
|
+
end
|
1170
1246
|
end
|
1171
1247
|
|
1172
|
-
# $Id: config.rb
|
1248
|
+
# $Id: config.rb 2743 2007-08-04 00:36:47Z luke $
|