puppet 7.9.0 → 7.10.0
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.lock +6 -6
- data/{ext → examples/enc}/regexp_nodes/classes/databases +0 -0
- data/{ext → examples/enc}/regexp_nodes/classes/webservers +0 -0
- data/{ext → examples/enc}/regexp_nodes/environment/development +0 -0
- data/{ext → examples/enc}/regexp_nodes/parameters/service/prod +0 -0
- data/{ext → examples/enc}/regexp_nodes/parameters/service/qa +0 -0
- data/{ext → examples/enc}/regexp_nodes/parameters/service/sandbox +0 -0
- data/{ext → examples/enc}/regexp_nodes/regexp_nodes.rb +0 -0
- data/{ext → examples}/nagios/check_puppet.rb +2 -2
- data/ext/README.md +13 -0
- data/lib/puppet/configurer.rb +155 -46
- data/lib/puppet/defaults.rb +51 -26
- data/lib/puppet/environments.rb +66 -26
- data/lib/puppet/file_serving/configuration.rb +2 -0
- data/lib/puppet/file_serving/configuration/parser.rb +2 -0
- data/lib/puppet/file_serving/mount/scripts.rb +24 -0
- data/lib/puppet/functions/find_template.rb +2 -2
- data/lib/puppet/http/service/compiler.rb +6 -1
- data/lib/puppet/indirector/catalog/compiler.rb +21 -3
- data/lib/puppet/indirector/catalog/rest.rb +1 -0
- data/lib/puppet/indirector/terminus.rb +4 -0
- data/lib/puppet/module/plan.rb +0 -1
- data/lib/puppet/module/task.rb +1 -1
- data/lib/puppet/module_tool/applications/installer.rb +8 -4
- data/lib/puppet/network/http/api/indirected_routes.rb +1 -1
- data/lib/puppet/node/environment.rb +10 -11
- data/lib/puppet/pops/serialization/to_data_converter.rb +18 -6
- data/lib/puppet/provider/package/pkg.rb +8 -1
- data/lib/puppet/provider/service/launchd.rb +1 -1
- data/lib/puppet/provider/service/systemd.rb +1 -1
- data/lib/puppet/provider/user/useradd.rb +42 -9
- data/lib/puppet/transaction/persistence.rb +11 -1
- data/lib/puppet/transaction/report.rb +15 -1
- data/lib/puppet/type.rb +1 -1
- data/lib/puppet/type/exec.rb +10 -1
- data/lib/puppet/type/file.rb +6 -6
- data/lib/puppet/type/filebucket.rb +2 -2
- data/lib/puppet/version.rb +1 -1
- data/locales/puppet.pot +134 -94
- data/man/man5/puppet.conf.5 +65 -25
- data/man/man8/puppet-agent.8 +1 -1
- data/man/man8/puppet-apply.8 +1 -1
- data/man/man8/puppet-catalog.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-lookup.8 +1 -1
- data/man/man8/puppet-module.8 +3 -3
- 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-ssl.8 +1 -1
- data/man/man8/puppet.8 +2 -2
- data/spec/fixtures/integration/application/agent/lib/facter/agent_spec_role.rb +3 -0
- data/spec/fixtures/integration/l10n/envs/prod/modules/demo/Gemfile +4 -0
- data/spec/fixtures/integration/l10n/envs/prod/modules/demo/Rakefile +3 -0
- data/spec/fixtures/integration/l10n/envs/prod/modules/demo/lib/puppet/functions/l10n.rb +8 -0
- data/spec/fixtures/integration/l10n/envs/prod/modules/demo/locales/config.yaml +25 -0
- data/spec/fixtures/integration/l10n/envs/prod/modules/demo/locales/ja/puppet-l10n.po +19 -0
- data/spec/fixtures/integration/l10n/envs/prod/modules/demo/locales/puppet-l10n.pot +20 -0
- data/spec/fixtures/integration/l10n/envs/prod/modules/demo/metadata.json +8 -0
- data/spec/integration/application/agent_spec.rb +102 -52
- data/spec/integration/application/filebucket_spec.rb +5 -0
- data/spec/integration/configurer_spec.rb +17 -1
- data/spec/integration/l10n/compiler_spec.rb +37 -0
- data/spec/lib/puppet_spec/modules.rb +13 -2
- data/spec/lib/puppet_spec/puppetserver.rb +15 -0
- data/spec/shared_behaviours/documentation_on_faces.rb +0 -2
- data/spec/shared_contexts/l10n.rb +27 -0
- data/spec/spec_helper.rb +1 -10
- data/spec/unit/configurer_spec.rb +265 -54
- data/spec/unit/environments_spec.rb +150 -1
- data/spec/unit/file_serving/configuration/parser_spec.rb +23 -0
- data/spec/unit/file_serving/configuration_spec.rb +12 -4
- data/spec/unit/file_serving/mount/scripts_spec.rb +69 -0
- data/spec/unit/functions/logging_spec.rb +1 -0
- data/spec/unit/http/service/compiler_spec.rb +8 -0
- data/spec/unit/indirector/catalog/compiler_spec.rb +87 -0
- data/spec/unit/indirector/catalog/rest_spec.rb +8 -0
- data/spec/unit/interface/action_spec.rb +0 -9
- data/spec/unit/module_spec.rb +14 -0
- data/spec/unit/module_tool/applications/installer_spec.rb +39 -12
- data/spec/unit/pops/parser/parse_containers_spec.rb +0 -11
- data/spec/unit/pops/serialization/to_from_hr_spec.rb +58 -0
- data/spec/unit/provider/package/pkg_spec.rb +19 -5
- data/spec/unit/provider/service/launchd_spec.rb +11 -0
- data/spec/unit/provider/service/systemd_spec.rb +1 -1
- data/spec/unit/provider/user/useradd_spec.rb +3 -2
- metadata +34 -94
- data/ext/README.environment +0 -8
- data/ext/dbfix.sql +0 -132
- data/ext/debian/README.Debian +0 -8
- data/ext/debian/README.source +0 -2
- data/ext/debian/TODO.Debian +0 -1
- data/ext/debian/changelog.erb +0 -1122
- data/ext/debian/compat +0 -1
- data/ext/debian/control +0 -144
- data/ext/debian/copyright +0 -339
- data/ext/debian/docs +0 -1
- data/ext/debian/fileserver.conf +0 -41
- data/ext/debian/puppet-common.dirs +0 -13
- data/ext/debian/puppet-common.install +0 -3
- data/ext/debian/puppet-common.lintian-overrides +0 -5
- data/ext/debian/puppet-common.manpages +0 -28
- data/ext/debian/puppet-common.postinst +0 -35
- data/ext/debian/puppet-common.postrm +0 -33
- data/ext/debian/puppet-el.dirs +0 -1
- data/ext/debian/puppet-el.emacsen-install +0 -25
- data/ext/debian/puppet-el.emacsen-remove +0 -11
- data/ext/debian/puppet-el.emacsen-startup +0 -9
- data/ext/debian/puppet-el.install +0 -1
- data/ext/debian/puppet-testsuite.install +0 -2
- data/ext/debian/puppet-testsuite.lintian-overrides +0 -4
- data/ext/debian/puppet.lintian-overrides +0 -3
- data/ext/debian/puppet.logrotate +0 -20
- data/ext/debian/puppet.postinst +0 -20
- data/ext/debian/puppet.postrm +0 -20
- data/ext/debian/puppet.preinst +0 -20
- data/ext/debian/puppetmaster-common.install +0 -2
- data/ext/debian/puppetmaster-common.manpages +0 -2
- data/ext/debian/puppetmaster-common.postinst +0 -6
- data/ext/debian/puppetmaster-passenger.dirs +0 -4
- data/ext/debian/puppetmaster-passenger.postinst +0 -162
- data/ext/debian/puppetmaster-passenger.postrm +0 -61
- data/ext/debian/puppetmaster.README.debian +0 -17
- data/ext/debian/puppetmaster.default +0 -14
- data/ext/debian/puppetmaster.init +0 -137
- data/ext/debian/puppetmaster.lintian-overrides +0 -3
- data/ext/debian/puppetmaster.postinst +0 -20
- data/ext/debian/puppetmaster.postrm +0 -5
- data/ext/debian/puppetmaster.preinst +0 -22
- data/ext/debian/rules +0 -132
- data/ext/debian/source/format +0 -1
- data/ext/debian/source/options +0 -1
- data/ext/debian/vim-puppet.README.Debian +0 -13
- data/ext/debian/vim-puppet.dirs +0 -5
- data/ext/debian/vim-puppet.yaml +0 -7
- data/ext/debian/watch +0 -2
- data/ext/freebsd/puppetd +0 -26
- data/ext/freebsd/puppetmasterd +0 -26
- data/ext/gentoo/conf.d/puppet +0 -5
- data/ext/gentoo/conf.d/puppetmaster +0 -12
- data/ext/gentoo/init.d/puppet +0 -38
- data/ext/gentoo/init.d/puppetmaster +0 -51
- data/ext/gentoo/puppet/fileserver.conf +0 -41
- data/ext/ips/puppet-agent +0 -44
- data/ext/ips/puppet-master +0 -44
- data/ext/ips/puppet.p5m.erb +0 -12
- data/ext/ips/puppetagent.xml +0 -42
- data/ext/ips/puppetmaster.xml +0 -42
- data/ext/ips/rules +0 -19
- data/ext/ips/transforms +0 -34
- data/ext/ldap/puppet.schema +0 -24
- data/ext/logcheck/puppet +0 -23
- data/ext/osx/file_mapping.yaml +0 -28
- data/ext/osx/postflight.erb +0 -109
- data/ext/osx/preflight.erb +0 -52
- data/ext/osx/prototype.plist.erb +0 -38
- data/ext/redhat/fileserver.conf +0 -41
- data/ext/redhat/logrotate +0 -21
- data/ext/redhat/puppet.spec.erb +0 -841
- data/ext/redhat/server.init +0 -128
- data/ext/redhat/server.sysconfig +0 -13
- data/ext/solaris/pkginfo +0 -6
- data/ext/solaris/smf/puppetd.xml +0 -77
- data/ext/solaris/smf/puppetmasterd.xml +0 -77
- data/ext/solaris/smf/svc-puppetd +0 -71
- data/ext/solaris/smf/svc-puppetmasterd +0 -67
- data/ext/suse/puppet.spec +0 -310
- data/ext/suse/server.init +0 -173
- data/ext/yaml_nodes.rb +0 -105
- data/spec/unit/indirector/store_configs_spec.rb +0 -7
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 2021" "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 2021" "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 2021" "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-ssl.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\-SSL" "8" "
|
4
|
+
.TH "PUPPET\-SSL" "8" "August 2021" "Puppet, Inc." "Puppet manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBpuppet\-ssl\fR \- Manage SSL keys and certificates for puppet SSL clients
|
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 2021" "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 v7\.
|
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 v7\.10\.0
|
@@ -0,0 +1,25 @@
|
|
1
|
+
---
|
2
|
+
# This is the project-specific configuration file for setting up
|
3
|
+
# fast_gettext for your project.
|
4
|
+
gettext:
|
5
|
+
# This is used for the name of the .pot and .po files; they will be
|
6
|
+
# called <project_name>.pot?
|
7
|
+
project_name: 'puppet-l10n'
|
8
|
+
# This is used in comments in the .pot and .po files to indicate what
|
9
|
+
# project the files belong to and should bea little more descriptive than
|
10
|
+
# <project_name>
|
11
|
+
package_name: puppet l10n demo
|
12
|
+
# The locale that the default messages in the .pot file are in
|
13
|
+
default_locale: en
|
14
|
+
# The email used for sending bug reports.
|
15
|
+
bugs_address: docs@puppetlabs.com
|
16
|
+
# The holder of the copyright.
|
17
|
+
copyright_holder: Puppet Labs, LLC.
|
18
|
+
# This determines which comments in code should be eligible for translation.
|
19
|
+
# Any comments that start with this string will be externalized. (Leave
|
20
|
+
# empty to include all.)
|
21
|
+
comments_tag: TRANSLATORS
|
22
|
+
# Patterns for +Dir.glob+ used to find all files that might contain
|
23
|
+
# translatable content, relative to the project root directory
|
24
|
+
source_files:
|
25
|
+
- 'lib/**/*.rb'
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# Puppet, 2021
|
2
|
+
#
|
3
|
+
msgid ""
|
4
|
+
msgstr ""
|
5
|
+
"Project-Id-Version: 1.0\n"
|
6
|
+
"Report-Msgid-Bugs-To: \n"
|
7
|
+
"POT-Creation-Date: 2018-03-29 12:41+0000\n"
|
8
|
+
"PO-Revision-Date: 2018-03-29 12:43+0000\n"
|
9
|
+
"Last-Translator: Puppet\n"
|
10
|
+
"Language-Team: English\n"
|
11
|
+
"MIME-Version: 1.0\n"
|
12
|
+
"Content-Type: text/plain; charset=UTF-8\n"
|
13
|
+
"Content-Transfer-Encoding: 8bit\n"
|
14
|
+
"Language: en\n"
|
15
|
+
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
16
|
+
|
17
|
+
#: ../lib/puppet/functions/l10n.rb:5
|
18
|
+
msgid "IT'S HAPPY FUN TIME"
|
19
|
+
msgstr "それは楽しい時間です"
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# SOME DESCRIPTIVE TITLE.
|
2
|
+
# Copyright (C) 2021 Puppet Labs, LLC.
|
3
|
+
# This file is distributed under the same license as the puppet l10n demo package.
|
4
|
+
# FIRST AUTHOR <EMAIL@ADDRESS>, 2021.
|
5
|
+
#
|
6
|
+
#, fuzzy
|
7
|
+
msgid ""
|
8
|
+
msgstr ""
|
9
|
+
"Project-Id-Version: puppet l10n demo 6.23.0-100-gdc4e95bd86\n"
|
10
|
+
"\n"
|
11
|
+
"Report-Msgid-Bugs-To: docs@puppetlabs.com\n"
|
12
|
+
"POT-Creation-Date: 2021-07-16 16:48-0700\n"
|
13
|
+
"PO-Revision-Date: 2021-07-16 16:48-0700\n"
|
14
|
+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
15
|
+
"Language-Team: LANGUAGE <LL@li.org>\n"
|
16
|
+
"Language: \n"
|
17
|
+
"MIME-Version: 1.0\n"
|
18
|
+
"Content-Type: text/plain; charset=UTF-8\n"
|
19
|
+
"Content-Transfer-Encoding: 8bit\n"
|
20
|
+
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
|
@@ -469,83 +469,64 @@ describe "puppet agent", unless: Puppet::Util::Platform.jruby? do
|
|
469
469
|
end
|
470
470
|
|
471
471
|
context 'multiple agents running' do
|
472
|
-
|
472
|
+
def with_another_agent_running(&block)
|
473
473
|
path = Puppet[:agent_catalog_run_lockfile]
|
474
474
|
|
475
475
|
th = Thread.new {
|
476
|
-
%x{ruby -e "$0 = 'puppet'; File.write('#{path}', Process.pid); sleep(
|
476
|
+
%x{ruby -e "$0 = 'puppet'; File.write('#{path}', Process.pid); sleep(5)"}
|
477
477
|
}
|
478
478
|
|
479
|
+
# ensure file is written before yielding
|
479
480
|
until File.exists?(path) && File.size(path) > 0 do
|
480
481
|
sleep 0.1
|
481
482
|
end
|
482
483
|
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
484
|
+
begin
|
485
|
+
yield
|
486
|
+
ensure
|
487
|
+
th.kill # kill thread so we don't wait too much
|
488
|
+
end
|
489
|
+
end
|
487
490
|
|
488
|
-
|
491
|
+
it "exits if an agent is already running" do
|
492
|
+
with_another_agent_running do
|
493
|
+
expect {
|
494
|
+
agent.command_line.args << '--test'
|
495
|
+
agent.run
|
496
|
+
}.to exit_with(1).and output(/Run of Puppet configuration client already in progress; skipping/).to_stdout
|
497
|
+
end
|
489
498
|
end
|
490
499
|
|
491
500
|
it "waits for other agent run to finish before starting" do
|
492
501
|
server.start_server do |port|
|
493
|
-
script = tmpfile('wait_for_log_entry')
|
494
|
-
logdest = tmpfile('agent_log')
|
495
|
-
path = Puppet[:agent_catalog_run_lockfile]
|
496
502
|
Puppet[:serverport] = port
|
497
503
|
Puppet[:waitforlock] = 1
|
498
504
|
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
%x{ruby '#{script}'}
|
510
|
-
}
|
505
|
+
with_another_agent_running do
|
506
|
+
expect {
|
507
|
+
agent.command_line.args << '--test'
|
508
|
+
agent.run
|
509
|
+
}.to exit_with(0)
|
510
|
+
.and output(a_string_matching(
|
511
|
+
/Info: Will try again in #{Puppet[:waitforlock]} seconds/
|
512
|
+
).and matching(
|
513
|
+
/Applied catalog/
|
514
|
+
)).to_stdout
|
511
515
|
|
512
|
-
until File.exists?(path) && File.size(path) > 0 do
|
513
|
-
sleep 0.1
|
514
516
|
end
|
515
|
-
|
516
|
-
expect {
|
517
|
-
agent.command_line.args << '--test' << '--logdest' << logdest << '--logdest' << 'console'
|
518
|
-
agent.run
|
519
|
-
}.to exit_with(0)
|
520
|
-
.and output(a_string_matching(
|
521
|
-
/Info: Will try again in #{Puppet[:waitforlock]} seconds/
|
522
|
-
).and matching(
|
523
|
-
/Applied catalog/
|
524
|
-
)).to_stdout
|
525
|
-
|
526
|
-
th.kill # kill thread so we don't wait too much
|
527
517
|
end
|
528
518
|
end
|
529
519
|
|
530
520
|
it "exits if maxwaitforlock is exceeded" do
|
531
|
-
path = Puppet[:agent_catalog_run_lockfile]
|
532
521
|
Puppet[:waitforlock] = 1
|
533
522
|
Puppet[:maxwaitforlock] = 0
|
534
523
|
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
sleep 0.1
|
524
|
+
with_another_agent_running do
|
525
|
+
expect {
|
526
|
+
agent.command_line.args << '--test'
|
527
|
+
agent.run
|
528
|
+
}.to exit_with(1).and output(/Exiting now because the maxwaitforlock timeout has been exceeded./).to_stdout
|
541
529
|
end
|
542
|
-
|
543
|
-
expect {
|
544
|
-
agent.command_line.args << '--test'
|
545
|
-
agent.run
|
546
|
-
}.to exit_with(1).and output(/Exiting now because the maxwaitforlock timeout has been exceeded./).to_stdout
|
547
|
-
|
548
|
-
th.kill # kill thread so we don't wait too much
|
549
530
|
end
|
550
531
|
end
|
551
532
|
|
@@ -585,7 +566,7 @@ describe "puppet agent", unless: Puppet::Util::Platform.jruby? do
|
|
585
566
|
).and matching(
|
586
567
|
/Notify\[a message\]\/message:/
|
587
568
|
)).to_stdout
|
588
|
-
.and output(/
|
569
|
+
.and output(/No more routes to fileserver/).to_stderr
|
589
570
|
end
|
590
571
|
|
591
572
|
it 'preserves the old cached catalog if validation fails with the old one' do
|
@@ -604,7 +585,7 @@ describe "puppet agent", unless: Puppet::Util::Platform.jruby? do
|
|
604
585
|
agent.command_line.args << '--test'
|
605
586
|
agent.run
|
606
587
|
}.to exit_with(1)
|
607
|
-
.and output(
|
588
|
+
.and output(%r{Retrieving plugin}).to_stdout
|
608
589
|
.and output(%r{Validation of Exec\[unqualified_command\] failed: 'unqualified_command' is not qualified and no path was specified}).to_stderr
|
609
590
|
end
|
610
591
|
|
@@ -646,4 +627,73 @@ describe "puppet agent", unless: Puppet::Util::Platform.jruby? do
|
|
646
627
|
end
|
647
628
|
end
|
648
629
|
end
|
630
|
+
|
631
|
+
context "environment convergence" do
|
632
|
+
it "switches to 'newenv' environment and retries the run" do
|
633
|
+
first_run = true
|
634
|
+
libdir = File.join(my_fixture_dir, 'lib')
|
635
|
+
|
636
|
+
# we have to use the :facter terminus to reliably test that pluginsynced
|
637
|
+
# facts are included in the catalog request
|
638
|
+
Puppet::Node::Facts.indirection.terminus_class = :facter
|
639
|
+
|
640
|
+
mounts = {}
|
641
|
+
|
642
|
+
# During the first run, only return metadata for the top-level directory.
|
643
|
+
# During the second run, include metadata for all of the 'lib' fixtures
|
644
|
+
# due to the `recurse` option.
|
645
|
+
mounts[:file_metadatas] = -> (req, res) {
|
646
|
+
request = Puppet::FileServing::Metadata.indirection.request(
|
647
|
+
:search, libdir, nil, recurse: !first_run
|
648
|
+
)
|
649
|
+
data = Puppet::FileServing::Metadata.indirection.terminus(:file).search(request)
|
650
|
+
res.body = formatter.render(data)
|
651
|
+
res['Content-Type'] = formatter.mime
|
652
|
+
}
|
653
|
+
|
654
|
+
mounts[:file_content] = -> (req, res) {
|
655
|
+
request = Puppet::FileServing::Content.indirection.request(
|
656
|
+
:find, File.join(libdir, 'facter', 'agent_spec_role.rb'), nil
|
657
|
+
)
|
658
|
+
content = Puppet::FileServing::Content.indirection.terminus(:file).find(request)
|
659
|
+
res.body = content.content
|
660
|
+
res['Content-Length'] = content.content.length
|
661
|
+
res['Content-Type'] = 'application/octet-stream'
|
662
|
+
}
|
663
|
+
|
664
|
+
# During the first run, return an empty catalog referring to the newenv.
|
665
|
+
# During the second run, compile a catalog that depends on a fact that
|
666
|
+
# only exists in the second environment. If the fact is missing/empty,
|
667
|
+
# then compilation will fail since resources can't have an empty title.
|
668
|
+
mounts[:catalog] = -> (req, res) {
|
669
|
+
node = Puppet::Node.new('test')
|
670
|
+
|
671
|
+
code = if first_run
|
672
|
+
first_run = false
|
673
|
+
''
|
674
|
+
else
|
675
|
+
data = CGI.unescape(req.query['facts'])
|
676
|
+
facts = Puppet::Node::Facts.convert_from('json', data)
|
677
|
+
node.fact_merge(facts)
|
678
|
+
'notify { $facts["agent_spec_role"]: }'
|
679
|
+
end
|
680
|
+
|
681
|
+
catalog = compile_to_catalog(code, node)
|
682
|
+
catalog.environment = 'newenv'
|
683
|
+
|
684
|
+
res.body = formatter.render(catalog)
|
685
|
+
res['Content-Type'] = formatter.mime
|
686
|
+
}
|
687
|
+
|
688
|
+
server.start_server(mounts: mounts) do |port|
|
689
|
+
Puppet[:serverport] = port
|
690
|
+
expect {
|
691
|
+
agent.command_line.args << '--test'
|
692
|
+
agent.run
|
693
|
+
}.to exit_with(2)
|
694
|
+
.and output(a_string_matching(%r{Notice: Local environment: 'production' doesn't match server specified environment 'newenv', restarting agent run with environment 'newenv'})
|
695
|
+
.and matching(%r{defined 'message' as 'web'})).to_stdout
|
696
|
+
end
|
697
|
+
end
|
698
|
+
end
|
649
699
|
end
|
@@ -18,6 +18,11 @@ describe "puppet filebucket", unless: Puppet::Util::Platform.jruby? do
|
|
18
18
|
File.binwrite(backup_file, text)
|
19
19
|
end
|
20
20
|
|
21
|
+
after :each do
|
22
|
+
# mute debug messages generated during `after :each` blocks
|
23
|
+
Puppet::Util::Log.close_all
|
24
|
+
end
|
25
|
+
|
21
26
|
it "backs up to and restores from the local filebucket" do
|
22
27
|
filebucket.command_line.args = ['backup', backup_file, '--local']
|
23
28
|
expect {
|
@@ -60,7 +60,8 @@ describe Puppet::Configurer do
|
|
60
60
|
expect(summary["time"]["last_run"]).to be_between(t1, t2)
|
61
61
|
end
|
62
62
|
|
63
|
-
it "applies a cached catalog if pluginsync fails when usecacheonfailure is true" do
|
63
|
+
it "applies a cached catalog if pluginsync fails when usecacheonfailure is true and environment is valid" do
|
64
|
+
expect(@configurer).to receive(:valid_server_environment?).and_return(true)
|
64
65
|
Puppet[:ignore_plugin_errors] = false
|
65
66
|
|
66
67
|
Puppet[:use_cached_catalog] = false
|
@@ -74,6 +75,21 @@ describe Puppet::Configurer do
|
|
74
75
|
expect(report.cached_catalog_status).to eq('on_failure')
|
75
76
|
end
|
76
77
|
|
78
|
+
it "applies a cached catalog if pluginsync fails when usecacheonfailure is true and environment is invalid" do
|
79
|
+
expect(@configurer).to receive(:valid_server_environment?).and_return(false)
|
80
|
+
Puppet[:ignore_plugin_errors] = false
|
81
|
+
|
82
|
+
Puppet[:use_cached_catalog] = false
|
83
|
+
Puppet[:usecacheonfailure] = true
|
84
|
+
|
85
|
+
report = Puppet::Transaction::Report.new
|
86
|
+
expect(Puppet::Resource::Catalog.indirection).to receive(:find).and_raise(Puppet::Error, 'Cannot compile remote catalog')
|
87
|
+
expect(Puppet::Resource::Catalog.indirection).to receive(:find).and_return(@catalog)
|
88
|
+
|
89
|
+
@configurer.run(pluginsync: true, report: report)
|
90
|
+
expect(report.cached_catalog_status).to eq('on_failure')
|
91
|
+
end
|
92
|
+
|
77
93
|
describe 'resubmitting facts' do
|
78
94
|
context 'when resubmit_facts is set to false' do
|
79
95
|
it 'should not send data' do
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'compiler localization' do
|
4
|
+
include_context 'l10n', 'ja'
|
5
|
+
|
6
|
+
let(:envdir) { File.join(my_fixture_dir, '..', 'envs') }
|
7
|
+
let(:environments) do
|
8
|
+
Puppet::Environments::Cached.new(
|
9
|
+
Puppet::Environments::Directories.new(envdir, [])
|
10
|
+
)
|
11
|
+
end
|
12
|
+
let(:env) { Puppet::Node::Environment.create(:prod, [File.join(envdir, 'prod', 'modules')]) }
|
13
|
+
let(:node) { Puppet::Node.new('test', :environment => env) }
|
14
|
+
|
15
|
+
around(:each) do |example|
|
16
|
+
Puppet.override(current_environment: env,
|
17
|
+
loaders: Puppet::Pops::Loaders.new(env),
|
18
|
+
environments: environments) do
|
19
|
+
example.run
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'localizes strings in functions' do
|
24
|
+
Puppet[:code] = <<~END
|
25
|
+
notify { 'demo':
|
26
|
+
message => l10n()
|
27
|
+
}
|
28
|
+
END
|
29
|
+
|
30
|
+
Puppet::Resource::Catalog.indirection.terminus_class = :compiler
|
31
|
+
catalog = Puppet::Resource::Catalog.indirection.find(node.name)
|
32
|
+
resource = catalog.resource(:notify, 'demo')
|
33
|
+
|
34
|
+
expect(resource).to be
|
35
|
+
expect(resource[:message]).to eq("それは楽しい時間です")
|
36
|
+
end
|
37
|
+
end
|