puppet 6.0.2-x64-mingw32 → 6.0.3-x64-mingw32
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.
- checksums.yaml +4 -4
- data/Gemfile +2 -2
- data/Gemfile.lock +11 -11
- data/lib/puppet/application.rb +5 -0
- data/lib/puppet/application/apply.rb +1 -0
- data/lib/puppet/application/script.rb +1 -1
- data/lib/puppet/application/ssl.rb +119 -49
- data/lib/puppet/defaults.rb +9 -27
- data/lib/puppet/face/node/clean.rb +0 -1
- data/lib/puppet/feature/base.rb +1 -1
- data/lib/puppet/file_serving/fileset.rb +1 -1
- data/lib/puppet/pops/validation/checker4_0.rb +4 -2
- data/lib/puppet/provider/package/windows.rb +2 -2
- data/lib/puppet/provider/package/windows/exe_package.rb +3 -10
- data/lib/puppet/provider/service/windows.rb +11 -3
- data/lib/puppet/provider/user/useradd.rb +2 -10
- data/lib/puppet/resource/catalog.rb +1 -5
- data/lib/puppet/ssl/host.rb +7 -9
- data/lib/puppet/transaction/persistence.rb +1 -1
- data/lib/puppet/type/package.rb +1 -1
- data/lib/puppet/type/user.rb +4 -1
- data/lib/puppet/util.rb +7 -3
- data/lib/puppet/util/execution.rb +1 -0
- data/lib/puppet/util/logging.rb +3 -2
- data/lib/puppet/util/windows/process.rb +6 -2
- data/lib/puppet/util/windows/security.rb +14 -0
- data/lib/puppet/util/windows/service.rb +217 -74
- data/lib/puppet/util/windows/user.rb +3 -5
- data/lib/puppet/version.rb +1 -1
- data/locales/ja/puppet.po +505 -276
- data/locales/puppet.pot +250 -111
- data/man/man5/puppet.conf.5 +8 -1
- data/man/man8/puppet-ssl.8 +22 -2
- data/man/man8/puppet.8 +1 -1
- data/spec/integration/parser/collection_spec.rb +4 -8
- data/spec/integration/type/file_spec.rb +6 -6
- data/spec/integration/util/windows/security_spec.rb +10 -7
- data/spec/integration/util/windows/user_spec.rb +37 -17
- data/spec/lib/puppet/test_ca.rb +1 -1
- data/spec/unit/agent_spec.rb +2 -2
- data/spec/unit/application/apply_spec.rb +41 -2
- data/spec/unit/application/face_base_spec.rb +1 -1
- data/spec/unit/application/ssl_spec.rb +160 -110
- data/spec/unit/application_spec.rb +29 -11
- data/spec/unit/configurer/downloader_spec.rb +1 -1
- data/spec/unit/configurer_spec.rb +5 -5
- data/spec/unit/face/node_spec.rb +1 -3
- data/spec/unit/file_serving/fileset_spec.rb +11 -11
- data/spec/unit/network/http/connection_spec.rb +2 -2
- data/spec/unit/pops/validator/validator_spec.rb +24 -10
- data/spec/unit/provider/package/windows/exe_package_spec.rb +3 -3
- data/spec/unit/provider/package/windows_spec.rb +4 -4
- data/spec/unit/provider/service/windows_spec.rb +21 -3
- data/spec/unit/provider/user/useradd_spec.rb +2 -2
- data/spec/unit/resource/catalog_spec.rb +2 -2
- data/spec/unit/ssl/host_spec.rb +1 -1
- data/spec/unit/transaction/persistence_spec.rb +4 -4
- data/spec/unit/util/execution_spec.rb +19 -1
- data/spec/unit/util/logging_spec.rb +58 -0
- data/spec/unit/util/windows/service_spec.rb +344 -191
- metadata +2 -2
@@ -33,7 +33,7 @@ describe Puppet::Application do
|
|
33
33
|
describe "application defaults" do
|
34
34
|
it "should fail if required app default values are missing" do
|
35
35
|
@app.stubs(:app_defaults).returns({ :foo => 'bar' })
|
36
|
-
Puppet.expects(:
|
36
|
+
Puppet.expects(:send_log).with(:err, regexp_matches(/missing required app default setting/))
|
37
37
|
expect {
|
38
38
|
@app.run
|
39
39
|
}.to exit_with(1)
|
@@ -55,10 +55,10 @@ describe Puppet::Application do
|
|
55
55
|
end
|
56
56
|
|
57
57
|
it "should error if it can't find a class" do
|
58
|
-
Puppet.expects(:
|
59
|
-
|
60
|
-
|
61
|
-
|
58
|
+
Puppet.expects(:send_log).with do |_level, message|
|
59
|
+
message =~ /Unable to find application 'ThisShallNeverEverEverExist'/ and
|
60
|
+
message =~ /puppet\/application\/thisshallneverevereverexist/ and
|
61
|
+
message =~ /no such file to load|cannot load such file/
|
62
62
|
end
|
63
63
|
|
64
64
|
expect {
|
@@ -422,7 +422,6 @@ describe Puppet::Application do
|
|
422
422
|
end
|
423
423
|
|
424
424
|
describe "when calling default setup" do
|
425
|
-
|
426
425
|
before :each do
|
427
426
|
@app.options.stubs(:[])
|
428
427
|
end
|
@@ -443,6 +442,14 @@ describe Puppet::Application do
|
|
443
442
|
|
444
443
|
@app.setup
|
445
444
|
end
|
445
|
+
|
446
|
+
it "sets the log destination if provided via settings" do
|
447
|
+
@app.options.unstub(:[])
|
448
|
+
Puppet[:logdest] = "set_via_config"
|
449
|
+
Puppet::Util::Log.expects(:newdestination).with("set_via_config")
|
450
|
+
|
451
|
+
@app.setup
|
452
|
+
end
|
446
453
|
|
447
454
|
it "does not downgrade the loglevel when --verbose is specified" do
|
448
455
|
Puppet[:log_level] = :debug
|
@@ -553,19 +560,19 @@ describe Puppet::Application do
|
|
553
560
|
end
|
554
561
|
|
555
562
|
it "should warn and exit if no command can be called" do
|
556
|
-
Puppet.expects(:err)
|
563
|
+
Puppet.expects(:send_log).with(:err, "Could not run: No valid command or main")
|
557
564
|
expect { @app.run }.to exit_with 1
|
558
565
|
end
|
559
566
|
|
560
567
|
it "should raise an error if dispatch returns no command" do
|
561
568
|
@app.stubs(:get_command).returns(nil)
|
562
|
-
Puppet.expects(:err)
|
569
|
+
Puppet.expects(:send_log).with(:err, "Could not run: No valid command or main")
|
563
570
|
expect { @app.run }.to exit_with 1
|
564
571
|
end
|
565
572
|
|
566
573
|
it "should raise an error if dispatch returns an invalid command" do
|
567
574
|
@app.stubs(:get_command).returns(:this_function_doesnt_exist)
|
568
|
-
Puppet.expects(:err)
|
575
|
+
Puppet.expects(:send_log).with(:err, "Could not run: No valid command or main")
|
569
576
|
expect { @app.run }.to exit_with 1
|
570
577
|
end
|
571
578
|
end
|
@@ -652,7 +659,6 @@ describe Puppet::Application do
|
|
652
659
|
end
|
653
660
|
|
654
661
|
describe "#handle_logdest_arg" do
|
655
|
-
|
656
662
|
let(:test_arg) { "arg_test_logdest" }
|
657
663
|
|
658
664
|
it "should log an exception that is raised" do
|
@@ -672,6 +678,18 @@ describe Puppet::Application do
|
|
672
678
|
@app.handle_logdest_arg(test_arg)
|
673
679
|
expect(@app.options[:setdest]).to be_truthy
|
674
680
|
end
|
675
|
-
end
|
676
681
|
|
682
|
+
it "does not set the log destination if setdest is true" do
|
683
|
+
Puppet::Util::Log.expects(:newdestination).never
|
684
|
+
@app.options[:setdest] = true
|
685
|
+
|
686
|
+
@app.handle_logdest_arg(test_arg)
|
687
|
+
end
|
688
|
+
|
689
|
+
it "does not set the log destination if arg is nil" do
|
690
|
+
Puppet::Util::Log.expects(:newdestination).never
|
691
|
+
|
692
|
+
@app.handle_logdest_arg(nil)
|
693
|
+
end
|
694
|
+
end
|
677
695
|
end
|
@@ -222,7 +222,7 @@ describe Puppet::Configurer::Downloader do
|
|
222
222
|
end
|
223
223
|
|
224
224
|
it "should catch and log exceptions" do
|
225
|
-
Puppet.expects(:
|
225
|
+
Puppet.expects(:log_exception)
|
226
226
|
# The downloader creates a new catalog for each apply, and really the only object
|
227
227
|
# that it is possible to stub for the purpose of generating a puppet error
|
228
228
|
Puppet::Resource::Catalog.any_instance.stubs(:apply).raises(Puppet::Error, "testing")
|
@@ -551,8 +551,8 @@ describe Puppet::Configurer do
|
|
551
551
|
|
552
552
|
Puppet::Transaction::Report.indirection.expects(:save).raises("whatever")
|
553
553
|
|
554
|
-
Puppet.expects(:err)
|
555
|
-
|
554
|
+
Puppet.expects(:send_log).with(:err, 'Could not send report: whatever')
|
555
|
+
@configurer.send_report(@report)
|
556
556
|
end
|
557
557
|
end
|
558
558
|
|
@@ -590,8 +590,8 @@ describe Puppet::Configurer do
|
|
590
590
|
|
591
591
|
Puppet::Util.expects(:replace_file).yields(fh)
|
592
592
|
|
593
|
-
Puppet.expects(:err)
|
594
|
-
|
593
|
+
Puppet.expects(:send_log).with(:err, 'Could not save last run local report: failed to do print')
|
594
|
+
@configurer.save_last_run_summary(@report)
|
595
595
|
end
|
596
596
|
|
597
597
|
it "should create the last run file with the correct mode" do
|
@@ -609,7 +609,7 @@ describe Puppet::Configurer do
|
|
609
609
|
|
610
610
|
it "should report invalid last run file permissions" do
|
611
611
|
Puppet.settings.setting(:lastrunfile).expects(:mode).returns('892')
|
612
|
-
Puppet.expects(:
|
612
|
+
Puppet.expects(:send_log).with(:err, regexp_matches(/Could not save last run local report.*892 is invalid/))
|
613
613
|
@configurer.save_last_run_summary(@report)
|
614
614
|
end
|
615
615
|
end
|
data/spec/unit/face/node_spec.rb
CHANGED
@@ -2,8 +2,6 @@
|
|
2
2
|
require 'spec_helper'
|
3
3
|
require 'puppet/face'
|
4
4
|
|
5
|
-
require 'puppetserver/ca/cli'
|
6
|
-
|
7
5
|
describe Puppet::Face[:node, '0.0.1'] do
|
8
6
|
describe '#cleanup' do
|
9
7
|
it "should clean everything" do
|
@@ -90,7 +88,7 @@ describe Puppet::Face[:node, '0.0.1'] do
|
|
90
88
|
end
|
91
89
|
end
|
92
90
|
|
93
|
-
describe "when cleaning certificate" do
|
91
|
+
describe "when cleaning certificate", :if => Puppet.features.puppetserver_ca? do
|
94
92
|
it "should call the CA CLI gem's clean action" do
|
95
93
|
Puppetserver::Ca::Action::Clean.any_instance.expects(:run).with({ 'certnames' => ['hostname'] }).returns(0)
|
96
94
|
subject.clean_cert('hostname')
|
@@ -147,12 +147,12 @@ describe Puppet::FileServing::Fileset do
|
|
147
147
|
top_names = %w{one two .svn CVS}
|
148
148
|
sub_names = %w{file1 file2 .svn CVS 0 false}
|
149
149
|
|
150
|
-
Dir.stubs(:entries).with(path).returns(top_names)
|
150
|
+
Dir.stubs(:entries).with(path, encoding: Encoding::UTF_8).returns(top_names)
|
151
151
|
top_names.each do |subdir|
|
152
152
|
@files << subdir # relative path
|
153
153
|
subpath = File.join(path, subdir)
|
154
154
|
Puppet::FileSystem.stubs(stat_method).with(subpath).returns @dirstat
|
155
|
-
Dir.stubs(:entries).with(subpath).returns(sub_names)
|
155
|
+
Dir.stubs(:entries).with(subpath, encoding: Encoding::UTF_8).returns(sub_names)
|
156
156
|
sub_names.each do |file|
|
157
157
|
@files << File.join(subdir, file) # relative path
|
158
158
|
subfile_path = File.join(subpath, file)
|
@@ -173,7 +173,7 @@ describe Puppet::FileServing::Fileset do
|
|
173
173
|
extend Mocha::API
|
174
174
|
path = File.join(base_path, name)
|
175
175
|
Puppet::FileSystem.stubs(:lstat).with(path).returns MockStat.new(path, true)
|
176
|
-
Dir.stubs(:entries).with(path).returns(['.', '..'] + entries.map(&:name))
|
176
|
+
Dir.stubs(:entries).with(path, encoding: Encoding::UTF_8).returns(['.', '..'] + entries.map(&:name))
|
177
177
|
entries.each do |entry|
|
178
178
|
entry.mock(path)
|
179
179
|
end
|
@@ -295,7 +295,7 @@ describe Puppet::FileServing::Fileset do
|
|
295
295
|
link_path = File.join(path, "mylink")
|
296
296
|
Puppet::FileSystem.expects(:stat).with(link_path).raises(Errno::ENOENT)
|
297
297
|
|
298
|
-
Dir.stubs(:entries).with(path).returns(["mylink"])
|
298
|
+
Dir.stubs(:entries).with(path, encoding: Encoding::UTF_8).returns(["mylink"])
|
299
299
|
|
300
300
|
fileset = Puppet::FileServing::Fileset.new(path)
|
301
301
|
|
@@ -319,9 +319,9 @@ describe Puppet::FileServing::Fileset do
|
|
319
319
|
end
|
320
320
|
|
321
321
|
it "returns a hash of all files in each fileset with the value being the base path" do
|
322
|
-
Dir.expects(:entries).with(make_absolute("/first/path")).returns(%w{one uno})
|
323
|
-
Dir.expects(:entries).with(make_absolute("/second/path")).returns(%w{two dos})
|
324
|
-
Dir.expects(:entries).with(make_absolute("/third/path")).returns(%w{three tres})
|
322
|
+
Dir.expects(:entries).with(make_absolute("/first/path"), encoding: Encoding::UTF_8).returns(%w{one uno})
|
323
|
+
Dir.expects(:entries).with(make_absolute("/second/path"), encoding: Encoding::UTF_8).returns(%w{two dos})
|
324
|
+
Dir.expects(:entries).with(make_absolute("/third/path"), encoding: Encoding::UTF_8).returns(%w{three tres})
|
325
325
|
|
326
326
|
expect(Puppet::FileServing::Fileset.merge(*@filesets)).to eq({
|
327
327
|
"." => make_absolute("/first/path"),
|
@@ -335,15 +335,15 @@ describe Puppet::FileServing::Fileset do
|
|
335
335
|
end
|
336
336
|
|
337
337
|
it "includes the base directory from the first fileset" do
|
338
|
-
Dir.expects(:entries).with(make_absolute("/first/path")).returns(%w{one})
|
339
|
-
Dir.expects(:entries).with(make_absolute("/second/path")).returns(%w{two})
|
338
|
+
Dir.expects(:entries).with(make_absolute("/first/path"), encoding: Encoding::UTF_8).returns(%w{one})
|
339
|
+
Dir.expects(:entries).with(make_absolute("/second/path"), encoding: Encoding::UTF_8).returns(%w{two})
|
340
340
|
|
341
341
|
expect(Puppet::FileServing::Fileset.merge(*@filesets)["."]).to eq(make_absolute("/first/path"))
|
342
342
|
end
|
343
343
|
|
344
344
|
it "uses the base path of the first found file when relative file paths conflict" do
|
345
|
-
Dir.expects(:entries).with(make_absolute("/first/path")).returns(%w{one})
|
346
|
-
Dir.expects(:entries).with(make_absolute("/second/path")).returns(%w{one})
|
345
|
+
Dir.expects(:entries).with(make_absolute("/first/path"), encoding: Encoding::UTF_8).returns(%w{one})
|
346
|
+
Dir.expects(:entries).with(make_absolute("/second/path"), encoding: Encoding::UTF_8).returns(%w{one})
|
347
347
|
|
348
348
|
expect(Puppet::FileServing::Fileset.merge(*@filesets)["one"]).to eq(make_absolute("/first/path"))
|
349
349
|
end
|
@@ -97,7 +97,7 @@ describe Puppet::Network::HTTP::Connection do
|
|
97
97
|
:verify => ConstantErrorValidator.new(
|
98
98
|
:fails_with => 'hostname was not match with server certificate',
|
99
99
|
:peer_certs => [Puppet::TestCa.new.generate('not_my_server',
|
100
|
-
:subject_alt_names => 'DNS:foo,DNS:bar,DNS:baz,DNS:not_my_server')
|
100
|
+
:subject_alt_names => 'DNS:foo,DNS:bar,DNS:baz,DNS:not_my_server')[:cert]]))
|
101
101
|
|
102
102
|
expect do
|
103
103
|
connection.get('request')
|
@@ -120,7 +120,7 @@ describe Puppet::Network::HTTP::Connection do
|
|
120
120
|
it "should check all peer certificates for upcoming expiration", :unless => Puppet::Util::Platform.windows? || RUBY_PLATFORM == 'java' do
|
121
121
|
Puppet[:confdir] = tmpdir('conf')
|
122
122
|
cert = Puppet::TestCa.new.generate('server',
|
123
|
-
:subject_alt_names => 'DNS:foo,DNS:bar,DNS:baz,DNS:server')
|
123
|
+
:subject_alt_names => 'DNS:foo,DNS:bar,DNS:baz,DNS:server')[:cert]
|
124
124
|
|
125
125
|
connection = Puppet::Network::HTTP::Connection.new(
|
126
126
|
host, port,
|
@@ -23,7 +23,11 @@ describe "validating 4x" do
|
|
23
23
|
|
24
24
|
def with_environment(environment, env_params = {})
|
25
25
|
override_env = environment
|
26
|
-
override_env = environment.override_with(
|
26
|
+
override_env = environment.override_with({
|
27
|
+
modulepath: env_params[:modulepath] || environment.full_modulepath,
|
28
|
+
manifest: env_params[:manifest] || environment.manifest,
|
29
|
+
config_version: env_params[:config_version] || environment.config_version
|
30
|
+
}) if env_params.count > 0
|
27
31
|
Puppet.override(current_environment: override_env) do
|
28
32
|
yield
|
29
33
|
end
|
@@ -72,15 +76,6 @@ describe "validating 4x" do
|
|
72
76
|
end
|
73
77
|
end
|
74
78
|
|
75
|
-
it 'should not raise error for legal definition locations' do
|
76
|
-
with_environment(environment, :manifest => 'a/manifest/file.pp') do
|
77
|
-
expect(validate(parse('function aaa::bbb() {}', 'path/aaa/manifests/bbb.pp'))).not_to have_issue(Puppet::Pops::Issues::ILLEGAL_DEFINITION_LOCATION)
|
78
|
-
expect(validate(parse('class aaa() {}', 'path/aaa/manifests/init.pp'))).not_to have_issue(Puppet::Pops::Issues::ILLEGAL_DEFINITION_LOCATION)
|
79
|
-
expect(validate(parse('function aaa::bbB::ccc() {}', 'path/aaa/manifests/bBb.pp'))).not_to have_issue(Puppet::Pops::Issues::ILLEGAL_DEFINITION_LOCATION)
|
80
|
-
expect(validate(parse('function aaa::bbb::ccc() {}', 'path/aaa/manifests/bbb/CCC.pp'))).not_to have_issue(Puppet::Pops::Issues::ILLEGAL_DEFINITION_LOCATION)
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
79
|
it 'should not raise error for definitions inside initial --manifest file' do
|
85
80
|
with_environment(environment, :manifest => 'a/manifest/file.pp') do
|
86
81
|
expect(validate(parse('class aaa() {}', 'a/manifest/file.pp'))).not_to have_issue(Puppet::Pops::Issues::ILLEGAL_DEFINITION_LOCATION)
|
@@ -100,6 +95,13 @@ describe "validating 4x" do
|
|
100
95
|
end
|
101
96
|
end
|
102
97
|
|
98
|
+
it 'should not raise error for empty files in modulepath' do
|
99
|
+
with_environment(environment) do
|
100
|
+
expect(validate(parse('', 'path/aaa/manifests/init.pp'))).not_to have_issue(Puppet::Pops::Issues::ILLEGAL_TOP_CONSTRUCT_LOCATION)
|
101
|
+
expect(validate(parse('#this is a comment', 'path/aaa/manifests/init.pp'))).not_to have_issue(Puppet::Pops::Issues::ILLEGAL_TOP_CONSTRUCT_LOCATION)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
103
105
|
it 'should raise error if the file is in the modulepath but is not well formed' do
|
104
106
|
with_environment(environment) do
|
105
107
|
expect(validate(parse('class aaa::bbb::ccc() {}', 'path/manifest/aaa/bbb.pp'))).to have_issue(Puppet::Pops::Issues::ILLEGAL_DEFINITION_LOCATION)
|
@@ -113,6 +115,18 @@ describe "validating 4x" do
|
|
113
115
|
end
|
114
116
|
end
|
115
117
|
|
118
|
+
it 'should not raise error when one modulepath is a substring of another' do
|
119
|
+
with_environment(environment, modulepath: ['path', 'pathplus']) do
|
120
|
+
expect(validate(parse('class aaa::ccc() {}', 'pathplus/aaa/manifests/ccc.pp'))).not_to have_issue(Puppet::Pops::Issues::ILLEGAL_DEFINITION_LOCATION)
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
it 'should not raise error when a modulepath ends with a file separator' do
|
125
|
+
with_environment(environment, modulepath: ['path/']) do
|
126
|
+
expect(validate(parse('class aaa::ccc() {}', 'pathplus/aaa/manifests/ccc.pp'))).not_to have_issue(Puppet::Pops::Issues::ILLEGAL_DEFINITION_LOCATION)
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
116
130
|
it 'should raise error for illegal type names' do
|
117
131
|
expect(validate(parse('type ::Aaa = Any'))).to have_issue(Puppet::Pops::Issues::ILLEGAL_DEFINITION_NAME)
|
118
132
|
end
|
@@ -76,7 +76,7 @@ describe Puppet::Provider::Package::Windows::ExePackage do
|
|
76
76
|
it 'should install using the source' do
|
77
77
|
cmd = subject.install_command({:source => source})
|
78
78
|
|
79
|
-
expect(cmd).to eq(
|
79
|
+
expect(cmd).to eq(source)
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
@@ -84,7 +84,7 @@ describe Puppet::Provider::Package::Windows::ExePackage do
|
|
84
84
|
['C:\uninstall.exe', 'C:\Program Files\uninstall.exe'].each do |exe|
|
85
85
|
it "should quote #{exe}" do
|
86
86
|
expect(subject.new(name, version, exe).uninstall_command).to eq(
|
87
|
-
|
87
|
+
"\"#{exe}\""
|
88
88
|
)
|
89
89
|
end
|
90
90
|
end
|
@@ -92,7 +92,7 @@ describe Puppet::Provider::Package::Windows::ExePackage do
|
|
92
92
|
['"C:\Program Files\uninstall.exe"', '"C:\Program Files (x86)\Git\unins000.exe" /SILENT"'].each do |exe|
|
93
93
|
it "should not quote #{exe}" do
|
94
94
|
expect(subject.new(name, version, exe).uninstall_command).to eq(
|
95
|
-
|
95
|
+
exe
|
96
96
|
)
|
97
97
|
end
|
98
98
|
end
|
@@ -1,12 +1,12 @@
|
|
1
1
|
#! /usr/bin/env ruby
|
2
2
|
require 'spec_helper'
|
3
3
|
|
4
|
-
describe Puppet::Type.type(:package).provider(:windows) do
|
4
|
+
describe Puppet::Type.type(:package).provider(:windows), :if => Puppet.features.microsoft_windows? do
|
5
5
|
let (:name) { 'mysql-5.1.58-win-x64' }
|
6
|
-
let (:source) { 'E:\mysql-5.1.58-win-x64.msi' }
|
6
|
+
let (:source) { 'E:\Rando\Directory\mysql-5.1.58-win-x64.msi' }
|
7
7
|
let (:resource) { Puppet::Type.type(:package).new(:name => name, :provider => :windows, :source => source) }
|
8
8
|
let (:provider) { resource.provider }
|
9
|
-
let (:execute_options) do {:failonfail => false, :combine => true} end
|
9
|
+
let (:execute_options) do {:failonfail => false, :combine => true, :suppress_window => true} end
|
10
10
|
|
11
11
|
before :each do
|
12
12
|
# make sure we never try to execute anything
|
@@ -86,7 +86,7 @@ describe Puppet::Type.type(:package).provider(:windows) do
|
|
86
86
|
context '#install' do
|
87
87
|
let(:command) { 'blarg.exe /S' }
|
88
88
|
let(:klass) { mock('installer', :install_command => ['blarg.exe', '/S'] ) }
|
89
|
-
|
89
|
+
let(:execute_options) do {:failonfail => false, :combine => true, :cwd => 'E:\Rando\Directory', :suppress_window => true} end
|
90
90
|
before :each do
|
91
91
|
Puppet::Provider::Package::Windows::Package.expects(:installer_class).returns(klass)
|
92
92
|
end
|
@@ -36,6 +36,16 @@ describe 'Puppet::Type::Service::Provider::Windows',
|
|
36
36
|
end
|
37
37
|
|
38
38
|
describe "#start" do
|
39
|
+
before(:each) do
|
40
|
+
provider.stubs(:status).returns(:stopped)
|
41
|
+
end
|
42
|
+
|
43
|
+
it "should resume a paused service" do
|
44
|
+
provider.stubs(:status).returns(:paused)
|
45
|
+
service_util.expects(:resume).with(name)
|
46
|
+
provider.start
|
47
|
+
end
|
48
|
+
|
39
49
|
it "should start the service" do
|
40
50
|
service_util.expects(:service_start_type).with(name).returns(:SERVICE_AUTO_START)
|
41
51
|
service_util.expects(:start).with(name)
|
@@ -85,10 +95,18 @@ describe 'Puppet::Type::Service::Provider::Windows',
|
|
85
95
|
end
|
86
96
|
|
87
97
|
[
|
88
|
-
:SERVICE_STOPPED,
|
89
98
|
:SERVICE_PAUSED,
|
90
|
-
:
|
91
|
-
|
99
|
+
:SERVICE_PAUSE_PENDING
|
100
|
+
].each do |state|
|
101
|
+
it "should report a #{state} service as paused" do
|
102
|
+
service_util.expects(:service_state).with(name).returns(state)
|
103
|
+
expect(provider.status).to eq(:paused)
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
[
|
108
|
+
:SERVICE_STOPPED,
|
109
|
+
:SERVICE_STOP_PENDING
|
92
110
|
].each do |state|
|
93
111
|
it "should report a #{state} service as stopped" do
|
94
112
|
service_util.expects(:service_state).with(name).returns(state)
|
@@ -138,10 +138,10 @@ describe Puppet::Type.type(:user).provider(:useradd) do
|
|
138
138
|
provider.create
|
139
139
|
end
|
140
140
|
|
141
|
-
it "should not use -e with luseradd, should call
|
141
|
+
it "should not use -e with luseradd, should call usermod with -e after luseradd when expiry is set" do
|
142
142
|
resource[:expiry] = '2038-01-24'
|
143
143
|
provider.expects(:execute).with(all_of(includes('/usr/sbin/luseradd'), Not(includes('-e'))), has_entry(:custom_environment, has_key('LIBUSER_CONF')))
|
144
|
-
provider.expects(:execute).with(all_of(includes('/usr/sbin/
|
144
|
+
provider.expects(:execute).with(all_of(includes('/usr/sbin/usermod'), includes('-e')), has_entry(:custom_environment, has_key('LIBUSER_CONF')))
|
145
145
|
provider.create
|
146
146
|
end
|
147
147
|
|
@@ -48,8 +48,8 @@ describe Puppet::Resource::Catalog, "when compiling" do
|
|
48
48
|
catalog.add_resource(res, res2, res3, res4, comp_res)
|
49
49
|
catalog.write_resource_file
|
50
50
|
expect(File.readlines(resourcefile).map(&:chomp)).to match_array([
|
51
|
-
"file[#{
|
52
|
-
"exec[#{
|
51
|
+
"file[#{res.title.downcase}]",
|
52
|
+
"exec[#{res2.title.downcase}]"
|
53
53
|
])
|
54
54
|
end
|
55
55
|
|
data/spec/unit/ssl/host_spec.rb
CHANGED
@@ -73,7 +73,7 @@ describe Puppet::Transaction::Persistence do
|
|
73
73
|
it "should initialize with a clear internal state if the file does not contain valid YAML" do
|
74
74
|
write_state_file('{ invalid')
|
75
75
|
|
76
|
-
Puppet.expects(:
|
76
|
+
Puppet.expects(:send_log).with(:err, regexp_matches(/Transaction store file .* is corrupt/))
|
77
77
|
|
78
78
|
persistence = Puppet::Transaction::Persistence.new
|
79
79
|
persistence.load
|
@@ -97,8 +97,8 @@ describe Puppet::Transaction::Persistence do
|
|
97
97
|
|
98
98
|
File.expects(:rename).raises(SystemCallError)
|
99
99
|
|
100
|
-
Puppet.expects(:
|
101
|
-
Puppet.expects(:
|
100
|
+
Puppet.expects(:send_log).with(:err, regexp_matches(/Transaction store file .* is corrupt/))
|
101
|
+
Puppet.expects(:send_log).with(:err, regexp_matches(/Unable to rename/))
|
102
102
|
|
103
103
|
persistence = Puppet::Transaction::Persistence.new
|
104
104
|
expect { persistence.load }.to raise_error(Puppet::Error, /Could not rename/)
|
@@ -109,7 +109,7 @@ describe Puppet::Transaction::Persistence do
|
|
109
109
|
|
110
110
|
File.expects(:rename).at_least_once
|
111
111
|
|
112
|
-
Puppet.expects(:
|
112
|
+
Puppet.expects(:send_log).with(:err, regexp_matches(/Transaction store file .* is corrupt/))
|
113
113
|
|
114
114
|
persistence = Puppet::Transaction::Persistence.new
|
115
115
|
persistence.load
|