puppet 6.9.0 → 6.10.0

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

Potentially problematic release.


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

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0e29fb771008f2391db8072a7c609e3388d1941f07ce3726b1e4f46e224f419d
4
- data.tar.gz: 016e177050c07c41fbd16447c027d8353f5fe02bc9169b849e26d5a4be54d4ae
3
+ metadata.gz: 59f14a1638260b64116990632bc1e2e9f3bc9c9f67d6ac8e6d000364754eec95
4
+ data.tar.gz: 5653930e2713ccbfd33e67ae9d9e01694852cb98625a4411dfb43bdafaf5addd
5
5
  SHA512:
6
- metadata.gz: bd9d5695bbc4945aa90afe21df95b1b639ac049904e6595bdd9406e686a20eb0255773eed7476549c97a2aed29ee13cd4a1367705ec032e629addecc63ce6bf1
7
- data.tar.gz: d89df5ab8202cc7c44e53ecbb6a35eb14cbbaf77312d43b30b0cd97ddaca243141e6c0e8994f9d22aaadefe0a70f3aabdb7addd1720066a423b5c8a4206aae6a
6
+ metadata.gz: 3e897cb8963e9c4b71cfb3c781f77d99f43bd46ddfb34e29fb9924a53076ec3374b79063ff9cc62ba2c7d5caac172cbaffd6a9fd8d459b68632f00b439954e96
7
+ data.tar.gz: d7aef922b4b92835a505bf5d62b787c28e8054d752e3148cdf3b7fdd5956f5b38961798e61338c4585a0c39a5c70264af414c55e6e5ed848e91a6dfd345a693c
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- puppet (6.9.0)
4
+ puppet (6.10.0)
5
5
  CFPropertyList (~> 2.2)
6
6
  concurrent-ruby (~> 1.0)
7
7
  facter (>= 2.4.0, < 4)
@@ -64,7 +64,7 @@ GEM
64
64
  coderay (~> 1.1.0)
65
65
  method_source (~> 0.9.0)
66
66
  public_suffix (4.0.1)
67
- puppet-resource_api (1.8.6)
67
+ puppet-resource_api (1.8.7)
68
68
  hocon (>= 1.0)
69
69
  puppetserver-ca (1.4.0)
70
70
  facter (>= 2.0.1, < 4)
@@ -238,6 +238,10 @@ generated by running puppet agent with '--genconfig'.
238
238
  not start for another half hour).
239
239
 
240
240
  'puppet agent' exits after executing this.
241
+
242
+ * --evaltrace:
243
+ 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.)
244
+
241
245
 
242
246
  * --fingerprint:
243
247
  Display the current certificate or certificate signing request
@@ -291,6 +295,11 @@ generated by running puppet agent with '--genconfig'.
291
295
  Enable the most common options used for testing. These are 'onetime',
292
296
  'verbose', 'no-daemonize', 'no-usecacheonfailure', 'detailed-exitcodes',
293
297
  'no-splay', and 'show_diff'.
298
+
299
+ * --trace
300
+ 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.)
301
+
302
+
294
303
 
295
304
  * --verbose:
296
305
  Turn on verbose reporting.
@@ -315,10 +315,10 @@ Licensed under the Apache 2.0 License
315
315
  Puppet.info _("retrieving resource: %{resource} from %{target} at %{scheme}%{url_host}%{port}%{url_path}") % { resource: type, target: device.name, scheme: scheme, url_host: device_url.host, port: port, url_path: device_url.path }
316
316
  resources = find_resources(type, name)
317
317
  if options[:to_yaml]
318
- text = resources.map do |resource|
319
- resource.prune_parameters(:parameters_to_include => @extra_params).to_hierayaml.force_encoding(Encoding.default_external)
320
- end.join("\n")
321
- text.prepend("#{type.downcase}:\n")
318
+ data = resources.map do |resource|
319
+ resource.prune_parameters(:parameters_to_include => @extra_params).to_hiera_hash
320
+ end.inject(:merge!)
321
+ text = YAML.dump(type.downcase => data)
322
322
  else
323
323
  text = resources.map do |resource|
324
324
  resource.prune_parameters(:parameters_to_include => @extra_params).to_manifest.force_encoding(Encoding.default_external)
@@ -142,10 +142,10 @@ Copyright (c) 2011 Puppet Inc., LLC Licensed under the Apache 2.0 License
142
142
  resources = find_or_save_resources(type, name, params)
143
143
 
144
144
  if options[:to_yaml]
145
- text = resources.map do |resource|
146
- resource.prune_parameters(:parameters_to_include => @extra_params).to_hierayaml.force_encoding(Encoding.default_external)
147
- end.join("\n")
148
- text.prepend("#{type.downcase}:\n")
145
+ data = resources.map do |resource|
146
+ resource.prune_parameters(:parameters_to_include => @extra_params).to_hiera_hash
147
+ end.inject(:merge!)
148
+ text = YAML.dump(type.downcase => data)
149
149
  else
150
150
  text = resources.map do |resource|
151
151
  resource.prune_parameters(:parameters_to_include => @extra_params).to_manifest.force_encoding(Encoding.default_external)
@@ -1972,10 +1972,10 @@ EOT
1972
1972
  require 'puppet/node'
1973
1973
  require 'puppet/node/facts'
1974
1974
  if value
1975
- Puppet::Resource::Catalog.indirection.cache_class = :store_configs
1975
+ Puppet::Resource::Catalog.indirection.set_global_setting(:cache_class, :store_configs)
1976
1976
  Puppet.settings.override_default(:catalog_cache_terminus, :store_configs)
1977
- Puppet::Node::Facts.indirection.cache_class = :store_configs
1978
- Puppet::Resource.indirection.terminus_class = :store_configs
1977
+ Puppet::Node::Facts.indirection.set_global_setting(:cache_class, :store_configs)
1978
+ Puppet::Resource.indirection.set_global_setting(:terminus_class, :store_configs)
1979
1979
  end
1980
1980
  end
1981
1981
  },
@@ -1,12 +1,13 @@
1
+
2
+ require 'yaml'
1
3
  # The `yaml_data` is a hiera 5 `data_hash` data provider function.
2
4
  # See [the configuration guide documentation](https://puppet.com/docs/puppet/latest/hiera_config_yaml_5.html#configuring-a-hierarchy-level-built-in-backends) for
3
5
  # how to use this function.
4
6
  #
5
7
  # @since 4.8.0
6
8
  #
7
- require 'yaml'
8
-
9
9
  Puppet::Functions.create_function(:yaml_data) do
10
+ # @since 4.8.0
10
11
  dispatch :yaml_data do
11
12
  param 'Struct[{path=>String[1]}]', :options
12
13
  param 'Puppet::LookupContext', :context
@@ -24,8 +24,8 @@ module Puppet::Indirector
24
24
  indirection = Puppet::Indirector::Indirection.instance(indirection_name)
25
25
  raise _("Indirection %{indirection_name} does not exist") % { indirection_name: indirection_name } unless indirection
26
26
 
27
- indirection.terminus_class = terminus_name if terminus_name
28
- indirection.cache_class = cache_name if cache_name
27
+ indirection.set_global_setting(:terminus_class, terminus_name) if terminus_name
28
+ indirection.set_global_setting(:cache_class, cache_name) if cache_name
29
29
  end
30
30
  end
31
31
 
@@ -2,6 +2,7 @@ require 'puppet/util/docs'
2
2
  require 'puppet/util/profiler'
3
3
  require 'puppet/indirector/envelope'
4
4
  require 'puppet/indirector/request'
5
+ require 'puppet/thread_local'
5
6
 
6
7
  # The class that connects functional classes with their different collection
7
8
  # back-ends. Each indirection has a set of associated terminus classes,
@@ -45,11 +46,14 @@ class Puppet::Indirector::Indirection
45
46
  cache_class ? true : false
46
47
  end
47
48
 
48
- attr_reader :cache_class
49
+ def cache_class
50
+ @cache_class.value
51
+ end
52
+
49
53
  # Define a terminus class to be used for caching.
50
54
  def cache_class=(class_name)
51
55
  validate_terminus_class(class_name) if class_name
52
- @cache_class = class_name
56
+ @cache_class.value = class_name
53
57
  end
54
58
 
55
59
  # This is only used for testing.
@@ -101,10 +105,26 @@ class Puppet::Indirector::Indirection
101
105
  @indirected_class = indirected_class
102
106
  self.extend(extend) if extend
103
107
 
104
- # These setters depend on the indirection already being installed so they have to be at the end
105
- self.cache_class = cache_class if cache_class
106
- self.terminus_class = terminus_class if terminus_class
107
- self.terminus_setting = terminus_setting if terminus_setting
108
+ # Setting these depend on the indirection already being installed so they have to be at the end
109
+ set_global_setting(:cache_class, cache_class)
110
+ set_global_setting(:terminus_class, terminus_class)
111
+ set_global_setting(:terminus_setting, terminus_setting)
112
+ end
113
+
114
+ # Use this to set indirector settings globally across threads.
115
+ def set_global_setting(setting, value)
116
+ case setting
117
+ when :cache_class
118
+ validate_terminus_class(value) if !value.nil?
119
+ @cache_class = Puppet::ThreadLocal.new(value)
120
+ when :terminus_class
121
+ validate_terminus_class(value) if !value.nil?
122
+ @terminus_class = Puppet::ThreadLocal.new(value)
123
+ when :terminus_setting
124
+ @terminus_setting = Puppet::ThreadLocal.new(value)
125
+ else
126
+ raise(ArgumentError, _("The setting %{setting} is not a valid indirection setting.") % {setting: setting})
127
+ end
108
128
  end
109
129
 
110
130
  # Set up our request object.
@@ -120,12 +140,18 @@ class Puppet::Indirector::Indirection
120
140
  termini[terminus_name] ||= make_terminus(terminus_name)
121
141
  end
122
142
 
123
- # This can be used to select the terminus class.
124
- attr_accessor :terminus_setting
143
+ # These can be used to select the terminus class.
144
+ def terminus_setting
145
+ @terminus_setting.value
146
+ end
147
+
148
+ def terminus_setting=(setting)
149
+ @terminus_setting.value = setting
150
+ end
125
151
 
126
152
  # Determine the terminus class.
127
153
  def terminus_class
128
- unless @terminus_class
154
+ unless @terminus_class.value
129
155
  setting = self.terminus_setting
130
156
  if setting
131
157
  self.terminus_class = Puppet.settings[setting]
@@ -133,17 +159,17 @@ class Puppet::Indirector::Indirection
133
159
  raise Puppet::DevError, _("No terminus class nor terminus setting was provided for indirection %{name}") % { name: self.name}
134
160
  end
135
161
  end
136
- @terminus_class
162
+ @terminus_class.value
137
163
  end
138
164
 
139
165
  def reset_terminus_class
140
- @terminus_class = nil
166
+ @terminus_class.value = nil
141
167
  end
142
168
 
143
169
  # Specify the terminus class to use.
144
170
  def terminus_class=(klass)
145
171
  validate_terminus_class(klass)
146
- @terminus_class = klass
172
+ @terminus_class.value = klass
147
173
  end
148
174
 
149
175
  # This is used by terminus_class= and cache=.
@@ -87,9 +87,9 @@ Puppet::Type.type(:package).provide :pip, :parent => ::Puppet::Provider::Package
87
87
  end
88
88
 
89
89
  # Parse lines of output from `pip freeze`, which are structured as:
90
- # _package_==_version_
90
+ # _package_==_version_ or _package_===_version_
91
91
  def self.parse(line)
92
- if line.chomp =~ /^([^=]+)==([^=]+)$/
92
+ if line.chomp =~ /^([^=]+)===?([^=]+)$/
93
93
  {:ensure => $2, :name => $1, :provider => name}
94
94
  end
95
95
  end
@@ -432,6 +432,8 @@ class Puppet::Resource
432
432
  end
433
433
 
434
434
  # Convert our resource to yaml for Hiera purposes.
435
+ #
436
+ # @deprecated Use {to_hiera_hash} instead.
435
437
  def to_hierayaml
436
438
  # Collect list of attributes to align => and move ensure first
437
439
  attr = parameters.keys
@@ -451,6 +453,21 @@ class Puppet::Resource
451
453
  " %s:\n%s" % [self.title, attributes]
452
454
  end
453
455
 
456
+ # Convert our resource to a hiera hash suitable for serialization.
457
+ def to_hiera_hash
458
+ # to_data_hash converts to safe Data types, e.g. no symbols, unicode replacement character
459
+ h = to_data_hash
460
+
461
+ params = h['parameters'] || {}
462
+ value = params.delete('ensure')
463
+
464
+ res = {}
465
+ res['ensure'] = value if value
466
+ res.merge!(Hash[params.sort])
467
+
468
+ return { h['title'] => res }
469
+ end
470
+
454
471
  # Convert our resource to Puppet code.
455
472
  def to_manifest
456
473
  # Collect list of attributes to align => and move ensure first
@@ -21,8 +21,4 @@ else
21
21
  class Certificate; end
22
22
  end
23
23
  end
24
-
25
- Puppet::SSL::Certificate.indirection.terminus = :none
26
- Puppet::SSL::CertificateRequest.indirection.terminus = :none
27
- Puppet::SSL::Key.indirection.terminus = :none
28
24
  end
@@ -113,8 +113,8 @@ module Puppet::Test
113
113
  indirections = Puppet::Indirector::Indirection.send(:class_variable_get, :@@indirections)
114
114
  indirections.each do |indirector|
115
115
  $saved_indirection_state[indirector.name] = {
116
- :@terminus_class => indirector.instance_variable_get(:@terminus_class),
117
- :@cache_class => indirector.instance_variable_get(:@cache_class)
116
+ :@terminus_class => indirector.instance_variable_get(:@terminus_class).value,
117
+ :@cache_class => indirector.instance_variable_get(:@cache_class).value
118
118
  }
119
119
  end
120
120
 
@@ -172,7 +172,7 @@ module Puppet::Test
172
172
  indirections = Puppet::Indirector::Indirection.send(:class_variable_get, :@@indirections)
173
173
  indirections.each do |indirector|
174
174
  $saved_indirection_state.fetch(indirector.name, {}).each do |variable, value|
175
- indirector.instance_variable_set(variable, value)
175
+ indirector.instance_variable_get(variable).value = value
176
176
  end
177
177
  end
178
178
  $saved_indirection_state = nil
@@ -12,15 +12,27 @@ module Puppet
12
12
  * The command itself is already idempotent. (For example, `apt-get update`.)
13
13
  * The exec has an `onlyif`, `unless`, or `creates` attribute, which prevents
14
14
  Puppet from running the command unless some condition is met.
15
- * The exec has `refreshonly => true`, which only allows Puppet to run the
16
- command when some other resource is changed. (See the notes on refreshing
17
- below.)
15
+ * The exec has `refreshonly => true`, which allows Puppet to run the
16
+ command only when some other resource is changed. (See the notes on refreshing
17
+ below.)
18
+
19
+ The state managed by an `exec` resource represents whether the specified command
20
+ _needs to be_ executed during the catalog run. The target state is always that
21
+ the command does not need to be executed. If the initial state is that the
22
+ command _does_ need to be executed, then successfully executing the command
23
+ transitions it to the target state.
24
+
25
+ The `unless`, `onlyif`, and `creates` properties check the initial state of the
26
+ resource. If one or more of these properties is specified, the exec might not
27
+ need to run. If the exec does not need to run, then the system is already in
28
+ the target state. In such cases, the exec is considered successful without
29
+ actually executing its command.
18
30
 
19
31
  A caution: There's a widespread tendency to use collections of execs to
20
32
  manage resources that aren't covered by an existing resource type. This
21
33
  works fine for simple tasks, but once your exec pile gets complex enough
22
34
  that you really have to think to understand what's happening, you should
23
- consider developing a custom resource type instead, as it will be much
35
+ consider developing a custom resource type instead, as it is much
24
36
  more predictable and maintainable.
25
37
 
26
38
  **Duplication:** Even though `command` is the namevar, Puppet allows
@@ -31,30 +43,29 @@ module Puppet
31
43
  is non-standard, and can be affected by the `refresh` and
32
44
  `refreshonly` attributes:
33
45
 
34
- * If `refreshonly` is set to true, the exec will _only_ run when it receives an
46
+ * If `refreshonly` is set to true, the exec runs _only_ when it receives an
35
47
  event. This is the most reliable way to use refresh with execs.
36
- * If the exec already would have run and receives an event, it will run its
37
- command **up to two times.** (If an `onlyif`, `unless`, or `creates` condition
38
- is no longer met after the first run, the second run will not occur.)
39
- * If the exec already would have run, has a `refresh` command, and receives an
40
- event, it will run its normal command, then run its `refresh` command
41
- (as long as any `onlyif`, `unless`, or `creates` conditions are still met
42
- after the normal command finishes).
43
- * If the exec would **not** have run (due to an `onlyif`, `unless`, or `creates`
44
- attribute) and receives an event, it still will not run.
48
+ * If the exec has already run and then receives an event, it runs its
49
+ command **up to two times.** If an `onlyif`, `unless`, or `creates` condition
50
+ is no longer met after the first run, the second run does not occur.
51
+ * If the exec has already run, has a `refresh` command, and receives an
52
+ event, it runs its normal command. Then, if any `onlyif`, `unless`, or `creates`
53
+ conditions are still met, the exec runs its `refresh` command.
54
+ * If the exec has an `onlyif`, `unless`, or `creates` attribute that prevents it
55
+ from running, and it then receives an event, it still will not run.
45
56
  * If the exec has `noop => true`, would otherwise have run, and receives
46
- an event from a non-noop resource, it will run once (or run its `refresh`
47
- command instead, if it has one).
57
+ an event from a non-noop resource, it runs once. However, if it has a `refresh`
58
+ command, it runs that instead of its normal command.
48
59
 
49
60
  In short: If there's a possibility of your exec receiving refresh events,
50
- it becomes doubly important to make sure the run conditions are restricted.
61
+ it is extremely important to make sure the run conditions are restricted.
51
62
 
52
63
  **Autorequires:** If Puppet is managing an exec's cwd or the executable
53
64
  file used in an exec's command, the exec resource autorequires those
54
65
  files. If Puppet is managing the user that an exec should run as, the
55
- exec resource will autorequire that user."
66
+ exec resource autorequires that user."
56
67
 
57
- # Create a new check mechanism. It's basically just a parameter that
68
+ # Create a new check mechanism. It's basically a parameter that
58
69
  # provides one extra 'check' method.
59
70
  def self.newcheck(name, options = {}, &block)
60
71
  @checks ||= {}
@@ -35,7 +35,7 @@ module Puppet
35
35
  feature :refreshable, "The provider can restart the service.",
36
36
  :methods => [:restart]
37
37
 
38
- feature :enableable, "The provider can enable and disable the service",
38
+ feature :enableable, "The provider can enable and disable the service.",
39
39
  :methods => [:disable, :enable, :enabled?]
40
40
 
41
41
  feature :controllable, "The provider uses a control variable."
@@ -49,9 +49,9 @@ module Puppet
49
49
 
50
50
  newproperty(:enable, :required_features => :enableable) do
51
51
  desc "Whether a service should be enabled to start at boot.
52
- This property behaves quite differently depending on the platform;
52
+ This property behaves differently depending on the platform;
53
53
  wherever possible, it relies on local tools to enable or disable
54
- a given service."
54
+ a given service. Default values depend on the platform."
55
55
 
56
56
  newvalue(:true, :event => :service_enabled) do
57
57
  provider.enable
@@ -95,7 +95,7 @@ module Puppet
95
95
 
96
96
  # Handle whether the service should actually be running right now.
97
97
  newproperty(:ensure) do
98
- desc "Whether a service should be running."
98
+ desc "Whether a service should be running. Default values depend on the platform."
99
99
 
100
100
  newvalue(:stopped, :event => :service_stopped) do
101
101
  provider.stop
@@ -198,7 +198,7 @@ module Puppet::Util::HttpProxy
198
198
  headers.merge!({"Accept-Encoding" => Puppet::Network::HTTP::Compression::ACCEPT_ENCODING})
199
199
  end
200
200
 
201
- response = proxy.send(:head, current_uri.path, headers)
201
+ response = proxy.send(:head, current_uri, headers)
202
202
  Puppet.debug("HTTP HEAD request to #{current_uri} returned #{response.code} #{response.message}")
203
203
 
204
204
  if [301, 302, 307].include?(response.code.to_i)
@@ -209,9 +209,9 @@ module Puppet::Util::HttpProxy
209
209
 
210
210
  if method != :head
211
211
  if block_given?
212
- response = proxy.send("request_#{method}".to_sym, current_uri.path, headers, &block)
212
+ response = proxy.send("request_#{method}".to_sym, current_uri, headers, &block)
213
213
  else
214
- response = proxy.send(method, current_uri.path, headers)
214
+ response = proxy.send(method, current_uri, headers)
215
215
  end
216
216
 
217
217
  Puppet.debug("HTTP #{method.to_s.upcase} request to #{current_uri} returned #{response.code} #{response.message}")
@@ -41,7 +41,7 @@ module Puppet
41
41
  begin
42
42
  require 'openssl'
43
43
  false
44
- rescue LoadError
44
+ rescue LoadError, NameError
45
45
  true
46
46
  end
47
47
  else
@@ -6,7 +6,7 @@
6
6
  # Raketasks and such to set the version based on the output of `git describe`
7
7
 
8
8
  module Puppet
9
- PUPPETVERSION = '6.9.0'
9
+ PUPPETVERSION = '6.10.0'
10
10
 
11
11
  ##
12
12
  # version is a public API method intended to always provide a fast and