puppet 6.13.0 → 6.14.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of puppet might be problematic. Click here for more details.

Files changed (118) hide show
  1. checksums.yaml +4 -4
  2. data/CONTRIBUTING.md +7 -13
  3. data/Gemfile.lock +6 -6
  4. data/README.md +15 -22
  5. data/lib/puppet.rb +1 -1
  6. data/lib/puppet/application/agent.rb +9 -11
  7. data/lib/puppet/application/describe.rb +7 -5
  8. data/lib/puppet/application/device.rb +2 -2
  9. data/lib/puppet/application/filebucket.rb +14 -1
  10. data/lib/puppet/application/ssl.rb +1 -1
  11. data/lib/puppet/configurer.rb +30 -41
  12. data/lib/puppet/configurer/plugin_handler.rb +10 -1
  13. data/lib/puppet/defaults.rb +7 -1
  14. data/lib/puppet/face/plugin.rb +1 -1
  15. data/lib/puppet/functions/eyaml_lookup_key.rb +13 -8
  16. data/lib/puppet/http.rb +1 -0
  17. data/lib/puppet/http/client.rb +69 -34
  18. data/lib/puppet/http/resolver/server_list.rb +2 -2
  19. data/lib/puppet/http/resolver/settings.rb +1 -1
  20. data/lib/puppet/http/resolver/srv.rb +1 -1
  21. data/lib/puppet/http/response.rb +6 -1
  22. data/lib/puppet/http/service.rb +30 -11
  23. data/lib/puppet/http/service/ca.rb +8 -8
  24. data/lib/puppet/http/service/compiler.rb +41 -10
  25. data/lib/puppet/http/service/file_server.rb +40 -20
  26. data/lib/puppet/http/service/report.rb +12 -15
  27. data/lib/puppet/http/session.rb +39 -1
  28. data/lib/puppet/indirector/catalog/rest.rb +33 -0
  29. data/lib/puppet/indirector/facts/rest.rb +41 -0
  30. data/lib/puppet/indirector/file_content/rest.rb +30 -0
  31. data/lib/puppet/indirector/file_metadata/rest.rb +50 -0
  32. data/lib/puppet/indirector/node/rest.rb +23 -0
  33. data/lib/puppet/indirector/report/rest.rb +19 -0
  34. data/lib/puppet/indirector/rest.rb +6 -0
  35. data/lib/puppet/indirector/status/rest.rb +17 -0
  36. data/lib/puppet/loaders.rb +6 -0
  37. data/lib/puppet/network/http/base_pool.rb +1 -1
  38. data/lib/puppet/network/http/pool.rb +6 -1
  39. data/lib/puppet/provider/group/groupadd.rb +9 -4
  40. data/lib/puppet/runtime.rb +8 -1
  41. data/lib/puppet/settings.rb +2 -0
  42. data/lib/puppet/settings/http_extra_headers_setting.rb +25 -0
  43. data/lib/puppet/ssl/state_machine.rb +4 -0
  44. data/lib/puppet/test/test_helper.rb +3 -1
  45. data/lib/puppet/type/file.rb +13 -0
  46. data/lib/puppet/type/file/source.rb +47 -58
  47. data/lib/puppet/version.rb +1 -1
  48. data/locales/puppet.pot +167 -160
  49. data/man/man5/puppet.conf.5 +11 -3
  50. data/man/man8/puppet-agent.8 +6 -6
  51. data/man/man8/puppet-apply.8 +1 -1
  52. data/man/man8/puppet-catalog.8 +1 -1
  53. data/man/man8/puppet-config.8 +1 -1
  54. data/man/man8/puppet-describe.8 +1 -1
  55. data/man/man8/puppet-device.8 +2 -2
  56. data/man/man8/puppet-doc.8 +1 -1
  57. data/man/man8/puppet-epp.8 +1 -1
  58. data/man/man8/puppet-facts.8 +1 -1
  59. data/man/man8/puppet-filebucket.8 +17 -2
  60. data/man/man8/puppet-generate.8 +1 -1
  61. data/man/man8/puppet-help.8 +1 -1
  62. data/man/man8/puppet-key.8 +1 -1
  63. data/man/man8/puppet-lookup.8 +1 -1
  64. data/man/man8/puppet-man.8 +1 -1
  65. data/man/man8/puppet-module.8 +1 -1
  66. data/man/man8/puppet-node.8 +1 -1
  67. data/man/man8/puppet-parser.8 +1 -1
  68. data/man/man8/puppet-plugin.8 +1 -1
  69. data/man/man8/puppet-report.8 +1 -1
  70. data/man/man8/puppet-resource.8 +1 -1
  71. data/man/man8/puppet-script.8 +1 -1
  72. data/man/man8/puppet-ssl.8 +2 -2
  73. data/man/man8/puppet-status.8 +1 -1
  74. data/man/man8/puppet.8 +2 -2
  75. data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_md5/should_fetch_if_not_on_the_local_disk.yml +1 -67
  76. data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_md5/should_not_update_if_content_on_disk_is_up-to-date.yml +1 -69
  77. data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_md5/should_update_if_content_differs_on_disk.yml +1 -69
  78. data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_mtime/should_fetch_if_mtime_is_older_on_disk.yml +1 -67
  79. data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_mtime/should_fetch_if_no_header_specified.yml +1 -65
  80. data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_mtime/should_fetch_if_not_on_the_local_disk.yml +1 -67
  81. data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_mtime/should_not_update_if_mtime_is_newer_on_disk.yml +1 -67
  82. data/spec/integration/faces/plugin_spec.rb +3 -1
  83. data/spec/integration/http/client_spec.rb +11 -0
  84. data/spec/integration/network/http_pool_spec.rb +9 -1
  85. data/spec/unit/application/describe_spec.rb +88 -50
  86. data/spec/unit/configurer/plugin_handler_spec.rb +36 -19
  87. data/spec/unit/configurer_spec.rb +16 -14
  88. data/spec/unit/face/plugin_spec.rb +12 -10
  89. data/spec/unit/functions/lookup_spec.rb +13 -0
  90. data/spec/unit/http/client_spec.rb +172 -1
  91. data/spec/unit/http/resolver_spec.rb +14 -2
  92. data/spec/unit/http/response_spec.rb +69 -0
  93. data/spec/unit/http/service/ca_spec.rb +28 -9
  94. data/spec/unit/http/service/compiler_spec.rb +151 -24
  95. data/spec/unit/http/service/file_server_spec.rb +65 -8
  96. data/spec/unit/http/service/report_spec.rb +17 -8
  97. data/spec/unit/http/service_spec.rb +92 -3
  98. data/spec/unit/http/session_spec.rb +104 -1
  99. data/spec/unit/indirector/catalog/rest_spec.rb +59 -2
  100. data/spec/unit/indirector/facts/rest_spec.rb +79 -24
  101. data/spec/unit/indirector/file_content/rest_spec.rb +53 -2
  102. data/spec/unit/indirector/file_metadata/rest_spec.rb +109 -2
  103. data/spec/unit/indirector/node/rest_spec.rb +57 -2
  104. data/spec/unit/indirector/report/rest_spec.rb +58 -51
  105. data/spec/unit/indirector/resource/ral_spec.rb +7 -8
  106. data/spec/unit/indirector/status/rest_spec.rb +43 -2
  107. data/spec/unit/network/http/pool_spec.rb +57 -11
  108. data/spec/unit/provider/group/groupadd_spec.rb +22 -8
  109. data/spec/unit/settings/autosign_setting_spec.rb +1 -1
  110. data/spec/unit/settings/http_extra_headers_spec.rb +64 -0
  111. data/spec/unit/ssl/state_machine_spec.rb +10 -0
  112. data/spec/unit/transaction_spec.rb +0 -2
  113. data/spec/unit/type/file/ensure_spec.rb +1 -2
  114. data/spec/unit/type/file/source_spec.rb +86 -35
  115. data/spec/unit/util/at_fork_spec.rb +1 -0
  116. data/spec/unit/util/pidlock_spec.rb +36 -24
  117. metadata +7 -3
  118. data/COMMITTERS.md +0 -244
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 77d2129b60ff6de7ba7a09cc3b6a5248977c58ae3787daf6d0cb2229c4bcc913
4
- data.tar.gz: b69f4e35d6b46f3ee84c06f5179c30673ad1d893209d66397817810477bed9ff
3
+ metadata.gz: fc1216f1f77ee762e957b53119e4b3ece7c58f1bd70c3e0737b9c508a8a81be2
4
+ data.tar.gz: d24df2321580cf5576069d809557f5ba60668dbd227c1403f602f5d6b99d48f4
5
5
  SHA512:
6
- metadata.gz: b9f16ed09bc8bad983e06482145e6444e14bd871bde8ef01be4043dbcb8ec053e43af3c5b08417e8ca19e30400b847d14c39a302f1b96c84c7dd86154fdda7b1
7
- data.tar.gz: 691779a9ace904f1f598fc86d0cbc670f46bd93b9f85d7a0414f6130b6e27078efc31a836424ebb876d364b55f7c38b71598e605c0e7f0b562035c5731be8e5a
6
+ metadata.gz: '09c7f51ea3a5d6b9104d04a7409ef44cc77f0199f51ffe00c0daad6ff4a1f844b9f5d3f359d3b686ec68e546a0343b5d52e8307f03c1bf0385fe4b50af081cf4'
7
+ data.tar.gz: 334425bf5c64658b01588756ee26a2090e8245f4962c16ab31f85f39809e7fadef3d5d95b84ff6a2bc4b0cc2c3f602fad70887007292bf4664e268866c23d7cd
@@ -28,7 +28,7 @@ the [puppet-dev mailing list](https://groups.google.com/forum/#!forum/puppet-dev
28
28
  ## Getting Started
29
29
 
30
30
  * Make sure you have a [Jira account](https://tickets.puppetlabs.com).
31
- * Make sure you have a [GitHub account](https://github.com/signup/free).
31
+ * Make sure you have a [GitHub account](https://github.com/join).
32
32
  * Submit a Jira ticket for your issue if one does not already exist.
33
33
  * Clearly describe the issue including steps to reproduce when it is a bug.
34
34
  * Make sure you fill in the earliest version that you know has the issue.
@@ -89,7 +89,7 @@ user-facing strings are marked in new PRs before merging.
89
89
 
90
90
  For [changes of a trivial nature](https://puppet.com/community/trivial-patch-exemption-policy), it is not always necessary to create a new
91
91
  ticket in Jira. In this case, it is appropriate to start the first line of a
92
- commit with one of `(docs)`, `(maint)`, or `(packaging)` instead of a ticket
92
+ commit with one of `(docs)`, `(maint)`, or `(packaging)` instead of a ticket
93
93
  number.
94
94
 
95
95
  If a Jira ticket exists for the documentation commit, you can include it
@@ -117,15 +117,10 @@ respectively.
117
117
  * Sign the [Contributor License Agreement](https://cla.puppet.com).
118
118
  * Push your changes to a topic branch in your fork of the repository.
119
119
  * Submit a pull request to the repository in the puppetlabs organization.
120
- * Update your Jira ticket to mark that you have submitted code and are ready
120
+ * Update the related Jira ticket to mark that you have submitted code and are ready
121
121
  for it to be reviewed (Status: Ready for Merge).
122
- * Include a link to the pull request in the ticket.
123
- * The core team looks at Pull Requests on a regular basis in a weekly triage
124
- meeting that we hold in a public Google Hangout. The hangout is announced in
125
- the weekly status updates that are sent to the puppet-dev list. Notes are
126
- posted to the [Puppet Community community-triage
127
- repo](https://github.com/puppet-community/community-triage/tree/master/core/notes)
128
- and include a link to a YouTube recording of the hangout.
122
+ * The core team looks at pull requests on a regular basis in a weekly triage
123
+ meeting.
129
124
  * After feedback has been given we expect responses within two weeks. After two
130
125
  weeks we may close the pull request if it isn't showing any activity.
131
126
 
@@ -159,9 +154,8 @@ ensure the issue has been resolved.
159
154
 
160
155
  * [Puppet community guidelines](https://puppet.com/community/community-guidelines)
161
156
  * [Bug tracker (Jira)](https://tickets.puppetlabs.com)
162
- * [Contributor License Agreement](http://links.puppet.com/cla)
157
+ * [Contributor License Agreement](https://cla.puppet.com/)
163
158
  * [General GitHub documentation](https://help.github.com/)
164
159
  * [GitHub pull request documentation](https://help.github.com/articles/creating-a-pull-request/)
165
- * #puppet-dev IRC channel on freenode.org ([Archive](https://botbot.me/freenode/puppet-dev/))
166
160
  * [puppet-dev mailing list](https://groups.google.com/forum/#!forum/puppet-dev)
167
- * [Community PR Triage notes](https://github.com/puppet-community/community-triage/tree/master/core/notes)
161
+ * [Puppet community slack](https://slack.puppet.com)
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- puppet (6.13.0)
4
+ puppet (6.14.0)
5
5
  CFPropertyList (~> 2.2)
6
6
  concurrent-ruby (~> 1.0)
7
7
  deep_merge (~> 1.0)
@@ -38,7 +38,7 @@ GEM
38
38
  fast_gettext (~> 1.1.0)
39
39
  gettext (>= 3.0.2, < 3.3.0)
40
40
  locale
41
- hashdiff (1.0.0)
41
+ hashdiff (1.0.1)
42
42
  hiera (3.6.0)
43
43
  hiera-eyaml (3.2.0)
44
44
  highline (~> 1.6.19)
@@ -57,19 +57,19 @@ GEM
57
57
  multi_json (1.14.1)
58
58
  mustache (1.1.1)
59
59
  optimist (3.0.0)
60
- packaging (0.99.56)
60
+ packaging (0.99.58)
61
61
  artifactory (~> 2)
62
62
  rake (>= 12.3)
63
63
  release-metrics
64
64
  parallel (1.19.1)
65
- parser (2.7.0.2)
65
+ parser (2.7.0.4)
66
66
  ast (~> 2.4.0)
67
67
  powerpack (0.1.2)
68
68
  pry (0.12.2)
69
69
  coderay (~> 1.1.0)
70
70
  method_source (~> 0.9.0)
71
71
  public_suffix (4.0.3)
72
- puppet-resource_api (1.8.7)
72
+ puppet-resource_api (1.8.12)
73
73
  hocon (>= 1.0)
74
74
  puppetserver-ca (1.5.0)
75
75
  facter (>= 2.0.1, < 4)
@@ -111,7 +111,7 @@ GEM
111
111
  unicode-display_width (~> 1.0, >= 1.0.1)
112
112
  rubocop-i18n (1.2.0)
113
113
  rubocop (~> 0.49.0)
114
- ruby-prof (1.2.0)
114
+ ruby-prof (1.3.0)
115
115
  ruby-progressbar (1.10.1)
116
116
  safe_yaml (1.0.5)
117
117
  semantic_puppet (1.0.2)
data/README.md CHANGED
@@ -1,5 +1,4 @@
1
- Puppet
2
- ======
1
+ # Puppet
3
2
 
4
3
  [![Travis Status](https://travis-ci.com/puppetlabs/puppet.svg?branch=master)](https://travis-ci.com/puppetlabs/puppet)
5
4
  [![Appveyor Status](https://ci.appveyor.com/api/projects/status/cvhpypd4504sevqq/branch/master?svg=true)](https://ci.appveyor.com/project/puppetlabs/puppet/branch/master)
@@ -10,18 +9,16 @@ Puppet, an automated administrative engine for your Linux, Unix, and Windows sys
10
9
  administrative tasks (such as adding users, installing packages, and updating server
11
10
  configurations) based on a centralized specification.
12
11
 
13
- Documentation
14
- -------------
12
+ ## Documentation
15
13
 
16
14
  Documentation for Puppet and related projects can be found online at the
17
15
  [Puppet Docs site](https://puppet.com/docs).
18
16
 
19
- HTTP API
20
- --------
17
+ ### HTTP API
18
+
21
19
  [HTTP API Index](https://puppet.com/docs/puppet/5.5/http_api/http_api_index.html)
22
20
 
23
- Installation
24
- ------------
21
+ ## Installation
25
22
 
26
23
  The best way to run Puppet is with [Puppet Enterprise (PE)](https://puppet.com/products/puppet-enterprise/),
27
24
  which also includes orchestration features, a web console, and professional support.
@@ -33,8 +30,7 @@ To install an open source release of Puppet,
33
30
  If you need to run Puppet from source as a tester or developer,
34
31
  see the [Running Puppet from Source](https://docs.puppet.com/puppet/3.8/from_source.html) guide on the docs site.
35
32
 
36
- Developing and Contributing
37
- ------
33
+ ## Developing and Contributing
38
34
 
39
35
  We'd love to get contributions from you! For a quick guide to getting your
40
36
  system setup for developing, take a look at our [Quickstart
@@ -45,32 +41,29 @@ in.
45
41
  For more complete docs on developing with Puppet, take a look at the
46
42
  rest of the [developer documents](https://github.com/puppetlabs/puppet/blob/master/docs/index.md).
47
43
 
48
- Licensing
49
- ---------
44
+ ## Licensing
50
45
 
51
46
  See [LICENSE](https://github.com/puppetlabs/puppet/blob/master/LICENSE) file. Puppet is licensed by Puppet, Inc. under the Apache license. Puppet, Inc. can be contacted at: info@puppet.com
52
47
 
53
- Support
54
- -------
48
+ ## Support
55
49
 
56
- Please log tickets and issues at our [JIRA tracker](https://tickets.puppetlabs.com). A [mailing
50
+ Please log tickets and issues at our [JIRA tracker](https://tickets.puppetlabs.com). A [mailing
57
51
  list](https://groups.google.com/forum/?fromgroups#!forum/puppet-users) is
58
- available for asking questions and getting help from others. In addition, there
59
- is an active #puppet channel on Freenode.
52
+ available for asking questions and getting help from others, or if you prefer chat, we also have a [Puppet Community slack.](https://puppetcommunity.slack.com/)
60
53
 
61
54
  We use semantic version numbers for our releases and recommend that users stay
62
55
  as up-to-date as possible by upgrading to patch releases and minor releases as
63
56
  they become available.
64
57
 
65
- Bugfixes and ongoing development will occur in minor releases for the current
58
+ Bug fixes and ongoing development will occur in minor releases for the current
66
59
  major version. Security fixes will be backported to a previous major version on
67
60
  a best-effort basis, until the previous major version is no longer maintained.
68
61
 
69
- For example: If a security vulnerability is discovered in Puppet 4.1.1, we
70
- would fix it in the 4 series, most likely as 4.1.2. Maintainers would then make
71
- a best effort to backport that fix onto the latest Puppet 3 release.
62
+ For example: If a security vulnerability is discovered in Puppet 6.1.1, we
63
+ would fix it in the 6 series, most likely as 6.1.2. Maintainers would then make
64
+ a best effort to backport that fix onto the latest Puppet 5 release.
72
65
 
73
66
  Long-term support, including security patches and bug fixes, is available for
74
67
  commercial customers. Please see the following page for more details:
75
68
 
76
- [Puppet Enterprise Support Lifecycle](https://puppet.com/misc/puppet-enterprise-lifecycle)
69
+ [Puppet Enterprise Support Lifecycle](https://puppet.com/docs/puppet-enterprise/product-support-lifecycle/)
@@ -237,6 +237,7 @@ module Puppet
237
237
  end
238
238
  },
239
239
  :ssl_host => proc { Puppet::SSL::Host.localhost },
240
+ :http_session => proc { Puppet.runtime["http"].create_session },
240
241
  :plugins => proc { Puppet::Plugins::Configuration.load_plugins },
241
242
  :rich_data => false
242
243
  }
@@ -322,7 +323,6 @@ module Puppet
322
323
 
323
324
  require 'puppet/runtime'
324
325
  @runtime = Puppet::Runtime.instance
325
- @runtime['http'] = proc { Puppet::HTTP::Client.new }
326
326
  end
327
327
 
328
328
  # This feels weird to me; I would really like for us to get to a state where there is never a "require" statement
@@ -90,7 +90,7 @@ puppet-agent(8) -- #{summary}
90
90
 
91
91
  SYNOPSIS
92
92
  --------
93
- Retrieves the client configuration from the puppet master and applies it to
93
+ Retrieves the client configuration from the Puppet master and applies it to
94
94
  the local host.
95
95
 
96
96
  This service may be run as a daemon, run periodically using cron (or something
@@ -164,13 +164,15 @@ when signing certificates).
164
164
  only resources not tagged with the specified tags will be applied.
165
165
  Values must be comma-separated.
166
166
 
167
+
167
168
  OPTIONS
168
169
  -------
169
170
 
170
171
  Note that any Puppet setting that's valid in the configuration file is also a
171
172
  valid long argument. For example, 'server' is a valid setting, so you can
172
- specify '--server <servername>' as an argument. Boolean settings translate into
173
- '--setting' and '--no-setting' pairs.
173
+ specify '--server <servername>' as an argument. Boolean settings accept a '--no-'
174
+ prefix to turn off a behavior, translating into '--setting' and '--no-setting'
175
+ pairs, such as `--daemonize` and `--no-daemonize`.
174
176
 
175
177
  See the configuration file documentation at
176
178
  https://puppet.com/docs/puppet/latest/configuration.html for the
@@ -237,15 +239,14 @@ generated by running puppet agent with '--genconfig'.
237
239
  * --enable:
238
240
  Enable working on the local system. This removes any lock file,
239
241
  causing 'puppet agent' to start managing the local system again
240
- (although it will continue to use its normal scheduling, so it might
241
- not start for another half hour).
242
+ However, it continues to use its normal scheduling, so it might
243
+ not start for another half hour.
242
244
 
243
245
  'puppet agent' exits after executing this.
244
246
 
245
247
  * --evaltrace:
246
248
  Logs each resource as it is being evaluated. This allows you to interactively see exactly what is being done. (This is a Puppet setting, and can go in puppet.conf. Note the special 'no-' prefix for boolean settings on the command line.)
247
249
 
248
-
249
250
  * --fingerprint:
250
251
  Display the current certificate or certificate signing request
251
252
  fingerprint and then exit. Use the '--digest' option to change the
@@ -278,7 +279,7 @@ generated by running puppet agent with '--genconfig'.
278
279
 
279
280
  * --noop:
280
281
  Use 'noop' mode where the daemon runs in a no-op or dry-run mode. This
281
- is useful for seeing what changes Puppet will make without actually
282
+ is useful for seeing what changes Puppet would make without actually
282
283
  executing the changes.
283
284
  (This is a Puppet setting, and can go in puppet.conf. Note the special 'no-'
284
285
  prefix for boolean settings on the command line.)
@@ -302,8 +303,6 @@ generated by running puppet agent with '--genconfig'.
302
303
  * --trace
303
304
  Prints stack traces on some errors. (This is a Puppet setting, and can go in puppet.conf. Note the special 'no-' prefix for boolean settings on the command line.)
304
305
 
305
-
306
-
307
306
  * --verbose:
308
307
  Turn on verbose reporting.
309
308
 
@@ -317,8 +316,7 @@ generated by running puppet agent with '--genconfig'.
317
316
  it to sign a certificate request. This is useful for the initial setup
318
317
  of a puppet client. You can turn off waiting for certificates by
319
318
  specifying a time of 0.
320
- (This is a Puppet setting, and can go in puppet.conf. Note the special 'no-'
321
- prefix for boolean settings on the command line.)
319
+ (This is a Puppet setting, and can go in puppet.conf.)
322
320
 
323
321
 
324
322
  EXAMPLE
@@ -67,13 +67,15 @@ class TypeDoc
67
67
  @types.keys.sort_by(&:to_s).each do |name|
68
68
  type = @types[name]
69
69
  s = type.doc.gsub(/\s+/, " ")
70
- n = s.index(". ")
71
- if n.nil?
70
+ if s.empty?
72
71
  s = ".. no documentation .."
73
- elsif n > 45
74
- s = s[0, 45] + " ..."
75
72
  else
76
- s = s[0, n]
73
+ n = s.index(".") || s.length
74
+ if n > 45
75
+ s = s[0, 45] + " ..."
76
+ else
77
+ s = s[0, n]
78
+ end
77
79
  end
78
80
  printf "%-15s - %s\n", name, s
79
81
  end
@@ -194,7 +194,7 @@ you can specify '--server <servername>' as an argument.
194
194
 
195
195
  * --resource:
196
196
  Displays a resource state as Puppet code, roughly equivalent to
197
- `puppet resource`. Can be filterd by title. Requires --target be specified.
197
+ `puppet resource`. Can be filtered by title. Requires --target be specified.
198
198
 
199
199
  * --target:
200
200
  Target a specific device/certificate in the device.conf. Doing so will perform a
@@ -259,7 +259,7 @@ Licensed under the Apache 2.0 License
259
259
  end
260
260
  end
261
261
  devices.collect do |devicename,device|
262
- pool = Puppet::Network::HTTP::Pool.new(Puppet[:http_keepalive_timeout])
262
+ pool = Puppet.runtime['http'].pool
263
263
  Puppet.override(:http_pool => pool) do
264
264
  # TODO when we drop support for ruby < 2.5 we can remove the extra block here
265
265
  begin
@@ -69,6 +69,19 @@ running as a user with valid Puppet certificates. Alternatively, you can
69
69
  use your local file bucket by specifying '--local', or by specifying
70
70
  '--bucket' with a local path.
71
71
 
72
+ > **Note**: Enabling and using the backup option, and by extension the
73
+ filebucket resource, requires appropriate planning and management to ensure
74
+ that sufficient disk space is available for the file backups. Generally, you
75
+ can implement this using one of the following two options:
76
+ - Use a `find` command and `crontab` entry to retain only the last X days
77
+ of file backups. For example:
78
+
79
+ ```shell
80
+ find /opt/puppetlabs/server/data/puppetserver/bucket -type f -mtime +45 -atime +45 -print0 | xargs -0 rm
81
+ ```
82
+
83
+ - Restrict the directory to a maximum size after which the oldest items are removed.
84
+
72
85
 
73
86
  OPTIONS
74
87
  -------
@@ -108,7 +121,7 @@ configuration options can also be generated by running puppet with
108
121
  by default.
109
122
 
110
123
  * --server_list:
111
- A list of comma seperated servers; only the first entry is used for file storage.
124
+ A list of comma separated servers; only the first entry is used for file storage.
112
125
  This setting takes precidence over `server`.
113
126
 
114
127
  * --server:
@@ -28,7 +28,7 @@ OPTIONS
28
28
  -------
29
29
 
30
30
  * --help:
31
- Print this help messsge.
31
+ Print this help message.
32
32
 
33
33
  * --verbose:
34
34
  Print extra information.
@@ -1,6 +1,5 @@
1
1
  # The client for interacting with the puppetmaster config server.
2
2
  require 'timeout'
3
- require 'puppet/network/http_pool'
4
3
  require 'puppet/util'
5
4
  require 'securerandom'
6
5
  #require 'puppet/parser/script_compiler'
@@ -64,7 +63,7 @@ class Puppet::Configurer
64
63
  end
65
64
 
66
65
  # Get the remote catalog, yo. Returns nil if no catalog can be found.
67
- def retrieve_catalog(query_options)
66
+ def retrieve_catalog(facts, query_options)
68
67
  query_options ||= {}
69
68
  result = retrieve_catalog_from_cache(query_options) if Puppet[:use_cached_catalog]
70
69
  if result
@@ -72,7 +71,7 @@ class Puppet::Configurer
72
71
 
73
72
  Puppet.info _("Using cached catalog from environment '%{environment}'") % { environment: result.environment }
74
73
  else
75
- result = retrieve_new_catalog(query_options)
74
+ result = retrieve_new_catalog(facts, query_options)
76
75
 
77
76
  if !result
78
77
  if !Puppet[:usecacheonfailure]
@@ -99,12 +98,11 @@ class Puppet::Configurer
99
98
  end
100
99
 
101
100
  # Convert a plain resource catalog into our full host catalog.
102
- def convert_catalog(result, duration, options = {})
101
+ def convert_catalog(result, duration, facts, options = {})
103
102
  catalog = nil
104
103
 
105
104
  catalog_conversion_time = thinmark do
106
105
  # Will mutate the result and replace all Deferred values with resolved values
107
- facts = options[:convert_with_facts]
108
106
  if facts
109
107
  Puppet::Pops::Evaluator::DeferredResolver.resolve_and_replace(facts, result)
110
108
  end
@@ -133,6 +131,7 @@ class Puppet::Configurer
133
131
  end
134
132
 
135
133
  facts_hash = {}
134
+ facts = nil
136
135
  if Puppet::Resource::Catalog.indirection.terminus_class == :rest
137
136
  # This is a bit complicated. We need the serialized and escaped facts,
138
137
  # and we need to know which format they're encoded in. Thus, we
@@ -141,15 +140,14 @@ class Puppet::Configurer
141
140
  # facts_for_uploading may set Puppet[:node_name_value] as a side effect
142
141
  facter_time = thinmark do
143
142
  facts = find_facts
144
- options[:convert_with_facts] = facts
145
143
  facts_hash = encode_facts(facts) # encode for uploading # was: facts_for_uploading
146
144
  end
147
145
  options[:report].add_times(:fact_generation, facter_time) if options[:report]
148
146
  end
149
- facts_hash
147
+ [facts_hash, facts]
150
148
  end
151
149
 
152
- def prepare_and_retrieve_catalog(cached_catalog, options, query_options)
150
+ def prepare_and_retrieve_catalog(cached_catalog, facts, options, query_options)
153
151
  # set report host name now that we have the fact
154
152
  options[:report].host = Puppet[:node_name_value]
155
153
 
@@ -165,7 +163,7 @@ class Puppet::Configurer
165
163
  catalog = cached_catalog || options[:catalog]
166
164
  unless catalog
167
165
  # retrieve_catalog returns resource catalog
168
- catalog = retrieve_catalog(query_options)
166
+ catalog = retrieve_catalog(facts, query_options)
169
167
  Puppet.err _("Could not retrieve catalog; skipping run") unless catalog
170
168
  end
171
169
  catalog
@@ -196,7 +194,7 @@ class Puppet::Configurer
196
194
  # This just passes any options on to the catalog,
197
195
  # which accepts :tags and :ignoreschedules.
198
196
  def run(options = {})
199
- pool = Puppet::Network::HTTP::Pool.new(Puppet[:http_keepalive_timeout])
197
+ pool = Puppet.runtime['http'].pool
200
198
  # We create the report pre-populated with default settings for
201
199
  # environment and transaction_uuid very early, this is to ensure
202
200
  # they are sent regardless of any catalog compilation failures or
@@ -210,13 +208,9 @@ class Puppet::Configurer
210
208
  completed = nil
211
209
  begin
212
210
  Puppet.override(:http_pool => pool) do
213
-
214
211
  # Skip failover logic if the server_list setting is empty
215
- if Puppet.settings[:server_list].nil? || Puppet.settings[:server_list].empty?
216
- do_failover = false
217
- else
218
- do_failover = true
219
- end
212
+ do_failover = Puppet.settings[:server_list] && !Puppet.settings[:server_list].empty?
213
+
220
214
  # When we are passed a catalog, that means we're in apply
221
215
  # mode. We shouldn't try to do any failover in that case.
222
216
  if options[:catalog].nil? && do_failover
@@ -224,8 +218,6 @@ class Puppet::Configurer
224
218
  if server.nil?
225
219
  raise Puppet::Error, _("Could not select a functional puppet master from server_list: '%{server_list}'") % { server_list: Puppet.settings.value(:server_list, Puppet[:environment].to_sym, true) }
226
220
  else
227
- #TRANSLATORS 'server_list' is the name of a setting and should not be translated
228
- Puppet.debug _("Selected puppet server from the `server_list` setting: %{server}:%{port}") % { server: server, port: port }
229
221
  report.master_used = "#{server}:#{port}"
230
222
  end
231
223
  Puppet.override(server: server, serverport: port) do
@@ -273,7 +265,7 @@ class Puppet::Configurer
273
265
 
274
266
  begin
275
267
  unless Puppet[:node_name_fact].empty?
276
- query_options = get_facts(options)
268
+ query_options, facts = get_facts(options)
277
269
  end
278
270
 
279
271
  configured_environment = Puppet[:environment] if Puppet.settings.set_by_config?(:environment)
@@ -306,6 +298,7 @@ class Puppet::Configurer
306
298
  @environment = node.environment.to_s
307
299
  report.environment = @environment
308
300
  query_options = nil
301
+ facts = nil
309
302
  else
310
303
  Puppet.info _("Using configured environment '%{env}'") % { env: @environment }
311
304
  end
@@ -330,11 +323,11 @@ class Puppet::Configurer
330
323
  :loaders => Puppet::Pops::Loaders.new(local_node_environment, true)
331
324
  }, "Local node environment for configurer transaction")
332
325
 
333
- query_options = get_facts(options) unless query_options
326
+ query_options, facts = get_facts(options) unless query_options
334
327
  query_options[:configured_environment] = configured_environment
335
328
  options[:convert_for_node] = node
336
329
 
337
- catalog = prepare_and_retrieve_catalog(cached_catalog, options, query_options)
330
+ catalog = prepare_and_retrieve_catalog(cached_catalog, facts, options, query_options)
338
331
  unless catalog
339
332
  return nil
340
333
  end
@@ -357,11 +350,11 @@ class Puppet::Configurer
357
350
  @environment = catalog.environment
358
351
  report.environment = @environment
359
352
 
360
- query_options = get_facts(options)
353
+ query_options, facts = get_facts(options)
361
354
  query_options[:configured_environment] = configured_environment
362
355
 
363
356
  # if we get here, ignore the cached catalog
364
- catalog = prepare_and_retrieve_catalog(nil, options, query_options)
357
+ catalog = prepare_and_retrieve_catalog(nil, facts, options, query_options)
365
358
  return nil unless catalog
366
359
  tries += 1
367
360
  end
@@ -373,7 +366,7 @@ class Puppet::Configurer
373
366
  else
374
367
  # REMIND @duration is the time spent loading the last catalog, and doesn't
375
368
  # account for things like we failed to download and fell back to the cache
376
- ral_catalog = convert_catalog(catalog, @duration, options)
369
+ ral_catalog = convert_catalog(catalog, @duration, facts, options)
377
370
 
378
371
  # If not noop, commit the cached resource catalog (not ral catalog). Ideally
379
372
  # we'd just copy the downloaded response body, instead of serializing the
@@ -418,21 +411,16 @@ class Puppet::Configurer
418
411
  private :run_internal
419
412
 
420
413
  def find_functional_server
421
- Puppet.settings[:server_list].each do |server|
422
- host = server[0]
423
- port = server[1] || Puppet[:masterport]
424
- begin
425
- ssl_context = Puppet.lookup(:ssl_context)
426
- http = Puppet::Network::HttpPool.connection(host, port.to_i, ssl_context: ssl_context)
427
- response = http.get('/status/v1/simple/master')
428
- return [host, port] if response.is_a?(Net::HTTPOK)
429
-
430
- Puppet.debug(_("Puppet server %{host}:%{port} is unavailable: %{code} %{reason}") %
431
- { host: host, port: port, code: response.code, reason: response.message })
432
- rescue => detail
433
- #TRANSLATORS 'server_list' is the name of a setting and should not be translated
434
- Puppet.debug _("Unable to connect to server from server_list setting: %{detail}") % {detail: detail}
435
- end
414
+ begin
415
+ session = Puppet.lookup(:http_session)
416
+ service = session.route_to(:puppet)
417
+ return [service.url.host, service.url.port]
418
+ rescue Puppet::HTTP::ResponseError => e
419
+ Puppet.debug(_("Puppet server %{host}:%{port} is unavailable: %{code} %{reason}") %
420
+ { host: e.response.url.host, port: e.response.url.port, code: e.response.code, reason: e.response.reason })
421
+ rescue => detail
422
+ #TRANSLATORS 'server_list' is the name of a setting and should not be translated
423
+ Puppet.debug _("Unable to connect to server from server_list setting: %{detail}") % {detail: detail}
436
424
  end
437
425
  [nil, nil]
438
426
  end
@@ -516,7 +504,7 @@ class Puppet::Configurer
516
504
  return nil
517
505
  end
518
506
 
519
- def retrieve_new_catalog(query_options)
507
+ def retrieve_new_catalog(facts, query_options)
520
508
  result = nil
521
509
  @duration = thinmark do
522
510
  result = Puppet::Resource::Catalog.indirection.find(
@@ -526,7 +514,8 @@ class Puppet::Configurer
526
514
  # don't update cache until after environment converges
527
515
  :ignore_cache_save => true,
528
516
  :environment => Puppet::Node::Environment.remote(@environment),
529
- :fail_on_404 => true
517
+ :fail_on_404 => true,
518
+ :facts_for_catalog => facts
530
519
  )
531
520
  )
532
521
  end