puppet 2.7.18 → 2.7.19
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 +82 -0
- data/CONTRIBUTING.md +114 -171
- data/README.md +8 -0
- data/README_DEVELOPER.md +38 -3
- data/Rakefile +19 -3
- data/conf/osx/createpackage.sh +3 -1
- data/conf/redhat/logrotate +1 -1
- data/conf/redhat/puppet.spec +35 -8
- data/lib/puppet.rb +1 -1
- data/lib/puppet/application/agent.rb +2 -0
- data/lib/puppet/application/master.rb +2 -0
- data/lib/puppet/configurer.rb +2 -3
- data/lib/puppet/defaults.rb +6 -5
- data/lib/puppet/face/module/install.rb +2 -1
- data/lib/puppet/file_bucket/dipper.rb +1 -1
- data/lib/puppet/indirector/file_content.rb +2 -2
- data/lib/puppet/indirector/file_metadata.rb +2 -2
- data/lib/puppet/indirector/indirection.rb +3 -4
- data/lib/puppet/indirector/rest.rb +12 -6
- data/lib/puppet/interface/action_manager.rb +1 -2
- data/lib/puppet/module_tool/applications/unpacker.rb +22 -3
- data/lib/puppet/network/handler/fileserver.rb +2 -2
- data/lib/puppet/parser/ast/resource.rb +9 -2
- data/lib/puppet/parser/functions/fqdn_rand.rb +2 -1
- data/lib/puppet/parser/functions/md5.rb +2 -2
- data/lib/puppet/parser/functions/sha1.rb +2 -2
- data/lib/puppet/parser/functions/template.rb +0 -2
- data/lib/puppet/parser/type_loader.rb +1 -2
- data/lib/puppet/provider/augeas/augeas.rb +19 -1
- data/lib/puppet/provider/confine.rb +1 -1
- data/lib/puppet/provider/package/msi.rb +97 -51
- data/lib/puppet/provider/scheduled_task/win32_taskscheduler.rb +1 -0
- data/lib/puppet/provider/service/gentoo.rb +0 -2
- data/lib/puppet/provider/service/openrc.rb +69 -0
- data/lib/puppet/provider/service/windows.rb +6 -4
- data/lib/puppet/provider/user/aix.rb +8 -4
- data/lib/puppet/provider/user/useradd.rb +6 -0
- data/lib/puppet/rails/benchmark.rb +2 -2
- data/lib/puppet/reports/store.rb +9 -9
- data/lib/puppet/resource/catalog.rb +2 -1
- data/lib/puppet/resource/type_collection.rb +2 -1
- data/lib/puppet/ssl/base.rb +1 -2
- data/lib/puppet/ssl/certificate_authority/interface.rb +1 -0
- data/lib/puppet/test/test_helper.rb +2 -1
- data/lib/puppet/type.rb +1 -1
- data/lib/puppet/type/augeas.rb +1 -1
- data/lib/puppet/type/file.rb +4 -2
- data/lib/puppet/type/scheduled_task.rb +8 -10
- data/lib/puppet/type/tidy.rb +1 -1
- data/lib/puppet/util.rb +63 -25
- data/lib/puppet/util/autoload.rb +6 -4
- data/lib/puppet/util/checksums.rb +3 -8
- data/lib/puppet/util/diff.rb +2 -1
- data/lib/puppet/util/filetype.rb +1 -3
- data/lib/puppet/util/run_mode.rb +2 -1
- data/lib/puppet/util/suidmanager.rb +1 -1
- data/lib/puppet/util/windows.rb +1 -0
- data/lib/puppet/util/windows/file.rb +27 -0
- data/lib/puppet/util/windows/user.rb +1 -2
- data/man/man8/puppet-agent.8 +4 -0
- data/man/man8/puppet-master.8 +4 -0
- data/man/man8/puppetmasterd.8 +4 -0
- data/spec/fixtures/unit/provider/augeas/augeas/augeas/lenses/test.aug +13 -0
- data/spec/fixtures/unit/provider/augeas/augeas/etc/fstab +10 -0
- data/spec/fixtures/unit/provider/augeas/augeas/etc/hosts +6 -0
- data/spec/fixtures/unit/provider/augeas/augeas/etc/test +3 -0
- data/spec/fixtures/unit/provider/augeas/augeas/test.aug +13 -0
- data/spec/fixtures/unit/provider/service/openrc/rcservice_list +8 -0
- data/spec/fixtures/unit/provider/service/openrc/rcstatus +43 -0
- data/spec/integration/defaults_spec.rb +3 -3
- data/spec/integration/network/server/mongrel_spec.rb +8 -6
- data/spec/integration/parser/parser_spec.rb +1 -1
- data/spec/integration/type/file_spec.rb +49 -12
- data/spec/lib/puppet_spec/database.rb +5 -3
- data/spec/lib/puppet_spec/files.rb +2 -1
- data/spec/monkey_patches/alias_should_to_must.rb +15 -2
- data/spec/shared_behaviours/file_serving_model.rb +9 -6
- data/spec/shared_behaviours/path_parameters.rb +5 -5
- data/spec/shared_behaviours/things_that_declare_options.rb +5 -5
- data/spec/unit/application/facts_spec.rb +1 -1
- data/spec/unit/application_spec.rb +10 -8
- data/spec/unit/configurer_spec.rb +11 -2
- data/spec/unit/face/ca_spec.rb +15 -15
- data/spec/unit/face/help_spec.rb +5 -5
- data/spec/unit/face/module/install_spec.rb +13 -2
- data/spec/unit/face/node_spec.rb +7 -6
- data/spec/unit/indirector/certificate_request/ca_spec.rb +1 -1
- data/spec/unit/indirector/envelope_spec.rb +0 -13
- data/spec/unit/indirector/facts/inventory_service_spec.rb +1 -1
- data/spec/unit/indirector/queue_spec.rb +3 -3
- data/spec/unit/indirector/rest_spec.rb +31 -20
- data/spec/unit/indirector_spec.rb +5 -5
- data/spec/unit/interface/action_builder_spec.rb +3 -2
- data/spec/unit/interface/action_manager_spec.rb +1 -1
- data/spec/unit/interface/action_spec.rb +4 -3
- data/spec/unit/interface/face_collection_spec.rb +1 -1
- data/spec/unit/interface/option_spec.rb +13 -9
- data/spec/unit/interface_spec.rb +5 -5
- data/spec/unit/module_tool/applications/unpacker_spec.rb +61 -0
- data/spec/unit/network/handler/fileserver_spec.rb +3 -3
- data/spec/unit/other/transbucket_spec.rb +6 -9
- data/spec/unit/parser/ast/resource_spec.rb +27 -0
- data/spec/unit/parser/functions/create_resources_spec.rb +12 -12
- data/spec/unit/parser/lexer_spec.rb +5 -5
- data/spec/unit/provider/augeas/augeas_spec.rb +78 -0
- data/spec/unit/provider/nameservice/directoryservice_spec.rb +6 -6
- data/spec/unit/provider/package/freebsd_spec.rb +2 -2
- data/spec/unit/provider/package/msi_spec.rb +181 -114
- data/spec/unit/provider/package/openbsd_spec.rb +1 -0
- data/spec/unit/provider/package/pkgdmg_spec.rb +3 -3
- data/spec/unit/provider/scheduled_task/win32_taskscheduler_spec.rb +1 -1
- data/spec/unit/provider/service/openrc_spec.rb +209 -0
- data/spec/unit/provider/service/windows_spec.rb +57 -59
- data/spec/unit/provider/user/useradd_spec.rb +7 -0
- data/spec/unit/reports/store_spec.rb +13 -13
- data/spec/unit/resource/catalog_spec.rb +29 -24
- data/spec/unit/resource_spec.rb +13 -13
- data/spec/unit/simple_graph_spec.rb +12 -12
- data/spec/unit/ssl/certificate_authority/interface_spec.rb +3 -3
- data/spec/unit/ssl/certificate_authority_spec.rb +11 -10
- data/spec/unit/transaction_spec.rb +3 -3
- data/spec/unit/type/cron_spec.rb +171 -171
- data/spec/unit/type/exec_spec.rb +29 -27
- data/spec/unit/type/file_spec.rb +22 -13
- data/spec/unit/type/interface_spec.rb +1 -1
- data/spec/unit/type/scheduled_task_spec.rb +15 -14
- data/spec/unit/type/tidy_spec.rb +2 -2
- data/spec/unit/type/user_spec.rb +15 -15
- data/spec/unit/type/vlan_spec.rb +1 -1
- data/spec/unit/type_spec.rb +22 -25
- data/spec/unit/util/autoload_spec.rb +13 -7
- data/spec/unit/util/backups_spec.rb +36 -67
- data/spec/unit/util/storage_spec.rb +2 -9
- data/spec/unit/util/suidmanager_spec.rb +1 -1
- data/spec/unit/util_spec.rb +20 -28
- data/test/ral/manager/attributes.rb +1 -1
- metadata +1553 -1542
@@ -46,7 +46,7 @@ shared_examples_for "all pathname parameters with arrays" do |win32|
|
|
46
46
|
it "should #{reject ? 'reject' : 'accept'} #{set.join(", ")}" do
|
47
47
|
if reject then
|
48
48
|
expect { instance(data) }.
|
49
|
-
|
49
|
+
to raise_error Puppet::Error, /fully qualified/
|
50
50
|
else
|
51
51
|
instance = instance(data)
|
52
52
|
instance[@param].should == data
|
@@ -56,7 +56,7 @@ shared_examples_for "all pathname parameters with arrays" do |win32|
|
|
56
56
|
it "should #{reject ? 'reject' : 'accept'} #{set.join(", ")} doubled" do
|
57
57
|
if reject then
|
58
58
|
expect { instance(data + data) }.
|
59
|
-
|
59
|
+
to raise_error Puppet::Error, /fully qualified/
|
60
60
|
else
|
61
61
|
instance = instance(data + data)
|
62
62
|
instance[@param].should == (data + data)
|
@@ -101,7 +101,7 @@ shared_examples_for "all path parameters" do |param, options|
|
|
101
101
|
it "should give a useful error when the path is not absolute" do
|
102
102
|
path = 'foo'
|
103
103
|
expect { instance(path) }.
|
104
|
-
|
104
|
+
to raise_error Puppet::Error, /fully qualified/
|
105
105
|
end
|
106
106
|
|
107
107
|
{ "Unix" => '/', "Win32" => '\\' }.each do |style, slash|
|
@@ -109,7 +109,7 @@ shared_examples_for "all path parameters" do |param, options|
|
|
109
109
|
it "should reject drive letter '#{drive}' with #{style} path separators" do
|
110
110
|
path = "#{drive}:#{slash}Program Files"
|
111
111
|
expect { instance(path) }.
|
112
|
-
|
112
|
+
to raise_error Puppet::Error, /fully qualified/
|
113
113
|
end
|
114
114
|
end
|
115
115
|
end
|
@@ -128,7 +128,7 @@ shared_examples_for "all path parameters" do |param, options|
|
|
128
128
|
it "should give a useful error when the path is not absolute" do
|
129
129
|
path = 'foo'
|
130
130
|
expect { instance(path) }.
|
131
|
-
|
131
|
+
to raise_error Puppet::Error, /fully qualified/
|
132
132
|
end
|
133
133
|
|
134
134
|
it "also accepts Unix style path separators" do
|
@@ -52,7 +52,7 @@ shared_examples_for "things that declare options" do
|
|
52
52
|
option "--foo"
|
53
53
|
option "--foo"
|
54
54
|
end
|
55
|
-
}.
|
55
|
+
}.to raise_error ArgumentError, /Option foo conflicts with existing option foo/i
|
56
56
|
end
|
57
57
|
|
58
58
|
it "should detect conflicts in short options" do
|
@@ -61,7 +61,7 @@ shared_examples_for "things that declare options" do
|
|
61
61
|
option "-f"
|
62
62
|
option "-f"
|
63
63
|
end
|
64
|
-
}.
|
64
|
+
}.to raise_error ArgumentError, /Option f conflicts with existing option f/
|
65
65
|
end
|
66
66
|
|
67
67
|
["-f", "--foo"].each do |option|
|
@@ -72,7 +72,7 @@ shared_examples_for "things that declare options" do
|
|
72
72
|
add_options_to do
|
73
73
|
option input, input
|
74
74
|
end
|
75
|
-
}.
|
75
|
+
}.to raise_error ArgumentError, /duplicates existing alias/
|
76
76
|
end
|
77
77
|
end
|
78
78
|
end
|
@@ -90,13 +90,13 @@ shared_examples_for "things that declare options" do
|
|
90
90
|
option *base
|
91
91
|
option *conflict
|
92
92
|
end
|
93
|
-
}.
|
93
|
+
}.to raise_error ArgumentError, /conflicts with existing option/
|
94
94
|
end
|
95
95
|
end
|
96
96
|
|
97
97
|
it "should fail if we are not consistent about taking an argument" do
|
98
98
|
expect { add_options_to do option "--foo=bar", "--bar" end }.
|
99
|
-
|
99
|
+
to raise_error ArgumentError, /inconsistent about taking an argument/
|
100
100
|
end
|
101
101
|
|
102
102
|
it "should not accept optional arguments" do
|
@@ -32,9 +32,11 @@ describe Puppet::Application do
|
|
32
32
|
end
|
33
33
|
|
34
34
|
it "should exit if it can't find a class" do
|
35
|
-
|
36
|
-
|
37
|
-
|
35
|
+
@klass.expects(:puts).with do |value|
|
36
|
+
value =~ /Unable to find application 'ThisShallNeverEverEverExist'/ and
|
37
|
+
value =~ /puppet\/application\/thisshallneverevereverexist/ and
|
38
|
+
value =~ /no such file to load|cannot load such file/
|
39
|
+
end
|
38
40
|
|
39
41
|
expect { @klass.find("ThisShallNeverEverEverExist") }.to exit_with 1
|
40
42
|
end
|
@@ -80,7 +82,7 @@ describe Puppet::Application do
|
|
80
82
|
|
81
83
|
app.class.run_mode.name.should == :agent
|
82
84
|
$puppet_application_mode.name.should == :agent
|
83
|
-
}.
|
85
|
+
}.to_not raise_error
|
84
86
|
|
85
87
|
Puppet[:run_mode].should == "agent"
|
86
88
|
end
|
@@ -93,7 +95,7 @@ describe Puppet::Application do
|
|
93
95
|
$puppet_application_mode.name.should == :master
|
94
96
|
app.set_run_mode app.class.run_mode "agent"
|
95
97
|
$puppet_application_mode.name.should == :agent
|
96
|
-
}.
|
98
|
+
}.to raise_error
|
97
99
|
end
|
98
100
|
|
99
101
|
it "should explode when an invalid run mode is set at runtime, for great victory"
|
@@ -432,7 +434,7 @@ describe Puppet::Application do
|
|
432
434
|
it "should not fail if the route file doesn't exist" do
|
433
435
|
Puppet[:route_file] = "/dev/null/non-existent"
|
434
436
|
|
435
|
-
expect { @app.configure_indirector_routes }.
|
437
|
+
expect { @app.configure_indirector_routes }.to_not raise_error
|
436
438
|
end
|
437
439
|
|
438
440
|
it "should raise an error if the routes file is invalid" do
|
@@ -443,7 +445,7 @@ describe Puppet::Application do
|
|
443
445
|
ROUTES
|
444
446
|
end
|
445
447
|
|
446
|
-
expect { @app.configure_indirector_routes }.
|
448
|
+
expect { @app.configure_indirector_routes }.to raise_error
|
447
449
|
end
|
448
450
|
end
|
449
451
|
|
@@ -565,7 +567,7 @@ describe Puppet::Application do
|
|
565
567
|
raise "I can't believe it, it works!"
|
566
568
|
end
|
567
569
|
|
568
|
-
|
570
|
+
expect { @app.handle_test2 }.to raise_error
|
569
571
|
end
|
570
572
|
|
571
573
|
it "should declare the option to OptionParser" do
|
@@ -430,9 +430,18 @@ describe Puppet::Configurer do
|
|
430
430
|
end
|
431
431
|
|
432
432
|
it "should log but not fail if saving the last run summary fails" do
|
433
|
-
|
433
|
+
# The mock will raise an exception on any method used. This should
|
434
|
+
# simulate a nice hard failure from the underlying OS for us.
|
435
|
+
fh = Class.new(Object) do
|
436
|
+
def method_missing(*args)
|
437
|
+
raise "failed to do #{args[0]}"
|
438
|
+
end
|
439
|
+
end.new
|
440
|
+
|
441
|
+
Puppet::Util.expects(:replace_file).yields(fh)
|
442
|
+
|
434
443
|
Puppet.expects(:err)
|
435
|
-
|
444
|
+
expect { @configurer.save_last_run_summary(@report) }.should_not raise_error
|
436
445
|
end
|
437
446
|
end
|
438
447
|
|
data/spec/unit/face/ca_spec.rb
CHANGED
@@ -40,7 +40,7 @@ describe Puppet::Face[:ca, '0.1.0'], :unless => Puppet.features.microsoft_window
|
|
40
40
|
:host => 'random-host', :valid => false,
|
41
41
|
:error => 'Could not find a certificate for random-host'
|
42
42
|
}
|
43
|
-
}.
|
43
|
+
}.to_not raise_error
|
44
44
|
end
|
45
45
|
|
46
46
|
it "should not explode if there is only a CSR" do
|
@@ -50,7 +50,7 @@ describe Puppet::Face[:ca, '0.1.0'], :unless => Puppet.features.microsoft_window
|
|
50
50
|
:host => 'random-host', :valid => false,
|
51
51
|
:error => 'Could not find a certificate for random-host'
|
52
52
|
}
|
53
|
-
}.
|
53
|
+
}.to_not raise_error
|
54
54
|
end
|
55
55
|
|
56
56
|
it "should verify a signed certificate" do
|
@@ -69,7 +69,7 @@ describe Puppet::Face[:ca, '0.1.0'], :unless => Puppet.features.microsoft_window
|
|
69
69
|
:host => 'random-host', :valid => false,
|
70
70
|
:error => 'certificate revoked'
|
71
71
|
}
|
72
|
-
}.
|
72
|
+
}.to_not raise_error
|
73
73
|
end
|
74
74
|
|
75
75
|
it "should verify a revoked certificate if CRL use was turned off" do
|
@@ -93,14 +93,14 @@ describe Puppet::Face[:ca, '0.1.0'], :unless => Puppet.features.microsoft_window
|
|
93
93
|
it "should not explode if there is no certificate" do
|
94
94
|
expect {
|
95
95
|
subject.fingerprint('random-host').should be_nil
|
96
|
-
}.
|
96
|
+
}.to_not raise_error
|
97
97
|
end
|
98
98
|
|
99
99
|
it "should fingerprint a CSR" do
|
100
100
|
make_certs('random-host', [])
|
101
101
|
expect {
|
102
102
|
subject.fingerprint('random-host').should =~ /^[0-9A-F:]+$/
|
103
|
-
}.
|
103
|
+
}.to_not raise_error
|
104
104
|
end
|
105
105
|
|
106
106
|
it "should fingerprint a certificate" do
|
@@ -128,14 +128,14 @@ describe Puppet::Face[:ca, '0.1.0'], :unless => Puppet.features.microsoft_window
|
|
128
128
|
it "should not explode if there is no certificate" do
|
129
129
|
expect {
|
130
130
|
subject.print('random-host').should be_nil
|
131
|
-
}.
|
131
|
+
}.to_not raise_error
|
132
132
|
end
|
133
133
|
|
134
134
|
it "should return nothing if there is only a CSR" do
|
135
135
|
make_certs('random-host', [])
|
136
136
|
expect {
|
137
137
|
subject.print('random-host').should be_nil
|
138
|
-
}.
|
138
|
+
}.to_not raise_error
|
139
139
|
end
|
140
140
|
|
141
141
|
it "should return the certificate content if there is a cert" do
|
@@ -155,7 +155,7 @@ describe Puppet::Face[:ca, '0.1.0'], :unless => Puppet.features.microsoft_window
|
|
155
155
|
expect {
|
156
156
|
subject.sign('random-host').
|
157
157
|
should == 'Could not find certificate request for random-host'
|
158
|
-
}.
|
158
|
+
}.to_not raise_error
|
159
159
|
end
|
160
160
|
|
161
161
|
it "should not explode if there is a signed cert" do
|
@@ -163,7 +163,7 @@ describe Puppet::Face[:ca, '0.1.0'], :unless => Puppet.features.microsoft_window
|
|
163
163
|
expect {
|
164
164
|
subject.sign('random-host').
|
165
165
|
should == 'Could not find certificate request for random-host'
|
166
|
-
}.
|
166
|
+
}.to_not raise_error
|
167
167
|
end
|
168
168
|
|
169
169
|
it "should sign a CSR if one exists" do
|
@@ -216,14 +216,14 @@ describe Puppet::Face[:ca, '0.1.0'], :unless => Puppet.features.microsoft_window
|
|
216
216
|
make_certs('random-host', [])
|
217
217
|
expect {
|
218
218
|
subject.generate('random-host').should =~ /already has a certificate request/
|
219
|
-
}.
|
219
|
+
}.to_not raise_error
|
220
220
|
end
|
221
221
|
|
222
222
|
it "should not explode if the certificate with that name already exists" do
|
223
223
|
make_certs([], 'random-host')
|
224
224
|
expect {
|
225
225
|
subject.generate('random-host').should =~ /already has a certificate/
|
226
|
-
}.
|
226
|
+
}.to_not raise_error
|
227
227
|
end
|
228
228
|
|
229
229
|
it "should include the specified DNS alt names" do
|
@@ -242,7 +242,7 @@ describe Puppet::Face[:ca, '0.1.0'], :unless => Puppet.features.microsoft_window
|
|
242
242
|
let :action do Puppet::Face[:ca, '0.1.0'].get_action(:revoke) end
|
243
243
|
|
244
244
|
it "should not explode when asked to revoke something that doesn't exist" do
|
245
|
-
expect { subject.revoke('nonesuch') }.
|
245
|
+
expect { subject.revoke('nonesuch') }.to_not raise_error
|
246
246
|
end
|
247
247
|
|
248
248
|
it "should let the user know what went wrong" do
|
@@ -267,7 +267,7 @@ describe Puppet::Face[:ca, '0.1.0'], :unless => Puppet.features.microsoft_window
|
|
267
267
|
let :action do Puppet::Face[:ca, '0.1.0'].get_action(:destroy) end
|
268
268
|
|
269
269
|
it "should not explode when asked to delete something that doesn't exist" do
|
270
|
-
expect { subject.destroy('nonesuch') }.
|
270
|
+
expect { subject.destroy('nonesuch') }.to_not raise_error
|
271
271
|
end
|
272
272
|
|
273
273
|
it "should let the user know if nothing was deleted" do
|
@@ -325,7 +325,7 @@ describe Puppet::Face[:ca, '0.1.0'], :unless => Puppet.features.microsoft_window
|
|
325
325
|
it "should not fail when a matcher is passed" do
|
326
326
|
expect {
|
327
327
|
subject.list(type.merge :subject => '.').should == []
|
328
|
-
}.
|
328
|
+
}.to_not raise_error
|
329
329
|
end
|
330
330
|
|
331
331
|
context "when_rendering :console" do
|
@@ -394,7 +394,7 @@ describe Puppet::Face[:ca, '0.1.0'], :unless => Puppet.features.microsoft_window
|
|
394
394
|
else
|
395
395
|
raise "#{action} has arity #{subject.method(action).arity}"
|
396
396
|
end
|
397
|
-
}.
|
397
|
+
}.to raise_error(/Not a CA/)
|
398
398
|
end
|
399
399
|
end
|
400
400
|
end
|
data/spec/unit/face/help_spec.rb
CHANGED
@@ -12,20 +12,20 @@ describe Puppet::Face[:help, '0.0.1'] do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
it "should accept a call with no arguments" do
|
15
|
-
expect { subject.help() }.
|
15
|
+
expect { subject.help() }.to_not raise_error
|
16
16
|
end
|
17
17
|
|
18
18
|
it "should accept a face name" do
|
19
|
-
expect { subject.help(:help) }.
|
19
|
+
expect { subject.help(:help) }.to_not raise_error
|
20
20
|
end
|
21
21
|
|
22
22
|
it "should accept a face and action name" do
|
23
|
-
expect { subject.help(:help, :help) }.
|
23
|
+
expect { subject.help(:help, :help) }.to_not raise_error
|
24
24
|
end
|
25
25
|
|
26
26
|
it "should fail if more than a face and action are given" do
|
27
27
|
expect { subject.help(:help, :help, :for_the_love_of_god) }.
|
28
|
-
|
28
|
+
to raise_error ArgumentError
|
29
29
|
end
|
30
30
|
|
31
31
|
it "should treat :current and 'current' identically" do
|
@@ -35,7 +35,7 @@ describe Puppet::Face[:help, '0.0.1'] do
|
|
35
35
|
|
36
36
|
it "should complain when the request version of a face is missing" do
|
37
37
|
expect { subject.help(:huzzah, :bar, :version => '17.0.0') }.
|
38
|
-
|
38
|
+
to raise_error Puppet::Error
|
39
39
|
end
|
40
40
|
|
41
41
|
it "should find a face by version" do
|
@@ -88,15 +88,26 @@ describe "puppet module install" do
|
|
88
88
|
|
89
89
|
Puppet.settings[:modulepath].should == fakemodpath
|
90
90
|
end
|
91
|
+
|
92
|
+
it "should expand the target directory derived from the modulepath" do
|
93
|
+
options[:modulepath] = "modules"
|
94
|
+
expanded_path = File.expand_path("modules")
|
95
|
+
expected_options.merge!(options)
|
96
|
+
expected_options[:target_dir] = expanded_path
|
97
|
+
expected_options[:modulepath] = "modules"
|
98
|
+
|
99
|
+
Puppet::ModuleTool::Applications::Installer.expects(:run).with("puppetlabs-apache", expected_options).once
|
100
|
+
subject.install("puppetlabs-apache", options)
|
101
|
+
end
|
91
102
|
end
|
92
103
|
|
93
104
|
describe "when target-dir option is passed" do
|
94
|
-
it "should expand the target directory" do
|
105
|
+
it "should expand the target directory when target_dir is set" do
|
95
106
|
options[:target_dir] = "modules"
|
96
107
|
expanded_path = File.expand_path("modules")
|
97
108
|
expected_options.merge!(options)
|
98
109
|
expected_options[:target_dir] = expanded_path
|
99
|
-
expected_options[:modulepath] = "#{
|
110
|
+
expected_options[:modulepath] = "modules#{sep}#{fakemodpath}"
|
100
111
|
|
101
112
|
Puppet::ModuleTool::Applications::Installer.expects(:run).with("puppetlabs-apache", expected_options).once
|
102
113
|
subject.install("puppetlabs-apache", options)
|
data/spec/unit/face/node_spec.rb
CHANGED
@@ -48,26 +48,27 @@ describe Puppet::Face[:node, '0.0.1'] do
|
|
48
48
|
end
|
49
49
|
|
50
50
|
it "should not accept a call with no arguments" do
|
51
|
-
expect { subject.clean() }.
|
51
|
+
expect { subject.clean() }.to raise_error
|
52
52
|
end
|
53
53
|
|
54
54
|
it "should accept a node name" do
|
55
|
-
expect { subject.clean('hostname') }.
|
55
|
+
expect { subject.clean('hostname') }.to_not raise_error
|
56
56
|
end
|
57
57
|
|
58
58
|
it "should accept more than one node name" do
|
59
59
|
expect do
|
60
60
|
subject.clean('hostname', 'hostname2', {})
|
61
|
-
end.
|
61
|
+
end.to_not raise_error
|
62
62
|
|
63
63
|
expect do
|
64
64
|
subject.clean('hostname', 'hostname2', 'hostname3', { :unexport => true })
|
65
|
-
end.
|
65
|
+
end.to_not raise_error
|
66
66
|
end
|
67
67
|
|
68
68
|
it "should accept the option --unexport" do
|
69
|
-
expect {
|
70
|
-
|
69
|
+
expect {
|
70
|
+
subject.help('hostname', :unexport => true)
|
71
|
+
}.to_not raise_error(ArgumentError)
|
71
72
|
end
|
72
73
|
|
73
74
|
context "clean action" do
|
@@ -48,7 +48,7 @@ describe Puppet::SSL::CertificateRequest::Ca, :unless => Puppet.features.microso
|
|
48
48
|
host.generate_certificate_request
|
49
49
|
@ca.sign(host.name)
|
50
50
|
|
51
|
-
expect { Puppet::SSL::Host.indirection.find("bar").generate_certificate_request }.
|
51
|
+
expect { Puppet::SSL::Host.indirection.find("bar").generate_certificate_request }.to raise_error(/ignoring certificate request/)
|
52
52
|
|
53
53
|
Puppet::SSL::Certificate.indirection.find("bar").name.should == "bar"
|
54
54
|
Puppet::SSL::CertificateRequest.indirection.find("bar").should be_nil
|
@@ -8,19 +8,6 @@ describe Puppet::Indirector::Envelope do
|
|
8
8
|
@instance.extend(Puppet::Indirector::Envelope)
|
9
9
|
end
|
10
10
|
|
11
|
-
it "should have an expiration accessor" do
|
12
|
-
@instance.expiration = "testing"
|
13
|
-
@instance.expiration.should == "testing"
|
14
|
-
end
|
15
|
-
|
16
|
-
it "should have an expiration setter" do
|
17
|
-
@instance.should respond_to(:expiration=)
|
18
|
-
end
|
19
|
-
|
20
|
-
it "should have a means of testing whether it is expired" do
|
21
|
-
@instance.should respond_to(:expired?)
|
22
|
-
end
|
23
|
-
|
24
11
|
describe "when testing if it is expired" do
|
25
12
|
it "should return false if there is no expiration set" do
|
26
13
|
@instance.should_not be_expired
|
@@ -49,7 +49,7 @@ describe Puppet::Indirector::Queue, :if => Puppet.features.pson? do
|
|
49
49
|
it "should require PSON" do
|
50
50
|
Puppet.features.expects(:pson?).returns false
|
51
51
|
|
52
|
-
|
52
|
+
expect { @store_class.new }.to raise_error(ArgumentError)
|
53
53
|
end
|
54
54
|
|
55
55
|
it 'should use the correct client type and queue' do
|
@@ -75,7 +75,7 @@ describe Puppet::Indirector::Queue, :if => Puppet.features.pson? do
|
|
75
75
|
it "should catch any exceptions raised" do
|
76
76
|
@store.client.expects(:publish_message).raises ArgumentError
|
77
77
|
|
78
|
-
|
78
|
+
expect { @store.save(@request) }.to raise_error(Puppet::Error)
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
@@ -110,7 +110,7 @@ describe Puppet::Indirector::Queue, :if => Puppet.features.pson? do
|
|
110
110
|
it "should log but not propagate errors" do
|
111
111
|
@store_class.client.expects(:subscribe).yields("foo")
|
112
112
|
@store_class.expects(:intern).raises(ArgumentError)
|
113
|
-
expect { @store_class.subscribe {|o| o } }.
|
113
|
+
expect { @store_class.subscribe {|o| o } }.to_not raise_error
|
114
114
|
|
115
115
|
@logs.length.should == 1
|
116
116
|
@logs.first.message.should =~ /Error occured with subscription to queue my_queue for indirection my_queue: ArgumentError/
|