puppet 7.9.0 → 7.12.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (292) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -2
  3. data/Gemfile.lock +12 -12
  4. data/{ext → examples/enc}/regexp_nodes/classes/databases +0 -0
  5. data/{ext → examples/enc}/regexp_nodes/classes/webservers +0 -0
  6. data/{ext → examples/enc}/regexp_nodes/environment/development +0 -0
  7. data/{ext → examples/enc}/regexp_nodes/parameters/service/prod +0 -0
  8. data/{ext → examples/enc}/regexp_nodes/parameters/service/qa +0 -0
  9. data/{ext → examples/enc}/regexp_nodes/parameters/service/sandbox +0 -0
  10. data/{ext → examples/enc}/regexp_nodes/regexp_nodes.rb +0 -0
  11. data/{ext → examples}/nagios/check_puppet.rb +2 -2
  12. data/ext/README.md +13 -0
  13. data/lib/puppet/application/agent.rb +4 -0
  14. data/lib/puppet/application/apply.rb +20 -2
  15. data/lib/puppet/application/resource.rb +15 -13
  16. data/lib/puppet/concurrent/thread_local_singleton.rb +1 -0
  17. data/lib/puppet/configurer.rb +236 -58
  18. data/lib/puppet/confine/variable.rb +1 -1
  19. data/lib/puppet/defaults.rb +66 -29
  20. data/lib/puppet/environments.rb +66 -26
  21. data/lib/puppet/facter_impl.rb +96 -0
  22. data/lib/puppet/file_serving/configuration/parser.rb +2 -0
  23. data/lib/puppet/file_serving/configuration.rb +2 -0
  24. data/lib/puppet/file_serving/mount/file.rb +4 -4
  25. data/lib/puppet/file_serving/mount/scripts.rb +24 -0
  26. data/lib/puppet/file_system/file_impl.rb +3 -1
  27. data/lib/puppet/file_system.rb +2 -1
  28. data/lib/puppet/forge.rb +1 -1
  29. data/lib/puppet/functions/find_template.rb +2 -2
  30. data/lib/puppet/http/client.rb +1 -1
  31. data/lib/puppet/http/redirector.rb +5 -0
  32. data/lib/puppet/http/service/compiler.rb +6 -1
  33. data/lib/puppet/indirector/catalog/compiler.rb +24 -6
  34. data/lib/puppet/indirector/catalog/rest.rb +1 -0
  35. data/lib/puppet/indirector/facts/facter.rb +6 -6
  36. data/lib/puppet/indirector/indirection.rb +1 -1
  37. data/lib/puppet/indirector/terminus.rb +4 -0
  38. data/lib/puppet/module/plan.rb +0 -1
  39. data/lib/puppet/module/task.rb +1 -1
  40. data/lib/puppet/module_tool/applications/installer.rb +8 -4
  41. data/lib/puppet/module_tool/applications/uninstaller.rb +1 -1
  42. data/lib/puppet/module_tool/applications/upgrader.rb +1 -1
  43. data/lib/puppet/network/http/api/indirected_routes.rb +1 -1
  44. data/lib/puppet/node/environment.rb +10 -11
  45. data/lib/puppet/pal/pal_impl.rb +1 -1
  46. data/lib/puppet/parser/resource.rb +1 -1
  47. data/lib/puppet/parser/scope.rb +8 -7
  48. data/lib/puppet/parser/templatewrapper.rb +1 -0
  49. data/lib/puppet/pops/evaluator/closure.rb +7 -5
  50. data/lib/puppet/pops/evaluator/runtime3_resource_support.rb +1 -0
  51. data/lib/puppet/pops/lookup/lookup_adapter.rb +3 -2
  52. data/lib/puppet/pops/model/ast.rb +1 -0
  53. data/lib/puppet/pops/model/factory.rb +14 -13
  54. data/lib/puppet/pops/parser/egrammar.ra +2 -2
  55. data/lib/puppet/pops/parser/eparser.rb +752 -753
  56. data/lib/puppet/pops/parser/lexer2.rb +69 -68
  57. data/lib/puppet/pops/parser/slurp_support.rb +1 -0
  58. data/lib/puppet/pops/serialization/to_data_converter.rb +18 -6
  59. data/lib/puppet/pops/serialization/to_stringified_converter.rb +1 -1
  60. data/lib/puppet/pops/types/type_formatter.rb +7 -6
  61. data/lib/puppet/pops/types/types.rb +1 -1
  62. data/lib/puppet/provider/aix_object.rb +1 -1
  63. data/lib/puppet/provider/group/groupadd.rb +5 -2
  64. data/lib/puppet/provider/package/pkg.rb +19 -2
  65. data/lib/puppet/provider/package/puppet_gem.rb +1 -1
  66. data/lib/puppet/provider/package/puppetserver_gem.rb +1 -1
  67. data/lib/puppet/provider/package/yum.rb +1 -1
  68. data/lib/puppet/provider/service/base.rb +1 -1
  69. data/lib/puppet/provider/service/init.rb +5 -5
  70. data/lib/puppet/provider/service/launchd.rb +2 -2
  71. data/lib/puppet/provider/service/redhat.rb +1 -1
  72. data/lib/puppet/provider/service/smf.rb +3 -3
  73. data/lib/puppet/provider/service/systemd.rb +2 -2
  74. data/lib/puppet/provider/service/upstart.rb +5 -5
  75. data/lib/puppet/provider/user/aix.rb +44 -1
  76. data/lib/puppet/provider/user/directoryservice.rb +1 -1
  77. data/lib/puppet/provider/user/useradd.rb +72 -16
  78. data/lib/puppet/provider.rb +1 -1
  79. data/lib/puppet/reference/providers.rb +2 -2
  80. data/lib/puppet/resource/catalog.rb +1 -1
  81. data/lib/puppet/resource/type_collection.rb +2 -1
  82. data/lib/puppet/resource.rb +38 -5
  83. data/lib/puppet/runtime.rb +11 -1
  84. data/lib/puppet/settings/file_setting.rb +3 -8
  85. data/lib/puppet/settings.rb +2 -2
  86. data/lib/puppet/test/test_helper.rb +4 -1
  87. data/lib/puppet/transaction/persistence.rb +11 -1
  88. data/lib/puppet/transaction/report.rb +15 -1
  89. data/lib/puppet/type/exec.rb +19 -2
  90. data/lib/puppet/type/file.rb +6 -6
  91. data/lib/puppet/type/filebucket.rb +2 -2
  92. data/lib/puppet/type/group.rb +0 -1
  93. data/lib/puppet/type/resources.rb +1 -1
  94. data/lib/puppet/type/service.rb +8 -3
  95. data/lib/puppet/type/user.rb +0 -1
  96. data/lib/puppet/type.rb +1 -1
  97. data/lib/puppet/util/autoload.rb +1 -1
  98. data/lib/puppet/util/command_line.rb +1 -1
  99. data/lib/puppet/util/filetype.rb +2 -2
  100. data/lib/puppet/util/json.rb +3 -0
  101. data/lib/puppet/util/log.rb +1 -2
  102. data/lib/puppet/util/logging.rb +1 -25
  103. data/lib/puppet/util/pidlock.rb +1 -1
  104. data/lib/puppet/util/rdoc/parser/puppet_parser_core.rb +1 -1
  105. data/lib/puppet/util/suidmanager.rb +1 -2
  106. data/lib/puppet/util/tagging.rb +1 -0
  107. data/lib/puppet/util/windows/service.rb +0 -5
  108. data/lib/puppet/util/windows/user.rb +0 -1
  109. data/lib/puppet/util/windows.rb +3 -0
  110. data/lib/puppet/util.rb +4 -3
  111. data/lib/puppet/version.rb +1 -1
  112. data/lib/puppet.rb +2 -6
  113. data/locales/puppet.pot +265 -221
  114. data/man/man5/puppet.conf.5 +73 -25
  115. data/man/man8/puppet-agent.8 +4 -1
  116. data/man/man8/puppet-apply.8 +1 -1
  117. data/man/man8/puppet-catalog.8 +1 -1
  118. data/man/man8/puppet-config.8 +1 -1
  119. data/man/man8/puppet-describe.8 +1 -1
  120. data/man/man8/puppet-device.8 +1 -1
  121. data/man/man8/puppet-doc.8 +1 -1
  122. data/man/man8/puppet-epp.8 +1 -1
  123. data/man/man8/puppet-facts.8 +1 -1
  124. data/man/man8/puppet-filebucket.8 +1 -1
  125. data/man/man8/puppet-generate.8 +1 -1
  126. data/man/man8/puppet-help.8 +1 -1
  127. data/man/man8/puppet-lookup.8 +1 -1
  128. data/man/man8/puppet-module.8 +3 -3
  129. data/man/man8/puppet-node.8 +1 -1
  130. data/man/man8/puppet-parser.8 +1 -1
  131. data/man/man8/puppet-plugin.8 +1 -1
  132. data/man/man8/puppet-report.8 +1 -1
  133. data/man/man8/puppet-resource.8 +1 -1
  134. data/man/man8/puppet-script.8 +1 -1
  135. data/man/man8/puppet-ssl.8 +1 -1
  136. data/man/man8/puppet.8 +2 -2
  137. data/spec/fixtures/integration/application/agent/cached_deferred_catalog.json +2 -1
  138. data/spec/fixtures/integration/application/agent/lib/facter/agent_spec_role.rb +3 -0
  139. data/spec/fixtures/integration/l10n/envs/prod/modules/demo/Gemfile +4 -0
  140. data/spec/fixtures/integration/l10n/envs/prod/modules/demo/Rakefile +3 -0
  141. data/spec/fixtures/integration/l10n/envs/prod/modules/demo/lib/puppet/functions/l10n.rb +8 -0
  142. data/spec/fixtures/integration/l10n/envs/prod/modules/demo/locales/config.yaml +25 -0
  143. data/spec/fixtures/integration/l10n/envs/prod/modules/demo/locales/ja/puppet-l10n.po +19 -0
  144. data/spec/fixtures/integration/l10n/envs/prod/modules/demo/locales/puppet-l10n.pot +20 -0
  145. data/spec/fixtures/integration/l10n/envs/prod/modules/demo/metadata.json +8 -0
  146. data/spec/integration/application/agent_spec.rb +146 -52
  147. data/spec/integration/application/filebucket_spec.rb +5 -0
  148. data/spec/integration/configurer_spec.rb +18 -2
  149. data/spec/integration/indirector/facts/facter_spec.rb +3 -3
  150. data/spec/integration/l10n/compiler_spec.rb +37 -0
  151. data/spec/integration/parser/pcore_resource_spec.rb +10 -0
  152. data/spec/integration/transaction/report_spec.rb +1 -1
  153. data/spec/integration/type/file_spec.rb +2 -2
  154. data/spec/integration/type/package_spec.rb +6 -6
  155. data/spec/integration/util/rdoc/parser_spec.rb +1 -1
  156. data/spec/integration/util/windows/process_spec.rb +1 -9
  157. data/spec/lib/puppet_spec/modules.rb +13 -2
  158. data/spec/lib/puppet_spec/puppetserver.rb +15 -0
  159. data/spec/shared_behaviours/documentation_on_faces.rb +0 -2
  160. data/spec/shared_contexts/l10n.rb +27 -0
  161. data/spec/spec_helper.rb +1 -10
  162. data/spec/unit/application/apply_spec.rb +76 -56
  163. data/spec/unit/application/resource_spec.rb +29 -0
  164. data/spec/unit/configurer_spec.rb +353 -57
  165. data/spec/unit/environments_spec.rb +150 -1
  166. data/spec/unit/facter_impl_spec.rb +31 -0
  167. data/spec/unit/file_bucket/dipper_spec.rb +2 -2
  168. data/spec/unit/file_serving/configuration/parser_spec.rb +23 -0
  169. data/spec/unit/file_serving/configuration_spec.rb +12 -4
  170. data/spec/unit/file_serving/mount/scripts_spec.rb +69 -0
  171. data/spec/unit/file_system_spec.rb +7 -0
  172. data/spec/unit/functions/logging_spec.rb +1 -0
  173. data/spec/unit/functions/lookup_spec.rb +64 -0
  174. data/spec/unit/http/client_spec.rb +58 -1
  175. data/spec/unit/http/service/compiler_spec.rb +8 -0
  176. data/spec/unit/indirector/catalog/compiler_spec.rb +87 -0
  177. data/spec/unit/indirector/catalog/rest_spec.rb +8 -0
  178. data/spec/unit/indirector/indirection_spec.rb +10 -3
  179. data/spec/unit/interface/action_spec.rb +0 -9
  180. data/spec/unit/module_spec.rb +14 -0
  181. data/spec/unit/module_tool/applications/installer_spec.rb +39 -12
  182. data/spec/unit/network/formats_spec.rb +6 -0
  183. data/spec/unit/pops/parser/parse_containers_spec.rb +0 -11
  184. data/spec/unit/pops/serialization/to_from_hr_spec.rb +58 -0
  185. data/spec/unit/pops/serialization/to_stringified_spec.rb +5 -0
  186. data/spec/unit/pops/types/type_calculator_spec.rb +6 -0
  187. data/spec/unit/provider/package/gem_spec.rb +1 -1
  188. data/spec/unit/provider/package/pip2_spec.rb +1 -1
  189. data/spec/unit/provider/package/pip3_spec.rb +1 -1
  190. data/spec/unit/provider/package/pip_spec.rb +1 -1
  191. data/spec/unit/provider/package/pkg_spec.rb +34 -5
  192. data/spec/unit/provider/package/puppet_gem_spec.rb +1 -1
  193. data/spec/unit/provider/package/puppetserver_gem_spec.rb +1 -1
  194. data/spec/unit/provider/service/launchd_spec.rb +11 -0
  195. data/spec/unit/provider/service/systemd_spec.rb +1 -1
  196. data/spec/unit/provider/user/aix_spec.rb +100 -0
  197. data/spec/unit/provider/user/directoryservice_spec.rb +1 -1
  198. data/spec/unit/provider/user/useradd_spec.rb +43 -2
  199. data/spec/unit/provider_spec.rb +4 -4
  200. data/spec/unit/puppet_spec.rb +12 -4
  201. data/spec/unit/resource/catalog_spec.rb +14 -1
  202. data/spec/unit/resource_spec.rb +58 -2
  203. data/spec/unit/settings/file_setting_spec.rb +10 -7
  204. data/spec/unit/type/service_spec.rb +27 -0
  205. data/spec/unit/type_spec.rb +2 -2
  206. data/spec/unit/util/autoload_spec.rb +25 -8
  207. data/spec/unit/util/logging_spec.rb +2 -0
  208. data/tasks/parallel.rake +3 -3
  209. metadata +37 -94
  210. data/ext/README.environment +0 -8
  211. data/ext/dbfix.sql +0 -132
  212. data/ext/debian/README.Debian +0 -8
  213. data/ext/debian/README.source +0 -2
  214. data/ext/debian/TODO.Debian +0 -1
  215. data/ext/debian/changelog.erb +0 -1122
  216. data/ext/debian/compat +0 -1
  217. data/ext/debian/control +0 -144
  218. data/ext/debian/copyright +0 -339
  219. data/ext/debian/docs +0 -1
  220. data/ext/debian/fileserver.conf +0 -41
  221. data/ext/debian/puppet-common.dirs +0 -13
  222. data/ext/debian/puppet-common.install +0 -3
  223. data/ext/debian/puppet-common.lintian-overrides +0 -5
  224. data/ext/debian/puppet-common.manpages +0 -28
  225. data/ext/debian/puppet-common.postinst +0 -35
  226. data/ext/debian/puppet-common.postrm +0 -33
  227. data/ext/debian/puppet-el.dirs +0 -1
  228. data/ext/debian/puppet-el.emacsen-install +0 -25
  229. data/ext/debian/puppet-el.emacsen-remove +0 -11
  230. data/ext/debian/puppet-el.emacsen-startup +0 -9
  231. data/ext/debian/puppet-el.install +0 -1
  232. data/ext/debian/puppet-testsuite.install +0 -2
  233. data/ext/debian/puppet-testsuite.lintian-overrides +0 -4
  234. data/ext/debian/puppet.lintian-overrides +0 -3
  235. data/ext/debian/puppet.logrotate +0 -20
  236. data/ext/debian/puppet.postinst +0 -20
  237. data/ext/debian/puppet.postrm +0 -20
  238. data/ext/debian/puppet.preinst +0 -20
  239. data/ext/debian/puppetmaster-common.install +0 -2
  240. data/ext/debian/puppetmaster-common.manpages +0 -2
  241. data/ext/debian/puppetmaster-common.postinst +0 -6
  242. data/ext/debian/puppetmaster-passenger.dirs +0 -4
  243. data/ext/debian/puppetmaster-passenger.postinst +0 -162
  244. data/ext/debian/puppetmaster-passenger.postrm +0 -61
  245. data/ext/debian/puppetmaster.README.debian +0 -17
  246. data/ext/debian/puppetmaster.default +0 -14
  247. data/ext/debian/puppetmaster.init +0 -137
  248. data/ext/debian/puppetmaster.lintian-overrides +0 -3
  249. data/ext/debian/puppetmaster.postinst +0 -20
  250. data/ext/debian/puppetmaster.postrm +0 -5
  251. data/ext/debian/puppetmaster.preinst +0 -22
  252. data/ext/debian/rules +0 -132
  253. data/ext/debian/source/format +0 -1
  254. data/ext/debian/source/options +0 -1
  255. data/ext/debian/vim-puppet.README.Debian +0 -13
  256. data/ext/debian/vim-puppet.dirs +0 -5
  257. data/ext/debian/vim-puppet.yaml +0 -7
  258. data/ext/debian/watch +0 -2
  259. data/ext/freebsd/puppetd +0 -26
  260. data/ext/freebsd/puppetmasterd +0 -26
  261. data/ext/gentoo/conf.d/puppet +0 -5
  262. data/ext/gentoo/conf.d/puppetmaster +0 -12
  263. data/ext/gentoo/init.d/puppet +0 -38
  264. data/ext/gentoo/init.d/puppetmaster +0 -51
  265. data/ext/gentoo/puppet/fileserver.conf +0 -41
  266. data/ext/ips/puppet-agent +0 -44
  267. data/ext/ips/puppet-master +0 -44
  268. data/ext/ips/puppet.p5m.erb +0 -12
  269. data/ext/ips/puppetagent.xml +0 -42
  270. data/ext/ips/puppetmaster.xml +0 -42
  271. data/ext/ips/rules +0 -19
  272. data/ext/ips/transforms +0 -34
  273. data/ext/ldap/puppet.schema +0 -24
  274. data/ext/logcheck/puppet +0 -23
  275. data/ext/osx/file_mapping.yaml +0 -28
  276. data/ext/osx/postflight.erb +0 -109
  277. data/ext/osx/preflight.erb +0 -52
  278. data/ext/osx/prototype.plist.erb +0 -38
  279. data/ext/redhat/fileserver.conf +0 -41
  280. data/ext/redhat/logrotate +0 -21
  281. data/ext/redhat/puppet.spec.erb +0 -841
  282. data/ext/redhat/server.init +0 -128
  283. data/ext/redhat/server.sysconfig +0 -13
  284. data/ext/solaris/pkginfo +0 -6
  285. data/ext/solaris/smf/puppetd.xml +0 -77
  286. data/ext/solaris/smf/puppetmasterd.xml +0 -77
  287. data/ext/solaris/smf/svc-puppetd +0 -71
  288. data/ext/solaris/smf/svc-puppetmasterd +0 -67
  289. data/ext/suse/puppet.spec +0 -310
  290. data/ext/suse/server.init +0 -173
  291. data/ext/yaml_nodes.rb +0 -105
  292. data/spec/unit/indirector/store_configs_spec.rb +0 -7
@@ -3,7 +3,7 @@ require_relative '../puppet/util/platform'
3
3
  module Puppet
4
4
 
5
5
  def self.default_diffargs
6
- if (Facter.value(:kernel) == "AIX" && Facter.value(:kernelmajversion) == "5300")
6
+ if (Puppet.runtime[:facter].value(:kernel) == "AIX" && Puppet.runtime[:facter].value(:kernelmajversion) == "5300")
7
7
  ""
8
8
  else
9
9
  "-u"
@@ -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,
@@ -243,7 +243,7 @@ module Puppet
243
243
  internal Ruby stack trace interleaved with Puppet function frames.",
244
244
  :hook => proc do |value|
245
245
  # Enable or disable Facter's trace option too
246
- Facter.trace(value) if Facter.respond_to? :trace
246
+ Puppet.runtime[:facter].trace(value)
247
247
  end
248
248
  },
249
249
  :puppet_trace => {
@@ -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
@@ -761,6 +761,12 @@ Valid values are 0 (never cache) and 15 (15 second minimum wait time).
761
761
  :owner => "service",
762
762
  :group => "service",
763
763
  :desc => "The directory where catalog previews per node are generated."
764
+ },
765
+ :location_trusted => {
766
+ :default => false,
767
+ :type => :boolean,
768
+ :desc => "This will allow sending the name + password and the cookie header to all hosts that puppet may redirect to.
769
+ This may or may not introduce a security breach if puppet redirects you to a site to which you'll send your authentication info and cookies."
764
770
  }
765
771
  )
766
772
 
@@ -791,7 +797,7 @@ Valid values are 0 (never cache) and 15 (15 second minimum wait time).
791
797
  :certname => {
792
798
  :default => lambda { Puppet::Settings.default_certname.downcase },
793
799
  :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
800
+ requests a certificate from the CA Puppet Server, it uses the value of the
795
801
  `certname` setting as its requested Subject CN.
796
802
 
797
803
  This is the name used when managing a node's permissions in
@@ -854,7 +860,7 @@ EOT
854
860
  :desc => <<EOT
855
861
  An optional file containing custom attributes to add to certificate signing
856
862
  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
863
+ Puppet Server; if it does, unwanted certificate extensions may leak into
858
864
  certificates created with the `puppetserver ca generate` command.
859
865
 
860
866
  If present, this file must be a YAML hash containing a `custom_attributes` key
@@ -1143,7 +1149,7 @@ EOT
1143
1149
  :default => "$confdir/autosign.conf",
1144
1150
  :type => :autosign,
1145
1151
  :desc => "Whether (and how) to autosign certificate requests. This setting
1146
- is only relevant on a puppet master acting as a certificate authority (CA).
1152
+ is only relevant on a Puppet Server acting as a certificate authority (CA).
1147
1153
 
1148
1154
  Valid values are true (autosigns all certificate requests; not recommended),
1149
1155
  false (disables autosigning certificates), or the absolute path to a file.
@@ -1154,7 +1160,7 @@ EOT
1154
1160
  file, it will be treated as a policy executable; otherwise, it will be
1155
1161
  treated as a config file.
1156
1162
 
1157
- If a custom policy executable is configured, the CA puppet master will run it
1163
+ If a custom policy executable is configured, the CA Puppet Server will run it
1158
1164
  every time it receives a CSR. The executable will be passed the subject CN of the
1159
1165
  request _as a command line argument,_ and the contents of the CSR in PEM format
1160
1166
  _on stdin._ It should exit with a status of 0 if the cert should be autosigned
@@ -1241,7 +1247,7 @@ EOT
1241
1247
  :manifest => {
1242
1248
  :default => nil,
1243
1249
  :type => :file_or_directory,
1244
- :desc => "The entry-point manifest for puppet master. This can be one file
1250
+ :desc => "The entry-point manifest for the primary server. This can be one file
1245
1251
  or a directory of manifests to be evaluated in alphabetical order. Puppet manages
1246
1252
  this path as a directory if one exists or if the path ends with a / or \\.
1247
1253
 
@@ -1421,8 +1427,8 @@ EOT
1421
1427
  their names should be comma-separated, with whitespace allowed. (For example,
1422
1428
  `reports = http, store`.)
1423
1429
 
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
1430
+ This setting is relevant to puppet server and puppet apply. The primary Puppet
1431
+ server will call these report handlers with the reports it receives from
1426
1432
  agent nodes, and puppet apply will call them with its own report. (In
1427
1433
  all cases, the node applying the catalog must have `report = true`.)
1428
1434
 
@@ -1474,14 +1480,14 @@ EOT
1474
1480
  :node_name_value => {
1475
1481
  :default => "$certname",
1476
1482
  :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
1483
+ makes to the primary server. WARNING: This setting is mutually exclusive with
1478
1484
  node_name_fact. Changing this setting also requires changes to
1479
1485
  Puppet Server's default [auth.conf](https://puppet.com/docs/puppetserver/latest/config_file_auth.html)."
1480
1486
  },
1481
1487
  :node_name_fact => {
1482
1488
  :default => "",
1483
1489
  :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
1490
+ makes to the primary server. WARNING: This setting is mutually exclusive with
1485
1491
  node_name_value. Changing this setting also requires changes to
1486
1492
  Puppet Server's default [auth.conf](https://puppet.com/docs/puppetserver/latest/config_file_auth.html).",
1487
1493
  :hook => proc do |value|
@@ -1494,8 +1500,8 @@ EOT
1494
1500
  :default => "$statedir/state.yaml",
1495
1501
  :type => :file,
1496
1502
  :mode => "0640",
1497
- :desc => "Where puppet agent and puppet master store state associated
1498
- with the running configuration. In the case of puppet master,
1503
+ :desc => "Where Puppet agent and Puppet Server store state associated
1504
+ with the running configuration. In the case of Puppet Server,
1499
1505
  this file reflects the state discovered through interacting
1500
1506
  with clients."
1501
1507
  },
@@ -1532,6 +1538,12 @@ EOT
1532
1538
  :mode => "0750",
1533
1539
  :desc => "The directory in which serialized data is stored on the client."
1534
1540
  },
1541
+ :write_catalog_summary => {
1542
+ :default => true,
1543
+ :type => :boolean,
1544
+ :desc => "Whether to write the `classfile` and `resourcefile` after applying
1545
+ the catalog. It is enabled by default, except when running `puppet apply`.",
1546
+ },
1535
1547
  :classfile => {
1536
1548
  :default => "$statedir/classes.txt",
1537
1549
  :type => :file,
@@ -1558,11 +1570,11 @@ EOT
1558
1570
  the POSIX syslog service and the Windows Event Log are unavailable. (Currently,
1559
1571
  no supported operating systems match that description.)
1560
1572
 
1561
- Despite the name, both puppet agent and puppet master will use this file
1573
+ Despite the name, both puppet agent and puppet server will use this file
1562
1574
  as the fallback logging destination.
1563
1575
 
1564
1576
  For control over logging destinations, see the `--logdest` command line
1565
- option in the manual pages for puppet master, puppet agent, and puppet
1577
+ option in the manual pages for puppet server, puppet agent, and puppet
1566
1578
  apply. You can see man pages by running `puppet <SUBCOMMAND> --help`,
1567
1579
  or read them online at https://puppet.com/docs/puppet/latest/man/."
1568
1580
  },
@@ -1576,12 +1588,12 @@ EOT
1576
1588
  },
1577
1589
  :server => {
1578
1590
  :default => "puppet",
1579
- :desc => "The puppet master server to which the puppet agent should connect.",
1591
+ :desc => "The primary Puppet server to which the Puppet agent should connect.",
1580
1592
  },
1581
1593
  :server_list => {
1582
1594
  :default => [],
1583
1595
  :type => :server_list,
1584
- :desc => "The list of Puppet master servers to which the Puppet agent should connect,
1596
+ :desc => "The list of primary Puppet servers to which the Puppet agent should connect,
1585
1597
  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
1598
  },
1587
1599
  :use_srv_records => {
@@ -1596,7 +1608,7 @@ EOT
1596
1608
  :http_extra_headers => {
1597
1609
  :default => [],
1598
1610
  :type => :http_extra_headers,
1599
- :desc => "The list of extra headers that will be sent with http requests to the master.
1611
+ :desc => "The list of extra headers that will be sent with http requests to the primary server.
1600
1612
  The header definition consists of a name and a value separated by a colon."
1601
1613
  },
1602
1614
  :ignoreschedules => {
@@ -1622,7 +1634,7 @@ EOT
1622
1634
  like it does when running normally. However, if a resource attribute is not in
1623
1635
  the desired state (as declared in the catalog), Puppet will take no
1624
1636
  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
1637
+ simulated changes will appear in the report sent to the primary Puppet server, or
1626
1638
  be shown on the console if running puppet agent or puppet apply in the
1627
1639
  foreground. The simulated changes will not send refresh events to any
1628
1640
  subscribing or notified resources, although Puppet will log that a refresh
@@ -1689,13 +1701,38 @@ EOT
1689
1701
  new configurations, where you want to fix the broken configuration
1690
1702
  rather than reverting to a known-good one.",
1691
1703
  },
1704
+ :fact_name_length_soft_limit => {
1705
+ :default => 2560,
1706
+ :type => :integer,
1707
+ :desc => "The soft limit for the length of a fact name.",
1708
+ },
1709
+ :fact_value_length_soft_limit => {
1710
+ :default => 4096,
1711
+ :type => :integer,
1712
+ :desc => "The soft limit for the length of a fact value.",
1713
+ },
1714
+ :top_level_facts_soft_limit => {
1715
+ :default => 512,
1716
+ :type => :integer,
1717
+ :desc => "The soft limit for the number of top level facts.",
1718
+ },
1719
+ :number_of_facts_soft_limit => {
1720
+ :default => 2048,
1721
+ :type => :integer,
1722
+ :desc => "The soft limit for the total number of facts.",
1723
+ },
1724
+ :payload_soft_limit => {
1725
+ :default => 16 * 1024 * 1024,
1726
+ :type => :integer,
1727
+ :desc => "The soft limit for the size of the payload.",
1728
+ },
1692
1729
  :use_cached_catalog => {
1693
1730
  :default => false,
1694
1731
  :type => :boolean,
1695
1732
  :desc => "Whether to only use the cached catalog rather than compiling a new catalog
1696
1733
  on every run. Puppet can be run with this enabled by default and then selectively
1697
1734
  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
1735
+ does not contact the primary server for a new catalog, it also does not upload facts at
1699
1736
  the beginning of the Puppet run.",
1700
1737
  },
1701
1738
  :ignoremissingtypes => {
@@ -1703,7 +1740,7 @@ EOT
1703
1740
  :type => :boolean,
1704
1741
  :desc => "Skip searching for classes and definitions that were missing during a
1705
1742
  prior compilation. The list of missing objects is maintained per-environment and
1706
- persists until the environment is cleared or the master is restarted.",
1743
+ persists until the environment is cleared or the primary server is restarted.",
1707
1744
  },
1708
1745
  :splaylimit => {
1709
1746
  :default => "$runinterval",
@@ -1733,7 +1770,7 @@ EOT
1733
1770
  If you restart an agent's puppet service with `splay` enabled, it
1734
1771
  recalculates its splay period and delays its first agent run after
1735
1772
  restarting for this new period. If you simultaneously restart a group of
1736
- puppet agents with `splay` enabled, their checkins to your puppet masters
1773
+ puppet agents with `splay` enabled, their checkins to your primary servers
1737
1774
  can be distributed more evenly.",
1738
1775
  },
1739
1776
  :clientbucketdir => {
@@ -1832,7 +1869,7 @@ EOT
1832
1869
 
1833
1870
  When starting for the first time, puppet agent will submit a certificate
1834
1871
  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
1872
+ (usually the primary Puppet server); this may be autosigned, or may need to be
1836
1873
  approved by a human, depending on the CA server's configuration.
1837
1874
 
1838
1875
  Puppet agent cannot apply configurations until its approved certificate is
@@ -1946,7 +1983,7 @@ EOT
1946
1983
  :call_hook => :on_initialize_and_write, # Call our hook with the default value, so we always get the value added to facter.
1947
1984
  :hook => proc do |value|
1948
1985
  paths = value.split(File::PATH_SEPARATOR)
1949
- Facter.search(*paths)
1986
+ Puppet.runtime[:facter].search(*paths)
1950
1987
  end
1951
1988
  }
1952
1989
  )
@@ -48,6 +48,13 @@ module Puppet::Environments
48
48
  root.instance_variable_set(:@rich_data, nil)
49
49
  end
50
50
  end
51
+
52
+ # The base implementation is a noop, because `get` returns a new environment
53
+ # each time.
54
+ #
55
+ # @see Puppet::Environments::Cached#guard
56
+ def guard(name); end
57
+ def unguard(name); end
51
58
  end
52
59
 
53
60
  # @!macro [new] loader_search_paths
@@ -188,7 +195,7 @@ module Puppet::Environments
188
195
 
189
196
  def self.real_path(dir)
190
197
  if Puppet::FileSystem.symlink?(dir) && Puppet[:versioned_environment_dirs]
191
- dir = Puppet::FileSystem.expand_path(Puppet::FileSystem.readlink(dir))
198
+ dir = Pathname.new Puppet::FileSystem.expand_path(Puppet::FileSystem.readlink(dir))
192
199
  end
193
200
  return dir
194
201
  end
@@ -241,7 +248,7 @@ module Puppet::Environments
241
248
 
242
249
  def validated_directory(envdir)
243
250
  env_name = Puppet::FileSystem.basename_string(envdir)
244
- envdir = Puppet::Environments::Directories.real_path(envdir)
251
+ envdir = Puppet::Environments::Directories.real_path(envdir).to_s
245
252
  if Puppet::FileSystem.directory?(envdir) && Puppet::Node::Environment.valid_name?(env_name)
246
253
  envdir
247
254
  else
@@ -330,21 +337,13 @@ module Puppet::Environments
330
337
  end
331
338
 
332
339
  def self.cache_expiration_service=(service)
333
- @cache_expiration_service = service
340
+ @cache_expiration_service_singleton = service
334
341
  end
335
342
 
336
343
  def self.cache_expiration_service
337
- @cache_expiration_service || DefaultCacheExpirationService.new
344
+ @cache_expiration_service_singleton || DefaultCacheExpirationService.new
338
345
  end
339
346
 
340
- # Returns the end of time (the next Mesoamerican Long Count cycle-end after 2012 (5125+2012) = 7137
341
- def self.end_of_time
342
- Time.gm(7137)
343
- end
344
-
345
- END_OF_TIME = end_of_time
346
- START_OF_TIME = Time.gm(1)
347
-
348
347
  def initialize(loader)
349
348
  @loader = loader
350
349
  @cache_expiration_service = Puppet::Environments::Cached.cache_expiration_service
@@ -356,7 +355,7 @@ module Puppet::Environments
356
355
  # Evict all that have expired, in the same way as `get`
357
356
  clear_all_expired
358
357
 
359
- # Evict all that was removed from diks
358
+ # Evict all that was removed from disk
360
359
  cached_envs = @cache.keys.map!(&:to_sym)
361
360
  loader_envs = @loader.list.map!(&:name)
362
361
  removed_envs = cached_envs - loader_envs
@@ -385,27 +384,35 @@ module Puppet::Environments
385
384
 
386
385
  # @!macro loader_get
387
386
  def get(name)
387
+ entry = get_entry(name)
388
+ entry ? entry.value : nil
389
+ end
390
+
391
+ # Get a cache entry for an envionment. It returns nil if the
392
+ # environment doesn't exist.
393
+ def get_entry(name, check_expired = true)
388
394
  # Aggressively evict all that has expired
389
395
  # This strategy favors smaller memory footprint over environment
390
396
  # retrieval time.
391
- clear_all_expired
392
- result = @cache[name]
393
- if result
394
- Puppet.debug {"Found in cache '#{name}' #{result.label}"}
397
+ clear_all_expired if check_expired
398
+ name = name.to_sym
399
+ entry = @cache[name]
400
+ if entry
401
+ Puppet.debug {"Found in cache #{name.inspect} #{entry.label}"}
395
402
  # found in cache
396
- result.touch
397
- return result.value
398
- elsif (result = @loader.get(name))
403
+ entry.touch
404
+ elsif (env = @loader.get(name))
399
405
  # environment loaded, cache it
400
- cache_entry = entry(result)
401
- add_entry(name, cache_entry)
402
- result
406
+ entry = entry(env)
407
+ add_entry(name, entry)
403
408
  end
409
+ entry
404
410
  end
411
+ private :get_entry
405
412
 
406
413
  # Adds a cache entry to the cache
407
414
  def add_entry(name, cache_entry)
408
- Puppet.debug {"Caching environment '#{name}' #{cache_entry.label}"}
415
+ Puppet.debug {"Caching environment #{name.inspect} #{cache_entry.label}"}
409
416
  @cache[name] = cache_entry
410
417
  @cache_expiration_service.created(cache_entry.value)
411
418
  end
@@ -413,7 +420,7 @@ module Puppet::Environments
413
420
 
414
421
  def clear_entry(name, entry)
415
422
  @cache.delete(name)
416
- Puppet.debug {"Evicting cache entry for environment '#{name}'"}
423
+ Puppet.debug {"Evicting cache entry for environment #{name.inspect}"}
417
424
  @cache_expiration_service.evicted(name.to_sym)
418
425
  Puppet::GettextConfig.delete_text_domain(name)
419
426
  Puppet.settings.clear_environment_settings(name)
@@ -423,6 +430,7 @@ module Puppet::Environments
423
430
  # Clears the cache of the environment with the given name.
424
431
  # (The intention is that this could be used from a MANUAL cache eviction command (TBD)
425
432
  def clear(name)
433
+ name = name.to_sym
426
434
  entry = @cache[name]
427
435
  clear_entry(name, entry) if entry
428
436
  end
@@ -443,19 +451,21 @@ module Puppet::Environments
443
451
  # Clears all environments that have expired, either by exceeding their time to live, or
444
452
  # through an explicit eviction determined by the cache expiration service.
445
453
  #
446
- def clear_all_expired()
454
+ def clear_all_expired
447
455
  t = Time.now
448
456
 
449
457
  @cache.each_pair do |name, entry|
450
458
  clear_if_expired(name, entry, t)
451
459
  end
452
460
  end
461
+ private :clear_all_expired
453
462
 
454
463
  # Clear an environment if it is expired, either by exceeding its time to live, or
455
464
  # through an explicit eviction determined by the cache expiration service.
456
465
  #
457
466
  def clear_if_expired(name, entry, t = Time.now)
458
467
  return unless entry
468
+ return if entry.guarded?
459
469
 
460
470
  if entry.expired?(t) || @cache_expiration_service.expired?(name.to_sym)
461
471
  clear_entry(name, entry)
@@ -472,10 +482,25 @@ module Puppet::Environments
472
482
  #
473
483
  # @!macro loader_get_conf
474
484
  def get_conf(name)
485
+ name = name.to_sym
475
486
  clear_if_expired(name, @cache[name])
476
487
  @loader.get_conf(name)
477
488
  end
478
489
 
490
+ # Guard an environment so it can't be evicted while it's in use. The method
491
+ # may be called multiple times, provided it is unguarded the same number of
492
+ # times. If you call this method, you must call `unguard` in an ensure block.
493
+ def guard(name)
494
+ entry = get_entry(name, false)
495
+ entry.guard if entry
496
+ end
497
+
498
+ # Unguard an environment.
499
+ def unguard(name)
500
+ entry = get_entry(name, false)
501
+ entry.unguard if entry
502
+ end
503
+
479
504
  # Creates a suitable cache entry given the time to live for one environment
480
505
  #
481
506
  def entry(env)
@@ -501,6 +526,7 @@ module Puppet::Environments
501
526
 
502
527
  def initialize(value)
503
528
  @value = value
529
+ @guards = 0
504
530
  end
505
531
 
506
532
  def touch
@@ -513,6 +539,20 @@ module Puppet::Environments
513
539
  def label
514
540
  ""
515
541
  end
542
+
543
+ # These are not protected with a lock, because all of the Cached
544
+ # methods are protected.
545
+ def guarded?
546
+ @guards > 0
547
+ end
548
+
549
+ def guard
550
+ @guards += 1
551
+ end
552
+
553
+ def unguard
554
+ @guards -= 1
555
+ end
516
556
  end
517
557
 
518
558
  # Always evicting entry
@@ -0,0 +1,96 @@
1
+ # frozen_string_literal: true
2
+
3
+ #
4
+ # @api private
5
+ # Default Facter implementation that delegates to Facter API
6
+ #
7
+
8
+ module Puppet
9
+ class FacterImpl
10
+ def initialize
11
+ require 'facter'
12
+
13
+ setup_logging
14
+ end
15
+
16
+ def value(fact_name)
17
+ ::Facter.value(fact_name)
18
+ end
19
+
20
+ def add(name, &block)
21
+ ::Facter.add(name, &block)
22
+ end
23
+
24
+ def to_hash
25
+ ::Facter.to_hash
26
+ end
27
+
28
+ def clear
29
+ ::Facter.clear
30
+ end
31
+
32
+ def reset
33
+ ::Facter.reset
34
+ end
35
+
36
+ def resolve(options)
37
+ ::Facter.resolve(options)
38
+ end
39
+
40
+ def search_external(dirs)
41
+ ::Facter.search_external(dirs)
42
+ end
43
+
44
+ def search(*dirs)
45
+ ::Facter.search(*dirs)
46
+ end
47
+
48
+ def trace(value)
49
+ ::Facter.trace(value) if ::Facter.respond_to? :trace
50
+ end
51
+
52
+ def debugging(value)
53
+ ::Facter.debugging(value) if ::Facter.respond_to?(:debugging)
54
+ end
55
+
56
+ def load_external?
57
+ ::Facter.respond_to?(:load_external)
58
+ end
59
+
60
+ def load_external(value)
61
+ ::Facter.load_external(value) if self.load_external?
62
+ end
63
+
64
+ private
65
+
66
+ def setup_logging
67
+ return unless ::Facter.respond_to? :on_message
68
+
69
+ ::Facter.on_message do |level, message|
70
+ case level
71
+ when :trace, :debug
72
+ level = :debug
73
+ when :info
74
+ # Same as Puppet
75
+ when :warn
76
+ level = :warning
77
+ when :error
78
+ level = :err
79
+ when :fatal
80
+ level = :crit
81
+ else
82
+ next
83
+ end
84
+
85
+ Puppet::Util::Log.create(
86
+ {
87
+ :level => level,
88
+ :source => 'Facter',
89
+ :message => message
90
+ }
91
+ )
92
+ nil
93
+ end
94
+ end
95
+ end
96
+ end
@@ -78,6 +78,8 @@ class Puppet::FileServing::Configuration::Parser
78
78
  mount = Mount::Modules.new(name)
79
79
  when "plugins"
80
80
  mount = Mount::Plugins.new(name)
81
+ when "scripts"
82
+ mount = Mount::Scripts.new(name)
81
83
  when "tasks"
82
84
  mount = Mount::Tasks.new(name)
83
85
  when "locales"
@@ -6,6 +6,7 @@ require_relative '../../puppet/file_serving/mount/modules'
6
6
  require_relative '../../puppet/file_serving/mount/plugins'
7
7
  require_relative '../../puppet/file_serving/mount/locales'
8
8
  require_relative '../../puppet/file_serving/mount/pluginfacts'
9
+ require_relative '../../puppet/file_serving/mount/scripts'
9
10
  require_relative '../../puppet/file_serving/mount/tasks'
10
11
 
11
12
  class Puppet::FileServing::Configuration
@@ -83,6 +84,7 @@ class Puppet::FileServing::Configuration
83
84
  @mounts["plugins"] ||= Mount::Plugins.new("plugins")
84
85
  @mounts["locales"] ||= Mount::Locales.new("locales")
85
86
  @mounts["pluginfacts"] ||= Mount::PluginFacts.new("pluginfacts")
87
+ @mounts["scripts"] ||= Mount::Scripts.new("scripts")
86
88
  @mounts["tasks"] ||= Mount::Tasks.new("tasks")
87
89
  end
88
90
 
@@ -3,12 +3,12 @@ require_relative '../../../puppet/file_serving/mount'
3
3
  class Puppet::FileServing::Mount::File < Puppet::FileServing::Mount
4
4
  def self.localmap
5
5
  @localmap ||= {
6
- "h" => Facter.value("hostname"),
6
+ "h" => Puppet.runtime[:facter].value("hostname"),
7
7
  "H" => [
8
- Facter.value("hostname"),
9
- Facter.value("domain")
8
+ Puppet.runtime[:facter].value("hostname"),
9
+ Puppet.runtime[:facter].value("domain")
10
10
  ].join("."),
11
- "d" => Facter.value("domain")
11
+ "d" => Puppet.runtime[:facter].value("domain")
12
12
  }
13
13
  end
14
14
 
@@ -0,0 +1,24 @@
1
+ require 'puppet/file_serving/mount'
2
+
3
+ class Puppet::FileServing::Mount::Scripts < Puppet::FileServing::Mount
4
+ # Return an instance of the appropriate class.
5
+ def find(path, request)
6
+ raise _("No module specified") if path.to_s.empty?
7
+ module_name, relative_path = path.split("/", 2)
8
+ mod = request.environment.module(module_name)
9
+ return nil unless mod
10
+
11
+ mod.script(relative_path)
12
+ end
13
+
14
+ def search(path, request)
15
+ result = find(path, request)
16
+ if result
17
+ [result]
18
+ end
19
+ end
20
+
21
+ def valid?
22
+ true
23
+ end
24
+ end
@@ -84,7 +84,9 @@ class Puppet::FileSystem::FileImpl
84
84
  end
85
85
 
86
86
  def read_preserve_line_endings(path)
87
- read(path, encoding: "bom|#{Encoding.default_external.name}")
87
+ default_encoding = Encoding.default_external.name
88
+ encoding = default_encoding.downcase.start_with?('utf-') ? "bom|#{default_encoding}" : default_encoding
89
+ read(path, encoding: encoding)
88
90
  end
89
91
 
90
92
  def binread(path)
@@ -345,7 +345,8 @@ module Puppet::FileSystem
345
345
  # value ~ will be expanded to something like /Users/Foo
346
346
  #
347
347
  # This method exists primarlily to resolve a Ruby deficiency where
348
- # File.expand_path doesn't handle ~ in each segment on a Windows path
348
+ # File.expand_path doesn't convert short paths to long paths, which is
349
+ # important when resolving the path to load.
349
350
  #
350
351
  # @param path [Object] a path handle produced by {#pathname}
351
352
  # @return [String] a string representation of the path