puppet 5.5.3-x86-mingw32 → 5.5.6-x86-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 +5 -5
- data/CONTRIBUTING.md +1 -4
- data/Gemfile +5 -1
- data/Gemfile.lock +167 -0
- data/Rakefile +4 -34
- data/ext/build_defaults.yaml +0 -2
- data/lib/puppet/application/cert.rb +3 -1
- data/lib/puppet/defaults.rb +55 -26
- data/lib/puppet/face/certificate.rb +2 -0
- data/lib/puppet/indirector/ldap.rb +6 -0
- data/lib/puppet/node/environment.rb +4 -2
- data/lib/puppet/parser/functions/tagged.rb +1 -4
- data/lib/puppet/pops/issues.rb +4 -0
- data/lib/puppet/pops/validation/checker4_0.rb +100 -0
- data/lib/puppet/pops/validation/validator_factory_4_0.rb +4 -3
- data/lib/puppet/provider/augeas/augeas.rb +198 -4
- data/lib/puppet/provider/service/smf.rb +2 -3
- data/lib/puppet/provider/service/upstart.rb +10 -2
- data/lib/puppet/test/test_helper.rb +0 -3
- data/lib/puppet/type/file/source.rb +10 -1
- data/lib/puppet/version.rb +1 -1
- data/locales/puppet.pot +132 -118
- data/man/man5/puppet.conf.5 +23 -23
- data/man/man8/puppet-agent.8 +1 -1
- data/man/man8/puppet-apply.8 +1 -1
- data/man/man8/puppet-ca.8 +3 -3
- data/man/man8/puppet-catalog.8 +1 -1
- data/man/man8/puppet-cert.8 +2 -2
- data/man/man8/puppet-certificate.8 +3 -3
- data/man/man8/puppet-certificate_request.8 +1 -1
- data/man/man8/puppet-certificate_revocation_list.8 +1 -1
- data/man/man8/puppet-config.8 +1 -1
- data/man/man8/puppet-describe.8 +1 -1
- data/man/man8/puppet-device.8 +1 -1
- data/man/man8/puppet-doc.8 +1 -1
- data/man/man8/puppet-epp.8 +1 -1
- data/man/man8/puppet-facts.8 +1 -1
- data/man/man8/puppet-filebucket.8 +1 -1
- data/man/man8/puppet-generate.8 +1 -1
- data/man/man8/puppet-help.8 +1 -1
- data/man/man8/puppet-key.8 +1 -1
- data/man/man8/puppet-lookup.8 +1 -1
- data/man/man8/puppet-man.8 +1 -1
- data/man/man8/puppet-master.8 +1 -1
- data/man/man8/puppet-module.8 +1 -1
- data/man/man8/puppet-node.8 +1 -1
- data/man/man8/puppet-parser.8 +1 -1
- data/man/man8/puppet-plugin.8 +1 -1
- data/man/man8/puppet-report.8 +1 -1
- data/man/man8/puppet-resource.8 +1 -1
- data/man/man8/puppet-script.8 +1 -1
- data/man/man8/puppet-status.8 +1 -1
- data/man/man8/puppet.8 +3 -3
- data/spec/integration/type/file_spec.rb +18 -3
- data/spec/integration/util/settings_spec.rb +1 -0
- data/spec/integration/util/windows/security_spec.rb +78 -1
- data/spec/unit/application/master_spec.rb +2 -0
- data/spec/unit/configurer/downloader_spec.rb +5 -0
- data/spec/unit/defaults_spec.rb +13 -0
- data/spec/unit/face/help_spec.rb +2 -1
- data/spec/unit/indirector/ldap_spec.rb +22 -1
- data/spec/unit/node/environment_spec.rb +14 -0
- data/spec/unit/parser/functions/tagged_spec.rb +16 -0
- data/spec/unit/pops/validator/validator_spec.rb +139 -4
- data/spec/unit/provider/augeas/augeas_spec.rb +66 -1
- data/spec/unit/provider/service/smf_spec.rb +2 -6
- data/spec/unit/provider/service/upstart_spec.rb +37 -0
- data/spec/unit/settings/autosign_setting_spec.rb +2 -2
- data/spec/unit/settings/file_setting_spec.rb +6 -0
- data/spec/unit/ssl/certificate_authority_spec.rb +1 -0
- metadata +4 -3
data/man/man8/puppet-node.8
CHANGED
@@ -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" "
|
4
|
+
.TH "PUPPET\-NODE" "8" "August 2018" "Puppet, Inc." "Puppet manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBpuppet\-node\fR \- View and manage node definitions\.
|
data/man/man8/puppet-parser.8
CHANGED
@@ -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" "
|
4
|
+
.TH "PUPPET\-PARSER" "8" "August 2018" "Puppet, Inc." "Puppet manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBpuppet\-parser\fR \- Interact directly with the parser\.
|
data/man/man8/puppet-plugin.8
CHANGED
@@ -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" "
|
4
|
+
.TH "PUPPET\-PLUGIN" "8" "August 2018" "Puppet, Inc." "Puppet manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBpuppet\-plugin\fR \- Interact with the Puppet plugin system\.
|
data/man/man8/puppet-report.8
CHANGED
@@ -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" "
|
4
|
+
.TH "PUPPET\-REPORT" "8" "August 2018" "Puppet, Inc." "Puppet manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBpuppet\-report\fR \- Create, display, and submit reports\.
|
data/man/man8/puppet-resource.8
CHANGED
@@ -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" "
|
4
|
+
.TH "PUPPET\-RESOURCE" "8" "August 2018" "Puppet, Inc." "Puppet manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBpuppet\-resource\fR \- The resource abstraction layer shell
|
data/man/man8/puppet-script.8
CHANGED
@@ -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" "
|
4
|
+
.TH "PUPPET\-SCRIPT" "8" "August 2018" "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
|
data/man/man8/puppet-status.8
CHANGED
@@ -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" "
|
4
|
+
.TH "PUPPET\-STATUS" "8" "August 2018" "Puppet, Inc." "Puppet manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBpuppet\-status\fR \- View puppet server status\.
|
data/man/man8/puppet.8
CHANGED
@@ -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" "
|
4
|
+
.TH "PUPPET" "8" "August 2018" "Puppet, Inc." "Puppet manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBpuppet\fR
|
@@ -13,7 +13,7 @@ Usage: puppet \fIsubcommand\fR [options] \fIaction\fR [options]
|
|
13
13
|
Available subcommands:
|
14
14
|
.
|
15
15
|
.P
|
16
|
-
agent The puppet agent daemon apply Apply Puppet manifests locally ca Local Puppet Certificate Authority management\. (Deprecated) catalog Compile, save, view, and convert catalogs\. cert Manage certificates and requests certificate Provide access to the CA for certificate management\. certificate_request Manage certificate requests\. (Deprecated) certificate_revocation_list Manage the list of revoked certificates\. (Deprecated) config Interact with Puppet\'s settings\. 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\. help Display Puppet help\. key Create, save, and remove certificate keys\. (Deprecated) lookup Interactive Hiera lookup man Display Puppet manual pages\. (Deprecated) master The puppet master daemon module Creates, installs and searches for modules on the Puppet Forge\. node View and manage node definitions\. parser Interact directly with the parser\. plugin Interact with the Puppet plugin system\. report Create, display, and submit reports\. resource The resource abstraction layer shell script Run a puppet manifests as a script without compiling a catalog status View puppet server status\. (Deprecated)
|
16
|
+
agent The puppet agent daemon apply Apply Puppet manifests locally ca Local Puppet Certificate Authority management\. (Deprecated) catalog Compile, save, view, and convert catalogs\. cert Manage certificates and requests (Deprecated) certificate Provide access to the CA for certificate management\. (Deprecated) certificate_request Manage certificate requests\. (Deprecated) certificate_revocation_list Manage the list of revoked certificates\. (Deprecated) config Interact with Puppet\'s settings\. 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\. help Display Puppet help\. key Create, save, and remove certificate keys\. (Deprecated) lookup Interactive Hiera lookup man Display Puppet manual pages\. (Deprecated) master The puppet master daemon module Creates, installs and searches for modules on the Puppet Forge\. node View and manage node definitions\. parser Interact directly with the parser\. plugin Interact with the Puppet plugin system\. report Create, display, and submit reports\. resource The resource abstraction layer shell script Run a puppet manifests as a script without compiling a catalog status View puppet server status\. (Deprecated)
|
17
17
|
.
|
18
18
|
.P
|
19
|
-
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 v5\.5\.
|
19
|
+
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 v5\.5\.6
|
@@ -602,7 +602,7 @@ describe Puppet::Type.type(:file), :uses_checksums => true do
|
|
602
602
|
end
|
603
603
|
end
|
604
604
|
|
605
|
-
it "should not give a deprecation warning when given actual content" do
|
605
|
+
it "should not give a checksum deprecation warning when given actual content" do
|
606
606
|
Puppet.expects(:puppet_deprecation_warning).never
|
607
607
|
catalog.add_resource described_class.new(:path => path, :content => 'this is content')
|
608
608
|
catalog.apply
|
@@ -613,14 +613,14 @@ describe Puppet::Type.type(:file), :uses_checksums => true do
|
|
613
613
|
let(:filebucket_digest) { method(:digest) }
|
614
614
|
end
|
615
615
|
|
616
|
-
it "should give a deprecation warning" do
|
616
|
+
it "should give a checksum deprecation warning" do
|
617
617
|
Puppet.expects(:puppet_deprecation_warning).with('Using a checksum in a file\'s "content" property is deprecated. The ability to use a checksum to retrieve content from the filebucket using the "content" property will be removed in a future release. The literal value of the "content" property will be written to the file. The checksum retrieval functionality is being replaced by the use of static catalogs. See https://puppet.com/docs/puppet/latest/static_catalogs.html for more information.', {:file => 'my/file.pp', :line => 5})
|
618
618
|
d = digest("this is some content")
|
619
619
|
catalog.add_resource described_class.new(:path => path, :content => "{#{digest_algorithm}}#{d}")
|
620
620
|
catalog.apply
|
621
621
|
end
|
622
622
|
|
623
|
-
it "should not give a deprecation warning when no content is specified while checksum and checksum value are used" do
|
623
|
+
it "should not give a checksum deprecation warning when no content is specified while checksum and checksum value are used" do
|
624
624
|
Puppet.expects(:puppet_deprecation_warning).never
|
625
625
|
d = digest("this is some content")
|
626
626
|
catalog.add_resource described_class.new(:path => path, :checksum => digest_algorithm, :checksum_value => d)
|
@@ -1281,6 +1281,21 @@ describe Puppet::Type.type(:file), :uses_checksums => true do
|
|
1281
1281
|
end
|
1282
1282
|
|
1283
1283
|
describe "when sourcing" do
|
1284
|
+
it "should give a deprecation warning when the user sets source_permissions" do
|
1285
|
+
Puppet.expects(:puppet_deprecation_warning).with(
|
1286
|
+
'The `source_permissions` parameter is deprecated. Explicitly set `owner`, `group`, and `mode`.',
|
1287
|
+
{:file => 'my/file.pp', :line => 5})
|
1288
|
+
|
1289
|
+
catalog.add_resource described_class.new(:path => path, :content => 'this is content', :source_permissions => :use_when_creating)
|
1290
|
+
catalog.apply
|
1291
|
+
end
|
1292
|
+
|
1293
|
+
it "should not give a deprecation warning when the user does not set source_permissions" do
|
1294
|
+
Puppet.expects(:puppet_deprecation_warning).never
|
1295
|
+
catalog.add_resource described_class.new(:path => path, :content => 'this is content')
|
1296
|
+
catalog.apply
|
1297
|
+
end
|
1298
|
+
|
1284
1299
|
with_checksum_types "source", "default_values" do
|
1285
1300
|
before(:each) do
|
1286
1301
|
set_mode(0770, checksum_file)
|
@@ -224,7 +224,58 @@ describe "Puppet::Util::Windows::Security", :if => Puppet.features.microsoft_win
|
|
224
224
|
end
|
225
225
|
end
|
226
226
|
|
227
|
-
it "should round-trip all 128 modes that do not require deny ACEs" do
|
227
|
+
it "should round-trip all 128 modes that do not require deny ACEs, where owner and group are different" do
|
228
|
+
# windows defaults set Administrators, None when Administrator
|
229
|
+
# or Administrators, SYSTEM when System
|
230
|
+
# but we can guarantee group is different by explicitly setting to Users
|
231
|
+
winsec.set_group(sids[:users], path)
|
232
|
+
|
233
|
+
0.upto(1).each do |s|
|
234
|
+
0.upto(7).each do |u|
|
235
|
+
0.upto(u).each do |g|
|
236
|
+
0.upto(g).each do |o|
|
237
|
+
# if user is superset of group, and group superset of other, then
|
238
|
+
# no deny ace is required, and mode can be converted to win32
|
239
|
+
# access mask, and back to mode without loss of information
|
240
|
+
# (provided the owner and group are not the same)
|
241
|
+
next if ((u & g) != g) or ((g & o) != o)
|
242
|
+
|
243
|
+
mode = (s << 9 | u << 6 | g << 3 | o << 0)
|
244
|
+
winsec.set_mode(mode, path)
|
245
|
+
expect(winsec.get_mode(path).to_s(8)).to eq(mode.to_s(8))
|
246
|
+
end
|
247
|
+
end
|
248
|
+
end
|
249
|
+
end
|
250
|
+
end
|
251
|
+
|
252
|
+
it "should round-trip all 54 modes that do not require deny ACEs, where owner and group are same" do
|
253
|
+
winsec.set_group(winsec.get_owner(path), path)
|
254
|
+
|
255
|
+
0.upto(1).each do |s|
|
256
|
+
0.upto(7).each do |ug|
|
257
|
+
0.upto(ug).each do |o|
|
258
|
+
# if user and group superset of other, then
|
259
|
+
# no deny ace is required, and mode can be converted to win32
|
260
|
+
# access mask, and back to mode without loss of information
|
261
|
+
# (provided the owner and group are the same)
|
262
|
+
next if ((ug & o) != o)
|
263
|
+
mode = (s << 9 | ug << 6 | ug << 3 | o << 0)
|
264
|
+
winsec.set_mode(mode, path)
|
265
|
+
expect(winsec.get_mode(path).to_s(8)).to eq(mode.to_s(8))
|
266
|
+
end
|
267
|
+
end
|
268
|
+
end
|
269
|
+
end
|
270
|
+
|
271
|
+
# The SYSTEM user is a special case therefore we need to test that we round trip correctly when set
|
272
|
+
it "should round-trip all 128 modes that do not require deny ACEs, when simulating a SYSTEM service" do
|
273
|
+
# The owner and group for files/dirs created, when running as a service under Local System are
|
274
|
+
# Owner = Administrators
|
275
|
+
# Group = SYSTEM
|
276
|
+
winsec.set_owner(sids[:administrators], path)
|
277
|
+
winsec.set_group(sids[:system], path)
|
278
|
+
|
228
279
|
0.upto(1).each do |s|
|
229
280
|
0.upto(7).each do |u|
|
230
281
|
0.upto(u).each do |g|
|
@@ -566,6 +617,32 @@ describe "Puppet::Util::Windows::Security", :if => Puppet.features.microsoft_win
|
|
566
617
|
# end
|
567
618
|
end
|
568
619
|
|
620
|
+
describe "#mode=" do
|
621
|
+
# setting owner to SYSTEM requires root
|
622
|
+
it "should round-trip all 54 modes that do not require deny ACEs, when simulating a SYSTEM scheduled task" do
|
623
|
+
# The owner and group for files/dirs created, when running as a Scheduled Task as Local System are
|
624
|
+
# Owner = SYSTEM
|
625
|
+
# Group = SYSTEM
|
626
|
+
winsec.set_group(sids[:system], path)
|
627
|
+
winsec.set_owner(sids[:system], path)
|
628
|
+
|
629
|
+
0.upto(1).each do |s|
|
630
|
+
0.upto(7).each do |ug|
|
631
|
+
0.upto(ug).each do |o|
|
632
|
+
# if user and group superset of other, then
|
633
|
+
# no deny ace is required, and mode can be converted to win32
|
634
|
+
# access mask, and back to mode without loss of information
|
635
|
+
# (provided the owner and group are the same)
|
636
|
+
next if ((ug & o) != o)
|
637
|
+
mode = (s << 9 | ug << 6 | ug << 3 | o << 0)
|
638
|
+
winsec.set_mode(mode, path)
|
639
|
+
expect(winsec.get_mode(path).to_s(8)).to eq(mode.to_s(8))
|
640
|
+
end
|
641
|
+
end
|
642
|
+
end
|
643
|
+
end
|
644
|
+
end
|
645
|
+
|
569
646
|
describe "when the parent directory" do
|
570
647
|
before :each do
|
571
648
|
winsec.set_owner(sids[:current_user], parent)
|
@@ -7,6 +7,7 @@ require 'puppet/network/server'
|
|
7
7
|
|
8
8
|
describe Puppet::Application::Master, :unless => Puppet.features.microsoft_windows? do
|
9
9
|
before :each do
|
10
|
+
Puppet[:bindaddress] = '127.0.0.1'
|
10
11
|
@master = Puppet::Application[:master]
|
11
12
|
@daemon = stub_everything 'daemon'
|
12
13
|
Puppet::Daemon.stubs(:new).returns(@daemon)
|
@@ -357,6 +358,7 @@ describe Puppet::Application::Master, :unless => Puppet.features.microsoft_windo
|
|
357
358
|
|
358
359
|
it "should log a deprecation notice when running a WEBrick server" do
|
359
360
|
Puppet.expects(:deprecation_warning).with("The WEBrick Puppet master server is deprecated and will be removed in a future release. Please use Puppet Server instead. See http://links.puppet.com/deprecate-rack-webrick-servers for more information.")
|
361
|
+
Puppet.expects(:deprecation_warning).with("Accessing 'bindaddress' as a setting is deprecated.")
|
360
362
|
|
361
363
|
@master.main
|
362
364
|
end
|
@@ -160,6 +160,11 @@ describe Puppet::Configurer::Downloader do
|
|
160
160
|
expect(@dler.catalog.host_config).to eq(false)
|
161
161
|
end
|
162
162
|
|
163
|
+
it "should not issue a deprecation warning for source_permissions" do
|
164
|
+
Puppet.expects(:puppet_deprecation_warning).never
|
165
|
+
catalog = @dler.catalog
|
166
|
+
expect(catalog.resources.size).to eq(1) # Must consume catalog to fix warnings
|
167
|
+
end
|
163
168
|
end
|
164
169
|
|
165
170
|
describe "when downloading" do
|
data/spec/unit/defaults_spec.rb
CHANGED
@@ -124,6 +124,19 @@ describe "Defaults" do
|
|
124
124
|
end
|
125
125
|
end
|
126
126
|
|
127
|
+
describe 'manage_internal_file_permissions' do
|
128
|
+
describe 'on windows', :if => Puppet::Util::Platform.windows? do
|
129
|
+
it 'should default to false' do
|
130
|
+
expect(Puppet.settings[:manage_internal_file_permissions]).to be false
|
131
|
+
end
|
132
|
+
end
|
133
|
+
describe 'on non-windows', :if => ! Puppet::Util::Platform.windows? do
|
134
|
+
it 'should default to true' do
|
135
|
+
expect(Puppet.settings[:manage_internal_file_permissions]).to be true
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
127
140
|
describe 'basemodulepath' do
|
128
141
|
it 'includes the global and system modules on non-windows', :unless => Puppet::Util::Platform.windows? do
|
129
142
|
expect(
|
data/spec/unit/face/help_spec.rb
CHANGED
@@ -127,7 +127,8 @@ describe Puppet::Face[:help, '0.0.1'] do
|
|
127
127
|
expect(subject).to match(%r{ #{appname} })
|
128
128
|
|
129
129
|
summary = Puppet::Face[:help, :current].horribly_extract_summary_from(appname)
|
130
|
-
|
130
|
+
summary_regex = Regexp.escape(summary)
|
131
|
+
summary and expect(subject).to match(%r{ #{summary_regex}$})
|
131
132
|
end
|
132
133
|
end
|
133
134
|
end
|
@@ -13,12 +13,33 @@ describe Puppet::Indirector::Ldap do
|
|
13
13
|
end
|
14
14
|
|
15
15
|
@connection = mock 'ldap'
|
16
|
+
end
|
17
|
+
|
18
|
+
describe "when instantiating ldap" do
|
19
|
+
it "should be deprecated" do
|
20
|
+
Puppet.expects(:deprecation_warning).with("Puppet::Indirector::Ldap is deprecated and will be removed in a future release of Puppet.")
|
21
|
+
|
22
|
+
@ldap_class.new
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should not emit a deprecation warning when they are disabled" do
|
26
|
+
Puppet.expects(:warning).with(regexp_matches(/Puppet::Indirector::Ldap is deprecated/)).never
|
27
|
+
Puppet[:disable_warnings] = ['deprecations']
|
16
28
|
|
17
|
-
|
29
|
+
@ldap_class.new
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should only emit the deprecation warning once" do
|
33
|
+
Puppet.expects(:warning).with(regexp_matches(/Puppet::Indirector::Ldap is deprecated/)).once
|
34
|
+
|
35
|
+
@ldap_class.new
|
36
|
+
@ldap_class.new
|
37
|
+
end
|
18
38
|
end
|
19
39
|
|
20
40
|
describe "when searching ldap" do
|
21
41
|
before do
|
42
|
+
@searcher = @ldap_class.new
|
22
43
|
# Stub everything, and we can selectively replace with an expect as
|
23
44
|
# we need to for testing.
|
24
45
|
@searcher.stubs(:connection).returns(@connection)
|
@@ -507,6 +507,20 @@ describe Puppet::Node::Environment do
|
|
507
507
|
Puppet::GettextConfig.expects(:use_text_domain).with(env.name)
|
508
508
|
env.with_text_domain do; end
|
509
509
|
end
|
510
|
+
|
511
|
+
it "yields block results" do
|
512
|
+
ran = false
|
513
|
+
expect(env.with_text_domain { ran = true; :result }).to eq(:result)
|
514
|
+
expect(ran).to eq(true)
|
515
|
+
end
|
516
|
+
|
517
|
+
it "yields block results when i18n is disabled" do
|
518
|
+
Puppet[:disable_i18n] = true
|
519
|
+
|
520
|
+
ran = false
|
521
|
+
expect(env.with_text_domain { ran = true; :result }).to eq(:result)
|
522
|
+
expect(ran).to eq(true)
|
523
|
+
end
|
510
524
|
end
|
511
525
|
|
512
526
|
end
|
@@ -22,4 +22,20 @@ describe "the 'tagged' function" do
|
|
22
22
|
@scope.function_tagged(['one', 'two'])
|
23
23
|
end.to raise_error(Puppet::ParseError, /is only available when compiling a catalog/)
|
24
24
|
end
|
25
|
+
|
26
|
+
it 'should be case-insensitive' do
|
27
|
+
resource = Puppet::Parser::Resource.new(:file, "/file", :scope => @scope)
|
28
|
+
@scope.stubs(:resource).returns resource
|
29
|
+
@scope.function_tag ["one"]
|
30
|
+
|
31
|
+
expect(@scope.function_tagged(['One'])).to eq(true)
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'should check if all specified tags are included' do
|
35
|
+
resource = Puppet::Parser::Resource.new(:file, "/file", :scope => @scope)
|
36
|
+
@scope.stubs(:resource).returns resource
|
37
|
+
@scope.function_tag ["one"]
|
38
|
+
|
39
|
+
expect(@scope.function_tagged(['one', 'two'])).to eq(false)
|
40
|
+
end
|
25
41
|
end
|
@@ -10,12 +10,25 @@ describe "validating 4x" do
|
|
10
10
|
|
11
11
|
let(:acceptor) { Puppet::Pops::Validation::Acceptor.new() }
|
12
12
|
let(:validator) { Puppet::Pops::Validation::ValidatorFactory_4_0.new().validator(acceptor) }
|
13
|
+
let(:environment) { Puppet::Node::Environment.create(:bar, ['path']) }
|
13
14
|
|
14
15
|
def validate(factory)
|
15
16
|
validator.validate(factory.model)
|
16
17
|
acceptor
|
17
18
|
end
|
18
19
|
|
20
|
+
def deprecation_count(acceptor)
|
21
|
+
acceptor.diagnostics.select {|d| d.severity == :deprecation }.count
|
22
|
+
end
|
23
|
+
|
24
|
+
def with_environment(environment, env_params = {})
|
25
|
+
override_env = environment
|
26
|
+
override_env = environment.override_with(env_params) if env_params.count > 0
|
27
|
+
Puppet.override(current_environment: override_env) do
|
28
|
+
yield
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
19
32
|
it 'should raise error for illegal class names' do
|
20
33
|
expect(validate(parse('class aaa::_bbb {}'))).to have_issue(Puppet::Pops::Issues::ILLEGAL_DEFINITION_NAME)
|
21
34
|
expect(validate(parse('class Aaa {}'))).to have_issue(Puppet::Pops::Issues::ILLEGAL_DEFINITION_NAME)
|
@@ -34,6 +47,72 @@ describe "validating 4x" do
|
|
34
47
|
expect(validate(parse('function ::aaa() {}'))).to have_issue(Puppet::Pops::Issues::ILLEGAL_DEFINITION_NAME)
|
35
48
|
end
|
36
49
|
|
50
|
+
it 'should raise error for illegal definition locations' do
|
51
|
+
with_environment(environment) do
|
52
|
+
expect(validate(parse('function aaa::ccc() {}', 'path/aaa/manifests/bbb.pp'))).to have_issue(Puppet::Pops::Issues::ILLEGAL_DEFINITION_LOCATION)
|
53
|
+
expect(validate(parse('class bbb() {}', 'path/aaa/manifests/init.pp'))).to have_issue(Puppet::Pops::Issues::ILLEGAL_DEFINITION_LOCATION)
|
54
|
+
expect(validate(parse('define aaa::bbb::ccc::eee() {}', 'path/aaa/manifests/bbb/ddd.pp'))).to have_issue(Puppet::Pops::Issues::ILLEGAL_DEFINITION_LOCATION)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'should not raise error for legal definition locations' do
|
59
|
+
with_environment(environment) do
|
60
|
+
expect(validate(parse('function aaa::bbb() {}', 'path/aaa/manifests/bbb.pp'))).not_to have_issue(Puppet::Pops::Issues::ILLEGAL_DEFINITION_LOCATION)
|
61
|
+
expect(validate(parse('class aaa() {}', 'path/aaa/manifests/init.pp'))).not_to have_issue(Puppet::Pops::Issues::ILLEGAL_DEFINITION_LOCATION)
|
62
|
+
expect(validate(parse('function aaa::bbB::ccc() {}', 'path/aaa/manifests/bBb.pp'))).not_to have_issue(Puppet::Pops::Issues::ILLEGAL_DEFINITION_LOCATION)
|
63
|
+
expect(validate(parse('function aaa::bbb::ccc() {}', 'path/aaa/manifests/bbb/CCC.pp'))).not_to have_issue(Puppet::Pops::Issues::ILLEGAL_DEFINITION_LOCATION)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
it 'should not raise error for class locations when not parsing a file' do
|
68
|
+
#nil/'' file means eval or some other way to get puppet language source code into the catalog
|
69
|
+
with_environment(environment) do
|
70
|
+
expect(validate(parse('function aaa::ccc() {}', nil))).not_to have_issue(Puppet::Pops::Issues::ILLEGAL_DEFINITION_LOCATION)
|
71
|
+
expect(validate(parse('function aaa::ccc() {}', ''))).not_to have_issue(Puppet::Pops::Issues::ILLEGAL_DEFINITION_LOCATION)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
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
|
+
it 'should not raise error for definitions inside initial --manifest file' do
|
85
|
+
with_environment(environment, :manifest => 'a/manifest/file.pp') do
|
86
|
+
expect(validate(parse('class aaa() {}', 'a/manifest/file.pp'))).not_to have_issue(Puppet::Pops::Issues::ILLEGAL_DEFINITION_LOCATION)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
it 'should not raise error for definitions inside initial --manifest directory' do
|
91
|
+
with_environment(environment, :manifest => 'a/manifest/dir') do
|
92
|
+
expect(validate(parse('class aaa() {}', 'a/manifest/dir/file1.pp'))).not_to have_issue(Puppet::Pops::Issues::ILLEGAL_DEFINITION_LOCATION)
|
93
|
+
expect(validate(parse('class bbb::ccc::ddd() {}', 'a/manifest/dir/and/more/stuff.pp'))).not_to have_issue(Puppet::Pops::Issues::ILLEGAL_DEFINITION_LOCATION)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
it 'should not raise error for definitions not inside initial --manifest but also not in modulepath' do
|
98
|
+
with_environment(environment, :manifest => 'a/manifest/somewhere/else') do
|
99
|
+
expect(validate(parse('class aaa() {}', 'a/random/dir/file1.pp'))).not_to have_issue(Puppet::Pops::Issues::ILLEGAL_DEFINITION_LOCATION)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
it 'should raise error if the file is in the modulepath but is not well formed' do
|
104
|
+
with_environment(environment) do
|
105
|
+
expect(validate(parse('class aaa::bbb::ccc() {}', 'path/manifest/aaa/bbb.pp'))).to have_issue(Puppet::Pops::Issues::ILLEGAL_DEFINITION_LOCATION)
|
106
|
+
expect(validate(parse('class aaa::bbb::ccc() {}', 'path/aaa/bbb/manifest/ccc.pp'))).to have_issue(Puppet::Pops::Issues::ILLEGAL_DEFINITION_LOCATION)
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
it 'should not raise error for definitions not inside initial --manifest but also not in modulepath because of only a case difference' do
|
111
|
+
with_environment(environment) do
|
112
|
+
expect(validate(parse('class aaa::bb() {}', 'Path/aaa/manifests/ccc.pp'))).not_to have_issue(Puppet::Pops::Issues::ILLEGAL_DEFINITION_LOCATION)
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
37
116
|
it 'should raise error for illegal type names' do
|
38
117
|
expect(validate(parse('type ::Aaa = Any'))).to have_issue(Puppet::Pops::Issues::ILLEGAL_DEFINITION_NAME)
|
39
118
|
end
|
@@ -56,6 +135,16 @@ describe "validating 4x" do
|
|
56
135
|
expect(acceptor.error_count).to eql(0)
|
57
136
|
expect(acceptor).to have_issue(Puppet::Pops::Issues::DUPLICATE_KEY)
|
58
137
|
end
|
138
|
+
|
139
|
+
it 'produces a deprecation for illegal function locations' do
|
140
|
+
with_environment(environment) do
|
141
|
+
acceptor = validate(parse('function aaa::ccc() {}', 'path/aaa/manifests/bbb.pp'))
|
142
|
+
expect(deprecation_count(acceptor)).to eql(1)
|
143
|
+
expect(acceptor.warning_count).to eql(1)
|
144
|
+
expect(acceptor.error_count).to eql(0)
|
145
|
+
expect(acceptor).to have_issue(Puppet::Pops::Issues::ILLEGAL_DEFINITION_LOCATION)
|
146
|
+
end
|
147
|
+
end
|
59
148
|
end
|
60
149
|
|
61
150
|
context 'with --strict set to warning' do
|
@@ -74,12 +163,22 @@ describe "validating 4x" do
|
|
74
163
|
expect(acceptor).to have_issue(Puppet::Pops::Issues::CLASS_NOT_VIRTUALIZABLE)
|
75
164
|
end
|
76
165
|
|
77
|
-
it 'produces a
|
166
|
+
it 'produces a warning for exported class resource' do
|
78
167
|
acceptor = validate(parse('@@class { test: }'))
|
79
168
|
expect(acceptor.warning_count).to eql(1)
|
80
169
|
expect(acceptor.error_count).to eql(0)
|
81
170
|
expect(acceptor).to have_issue(Puppet::Pops::Issues::CLASS_NOT_VIRTUALIZABLE)
|
82
171
|
end
|
172
|
+
|
173
|
+
it 'produces a deprecation for illegal function locations' do
|
174
|
+
with_environment(environment) do
|
175
|
+
acceptor = validate(parse('function aaa::ccc() {}', 'path/aaa/manifests/bbb.pp'))
|
176
|
+
expect(deprecation_count(acceptor)).to eql(1)
|
177
|
+
expect(acceptor.warning_count).to eql(1)
|
178
|
+
expect(acceptor.error_count).to eql(0)
|
179
|
+
expect(acceptor).to have_issue(Puppet::Pops::Issues::ILLEGAL_DEFINITION_LOCATION)
|
180
|
+
end
|
181
|
+
end
|
83
182
|
end
|
84
183
|
|
85
184
|
context 'with --strict set to error' do
|
@@ -111,6 +210,16 @@ describe "validating 4x" do
|
|
111
210
|
expect(acceptor.error_count).to eql(1)
|
112
211
|
expect(acceptor).to have_issue(Puppet::Pops::Issues::CLASS_NOT_VIRTUALIZABLE)
|
113
212
|
end
|
213
|
+
|
214
|
+
it 'produces a deprecation for illegal function locations' do
|
215
|
+
with_environment(environment) do
|
216
|
+
acceptor = validate(parse('function aaa::ccc() {}', 'path/aaa/manifests/bbb.pp'))
|
217
|
+
expect(deprecation_count(acceptor)).to eql(1)
|
218
|
+
expect(acceptor.warning_count).to eql(1)
|
219
|
+
expect(acceptor.error_count).to eql(0)
|
220
|
+
expect(acceptor).to have_issue(Puppet::Pops::Issues::ILLEGAL_DEFINITION_LOCATION)
|
221
|
+
end
|
222
|
+
end
|
114
223
|
end
|
115
224
|
|
116
225
|
context 'with --strict set to off' do
|
@@ -121,6 +230,16 @@ describe "validating 4x" do
|
|
121
230
|
expect(acceptor.error_count).to eql(0)
|
122
231
|
expect(acceptor).to_not have_issue(Puppet::Pops::Issues::DUPLICATE_KEY)
|
123
232
|
end
|
233
|
+
|
234
|
+
it 'produces a deprecation for illegal function locations' do
|
235
|
+
with_environment(environment) do
|
236
|
+
acceptor = validate(parse('function aaa::ccc() {}', 'path/aaa/manifests/bbb.pp'))
|
237
|
+
expect(deprecation_count(acceptor)).to eql(1)
|
238
|
+
expect(acceptor.warning_count).to eql(1)
|
239
|
+
expect(acceptor.error_count).to eql(0)
|
240
|
+
expect(acceptor).to have_issue(Puppet::Pops::Issues::ILLEGAL_DEFINITION_LOCATION)
|
241
|
+
end
|
242
|
+
end
|
124
243
|
end
|
125
244
|
|
126
245
|
context 'irrespective of --strict' do
|
@@ -145,7 +264,7 @@ describe "validating 4x" do
|
|
145
264
|
expect(acceptor).to have_issue(Puppet::Pops::Issues::CLASS_NOT_VIRTUALIZABLE)
|
146
265
|
end
|
147
266
|
|
148
|
-
it 'produces a
|
267
|
+
it 'produces a warning for exported class resource' do
|
149
268
|
acceptor = validate(parse('@@class { test: }'))
|
150
269
|
expect(acceptor.warning_count).to eql(1)
|
151
270
|
expect(acceptor.error_count).to eql(0)
|
@@ -156,6 +275,22 @@ describe "validating 4x" do
|
|
156
275
|
context 'with --tasks set' do
|
157
276
|
before(:each) { Puppet[:tasks] = true }
|
158
277
|
|
278
|
+
it 'raises an error for illegal plan names' do
|
279
|
+
with_environment(environment) do
|
280
|
+
expect(validate(parse('plan aaa::ccc::eee() {}', 'path/aaa/plans/bbb/ccc/eee.pp'))).to have_issue(Puppet::Pops::Issues::ILLEGAL_DEFINITION_LOCATION)
|
281
|
+
expect(validate(parse('plan aaa() {}', 'path/aaa/plans/aaa.pp'))).to have_issue(Puppet::Pops::Issues::ILLEGAL_DEFINITION_LOCATION)
|
282
|
+
expect(validate(parse('plan aaa::bbb() {}', 'path/aaa/plans/bbb/bbb.pp'))).to have_issue(Puppet::Pops::Issues::ILLEGAL_DEFINITION_LOCATION)
|
283
|
+
end
|
284
|
+
end
|
285
|
+
|
286
|
+
it 'accepts legal plan names' do
|
287
|
+
with_environment(environment) do
|
288
|
+
expect(validate(parse('plan aaa::ccc::eee() {}', 'path/aaa/plans/ccc/eee.pp'))).not_to have_issue(Puppet::Pops::Issues::ILLEGAL_DEFINITION_LOCATION)
|
289
|
+
expect(validate(parse('plan aaa() {}', 'path/aaa/plans/init.pp'))).not_to have_issue(Puppet::Pops::Issues::ILLEGAL_DEFINITION_LOCATION)
|
290
|
+
expect(validate(parse('plan aaa::bbb() {}', 'path/aaa/plans/bbb.pp'))).not_to have_issue(Puppet::Pops::Issues::ILLEGAL_DEFINITION_LOCATION)
|
291
|
+
end
|
292
|
+
end
|
293
|
+
|
159
294
|
it 'produces an error for application' do
|
160
295
|
acceptor = validate(parse('application test {}'))
|
161
296
|
expect(acceptor.error_count).to eql(1)
|
@@ -662,7 +797,7 @@ describe "validating 4x" do
|
|
662
797
|
end
|
663
798
|
end
|
664
799
|
|
665
|
-
def parse(source)
|
666
|
-
Puppet::Pops::Parser::Parser.new.parse_string(source)
|
800
|
+
def parse(source, path=nil)
|
801
|
+
Puppet::Pops::Parser::Parser.new.parse_string(source, path)
|
667
802
|
end
|
668
803
|
end
|