puppet 2.6.7 → 2.6.8
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 +49 -0
- data/install.rb +6 -2
- data/lib/puppet.rb +1 -1
- data/lib/puppet/application.rb +16 -8
- data/lib/puppet/application/agent.rb +2 -0
- data/lib/puppet/application/apply.rb +3 -0
- data/lib/puppet/application/master.rb +1 -1
- data/lib/puppet/configurer.rb +10 -1
- data/lib/puppet/defaults.rb +9 -0
- data/lib/puppet/file_serving/fileset.rb +1 -0
- data/lib/puppet/indirector/exec.rb +1 -2
- data/lib/puppet/indirector/report/yaml.rb +11 -0
- data/lib/puppet/node/environment.rb +1 -1
- data/lib/puppet/parameter.rb +2 -0
- data/lib/puppet/parameter/path.rb +42 -0
- data/lib/puppet/parser/compiler.rb +1 -1
- data/lib/puppet/parser/lexer.rb +3 -2
- data/lib/puppet/parser/parser_support.rb +0 -1
- data/lib/puppet/provider/exec/posix.rb +112 -0
- data/lib/puppet/provider/exec/shell.rb +17 -0
- data/lib/puppet/provider/group/groupadd.rb +3 -0
- data/lib/puppet/provider/nameservice/#directoryservice.rb# +519 -0
- data/lib/puppet/provider/package/gem.rb +2 -2
- data/lib/puppet/provider/package/macports.rb +106 -0
- data/lib/puppet/provider/service/debian.rb +6 -2
- data/lib/puppet/rails/inventory_node.rb +5 -0
- data/lib/puppet/reference/#providers.rb# +123 -0
- data/lib/puppet/resource/type_collection.rb +6 -1
- data/lib/puppet/simple_graph.rb +1 -1
- data/lib/puppet/transaction.rb +1 -1
- data/lib/puppet/transaction/report.rb +28 -10
- data/lib/puppet/type/cron.rb +3 -1
- data/lib/puppet/type/exec.rb +30 -167
- data/lib/puppet/type/file.rb +12 -1
- data/lib/puppet/type/file/source.rb +1 -0
- data/lib/puppet/type/group.rb +11 -1
- data/lib/puppet/type/service.rb +19 -11
- data/lib/puppet/util/command_line.rb +15 -12
- data/lib/puppet/util/command_line/puppetrun +0 -1
- data/lib/puppet/util/loadedfile.rb +1 -5
- data/lib/puppet/util/metric.rb +3 -5
- data/lib/puppet/util/plugins.rb +82 -0
- data/spec/integration/configurer_spec.rb +38 -5
- data/spec/integration/transaction_spec.rb +43 -42
- data/spec/lib/puppet_spec/verbose.rb +9 -0
- data/spec/shared_behaviours/path_parameters.rb +185 -0
- data/spec/spec_helper.rb +6 -0
- data/spec/unit/application/agent_spec.rb +7 -0
- data/spec/unit/application/apply_spec.rb +6 -0
- data/spec/unit/application/master_spec.rb +2 -2
- data/spec/unit/configurer_spec.rb +48 -0
- data/spec/unit/file_serving/fileset_spec.rb +8 -0
- data/spec/unit/indirector/certificate_status/#file_spec.rb# +188 -0
- data/spec/unit/indirector/exec_spec.rb +2 -3
- data/spec/unit/indirector/facts/inventory_active_record_spec.rb +5 -1
- data/spec/unit/indirector/report/yaml_spec.rb +38 -0
- data/spec/unit/node/environment_spec.rb +15 -14
- data/spec/unit/parameter/path_spec.rb +24 -0
- data/spec/unit/parser/compiler_spec.rb +1 -2
- data/spec/unit/parser/lexer_spec.rb +12 -0
- data/spec/unit/provider/exec/posix_spec.rb +120 -0
- data/spec/unit/provider/exec/shell_spec.rb +50 -0
- data/spec/unit/provider/group/groupadd_spec.rb +11 -1
- data/spec/unit/provider/package/gem_spec.rb +11 -1
- data/spec/unit/provider/package/macports_spec.rb +122 -0
- data/spec/unit/provider/service/debian_spec.rb +14 -2
- data/spec/unit/resource/#type_collection_spec.rb# +463 -0
- data/spec/unit/resource/type_collection_spec.rb +21 -17
- data/spec/unit/transaction/report_spec.rb +13 -2
- data/spec/unit/type/cron_spec.rb +466 -18
- data/spec/unit/type/exec_spec.rb +633 -106
- data/spec/unit/type/file/source_spec.rb +1 -0
- data/spec/unit/type/group_spec.rb +8 -1
- data/spec/unit/type_spec.rb +1 -1
- data/spec/unit/util/loadedfile_spec.rb +7 -0
- data/spec/unit/util/rdoc/parser_spec.rb +2 -1
- data/tasks/rake/git_workflow.rake +3 -1
- data/test/ral/type/exec.rb +87 -176
- metadata +21 -5
- data/lib/puppet/provider/package/darwinport.rb +0 -86
@@ -187,6 +187,7 @@ describe Puppet::Type.type(:file).attrclass(:source) do
|
|
187
187
|
describe "and the source is a link" do
|
188
188
|
it "should set the target to the link destination" do
|
189
189
|
@metadata.stubs(:ftype).returns "link"
|
190
|
+
@metadata.stubs(:links).returns "manage"
|
190
191
|
@resource.stubs(:[])
|
191
192
|
@resource.stubs(:[]=)
|
192
193
|
|
@@ -16,6 +16,10 @@ describe Puppet::Type.type(:group) do
|
|
16
16
|
@class.defaultprovider.ancestors.should be_include(Puppet::Provider)
|
17
17
|
end
|
18
18
|
|
19
|
+
it "should have a system_groups feature" do
|
20
|
+
@class.provider_feature(:system_groups).should_not be_nil
|
21
|
+
end
|
22
|
+
|
19
23
|
describe "when validating attributes" do
|
20
24
|
[:name, :allowdupe].each do |param|
|
21
25
|
it "should have a #{param} parameter" do
|
@@ -38,11 +42,14 @@ describe Puppet::Type.type(:group) do
|
|
38
42
|
end
|
39
43
|
end
|
40
44
|
|
41
|
-
# #1407 - we need to declare the allowdupe param as boolean.
|
42
45
|
it "should have a boolean method for determining if duplicates are allowed" do
|
43
46
|
@class.new(:name => "foo").methods.should be_include("allowdupe?")
|
44
47
|
end
|
45
48
|
|
49
|
+
it "should have a boolean method for determining if system groups are allowed" do
|
50
|
+
@class.new(:name => "foo").methods.should be_include("system?")
|
51
|
+
end
|
52
|
+
|
46
53
|
it "should call 'create' to create the group" do
|
47
54
|
group = @class.new(:name => "foo", :ensure => :present)
|
48
55
|
group.provider.expects(:create)
|
data/spec/unit/type_spec.rb
CHANGED
@@ -6,6 +6,7 @@ require 'tempfile'
|
|
6
6
|
require 'puppet/util/loadedfile'
|
7
7
|
|
8
8
|
describe Puppet::Util::LoadedFile do
|
9
|
+
include PuppetSpec::Files
|
9
10
|
before(:each) do
|
10
11
|
@f = Tempfile.new('loadedfile_test')
|
11
12
|
@f.puts "yayness"
|
@@ -18,6 +19,12 @@ describe Puppet::Util::LoadedFile do
|
|
18
19
|
@fake_now = Time.now + (2 * Puppet[:filetimeout])
|
19
20
|
end
|
20
21
|
|
22
|
+
it "should accept files that don't exist" do
|
23
|
+
nofile = tmpfile('testfile')
|
24
|
+
File.exists?(nofile).should == false
|
25
|
+
lambda{ Puppet::Util::LoadedFile.new(nofile) }.should_not raise_error
|
26
|
+
end
|
27
|
+
|
21
28
|
it "should recognize when the file has not changed" do
|
22
29
|
# Use fake "now" so that we can be sure changed? actually checks, without sleeping
|
23
30
|
# for Puppet[:filetimeout] seconds.
|
@@ -20,8 +20,9 @@ describe RDoc::Parser do
|
|
20
20
|
@parser.stubs(:scan_top_level)
|
21
21
|
parser = stub 'parser'
|
22
22
|
Puppet::Parser::Parser.stubs(:new).returns(parser)
|
23
|
-
parser.expects(:parse)
|
23
|
+
parser.expects(:parse).at_least_once
|
24
24
|
parser.expects(:file=).with("module/manifests/init.pp")
|
25
|
+
parser.expects(:file=).with("/dev/null/manifests/site.pp")
|
25
26
|
|
26
27
|
@parser.scan
|
27
28
|
end
|
@@ -108,12 +108,14 @@ task :mail_patches do
|
|
108
108
|
# If we've got more than one patch, add --compose
|
109
109
|
if Dir.glob("00*.patch").length > 1
|
110
110
|
compose = "--compose"
|
111
|
+
subject = "--subject \"#{type} #{name} against #{parent}\""
|
111
112
|
else
|
112
113
|
compose = ""
|
114
|
+
subject = ""
|
113
115
|
end
|
114
116
|
|
115
117
|
# Now send the mail.
|
116
|
-
sh "git send-email #{compose} --no-signed-off-by-cc --suppress-from --to puppet-dev@googlegroups.com 00*.patch"
|
118
|
+
sh "git send-email #{compose} #{subject} --no-signed-off-by-cc --suppress-from --to puppet-dev@googlegroups.com 00*.patch"
|
117
119
|
|
118
120
|
# Finally, clean up the patches
|
119
121
|
sh "rm 00*.patch"
|
data/test/ral/type/exec.rb
CHANGED
@@ -34,10 +34,8 @@ class TestExec < Test::Unit::TestCase
|
|
34
34
|
assert_nothing_raised {
|
35
35
|
|
36
36
|
command = Puppet::Type.type(:exec).new(
|
37
|
-
|
38
37
|
:command => "echo",
|
39
|
-
|
40
|
-
:path => "/usr/bin:/bin:/usr/sbin:/sbin"
|
38
|
+
:path => "/usr/bin:/bin:/usr/sbin:/sbin"
|
41
39
|
)
|
42
40
|
}
|
43
41
|
assert_nothing_raised {
|
@@ -48,10 +46,8 @@ class TestExec < Test::Unit::TestCase
|
|
48
46
|
assert_nothing_raised {
|
49
47
|
|
50
48
|
command = Puppet::Type.type(:exec).new(
|
51
|
-
|
52
49
|
:command => "/bin/echo",
|
53
|
-
|
54
|
-
:path => "/usr/bin:/bin:/usr/sbin:/sbin"
|
50
|
+
:path => "/usr/bin:/bin:/usr/sbin:/sbin"
|
55
51
|
)
|
56
52
|
}
|
57
53
|
end
|
@@ -60,30 +56,24 @@ class TestExec < Test::Unit::TestCase
|
|
60
56
|
assert_nothing_raised {
|
61
57
|
|
62
58
|
command = Puppet::Type.type(:exec).new(
|
63
|
-
|
64
59
|
:command => "mkdir /this/directory/does/not/exist",
|
65
|
-
:path
|
66
|
-
|
60
|
+
:path => "/usr/bin:/bin:/usr/sbin:/sbin",
|
67
61
|
:returns => 1
|
68
62
|
)
|
69
63
|
}
|
70
64
|
assert_nothing_raised {
|
71
65
|
|
72
66
|
command = Puppet::Type.type(:exec).new(
|
73
|
-
|
74
67
|
:command => "touch /etc",
|
75
|
-
:path
|
76
|
-
|
68
|
+
:path => "/usr/bin:/bin:/usr/sbin:/sbin",
|
77
69
|
:returns => 1
|
78
70
|
)
|
79
71
|
}
|
80
72
|
assert_nothing_raised {
|
81
73
|
|
82
74
|
command = Puppet::Type.type(:exec).new(
|
83
|
-
|
84
75
|
:command => "thiscommanddoesnotexist",
|
85
|
-
:path
|
86
|
-
|
76
|
+
:path => "/usr/bin:/bin:/usr/sbin:/sbin",
|
87
77
|
:returns => 127
|
88
78
|
)
|
89
79
|
}
|
@@ -98,11 +88,9 @@ class TestExec < Test::Unit::TestCase
|
|
98
88
|
assert_nothing_raised {
|
99
89
|
|
100
90
|
command = Puppet::Type.type(:exec).new(
|
101
|
-
|
102
91
|
:command => "pwd",
|
103
|
-
:cwd
|
104
|
-
:path
|
105
|
-
|
92
|
+
:cwd => dir,
|
93
|
+
:path => "/usr/bin:/bin:/usr/sbin:/sbin",
|
106
94
|
:returns => 0
|
107
95
|
)
|
108
96
|
}
|
@@ -117,11 +105,9 @@ class TestExec < Test::Unit::TestCase
|
|
117
105
|
@@tmpfiles.push tmpfile
|
118
106
|
trans = nil
|
119
107
|
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
:content => "yay"
|
108
|
+
file = Puppet::Type.type(:file).new(
|
109
|
+
:path => tmpfile,
|
110
|
+
:content => "yay"
|
125
111
|
)
|
126
112
|
# Get the file in sync
|
127
113
|
assert_apply(file)
|
@@ -129,13 +115,10 @@ class TestExec < Test::Unit::TestCase
|
|
129
115
|
# Now make an exec
|
130
116
|
maker = tempfile
|
131
117
|
assert_nothing_raised {
|
132
|
-
|
133
118
|
cmd = Puppet::Type.type(:exec).new(
|
134
|
-
|
135
|
-
:
|
136
|
-
:
|
137
|
-
:subscribe => file,
|
138
|
-
|
119
|
+
:command => "touch #{maker}",
|
120
|
+
:path => "/usr/bin:/bin:/usr/sbin:/sbin",
|
121
|
+
:subscribe => file,
|
139
122
|
:refreshonly => true
|
140
123
|
)
|
141
124
|
}
|
@@ -143,7 +126,7 @@ class TestExec < Test::Unit::TestCase
|
|
143
126
|
assert(cmd, "did not make exec")
|
144
127
|
|
145
128
|
assert_nothing_raised do
|
146
|
-
assert(! cmd.
|
129
|
+
assert(! cmd.check_all_attributes, "Check passed when refreshonly is set")
|
147
130
|
end
|
148
131
|
|
149
132
|
assert_events([], file, cmd)
|
@@ -158,25 +141,22 @@ class TestExec < Test::Unit::TestCase
|
|
158
141
|
def test_refreshonly
|
159
142
|
cmd = true
|
160
143
|
assert_nothing_raised {
|
161
|
-
|
162
144
|
cmd = Puppet::Type.type(:exec).new(
|
163
|
-
|
164
|
-
:
|
165
|
-
:path => "/usr/bin:/bin:/usr/sbin:/sbin",
|
166
|
-
|
145
|
+
:command => "pwd",
|
146
|
+
:path => "/usr/bin:/bin:/usr/sbin:/sbin",
|
167
147
|
:refreshonly => true
|
168
148
|
)
|
169
149
|
}
|
170
150
|
|
171
151
|
# Checks should always fail when refreshonly is enabled
|
172
|
-
assert(!cmd.
|
152
|
+
assert(!cmd.check_all_attributes, "Check passed with refreshonly true")
|
173
153
|
|
174
154
|
# Now make sure it passes if we pass in "true"
|
175
|
-
assert(cmd.
|
155
|
+
assert(cmd.check_all_attributes(true), "Check failed with refreshonly true while refreshing")
|
176
156
|
|
177
157
|
# Now set it to false
|
178
158
|
cmd[:refreshonly] = false
|
179
|
-
assert(cmd.
|
159
|
+
assert(cmd.check_all_attributes, "Check failed with refreshonly false")
|
180
160
|
end
|
181
161
|
|
182
162
|
def test_creates
|
@@ -186,10 +166,8 @@ class TestExec < Test::Unit::TestCase
|
|
186
166
|
assert_nothing_raised {
|
187
167
|
|
188
168
|
exec = Puppet::Type.type(:exec).new(
|
189
|
-
|
190
169
|
:command => "touch #{file}",
|
191
|
-
:path
|
192
|
-
|
170
|
+
:path => "/usr/bin:/bin:/usr/sbin:/sbin",
|
193
171
|
:creates => file
|
194
172
|
)
|
195
173
|
}
|
@@ -206,21 +184,15 @@ class TestExec < Test::Unit::TestCase
|
|
206
184
|
sh = %x{which sh}
|
207
185
|
File.open(exe, "w") { |f| f.puts "#!#{sh}\necho yup" }
|
208
186
|
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
:source => exe,
|
214
|
-
|
215
|
-
:mode => 0755
|
187
|
+
file = Puppet::Type.type(:file).new(
|
188
|
+
:path => oexe,
|
189
|
+
:source => exe,
|
190
|
+
:mode => 0755
|
216
191
|
)
|
217
192
|
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
:command => oexe,
|
222
|
-
|
223
|
-
:require => Puppet::Resource.new(:file, oexe)
|
193
|
+
exec = Puppet::Type.type(:exec).new(
|
194
|
+
:command => oexe,
|
195
|
+
:require => Puppet::Resource.new(:file, oexe)
|
224
196
|
)
|
225
197
|
|
226
198
|
comp = mk_catalog("Testing", file, exec)
|
@@ -236,47 +208,36 @@ class TestExec < Test::Unit::TestCase
|
|
236
208
|
File.open(exe, "w") { |f| f.puts "#!#{sh}\necho yup" }
|
237
209
|
|
238
210
|
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
:mode => 755
|
211
|
+
file = Puppet::Type.type(:file).new(
|
212
|
+
:path => oexe,
|
213
|
+
:source => exe,
|
214
|
+
:mode => 755
|
245
215
|
)
|
246
216
|
|
247
217
|
basedir = File.dirname(oexe)
|
248
218
|
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
:mode => 755
|
219
|
+
baseobj = Puppet::Type.type(:file).new(
|
220
|
+
:path => basedir,
|
221
|
+
:source => exe,
|
222
|
+
:mode => 755
|
255
223
|
)
|
256
224
|
|
257
225
|
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
:mode => 755
|
226
|
+
ofile = Puppet::Type.type(:file).new(
|
227
|
+
:path => exe,
|
228
|
+
:mode => 755
|
263
229
|
)
|
264
230
|
|
265
231
|
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
:cwd => basedir
|
232
|
+
exec = Puppet::Type.type(:exec).new(
|
233
|
+
:command => oexe,
|
234
|
+
:path => ENV["PATH"],
|
235
|
+
:cwd => basedir
|
272
236
|
)
|
273
237
|
|
274
|
-
|
275
|
-
cat
|
276
|
-
|
277
|
-
:command => "cat #{exe} #{oexe}",
|
278
|
-
|
279
|
-
:path => ENV["PATH"]
|
238
|
+
cat = Puppet::Type.type(:exec).new(
|
239
|
+
:command => "cat #{exe} #{oexe}",
|
240
|
+
:path => ENV["PATH"]
|
280
241
|
)
|
281
242
|
|
282
243
|
catalog = mk_catalog(file, baseobj, ofile, exec, cat)
|
@@ -311,11 +272,9 @@ class TestExec < Test::Unit::TestCase
|
|
311
272
|
assert_nothing_raised {
|
312
273
|
|
313
274
|
exec = Puppet::Type.type(:exec).new(
|
314
|
-
|
315
275
|
:command => "touch #{bfile}",
|
316
|
-
:onlyif
|
317
|
-
|
318
|
-
:path => ENV['PATH']
|
276
|
+
:onlyif => "test -f #{afile}",
|
277
|
+
:path => ENV['PATH']
|
319
278
|
)
|
320
279
|
}
|
321
280
|
|
@@ -333,12 +292,9 @@ class TestExec < Test::Unit::TestCase
|
|
333
292
|
|
334
293
|
exec = nil
|
335
294
|
assert_nothing_raised {
|
336
|
-
|
337
295
|
exec = Puppet::Type.type(:exec).new(
|
338
|
-
|
339
296
|
:command => "touch #{bfile}",
|
340
297
|
:unless => "test -f #{afile}",
|
341
|
-
|
342
298
|
:path => ENV['PATH']
|
343
299
|
)
|
344
300
|
}
|
@@ -417,13 +373,10 @@ class TestExec < Test::Unit::TestCase
|
|
417
373
|
def test_logoutput
|
418
374
|
exec = nil
|
419
375
|
assert_nothing_raised {
|
420
|
-
|
421
376
|
exec = Puppet::Type.type(:exec).new(
|
422
|
-
|
423
|
-
:
|
424
|
-
:
|
425
|
-
:command => "echo logoutput is false",
|
426
|
-
|
377
|
+
:title => "logoutputesting",
|
378
|
+
:path => "/usr/bin:/bin",
|
379
|
+
:command => "echo logoutput is false",
|
427
380
|
:logoutput => false
|
428
381
|
)
|
429
382
|
}
|
@@ -453,24 +406,19 @@ class TestExec < Test::Unit::TestCase
|
|
453
406
|
assert_nothing_raised {
|
454
407
|
|
455
408
|
exec = Puppet::Type.type(:exec).new(
|
456
|
-
|
457
|
-
:
|
458
|
-
:path => "/usr/bin:/bin",
|
409
|
+
:title => "mkdir",
|
410
|
+
:path => "/usr/bin:/bin",
|
459
411
|
:creates => basedir,
|
460
|
-
|
461
412
|
:command => "mkdir #{basedir}; touch #{path}"
|
462
|
-
|
463
413
|
)
|
464
414
|
}
|
465
415
|
|
466
416
|
assert_nothing_raised {
|
467
417
|
|
468
418
|
file = Puppet::Type.type(:file).new(
|
469
|
-
|
470
|
-
:path => basedir,
|
419
|
+
:path => basedir,
|
471
420
|
:recurse => true,
|
472
|
-
:mode
|
473
|
-
|
421
|
+
:mode => "755",
|
474
422
|
:require => Puppet::Resource.new("exec", "mkdir")
|
475
423
|
)
|
476
424
|
}
|
@@ -507,12 +455,9 @@ class TestExec < Test::Unit::TestCase
|
|
507
455
|
file = tempfile
|
508
456
|
|
509
457
|
assert_nothing_raised {
|
510
|
-
|
511
458
|
exec1 = Puppet::Type.type(:exec).new(
|
512
|
-
|
513
|
-
:
|
514
|
-
:path => ENV["PATH"],
|
515
|
-
|
459
|
+
:title => "one",
|
460
|
+
:path => ENV["PATH"],
|
516
461
|
:command => "mkdir #{dir}"
|
517
462
|
)
|
518
463
|
}
|
@@ -520,12 +465,10 @@ class TestExec < Test::Unit::TestCase
|
|
520
465
|
assert_nothing_raised("Could not create exec w/out existing cwd") {
|
521
466
|
|
522
467
|
exec2 = Puppet::Type.type(:exec).new(
|
523
|
-
|
524
|
-
:
|
525
|
-
:path => ENV["PATH"],
|
468
|
+
:title => "two",
|
469
|
+
:path => ENV["PATH"],
|
526
470
|
:command => "touch #{file}",
|
527
|
-
|
528
|
-
:cwd => dir
|
471
|
+
:cwd => dir
|
529
472
|
)
|
530
473
|
}
|
531
474
|
|
@@ -555,11 +498,8 @@ class TestExec < Test::Unit::TestCase
|
|
555
498
|
test = "test -f #{file}"
|
556
499
|
|
557
500
|
assert_nothing_raised {
|
558
|
-
|
559
501
|
exec = Puppet::Type.type(:exec).new(
|
560
|
-
|
561
|
-
:path => ENV["PATH"],
|
562
|
-
|
502
|
+
:path => ENV["PATH"],
|
563
503
|
:command => "touch #{file}"
|
564
504
|
)
|
565
505
|
}
|
@@ -569,7 +509,7 @@ class TestExec < Test::Unit::TestCase
|
|
569
509
|
}
|
570
510
|
|
571
511
|
assert_nothing_raised {
|
572
|
-
assert(exec.
|
512
|
+
assert(exec.check_all_attributes, "Check did not pass")
|
573
513
|
}
|
574
514
|
|
575
515
|
assert_nothing_raised {
|
@@ -582,13 +522,13 @@ class TestExec < Test::Unit::TestCase
|
|
582
522
|
}
|
583
523
|
|
584
524
|
assert_nothing_raised {
|
585
|
-
assert(exec.
|
525
|
+
assert(exec.check_all_attributes, "Check did not pass")
|
586
526
|
}
|
587
527
|
|
588
528
|
assert_apply(exec)
|
589
529
|
|
590
530
|
assert_nothing_raised {
|
591
|
-
assert(! exec.
|
531
|
+
assert(! exec.check_all_attributes, "Check passed")
|
592
532
|
}
|
593
533
|
end
|
594
534
|
|
@@ -597,33 +537,29 @@ class TestExec < Test::Unit::TestCase
|
|
597
537
|
return if Facter.value(:operatingsystem) == "Solaris"
|
598
538
|
|
599
539
|
exec = Puppet::Type.type(:exec).new(
|
600
|
-
|
601
540
|
:command => "echo true",
|
602
|
-
:path
|
603
|
-
|
604
|
-
|
605
|
-
)
|
541
|
+
:path => ENV["PATH"],
|
542
|
+
:onlyif => "/bin/nosuchthingexists"
|
543
|
+
)
|
606
544
|
|
607
545
|
assert_raise(ArgumentError, "Missing command did not raise error") {
|
608
|
-
exec.run("/bin/nosuchthingexists")
|
546
|
+
exec.provider.run("/bin/nosuchthingexists")
|
609
547
|
}
|
610
548
|
end
|
611
549
|
|
612
550
|
def test_envparam
|
613
551
|
|
614
552
|
exec = Puppet::Type.newexec(
|
615
|
-
|
616
553
|
:command => "echo $envtest",
|
617
|
-
:path
|
618
|
-
|
619
|
-
:env => "envtest=yayness"
|
554
|
+
:path => ENV["PATH"],
|
555
|
+
:env => "envtest=yayness"
|
620
556
|
)
|
621
557
|
|
622
558
|
assert(exec, "Could not make exec")
|
623
559
|
|
624
560
|
output = status = nil
|
625
561
|
assert_nothing_raised {
|
626
|
-
output, status = exec.run("echo $envtest")
|
562
|
+
output, status = exec.provider.run("echo $envtest")
|
627
563
|
}
|
628
564
|
|
629
565
|
assert_equal("yayness\n", output)
|
@@ -636,7 +572,7 @@ and stuff"
|
|
636
572
|
|
637
573
|
output = status = nil
|
638
574
|
assert_nothing_raised {
|
639
|
-
output, status = exec.run('echo "$envtest"')
|
575
|
+
output, status = exec.provider.run('echo "$envtest"')
|
640
576
|
}
|
641
577
|
assert_equal("a list of things\nand stuff\n", output)
|
642
578
|
|
@@ -647,7 +583,7 @@ and stuff"
|
|
647
583
|
|
648
584
|
output = status = nil
|
649
585
|
assert_nothing_raised {
|
650
|
-
output, status = exec.run('echo "$funtest" "$yaytest"')
|
586
|
+
output, status = exec.provider.run('echo "$funtest" "$yaytest"')
|
651
587
|
}
|
652
588
|
assert_equal("A B\n", output)
|
653
589
|
end
|
@@ -655,10 +591,8 @@ and stuff"
|
|
655
591
|
def test_environmentparam
|
656
592
|
|
657
593
|
exec = Puppet::Type.newexec(
|
658
|
-
|
659
|
-
:
|
660
|
-
:path => ENV["PATH"],
|
661
|
-
|
594
|
+
:command => "echo $environmenttest",
|
595
|
+
:path => ENV["PATH"],
|
662
596
|
:environment => "environmenttest=yayness"
|
663
597
|
)
|
664
598
|
|
@@ -666,7 +600,7 @@ and stuff"
|
|
666
600
|
|
667
601
|
output = status = nil
|
668
602
|
assert_nothing_raised {
|
669
|
-
output, status = exec.run("echo $environmenttest")
|
603
|
+
output, status = exec.provider.run("echo $environmenttest")
|
670
604
|
}
|
671
605
|
|
672
606
|
assert_equal("yayness\n", output)
|
@@ -679,7 +613,7 @@ and stuff"
|
|
679
613
|
|
680
614
|
output = status = nil
|
681
615
|
assert_nothing_raised {
|
682
|
-
output, status = exec.run('echo "$environmenttest"')
|
616
|
+
output, status = exec.provider.run('echo "$environmenttest"')
|
683
617
|
}
|
684
618
|
assert_equal("a list of things\nand stuff\n", output)
|
685
619
|
|
@@ -690,36 +624,20 @@ and stuff"
|
|
690
624
|
|
691
625
|
output = status = nil
|
692
626
|
assert_nothing_raised {
|
693
|
-
output, status = exec.run('echo "$funtest" "$yaytest"')
|
627
|
+
output, status = exec.provider.run('echo "$funtest" "$yaytest"')
|
694
628
|
}
|
695
629
|
assert_equal("A B\n", output)
|
696
630
|
end
|
697
631
|
|
698
|
-
def test_timeout
|
699
|
-
exec = Puppet::Type.type(:exec).new(:command => "sleep 1", :path => ENV["PATH"], :timeout => "0.2")
|
700
|
-
time = Time.now
|
701
|
-
|
702
|
-
assert_raise(Timeout::Error) {
|
703
|
-
exec.run("sleep 1")
|
704
|
-
}
|
705
|
-
Puppet.info "#{Time.now.to_f - time.to_f} seconds, vs a timeout of #{exec[:timeout]}"
|
706
|
-
|
707
|
-
|
708
|
-
assert_apply(exec)
|
709
|
-
end
|
710
|
-
|
711
632
|
# Testing #470
|
712
633
|
def test_run_as_created_user
|
713
634
|
exec = nil
|
714
635
|
if Process.uid == 0
|
715
636
|
user = "nosuchuser"
|
716
637
|
assert_nothing_raised("Could not create exec with non-existent user") do
|
717
|
-
|
718
638
|
exec = Puppet::Type.type(:exec).new(
|
719
|
-
|
720
639
|
:command => "/bin/echo yay",
|
721
|
-
|
722
|
-
:user => user
|
640
|
+
:user => user
|
723
641
|
)
|
724
642
|
end
|
725
643
|
end
|
@@ -729,10 +647,8 @@ and stuff"
|
|
729
647
|
assert_nothing_raised("Could not create exec with non-existent user") do
|
730
648
|
|
731
649
|
exec = Puppet::Type.type(:exec).new(
|
732
|
-
|
733
650
|
:command => "/bin/echo yay",
|
734
|
-
|
735
|
-
:group => group
|
651
|
+
:group => group
|
736
652
|
)
|
737
653
|
end
|
738
654
|
end
|
@@ -759,12 +675,10 @@ and stuff"
|
|
759
675
|
file = tempfile
|
760
676
|
maker = tempfile
|
761
677
|
|
762
|
-
|
763
|
-
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
:path => ENV["PATH"]
|
678
|
+
exec = Puppet::Type.type(:exec).new(
|
679
|
+
:title => "maker",
|
680
|
+
:command => "touch #{maker}",
|
681
|
+
:path => ENV["PATH"]
|
768
682
|
)
|
769
683
|
|
770
684
|
# Make sure it runs normally
|
@@ -801,12 +715,10 @@ and stuff"
|
|
801
715
|
refresher = tempfile
|
802
716
|
maker = tempfile
|
803
717
|
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
:path => ENV["PATH"]
|
718
|
+
exec = Puppet::Type.type(:exec).new(
|
719
|
+
:title => "maker",
|
720
|
+
:command => "touch #{maker}",
|
721
|
+
:path => ENV["PATH"]
|
810
722
|
)
|
811
723
|
|
812
724
|
# Call refresh normally
|
@@ -844,4 +756,3 @@ and stuff"
|
|
844
756
|
end
|
845
757
|
end
|
846
758
|
end
|
847
|
-
|