puppet 6.10.0 → 6.10.1

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.

Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/CONTRIBUTING.md +1 -1
  3. data/Gemfile +1 -1
  4. data/Gemfile.lock +18 -18
  5. data/ext/project_data.yaml +2 -2
  6. data/lib/puppet/module_tool/applications/installer.rb +5 -1
  7. data/lib/puppet/module_tool/tar/mini.rb +11 -1
  8. data/lib/puppet/network/uri.rb +18 -0
  9. data/lib/puppet/node/environment.rb +5 -15
  10. data/lib/puppet/pops/validation.rb +11 -19
  11. data/lib/puppet/provider/service/windows.rb +8 -0
  12. data/lib/puppet/type/notify.rb +3 -2
  13. data/lib/puppet/type/service.rb +7 -2
  14. data/lib/puppet/util/windows/service.rb +149 -4
  15. data/lib/puppet/version.rb +1 -1
  16. data/locales/puppet.pot +81 -69
  17. data/man/man5/puppet.conf.5 +2 -2
  18. data/man/man8/puppet-agent.8 +1 -1
  19. data/man/man8/puppet-apply.8 +1 -1
  20. data/man/man8/puppet-catalog.8 +1 -1
  21. data/man/man8/puppet-config.8 +1 -1
  22. data/man/man8/puppet-describe.8 +1 -1
  23. data/man/man8/puppet-device.8 +1 -1
  24. data/man/man8/puppet-doc.8 +1 -1
  25. data/man/man8/puppet-epp.8 +1 -1
  26. data/man/man8/puppet-facts.8 +1 -1
  27. data/man/man8/puppet-filebucket.8 +1 -1
  28. data/man/man8/puppet-generate.8 +1 -1
  29. data/man/man8/puppet-help.8 +1 -1
  30. data/man/man8/puppet-key.8 +1 -1
  31. data/man/man8/puppet-lookup.8 +1 -1
  32. data/man/man8/puppet-man.8 +1 -1
  33. data/man/man8/puppet-module.8 +1 -1
  34. data/man/man8/puppet-node.8 +1 -1
  35. data/man/man8/puppet-parser.8 +1 -1
  36. data/man/man8/puppet-plugin.8 +1 -1
  37. data/man/man8/puppet-report.8 +1 -1
  38. data/man/man8/puppet-resource.8 +1 -1
  39. data/man/man8/puppet-script.8 +1 -1
  40. data/man/man8/puppet-ssl.8 +1 -1
  41. data/man/man8/puppet-status.8 +1 -1
  42. data/man/man8/puppet.8 +2 -2
  43. data/spec/integration/type/notify_spec.rb +46 -0
  44. data/spec/unit/module_tool/tar/mini_spec.rb +1 -1
  45. data/spec/unit/network/http/api/indirected_routes_spec.rb +25 -10
  46. data/spec/unit/network/uri_spec.rb +47 -0
  47. data/spec/unit/provider/service/windows_spec.rb +20 -0
  48. data/spec/unit/type/file/source_spec.rb +4 -4
  49. data/spec/unit/type/schedule_spec.rb +3 -1
  50. data/spec/unit/type/service_spec.rb +16 -0
  51. data/spec/unit/util/windows/service_spec.rb +9 -0
  52. metadata +7 -2
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-DEVICE" "8" "September 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-DEVICE" "8" "October 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-device\fR \- Manage remote network devices
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-DOC" "8" "September 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-DOC" "8" "October 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-doc\fR \- Generate Puppet references
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-EPP" "8" "September 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-EPP" "8" "October 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-epp\fR \- Interact directly with the EPP template parser/renderer\.
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-FACTS" "8" "September 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-FACTS" "8" "October 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-facts\fR \- Retrieve and store facts\.
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-FILEBUCKET" "8" "September 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-FILEBUCKET" "8" "October 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-filebucket\fR \- Store and retrieve files in a filebucket
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-GENERATE" "8" "September 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-GENERATE" "8" "October 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-generate\fR \- Generates Puppet code from Ruby definitions\.
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-HELP" "8" "September 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-HELP" "8" "October 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-help\fR \- Display Puppet help\.
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-KEY" "8" "September 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-KEY" "8" "October 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-key\fR \- Create, save, and remove certificate keys\.
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "LOOKUP" "8" "September 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "LOOKUP" "8" "October 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBlookup\fR \- Interactive Hiera lookup
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-MAN" "8" "September 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-MAN" "8" "October 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-man\fR \- Display Puppet manual pages\.
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-MODULE" "8" "September 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-MODULE" "8" "October 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-module\fR \- Creates, installs and searches for modules on the Puppet Forge\.
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-NODE" "8" "September 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-NODE" "8" "October 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-node\fR \- View and manage node definitions\.
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-PARSER" "8" "September 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-PARSER" "8" "October 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-parser\fR \- Interact directly with the parser\.
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-PLUGIN" "8" "September 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-PLUGIN" "8" "October 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-plugin\fR \- Interact with the Puppet plugin system\.
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-REPORT" "8" "September 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-REPORT" "8" "October 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-report\fR \- Create, display, and submit reports\.
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-RESOURCE" "8" "September 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-RESOURCE" "8" "October 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-resource\fR \- The resource abstraction layer shell
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-SCRIPT" "8" "September 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-SCRIPT" "8" "October 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-script\fR \- Run a puppet manifests as a script without compiling a catalog
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-SSL" "8" "September 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-SSL" "8" "October 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-ssl\fR \- Manage SSL keys and certificates for puppet SSL clients
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-STATUS" "8" "September 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-STATUS" "8" "October 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-status\fR \- View puppet server status\.
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET" "8" "September 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET" "8" "October 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\fR
@@ -25,4 +25,4 @@ Specialized:
25
25
  catalog Compile, save, view, and convert catalogs\. describe Display help about resource types device Manage remote network devices doc Generate Puppet references epp Interact directly with the EPP template parser/renderer\. facts Retrieve and store facts\. filebucket Store and retrieve files in a filebucket generate Generates Puppet code from Ruby definitions\. node View and manage node definitions\. parser Interact directly with the parser\. plugin Interact with the Puppet plugin system\. script Run a puppet manifests as a script without compiling a catalog ssl Manage SSL keys and certificates for puppet SSL clients
26
26
  .
27
27
  .P
28
- See \'puppet help \fIsubcommand\fR \fIaction\fR\' for help on a specific subcommand action\. See \'puppet help \fIsubcommand\fR\' for help on a specific subcommand\. Puppet v6\.10\.0
28
+ See \'puppet help \fIsubcommand\fR \fIaction\fR\' for help on a specific subcommand action\. See \'puppet help \fIsubcommand\fR\' for help on a specific subcommand\. Puppet v6\.10\.1
@@ -0,0 +1,46 @@
1
+ require 'spec_helper'
2
+ require 'puppet_spec/compiler'
3
+
4
+ describe Puppet::Type.type(:notify) do
5
+ include PuppetSpec::Compiler
6
+
7
+ it "logs the title at notice level" do
8
+ apply_compiled_manifest(<<-MANIFEST)
9
+ notify { 'hi': }
10
+ MANIFEST
11
+
12
+ expect(@logs).to include(an_object_having_attributes(level: :notice, message: 'hi'))
13
+ end
14
+
15
+ it "logs the message property" do
16
+ apply_compiled_manifest(<<-MANIFEST)
17
+ notify { 'title':
18
+ message => 'hello'
19
+ }
20
+ MANIFEST
21
+
22
+ expect(@logs).to include(an_object_having_attributes(level: :notice, message: "defined 'message' as 'hello'"))
23
+ end
24
+
25
+ it "redacts sensitive message properties" do
26
+ apply_compiled_manifest(<<-MANIFEST)
27
+ $message = Sensitive('secret')
28
+ notify { 'notify1':
29
+ message => $message
30
+ }
31
+ MANIFEST
32
+
33
+ expect(@logs).to include(an_object_having_attributes(level: :notice, message: 'changed [redacted] to [redacted]'))
34
+ end
35
+
36
+ it "redacts sensitive interpolated message properties" do
37
+ apply_compiled_manifest(<<-MANIFEST)
38
+ $message = Sensitive('secret')
39
+ notify { 'notify2':
40
+ message => "${message}"
41
+ }
42
+ MANIFEST
43
+
44
+ expect(@logs).to include(an_object_having_attributes(level: :notice, message: "defined 'message' as 'Sensitive [value redacted]'"))
45
+ end
46
+ end
@@ -82,7 +82,7 @@ describe Puppet::ModuleTool::Tar::Mini, :if => (Puppet.features.minitar? and Pup
82
82
  expect(Zlib::GzipReader).to receive(:open).with(sourcefile).and_yield(reader)
83
83
  expect(minitar).to receive(:find_valid_files).with(reader).and_return([name])
84
84
  entry = MockFileStatEntry.new(mode)
85
- expect(Archive::Tar::Minitar).to receive(:unpack).with(reader, destdir, [name]).
85
+ expect(Archive::Tar::Minitar).to receive(:unpack).with(reader, destdir, [name], :fsync => false).
86
86
  and_yield(type, name, {:entry => entry})
87
87
  entry
88
88
  end
@@ -40,19 +40,27 @@ describe Puppet::Network::HTTP::API::IndirectedRoutes do
40
40
  end
41
41
 
42
42
  it "should fail if there is no environment specified" do
43
- expect(lambda { handler.uri2indirection("GET", "#{master_url_prefix}/node/bar", {}) }).to raise_error(bad_request_error)
43
+ expect {
44
+ handler.uri2indirection("GET", "#{master_url_prefix}/node/bar", {})
45
+ }.to raise_error(bad_request_error)
44
46
  end
45
47
 
46
48
  it "should fail if the environment is not alphanumeric" do
47
- expect(lambda { handler.uri2indirection("GET", "#{master_url_prefix}/node/bar", {:environment => "env ness"}) }).to raise_error(bad_request_error)
49
+ expect {
50
+ handler.uri2indirection("GET", "#{master_url_prefix}/node/bar", {:environment => "env ness"})
51
+ }.to raise_error(bad_request_error)
48
52
  end
49
53
 
50
54
  it "should fail if the indirection does not match the prefix" do
51
- expect(lambda { handler.uri2indirection("GET", "#{master_url_prefix}/certificate/foo", params) }).to raise_error(bad_request_error)
55
+ expect {
56
+ handler.uri2indirection("GET", "#{master_url_prefix}/certificate/foo", params)
57
+ }.to raise_error(bad_request_error)
52
58
  end
53
59
 
54
60
  it "should fail if the indirection does not have the correct version" do
55
- expect(lambda { handler.uri2indirection("GET", "#{Puppet::Network::HTTP::MASTER_URL_PREFIX}/v1/node/bar", params) }).to raise_error(bad_request_error)
61
+ expect {
62
+ handler.uri2indirection("GET", "#{Puppet::Network::HTTP::MASTER_URL_PREFIX}/v1/node/bar", params)
63
+ }.to raise_error(bad_request_error)
56
64
  end
57
65
 
58
66
  it "should not pass a buck_path parameter through (See Bugs #13553, #13518, #13511)" do
@@ -76,7 +84,9 @@ describe Puppet::Network::HTTP::API::IndirectedRoutes do
76
84
  end
77
85
 
78
86
  it "should fail if the indirection name is not alphanumeric" do
79
- expect(lambda { handler.uri2indirection("GET", "#{master_url_prefix}/foo ness/bar", params) }).to raise_error(bad_request_error)
87
+ expect {
88
+ handler.uri2indirection("GET", "#{master_url_prefix}/foo ness/bar", params)
89
+ }.to raise_error(bad_request_error)
80
90
  end
81
91
 
82
92
  it "should use the remainder of the URI as the indirection key" do
@@ -88,7 +98,9 @@ describe Puppet::Network::HTTP::API::IndirectedRoutes do
88
98
  end
89
99
 
90
100
  it "should fail if no indirection key is specified" do
91
- expect(lambda { handler.uri2indirection("GET", "#{master_url_prefix}/node", params) }).to raise_error(bad_request_error)
101
+ expect {
102
+ handler.uri2indirection("GET", "#{master_url_prefix}/node", params)
103
+ }.to raise_error(bad_request_error)
92
104
  end
93
105
 
94
106
  it "should choose 'find' as the indirection method if the http method is a GET and the indirection name is singular" do
@@ -128,7 +140,9 @@ describe Puppet::Network::HTTP::API::IndirectedRoutes do
128
140
  end
129
141
 
130
142
  it "should fail if an indirection method cannot be picked" do
131
- expect(lambda { handler.uri2indirection("UPDATE", "#{master_url_prefix}/node/bar", params) }).to raise_error(method_not_allowed_error)
143
+ expect {
144
+ handler.uri2indirection("UPDATE", "#{master_url_prefix}/node/bar", params)
145
+ }.to raise_error(method_not_allowed_error)
132
146
  end
133
147
 
134
148
  it "should not URI unescape the indirection key" do
@@ -148,9 +162,10 @@ describe Puppet::Network::HTTP::API::IndirectedRoutes do
148
162
  expect(handler).to receive(:check_authorization).with(anything,
149
163
  anything,
150
164
  excluding(:environment))
151
- expect(lambda { handler.uri2indirection("GET",
152
- "#{master_url_prefix}/node/bar",
153
- {:environment => 'bogus'}) }).to raise_error(not_found_error)
165
+ expect { handler.uri2indirection("GET",
166
+ "#{master_url_prefix}/node/bar",
167
+ {:environment => 'bogus'})
168
+ }.to raise_error(not_found_error)
154
169
  end
155
170
 
156
171
  it "should not URI unescape the indirection key as passed through to a call to check_authorization" do
@@ -0,0 +1,47 @@
1
+ require 'spec_helper'
2
+ require 'puppet/network/uri'
3
+
4
+ describe Puppet::Network::Uri do
5
+ include Puppet::Network::Uri
6
+ describe '.mask_credentials' do
7
+ let(:address_with_passwd) { 'https://admin:S3cr3T@puppetforge.acmecorp.com/' }
8
+ let(:masked) { 'https://admin:***@puppetforge.acmecorp.com/' }
9
+ let(:address) { 'https://puppetforge.acmecorp.com/' }
10
+
11
+ subject do
12
+ input = to_be_masked.dup
13
+ result = mask_credentials(input)
14
+ raise 'illegal unexpected modification' if input != to_be_masked
15
+ result
16
+ end
17
+
18
+ describe 'if password was given in URI' do
19
+ describe 'as a String' do
20
+ let(:to_be_masked) { address_with_passwd }
21
+ it 'should mask out password' do
22
+ is_expected.to eq(masked)
23
+ end
24
+ end
25
+ describe 'as an URI' do
26
+ let(:to_be_masked) { URI.parse(address_with_passwd) }
27
+ it 'should mask out password' do
28
+ is_expected.to eq(masked)
29
+ end
30
+ end
31
+ end
32
+ describe "if password wasn't given in URI" do
33
+ describe 'as a String' do
34
+ let(:to_be_masked) { address }
35
+ it "shouldn't add mask to URI" do
36
+ is_expected.to eq(address)
37
+ end
38
+ end
39
+ describe 'as an URI' do
40
+ let(:to_be_masked) { URI.parse(address) }
41
+ it "shouldn't add mask to URI" do
42
+ is_expected.to eq(address)
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
@@ -150,6 +150,11 @@ describe 'Puppet::Type::Service::Provider::Windows',
150
150
  expect(provider.enabled?).to eq(:manual)
151
151
  end
152
152
 
153
+ it "should report a service with a startup type of delayed as delayed" do
154
+ expect(service_util).to receive(:service_start_type).with(name).and_return(:SERVICE_DELAYED_AUTO_START)
155
+ expect(provider.enabled?).to eq(:delayed)
156
+ end
157
+
153
158
  it "should report a service with a startup type of disabled as false" do
154
159
  expect(service_util).to receive(:service_start_type).with(name).and_return(:SERVICE_DISABLED)
155
160
  expect(provider.enabled?).to eq(:false)
@@ -215,4 +220,19 @@ describe 'Puppet::Type::Service::Provider::Windows',
215
220
  }.to raise_error(Puppet::Error, /Cannot enable #{name}/)
216
221
  end
217
222
  end
223
+
224
+ describe "#delayed_start" do
225
+ it "should set service start type to Service_Config_Delayed_Auto_Start (delayed) when delayed" do
226
+ expect(service_util).to receive(:set_startup_mode).with(name, :SERVICE_AUTO_START, true)
227
+ provider.delayed_start
228
+ end
229
+
230
+ it "raises an error if set_startup_mode fails" do
231
+ expect(service_util).to receive(:set_startup_mode).with(name, :SERVICE_AUTO_START, true).and_raise(Puppet::Error.new('foobar'))
232
+
233
+ expect {
234
+ provider.delayed_start
235
+ }.to raise_error(Puppet::Error, /Cannot enable #{name}/)
236
+ end
237
+ end
218
238
  end
@@ -34,11 +34,11 @@ describe Puppet::Type.type(:file).attrclass(:source), :uses_checksums => true do
34
34
  it "should fail if the set values are not URLs" do
35
35
  expect(URI).to receive(:parse).with('foo').and_raise(RuntimeError)
36
36
 
37
- expect(lambda { resource[:source] = %w{foo} }).to raise_error(Puppet::Error)
37
+ expect { resource[:source] = %w{foo} }.to raise_error(Puppet::Error)
38
38
  end
39
39
 
40
40
  it "should fail if the URI is not a local file, file URI, or puppet URI" do
41
- expect(lambda { resource[:source] = %w{ftp://foo/bar} }).to raise_error(Puppet::Error, /Cannot use URLs of type 'ftp' as source for fileserving/)
41
+ expect { resource[:source] = %w{ftp://foo/bar} }.to raise_error(Puppet::Error, /Cannot use URLs of type 'ftp' as source for fileserving/)
42
42
  end
43
43
 
44
44
  it "should strip trailing forward slashes", :unless => Puppet::Util::Platform.windows? do
@@ -61,11 +61,11 @@ describe Puppet::Type.type(:file).attrclass(:source), :uses_checksums => true do
61
61
  end
62
62
 
63
63
  it "should reject relative URI sources" do
64
- expect(lambda { resource[:source] = 'foo/bar' }).to raise_error(Puppet::Error)
64
+ expect { resource[:source] = 'foo/bar' }.to raise_error(Puppet::Error)
65
65
  end
66
66
 
67
67
  it "should reject opaque sources" do
68
- expect(lambda { resource[:source] = 'mailto:foo@com' }).to raise_error(Puppet::Error)
68
+ expect { resource[:source] = 'mailto:foo@com' }.to raise_error(Puppet::Error)
69
69
  end
70
70
 
71
71
  it "should accept URI authority component" do
@@ -446,7 +446,9 @@ describe Puppet::Type.type(:schedule) do
446
446
 
447
447
  it "should fail if the periodmatch is 'number'" do
448
448
  @schedule[:periodmatch] = :number
449
- expect(proc { @schedule[:repeat] = 2 }).to raise_error(Puppet::Error)
449
+ expect {
450
+ @schedule[:repeat] = 2
451
+ }.to raise_error(Puppet::Error)
450
452
  end
451
453
 
452
454
  it "should match if the previous run was further away than the distance divided by the repeat" do