puppet 7.14.0 → 7.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/CODEOWNERS +1 -1
  3. data/Gemfile.lock +19 -19
  4. data/lib/puppet/application/lookup.rb +24 -28
  5. data/lib/puppet/configurer.rb +6 -2
  6. data/lib/puppet/defaults.rb +0 -1
  7. data/lib/puppet/functions/next.rb +18 -1
  8. data/lib/puppet/functions/tree_each.rb +0 -1
  9. data/lib/puppet/http/client.rb +1 -1
  10. data/lib/puppet/type/exec.rb +1 -1
  11. data/lib/puppet/util/monkey_patches.rb +0 -2
  12. data/lib/puppet/util.rb +1 -0
  13. data/lib/puppet/version.rb +1 -1
  14. data/man/man5/puppet.conf.5 +2 -2
  15. data/man/man8/puppet-agent.8 +1 -1
  16. data/man/man8/puppet-apply.8 +1 -1
  17. data/man/man8/puppet-catalog.8 +1 -1
  18. data/man/man8/puppet-config.8 +1 -1
  19. data/man/man8/puppet-describe.8 +1 -1
  20. data/man/man8/puppet-device.8 +1 -1
  21. data/man/man8/puppet-doc.8 +1 -1
  22. data/man/man8/puppet-epp.8 +1 -1
  23. data/man/man8/puppet-facts.8 +1 -1
  24. data/man/man8/puppet-filebucket.8 +1 -1
  25. data/man/man8/puppet-generate.8 +1 -1
  26. data/man/man8/puppet-help.8 +1 -1
  27. data/man/man8/puppet-lookup.8 +1 -1
  28. data/man/man8/puppet-module.8 +1 -1
  29. data/man/man8/puppet-node.8 +1 -1
  30. data/man/man8/puppet-parser.8 +1 -1
  31. data/man/man8/puppet-plugin.8 +1 -1
  32. data/man/man8/puppet-report.8 +1 -1
  33. data/man/man8/puppet-resource.8 +1 -1
  34. data/man/man8/puppet-script.8 +1 -1
  35. data/man/man8/puppet-ssl.8 +1 -1
  36. data/man/man8/puppet.8 +2 -2
  37. data/spec/integration/application/lookup_spec.rb +64 -59
  38. data/spec/integration/application/resource_spec.rb +6 -2
  39. data/spec/unit/configurer_spec.rb +34 -3
  40. data/spec/unit/confiner_spec.rb +6 -6
  41. data/spec/unit/util/windows_spec.rb +23 -0
  42. metadata +5 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0bfe9ca048650907403c807502ce029037bcf50e43509d2da8c4daad6087a143
4
- data.tar.gz: 402ea46ece628a86c88351d7c93e739456a584bb95a21e2e5a4790616d724ad8
3
+ metadata.gz: 236ffe679e7475017af27237b3584914e21fdc4c40640f1068b4f25a683b2b3c
4
+ data.tar.gz: e0ab738928ad2ff627eb22060064b02016fce0aa742eb0bd995d3cfbffd7ed2a
5
5
  SHA512:
6
- metadata.gz: a46e4c6e681a1a23fe68a22e8308d41d9016e658577298d998354c4f8410b79aa1666b39e5244f00e3e8b97baa8c9bfcf0dd15b6a1a19a7c80d71d2cdbb9e609
7
- data.tar.gz: 06add9d22b8a646a50caf987611b1a4b366477619c2681634cc21a38de36e540d8455993c572fd5f20616771361b7bad0b847bbbcd8cac28bc02a8de916ce81c
6
+ metadata.gz: a011343c68d88f25ec0ea67c2a47c74c826a67b1c354365c8d51d39ab3a08c622cc0f9ed631670b13fea35485467757be5aee34e1e94fcc4f579e862ec3040f1
7
+ data.tar.gz: 8b300a0eb554107049cf1d5fb2bc73c76e6bb4ebc24500c138da1b8dd4b0b945906231e8e3a3f97ee4f9dd8ce4913b5b944eae14dcd87296aafd05e126a950f1
data/CODEOWNERS CHANGED
@@ -1,5 +1,5 @@
1
1
  # defaults
2
- * @puppetlabs/phoenix @puppetlabs/puppetserver-maintainers @puppetlabs/night-s-watch
2
+ * @puppetlabs/phoenix @puppetlabs/puppetserver-maintainers
3
3
 
4
4
  # PAL
5
5
  /lib/puppet/pal @puppetlabs/bolt
data/Gemfile.lock CHANGED
@@ -1,11 +1,11 @@
1
1
  GIT
2
2
  remote: https://github.com/puppetlabs/packaging
3
- revision: 9d36e41d10ce14c66d9c3c35157788e63c1afef8
3
+ revision: 478623dd22de2de32bbb7b7c340a8d80c269c9f4
4
4
  branch: 1.0.x
5
5
  specs:
6
- packaging (0.105.0)
6
+ packaging (0.106.0.20.g478623d)
7
7
  apt_stage_artifacts
8
- artifactory (~> 2)
8
+ artifactory (~> 3)
9
9
  csv (= 3.1.5)
10
10
  rake (>= 12.3)
11
11
  release-metrics
@@ -13,7 +13,7 @@ GIT
13
13
  PATH
14
14
  remote: .
15
15
  specs:
16
- puppet (7.14.0)
16
+ puppet (7.15.0)
17
17
  CFPropertyList (~> 2.2)
18
18
  concurrent-ruby (~> 1.0)
19
19
  deep_merge (~> 1.0)
@@ -33,7 +33,7 @@ GEM
33
33
  public_suffix (>= 2.0.2, < 5.0)
34
34
  apt_stage_artifacts (0.10.1)
35
35
  docopt
36
- artifactory (2.8.2)
36
+ artifactory (3.0.15)
37
37
  ast (2.4.2)
38
38
  coderay (1.1.3)
39
39
  concurrent-ruby (1.1.9)
@@ -69,7 +69,7 @@ GEM
69
69
  memory_profiler (1.0.0)
70
70
  method_source (1.0.0)
71
71
  minitar (0.9)
72
- msgpack (1.4.2)
72
+ msgpack (1.4.5)
73
73
  multi_json (1.15.0)
74
74
  mustache (1.1.1)
75
75
  optimist (3.0.1)
@@ -83,7 +83,7 @@ GEM
83
83
  public_suffix (4.0.6)
84
84
  puppet-resource_api (1.8.14)
85
85
  hocon (>= 1.0)
86
- puppetserver-ca (2.3.5)
86
+ puppetserver-ca (2.3.6)
87
87
  facter (>= 2.0.1, < 5)
88
88
  racc (1.5.2)
89
89
  rainbow (2.2.2)
@@ -99,22 +99,22 @@ GEM
99
99
  hpricot (>= 0.8.2)
100
100
  mustache (>= 0.7.0)
101
101
  rdiscount (>= 1.5.8)
102
- rspec (3.10.0)
103
- rspec-core (~> 3.10.0)
104
- rspec-expectations (~> 3.10.0)
105
- rspec-mocks (~> 3.10.0)
106
- rspec-core (3.10.1)
107
- rspec-support (~> 3.10.0)
108
- rspec-expectations (3.10.2)
102
+ rspec (3.11.0)
103
+ rspec-core (~> 3.11.0)
104
+ rspec-expectations (~> 3.11.0)
105
+ rspec-mocks (~> 3.11.0)
106
+ rspec-core (3.11.0)
107
+ rspec-support (~> 3.11.0)
108
+ rspec-expectations (3.11.0)
109
109
  diff-lcs (>= 1.2.0, < 2.0)
110
- rspec-support (~> 3.10.0)
110
+ rspec-support (~> 3.11.0)
111
111
  rspec-its (1.3.0)
112
112
  rspec-core (>= 3.0.0)
113
113
  rspec-expectations (>= 3.0.0)
114
- rspec-mocks (3.10.2)
114
+ rspec-mocks (3.11.0)
115
115
  diff-lcs (>= 1.2.0, < 2.0)
116
- rspec-support (~> 3.10.0)
117
- rspec-support (3.10.3)
116
+ rspec-support (~> 3.11.0)
117
+ rspec-support (3.11.0)
118
118
  rubocop (0.49.1)
119
119
  parallel (~> 1.10)
120
120
  parser (>= 2.3.3.1, < 3.0)
@@ -174,4 +174,4 @@ DEPENDENCIES
174
174
  yard
175
175
 
176
176
  BUNDLED WITH
177
- 2.2.6
177
+ 2.3.8
@@ -373,38 +373,34 @@ Copyright (c) 2015 Puppet Inc., LLC Licensed under the Apache 2.0 License
373
373
  end
374
374
 
375
375
  unless node.is_a?(Puppet::Node) # to allow unit tests to pass a node instance
376
- facts = retrieve_node_facts(node, given_facts)
377
- if Puppet.settings.set_by_cli?('environment')
378
- node = Puppet::Node.new(node, :classes => nil, :parameters => nil, :facts => facts, :environment => Puppet.settings.value('environment'))
379
- else
380
- ni = Puppet::Node.indirection
381
- tc = ni.terminus_class
382
- if options[:compile]
383
- if tc == :plain
384
- node = ni.find(node, facts: facts)
385
- else
386
- begin
387
- service = Puppet.runtime[:http]
388
- session = service.create_session
389
- cert = session.route_to(:ca)
390
-
391
- _, x509 = cert.get_certificate(node)
392
- cert = OpenSSL::X509::Certificate.new(x509)
393
- Puppet::SSL::Oids.register_puppet_oids
394
- trusted = Puppet::Context::TrustedInformation.remote(true, facts.values['certname'] || node, Puppet::SSL::Certificate.from_instance(cert))
395
- Puppet.override(trusted_information: trusted) do
396
- node = ni.find(node, facts: facts)
397
- end
398
- rescue
399
- Puppet.warning _("CA is not available, the operation will continue without using trusted facts.")
376
+ facts = retrieve_node_facts(node, given_facts)
377
+ ni = Puppet::Node.indirection
378
+ tc = ni.terminus_class
379
+ if options[:compile] && !Puppet.settings.set_by_cli?('environment')
380
+ if tc == :plain
381
+ node = ni.find(node, facts: facts)
382
+ else
383
+ begin
384
+ service = Puppet.runtime[:http]
385
+ session = service.create_session
386
+ cert = session.route_to(:ca)
387
+
388
+ _, x509 = cert.get_certificate(node)
389
+ cert = OpenSSL::X509::Certificate.new(x509)
390
+ Puppet::SSL::Oids.register_puppet_oids
391
+ trusted = Puppet::Context::TrustedInformation.remote(true, facts.values['certname'] || node, Puppet::SSL::Certificate.from_instance(cert))
392
+ Puppet.override(trusted_information: trusted) do
400
393
  node = ni.find(node, facts: facts)
401
394
  end
395
+ rescue
396
+ Puppet.warning _("CA is not available, the operation will continue without using trusted facts.")
397
+ node = ni.find(node, facts: facts)
402
398
  end
403
- else
404
- ni.terminus_class = :plain
405
- node = ni.find(node, facts: facts)
406
- ni.terminus_class = tc
407
399
  end
400
+ else
401
+ ni.terminus_class = :plain
402
+ node = ni.find(node, facts: facts, environment: Puppet[:environment])
403
+ ni.terminus_class = tc
408
404
  end
409
405
  else
410
406
  node.add_extra_facts(given_facts) if given_facts
@@ -418,7 +418,7 @@ class Puppet::Configurer
418
418
  temp_value = options[:pluginsync]
419
419
 
420
420
  # only validate server environment if pluginsync is requested
421
- options[:pluginsync] = valid_server_environment? if options[:pluginsync] == true
421
+ options[:pluginsync] = valid_server_environment? if options[:pluginsync]
422
422
 
423
423
  query_options, facts = get_facts(options) unless query_options
424
424
  options[:pluginsync] = temp_value
@@ -531,7 +531,11 @@ class Puppet::Configurer
531
531
  true
532
532
  rescue Puppet::HTTP::ResponseError => detail
533
533
  if detail.response.code == 404
534
- Puppet.notice(_("Environment '%{environment}' not found on server, skipping initial pluginsync.") % { environment: @environment })
534
+ if Puppet[:strict_environment_mode]
535
+ raise Puppet::Error.new(_("Environment '%{environment}' not found on server, aborting run.") % { environment: @environment })
536
+ else
537
+ Puppet.notice(_("Environment '%{environment}' not found on server, skipping initial pluginsync.") % { environment: @environment })
538
+ end
535
539
  else
536
540
  Puppet.log_exception(detail, detail.message)
537
541
  end
@@ -1995,7 +1995,6 @@ EOT
1995
1995
  :hook => proc do |value|
1996
1996
  paths = value.split(File::PATH_SEPARATOR)
1997
1997
  facter = Puppet.runtime[:facter]
1998
- facter.reset
1999
1998
  facter.search(*paths)
2000
1999
  end
2001
2000
  }
@@ -1,8 +1,25 @@
1
1
  # Makes iteration continue with the next value, optionally with a given value for this iteration.
2
2
  # If a value is not given it defaults to `undef`
3
+ #
4
+ # @example Using the `next()` function
3
5
  #
4
- # @since 4.7.0
6
+ # ```puppet
7
+ # $data = ['a','b','c']
8
+ # $data.each |Integer $index, String $value| {
9
+ # if $index == 1 {
10
+ # next()
11
+ # }
12
+ # notice ("${index} = ${value}")
13
+ # }
14
+ # ```
15
+ #
16
+ # Would notice:
17
+ # ```
18
+ # Notice: Scope(Class[main]): 0 = a
19
+ # Notice: Scope(Class[main]): 2 = c
20
+ # ```
5
21
  #
22
+ # @since 4.7.0
6
23
  Puppet::Functions.create_function(:next) do
7
24
  dispatch :next_impl do
8
25
  optional_param 'Any', :value
@@ -112,7 +112,6 @@
112
112
  # * `reverse_each` - get "leaves before root"
113
113
  # * `filter` - prune the tree
114
114
  # * `map` - transform each element
115
- # * `reduce` - produce something else
116
115
  #
117
116
  # Note than when chaining, the value passed on is a `Tuple` with `[path, value]`.
118
117
  #
@@ -19,7 +19,7 @@
19
19
  # response = client.get(URI("http://www.example.com"))
20
20
  #
21
21
  # @example To make an HTTPS GET request, trusting the puppet CA and certs in Puppet's CA bundle:
22
- # response = client.get(URI("https://www.example.com"), include_system_store: true)
22
+ # response = client.get(URI("https://www.example.com"), options: { include_system_store: true })
23
23
  #
24
24
  # @example To use a URL containing special characters, such as spaces:
25
25
  # response = client.get(URI(Puppet::Util.uri_encode("https://www.example.com/path to file")))
@@ -457,7 +457,7 @@ module Puppet
457
457
 
458
458
  exec { '/bin/echo root >> /usr/lib/cron/cron.allow':
459
459
  path => '/usr/bin:/usr/sbin:/bin',
460
- unless => 'grep root /usr/lib/cron/cron.allow 2>/dev/null',
460
+ unless => 'grep ^root$ /usr/lib/cron/cron.allow 2>/dev/null',
461
461
  }
462
462
 
463
463
  This would add `root` to the cron.allow file (on Solaris) unless
@@ -79,8 +79,6 @@ unless Puppet::Util::Platform.jruby_fips?
79
79
  end
80
80
 
81
81
  if Puppet::Util::Platform.windows?
82
- require_relative '../../puppet/util/windows'
83
-
84
82
  class OpenSSL::X509::Store
85
83
  @puppet_certs_loaded = false
86
84
  alias __original_set_default_paths set_default_paths
data/lib/puppet/util.rb CHANGED
@@ -7,6 +7,7 @@ require 'uri'
7
7
  require 'pathname'
8
8
  require 'ostruct'
9
9
  require_relative 'util/platform'
10
+ require_relative 'util/windows'
10
11
  require_relative 'util/symbolic_file_mode'
11
12
  require_relative '../puppet/file_system/uniquefile'
12
13
  require 'securerandom'
@@ -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 = '7.14.0'
9
+ PUPPETVERSION = '7.15.0'
10
10
 
11
11
  ##
12
12
  # version is a public API method intended to always provide a fast and
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPETCONF" "5" "January 2022" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPETCONF" "5" "March 2022" "Puppet, Inc." "Puppet manual"
5
5
  \fBThis page is autogenerated; any changes will get overwritten\fR
6
6
  .
7
7
  .SH "Configuration settings"
@@ -929,7 +929,7 @@ The time to wait for data to be read from an HTTP connection\. If nothing is rea
929
929
  The HTTP User\-Agent string to send when making network requests\.
930
930
  .
931
931
  .IP "\(bu" 4
932
- \fIDefault\fR: \fBPuppet/7\.14\.0 Ruby/2\.7\.1\-p83 (x86_64\-linux)\fR
932
+ \fIDefault\fR: \fBPuppet/7\.15\.0 Ruby/2\.7\.5\-p203 (x86_64\-linux)\fR
933
933
  .
934
934
  .IP "" 0
935
935
  .
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-AGENT" "8" "January 2022" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-AGENT" "8" "March 2022" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-agent\fR \- The puppet agent daemon
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-APPLY" "8" "January 2022" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-APPLY" "8" "March 2022" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-apply\fR \- Apply Puppet manifests locally
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-CATALOG" "8" "January 2022" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-CATALOG" "8" "March 2022" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-catalog\fR \- Compile, save, view, and convert catalogs\.
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-CONFIG" "8" "January 2022" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-CONFIG" "8" "March 2022" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-config\fR \- Interact with Puppet\'s settings\.
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-DESCRIBE" "8" "January 2022" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-DESCRIBE" "8" "March 2022" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-describe\fR \- Display help about resource types
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-DEVICE" "8" "January 2022" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-DEVICE" "8" "March 2022" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-device\fR \- Manage remote network devices
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-DOC" "8" "January 2022" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-DOC" "8" "March 2022" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-doc\fR \- Generate Puppet references
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-EPP" "8" "January 2022" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-EPP" "8" "March 2022" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-epp\fR \- Interact directly with the EPP template parser/renderer\.
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-FACTS" "8" "January 2022" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-FACTS" "8" "March 2022" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-facts\fR \- Retrieve and store facts\.
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-FILEBUCKET" "8" "January 2022" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-FILEBUCKET" "8" "March 2022" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-filebucket\fR \- Store and retrieve files in a filebucket
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-GENERATE" "8" "January 2022" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-GENERATE" "8" "March 2022" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-generate\fR \- Generates Puppet code from Ruby definitions\.
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-HELP" "8" "January 2022" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-HELP" "8" "March 2022" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-help\fR \- Display Puppet help\.
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-LOOKUP" "8" "January 2022" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-LOOKUP" "8" "March 2022" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-lookup\fR \- Interactive Hiera lookup
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-MODULE" "8" "January 2022" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-MODULE" "8" "March 2022" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-module\fR \- Creates, installs and searches for modules on the Puppet Forge\.
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-NODE" "8" "January 2022" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-NODE" "8" "March 2022" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-node\fR \- View and manage node definitions\.
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-PARSER" "8" "January 2022" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-PARSER" "8" "March 2022" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-parser\fR \- Interact directly with the parser\.
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-PLUGIN" "8" "January 2022" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-PLUGIN" "8" "March 2022" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-plugin\fR \- Interact with the Puppet plugin system\.
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-REPORT" "8" "January 2022" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-REPORT" "8" "March 2022" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-report\fR \- Create, display, and submit reports\.
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-RESOURCE" "8" "January 2022" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-RESOURCE" "8" "March 2022" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-resource\fR \- The resource abstraction layer shell
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-SCRIPT" "8" "January 2022" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-SCRIPT" "8" "March 2022" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-script\fR \- Run a puppet manifests as a script without compiling a catalog
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-SSL" "8" "January 2022" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-SSL" "8" "March 2022" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-ssl\fR \- Manage SSL keys and certificates for puppet SSL clients
data/man/man8/puppet.8 CHANGED
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET" "8" "January 2022" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET" "8" "March 2022" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\fR
@@ -25,4 +25,4 @@ Specialized:
25
25
  catalog Compile, save, view, and convert catalogs\. describe Display help about resource types device Manage remote network devices doc Generate Puppet references epp Interact directly with the EPP template parser/renderer\. facts Retrieve and store facts\. filebucket Store and retrieve files in a filebucket generate Generates Puppet code from Ruby definitions\. node View and manage node definitions\. parser Interact directly with the parser\. plugin Interact with the Puppet plugin system\. script Run a puppet manifests as a script without compiling a catalog ssl Manage SSL keys and certificates for puppet SSL clients
26
26
  .
27
27
  .P
28
- See \'puppet help \fIsubcommand\fR \fIaction\fR\' for help on a specific subcommand action\. See \'puppet help \fIsubcommand\fR\' for help on a specific subcommand\. Puppet v7\.14\.0
28
+ See \'puppet help \fIsubcommand\fR \fIaction\fR\' for help on a specific subcommand action\. See \'puppet help \fIsubcommand\fR\' for help on a specific subcommand\. Puppet v7\.15\.0
@@ -7,7 +7,7 @@ describe 'lookup' do
7
7
  include PuppetSpec::Files
8
8
 
9
9
  context 'with an environment' do
10
- let(:fqdn) { Puppet.runtime[:facter].value(:fqdn) }
10
+ let(:fqdn) { Puppet[:certname] }
11
11
  let(:env_name) { 'spec' }
12
12
  let(:env_dir) { tmpdir('environments') }
13
13
  let(:environment_files) do
@@ -43,12 +43,10 @@ describe 'lookup' do
43
43
  end
44
44
 
45
45
  let(:app) { Puppet::Application[:lookup] }
46
- let(:env) { Puppet::Node::Environment.create(env_name.to_sym, [File.join(populated_env_dir, env_name, 'modules')]) }
47
- let(:environments) { Puppet::Environments::Directories.new(populated_env_dir, []) }
48
46
  let(:facts) { Puppet::Node::Facts.new("facts", {'my_fact' => 'my_fact_value'}) }
49
47
  let(:cert) { pem_content('oid.pem') }
50
48
 
51
- let(:node) { Puppet::Node.new('testnode', :facts => facts, :environment => env) }
49
+ let(:node) { Puppet::Node.new('testnode', :facts => facts) }
52
50
  let(:populated_env_dir) do
53
51
  dir_contained_in(env_dir, environment_files)
54
52
  env_dir
@@ -57,75 +55,72 @@ describe 'lookup' do
57
55
  before do
58
56
  stub_request(:get, "https://puppet:8140/puppet-ca/v1/certificate/#{fqdn}").to_return(body: cert)
59
57
  allow(Puppet::Node::Facts.indirection).to receive(:find).and_return(facts)
60
- end
61
58
 
62
- def lookup(key, options = {}, explain = false)
63
- key = [key] unless key.is_a?(Array)
64
- allow(app.command_line).to receive(:args).and_return(key)
65
- if explain
66
- app.options[:explain] = true
67
- app.options[:render_as] = :s
68
- else
69
- app.options[:render_as] = :json
70
- end
71
- options.each_pair { |k, v| app.options[k] = v }
72
- capture = StringIO.new
73
- saved_stdout = $stdout
74
- begin
75
- $stdout = capture
76
- expect { app.run_command }.to exit_with(0)
77
- ensure
78
- $stdout = saved_stdout
79
- end
80
- out = capture.string.strip
81
- if explain
82
- out
83
- else
84
- out.empty? ? nil : JSON.parse("[#{out}]")[0]
85
- end
86
- end
59
+ Puppet[:environment] = env_name
60
+ Puppet[:environmentpath] = populated_env_dir
87
61
 
88
- def explain(key, options = {})
89
- lookup(key, options, true)
62
+ http = Puppet::HTTP::Client.new(ssl_context: Puppet::SSL::SSLProvider.new.create_insecure_context)
63
+ Puppet.runtime[:http] = http
90
64
  end
91
65
 
92
- around(:each) do |example|
93
- Puppet.override(:environments => environments, :current_environment => env) do
94
- example.run
95
- end
66
+ def expect_lookup_with_output(exitcode, out)
67
+ expect { app.run }.to exit_with(exitcode).and output(out).to_stdout
96
68
  end
97
69
 
98
70
  it 'finds data in the environment' do
99
- expect(lookup('a')).to eql('value a')
71
+ app.command_line.args << 'a'
72
+ expect_lookup_with_output(0, /value a/)
100
73
  end
101
74
 
102
- it 'loads trusted information from the node certificate' do
103
- allow(Puppet).to receive(:override).and_call_original
104
- expect(Puppet).to receive(:override).with(trusted_information: an_object_having_attributes(
105
- certname: fqdn,
106
- extensions: { "1.3.6.1.4.1.34380.1.2.1.1" => "somevalue" }))
75
+ it "resolves hiera data using a top-level node parameter" do
76
+ File.write(File.join(env_dir, env_name, 'hiera.yaml'), <<~YAML)
77
+ ---
78
+ version: 5
79
+ hierarchy:
80
+ - name: "Per Node"
81
+ data_hash: yaml_data
82
+ path: "%{my_fact}.yaml"
83
+ YAML
84
+
85
+ File.write(File.join(env_dir, env_name, 'data', "my_fact_value.yaml"), <<~YAML)
86
+ ---
87
+ a: value from per node data
88
+ YAML
89
+
90
+ app.command_line.args << 'a'
91
+ expect_lookup_with_output(0, /--- value from per node data/)
92
+ end
107
93
 
94
+ it 'loads trusted information from the node certificate' do
108
95
  Puppet.settings[:node_terminus] = 'exec'
109
- expect_any_instance_of(Puppet::Node::Exec).to receive(:find).and_return(node)
110
- lookup('a', :compile => true)
96
+ expect_any_instance_of(Puppet::Node::Exec).to receive(:find) do |args|
97
+ info = Puppet.lookup(:trusted_information)
98
+ expect(info.certname).to eq(fqdn)
99
+ expect(info.extensions).to eq({ "1.3.6.1.4.1.34380.1.2.1.1" => "somevalue" })
100
+ end.and_return(node)
101
+
102
+ app.command_line.args << 'a' << '--compile'
103
+ expect_lookup_with_output(0, /--- value a/)
111
104
  end
112
105
 
113
106
  it 'loads external facts when running without --node' do
114
107
  expect(Puppet::Util).not_to receive(:skip_external_facts)
115
108
  expect(Facter).not_to receive(:load_external)
116
- lookup('a')
109
+
110
+ app.command_line.args << 'a'
111
+ expect_lookup_with_output(0, /--- value a/)
117
112
  end
118
113
 
119
114
  describe 'when using --node' do
120
115
  let(:fqdn) { 'random_node' }
121
116
 
122
117
  it 'skips loading of external facts' do
123
- app.options[:node] = fqdn
118
+ app.command_line.args << 'a' << '--node' << fqdn
124
119
 
125
120
  expect(Puppet::Node::Facts.indirection).to receive(:find).and_return(facts)
126
- expect(Facter).to receive(:load_external).once.with(false)
127
- expect(Facter).to receive(:load_external).once.with(true)
128
- lookup('a')
121
+ expect(Facter).to receive(:load_external).twice.with(false)
122
+ expect(Facter).to receive(:load_external).twice.with(true)
123
+ expect_lookup_with_output(0, /--- value a/)
129
124
  end
130
125
  end
131
126
 
@@ -133,29 +128,32 @@ describe 'lookup' do
133
128
  require 'puppet/indirector/node/exec'
134
129
  require 'puppet/indirector/node/plain'
135
130
 
136
- let(:node) { Puppet::Node.new('testnode', :facts => facts, :environment => env) }
131
+ let(:node) { Puppet::Node.new('testnode', :facts => facts) }
137
132
 
138
133
  it ':plain without --compile' do
139
134
  Puppet.settings[:node_terminus] = 'exec'
140
135
  expect_any_instance_of(Puppet::Node::Plain).to receive(:find).and_return(node)
141
136
  expect_any_instance_of(Puppet::Node::Exec).not_to receive(:find)
142
- expect(lookup('a')).to eql('value a')
137
+
138
+ app.command_line.args << 'a'
139
+ expect_lookup_with_output(0, /--- value a/)
143
140
  end
144
141
 
145
142
  it 'configured in Puppet settings with --compile' do
146
143
  Puppet.settings[:node_terminus] = 'exec'
147
144
  expect_any_instance_of(Puppet::Node::Plain).not_to receive(:find)
148
145
  expect_any_instance_of(Puppet::Node::Exec).to receive(:find).and_return(node)
149
- expect(lookup('a', :compile => true)).to eql('value a')
146
+
147
+ app.command_line.args << 'a' << '--compile'
148
+ expect_lookup_with_output(0, /--- value a/)
150
149
  end
151
150
  end
152
151
 
153
152
  context 'configured with the wrong environment' do
154
- let(:env) { Puppet::Node::Environment.create(env_name.to_sym, [File.join(populated_env_dir, env_name, 'modules')]) }
155
153
  it 'does not find data in non-existing environment' do
156
- Puppet.override(:environments => environments, :current_environment => 'someother') do
157
- expect(lookup('a', {}, true)).to match(/did not find a value for the name 'a'/)
158
- end
154
+ Puppet[:environment] = 'doesntexist'
155
+ app.command_line.args << 'a'
156
+ expect { app.run }.to raise_error(Puppet::Environments::EnvironmentNotFound, /Could not find a directory environment named 'doesntexist'/)
159
157
  end
160
158
  end
161
159
 
@@ -200,15 +198,22 @@ describe 'lookup' do
200
198
  end
201
199
 
202
200
  it 'finds data in the module' do
203
- expect(lookup('mod_a::b')).to eql('value mod_a::b (from mod_a)')
201
+ app.command_line.args << 'mod_a::b'
202
+ expect_lookup_with_output(0, /value mod_a::b \(from mod_a\)/)
204
203
  end
205
204
 
206
205
  it 'finds quoted keys in the module' do
207
- expect(lookup('"mod_a::a.quoted.key"')).to eql('value mod_a::a.quoted.key (from mod_a)')
206
+ app.command_line.args << "'mod_a::a.quoted.key'"
207
+ expect_lookup_with_output(0, /value mod_a::a.quoted.key \(from mod_a\)/)
208
208
  end
209
209
 
210
210
  it 'merges hashes from environment and module when merge strategy hash is used' do
211
- expect(lookup('mod_a::hash_a', :merge => 'hash')).to eql({'a' => 'value mod_a::hash_a.a (from environment)', 'b' => 'value mod_a::hash_a.b (from mod_a)'})
211
+ app.command_line.args << 'mod_a::hash_a' << '--merge' << 'hash'
212
+ expect_lookup_with_output(0, <<~END)
213
+ ---
214
+ a: value mod_a::hash_a.a (from environment)
215
+ b: value mod_a::hash_a.b (from mod_a)
216
+ END
212
217
  end
213
218
  end
214
219
  end
@@ -28,14 +28,18 @@ describe "puppet resource", unless: Puppet::Util::Platform.jruby? do
28
28
  end
29
29
 
30
30
  it 'lists types from the default environment' do
31
+ begin
31
32
  modulepath = File.join(Puppet[:codedir], 'modules', 'test', 'lib', 'puppet', 'type')
32
33
  FileUtils.mkdir_p(modulepath)
33
- File.write(File.join(modulepath, 'test.rb'), 'Puppet::Type.newtype(:test)')
34
+ File.write(File.join(modulepath, 'test_resource_spec.rb'), 'Puppet::Type.newtype(:test_resource_spec)')
34
35
  resource.command_line.args = ['--types']
35
36
 
36
37
  expect {
37
38
  resource.run
38
- }.to exit_with(0).and output(/test/).to_stdout
39
+ }.to exit_with(0).and output(/test_resource_spec/).to_stdout
40
+ ensure
41
+ Puppet::Type.rmtype(:test_resource_spec)
42
+ end
39
43
  end
40
44
  end
41
45
 
@@ -9,9 +9,6 @@ describe Puppet::Configurer do
9
9
  Puppet[:report] = true
10
10
 
11
11
  catalog.add_resource(resource)
12
- allow_any_instance_of(described_class).to(
13
- receive(:valid_server_environment?).and_return(true)
14
- )
15
12
 
16
13
  Puppet[:lastrunfile] = file_containing('last_run_summary.yaml', <<~SUMMARY)
17
14
  ---
@@ -78,10 +75,44 @@ describe Puppet::Configurer do
78
75
  end
79
76
  end
80
77
 
78
+ describe "when executing a catalog run without stubbing valid_server_environment?" do
79
+ before do
80
+ Puppet::Resource::Catalog.indirection.terminus_class = :rest
81
+ allow(Puppet::Resource::Catalog.indirection).to receive(:find).and_return(catalog)
82
+ end
83
+
84
+ it 'skips initial plugin sync if environment is not found and no strict_environment_mode' do
85
+ body = "{\"message\":\"Not Found: Could not find environment 'fasdfad'\",\"issue_kind\":\"RUNTIME_ERROR\"}"
86
+ stub_request(:get, %r{/puppet/v3/file_metadatas/plugins?}).to_return(
87
+ status: 404, body: body, headers: {'Content-Type' => 'application/json'}
88
+ )
89
+
90
+ configurer.run(:pluginsync => true)
91
+
92
+ expect(@logs).to include(an_object_having_attributes(level: :notice, message: %r{Environment 'production' not found on server, skipping initial pluginsync.}))
93
+ expect(@logs).to include(an_object_having_attributes(level: :notice, message: /Applied catalog in .* seconds/))
94
+ end
95
+
96
+ it 'if strict_environment_mode is set and environment is not found, aborts the puppet run' do
97
+ Puppet[:strict_environment_mode] = true
98
+ body = "{\"message\":\"Not Found: Could not find environment 'fasdfad'\",\"issue_kind\":\"RUNTIME_ERROR\"}"
99
+ stub_request(:get, %r{/puppet/v3/file_metadatas/plugins?}).to_return(
100
+ status: 404, body: body, headers: {'Content-Type' => 'application/json'}
101
+ )
102
+
103
+ configurer.run(:pluginsync => true)
104
+
105
+ expect(@logs).to include(an_object_having_attributes(level: :err, message: %r{Failed to apply catalog: Environment 'production' not found on server, aborting run.}))
106
+ end
107
+ end
108
+
81
109
  describe "when executing a catalog run" do
82
110
  before do
83
111
  Puppet::Resource::Catalog.indirection.terminus_class = :rest
84
112
  allow(Puppet::Resource::Catalog.indirection).to receive(:find).and_return(catalog)
113
+ allow_any_instance_of(described_class).to(
114
+ receive(:valid_server_environment?).and_return(true)
115
+ )
85
116
  end
86
117
 
87
118
  it "downloads plugins when told" do
@@ -3,6 +3,8 @@ require 'spec_helper'
3
3
  require 'puppet/confiner'
4
4
 
5
5
  describe Puppet::Confiner do
6
+ let(:coll) { Puppet::ConfineCollection.new('') }
7
+
6
8
  before do
7
9
  @object = Object.new
8
10
  @object.extend(Puppet::Confiner)
@@ -21,7 +23,6 @@ describe Puppet::Confiner do
21
23
  end
22
24
 
23
25
  it "should delegate its confine method to its confine collection" do
24
- coll = double('collection')
25
26
  allow(@object).to receive(:confine_collection).and_return(coll)
26
27
  expect(coll).to receive(:confine).with(:foo => :bar, :bee => :baz)
27
28
  @object.confine(:foo => :bar, :bee => :baz)
@@ -39,22 +40,21 @@ describe Puppet::Confiner do
39
40
 
40
41
  describe "when testing suitability" do
41
42
  before do
42
- @coll = double('collection')
43
- allow(@object).to receive(:confine_collection).and_return(@coll)
43
+ allow(@object).to receive(:confine_collection).and_return(coll)
44
44
  end
45
45
 
46
46
  it "should return true if the confine collection is valid" do
47
- expect(@coll).to receive(:valid?).and_return(true)
47
+ expect(coll).to receive(:valid?).and_return(true)
48
48
  expect(@object).to be_suitable
49
49
  end
50
50
 
51
51
  it "should return false if the confine collection is invalid" do
52
- expect(@coll).to receive(:valid?).and_return(false)
52
+ expect(coll).to receive(:valid?).and_return(false)
53
53
  expect(@object).not_to be_suitable
54
54
  end
55
55
 
56
56
  it "should return the summary of the confine collection if a long result is asked for" do
57
- expect(@coll).to receive(:summary).and_return("myresult")
57
+ expect(coll).to receive(:summary).and_return("myresult")
58
58
  expect(@object.suitable?(false)).to eq("myresult")
59
59
  end
60
60
  end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Puppet::Util::Windows do
6
+ %w[
7
+ ADSI
8
+ ADSI::ADSIObject
9
+ ADSI::User
10
+ ADSI::UserProfile
11
+ ADSI::Group
12
+ EventLog
13
+ File
14
+ Process
15
+ Registry
16
+ Service
17
+ SID
18
+ ].each do |name|
19
+ it "defines Puppet::Util::Windows::#{name}" do
20
+ expect(described_class.const_get(name)).to be
21
+ end
22
+ end
23
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.14.0
4
+ version: 7.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet Labs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-18 00:00:00.000000000 Z
11
+ date: 2022-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: facter
@@ -2498,6 +2498,7 @@ files:
2498
2498
  - spec/unit/util/windows/service_spec.rb
2499
2499
  - spec/unit/util/windows/sid_spec.rb
2500
2500
  - spec/unit/util/windows/string_spec.rb
2501
+ - spec/unit/util/windows_spec.rb
2501
2502
  - spec/unit/util/yaml_spec.rb
2502
2503
  - spec/unit/util_spec.rb
2503
2504
  - spec/unit/version_spec.rb
@@ -2537,7 +2538,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
2537
2538
  - !ruby/object:Gem::Version
2538
2539
  version: 1.3.1
2539
2540
  requirements: []
2540
- rubygems_version: 3.1.2
2541
+ rubygems_version: 3.1.6
2541
2542
  signing_key:
2542
2543
  specification_version: 4
2543
2544
  summary: Puppet, an automated configuration management tool
@@ -3757,6 +3758,7 @@ test_files:
3757
3758
  - spec/unit/util/windows/service_spec.rb
3758
3759
  - spec/unit/util/windows/sid_spec.rb
3759
3760
  - spec/unit/util/windows/string_spec.rb
3761
+ - spec/unit/util/windows_spec.rb
3760
3762
  - spec/unit/util/yaml_spec.rb
3761
3763
  - spec/unit/util_spec.rb
3762
3764
  - spec/unit/version_spec.rb