puppet 7.9.0-x86-mingw32 → 7.10.0-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.

Files changed (182) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +6 -6
  3. data/{ext → examples/enc}/regexp_nodes/classes/databases +0 -0
  4. data/{ext → examples/enc}/regexp_nodes/classes/webservers +0 -0
  5. data/{ext → examples/enc}/regexp_nodes/environment/development +0 -0
  6. data/{ext → examples/enc}/regexp_nodes/parameters/service/prod +0 -0
  7. data/{ext → examples/enc}/regexp_nodes/parameters/service/qa +0 -0
  8. data/{ext → examples/enc}/regexp_nodes/parameters/service/sandbox +0 -0
  9. data/{ext → examples/enc}/regexp_nodes/regexp_nodes.rb +0 -0
  10. data/{ext → examples}/nagios/check_puppet.rb +2 -2
  11. data/ext/README.md +13 -0
  12. data/lib/puppet/configurer.rb +155 -46
  13. data/lib/puppet/defaults.rb +51 -26
  14. data/lib/puppet/environments.rb +66 -26
  15. data/lib/puppet/file_serving/configuration.rb +2 -0
  16. data/lib/puppet/file_serving/configuration/parser.rb +2 -0
  17. data/lib/puppet/file_serving/mount/scripts.rb +24 -0
  18. data/lib/puppet/functions/find_template.rb +2 -2
  19. data/lib/puppet/http/service/compiler.rb +6 -1
  20. data/lib/puppet/indirector/catalog/compiler.rb +21 -3
  21. data/lib/puppet/indirector/catalog/rest.rb +1 -0
  22. data/lib/puppet/indirector/terminus.rb +4 -0
  23. data/lib/puppet/module/plan.rb +0 -1
  24. data/lib/puppet/module/task.rb +1 -1
  25. data/lib/puppet/module_tool/applications/installer.rb +8 -4
  26. data/lib/puppet/network/http/api/indirected_routes.rb +1 -1
  27. data/lib/puppet/node/environment.rb +10 -11
  28. data/lib/puppet/pops/serialization/to_data_converter.rb +18 -6
  29. data/lib/puppet/provider/package/pkg.rb +8 -1
  30. data/lib/puppet/provider/service/launchd.rb +1 -1
  31. data/lib/puppet/provider/service/systemd.rb +1 -1
  32. data/lib/puppet/provider/user/useradd.rb +42 -9
  33. data/lib/puppet/transaction/persistence.rb +11 -1
  34. data/lib/puppet/transaction/report.rb +15 -1
  35. data/lib/puppet/type.rb +1 -1
  36. data/lib/puppet/type/exec.rb +10 -1
  37. data/lib/puppet/type/file.rb +6 -6
  38. data/lib/puppet/type/filebucket.rb +2 -2
  39. data/lib/puppet/version.rb +1 -1
  40. data/locales/puppet.pot +134 -94
  41. data/man/man5/puppet.conf.5 +65 -25
  42. data/man/man8/puppet-agent.8 +1 -1
  43. data/man/man8/puppet-apply.8 +1 -1
  44. data/man/man8/puppet-catalog.8 +1 -1
  45. data/man/man8/puppet-config.8 +1 -1
  46. data/man/man8/puppet-describe.8 +1 -1
  47. data/man/man8/puppet-device.8 +1 -1
  48. data/man/man8/puppet-doc.8 +1 -1
  49. data/man/man8/puppet-epp.8 +1 -1
  50. data/man/man8/puppet-facts.8 +1 -1
  51. data/man/man8/puppet-filebucket.8 +1 -1
  52. data/man/man8/puppet-generate.8 +1 -1
  53. data/man/man8/puppet-help.8 +1 -1
  54. data/man/man8/puppet-lookup.8 +1 -1
  55. data/man/man8/puppet-module.8 +3 -3
  56. data/man/man8/puppet-node.8 +1 -1
  57. data/man/man8/puppet-parser.8 +1 -1
  58. data/man/man8/puppet-plugin.8 +1 -1
  59. data/man/man8/puppet-report.8 +1 -1
  60. data/man/man8/puppet-resource.8 +1 -1
  61. data/man/man8/puppet-script.8 +1 -1
  62. data/man/man8/puppet-ssl.8 +1 -1
  63. data/man/man8/puppet.8 +2 -2
  64. data/spec/fixtures/integration/application/agent/lib/facter/agent_spec_role.rb +3 -0
  65. data/spec/fixtures/integration/l10n/envs/prod/modules/demo/Gemfile +4 -0
  66. data/spec/fixtures/integration/l10n/envs/prod/modules/demo/Rakefile +3 -0
  67. data/spec/fixtures/integration/l10n/envs/prod/modules/demo/lib/puppet/functions/l10n.rb +8 -0
  68. data/spec/fixtures/integration/l10n/envs/prod/modules/demo/locales/config.yaml +25 -0
  69. data/spec/fixtures/integration/l10n/envs/prod/modules/demo/locales/ja/puppet-l10n.po +19 -0
  70. data/spec/fixtures/integration/l10n/envs/prod/modules/demo/locales/puppet-l10n.pot +20 -0
  71. data/spec/fixtures/integration/l10n/envs/prod/modules/demo/metadata.json +8 -0
  72. data/spec/integration/application/agent_spec.rb +102 -52
  73. data/spec/integration/application/filebucket_spec.rb +5 -0
  74. data/spec/integration/configurer_spec.rb +17 -1
  75. data/spec/integration/l10n/compiler_spec.rb +37 -0
  76. data/spec/lib/puppet_spec/modules.rb +13 -2
  77. data/spec/lib/puppet_spec/puppetserver.rb +15 -0
  78. data/spec/shared_behaviours/documentation_on_faces.rb +0 -2
  79. data/spec/shared_contexts/l10n.rb +27 -0
  80. data/spec/spec_helper.rb +1 -10
  81. data/spec/unit/configurer_spec.rb +265 -54
  82. data/spec/unit/environments_spec.rb +150 -1
  83. data/spec/unit/file_serving/configuration/parser_spec.rb +23 -0
  84. data/spec/unit/file_serving/configuration_spec.rb +12 -4
  85. data/spec/unit/file_serving/mount/scripts_spec.rb +69 -0
  86. data/spec/unit/functions/logging_spec.rb +1 -0
  87. data/spec/unit/http/service/compiler_spec.rb +8 -0
  88. data/spec/unit/indirector/catalog/compiler_spec.rb +87 -0
  89. data/spec/unit/indirector/catalog/rest_spec.rb +8 -0
  90. data/spec/unit/interface/action_spec.rb +0 -9
  91. data/spec/unit/module_spec.rb +14 -0
  92. data/spec/unit/module_tool/applications/installer_spec.rb +39 -12
  93. data/spec/unit/pops/parser/parse_containers_spec.rb +0 -11
  94. data/spec/unit/pops/serialization/to_from_hr_spec.rb +58 -0
  95. data/spec/unit/provider/package/pkg_spec.rb +19 -5
  96. data/spec/unit/provider/service/launchd_spec.rb +11 -0
  97. data/spec/unit/provider/service/systemd_spec.rb +1 -1
  98. data/spec/unit/provider/user/useradd_spec.rb +3 -2
  99. metadata +34 -94
  100. data/ext/README.environment +0 -8
  101. data/ext/dbfix.sql +0 -132
  102. data/ext/debian/README.Debian +0 -8
  103. data/ext/debian/README.source +0 -2
  104. data/ext/debian/TODO.Debian +0 -1
  105. data/ext/debian/changelog.erb +0 -1122
  106. data/ext/debian/compat +0 -1
  107. data/ext/debian/control +0 -144
  108. data/ext/debian/copyright +0 -339
  109. data/ext/debian/docs +0 -1
  110. data/ext/debian/fileserver.conf +0 -41
  111. data/ext/debian/puppet-common.dirs +0 -13
  112. data/ext/debian/puppet-common.install +0 -3
  113. data/ext/debian/puppet-common.lintian-overrides +0 -5
  114. data/ext/debian/puppet-common.manpages +0 -28
  115. data/ext/debian/puppet-common.postinst +0 -35
  116. data/ext/debian/puppet-common.postrm +0 -33
  117. data/ext/debian/puppet-el.dirs +0 -1
  118. data/ext/debian/puppet-el.emacsen-install +0 -25
  119. data/ext/debian/puppet-el.emacsen-remove +0 -11
  120. data/ext/debian/puppet-el.emacsen-startup +0 -9
  121. data/ext/debian/puppet-el.install +0 -1
  122. data/ext/debian/puppet-testsuite.install +0 -2
  123. data/ext/debian/puppet-testsuite.lintian-overrides +0 -4
  124. data/ext/debian/puppet.lintian-overrides +0 -3
  125. data/ext/debian/puppet.logrotate +0 -20
  126. data/ext/debian/puppet.postinst +0 -20
  127. data/ext/debian/puppet.postrm +0 -20
  128. data/ext/debian/puppet.preinst +0 -20
  129. data/ext/debian/puppetmaster-common.install +0 -2
  130. data/ext/debian/puppetmaster-common.manpages +0 -2
  131. data/ext/debian/puppetmaster-common.postinst +0 -6
  132. data/ext/debian/puppetmaster-passenger.dirs +0 -4
  133. data/ext/debian/puppetmaster-passenger.postinst +0 -162
  134. data/ext/debian/puppetmaster-passenger.postrm +0 -61
  135. data/ext/debian/puppetmaster.README.debian +0 -17
  136. data/ext/debian/puppetmaster.default +0 -14
  137. data/ext/debian/puppetmaster.init +0 -137
  138. data/ext/debian/puppetmaster.lintian-overrides +0 -3
  139. data/ext/debian/puppetmaster.postinst +0 -20
  140. data/ext/debian/puppetmaster.postrm +0 -5
  141. data/ext/debian/puppetmaster.preinst +0 -22
  142. data/ext/debian/rules +0 -132
  143. data/ext/debian/source/format +0 -1
  144. data/ext/debian/source/options +0 -1
  145. data/ext/debian/vim-puppet.README.Debian +0 -13
  146. data/ext/debian/vim-puppet.dirs +0 -5
  147. data/ext/debian/vim-puppet.yaml +0 -7
  148. data/ext/debian/watch +0 -2
  149. data/ext/freebsd/puppetd +0 -26
  150. data/ext/freebsd/puppetmasterd +0 -26
  151. data/ext/gentoo/conf.d/puppet +0 -5
  152. data/ext/gentoo/conf.d/puppetmaster +0 -12
  153. data/ext/gentoo/init.d/puppet +0 -38
  154. data/ext/gentoo/init.d/puppetmaster +0 -51
  155. data/ext/gentoo/puppet/fileserver.conf +0 -41
  156. data/ext/ips/puppet-agent +0 -44
  157. data/ext/ips/puppet-master +0 -44
  158. data/ext/ips/puppet.p5m.erb +0 -12
  159. data/ext/ips/puppetagent.xml +0 -42
  160. data/ext/ips/puppetmaster.xml +0 -42
  161. data/ext/ips/rules +0 -19
  162. data/ext/ips/transforms +0 -34
  163. data/ext/ldap/puppet.schema +0 -24
  164. data/ext/logcheck/puppet +0 -23
  165. data/ext/osx/file_mapping.yaml +0 -28
  166. data/ext/osx/postflight.erb +0 -109
  167. data/ext/osx/preflight.erb +0 -52
  168. data/ext/osx/prototype.plist.erb +0 -38
  169. data/ext/redhat/fileserver.conf +0 -41
  170. data/ext/redhat/logrotate +0 -21
  171. data/ext/redhat/puppet.spec.erb +0 -841
  172. data/ext/redhat/server.init +0 -128
  173. data/ext/redhat/server.sysconfig +0 -13
  174. data/ext/solaris/pkginfo +0 -6
  175. data/ext/solaris/smf/puppetd.xml +0 -77
  176. data/ext/solaris/smf/puppetmasterd.xml +0 -77
  177. data/ext/solaris/smf/svc-puppetd +0 -71
  178. data/ext/solaris/smf/svc-puppetmasterd +0 -67
  179. data/ext/suse/puppet.spec +0 -310
  180. data/ext/suse/server.init +0 -173
  181. data/ext/yaml_nodes.rb +0 -105
  182. data/spec/unit/indirector/store_configs_spec.rb +0 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b425ff8c53d49f85df8de6d3d471a6b0522ed256b28064d692b1ebbf89437926
4
- data.tar.gz: 5f7335ab98f2de90fb014222a19e52c4ba6567c8afced5bae1e64aba1e84dd30
3
+ metadata.gz: 20b023930a13e00c408aa8e4ac8d76845ed066c8aebc13064b30e65543e92e10
4
+ data.tar.gz: 7943ad8710ee392c6be91e9322a19231bcd9eba8869d23b816c7c9a13301cd2b
5
5
  SHA512:
6
- metadata.gz: 15c88bebf85ac6e40347147240602b54d01b3d7806c6a863517f5601f0adce826ff097948a0050a48d6f5d9d317ef29967fc3b8b8b0138777b0621d14a310201
7
- data.tar.gz: e95cd4700370c9a046903b431713ab8251e2ab748fe3d0d11eb6b13ead39075d08df0e3fff8f5e6e6519355fed24cde70df16bd6b92073cff1ee03571e2d0011
6
+ metadata.gz: 371dbcf8fefac57ca259eb1ff8b63bf30f6792de177df0296c748ea56ed52a422d8270b4a85c1260cd1007ea96839bff6bf64861fa52c580509229bc787073ea
7
+ data.tar.gz: 6339f75b96125a8d1b2357c7f38d42daf26b1423af87fe89f413d6f3ed6d9bc3f67c409598dcc3b4031cf513ad156c36cc0f598c6d82d70969f4a34e858ff859
data/Gemfile.lock CHANGED
@@ -1,9 +1,9 @@
1
1
  GIT
2
2
  remote: git://github.com/puppetlabs/packaging
3
- revision: 4d6d51947f44bfa2fc282658836c15f69672e757
3
+ revision: 804ad19a32455079917eaabd73fcec65078e8cee
4
4
  branch: 1.0.x
5
5
  specs:
6
- packaging (0.99.78.4.g4d6d519)
6
+ packaging (0.99.79.2.g804ad19)
7
7
  artifactory (~> 2)
8
8
  csv (= 3.1.5)
9
9
  rake (>= 12.3)
@@ -12,7 +12,7 @@ GIT
12
12
  PATH
13
13
  remote: .
14
14
  specs:
15
- puppet (7.9.0)
15
+ puppet (7.10.0)
16
16
  CFPropertyList (~> 2.2)
17
17
  concurrent-ruby (~> 1.0)
18
18
  deep_merge (~> 1.0)
@@ -80,7 +80,7 @@ GEM
80
80
  public_suffix (4.0.6)
81
81
  puppet-resource_api (1.8.14)
82
82
  hocon (>= 1.0)
83
- puppetserver-ca (2.2.0)
83
+ puppetserver-ca (2.3.1)
84
84
  facter (>= 2.0.1, < 5)
85
85
  racc (1.4.9)
86
86
  rainbow (2.2.2)
@@ -129,8 +129,8 @@ GEM
129
129
  thor (1.1.0)
130
130
  unicode-display_width (1.7.0)
131
131
  vcr (5.1.0)
132
- webmock (3.13.0)
133
- addressable (>= 2.3.6)
132
+ webmock (3.14.0)
133
+ addressable (>= 2.8.0)
134
134
  crack (>= 0.3.2)
135
135
  hashdiff (>= 0.4.0, < 2.0.0)
136
136
  yard (0.9.26)
File without changes
@@ -11,8 +11,8 @@ class CheckPuppet
11
11
 
12
12
  # default options
13
13
  OPTIONS = {
14
- :statefile => "/var/lib/puppet/state/state.yaml",
15
- :process => "puppetd",
14
+ :statefile => "/opt/puppetlabs/puppet/cache/state/state.yaml",
15
+ :process => "puppet",
16
16
  :interval => 30,
17
17
  }
18
18
 
data/ext/README.md ADDED
@@ -0,0 +1,13 @@
1
+ # `ext/` directory details
2
+ This directory contains files used internally when packaging [puppet](https://github.com/puppetlabs/puppet) and [puppet-agent](https://github.com/puppetlabs/puppet-agent)
3
+ What follows is a more detailed description of each directory/file:
4
+ * `debian/` - init scripts for puppet (used for Debian-based platforms that do not support systemd)
5
+ * `hiera/hiera.yaml` - installed to `$codedir/environments/production`as a default Hiera configuration file
6
+ * `osx/puppet.plist` - puppet launchd plist for macOS
7
+ * `redhat/` - init scripts for puppet (used for EL-based platforms that do not support systemd)
8
+ * `solaris/smf/` - service manifests for Solaris 11
9
+ * `suse/client.init` - init script for puppet (used for SUSE-based platforms that do not support systemd)
10
+ * `systemd/puppet.service` - systemd unit file for puppet
11
+ * `windows/` - the puppet daemon for Windows, and other useful `.bat` helper wrappers
12
+ * `build_defaults.yaml` - information pertaining to the puppetlabs build automation
13
+ * `project_data.yaml` - information used when packaging the puppet gem
@@ -91,7 +91,7 @@ class Puppet::Configurer
91
91
 
92
92
  if result
93
93
  # don't use use cached catalog if it doesn't match server specified environment
94
- if @node_environment && result.environment != @environment
94
+ if result.environment != @environment
95
95
  Puppet.err _("Not using cached catalog because its environment '%{catalog_env}' does not match '%{local_env}'") % { catalog_env: result.environment, local_env: @environment }
96
96
  return nil
97
97
  end
@@ -126,6 +126,94 @@ class Puppet::Configurer
126
126
  catalog
127
127
  end
128
128
 
129
+ def warn_number_of_facts(size, max_number)
130
+ Puppet.warning _("The current total number of facts: %{size} exceeds the number of facts limit: %{max_size}") % { size: size, max_size: max_number }
131
+ end
132
+
133
+ def warn_fact_name_length(name, max_length)
134
+ Puppet.warning _("Fact %{name} with length: '%{length}' exceeds the length limit: %{limit}") % { name: name, length: name.to_s.bytesize, limit: max_length }
135
+ end
136
+
137
+ def warn_number_of_top_level_facts(size, max_number)
138
+ Puppet.warning _("The current number of top level facts: %{size} exceeds the top facts limit: %{max_size}") % { size: size, max_size: max_number }
139
+ end
140
+
141
+ def warn_fact_value_length(value, max_length)
142
+ Puppet.warning _("Fact value '%{value}' with the value length: '%{length}' exceeds the value length limit: %{max_length}") % { value: value, length:value.to_s.bytesize, max_length: max_length }
143
+ end
144
+
145
+ def warn_fact_payload_size(payload, max_size)
146
+ Puppet.warning _("Payload with the current size of: '%{payload}' exceeds the payload size limit: %{max_size}") % { payload: payload, max_size: max_size }
147
+ end
148
+
149
+ def check_fact_name_length(name, number_of_dots)
150
+ max_length = Puppet[:fact_name_length_soft_limit]
151
+ return if max_length.zero?
152
+
153
+ # rough byte size estimations of fact path as a postgresql btree index
154
+ size_as_btree_index = 8 + (number_of_dots * 2) + name.to_s.bytesize
155
+ warn_fact_name_length(name, max_length) if size_as_btree_index > max_length
156
+ end
157
+
158
+ def check_fact_values_length(values)
159
+ max_length = Puppet[:fact_value_length_soft_limit]
160
+ return if max_length.zero?
161
+
162
+ warn_fact_value_length(values, max_length) if values.to_s.bytesize > max_length
163
+ end
164
+
165
+ def check_top_level_number_limit(size)
166
+ max_size = Puppet[:top_level_facts_soft_limit]
167
+ return if max_size.zero?
168
+
169
+ warn_number_of_top_level_facts(size, max_size) if size > max_size
170
+ end
171
+
172
+ def check_total_number_limit(size)
173
+ max_size = Puppet[:number_of_facts_soft_limit]
174
+ return if max_size.zero?
175
+
176
+ warn_number_of_facts(size, max_size) if size > max_size
177
+ end
178
+
179
+ def check_payload_size(payload)
180
+ max_size = Puppet[:payload_soft_limit]
181
+ return if max_size.zero?
182
+
183
+ warn_fact_payload_size(payload, max_size) if payload > max_size
184
+ Puppet.debug _("The size of the payload is %{payload}") % {payload: payload}
185
+ end
186
+
187
+ def parse_fact_name_and_value_limits(object, path = [])
188
+ case object
189
+ when Hash
190
+ object.each do |key, value|
191
+ path.push(key)
192
+ parse_fact_name_and_value_limits(value, path)
193
+ path.pop
194
+ @number_of_facts += 1
195
+ end
196
+ when Array
197
+ object.each_with_index do |e, idx|
198
+ path.push(idx)
199
+ parse_fact_name_and_value_limits(e, path)
200
+ path.pop
201
+ end
202
+ else
203
+ check_fact_name_length(path.join(), path.size)
204
+ check_fact_values_length(object)
205
+ end
206
+ end
207
+
208
+ def check_facts_limits(facts)
209
+ @number_of_facts = 0
210
+ check_top_level_number_limit(facts.size)
211
+
212
+ parse_fact_name_and_value_limits(facts)
213
+ check_total_number_limit(@number_of_facts)
214
+ Puppet.debug _("The total number of facts registered is %{number_of_facts}") % {number_of_facts: @number_of_facts}
215
+ end
216
+
129
217
  def get_facts(options)
130
218
  if options[:pluginsync]
131
219
  plugin_sync_time = thinmark do
@@ -148,7 +236,9 @@ class Puppet::Configurer
148
236
  # facts_for_uploading may set Puppet[:node_name_value] as a side effect
149
237
  facter_time = thinmark do
150
238
  facts = find_facts
239
+ check_facts_limits(facts.to_data_hash['values'])
151
240
  facts_hash = encode_facts(facts) # encode for uploading # was: facts_for_uploading
241
+ check_payload_size(facts_hash[:facts].bytesize)
152
242
  end
153
243
  options[:report].add_times(:fact_generation, facter_time) if options[:report]
154
244
  end
@@ -255,6 +345,7 @@ class Puppet::Configurer
255
345
 
256
346
  def run_internal(options)
257
347
  report = options[:report]
348
+ report.initial_environment = Puppet[:environment]
258
349
 
259
350
  if options[:start_time]
260
351
  startup_time = Time.now - options[:start_time]
@@ -294,53 +385,18 @@ class Puppet::Configurer
294
385
  configured_environment = Puppet[:environment] if Puppet.settings.set_by_config?(:environment)
295
386
 
296
387
  # We only need to find out the environment to run in if we don't already have a catalog
297
- unless (cached_catalog || options[:catalog] || Puppet[:strict_environment_mode])
298
- begin
299
- node = nil
300
- node_retr_time = thinmark do
301
- node = Puppet::Node.indirection.find(Puppet[:node_name_value],
302
- :environment => Puppet::Node::Environment.remote(@environment),
303
- :configured_environment => configured_environment,
304
- :ignore_cache => true,
305
- :transaction_uuid => @transaction_uuid,
306
- :fail_on_404 => true)
307
- end
308
- options[:report].add_times(:node_retrieval, node_retr_time)
309
-
310
- if node
311
- # If we have deserialized a node from a rest call, we want to set
312
- # an environment instance as a simple 'remote' environment reference.
313
- if !node.has_environment_instance? && node.environment_name
314
- node.environment = Puppet::Node::Environment.remote(node.environment_name)
315
- end
316
-
317
- @node_environment = node.environment.to_s
318
-
319
- if node.environment.to_s != @environment
320
- Puppet.notice _("Local environment: '%{local_env}' doesn't match server specified node environment '%{node_env}', switching agent to '%{node_env}'.") % { local_env: @environment, node_env: node.environment }
321
- @environment = node.environment.to_s
322
- report.environment = @environment
323
- query_options = nil
324
- facts = nil
325
-
326
- new_env = Puppet::Node::Environment.remote(@environment)
327
- Puppet.push_context(
328
- {
329
- current_environment: new_env,
330
- loaders: Puppet::Pops::Loaders.new(new_env, true)
331
- },
332
- "Local node environment #{@environment} for configurer transaction"
333
- )
334
- else
335
- Puppet.info _("Using configured environment '%{env}'") % { env: @environment }
336
- end
337
- end
338
- rescue StandardError => detail
339
- Puppet.warning(_("Unable to fetch my node definition, but the agent run will continue:"))
340
- Puppet.warning(detail)
388
+ unless (cached_catalog || options[:catalog] || Puppet.settings.set_by_cli?(:environment) || Puppet[:strict_environment_mode])
389
+ Puppet.debug(_("Environment not passed via CLI and no catalog was given, attempting to find out the last server-specified environment"))
390
+ if last_server_specified_environment
391
+ @environment = last_server_specified_environment
392
+ report.environment = last_server_specified_environment
393
+ else
394
+ Puppet.debug(_("Could not find a usable environment in the lastrunfile. Either the file does not exist, does not have the required keys, or the values of 'initial_environment' and 'converged_environment' are identical."))
341
395
  end
342
396
  end
343
397
 
398
+ Puppet.info _("Using environment '%{env}'") % { env: @environment }
399
+
344
400
  # This is to maintain compatibility with anyone using this class
345
401
  # aside from agent, apply, device.
346
402
  unless Puppet.lookup(:loaders) { nil }
@@ -354,9 +410,15 @@ class Puppet::Configurer
354
410
  )
355
411
  end
356
412
 
413
+ temp_value = options[:pluginsync]
414
+
415
+ # only validate server environment if pluginsync is requested
416
+ options[:pluginsync] = valid_server_environment? if options[:pluginsync] == true
417
+
357
418
  query_options, facts = get_facts(options) unless query_options
419
+ options[:pluginsync] = temp_value
420
+
358
421
  query_options[:configured_environment] = configured_environment
359
- options[:convert_for_node] = node
360
422
 
361
423
  catalog = prepare_and_retrieve_catalog(cached_catalog, facts, options, query_options)
362
424
  unless catalog
@@ -381,6 +443,15 @@ class Puppet::Configurer
381
443
  @environment = catalog.environment
382
444
  report.environment = @environment
383
445
 
446
+ new_env = Puppet::Node::Environment.remote(@environment)
447
+ Puppet.push_context(
448
+ {
449
+ :current_environment => new_env,
450
+ :loaders => Puppet::Pops::Loaders.new(new_env, true)
451
+ },
452
+ "Local node environment #{@environment} for configurer transaction"
453
+ )
454
+
384
455
  query_options, facts = get_facts(options)
385
456
  query_options[:configured_environment] = configured_environment
386
457
 
@@ -454,6 +525,25 @@ class Puppet::Configurer
454
525
  end
455
526
  private :run_internal
456
527
 
528
+ def valid_server_environment?
529
+ session = Puppet.lookup(:http_session)
530
+ begin
531
+ fs = session.route_to(:fileserver)
532
+ fs.get_file_metadatas(path: URI(Puppet[:pluginsource]).path, recurse: :false, environment: @environment)
533
+ true
534
+ rescue Puppet::HTTP::ResponseError => detail
535
+ if detail.response.code == 404
536
+ Puppet.notice(_("Environment '%{environment}' not found on server, skipping initial pluginsync.") % { environment: @environment })
537
+ else
538
+ Puppet.log_exception(detail, detail.message)
539
+ end
540
+ false
541
+ rescue => detail
542
+ Puppet.log_exception(detail, detail.message)
543
+ false
544
+ end
545
+ end
546
+
457
547
  def find_functional_server
458
548
  begin
459
549
  session = Puppet.lookup(:http_session)
@@ -470,6 +560,24 @@ class Puppet::Configurer
470
560
  end
471
561
  private :find_functional_server
472
562
 
563
+ def last_server_specified_environment
564
+ return @last_server_specified_environment if @last_server_specified_environment
565
+ if Puppet::FileSystem.exist?(Puppet[:lastrunfile])
566
+ summary = Puppet::Util::Yaml.safe_load_file(Puppet[:lastrunfile])
567
+ return unless summary.dig('application', 'run_mode') == 'agent'
568
+ initial_environment = summary.dig('application', 'initial_environment')
569
+ converged_environment = summary.dig('application', 'converged_environment')
570
+ @last_server_specified_environment = converged_environment if initial_environment != converged_environment
571
+ end
572
+
573
+ Puppet.debug(_("Found last server-specified environment: %{environment}") % { environment: @last_server_specified_environment }) if @last_server_specified_environment
574
+ @last_server_specified_environment
575
+ rescue => detail
576
+ Puppet.debug(_("Could not find last server-specified environment: %{detail}") % { detail: detail })
577
+ nil
578
+ end
579
+ private :last_server_specified_environment
580
+
473
581
  def send_report(report)
474
582
  puts report.summary if Puppet[:summarize]
475
583
  save_last_run_summary(report)
@@ -558,6 +666,7 @@ class Puppet::Configurer
558
666
  # don't update cache until after environment converges
559
667
  :ignore_cache_save => true,
560
668
  :environment => Puppet::Node::Environment.remote(@environment),
669
+ :check_environment => true,
561
670
  :fail_on_404 => true,
562
671
  :facts_for_catalog => facts
563
672
  )
@@ -199,7 +199,7 @@ module Puppet
199
199
 
200
200
  The strictness level is for both language semantics and runtime
201
201
  evaluation validation. In addition to controlling the behavior with
202
- this master switch some individual warnings may also be controlled
202
+ this primary server switch some individual warnings may also be controlled
203
203
  by the disable_warnings setting.
204
204
 
205
205
  No new validations will be added to a micro (x.y.z) release,
@@ -268,7 +268,7 @@ module Puppet
268
268
  :default => true,
269
269
  :type => :boolean,
270
270
  :desc => "Whether to compile a [static catalog](https://puppet.com/docs/puppet/latest/static_catalogs.html#enabling-or-disabling-static-catalogs),
271
- which occurs only on a Puppet Server master when the `code-id-command` and
271
+ which occurs only on Puppet Server when the `code-id-command` and
272
272
  `code-content-command` settings are configured in its `puppetserver.conf` file.",
273
273
  },
274
274
  :settings_catalog => {
@@ -391,13 +391,13 @@ module Puppet
391
391
  :default => "production",
392
392
  :desc => "The environment in which Puppet is running. For clients,
393
393
  such as `puppet agent`, this determines the environment itself, which
394
- Puppet uses to find modules and much more. For servers, such as `puppet master`,
394
+ Puppet uses to find modules and much more. For servers, such as `puppet server`,
395
395
  this provides the default environment for nodes that Puppet knows nothing about.
396
396
 
397
397
  When defining an environment in the `[agent]` section, this refers to the
398
- environment that the agent requests from the master. The environment doesn't
398
+ environment that the agent requests from the primary server. The environment doesn't
399
399
  have to exist on the local filesystem because the agent fetches it from the
400
- master. This definition is used when running `puppet agent`.
400
+ primary server. This definition is used when running `puppet agent`.
401
401
 
402
402
  When defined in the `[user]` section, the environment refers to the path that
403
403
  Puppet uses to search for code and modules related to its execution. This
@@ -791,7 +791,7 @@ Valid values are 0 (never cache) and 15 (15 second minimum wait time).
791
791
  :certname => {
792
792
  :default => lambda { Puppet::Settings.default_certname.downcase },
793
793
  :desc => "The name to use when handling certificates. When a node
794
- requests a certificate from the CA puppet master, it uses the value of the
794
+ requests a certificate from the CA Puppet Server, it uses the value of the
795
795
  `certname` setting as its requested Subject CN.
796
796
 
797
797
  This is the name used when managing a node's permissions in
@@ -854,7 +854,7 @@ EOT
854
854
  :desc => <<EOT
855
855
  An optional file containing custom attributes to add to certificate signing
856
856
  requests (CSRs). You should ensure that this file does not exist on your CA
857
- puppet master; if it does, unwanted certificate extensions may leak into
857
+ Puppet Server; if it does, unwanted certificate extensions may leak into
858
858
  certificates created with the `puppetserver ca generate` command.
859
859
 
860
860
  If present, this file must be a YAML hash containing a `custom_attributes` key
@@ -1143,7 +1143,7 @@ EOT
1143
1143
  :default => "$confdir/autosign.conf",
1144
1144
  :type => :autosign,
1145
1145
  :desc => "Whether (and how) to autosign certificate requests. This setting
1146
- is only relevant on a puppet master acting as a certificate authority (CA).
1146
+ is only relevant on a Puppet Server acting as a certificate authority (CA).
1147
1147
 
1148
1148
  Valid values are true (autosigns all certificate requests; not recommended),
1149
1149
  false (disables autosigning certificates), or the absolute path to a file.
@@ -1154,7 +1154,7 @@ EOT
1154
1154
  file, it will be treated as a policy executable; otherwise, it will be
1155
1155
  treated as a config file.
1156
1156
 
1157
- If a custom policy executable is configured, the CA puppet master will run it
1157
+ If a custom policy executable is configured, the CA Puppet Server will run it
1158
1158
  every time it receives a CSR. The executable will be passed the subject CN of the
1159
1159
  request _as a command line argument,_ and the contents of the CSR in PEM format
1160
1160
  _on stdin._ It should exit with a status of 0 if the cert should be autosigned
@@ -1241,7 +1241,7 @@ EOT
1241
1241
  :manifest => {
1242
1242
  :default => nil,
1243
1243
  :type => :file_or_directory,
1244
- :desc => "The entry-point manifest for puppet master. This can be one file
1244
+ :desc => "The entry-point manifest for the primary server. This can be one file
1245
1245
  or a directory of manifests to be evaluated in alphabetical order. Puppet manages
1246
1246
  this path as a directory if one exists or if the path ends with a / or \\.
1247
1247
 
@@ -1421,8 +1421,8 @@ EOT
1421
1421
  their names should be comma-separated, with whitespace allowed. (For example,
1422
1422
  `reports = http, store`.)
1423
1423
 
1424
- This setting is relevant to puppet master and puppet apply. The puppet
1425
- master will call these report handlers with the reports it receives from
1424
+ This setting is relevant to puppet server and puppet apply. The primary Puppet
1425
+ server will call these report handlers with the reports it receives from
1426
1426
  agent nodes, and puppet apply will call them with its own report. (In
1427
1427
  all cases, the node applying the catalog must have `report = true`.)
1428
1428
 
@@ -1474,14 +1474,14 @@ EOT
1474
1474
  :node_name_value => {
1475
1475
  :default => "$certname",
1476
1476
  :desc => "The explicit value used for the node name for all requests the agent
1477
- makes to the master. WARNING: This setting is mutually exclusive with
1477
+ makes to the primary server. WARNING: This setting is mutually exclusive with
1478
1478
  node_name_fact. Changing this setting also requires changes to
1479
1479
  Puppet Server's default [auth.conf](https://puppet.com/docs/puppetserver/latest/config_file_auth.html)."
1480
1480
  },
1481
1481
  :node_name_fact => {
1482
1482
  :default => "",
1483
1483
  :desc => "The fact name used to determine the node name used for all requests the agent
1484
- makes to the master. WARNING: This setting is mutually exclusive with
1484
+ makes to the primary server. WARNING: This setting is mutually exclusive with
1485
1485
  node_name_value. Changing this setting also requires changes to
1486
1486
  Puppet Server's default [auth.conf](https://puppet.com/docs/puppetserver/latest/config_file_auth.html).",
1487
1487
  :hook => proc do |value|
@@ -1494,8 +1494,8 @@ EOT
1494
1494
  :default => "$statedir/state.yaml",
1495
1495
  :type => :file,
1496
1496
  :mode => "0640",
1497
- :desc => "Where puppet agent and puppet master store state associated
1498
- with the running configuration. In the case of puppet master,
1497
+ :desc => "Where Puppet agent and Puppet Server store state associated
1498
+ with the running configuration. In the case of Puppet Server,
1499
1499
  this file reflects the state discovered through interacting
1500
1500
  with clients."
1501
1501
  },
@@ -1558,11 +1558,11 @@ EOT
1558
1558
  the POSIX syslog service and the Windows Event Log are unavailable. (Currently,
1559
1559
  no supported operating systems match that description.)
1560
1560
 
1561
- Despite the name, both puppet agent and puppet master will use this file
1561
+ Despite the name, both puppet agent and puppet server will use this file
1562
1562
  as the fallback logging destination.
1563
1563
 
1564
1564
  For control over logging destinations, see the `--logdest` command line
1565
- option in the manual pages for puppet master, puppet agent, and puppet
1565
+ option in the manual pages for puppet server, puppet agent, and puppet
1566
1566
  apply. You can see man pages by running `puppet <SUBCOMMAND> --help`,
1567
1567
  or read them online at https://puppet.com/docs/puppet/latest/man/."
1568
1568
  },
@@ -1576,12 +1576,12 @@ EOT
1576
1576
  },
1577
1577
  :server => {
1578
1578
  :default => "puppet",
1579
- :desc => "The puppet master server to which the puppet agent should connect.",
1579
+ :desc => "The primary Puppet server to which the Puppet agent should connect.",
1580
1580
  },
1581
1581
  :server_list => {
1582
1582
  :default => [],
1583
1583
  :type => :server_list,
1584
- :desc => "The list of Puppet master servers to which the Puppet agent should connect,
1584
+ :desc => "The list of primary Puppet servers to which the Puppet agent should connect,
1585
1585
  in the order that they will be tried. Each value should be a fully qualified domain name, followed by an optional ':' and port number. If a port is omitted, Puppet uses masterport for that host.",
1586
1586
  },
1587
1587
  :use_srv_records => {
@@ -1596,7 +1596,7 @@ EOT
1596
1596
  :http_extra_headers => {
1597
1597
  :default => [],
1598
1598
  :type => :http_extra_headers,
1599
- :desc => "The list of extra headers that will be sent with http requests to the master.
1599
+ :desc => "The list of extra headers that will be sent with http requests to the primary server.
1600
1600
  The header definition consists of a name and a value separated by a colon."
1601
1601
  },
1602
1602
  :ignoreschedules => {
@@ -1622,7 +1622,7 @@ EOT
1622
1622
  like it does when running normally. However, if a resource attribute is not in
1623
1623
  the desired state (as declared in the catalog), Puppet will take no
1624
1624
  action, and will instead report the changes it _would_ have made. These
1625
- simulated changes will appear in the report sent to the puppet master, or
1625
+ simulated changes will appear in the report sent to the primary Puppet server, or
1626
1626
  be shown on the console if running puppet agent or puppet apply in the
1627
1627
  foreground. The simulated changes will not send refresh events to any
1628
1628
  subscribing or notified resources, although Puppet will log that a refresh
@@ -1689,13 +1689,38 @@ EOT
1689
1689
  new configurations, where you want to fix the broken configuration
1690
1690
  rather than reverting to a known-good one.",
1691
1691
  },
1692
+ :fact_name_length_soft_limit => {
1693
+ :default => 2560,
1694
+ :type => :integer,
1695
+ :desc => "The soft limit for the length of a fact name.",
1696
+ },
1697
+ :fact_value_length_soft_limit => {
1698
+ :default => 4096,
1699
+ :type => :integer,
1700
+ :desc => "The soft limit for the length of a fact value.",
1701
+ },
1702
+ :top_level_facts_soft_limit => {
1703
+ :default => 512,
1704
+ :type => :integer,
1705
+ :desc => "The soft limit for the number of top level facts.",
1706
+ },
1707
+ :number_of_facts_soft_limit => {
1708
+ :default => 2048,
1709
+ :type => :integer,
1710
+ :desc => "The soft limit for the total number of facts.",
1711
+ },
1712
+ :payload_soft_limit => {
1713
+ :default => 16 * 1024 * 1024,
1714
+ :type => :integer,
1715
+ :desc => "The soft limit for the size of the payload.",
1716
+ },
1692
1717
  :use_cached_catalog => {
1693
1718
  :default => false,
1694
1719
  :type => :boolean,
1695
1720
  :desc => "Whether to only use the cached catalog rather than compiling a new catalog
1696
1721
  on every run. Puppet can be run with this enabled by default and then selectively
1697
1722
  disabled when a recompile is desired. Because a Puppet agent using cached catalogs
1698
- does not contact the master for a new catalog, it also does not upload facts at
1723
+ does not contact the primary server for a new catalog, it also does not upload facts at
1699
1724
  the beginning of the Puppet run.",
1700
1725
  },
1701
1726
  :ignoremissingtypes => {
@@ -1703,7 +1728,7 @@ EOT
1703
1728
  :type => :boolean,
1704
1729
  :desc => "Skip searching for classes and definitions that were missing during a
1705
1730
  prior compilation. The list of missing objects is maintained per-environment and
1706
- persists until the environment is cleared or the master is restarted.",
1731
+ persists until the environment is cleared or the primary server is restarted.",
1707
1732
  },
1708
1733
  :splaylimit => {
1709
1734
  :default => "$runinterval",
@@ -1733,7 +1758,7 @@ EOT
1733
1758
  If you restart an agent's puppet service with `splay` enabled, it
1734
1759
  recalculates its splay period and delays its first agent run after
1735
1760
  restarting for this new period. If you simultaneously restart a group of
1736
- puppet agents with `splay` enabled, their checkins to your puppet masters
1761
+ puppet agents with `splay` enabled, their checkins to your primary servers
1737
1762
  can be distributed more evenly.",
1738
1763
  },
1739
1764
  :clientbucketdir => {
@@ -1832,7 +1857,7 @@ EOT
1832
1857
 
1833
1858
  When starting for the first time, puppet agent will submit a certificate
1834
1859
  signing request (CSR) to the server named in the `ca_server` setting
1835
- (usually the puppet master); this may be autosigned, or may need to be
1860
+ (usually the primary Puppet server); this may be autosigned, or may need to be
1836
1861
  approved by a human, depending on the CA server's configuration.
1837
1862
 
1838
1863
  Puppet agent cannot apply configurations until its approved certificate is