puppet 6.19.0 → 6.22.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.
- checksums.yaml +4 -4
- data/CODEOWNERS +2 -16
- data/Gemfile +3 -1
- data/Gemfile.lock +50 -39
- data/ext/project_data.yaml +2 -2
- data/lib/puppet/application.rb +10 -6
- data/lib/puppet/application/agent.rb +1 -0
- data/lib/puppet/application/apply.rb +3 -2
- data/lib/puppet/application/device.rb +1 -0
- data/lib/puppet/application/filebucket.rb +2 -2
- data/lib/puppet/application/script.rb +1 -0
- data/lib/puppet/application/ssl.rb +11 -0
- data/lib/puppet/application_support.rb +7 -0
- data/lib/puppet/configurer.rb +28 -18
- data/lib/puppet/defaults.rb +46 -20
- data/lib/puppet/environments.rb +54 -55
- data/lib/puppet/face/config.rb +10 -0
- data/lib/puppet/face/epp.rb +12 -2
- data/lib/puppet/face/facts.rb +158 -0
- data/lib/puppet/ffi/posix.rb +10 -0
- data/lib/puppet/ffi/posix/constants.rb +14 -0
- data/lib/puppet/ffi/posix/functions.rb +24 -0
- data/lib/puppet/file_system/memory_file.rb +8 -1
- data/lib/puppet/file_system/windows.rb +2 -0
- data/lib/puppet/functions/epp.rb +1 -0
- data/lib/puppet/functions/inline_epp.rb +1 -0
- data/lib/puppet/functions/partition.rb +8 -0
- data/lib/puppet/indirector/fact_search.rb +60 -0
- data/lib/puppet/indirector/facts/facter.rb +24 -3
- data/lib/puppet/indirector/facts/json.rb +27 -0
- data/lib/puppet/indirector/facts/yaml.rb +3 -58
- data/lib/puppet/indirector/json.rb +5 -1
- data/lib/puppet/indirector/node/json.rb +8 -0
- data/lib/puppet/indirector/report/json.rb +34 -0
- data/lib/puppet/module_tool/applications/installer.rb +48 -2
- data/lib/puppet/module_tool/errors/shared.rb +17 -2
- data/lib/puppet/network/formats.rb +69 -1
- data/lib/puppet/network/http/factory.rb +4 -0
- data/lib/puppet/pal/pal_impl.rb +70 -17
- data/lib/puppet/parser/ast/leaf.rb +3 -2
- data/lib/puppet/parser/templatewrapper.rb +1 -1
- data/lib/puppet/pops/evaluator/deferred_resolver.rb +5 -3
- data/lib/puppet/pops/evaluator/evaluator_impl.rb +22 -3
- data/lib/puppet/pops/model/ast_transformer.rb +1 -1
- data/lib/puppet/property/list.rb +1 -1
- data/lib/puppet/provider/group/groupadd.rb +13 -8
- data/lib/puppet/provider/package/apt.rb +34 -2
- data/lib/puppet/provider/package/aptitude.rb +6 -0
- data/lib/puppet/provider/package/dnfmodule.rb +1 -1
- data/lib/puppet/provider/service/debian.rb +2 -0
- data/lib/puppet/provider/service/systemd.rb +1 -1
- data/lib/puppet/provider/user/aix.rb +2 -2
- data/lib/puppet/provider/user/useradd.rb +62 -8
- data/lib/puppet/reference/configuration.rb +6 -5
- data/lib/puppet/settings.rb +43 -15
- data/lib/puppet/settings/alias_setting.rb +37 -0
- data/lib/puppet/settings/base_setting.rb +26 -2
- data/lib/puppet/settings/environment_conf.rb +1 -0
- data/lib/puppet/type/package.rb +3 -3
- data/lib/puppet/util/autoload.rb +1 -8
- data/lib/puppet/util/fact_dif.rb +81 -0
- data/lib/puppet/util/monkey_patches.rb +7 -0
- data/lib/puppet/util/posix.rb +54 -5
- data/lib/puppet/util/rubygems.rb +5 -1
- data/lib/puppet/util/windows/adsi.rb +46 -0
- data/lib/puppet/util/windows/api_types.rb +1 -1
- data/lib/puppet/util/windows/principal.rb +9 -2
- data/lib/puppet/util/windows/service.rb +1 -1
- data/lib/puppet/util/windows/sid.rb +4 -2
- data/lib/puppet/version.rb +1 -1
- data/locales/puppet.pot +295 -219
- data/man/man5/puppet.conf.5 +15 -7
- data/man/man8/puppet-agent.8 +2 -2
- data/man/man8/puppet-apply.8 +2 -2
- 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 +2 -2
- data/man/man8/puppet-doc.8 +1 -1
- data/man/man8/puppet-epp.8 +1 -1
- data/man/man8/puppet-facts.8 +90 -1
- data/man/man8/puppet-filebucket.8 +3 -3
- 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-module.8 +1 -1
- data/man/man8/puppet-node.8 +4 -1
- data/man/man8/puppet-parser.8 +1 -1
- data/man/man8/puppet-plugin.8 +1 -1
- data/man/man8/puppet-report.8 +4 -1
- data/man/man8/puppet-resource.8 +1 -1
- data/man/man8/puppet-script.8 +2 -2
- data/man/man8/puppet-ssl.8 +5 -1
- data/man/man8/puppet-status.8 +1 -1
- data/man/man8/puppet.8 +2 -2
- data/spec/fixtures/integration/application/agent/cached_deferred_catalog.json +91 -0
- data/spec/fixtures/unit/provider/service/systemd/list_unit_files_services_vendor_preset +9 -0
- data/spec/fixtures/unit/provider/user/aix/aix_passwd_file.out +4 -0
- data/spec/integration/application/agent_spec.rb +160 -3
- data/spec/integration/application/apply_spec.rb +19 -0
- data/spec/integration/application/plugin_spec.rb +1 -1
- data/spec/integration/defaults_spec.rb +0 -7
- data/spec/integration/environments/setting_hooks_spec.rb +1 -1
- data/spec/integration/http/client_spec.rb +12 -0
- data/spec/integration/indirector/direct_file_server_spec.rb +1 -3
- data/spec/integration/resource/type_collection_spec.rb +2 -6
- data/spec/integration/transaction_spec.rb +4 -9
- data/spec/integration/util/windows/adsi_spec.rb +21 -1
- data/spec/integration/util/windows/principal_spec.rb +21 -0
- data/spec/integration/util/windows/registry_spec.rb +6 -10
- data/spec/lib/puppet_spec/settings.rb +6 -1
- data/spec/spec_helper.rb +12 -5
- data/spec/unit/agent_spec.rb +8 -6
- data/spec/unit/application/agent_spec.rb +0 -1
- data/spec/unit/application/config_spec.rb +224 -4
- data/spec/unit/application/facts_spec.rb +482 -3
- data/spec/unit/application/filebucket_spec.rb +0 -2
- data/spec/unit/application/ssl_spec.rb +23 -0
- data/spec/unit/application_spec.rb +51 -9
- data/spec/unit/confine/feature_spec.rb +1 -1
- data/spec/unit/confine_spec.rb +8 -2
- data/spec/unit/defaults_spec.rb +36 -1
- data/spec/unit/environments_spec.rb +221 -68
- data/spec/unit/face/config_spec.rb +27 -32
- data/spec/unit/face/facts_spec.rb +4 -0
- data/spec/unit/face/node_spec.rb +0 -11
- data/spec/unit/file_serving/configuration/parser_spec.rb +0 -1
- data/spec/unit/file_serving/metadata_spec.rb +3 -3
- data/spec/unit/file_serving/terminus_helper_spec.rb +11 -4
- data/spec/unit/file_system_spec.rb +9 -0
- data/spec/unit/forge/module_release_spec.rb +2 -7
- data/spec/unit/functions/inline_epp_spec.rb +26 -1
- data/spec/unit/http/service/compiler_spec.rb +49 -0
- data/spec/unit/http/service_spec.rb +1 -1
- data/spec/unit/indirector/face_spec.rb +0 -1
- data/spec/unit/indirector/facts/facter_spec.rb +95 -1
- data/spec/unit/indirector/facts/json_spec.rb +255 -0
- data/spec/unit/indirector/file_bucket_file/selector_spec.rb +26 -8
- data/spec/unit/indirector/indirection_spec.rb +8 -12
- data/spec/unit/indirector/key/file_spec.rb +0 -1
- data/spec/unit/indirector/node/json_spec.rb +33 -0
- data/spec/{integration/indirector/report/yaml.rb → unit/indirector/report/json_spec.rb} +13 -24
- data/spec/unit/indirector/report/yaml_spec.rb +72 -8
- data/spec/unit/indirector_spec.rb +2 -2
- data/spec/unit/module_tool/applications/installer_spec.rb +66 -0
- data/spec/unit/network/authconfig_spec.rb +0 -3
- data/spec/unit/network/formats_spec.rb +41 -0
- data/spec/unit/network/http/api/indirected_routes_spec.rb +0 -9
- data/spec/unit/network/http/factory_spec.rb +19 -0
- data/spec/unit/network/http/handler_spec.rb +0 -5
- data/spec/unit/parser/compiler_spec.rb +3 -19
- data/spec/unit/parser/resource_spec.rb +14 -8
- data/spec/unit/parser/templatewrapper_spec.rb +4 -3
- data/spec/unit/pops/evaluator/deferred_resolver_spec.rb +20 -0
- data/spec/unit/property_spec.rb +1 -0
- data/spec/unit/provider/group/groupadd_spec.rb +5 -2
- data/spec/unit/provider/nameservice_spec.rb +66 -65
- data/spec/unit/provider/package/apt_spec.rb +28 -23
- data/spec/unit/provider/package/aptitude_spec.rb +1 -1
- data/spec/unit/provider/package/base_spec.rb +6 -5
- data/spec/unit/provider/package/dnfmodule_spec.rb +10 -1
- data/spec/unit/provider/package/pacman_spec.rb +18 -12
- data/spec/unit/provider/package/pip_spec.rb +6 -11
- data/spec/unit/provider/package/pkgdmg_spec.rb +0 -4
- data/spec/unit/provider/service/systemd_spec.rb +11 -0
- data/spec/unit/provider/user/aix_spec.rb +5 -0
- data/spec/unit/provider/user/hpux_spec.rb +1 -1
- data/spec/unit/provider/user/pw_spec.rb +2 -0
- data/spec/unit/provider/user/useradd_spec.rb +71 -3
- data/spec/unit/provider_spec.rb +8 -10
- data/spec/unit/puppet_pal_catalog_spec.rb +45 -0
- data/spec/unit/resource/capability_finder_spec.rb +6 -1
- data/spec/unit/resource/catalog_spec.rb +1 -1
- data/spec/unit/resource/type_spec.rb +1 -1
- data/spec/unit/resource_spec.rb +11 -10
- data/spec/unit/settings_spec.rb +543 -228
- data/spec/unit/ssl/base_spec.rb +0 -1
- data/spec/unit/ssl/host_spec.rb +0 -5
- data/spec/unit/ssl/ssl_provider_spec.rb +14 -8
- data/spec/unit/transaction/additional_resource_generator_spec.rb +3 -7
- data/spec/unit/transaction/event_manager_spec.rb +14 -11
- data/spec/unit/transaction_spec.rb +13 -4
- data/spec/unit/type/file/content_spec.rb +0 -1
- data/spec/unit/type/file/selinux_spec.rb +0 -2
- data/spec/unit/type/file_spec.rb +0 -6
- data/spec/unit/type/group_spec.rb +13 -6
- data/spec/unit/type/resources_spec.rb +7 -7
- data/spec/unit/type/service_spec.rb +1 -1
- data/spec/unit/type/tidy_spec.rb +0 -1
- data/spec/unit/type_spec.rb +2 -2
- data/spec/unit/util/at_fork_spec.rb +2 -2
- data/spec/unit/util/autoload_spec.rb +5 -1
- data/spec/unit/util/backups_spec.rb +1 -2
- data/spec/unit/util/execution_spec.rb +15 -11
- data/spec/unit/util/inifile_spec.rb +6 -14
- data/spec/unit/util/log_spec.rb +8 -7
- data/spec/unit/util/logging_spec.rb +3 -3
- data/spec/unit/util/posix_spec.rb +363 -15
- data/spec/unit/util/rubygems_spec.rb +2 -2
- data/spec/unit/util/selinux_spec.rb +76 -52
- data/spec/unit/util/storage_spec.rb +3 -1
- data/spec/unit/util/suidmanager_spec.rb +44 -41
- data/spec/unit/util/windows/sid_spec.rb +6 -0
- data/spec/unit/util_spec.rb +13 -6
- metadata +23 -14
- data/spec/integration/application/config_spec.rb +0 -74
- data/spec/lib/matchers/include.rb +0 -27
- data/spec/lib/matchers/include_spec.rb +0 -32
- data/spec/unit/face/catalog_spec.rb +0 -6
- data/spec/unit/face/module_spec.rb +0 -3
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" "April 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" "April 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
|
@@ -34,7 +34,7 @@ Print this help message
|
|
34
34
|
.
|
35
35
|
.TP
|
36
36
|
\-\-logdest
|
37
|
-
Where to send log messages\. Choose between \'syslog\' (the POSIX syslog service), \'eventlog\' (the Windows Event Log), \'console\', or the path to a log file\. Defaults to \'console\'\.
|
37
|
+
Where to send log messages\. Choose between \'syslog\' (the POSIX syslog service), \'eventlog\' (the Windows Event Log), \'console\', or the path to a log file\. Defaults to \'console\'\. Multiple destinations can be set using a comma separated list (eg: \fB/path/file1,console,/path/file2\fR)"
|
38
38
|
.
|
39
39
|
.IP
|
40
40
|
A path ending with \'\.json\' will receive structured output in JSON format\. The log file will not have an ending \']\' automatically written to it due to the appending nature of logging\. It must be appended manually to make the content valid JSON\.
|
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" "April 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
|
@@ -52,4 +52,8 @@ Verify the private key and certificate are present and match, verify the certifi
|
|
52
52
|
.TP
|
53
53
|
clean
|
54
54
|
Remove the private key and certificate related files for this host\. If \fB\-\-localca\fR is specified, then also remove this host\'s local copy of the CA certificate(s) and CRL bundle\. if \fB\-\-target CERTNAME\fR is specified, then remove the files for the specified device on this host instead of this host\.
|
55
|
+
.
|
56
|
+
.TP
|
57
|
+
show
|
58
|
+
Print the full\-text version of this host\'s certificate\.
|
55
59
|
|
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" "April 2021" "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" "April 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 v6\.
|
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\.22\.0
|
@@ -0,0 +1,91 @@
|
|
1
|
+
{
|
2
|
+
"tags": [
|
3
|
+
"settings"
|
4
|
+
],
|
5
|
+
"name": "127.0.0.1",
|
6
|
+
"version": 1607629733,
|
7
|
+
"code_id": null,
|
8
|
+
"catalog_uuid": "afc8472a-306b-4b24-b060-e956dffb79b8",
|
9
|
+
"catalog_format": 1,
|
10
|
+
"environment": "production",
|
11
|
+
"resources": [
|
12
|
+
{
|
13
|
+
"type": "Stage",
|
14
|
+
"title": "main",
|
15
|
+
"tags": [
|
16
|
+
"stage"
|
17
|
+
],
|
18
|
+
"exported": false,
|
19
|
+
"parameters": {
|
20
|
+
"name": "main"
|
21
|
+
}
|
22
|
+
},
|
23
|
+
{
|
24
|
+
"type": "Class",
|
25
|
+
"title": "Settings",
|
26
|
+
"tags": [
|
27
|
+
"class",
|
28
|
+
"settings"
|
29
|
+
],
|
30
|
+
"exported": false
|
31
|
+
},
|
32
|
+
{
|
33
|
+
"type": "Class",
|
34
|
+
"title": "main",
|
35
|
+
"tags": [
|
36
|
+
"class"
|
37
|
+
],
|
38
|
+
"exported": false,
|
39
|
+
"parameters": {
|
40
|
+
"name": "main"
|
41
|
+
}
|
42
|
+
},
|
43
|
+
{
|
44
|
+
"type": "Notify",
|
45
|
+
"title": "deferred",
|
46
|
+
"tags": [
|
47
|
+
"notify",
|
48
|
+
"deferred",
|
49
|
+
"class"
|
50
|
+
],
|
51
|
+
"file": "",
|
52
|
+
"line": 1,
|
53
|
+
"exported": false,
|
54
|
+
"parameters": {
|
55
|
+
"message": {
|
56
|
+
"__ptype": "Deferred",
|
57
|
+
"name": "new",
|
58
|
+
"arguments": [
|
59
|
+
{
|
60
|
+
"__ptype": "Pcore::StringType"
|
61
|
+
},
|
62
|
+
{
|
63
|
+
"__ptype": "Deferred",
|
64
|
+
"name": "binary_file",
|
65
|
+
"arguments": [
|
66
|
+
"__SOURCE_PATH__"
|
67
|
+
]
|
68
|
+
}
|
69
|
+
]
|
70
|
+
}
|
71
|
+
}
|
72
|
+
}
|
73
|
+
],
|
74
|
+
"edges": [
|
75
|
+
{
|
76
|
+
"source": "Stage[main]",
|
77
|
+
"target": "Class[Settings]"
|
78
|
+
},
|
79
|
+
{
|
80
|
+
"source": "Stage[main]",
|
81
|
+
"target": "Class[main]"
|
82
|
+
},
|
83
|
+
{
|
84
|
+
"source": "Class[main]",
|
85
|
+
"target": "Notify[deferred]"
|
86
|
+
}
|
87
|
+
],
|
88
|
+
"classes": [
|
89
|
+
"settings"
|
90
|
+
]
|
91
|
+
}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
UNIT FILE STATE VENDOR PRESET
|
2
|
+
arp-ethers.service disabled disabled
|
3
|
+
auditd.service enabled enabled
|
4
|
+
dbus.service enabled disabled
|
5
|
+
udev.service enabled-runtime disabled
|
6
|
+
umountfs.service linked-runtime disabled
|
7
|
+
umountnfs.service masked disabled
|
8
|
+
umountroot.service masked-runtime disabled
|
9
|
+
urandom.service indirect enabled
|
@@ -100,10 +100,10 @@ describe "puppet agent", unless: Puppet::Util::Platform.jruby? do
|
|
100
100
|
end
|
101
101
|
|
102
102
|
context 'rich data' do
|
103
|
-
it "
|
103
|
+
it "calls a deferred 4x function" do
|
104
104
|
catalog_handler = -> (req, res) {
|
105
105
|
catalog = compile_to_catalog(<<-MANIFEST, node)
|
106
|
-
notify { '
|
106
|
+
notify { 'deferred4x':
|
107
107
|
message => Deferred('join', [[1,2,3], ':'])
|
108
108
|
}
|
109
109
|
MANIFEST
|
@@ -118,7 +118,66 @@ describe "puppet agent", unless: Puppet::Util::Platform.jruby? do
|
|
118
118
|
agent.command_line.args << '--test'
|
119
119
|
agent.run
|
120
120
|
}.to exit_with(2)
|
121
|
-
.and output(%r{Notice: /Stage\[main\]/Main/Notify\[
|
121
|
+
.and output(%r{Notice: /Stage\[main\]/Main/Notify\[deferred4x\]/message: defined 'message' as '1:2:3'}).to_stdout
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
it "calls a deferred 3x function" do
|
126
|
+
catalog_handler = -> (req, res) {
|
127
|
+
catalog = compile_to_catalog(<<-MANIFEST, node)
|
128
|
+
notify { 'deferred3x':
|
129
|
+
message => Deferred('sprintf', ['%s', 'I am deferred'])
|
130
|
+
}
|
131
|
+
MANIFEST
|
132
|
+
|
133
|
+
res.body = formatter.render(catalog)
|
134
|
+
res['Content-Type'] = formatter.mime
|
135
|
+
}
|
136
|
+
|
137
|
+
server.start_server(mounts: {catalog: catalog_handler}) do |port|
|
138
|
+
Puppet[:serverport] = port
|
139
|
+
expect {
|
140
|
+
agent.command_line.args << '--test'
|
141
|
+
agent.run
|
142
|
+
}.to exit_with(2)
|
143
|
+
.and output(%r{Notice: /Stage\[main\]/Main/Notify\[deferred3x\]/message: defined 'message' as 'I am deferred'}).to_stdout
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
it "re-evaluates a deferred function in a cached catalog" do
|
148
|
+
Puppet[:report] = false
|
149
|
+
Puppet[:use_cached_catalog] = true
|
150
|
+
Puppet[:usecacheonfailure] = false
|
151
|
+
|
152
|
+
catalog_dir = File.join(Puppet[:client_datadir], 'catalog')
|
153
|
+
Puppet::FileSystem.mkpath(catalog_dir)
|
154
|
+
cached_catalog_path = "#{File.join(catalog_dir, Puppet[:certname])}.json"
|
155
|
+
|
156
|
+
# our catalog contains a deferred function that calls `binary_file`
|
157
|
+
# to read `source`. The function returns a Binary object, whose
|
158
|
+
# base64 value is printed to stdout
|
159
|
+
source = tmpfile('deferred_source')
|
160
|
+
catalog = File.read(my_fixture('cached_deferred_catalog.json'))
|
161
|
+
catalog.gsub!('__SOURCE_PATH__', source)
|
162
|
+
File.write(cached_catalog_path, catalog)
|
163
|
+
|
164
|
+
# verify we get a different result each time the deferred function
|
165
|
+
# is evaluated, and reads `source`.
|
166
|
+
{
|
167
|
+
'1234' => 'MTIzNA==',
|
168
|
+
'5678' => 'NTY3OA=='
|
169
|
+
}.each_pair do |content, base64|
|
170
|
+
File.write(source, content)
|
171
|
+
|
172
|
+
expect {
|
173
|
+
agent.command_line.args << '-t'
|
174
|
+
agent.run
|
175
|
+
|
176
|
+
}.to exit_with(2)
|
177
|
+
.and output(/Notice: #{base64}/).to_stdout
|
178
|
+
|
179
|
+
# reset state so we can run again
|
180
|
+
Puppet::Application.clear!
|
122
181
|
end
|
123
182
|
end
|
124
183
|
|
@@ -476,4 +535,102 @@ describe "puppet agent", unless: Puppet::Util::Platform.jruby? do
|
|
476
535
|
th.kill # kill thread so we don't wait too much
|
477
536
|
end
|
478
537
|
end
|
538
|
+
|
539
|
+
context 'cached catalogs' do
|
540
|
+
it 'falls back to a cached catalog' do
|
541
|
+
catalog_handler = -> (req, res) {
|
542
|
+
catalog = compile_to_catalog(<<-MANIFEST, node)
|
543
|
+
notify { 'a message': }
|
544
|
+
MANIFEST
|
545
|
+
|
546
|
+
res.body = formatter.render(catalog)
|
547
|
+
res['Content-Type'] = formatter.mime
|
548
|
+
}
|
549
|
+
|
550
|
+
server.start_server(mounts: {catalog: catalog_handler}) do |port|
|
551
|
+
Puppet[:serverport] = port
|
552
|
+
expect {
|
553
|
+
agent.command_line.args << '--test'
|
554
|
+
agent.run
|
555
|
+
}.to exit_with(2)
|
556
|
+
.and output(%r{Caching catalog for #{Puppet[:certname]}}).to_stdout
|
557
|
+
end
|
558
|
+
|
559
|
+
# reset state so we can run again
|
560
|
+
Puppet::Application.clear!
|
561
|
+
|
562
|
+
# --test above turns off `usecacheonfailure` so re-enable here
|
563
|
+
Puppet[:usecacheonfailure] = true
|
564
|
+
|
565
|
+
# run agent without server
|
566
|
+
expect {
|
567
|
+
agent.command_line.args << '--no-daemonize' << '--onetime' << '--server' << '127.0.0.1'
|
568
|
+
agent.run
|
569
|
+
}.to exit_with(2)
|
570
|
+
.and output(a_string_matching(
|
571
|
+
/Using cached catalog from environment 'production'/
|
572
|
+
).and matching(
|
573
|
+
/Notify\[a message\]\/message:/
|
574
|
+
)).to_stdout
|
575
|
+
.and output(/the agent run will continue/).to_stderr
|
576
|
+
end
|
577
|
+
|
578
|
+
it 'preserves the old cached catalog if validation fails with the old one' do
|
579
|
+
catalog_handler = -> (req, res) {
|
580
|
+
catalog = compile_to_catalog(<<-MANIFEST, node)
|
581
|
+
exec { 'unqualified_command': }
|
582
|
+
MANIFEST
|
583
|
+
|
584
|
+
res.body = formatter.render(catalog)
|
585
|
+
res['Content-Type'] = formatter.mime
|
586
|
+
}
|
587
|
+
|
588
|
+
server.start_server(mounts: {catalog: catalog_handler}) do |port|
|
589
|
+
Puppet[:serverport] = port
|
590
|
+
expect {
|
591
|
+
agent.command_line.args << '--test'
|
592
|
+
agent.run
|
593
|
+
}.to exit_with(1)
|
594
|
+
.and output(/Using configured environment/).to_stdout
|
595
|
+
.and output(%r{Validation of Exec\[unqualified_command\] failed: 'unqualified_command' is not qualified and no path was specified}).to_stderr
|
596
|
+
end
|
597
|
+
|
598
|
+
# cached catalog should not be updated
|
599
|
+
cached_catalog = "#{File.join(Puppet[:client_datadir], 'catalog', Puppet[:certname])}.json"
|
600
|
+
expect(File).to_not be_exist(cached_catalog)
|
601
|
+
end
|
602
|
+
end
|
603
|
+
|
604
|
+
context "reporting" do
|
605
|
+
it "stores a finalized report" do
|
606
|
+
catalog_handler = -> (req, res) {
|
607
|
+
catalog = compile_to_catalog(<<-MANIFEST, node)
|
608
|
+
notify { 'foo':
|
609
|
+
require => Notify['bar']
|
610
|
+
}
|
611
|
+
|
612
|
+
notify { 'bar':
|
613
|
+
require => Notify['foo']
|
614
|
+
}
|
615
|
+
MANIFEST
|
616
|
+
|
617
|
+
res.body = formatter.render(catalog)
|
618
|
+
res['Content-Type'] = formatter.mime
|
619
|
+
}
|
620
|
+
|
621
|
+
server.start_server(mounts: {catalog: catalog_handler}) do |port|
|
622
|
+
Puppet[:serverport] = port
|
623
|
+
expect {
|
624
|
+
agent.command_line.args << '--test'
|
625
|
+
agent.run
|
626
|
+
}.to exit_with(1)
|
627
|
+
.and output(%r{Applying configuration}).to_stdout
|
628
|
+
.and output(%r{Found 1 dependency cycle}).to_stderr
|
629
|
+
|
630
|
+
report = Puppet::Transaction::Report.convert_from(:yaml, File.read(Puppet[:lastrunreport]))
|
631
|
+
expect(report.status).to eq("failed")
|
632
|
+
expect(report.metrics).to_not be_empty
|
633
|
+
end
|
634
|
+
end
|
635
|
+
end
|
479
636
|
end
|
@@ -663,4 +663,23 @@ class amod::bad_type {
|
|
663
663
|
end
|
664
664
|
end
|
665
665
|
end
|
666
|
+
|
667
|
+
context 'rich data' do
|
668
|
+
it "calls a deferred 4x function" do
|
669
|
+
apply.command_line.args = ['-e', 'notify { "deferred3x": message => Deferred("join", [[1,2,3], ":"]) }']
|
670
|
+
|
671
|
+
expect {
|
672
|
+
apply.run
|
673
|
+
}.to exit_with(0) # for some reason apply returns 0 instead of 2
|
674
|
+
.and output(%r{Notice: /Stage\[main\]/Main/Notify\[deferred3x\]/message: defined 'message' as '1:2:3'}).to_stdout
|
675
|
+
end
|
676
|
+
|
677
|
+
it "calls a deferred 3x function" do
|
678
|
+
apply.command_line.args = ['-e', 'notify { "deferred4x": message => Deferred("sprintf", ["%s", "I am deferred"]) }']
|
679
|
+
expect {
|
680
|
+
apply.run
|
681
|
+
}.to exit_with(0) # for some reason apply returns 0 instead of 2
|
682
|
+
.and output(%r{Notice: /Stage\[main\]/Main/Notify\[deferred4x\]/message: defined 'message' as 'I am deferred'}).to_stdout
|
683
|
+
end
|
684
|
+
end
|
666
685
|
end
|
@@ -36,13 +36,6 @@ describe "Puppet defaults" do
|
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
-
describe "when setting the :serverport" do
|
40
|
-
it "should also set the :masterport to the same value" do
|
41
|
-
Puppet.settings[:serverport] = 9000
|
42
|
-
expect(Puppet.settings[:masterport]).to eq(9000)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
39
|
describe "when setting the :factpath" do
|
47
40
|
it "should add the :factpath to Facter's search paths" do
|
48
41
|
expect(Facter).to receive(:search).with("/my/fact/path")
|
@@ -12,7 +12,7 @@ describe "setting hooks" do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
it "accesses correct directory environment settings after initializing a setting with an on_write hook" do
|
15
|
-
expect(Puppet.settings.setting(:
|
15
|
+
expect(Puppet.settings.setting(:strict).call_hook).to eq(:on_write_only)
|
16
16
|
|
17
17
|
File.open(File.join(confdir, "puppet.conf"), "w:UTF-8") do |f|
|
18
18
|
f.puts("environmentpath=#{environmentpath}")
|
@@ -151,4 +151,16 @@ describe Puppet::HTTP::Client, unless: Puppet::Util::Platform.jruby? do
|
|
151
151
|
end
|
152
152
|
end
|
153
153
|
end
|
154
|
+
|
155
|
+
context 'ciphersuites' do
|
156
|
+
it "does not connect when using an SSLv3 ciphersuite", :if => Puppet::Util::Package.versioncmp(OpenSSL::OPENSSL_LIBRARY_VERSION.split[1], '1.1.1e') > 0 do
|
157
|
+
Puppet[:ciphers] = "DES-CBC3-SHA"
|
158
|
+
|
159
|
+
https_server.start_server do |port|
|
160
|
+
expect {
|
161
|
+
client.get(URI("https://127.0.0.1:#{port}"), options: {ssl_context: root_context})
|
162
|
+
}.to raise_error(Puppet::HTTP::ConnectionError, /no cipher match|sslv3 alert handshake failure/)
|
163
|
+
end
|
164
|
+
end
|
165
|
+
end
|
154
166
|
end
|