From 8255b92ac12558fa73b9ada07932f204fa48df93 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Thu, 18 Jun 2020 14:51:37 -0700 Subject: [PATCH 001/731] (PUP-3970) Remove wide string terminator workaround Ruby < 2.1 did not correctly handle multibyte terminators when allocating and resizing wide strings, causing data to be read past the end of the buffer. It was fixed in ruby 2.1.0[1], which we no longer support. Ruby < 2.4 did not correct handle multibyte terminators when transcoding strings, such as when calling `String#force_encoding('UTF-16')` and converting the binary string with a single null terminator to a wide string with a wide terminator. That was fixed in 2.4.0[2] and backported to 2.3 in [3], which is the minimum version we support. [1] https://github.com/ruby/ruby/commit/1549894a0699abdfab1fbba0e468afd3f2f990b3 [2] https://github.com/ruby/ruby/commit/f2ee22371b15411e818b23199161d1658ba08622 [3] https://github.com/ruby/ruby/commit/6f122a4f10512bb60795faa0021e498800a7f1b8 --- lib/puppet/util/windows/eventlog.rb | 9 ++------- lib/puppet/util/windows/string.rb | 9 ++------- spec/unit/util/windows/string_spec.rb | 4 +--- 3 files changed, 5 insertions(+), 17 deletions(-) diff --git a/lib/puppet/util/windows/eventlog.rb b/lib/puppet/util/windows/eventlog.rb index a10559a0005..2ad2332a5a7 100644 --- a/lib/puppet/util/windows/eventlog.rb +++ b/lib/puppet/util/windows/eventlog.rb @@ -126,13 +126,8 @@ def initialize(msg, code) def wide_string(str) # if given a nil string, assume caller wants to pass a nil pointer to win32 return nil if str.nil? - # ruby (< 2.1) does not respect multibyte terminators, so it is possible - # for a string to contain a single trailing null byte, followed by garbage - # causing buffer overruns. - # - # See http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?revision=41920&view=revision - newstr = str + "\0".encode(str.encoding) - newstr.encode!('UTF-16LE') + + str.encode('UTF-16LE') end # Private duplicate of Puppet::Util::Windows::ApiTypes::from_string_to_wide_string diff --git a/lib/puppet/util/windows/string.rb b/lib/puppet/util/windows/string.rb index 147c9291549..2c911ef27a5 100644 --- a/lib/puppet/util/windows/string.rb +++ b/lib/puppet/util/windows/string.rb @@ -4,13 +4,8 @@ module Puppet::Util::Windows::String def wide_string(str) # if given a nil string, assume caller wants to pass a nil pointer to win32 return nil if str.nil? - # ruby (< 2.1) does not respect multibyte terminators, so it is possible - # for a string to contain a single trailing null byte, followed by garbage - # causing buffer overruns. - # - # See http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?revision=41920&view=revision - newstr = str + "\0".encode(str.encoding) - newstr.encode!('UTF-16LE') + + str.encode('UTF-16LE') end module_function :wide_string end diff --git a/spec/unit/util/windows/string_spec.rb b/spec/unit/util/windows/string_spec.rb index 30d96a04333..1918fbf19c0 100644 --- a/spec/unit/util/windows/string_spec.rb +++ b/spec/unit/util/windows/string_spec.rb @@ -4,15 +4,13 @@ require 'puppet/util/windows' describe "Puppet::Util::Windows::String", :if => Puppet::Util::Platform.windows? do - UTF16_NULL = [0, 0] - def wide_string(str) Puppet::Util::Windows::String.wide_string(str) end def converts_to_wide_string(string_value) expected = string_value.encode(Encoding::UTF_16LE) - expected_bytes = expected.bytes.to_a + UTF16_NULL + expected_bytes = expected.bytes.to_a expect(wide_string(string_value).bytes.to_a).to eq(expected_bytes) end From 505298a2391a1c4e8311c9c5909fa6443ca6e9e5 Mon Sep 17 00:00:00 2001 From: gimmy Date: Thu, 23 Jul 2020 14:41:09 +0300 Subject: [PATCH 002/731] (PUP-10588) bump main version to 7.0.0 --- .gemspec | 2 +- lib/puppet/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gemspec b/.gemspec index 92a492d538d..8b6073a2989 100644 --- a/.gemspec +++ b/.gemspec @@ -13,7 +13,7 @@ Gem::Specification.new do |s| s.name = "puppet" - version = "6.18.0" + version = "7.0.0" mdata = version.match(/(\d+\.\d+\.\d+)/) s.version = mdata ? mdata[1] : version diff --git a/lib/puppet/version.rb b/lib/puppet/version.rb index d3abaf4be90..305bd09f51c 100644 --- a/lib/puppet/version.rb +++ b/lib/puppet/version.rb @@ -6,7 +6,7 @@ # Raketasks and such to set the version based on the output of `git describe` module Puppet - PUPPETVERSION = '6.18.0' + PUPPETVERSION = '7.0.0' ## # version is a public API method intended to always provide a fast and From b972f9749128f26988f05fb6d39a4681cfdfd76b Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Thu, 23 Jul 2020 16:43:45 +0000 Subject: [PATCH 003/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 2 +- man/man8/puppet.8 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index 36c81219b89..bfd26080b3e 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -923,7 +923,7 @@ The time to wait for data to be read from an HTTP connection\. If nothing is rea The HTTP User\-Agent string to send when making network requests\. . .IP "\(bu" 4 -\fIDefault\fR: Puppet/6\.18\.0 Ruby/2\.5\.1\-p57 (x86_64\-linux) +\fIDefault\fR: Puppet/7\.0\.0 Ruby/2\.5\.1\-p57 (x86_64\-linux) . .IP "" 0 . diff --git a/man/man8/puppet.8 b/man/man8/puppet.8 index b2fad796d70..9bc8b90fe0d 100644 --- a/man/man8/puppet.8 +++ b/man/man8/puppet.8 @@ -25,4 +25,4 @@ Specialized: 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 . .P -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 v6\.18\.0 +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\.0\.0 From 7a23b4ad82b343c37c2e34d76d6a5e4cd1da7307 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Wed, 29 Jul 2020 12:46:10 -0700 Subject: [PATCH 004/731] (PUP-10107) Remove vendored pathspec library The `puppet module build` command used to rely on pathspec to exclude files that matched patterns based on gitignore. That command was deleted in puppet 6, so remove the unused pathspec vendored code. --- lib/puppet/vendor/load_pathspec.rb | 1 - lib/puppet/vendor/pathspec/CHANGELOG.md | 2 - lib/puppet/vendor/pathspec/LICENSE | 201 ------------- lib/puppet/vendor/pathspec/PUPPET_README.md | 6 - lib/puppet/vendor/pathspec/README.md | 53 ---- lib/puppet/vendor/pathspec/lib/pathspec.rb | 122 -------- .../pathspec/lib/pathspec/gitignorespec.rb | 275 ------------------ .../vendor/pathspec/lib/pathspec/regexspec.rb | 17 -- .../vendor/pathspec/lib/pathspec/spec.rb | 14 - lib/puppet/vendor/require_vendored.rb | 1 - 10 files changed, 692 deletions(-) delete mode 100644 lib/puppet/vendor/load_pathspec.rb delete mode 100644 lib/puppet/vendor/pathspec/CHANGELOG.md delete mode 100644 lib/puppet/vendor/pathspec/LICENSE delete mode 100644 lib/puppet/vendor/pathspec/PUPPET_README.md delete mode 100644 lib/puppet/vendor/pathspec/README.md delete mode 100644 lib/puppet/vendor/pathspec/lib/pathspec.rb delete mode 100644 lib/puppet/vendor/pathspec/lib/pathspec/gitignorespec.rb delete mode 100644 lib/puppet/vendor/pathspec/lib/pathspec/regexspec.rb delete mode 100644 lib/puppet/vendor/pathspec/lib/pathspec/spec.rb diff --git a/lib/puppet/vendor/load_pathspec.rb b/lib/puppet/vendor/load_pathspec.rb deleted file mode 100644 index afdbc227928..00000000000 --- a/lib/puppet/vendor/load_pathspec.rb +++ /dev/null @@ -1 +0,0 @@ -$: << File.join([File.dirname(__FILE__), "pathspec/lib"]) diff --git a/lib/puppet/vendor/pathspec/CHANGELOG.md b/lib/puppet/vendor/pathspec/CHANGELOG.md deleted file mode 100644 index e4fe66d919a..00000000000 --- a/lib/puppet/vendor/pathspec/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -0.0.2: Misc. Windows/regex fixes. -0.0.1: Initial version. diff --git a/lib/puppet/vendor/pathspec/LICENSE b/lib/puppet/vendor/pathspec/LICENSE deleted file mode 100644 index e5583c184e6..00000000000 --- a/lib/puppet/vendor/pathspec/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ -Apache License - Version 2.0, January 2004 - https://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - https://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/lib/puppet/vendor/pathspec/PUPPET_README.md b/lib/puppet/vendor/pathspec/PUPPET_README.md deleted file mode 100644 index e7ceddec7fd..00000000000 --- a/lib/puppet/vendor/pathspec/PUPPET_README.md +++ /dev/null @@ -1,6 +0,0 @@ -Pathspec-ruby - Gitignore parsing in Ruby -============================================= - -Pathspec-ruby version 0.0.2 - -Copied from https://github.com/highb/pathspec-ruby/releases/tag/0.0.2 diff --git a/lib/puppet/vendor/pathspec/README.md b/lib/puppet/vendor/pathspec/README.md deleted file mode 100644 index f283f221f5a..00000000000 --- a/lib/puppet/vendor/pathspec/README.md +++ /dev/null @@ -1,53 +0,0 @@ -pathspec-ruby -============= - -Match Path Specifications, such as .gitignore, in Ruby! - -Follows .gitignore syntax defined on [gitscm](https://git-scm.com/docs/gitignore) - -.gitignore functionality ported from [Python pathspec](https://pypi.python.org/pypi/pathspec/0.2.2) by [@cpburnz](https://github.com/cpburnz/python-path-specification) - -[Travis Status](https://travis-ci.org/highb/pathspec-ruby) ![Travis CI Status](https://travis-ci.org/highb/pathspec-ruby.svg?branch=master) - -## Build/Install from Rubygems -```shell -gem install pathspec -``` - -## Usage -```ruby -require 'pathspec' - -# Create a .gitignore-style Pathspec by giving it newline separated gitignore -# lines, an array of gitignore lines, or any other enumable object that will -# give strings matching the .gitignore-style (File, etc.) -gitignore = Pathspec.new File.read('.gitignore', 'r') - -# Our .gitignore in this example contains: -# !**/important.txt -# abc/** - -# true, matches "abc/**" -gitignore.match 'abc/def.rb' - -# false, because it has been negated using the line "!**/important.txt" -gitignore.match 'abc/important.txt' - -# Give a path somewhere in the filesystem, and the Pathspec will return all -# matching files underneath. -# Returns ['/src/repo/abc/', '/src/repo/abc/123'] -gitignore.match_tree '/src/repo' - -# Give an enumerable of paths, and Pathspec will return the ones that match. -# Returns ['/abc/123', '/abc/'] -gitignore.match_paths ['/abc/123', '/abc/important.txt', '/abc/'] -``` - -## Building/Installing from Source -```shell -git clone git@github.com:highb/pathspec-ruby.git -cd pathspec-ruby && bash ./build_from_source.sh -``` - -## Contributing -Pull requests, bug reports, and feature requests welcome! :smile: I've tried to write exhaustive tests but who knows what cases I've missed. diff --git a/lib/puppet/vendor/pathspec/lib/pathspec.rb b/lib/puppet/vendor/pathspec/lib/pathspec.rb deleted file mode 100644 index 25546f7452e..00000000000 --- a/lib/puppet/vendor/pathspec/lib/pathspec.rb +++ /dev/null @@ -1,122 +0,0 @@ -require 'pathspec/gitignorespec' -require 'pathspec/regexspec' -require 'find' -require 'pathname' - -class PathSpec - attr_reader :specs - - def initialize(lines=nil, type=:git) - @specs = [] - - if lines - add(lines, type) - end - - self - end - - # Check if a path matches the pathspecs described - # Returns true if there are matches and none are excluded - # Returns false if there aren't matches or none are included - def match(path) - matches = specs_matching(path.to_s) - !matches.empty? && matches.all? {|m| m.inclusive?} - end - - def specs_matching(path) - @specs.select do |spec| - if spec.match(path) - spec - end - end - end - - # Check if any files in a given directory or subdirectories match the specs - # Returns matched paths or nil if no paths matched - def match_tree(root) - rootpath = Pathname.new(root) - matching = [] - - Find.find(root) do |path| - relpath = Pathname.new(path).relative_path_from(rootpath).to_s - relpath += '/' if File.directory? path - if match(relpath) - matching << path - end - end - - matching - end - - def match_path(path, root='/') - rootpath = Pathname.new(drive_letter_to_path(root)) - relpath = Pathname.new(drive_letter_to_path(path)).relative_path_from(rootpath).to_s - relpath = relpath + '/' if path[-1].chr == '/' - - match(relpath) - end - - def match_paths(paths, root='/') - matching = [] - - paths.each do |path| - if match_path(path, root) - matching << path - end - end - - matching - end - - def drive_letter_to_path(path) - path.gsub(/^([a-zA-Z]):\//, '/\1/') - end - - # Generate specs from a filename, such as a .gitignore - def self.from_filename(filename, type=:git) - # .gitignore is a UTF-8 file - self.from_lines(File.open(filename, 'r', :encoding => Encoding::UTF_8), type) - end - - def self.from_lines(lines, type=:git) - self.new lines, type - end - - # Generate specs from lines of text - def add(obj, type=:git) - spec_class = spec_type(type) - - if obj.respond_to?(:each_line) - obj.each_line do |l| - spec = spec_class.new(l.rstrip) - - if !spec.regex.nil? && !spec.inclusive?.nil? - @specs << spec - end - end - elsif obj.respond_to?(:each) - obj.each do |l| - add(l, type) - end - else - raise 'Cannot make Pathspec from non-string/non-enumerable object.' - end - - self - end - - def empty? - @specs.empty? - end - - def spec_type(type) - if type == :git - GitIgnoreSpec - elsif type == :regex - RegexSpec - else - raise "Unknown spec type #{type}" - end - end -end diff --git a/lib/puppet/vendor/pathspec/lib/pathspec/gitignorespec.rb b/lib/puppet/vendor/pathspec/lib/pathspec/gitignorespec.rb deleted file mode 100644 index c2bc13e01f9..00000000000 --- a/lib/puppet/vendor/pathspec/lib/pathspec/gitignorespec.rb +++ /dev/null @@ -1,275 +0,0 @@ -# encoding: utf-8 - -require 'pathspec/regexspec' - -class GitIgnoreSpec < RegexSpec - attr_reader :regex - - def initialize(pattern) - pattern = pattern.strip unless pattern.nil? - - # A pattern starting with a hash ('#') serves as a comment - # (neither includes nor excludes files). Escape the hash with a - # back-slash to match a literal hash (i.e., '\#'). - if pattern.start_with?('#') - @regex = nil - @inclusive = nil - - # A blank pattern is a null-operation (neither includes nor - # excludes files). - elsif pattern.empty? - @regex = nil - @inclusive = nil - - # Patterns containing three or more consecutive stars are invalid and - # will be ignored. - elsif pattern =~ /\*\*\*+/ - @regex = nil - @inclusive = nil - - # We have a valid pattern! - else - # A pattern starting with an exclamation mark ('!') negates the - # pattern (exclude instead of include). Escape the exclamation - # mark with a back-slash to match a literal exclamation mark - # (i.e., '\!'). - if pattern.start_with?('!') - @inclusive = false - # Remove leading exclamation mark. - pattern = pattern[1..-1] - else - @inclusive = true - end - - # Remove leading back-slash escape for escaped hash ('#') or - # exclamation mark ('!'). - if pattern.start_with?('\\') - pattern = pattern[1..-1] - end - - # Split pattern into segments. -1 to allow trailing slashes. - pattern_segs = pattern.split('/', -1) - - # Normalize pattern to make processing easier. - - # A pattern beginning with a slash ('/') will only match paths - # directly on the root directory instead of any descendant - # paths. So, remove empty first segment to make pattern relative - # to root. - if pattern_segs[0].empty? - pattern_segs.shift - else - # A pattern without a beginning slash ('/') will match any - # descendant path. This is equivalent to "**/{pattern}". So, - # prepend with double-asterisks to make pattern relative to - # root. - if pattern_segs.length == 1 && pattern_segs[0] != '**' - pattern_segs.insert(0, '**') - end - end - - # A pattern ending with a slash ('/') will match all descendant - # paths of if it is a directory but not if it is a regular file. - # This is equivalent to "{pattern}/**". So, set last segment to - # double asterisks to include all descendants. - if pattern_segs[-1].empty? - pattern_segs[-1] = '**' - end - - # Handle platforms with backslash separated paths - if File::SEPARATOR == '\\' - path_sep = '\\\\' - else - path_sep = '/' - end - - - # Build regular expression from pattern. - regex = '^' - need_slash = false - regex_end = pattern_segs.size - 1 - pattern_segs.each_index do |i| - seg = pattern_segs[i] - - if seg == '**' - # A pattern consisting solely of double-asterisks ('**') - # will match every path. - if i == 0 && i == regex_end - regex.concat('.+') - - # A normalized pattern beginning with double-asterisks - # ('**') will match any leading path segments. - elsif i == 0 - regex.concat("(?:.+#{path_sep})?") - need_slash = false - - # A normalized pattern ending with double-asterisks ('**') - # will match any trailing path segments. - elsif i == regex_end - regex.concat("#{path_sep}.*") - - # A pattern with inner double-asterisks ('**') will match - # multiple (or zero) inner path segments. - else - regex.concat("(?:#{path_sep}.+)?") - need_slash = true - end - - # Match single path segment. - elsif seg == '*' - if need_slash - regex.concat(path_sep) - end - - regex.concat("[^#{path_sep}]+") - need_slash = true - - else - # Match segment glob pattern. - if need_slash - regex.concat(path_sep) - end - - regex.concat(translate_segment_glob(seg)) - need_slash = true - end - end - - regex.concat('$') - super(regex) - end - end - - def match(path) - super(path) - end - - def translate_segment_glob(pattern) - """ - Translates the glob pattern to a regular expression. This is used in - the constructor to translate a path segment glob pattern to its - corresponding regular expression. - - *pattern* (``str``) is the glob pattern. - - Returns the regular expression (``str``). - """ - # NOTE: This is derived from `fnmatch.translate()` and is similar to - # the POSIX function `fnmatch()` with the `FNM_PATHNAME` flag set. - - escape = false - regex = '' - i = 0 - - while i < pattern.size - # Get next character. - char = pattern[i].chr - i += 1 - - # Escape the character. - if escape - escape = false - regex += Regexp.escape(char) - - # Escape character, escape next character. - elsif char == '\\' - escape = true - - # Multi-character wildcard. Match any string (except slashes), - # including an empty string. - elsif char == '*' - regex += '[^/]*' - - # Single-character wildcard. Match any single character (except - # a slash). - elsif char == '?' - regex += '[^/]' - - # Bracket expression wildcard. Except for the beginning - # exclamation mark, the whole bracket expression can be used - # directly as regex but we have to find where the expression - # ends. - # - "[][!]" matches ']', '[' and '!'. - # - "[]-]" matches ']' and '-'. - # - "[!]a-]" matches any character except ']', 'a' and '-'. - elsif char == '[' - j = i - # Pass brack expression negation. - if j < pattern.size && pattern[j].chr == '!' - j += 1 - end - - # Pass first closing bracket if it is at the beginning of the - # expression. - if j < pattern.size && pattern[j].chr == ']' - j += 1 - end - - # Find closing bracket. Stop once we reach the end or find it. - while j < pattern.size && pattern[j].chr != ']' - j += 1 - end - - - if j < pattern.size - expr = '[' - - # Bracket expression needs to be negated. - if pattern[i].chr == '!' - expr += '^' - i += 1 - - # POSIX declares that the regex bracket expression negation - # "[^...]" is undefined in a glob pattern. Python's - # `fnmatch.translate()` escapes the caret ('^') as a - # literal. To maintain consistency with undefined behavior, - # I am escaping the '^' as well. - elsif pattern[i].chr == '^' - expr += '\\^' - i += 1 - end - - # Escape brackets contained within pattern - if pattern[i].chr == ']' && i != j - expr += '\]' - i += 1 - end - - - # Build regex bracket expression. Escape slashes so they are - # treated as literal slashes by regex as defined by POSIX. - expr += pattern[i..j].sub('\\', '\\\\') - - # Add regex bracket expression to regex result. - regex += expr - - # Found end of bracket expression. Increment j to be one past - # the closing bracket: - # - # [...] - # ^ ^ - # i j - # - j += 1 - # Set i to one past the closing bracket. - i = j - - # Failed to find closing bracket, treat opening bracket as a - # bracket literal instead of as an expression. - else - regex += '\[' - end - - # Regular character, escape it for regex. - else - regex << Regexp.escape(char) - end - end - - regex - end - - def inclusive? - @inclusive - end -end diff --git a/lib/puppet/vendor/pathspec/lib/pathspec/regexspec.rb b/lib/puppet/vendor/pathspec/lib/pathspec/regexspec.rb deleted file mode 100644 index af043f4455b..00000000000 --- a/lib/puppet/vendor/pathspec/lib/pathspec/regexspec.rb +++ /dev/null @@ -1,17 +0,0 @@ -require 'pathspec/spec' - -class RegexSpec < Spec - def initialize(regex) - @regex = Regexp.compile regex - - super - end - - def inclusive? - true - end - - def match(path) - @regex.match(path) if @regex - end -end diff --git a/lib/puppet/vendor/pathspec/lib/pathspec/spec.rb b/lib/puppet/vendor/pathspec/lib/pathspec/spec.rb deleted file mode 100644 index 756588b1fe7..00000000000 --- a/lib/puppet/vendor/pathspec/lib/pathspec/spec.rb +++ /dev/null @@ -1,14 +0,0 @@ -class Spec - attr_reader :regex - - def initialize(*_) - end - - def match(files) - raise "Unimplemented" - end - - def inclusive? - true - end -end diff --git a/lib/puppet/vendor/require_vendored.rb b/lib/puppet/vendor/require_vendored.rb index 30ac7991f5a..12c1189c814 100644 --- a/lib/puppet/vendor/require_vendored.rb +++ b/lib/puppet/vendor/require_vendored.rb @@ -2,4 +2,3 @@ # Add one requirement per vendored package (or a comment if it is loaded on demand). # The vendored library 'rgen' is loaded on demand. -# The vendored library 'pathspec' is loaded on demand. From ea4c3a2f57794875d9c76dbb76b2183796765ddb Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Wed, 29 Jul 2020 13:18:34 -0700 Subject: [PATCH 005/731] (PUP-10490) Drop httpclient gem dependency We ended up not using the httpclient gem, drop it for now. --- .gemspec | 1 - ext/project_data.yaml | 1 - 2 files changed, 2 deletions(-) diff --git a/.gemspec b/.gemspec index 8b6073a2989..8d5f559a559 100644 --- a/.gemspec +++ b/.gemspec @@ -36,7 +36,6 @@ Gem::Specification.new do |s| s.add_runtime_dependency(%q, "~> 1.1") s.add_runtime_dependency(%q, "~> 2.1") s.add_runtime_dependency(%q, "~> 1.13") - s.add_runtime_dependency(%q, "~> 2.8") s.add_runtime_dependency(%q, "~> 1.0") s.add_runtime_dependency(%q, "~> 1.0") diff --git a/ext/project_data.yaml b/ext/project_data.yaml index 2190ee3a557..5cde3a2f961 100644 --- a/ext/project_data.yaml +++ b/ext/project_data.yaml @@ -23,7 +23,6 @@ gem_runtime_dependencies: fast_gettext: '~> 1.1' locale: '~> 2.1' multi_json: '~> 1.10' - httpclient: '~> 2.8' puppet-resource_api: '~>1.5' concurrent-ruby: '~> 1.0' deep_merge: '~> 1.0' From b638ce185ccb0f4563d011a87720759543faee6d Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Thu, 23 Jul 2020 10:51:22 -0700 Subject: [PATCH 006/731] (PUP-10442) Remove http file content terminus Puppet no longer uses the indirector to retrieve file content, because the indirector loads the entire file into memory. Remove the unused `http` file content terminus. --- lib/puppet/indirector/file_content/http.rb | 22 ---------------------- lib/puppet/indirector/generic_http.rb | 10 ---------- 2 files changed, 32 deletions(-) delete mode 100644 lib/puppet/indirector/file_content/http.rb diff --git a/lib/puppet/indirector/file_content/http.rb b/lib/puppet/indirector/file_content/http.rb deleted file mode 100644 index aa7c80af8f0..00000000000 --- a/lib/puppet/indirector/file_content/http.rb +++ /dev/null @@ -1,22 +0,0 @@ -require 'puppet/file_serving/metadata' -require 'puppet/indirector/generic_http' -require 'puppet/network/http' - -class Puppet::Indirector::FileContent::Http < Puppet::Indirector::GenericHttp - desc "Retrieve file contents from a remote HTTP server." - - include Puppet::FileServing::TerminusHelper - include Puppet::Network::HTTP::Compression.module - - @http_method = :get - - def initialize - Puppet.deprecation_warning(_("Puppet::Indirector::FileContent::Http is deprecated. Use Puppet::HTTP::Client instead.")) - super - end - - def find(request) - response = super - model.from_binary(uncompress_body(response)) - end -end diff --git a/lib/puppet/indirector/generic_http.rb b/lib/puppet/indirector/generic_http.rb index e797251db1b..248301aeae5 100644 --- a/lib/puppet/indirector/generic_http.rb +++ b/lib/puppet/indirector/generic_http.rb @@ -3,14 +3,4 @@ class Puppet::Indirector::GenericHttp < Puppet::Indirector::Terminus desc "Retrieve data from a remote HTTP server." - - class < Date: Thu, 23 Jul 2020 10:57:20 -0700 Subject: [PATCH 007/731] (PUP-10441) Remove HttpProxy.request_with_redirects The `request_with_redirects` method was copied from puppet's old Connection code and has a number of limitations: HTTPS connections don't trust the Puppet CA, it doesn't observe the `sourceaddress` setting (for multihomed hosts), it doesn't support relative URLs in the `Location` header, doesn't support basic authentication, and the streaming `request_xxx` methods handle errors & logging differently than their non-streaming counterparts. Remove the unused `request_with_redirects` and `get_http_object` methods. --- lib/puppet/util/http_proxy.rb | 79 ------------------------------- spec/unit/util/http_proxy_spec.rb | 67 -------------------------- 2 files changed, 146 deletions(-) diff --git a/lib/puppet/util/http_proxy.rb b/lib/puppet/util/http_proxy.rb index fdaab8c365f..8aa60b7fc99 100644 --- a/lib/puppet/util/http_proxy.rb +++ b/lib/puppet/util/http_proxy.rb @@ -135,83 +135,4 @@ def self.no_proxy return Puppet.settings[:no_proxy] end - - # Return a Net::HTTP::Proxy object. - # - # This method optionally configures SSL correctly if the URI scheme is - # 'https', including setting up the root certificate store so remote server - # SSL certificates can be validated. - # - # @param [URI] uri The URI that is to be accessed. - # @return [Net::HTTP::Proxy] object constructed tailored for the passed URI - def self.get_http_object(uri) - proxy = proxy(uri) - - if uri.scheme == 'https' - cert_store = OpenSSL::X509::Store.new - cert_store.set_default_paths - - proxy.use_ssl = true - proxy.verify_mode = OpenSSL::SSL::VERIFY_PEER - proxy.cert_store = cert_store - end - - if Puppet[:http_debug] - proxy.set_debug_output($stderr) - end - - proxy.open_timeout = Puppet[:http_connect_timeout] - proxy.read_timeout = Puppet[:http_read_timeout] - - proxy - end - - # Retrieve a document through HTTP(s), following redirects if necessary. The - # returned response body may be compressed, and it is the caller's - # responsibility to decompress it based on the 'content-encoding' header. - # - # Based on the the client implementation in the HTTP pool. - # - # @see Puppet::Network::HTTP::Connection#request_with_redirects - # - # @param [URI] uri The address of the resource to retrieve. - # @param [symbol] method The name of the Net::HTTP method to use, typically :get, :head, :post etc. - # @param [FixNum] redirect_limit The number of redirections that can be followed. - # @return [Net::HTTPResponse] a response object - def self.request_with_redirects(uri, method, redirect_limit = 10, &block) - current_uri = uri - response = nil - - 0.upto(redirect_limit) do |redirection| - proxy = get_http_object(current_uri) - - headers = { 'Accept' => '*/*', 'User-Agent' => Puppet[:http_user_agent] } - if Puppet.features.zlib? - headers["Accept-Encoding"] = Puppet::HTTP::ACCEPT_ENCODING - end - - response = proxy.send(:head, current_uri, headers) - Puppet.debug("HTTP HEAD request to #{current_uri} returned #{response.code} #{response.message}") - - if [301, 302, 307].include?(response.code.to_i) - # handle the redirection - current_uri = URI.parse(response['location']) - next - end - - if method != :head - if block_given? - response = proxy.send("request_#{method}".to_sym, current_uri, headers, &block) - else - response = proxy.send(method, current_uri, headers) - end - - Puppet.debug("HTTP #{method.to_s.upcase} request to #{current_uri} returned #{response.code} #{response.message}") - end - - return response - end - - raise RedirectionLimitExceededException, _("Too many HTTP redirections for %{uri}") % { uri: uri } - end end diff --git a/spec/unit/util/http_proxy_spec.rb b/spec/unit/util/http_proxy_spec.rb index b29e8d0d667..75a48b456f1 100644 --- a/spec/unit/util/http_proxy_spec.rb +++ b/spec/unit/util/http_proxy_spec.rb @@ -3,8 +3,6 @@ require 'puppet/util/http_proxy' describe Puppet::Util::HttpProxy do - include Puppet::Network::HTTP::Compression.module - before(:all) do ENV['http_proxy'] = nil ENV['HTTP_PROXY'] = nil @@ -346,69 +344,4 @@ def expects_proxy_connection_via(http, www, host, port, user, password) end end end - - describe '.request_with_redirects' do - let(:dest) { URI.parse('http://mydomain.com/some/path') } - - it 'generates accept and accept-encoding headers' do - stub_request(:head, dest) - - headers = { - 'Accept' => '*/*', - 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', - 'User-Agent' => /Puppet/ - } - stub_request(:get, dest).with(headers: headers) - - subject.request_with_redirects(dest, :get, 0) - end - - it 'can return a compressed response body' do - stub_request(:head, dest) - - compressed_body = [ - 0x1f, 0x8b, 0x08, 0x08, 0xe9, 0x08, 0x7a, 0x5a, 0x00, 0x03, - 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x00, 0xcb, 0xc8, 0xe4, 0x02, - 0x00, 0x7a, 0x7a, 0x6f, 0xed, 0x03, 0x00, 0x00, 0x00 - ].pack('C*') - - stub_request(:get, dest).to_return(status: 200, body: compressed_body, headers: { 'Content-Encoding' => 'gzip' }) - - expect( - uncompress_body(subject.request_with_redirects(dest, :get, 0)) - ).to eq("hi\n") - end - - it 'generates accept and accept-encoding headers when a block is provided' do - stub_request(:head, dest) - - headers = { - 'Accept' => '*/*', - 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', - 'User-Agent' => /Puppet/ - } - stub_request(:get, dest).with(headers: headers) - - subject.request_with_redirects(dest, :get, 0) do - # unused - end - end - - it 'only makes a single HEAD request' do - stub_request(:head, dest) - - subject.request_with_redirects(dest, :head, 0) - end - - it 'preserves query parameters' do - url = URI.parse('http://mydomain.com/some/path?foo=bar') - - stub_request(:head, url) - stub_request(:get, url) - - subject.request_with_redirects(url, :get, 0) do - # unused - end - end - end end From c53637db18c16972e1c31fac2c4fd455a8fe1b5e Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Thu, 23 Jul 2020 11:12:55 -0700 Subject: [PATCH 008/731] (PUP-10441) Move Puppet:Util::HttpProxy to Puppet::HTTP::Proxy Move the module to the `Puppet::HTTP` but still define the old constant to avoid breaking modules. --- lib/puppet/forge/repository.rb | 1 - lib/puppet/http.rb | 4 + lib/puppet/http/proxy.rb | 137 +++++++++++++++++ lib/puppet/indirector/generic_http.rb | 1 - lib/puppet/network/http/factory.rb | 4 +- lib/puppet/provider/package/pip.rb | 1 - lib/puppet/util/http_proxy.rb | 138 +----------------- .../http_proxy_spec.rb => http/proxy_spec.rb} | 4 +- spec/unit/network/http/factory_spec.rb | 3 +- 9 files changed, 148 insertions(+), 145 deletions(-) create mode 100644 lib/puppet/http/proxy.rb rename spec/unit/{util/http_proxy_spec.rb => http/proxy_spec.rb} (99%) diff --git a/lib/puppet/forge/repository.rb b/lib/puppet/forge/repository.rb index 5e66fb9fee1..50a91ba96b1 100644 --- a/lib/puppet/forge/repository.rb +++ b/lib/puppet/forge/repository.rb @@ -1,7 +1,6 @@ require 'puppet/ssl/openssl_loader' require 'digest/sha1' require 'uri' -require 'puppet/util/http_proxy' require 'puppet/forge' require 'puppet/forge/errors' require 'puppet/network/http' diff --git a/lib/puppet/http.rb b/lib/puppet/http.rb index 6bf4a87822d..b10687be101 100644 --- a/lib/puppet/http.rb +++ b/lib/puppet/http.rb @@ -1,4 +1,8 @@ module Puppet + module HTTP + require 'puppet/http/proxy' + end + module Network module HTTP require 'puppet/network/http/site' diff --git a/lib/puppet/http/proxy.rb b/lib/puppet/http/proxy.rb new file mode 100644 index 00000000000..d3fdaa7ca09 --- /dev/null +++ b/lib/puppet/http/proxy.rb @@ -0,0 +1,137 @@ +require 'uri' +require 'puppet/ssl/openssl_loader' + +module Puppet::HTTP::Proxy + def self.proxy(uri) + if http_proxy_host && !no_proxy?(uri) + Net::HTTP.new(uri.host, uri.port, self.http_proxy_host, self.http_proxy_port, self.http_proxy_user, self.http_proxy_password) + else + http = Net::HTTP.new(uri.host, uri.port, nil, nil, nil, nil) + # Net::HTTP defaults the proxy port even though we said not to + # use one. Set it to nil so caller is not surprised + http.proxy_port = nil + http + end + end + + def self.http_proxy_env + # Returns a URI object if proxy is set, or nil + proxy_env = ENV["http_proxy"] || ENV["HTTP_PROXY"] + begin + return URI.parse(proxy_env) if proxy_env + rescue URI::InvalidURIError + return nil + end + return nil + end + + # The documentation around the format of the no_proxy variable seems + # inconsistent. Some suggests the use of the * as a way of matching any + # hosts under a domain, e.g.: + # *.example.com + # Other documentation suggests that just a leading '.' indicates a domain + # level exclusion, e.g.: + # .example.com + # We'll accommodate both here. + def self.no_proxy?(dest) + no_proxy = self.no_proxy + unless no_proxy + return false + end + + unless dest.is_a? URI + begin + dest = URI.parse(dest) + rescue URI::InvalidURIError + return false + end + end + + no_proxy.split(/\s*,\s*/).each do |d| + host, port = d.split(':') + host = Regexp.escape(host).gsub('\*', '.*') + + #If this no_proxy entry specifies a port, we want to match it against + #the destination port. Otherwise just match hosts. + if port + no_proxy_regex = %r(#{host}:#{port}$) + dest_string = "#{dest.host}:#{dest.port}" + else + no_proxy_regex = %r(#{host}$) + dest_string = "#{dest.host}" + end + + if no_proxy_regex.match(dest_string) + return true + end + end + + return false + end + + def self.http_proxy_host + env = self.http_proxy_env + + if env and env.host + return env.host + end + + if Puppet.settings[:http_proxy_host] == 'none' + return nil + end + + return Puppet.settings[:http_proxy_host] + end + + def self.http_proxy_port + env = self.http_proxy_env + + if env and env.port + return env.port + end + + return Puppet.settings[:http_proxy_port] + end + + def self.http_proxy_user + env = self.http_proxy_env + + if env and env.user + return env.user + end + + if Puppet.settings[:http_proxy_user] == 'none' + return nil + end + + return Puppet.settings[:http_proxy_user] + end + + def self.http_proxy_password + env = self.http_proxy_env + + if env and env.password + return env.password + end + + if Puppet.settings[:http_proxy_user] == 'none' or Puppet.settings[:http_proxy_password] == 'none' + return nil + end + + return Puppet.settings[:http_proxy_password] + end + + def self.no_proxy + no_proxy_env = ENV["no_proxy"] || ENV["NO_PROXY"] + + if no_proxy_env + return no_proxy_env + end + + if Puppet.settings[:no_proxy] == 'none' + return nil + end + + return Puppet.settings[:no_proxy] + end +end diff --git a/lib/puppet/indirector/generic_http.rb b/lib/puppet/indirector/generic_http.rb index 248301aeae5..de96715b286 100644 --- a/lib/puppet/indirector/generic_http.rb +++ b/lib/puppet/indirector/generic_http.rb @@ -1,5 +1,4 @@ require 'puppet/file_serving/terminus_helper' -require 'puppet/util/http_proxy' class Puppet::Indirector::GenericHttp < Puppet::Indirector::Terminus desc "Retrieve data from a remote HTTP server." diff --git a/lib/puppet/network/http/factory.rb b/lib/puppet/network/http/factory.rb index 440304f0732..b836d1ba9bc 100644 --- a/lib/puppet/network/http/factory.rb +++ b/lib/puppet/network/http/factory.rb @@ -1,6 +1,6 @@ require 'puppet/ssl/openssl_loader' require 'net/http' -require 'puppet/util/http_proxy' +require 'puppet/http/proxy' # Factory for Net::HTTP objects. # @@ -25,7 +25,7 @@ def initialize def create_connection(site) Puppet.debug("Creating new connection for #{site}") - http = Puppet::Util::HttpProxy.proxy(URI(site.addr)) + http = Puppet::HTTP::Proxy.proxy(URI(site.addr)) http.use_ssl = site.use_ssl? http.read_timeout = Puppet[:http_read_timeout] http.open_timeout = Puppet[:http_connect_timeout] diff --git a/lib/puppet/provider/package/pip.rb b/lib/puppet/provider/package/pip.rb index 21d22df212b..09b3032355b 100644 --- a/lib/puppet/provider/package/pip.rb +++ b/lib/puppet/provider/package/pip.rb @@ -4,7 +4,6 @@ require 'puppet/util/package/version/pip' require 'puppet/util/package/version/range' require 'puppet/provider/package_targetable' -require 'puppet/util/http_proxy' Puppet::Type.type(:package).provide :pip, :parent => ::Puppet::Provider::Package::Targetable do diff --git a/lib/puppet/util/http_proxy.rb b/lib/puppet/util/http_proxy.rb index 8aa60b7fc99..d030d35a082 100644 --- a/lib/puppet/util/http_proxy.rb +++ b/lib/puppet/util/http_proxy.rb @@ -1,138 +1,4 @@ -require 'uri' -require 'puppet/ssl/openssl_loader' require 'puppet/http' -module Puppet::Util::HttpProxy - def self.proxy(uri) - if http_proxy_host && !no_proxy?(uri) - Net::HTTP.new(uri.host, uri.port, self.http_proxy_host, self.http_proxy_port, self.http_proxy_user, self.http_proxy_password) - else - http = Net::HTTP.new(uri.host, uri.port, nil, nil, nil, nil) - # Net::HTTP defaults the proxy port even though we said not to - # use one. Set it to nil so caller is not surprised - http.proxy_port = nil - http - end - end - - def self.http_proxy_env - # Returns a URI object if proxy is set, or nil - proxy_env = ENV["http_proxy"] || ENV["HTTP_PROXY"] - begin - return URI.parse(proxy_env) if proxy_env - rescue URI::InvalidURIError - return nil - end - return nil - end - - # The documentation around the format of the no_proxy variable seems - # inconsistent. Some suggests the use of the * as a way of matching any - # hosts under a domain, e.g.: - # *.example.com - # Other documentation suggests that just a leading '.' indicates a domain - # level exclusion, e.g.: - # .example.com - # We'll accommodate both here. - def self.no_proxy?(dest) - no_proxy = self.no_proxy - unless no_proxy - return false - end - - unless dest.is_a? URI - begin - dest = URI.parse(dest) - rescue URI::InvalidURIError - return false - end - end - - no_proxy.split(/\s*,\s*/).each do |d| - host, port = d.split(':') - host = Regexp.escape(host).gsub('\*', '.*') - - #If this no_proxy entry specifies a port, we want to match it against - #the destination port. Otherwise just match hosts. - if port - no_proxy_regex = %r(#{host}:#{port}$) - dest_string = "#{dest.host}:#{dest.port}" - else - no_proxy_regex = %r(#{host}$) - dest_string = "#{dest.host}" - end - - if no_proxy_regex.match(dest_string) - return true - end - end - - return false - end - - def self.http_proxy_host - env = self.http_proxy_env - - if env and env.host - return env.host - end - - if Puppet.settings[:http_proxy_host] == 'none' - return nil - end - - return Puppet.settings[:http_proxy_host] - end - - def self.http_proxy_port - env = self.http_proxy_env - - if env and env.port - return env.port - end - - return Puppet.settings[:http_proxy_port] - end - - def self.http_proxy_user - env = self.http_proxy_env - - if env and env.user - return env.user - end - - if Puppet.settings[:http_proxy_user] == 'none' - return nil - end - - return Puppet.settings[:http_proxy_user] - end - - def self.http_proxy_password - env = self.http_proxy_env - - if env and env.password - return env.password - end - - if Puppet.settings[:http_proxy_user] == 'none' or Puppet.settings[:http_proxy_password] == 'none' - return nil - end - - return Puppet.settings[:http_proxy_password] - end - - def self.no_proxy - no_proxy_env = ENV["no_proxy"] || ENV["NO_PROXY"] - - if no_proxy_env - return no_proxy_env - end - - if Puppet.settings[:no_proxy] == 'none' - return nil - end - - return Puppet.settings[:no_proxy] - end -end +# for backwards compatibility +Puppet::Util::HttpProxy = Puppet::HTTP::Proxy diff --git a/spec/unit/util/http_proxy_spec.rb b/spec/unit/http/proxy_spec.rb similarity index 99% rename from spec/unit/util/http_proxy_spec.rb rename to spec/unit/http/proxy_spec.rb index 75a48b456f1..f04a14b00f1 100644 --- a/spec/unit/util/http_proxy_spec.rb +++ b/spec/unit/http/proxy_spec.rb @@ -1,8 +1,8 @@ require 'uri' require 'spec_helper' -require 'puppet/util/http_proxy' +require 'puppet/http' -describe Puppet::Util::HttpProxy do +describe Puppet::HTTP::Proxy do before(:all) do ENV['http_proxy'] = nil ENV['HTTP_PROXY'] = nil diff --git a/spec/unit/network/http/factory_spec.rb b/spec/unit/network/http/factory_spec.rb index 73c39904706..13244adba4b 100644 --- a/spec/unit/network/http/factory_spec.rb +++ b/spec/unit/network/http/factory_spec.rb @@ -1,6 +1,5 @@ require 'spec_helper' -require 'puppet/network/http' -require 'puppet/util/http_proxy' +require 'puppet/http' describe Puppet::Network::HTTP::Factory do before(:all) do From 51c636bc340c43afc5b012abbcaf053050bd328d Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Thu, 30 Jul 2020 16:27:26 +0000 Subject: [PATCH 009/731] (packaging) Updating the puppet.pot file --- locales/puppet.pot | 106 ++++++++++++++++++++++----------------------- 1 file changed, 51 insertions(+), 55 deletions(-) diff --git a/locales/puppet.pot b/locales/puppet.pot index c1110a9e7e4..e7e5eba71e4 100644 --- a/locales/puppet.pot +++ b/locales/puppet.pot @@ -6,11 +6,11 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Puppet automation framework 6.16.0-141-g9bc4af5078\n" +"Project-Id-Version: Puppet automation framework 6.17.0-61-g8f9e413752\n" "\n" "Report-Msgid-Bugs-To: https://tickets.puppetlabs.com\n" -"POT-Creation-Date: 2020-07-08 11:31+0000\n" -"PO-Revision-Date: 2020-07-08 11:31+0000\n" +"POT-Creation-Date: 2020-07-30 16:27+0000\n" +"PO-Revision-Date: 2020-07-30 16:27+0000\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -44,7 +44,7 @@ msgstr "" msgid "Please supply a parameter to perform a Hiera lookup" msgstr "" -#: ../lib/hiera_puppet.rb:75 ../lib/puppet/indirector/hiera.rb:81 +#: ../lib/hiera_puppet.rb:75 ../lib/puppet/indirector/hiera.rb:85 msgid "Config file %{hiera_config} not found, using Hiera defaults" msgstr "" @@ -216,7 +216,7 @@ msgstr "" #. TRANSLATORS "puppet apply" is a program command and should not be translated #. TRANSLATORS "puppet apply" is a program command and should not be translated -#: ../lib/puppet/application/apply.rb:207 ../lib/puppet/application/apply.rb:322 +#: ../lib/puppet/application/apply.rb:207 ../lib/puppet/application/apply.rb:320 msgid "For puppet apply" msgstr "" @@ -224,27 +224,27 @@ msgstr "" msgid "%{file} is not readable" msgstr "" -#: ../lib/puppet/application/apply.rb:293 ../lib/puppet/application/script.rb:239 +#: ../lib/puppet/application/apply.rb:286 ../lib/puppet/application/script.rb:239 msgid "Exiting" msgstr "" -#: ../lib/puppet/application/apply.rb:332 +#: ../lib/puppet/application/apply.rb:330 msgid "Could not deserialize catalog from %{format}: %{detail}" msgstr "" -#: ../lib/puppet/application/apply.rb:353 ../lib/puppet/application/script.rb:144 +#: ../lib/puppet/application/apply.rb:351 ../lib/puppet/application/script.rb:144 msgid "Could not find facts for %{node}" msgstr "" -#: ../lib/puppet/application/apply.rb:365 ../lib/puppet/application/script.rb:152 +#: ../lib/puppet/application/apply.rb:363 ../lib/puppet/application/script.rb:152 msgid "Could not find node %{node}" msgstr "" -#: ../lib/puppet/application/apply.rb:378 ../lib/puppet/application/script.rb:137 +#: ../lib/puppet/application/apply.rb:376 ../lib/puppet/application/script.rb:137 msgid "Could not find file %{manifest}" msgstr "" -#: ../lib/puppet/application/apply.rb:379 +#: ../lib/puppet/application/apply.rb:377 msgid "Only one file can be applied per run. Skipping %{files}" msgstr "" @@ -717,15 +717,15 @@ msgstr "" msgid "Setting 'environment_data_provider' is deprecated." msgstr "" -#: ../lib/puppet/defaults.rb:828 +#: ../lib/puppet/defaults.rb:830 msgid "Certificate names must be lower case" msgstr "" -#: ../lib/puppet/defaults.rb:1022 +#: ../lib/puppet/defaults.rb:1024 msgid "Setting 'ssl_client_ca_auth' is deprecated." msgstr "" -#: ../lib/puppet/defaults.rb:1101 ../lib/puppet/settings/enum_setting.rb:13 ../lib/puppet/settings/symbolic_enum_setting.rb:14 +#: ../lib/puppet/defaults.rb:1103 ../lib/puppet/settings/enum_setting.rb:13 ../lib/puppet/settings/symbolic_enum_setting.rb:14 msgid "Invalid value '%{value}' for parameter %{name}. Allowed values are '%{allowed_values}'" msgstr "" @@ -1782,7 +1782,7 @@ msgstr "" msgid "Timeout waiting for exclusive lock on %{path}" msgstr "" -#: ../lib/puppet/file_system/jruby.rb:18 ../lib/puppet/file_system/windows.rb:127 ../lib/puppet/util.rb:705 +#: ../lib/puppet/file_system/jruby.rb:18 ../lib/puppet/file_system/windows.rb:127 ../lib/puppet/util.rb:706 msgid "Is a directory: %{directory}" msgstr "" @@ -2591,10 +2591,6 @@ msgstr "" msgid "Invalid checksum %{checksum}" msgstr "" -#: ../lib/puppet/indirector/file_content/http.rb:14 -msgid "Puppet::Indirector::FileContent::Http is deprecated. Use Puppet::HTTP::Client instead." -msgstr "" - #: ../lib/puppet/indirector/file_metadata/http.rb:31 msgid "cannot lookup multiple files" msgstr "" @@ -2608,12 +2604,12 @@ msgid "Could not find filesystem info for file '%{request}' in environment %{env msgstr "" #. TRANSLATORS "Hiera" is the name of a code library and should not be translated -#: ../lib/puppet/indirector/hiera.rb:8 +#: ../lib/puppet/indirector/hiera.rb:12 msgid "Hiera terminus not supported without hiera library" msgstr "" #. TRANSLATORS "merge" is a parameter name and should not be translated -#: ../lib/puppet/indirector/hiera.rb:68 +#: ../lib/puppet/indirector/hiera.rb:72 msgid "Unrecognized value for request 'merge' parameter: '%{merge}'" msgstr "" @@ -4163,7 +4159,7 @@ msgstr "" msgid "The 'disable_per_environment_manifest' setting is true, and the '%{env_name}' environment has an environment.conf manifest that conflicts with the 'default_manifest' setting." msgstr "" -#: ../lib/puppet/node/environment.rb:561 ../lib/puppet/pops/loaders.rb:300 +#: ../lib/puppet/node/environment.rb:561 ../lib/puppet/pops/loaders.rb:301 msgid "Could not parse for environment %{env}: %{detail}" msgstr "" @@ -4579,15 +4575,15 @@ msgstr "" msgid "Calling function_contain via the Scope class is deprecated. Use Scope#call_function instead" msgstr "" -#: ../lib/puppet/parser/functions/create_resources.rb:56 +#: ../lib/puppet/parser/functions/create_resources.rb:60 msgid "create_resources(): wrong number of arguments (%{count}; must be 2 or 3)" msgstr "" -#: ../lib/puppet/parser/functions/create_resources.rb:57 +#: ../lib/puppet/parser/functions/create_resources.rb:61 msgid "create_resources(): second argument must be a hash" msgstr "" -#: ../lib/puppet/parser/functions/create_resources.rb:59 +#: ../lib/puppet/parser/functions/create_resources.rb:63 msgid "create_resources(): third argument, if provided, must be a hash" msgstr "" @@ -5918,19 +5914,19 @@ msgstr "" msgid "Attempt to redefine already initialized loaders for environment" msgstr "" -#: ../lib/puppet/pops/loaders.rb:176 +#: ../lib/puppet/pops/loaders.rb:177 msgid "Internal Error: Puppet Context ':loaders' missing" msgstr "" -#: ../lib/puppet/pops/loaders.rb:190 +#: ../lib/puppet/pops/loaders.rb:191 msgid "Unable to find loader named '%{loader_name}'" msgstr "" -#: ../lib/puppet/pops/loaders.rb:211 +#: ../lib/puppet/pops/loaders.rb:212 msgid "Internal Error: did not find public loader for module: '%{module_name}'" msgstr "" -#: ../lib/puppet/pops/loaders.rb:257 +#: ../lib/puppet/pops/loaders.rb:258 msgid "Internal Error: Attempt to redefine loader named '%{name}'" msgstr "" @@ -6794,19 +6790,19 @@ msgstr "" msgid "Mac OS X packages must specify a package source" msgstr "" -#: ../lib/puppet/provider/package/apt.rb:47 +#: ../lib/puppet/provider/package/apt.rb:81 msgid "/etc/apt/sources.list contains a cdrom source; not installing. Use 'allowcdrom' to override this failure." msgstr "" -#: ../lib/puppet/provider/package/apt.rb:129 ../lib/puppet/provider/package/fink.rb:55 +#: ../lib/puppet/provider/package/apt.rb:163 ../lib/puppet/provider/package/fink.rb:55 msgid "Could not find latest version" msgstr "" -#: ../lib/puppet/provider/package/apt.rb:140 ../lib/puppet/provider/package/fink.rb:66 +#: ../lib/puppet/provider/package/apt.rb:174 ../lib/puppet/provider/package/fink.rb:66 msgid "Preseeding %{response} to debconf-set-selections" msgstr "" -#: ../lib/puppet/provider/package/apt.rb:144 ../lib/puppet/provider/package/fink.rb:70 +#: ../lib/puppet/provider/package/apt.rb:178 ../lib/puppet/provider/package/fink.rb:70 msgid "No responsefile specified or non existent, not preseeding anything" msgstr "" @@ -6858,27 +6854,27 @@ msgstr "" msgid "source is defined but does not have trailing slash, ignoring %{source}" msgstr "" -#: ../lib/puppet/provider/package/gem.rb:100 +#: ../lib/puppet/provider/package/gem.rb:102 msgid "Could not list gems: %{detail}" msgstr "" -#: ../lib/puppet/provider/package/gem.rb:126 +#: ../lib/puppet/provider/package/gem.rb:128 msgid "Could not match %{desc}" msgstr "" -#: ../lib/puppet/provider/package/gem.rb:204 +#: ../lib/puppet/provider/package/gem.rb:206 msgid "Invalid source '%{uri}': %{detail}" msgstr "" -#: ../lib/puppet/provider/package/gem.rb:215 +#: ../lib/puppet/provider/package/gem.rb:217 msgid "puppet:// URLs are not supported as gem sources" msgstr "" -#: ../lib/puppet/provider/package/gem.rb:231 +#: ../lib/puppet/provider/package/gem.rb:233 msgid "Could not install: %{output}" msgstr "" -#: ../lib/puppet/provider/package/gem.rb:257 +#: ../lib/puppet/provider/package/gem.rb:259 msgid "Could not uninstall: %{output}" msgstr "" @@ -8979,70 +8975,70 @@ msgstr "" msgid "Class name must be provided." msgstr "" -#: ../lib/puppet/util.rb:63 +#: ../lib/puppet/util.rb:64 msgid "Unable to retrieve the environment for mode %{mode}" msgstr "" -#: ../lib/puppet/util.rb:80 +#: ../lib/puppet/util.rb:81 msgid "Unable to clear the environment for mode %{mode}" msgstr "" -#: ../lib/puppet/util.rb:96 +#: ../lib/puppet/util.rb:97 msgid "Unable to set the environment variable %{name} for mode %{mode}" msgstr "" -#: ../lib/puppet/util.rb:113 +#: ../lib/puppet/util.rb:114 msgid "Unable to merge given values into the current environment for mode %{mode}" msgstr "" -#: ../lib/puppet/util.rb:155 +#: ../lib/puppet/util.rb:156 msgid "could not change to group %{group}: %{detail}" msgstr "" -#: ../lib/puppet/util.rb:156 +#: ../lib/puppet/util.rb:157 msgid "could not change to group %{group}" msgstr "" -#: ../lib/puppet/util.rb:169 +#: ../lib/puppet/util.rb:170 msgid "Could not change to user %{user}: %{detail}" msgstr "" #. TRANSLATORS 'benchmark' is a method name and should not be translated -#: ../lib/puppet/util.rb:223 +#: ../lib/puppet/util.rb:224 msgid "Failed to provide level to benchmark" msgstr "" -#: ../lib/puppet/util.rb:226 +#: ../lib/puppet/util.rb:227 msgid "Benchmarked object does not respond to %{value}" msgstr "" #. TRANSLATORS PATH and HOME are environment variables and should not be translated -#: ../lib/puppet/util.rb:266 +#: ../lib/puppet/util.rb:267 msgid "PATH contains a ~ character, and HOME is not set; ignoring PATH element '%{dir}'." msgstr "" #. TRANSLATORS PATH is an environment variable and should not be translated -#: ../lib/puppet/util.rb:270 +#: ../lib/puppet/util.rb:271 msgid "Couldn't expand PATH containing a ~ character; ignoring PATH element '%{dir}'." msgstr "" -#: ../lib/puppet/util.rb:317 +#: ../lib/puppet/util.rb:318 msgid "unknown platform %{platform} in absolute_path" msgstr "" -#: ../lib/puppet/util.rb:352 +#: ../lib/puppet/util.rb:353 msgid "Failed to convert '%{path}' to URI: %{detail}" msgstr "" -#: ../lib/puppet/util.rb:452 +#: ../lib/puppet/util.rb:453 msgid "path may not be nil" msgstr "" -#: ../lib/puppet/util.rb:620 +#: ../lib/puppet/util.rb:621 msgid "replace_file requires a block" msgstr "" -#: ../lib/puppet/util.rb:624 +#: ../lib/puppet/util.rb:625 msgid "replace_file default_mode: %{default_mode} is invalid" msgstr "" From 97183afcff739f78912b59843e925e6b1350ded4 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Fri, 31 Jul 2020 14:59:03 +0000 Subject: [PATCH 010/731] (packaging) Updating the puppet.pot file --- locales/puppet.pot | 63 ++++++++++++++++++++++++++-------------------- 1 file changed, 36 insertions(+), 27 deletions(-) diff --git a/locales/puppet.pot b/locales/puppet.pot index e7e5eba71e4..7c1fedfcfb6 100644 --- a/locales/puppet.pot +++ b/locales/puppet.pot @@ -6,11 +6,11 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Puppet automation framework 6.17.0-61-g8f9e413752\n" +"Project-Id-Version: Puppet automation framework 6.17.0-111-g4171555d21\n" "\n" "Report-Msgid-Bugs-To: https://tickets.puppetlabs.com\n" -"POT-Creation-Date: 2020-07-30 16:27+0000\n" -"PO-Revision-Date: 2020-07-30 16:27+0000\n" +"POT-Creation-Date: 2020-07-31 14:58+0000\n" +"PO-Revision-Date: 2020-07-31 14:58+0000\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -638,7 +638,11 @@ msgstr "" msgid "Retrieving %{name}" msgstr "" -#: ../lib/puppet/configurer/downloader.rb:20 +#: ../lib/puppet/configurer/downloader.rb:21 +msgid "Failed to retrieve %{name}: %{detail}" +msgstr "" + +#: ../lib/puppet/configurer/downloader.rb:32 msgid "Could not retrieve %{name}: %{detail}" msgstr "" @@ -729,6 +733,11 @@ msgstr "" msgid "Invalid value '%{value}' for parameter %{name}. Allowed values are '%{allowed_values}'" msgstr "" +#. TRANSLATORS 'pluginsync' is a setting and should not be translated +#: ../lib/puppet/defaults.rb:1969 +msgid "Setting 'pluginsync' is deprecated." +msgstr "" + #: ../lib/puppet/error.rb:77 msgid "Could not parse for environment %{environment}: %{message}" msgstr "" @@ -3203,11 +3212,11 @@ msgid "Loaded puppet/type/%{name} but no class was created" msgstr "" #. TRANSLATORS 'metadata.json' is a specific file name and should not be translated. -#: ../lib/puppet/module.rb:222 +#: ../lib/puppet/module.rb:221 msgid "%{name} has an invalid and unparsable metadata.json file. The parse error: %{error}" msgstr "" -#: ../lib/puppet/module.rb:468 +#: ../lib/puppet/module.rb:467 msgid "" " Invalid module name '%{name}'; module names must match either:\n" " An installed module name (ex. modulename) matching the expression /^[a-z][a-z0-9_]*$/ -or-\n" @@ -4159,7 +4168,7 @@ msgstr "" msgid "The 'disable_per_environment_manifest' setting is true, and the '%{env_name}' environment has an environment.conf manifest that conflicts with the 'default_manifest' setting." msgstr "" -#: ../lib/puppet/node/environment.rb:561 ../lib/puppet/pops/loaders.rb:301 +#: ../lib/puppet/node/environment.rb:562 ../lib/puppet/pops/loaders.rb:301 msgid "Could not parse for environment %{env}: %{detail}" msgstr "" @@ -5945,23 +5954,23 @@ msgstr "" msgid "Unknown Explain type %{qualifier_type}" msgstr "" -#: ../lib/puppet/pops/lookup/hiera_config.rb:85 +#: ../lib/puppet/pops/lookup/hiera_config.rb:86 msgid "Using of legacy data provider function '%{function_name}'. Please convert to a 'data_hash' function" msgstr "" -#: ../lib/puppet/pops/lookup/hiera_config.rb:142 +#: ../lib/puppet/pops/lookup/hiera_config.rb:143 msgid "%{config_path}: File exists but does not contain a valid YAML hash. Falling back to Hiera version 3 default config" msgstr "" -#: ../lib/puppet/pops/lookup/hiera_config.rb:200 +#: ../lib/puppet/pops/lookup/hiera_config.rb:201 msgid "Hiera configuration recreated due to change of scope variables used in interpolation expressions" msgstr "" -#: ../lib/puppet/pops/lookup/hiera_config.rb:428 +#: ../lib/puppet/pops/lookup/hiera_config.rb:429 msgid "%{config_path}: Use of 'hiera.yaml' version 3 is deprecated. It should be converted to version 5" msgstr "" -#: ../lib/puppet/pops/lookup/hiera_config.rb:528 +#: ../lib/puppet/pops/lookup/hiera_config.rb:529 msgid "%{config_path}: Use of 'hiera.yaml' version 4 is deprecated. It should be converted to version 5" msgstr "" @@ -8504,47 +8513,47 @@ msgstr "" msgid "%{name} has no providers and has not overridden 'instances'" msgstr "" -#: ../lib/puppet/type.rb:1467 +#: ../lib/puppet/type.rb:1468 msgid "Cannot add aliases without a catalog" msgstr "" -#: ../lib/puppet/type.rb:1547 +#: ../lib/puppet/type.rb:1548 msgid "Could not find %{description} %{ref} for %{resource}" msgstr "" -#: ../lib/puppet/type.rb:1824 +#: ../lib/puppet/type.rb:1825 msgid "Found multiple default providers for %{name}: %{provider_list}; using %{selected_provider}" msgstr "" -#: ../lib/puppet/type.rb:1911 +#: ../lib/puppet/type.rb:1912 msgid "Could not find parent provider %{parent} of %{name}" msgstr "" -#: ../lib/puppet/type.rb:1985 +#: ../lib/puppet/type.rb:1986 msgid "Invalid %{resource} provider '%{provider_class}'" msgstr "" -#: ../lib/puppet/type.rb:2070 +#: ../lib/puppet/type.rb:2071 msgid "Could not find %{name} provider of %{provider}" msgstr "" -#: ../lib/puppet/type.rb:2188 +#: ../lib/puppet/type.rb:2189 msgid "You cannot add relationships without a catalog" msgstr "" -#: ../lib/puppet/type.rb:2491 +#: ../lib/puppet/type.rb:2492 msgid "Unable to mark '%{name}' as sensitive: %{name} is a parameter and not a property, and cannot be automatically redacted." msgstr "" -#: ../lib/puppet/type.rb:2494 +#: ../lib/puppet/type.rb:2495 msgid "Unable to mark '%{name}' as sensitive: the property itself was not assigned a value." msgstr "" -#: ../lib/puppet/type.rb:2496 +#: ../lib/puppet/type.rb:2497 msgid "Unable to mark '%{name}' as sensitive: the property itself is not defined on %{type}." msgstr "" -#: ../lib/puppet/type.rb:2554 +#: ../lib/puppet/type.rb:2555 msgid "Could not set %{attribute} on %{class_name}: %{detail}" msgstr "" @@ -8742,7 +8751,7 @@ msgid "Not managing symlink mode" msgstr "" #. TRANSLATORS "source_permissions" is a parameter name and should not be translated -#: ../lib/puppet/type/file/source.rb:353 +#: ../lib/puppet/type/file/source.rb:368 msgid "The `source_permissions` parameter is deprecated. Explicitly set `owner`, `group`, and `mode`." msgstr "" @@ -9102,15 +9111,15 @@ msgstr "" msgid "Filebucketed %{f} to %{filebucket} with sum %{sum}" msgstr "" -#: ../lib/puppet/util/character_encoding.rb:22 +#: ../lib/puppet/util/character_encoding.rb:23 msgid "%{value} is already labeled as UTF-8 but this encoding is invalid. It cannot be transcoded by Puppet." msgstr "" -#: ../lib/puppet/util/character_encoding.rb:43 +#: ../lib/puppet/util/character_encoding.rb:45 msgid "%{error}: %{value} cannot be transcoded by Puppet." msgstr "" -#: ../lib/puppet/util/character_encoding.rb:70 +#: ../lib/puppet/util/character_encoding.rb:73 msgid "%{value} is not valid UTF-8 and result of overriding encoding would be invalid." msgstr "" From bfd0f3fdd565372c4a54f1d081cf0563f217c530 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Fri, 31 Jul 2020 15:00:35 +0000 Subject: [PATCH 011/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index bfd26080b3e..444223dbe68 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -927,6 +927,14 @@ The HTTP User\-Agent string to send when making network requests\. . .IP "" 0 . +.SS "ignore_plugin_errors" +Whether the puppet run should ignore errors during pluginsync\. If the setting is false and there are errors during pluginsync, then the agent will abort the run and submit a report containing information about the failed run\. +. +.IP "\(bu" 4 +\fIDefault\fR: true +. +.IP "" 0 +. .SS "ignoremissingtypes" Skip searching for classes and definitions that were missing during a prior compilation\. The list of missing objects is maintained per\-environment and persists until the environment is cleared or the master is restarted\. . @@ -1435,6 +1443,14 @@ From where to retrieve plugins\. The standard Puppet \fBfile\fR type is used for . .IP "" 0 . +.SS "pluginsync" +Whether plugins should be synced with the central server\. This setting is deprecated\. +. +.IP "\(bu" 4 +\fIDefault\fR: true +. +.IP "" 0 +. .SS "postrun_command" A command to run after every agent run\. If this command returns a non\-zero return code, the entire Puppet run will be considered to have failed, even though it might have performed work during the normal run\. . From 81e3bdf38bbfb1ec4d2ffc2093e77e785628a6fe Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Fri, 31 Jul 2020 16:42:21 +0000 Subject: [PATCH 012/731] (packaging) Updating the puppet.pot file --- locales/puppet.pot | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/locales/puppet.pot b/locales/puppet.pot index 7c1fedfcfb6..8ffe6aad867 100644 --- a/locales/puppet.pot +++ b/locales/puppet.pot @@ -6,11 +6,11 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Puppet automation framework 6.17.0-111-g4171555d21\n" +"Project-Id-Version: Puppet automation framework 6.17.0-116-gd30948520d\n" "\n" "Report-Msgid-Bugs-To: https://tickets.puppetlabs.com\n" -"POT-Creation-Date: 2020-07-31 14:58+0000\n" -"PO-Revision-Date: 2020-07-31 14:58+0000\n" +"POT-Creation-Date: 2020-07-31 16:42+0000\n" +"PO-Revision-Date: 2020-07-31 16:42+0000\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -6993,7 +6993,7 @@ msgstr "" msgid "Refusing to install package group %{resource_name}, because allow_virtual is false." msgstr "" -#: ../lib/puppet/provider/package/pip.rb:58 +#: ../lib/puppet/provider/package/pip.rb:57 msgid "Cannot resolve pip version" msgstr "" @@ -9487,10 +9487,6 @@ msgstr "" msgid "Could not write crontab for %{path}: %{detail}" msgstr "" -#: ../lib/puppet/util/http_proxy.rb:215 -msgid "Too many HTTP redirections for %{uri}" -msgstr "" - #: ../lib/puppet/util/inifile.rb:139 msgid "Cannot read nonexistent file %{file}" msgstr "" From 50a908694916e812e53b5ab5b0a5302ed9ba9811 Mon Sep 17 00:00:00 2001 From: Luchian Nemes Date: Wed, 5 Aug 2020 18:54:04 +0300 Subject: [PATCH 013/731] (PUP-10590) Remove win32-process gem dependency This commit updates `project_data.yaml` to align with the win32-process gem removal. --- ext/project_data.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/ext/project_data.yaml b/ext/project_data.yaml index 5cde3a2f961..4cb199bf0ba 100644 --- a/ext/project_data.yaml +++ b/ext/project_data.yaml @@ -41,7 +41,6 @@ gem_platform_dependencies: ffi: ['> 1.9.24', '< 2'] # win32-xxxx gems are pinned due to PUP-6445 win32-dir: '= 0.4.9' - win32-process: '= 0.7.5' # Use of win32-security is deprecated win32-security: '= 0.2.5' win32-service: '= 0.8.8' @@ -51,7 +50,6 @@ gem_platform_dependencies: ffi: ['> 1.9.24', '< 2'] # win32-xxxx gems are pinned due to PUP-6445 win32-dir: '= 0.4.9' - win32-process: '= 0.7.5' # Use of win32-security is deprecated win32-security: '= 0.2.5' win32-service: '= 0.8.8' From 321f36fac7856fdd8af82f80d236fb2603a825ea Mon Sep 17 00:00:00 2001 From: Luchian Nemes Date: Wed, 5 Aug 2020 19:06:34 +0300 Subject: [PATCH 014/731] (PUP-7446) Remove win32-service gem dependency This commit updates project_data.yaml to align with the win32-service gem removal. --- ext/project_data.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/ext/project_data.yaml b/ext/project_data.yaml index 5cde3a2f961..e3645a7d54f 100644 --- a/ext/project_data.yaml +++ b/ext/project_data.yaml @@ -44,7 +44,6 @@ gem_platform_dependencies: win32-process: '= 0.7.5' # Use of win32-security is deprecated win32-security: '= 0.2.5' - win32-service: '= 0.8.8' minitar: '~> 0.9' x64-mingw32: gem_runtime_dependencies: @@ -54,7 +53,6 @@ gem_platform_dependencies: win32-process: '= 0.7.5' # Use of win32-security is deprecated win32-security: '= 0.2.5' - win32-service: '= 0.8.8' minitar: '~> 0.9' bundle_platforms: universal-darwin: all From 7f1e68cc418e17d5c1d91d175341962d1267e7eb Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Wed, 29 Jul 2020 14:33:00 -0700 Subject: [PATCH 015/731] (PUP-10440) Remove cert related rest terminus Puppet doesn't use the indirector to manage certificates, delete the rest terminus. --- lib/puppet/indirector/certificate/rest.rb | 18 ------ .../indirector/certificate_request/rest.rb | 11 ---- spec/unit/indirector/certificate/rest_spec.rb | 61 ------------------- .../certificate_request/rest_spec.rb | 25 -------- 4 files changed, 115 deletions(-) delete mode 100644 lib/puppet/indirector/certificate/rest.rb delete mode 100644 lib/puppet/indirector/certificate_request/rest.rb delete mode 100644 spec/unit/indirector/certificate/rest_spec.rb delete mode 100644 spec/unit/indirector/certificate_request/rest_spec.rb diff --git a/lib/puppet/indirector/certificate/rest.rb b/lib/puppet/indirector/certificate/rest.rb deleted file mode 100644 index f5ca23a5c92..00000000000 --- a/lib/puppet/indirector/certificate/rest.rb +++ /dev/null @@ -1,18 +0,0 @@ -require 'puppet/ssl/certificate' -require 'puppet/indirector/rest' - -# @deprecated -class Puppet::SSL::Certificate::Rest < Puppet::Indirector::REST - desc "Find certificates over HTTP via REST." - - use_server_setting(:ca_server) - use_port_setting(:ca_port) - use_srv_service(:ca) - - def find(request) - result = super - return nil unless result - result.name = request.key unless result.name == request.key - result - end -end diff --git a/lib/puppet/indirector/certificate_request/rest.rb b/lib/puppet/indirector/certificate_request/rest.rb deleted file mode 100644 index 21a18e36114..00000000000 --- a/lib/puppet/indirector/certificate_request/rest.rb +++ /dev/null @@ -1,11 +0,0 @@ -require 'puppet/ssl/certificate_request' -require 'puppet/indirector/rest' - -# @deprecated -class Puppet::SSL::CertificateRequest::Rest < Puppet::Indirector::REST - desc "Find and save certificate requests over HTTP via REST." - - use_server_setting(:ca_server) - use_port_setting(:ca_port) - use_srv_service(:ca) -end diff --git a/spec/unit/indirector/certificate/rest_spec.rb b/spec/unit/indirector/certificate/rest_spec.rb deleted file mode 100644 index 4ccf4b1260f..00000000000 --- a/spec/unit/indirector/certificate/rest_spec.rb +++ /dev/null @@ -1,61 +0,0 @@ -require 'spec_helper' -require 'puppet/indirector/certificate/rest' - -describe Puppet::SSL::Certificate::Rest do - before do - @searcher = Puppet::SSL::Certificate::Rest.new - end - - it "should be a sublcass of Puppet::Indirector::REST" do - expect(Puppet::SSL::Certificate::Rest.superclass).to equal(Puppet::Indirector::REST) - end - - it "should set server_setting to :ca_server" do - expect(Puppet::SSL::Certificate::Rest.server_setting).to eq(:ca_server) - end - - it "should set port_setting to :ca_port" do - expect(Puppet::SSL::Certificate::Rest.port_setting).to eq(:ca_port) - end - - it "should use the :ca SRV service" do - expect(Puppet::SSL::Certificate::Rest.srv_service).to eq(:ca) - end - - it "should make sure found certificates have their names set to the search string" do - terminus = Puppet::SSL::Certificate::Rest.new - - # This has 'boo.com' in the CN - cert_string = "-----BEGIN CERTIFICATE----- -MIICPzCCAaigAwIBAgIBBDANBgkqhkiG9w0BAQUFADAWMRQwEgYDVQQDDAtidWNr -eS5sb2NhbDAeFw0wOTA5MTcxNzI1MzJaFw0xNDA5MTYxNzI1MzJaMBIxEDAOBgNV -BAMMB2Jvby5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAKG9B+DkTCNh -F5xHchNDfnbC9NzWKM600oxrr84pgUVAG6B2wAZcdfoEtXszhsY9Jzpwqkvxk4Mx -AbYqo9+TCi4UoiH6e+vAKOOJD3DHrlf+/RW4hGtyaI41DBhf4+B4/oFz5PH9mvKe -NSfHFI/yPW+1IXYjxKLQNwF9E7q3JbnzAgMBAAGjgaAwgZ0wOAYJYIZIAYb4QgEN -BCsWKVB1cHBldCBSdWJ5L09wZW5TU0wgR2VuZXJhdGVkIENlcnRpZmljYXRlMAwG -A1UdEwEB/wQCMAAwHQYDVR0OBBYEFJOxEUeyf4cNOBmf9zIaE1JTuNdLMAsGA1Ud -DwQEAwIFoDAnBgNVHSUEIDAeBggrBgEFBQcDAQYIKwYBBQUHAwIGCCsGAQUFBwME -MA0GCSqGSIb3DQEBBQUAA4GBAFTJxKprMg6tfhGnvEvURPmlJrINn9c2b5Y4AGYp -tO86PFFkWw/EIJvvJzbj3s+Butr+eUo//+f1xxX7UCwwGqGxKqjtVS219oU/wkx8 -h7rW4Xk7MrLl0auSS1p4wLcAMm+ZImf94+j8Cj+tkr8eGozZceRV13b8+EkdaE3S -rn/G ------END CERTIFICATE----- -" - - network = double('network') - allow(terminus).to receive(:network).and_return(network) - - response = double('response', :code => "200", :body => cert_string) - allow(response).to receive(:[]).with('content-type').and_return("text/plain") - allow(response).to receive(:[]).with('content-encoding') - allow(response).to receive(:[]).with(Puppet::Network::HTTP::HEADER_PUPPET_VERSION).and_return(Puppet.version) - allow(network).to receive(:verify_callback=) - expect(network).to receive(:get).and_return(response) - - request = Puppet::Indirector::Request.new(:certificate, :find, "foo.com", nil) - result = terminus.find(request) - expect(result).not_to be_nil - expect(result.name).to eq("foo.com") - end -end diff --git a/spec/unit/indirector/certificate_request/rest_spec.rb b/spec/unit/indirector/certificate_request/rest_spec.rb deleted file mode 100644 index 23f4fc8028c..00000000000 --- a/spec/unit/indirector/certificate_request/rest_spec.rb +++ /dev/null @@ -1,25 +0,0 @@ -require 'spec_helper' - -require 'puppet/indirector/certificate_request/rest' - -describe Puppet::SSL::CertificateRequest::Rest do - before do - @searcher = Puppet::SSL::CertificateRequest::Rest.new - end - - it "should be a sublcass of Puppet::Indirector::REST" do - expect(Puppet::SSL::CertificateRequest::Rest.superclass).to equal(Puppet::Indirector::REST) - end - - it "should set server_setting to :ca_server" do - expect(Puppet::SSL::CertificateRequest::Rest.server_setting).to eq(:ca_server) - end - - it "should set port_setting to :ca_port" do - expect(Puppet::SSL::CertificateRequest::Rest.port_setting).to eq(:ca_port) - end - - it "should use the :ca SRV service" do - expect(Puppet::SSL::CertificateRequest::Rest.srv_service).to eq(:ca) - end -end From d7fdd563102ef1c4f6d8b82bfc968e3e139a95b1 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Wed, 29 Jul 2020 14:38:58 -0700 Subject: [PATCH 016/731] (PUP-10440) Always use HTTP client for REST requests Never fallback to the abstract Puppet::Indirector::Rest terminus. Since the HTTP client handles resolution based on SRV records and settings, remove the `use_srv_service` and `use_(server|port)_setting` calls from the individual rest termini. --- lib/puppet/indirector/catalog/rest.rb | 2 -- lib/puppet/indirector/facts/rest.rb | 18 ------------------ lib/puppet/indirector/file_bucket_file/rest.rb | 6 ------ lib/puppet/indirector/file_content/rest.rb | 4 ---- lib/puppet/indirector/file_metadata/rest.rb | 6 ------ lib/puppet/indirector/node/rest.rb | 2 -- lib/puppet/indirector/report/rest.rb | 5 ----- lib/puppet/indirector/status/rest.rb | 2 -- spec/unit/indirector/file_content/rest_spec.rb | 4 ---- .../unit/indirector/file_metadata/rest_spec.rb | 4 ---- spec/unit/indirector/report/rest_spec.rb | 15 --------------- 11 files changed, 68 deletions(-) diff --git a/lib/puppet/indirector/catalog/rest.rb b/lib/puppet/indirector/catalog/rest.rb index 2e28f1bf436..07b532386fc 100644 --- a/lib/puppet/indirector/catalog/rest.rb +++ b/lib/puppet/indirector/catalog/rest.rb @@ -5,8 +5,6 @@ class Puppet::Resource::Catalog::Rest < Puppet::Indirector::REST desc "Find resource catalogs over HTTP via REST." def find(request) - return super unless use_http_client? - checksum_type = if request.options[:checksum_type] request.options[:checksum_type].split('.') else diff --git a/lib/puppet/indirector/facts/rest.rb b/lib/puppet/indirector/facts/rest.rb index 7af80f7e581..5102dd2b091 100644 --- a/lib/puppet/indirector/facts/rest.rb +++ b/lib/puppet/indirector/facts/rest.rb @@ -5,8 +5,6 @@ class Puppet::Node::Facts::Rest < Puppet::Indirector::REST desc "Find and save facts about nodes over HTTP via REST." def find(request) - return super unless use_http_client? - session = Puppet.lookup(:http_session) api = session.route_to(:puppet) _, facts = api.get_facts( @@ -29,8 +27,6 @@ def find(request) def save(request) raise ArgumentError, _("PUT does not accept options") unless request.options.empty? - return legacy_save(request) unless use_http_client? - session = Puppet.lookup(:http_session) api = session.route_to(:puppet) api.put_facts( @@ -44,20 +40,6 @@ def save(request) rescue Puppet::HTTP::ResponseError => e # always raise even if fail_on_404 is false raise convert_to_http_error(e.response.nethttp) - end - - private - def legacy_save(request) - response = do_request(request) do |req| - http_put(req, IndirectedRoutes.request_to_uri(req), req.instance.render, headers.merge({ "Content-Type" => req.instance.mime })) - end - - if is_http_200?(response) - content_type, body = parse_response(response) - deserialize_save(content_type, body) - else - raise convert_to_http_error(response) - end end end diff --git a/lib/puppet/indirector/file_bucket_file/rest.rb b/lib/puppet/indirector/file_bucket_file/rest.rb index 6fabc9de1e9..a0d59ef22dd 100644 --- a/lib/puppet/indirector/file_bucket_file/rest.rb +++ b/lib/puppet/indirector/file_bucket_file/rest.rb @@ -6,8 +6,6 @@ class Rest < Puppet::Indirector::REST desc "This is a REST based mechanism to send/retrieve file to/from the filebucket" def head(request) - return super unless use_http_client? - session = Puppet.lookup(:http_session) api = session.route_to(:puppet) api.head_filebucket_file( @@ -21,8 +19,6 @@ def head(request) end def find(request) - return super unless use_http_client? - session = Puppet.lookup(:http_session) api = session.route_to(:puppet) _, filebucket_file = api.get_filebucket_file( @@ -40,8 +36,6 @@ def find(request) end def save(request) - return super unless use_http_client? - session = Puppet.lookup(:http_session) api = session.route_to(:puppet) api.put_filebucket_file( diff --git a/lib/puppet/indirector/file_content/rest.rb b/lib/puppet/indirector/file_content/rest.rb index daf355f9091..54df626f0c9 100644 --- a/lib/puppet/indirector/file_content/rest.rb +++ b/lib/puppet/indirector/file_content/rest.rb @@ -5,11 +5,7 @@ class Puppet::Indirector::FileContent::Rest < Puppet::Indirector::REST desc "Retrieve file contents via a REST HTTP interface." - use_srv_service(:fileserver) - def find(request) - return super unless use_http_client? - content = StringIO.new content.binmode diff --git a/lib/puppet/indirector/file_metadata/rest.rb b/lib/puppet/indirector/file_metadata/rest.rb index 7d3d7a17500..c7efb13f178 100644 --- a/lib/puppet/indirector/file_metadata/rest.rb +++ b/lib/puppet/indirector/file_metadata/rest.rb @@ -5,11 +5,7 @@ class Puppet::Indirector::FileMetadata::Rest < Puppet::Indirector::REST desc "Retrieve file metadata via a REST HTTP interface." - use_srv_service(:fileserver) - def find(request) - return super unless use_http_client? - url = URI.parse(Puppet::Util.uri_encode(request.uri)) session = Puppet.lookup(:http_session) api = session.route_to(:fileserver, url: url) @@ -35,8 +31,6 @@ def find(request) end def search(request) - return super unless use_http_client? - url = URI.parse(Puppet::Util.uri_encode(request.uri)) session = Puppet.lookup(:http_session) api = session.route_to(:fileserver, url: url) diff --git a/lib/puppet/indirector/node/rest.rb b/lib/puppet/indirector/node/rest.rb index 97bc8fc1235..5630683ac83 100644 --- a/lib/puppet/indirector/node/rest.rb +++ b/lib/puppet/indirector/node/rest.rb @@ -6,8 +6,6 @@ class Puppet::Node::Rest < Puppet::Indirector::REST to override its environment." def find(request) - return super unless use_http_client? - session = Puppet.lookup(:http_session) api = session.route_to(:puppet) _, node = api.get_node( diff --git a/lib/puppet/indirector/report/rest.rb b/lib/puppet/indirector/report/rest.rb index 7f2c391b6a7..5a3fd3f71e4 100644 --- a/lib/puppet/indirector/report/rest.rb +++ b/lib/puppet/indirector/report/rest.rb @@ -3,13 +3,8 @@ class Puppet::Transaction::Report::Rest < Puppet::Indirector::REST desc "Get server report over HTTP via REST." - use_server_setting(:report_server) - use_port_setting(:report_port) - use_srv_service(:report) def save(request) - return super unless use_http_client? - session = Puppet.lookup(:http_session) api = session.route_to(:report) response = api.put_report( diff --git a/lib/puppet/indirector/status/rest.rb b/lib/puppet/indirector/status/rest.rb index e84d971871f..a985fc466fb 100644 --- a/lib/puppet/indirector/status/rest.rb +++ b/lib/puppet/indirector/status/rest.rb @@ -7,8 +7,6 @@ class Puppet::Indirector::Status::Rest < Puppet::Indirector::REST of both the web server and the indirector." def find(request) - return super unless use_http_client? - session = Puppet.lookup(:http_session) api = session.route_to(:puppet) _, status = api.get_status(request.key) diff --git a/spec/unit/indirector/file_content/rest_spec.rb b/spec/unit/indirector/file_content/rest_spec.rb index 4381691c39c..b2d796807b6 100644 --- a/spec/unit/indirector/file_content/rest_spec.rb +++ b/spec/unit/indirector/file_content/rest_spec.rb @@ -57,8 +57,4 @@ def file_content_response described_class.indirection.find("puppet://example.com:8140/:mount/path/to/file") end - - it "should use the :fileserver SRV service" do - expect(Puppet::Indirector::FileContent::Rest.srv_service).to eq(:fileserver) - end end diff --git a/spec/unit/indirector/file_metadata/rest_spec.rb b/spec/unit/indirector/file_metadata/rest_spec.rb index c3d0a99eb5a..fa825d048c6 100644 --- a/spec/unit/indirector/file_metadata/rest_spec.rb +++ b/spec/unit/indirector/file_metadata/rest_spec.rb @@ -113,8 +113,4 @@ def metadata_response(metadata) model.indirection.search("puppet://example.com:8140/:mount/path/to/dir") end end - - it "should use the :fileserver SRV service" do - expect(Puppet::Indirector::FileMetadata::Rest.srv_service).to eq(:fileserver) - end end diff --git a/spec/unit/indirector/report/rest_spec.rb b/spec/unit/indirector/report/rest_spec.rb index 98579a0d917..4b6f512bf97 100644 --- a/spec/unit/indirector/report/rest_spec.rb +++ b/spec/unit/indirector/report/rest_spec.rb @@ -20,21 +20,6 @@ def report_response { body: formatter.render(["store", "http"]), headers: {'Content-Type' => formatter.mime } } end - it "should use the :report_server setting in preference to :server" do - Puppet.settings[:server] = "server" - Puppet.settings[:report_server] = "report_server" - expect(Puppet::Transaction::Report::Rest.server).to eq("report_server") - end - - it "should have a value for report_server and report_port" do - expect(Puppet::Transaction::Report::Rest.server).not_to be_nil - expect(Puppet::Transaction::Report::Rest.port).not_to be_nil - end - - it "should use the :report SRV service" do - expect(Puppet::Transaction::Report::Rest.srv_service).to eq(:report) - end - it "saves a report " do stub_request(:put, uri) .to_return(status: 200, **report_response) From ca36093089d90da1659e0bba1e0e3d76a1ab1c04 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Wed, 29 Jul 2020 14:42:53 -0700 Subject: [PATCH 017/731] (PUP-10440) Decouple REST terminus from HTTP requests The abstract REST terminus performs HTTP requests for indirected models. The terminus is tightly coupled to the model, for example, the model has to implement a `supported_formats` so the REST terminus knows which MIME types to accept. This makes it impossible to use the HTTP request handling for something other than an indirected model. Puppet's rest terminus subclasses no longer use the abstract terminus for HTTP requests. Instead they use Puppet's HTTP client. This commit removes the unused methods from the abstract REST terminus. This eliminates mutable global state, like `server_setting`. This won't break the classifier or puppetdb termini because they handle HTTP requests directly using HTTP connections provided by puppet. This could break a third-party REST terminus for an indirected model that is not in core puppet, but I think that is extremely unlikely. --- lib/puppet/indirector/rest.rb | 262 +--------- spec/unit/indirector/rest_spec.rb | 810 ++---------------------------- 2 files changed, 34 insertions(+), 1038 deletions(-) diff --git a/lib/puppet/indirector/rest.rb b/lib/puppet/indirector/rest.rb index b6274aec78a..600efda51e1 100644 --- a/lib/puppet/indirector/rest.rb +++ b/lib/puppet/indirector/rest.rb @@ -1,241 +1,23 @@ -require 'net/http' -require 'uri' -require 'puppet/util/json' -require 'puppet/util/connection' -require 'semantic_puppet' - -require 'puppet/network/http' -require 'puppet/network/http_pool' - # Access objects via REST class Puppet::Indirector::REST < Puppet::Indirector::Terminus - include Puppet::Network::HTTP::Compression.module - - IndirectedRoutes = Puppet::Network::HTTP::API::IndirectedRoutes - EXCLUDED_FORMATS = [:yaml, :b64_zlib_yaml, :dot] - - # puppet major version where JSON is enabled by default - MAJOR_VERSION_JSON_DEFAULT = 5 - - class << self - attr_reader :server_setting, :port_setting - end - - # Specify the setting that we should use to get the server name. - def self.use_server_setting(setting) - @server_setting = setting - end - - # Specify the setting that we should use to get the port. - def self.use_port_setting(setting) - @port_setting = setting - end - - # Specify the service to use when doing SRV record lookup - def self.use_srv_service(service) - @srv_service = service - end - - def self.srv_service - @srv_service || :puppet - end - - # Select the server to use based on the settings configuration - # for this indirection, taking into account the HA server list. - def self.server - Puppet::Util::Connection.determine_server(server_setting) - end - - # Select the port to use based on the settings configuration - # for this indirection, taking into account the HA server list. - def self.port - Puppet::Util::Connection.determine_port(port_setting, server_setting) - end - - # Should we use puppet's http client to make requests. Will return - # false when running in puppetserver - def use_http_client? - Puppet::Network::HttpPool.http_client_class == Puppet::Network::HTTP::Connection || - Puppet::Network::HttpPool.http_client_class == Puppet::Network::HTTP::ConnectionAdapter - end - - # Provide appropriate headers. - def headers - # yaml is not allowed on the network - network_formats = model.supported_formats - EXCLUDED_FORMATS - mime_types = network_formats.map { |f| model.get_format(f).mime } - common_headers = { - "Accept" => mime_types.join(', '), - Puppet::Network::HTTP::HEADER_PUPPET_VERSION => Puppet.version - } - - add_accept_encoding(common_headers) - end - - def add_profiling_header(headers) - if (Puppet[:profile]) - headers[Puppet::Network::HTTP::HEADER_ENABLE_PROFILING] = "true" - end - headers - end - - def network(request) - ssl_context = Puppet.lookup(:ssl_context) - Puppet::Network::HttpPool.connection(request.server || self.class.server, - request.port || self.class.port, - ssl_context: ssl_context) - end - - def http_get(request, path, headers = nil, *args) - http_request(:get, request, path, add_profiling_header(headers), *args) - end - - def http_post(request, path, data, headers = nil, *args) - http_request(:post, request, path, data, add_profiling_header(headers), *args) - end - - def http_head(request, path, headers = nil, *args) - http_request(:head, request, path, add_profiling_header(headers), *args) - end - - def http_delete(request, path, headers = nil, *args) - http_request(:delete, request, path, add_profiling_header(headers), *args) - end - - def http_put(request, path, data, headers = nil, *args) - http_request(:put, request, path, data, add_profiling_header(headers), *args) - end - - def http_request(method, request, *args) - conn = network(request) - conn.send(method, *args) - end - def find(request) - Puppet.deprecation_warning(_("Puppet::Indirector::Rest#find is deprecated. Use Puppet::HTTP::Client instead.")) - uri, body = IndirectedRoutes.request_to_uri_and_body(request) - uri_with_query_string = "#{uri}?#{body}" - - response = do_request(request) do |req| - # WEBrick in Ruby 1.9.1 only supports up to 1024 character lines in an HTTP request - # http://redmine.ruby-lang.org/issues/show/3991 - if "GET #{uri_with_query_string} HTTP/1.1\r\n".length > 1024 - uri_with_env = "#{uri}?environment=#{request.environment.name}" - http_post(req, uri_with_env, body, headers) - else - http_get(req, uri_with_query_string, headers) - end - end - - if is_http_200?(response) - content_type, body = parse_response(response) - result = deserialize_find(content_type, body) - result.name = request.key if result.respond_to?(:name=) - result - - elsif is_http_404?(response) - return nil unless request.options[:fail_on_404] - - # 404 can get special treatment as the indirector API can not produce a meaningful - # reason to why something is not found - it may not be the thing the user is - # expecting to find that is missing, but something else (like the environment). - # While this way of handling the issue is not perfect, there is at least an error - # that makes a user aware of the reason for the failure. - # - _, body = parse_response(response) - msg = _("Find %{uri} resulted in 404 with the message: %{body}") % { uri: elide(uri_with_query_string, 100), body: body } - raise Puppet::Error, msg - else - nil - end + raise NotImplementedError end def head(request) - Puppet.deprecation_warning(_("Puppet::Indirector::Rest#head is deprecated. Use Puppet::HTTP::Client instead.")) - response = do_request(request) do |req| - http_head(req, IndirectedRoutes.request_to_uri(req), headers) - end - - if is_http_200?(response) - true - else - false - end + raise NotImplementedError end def search(request) - Puppet.deprecation_warning(_("Puppet::Indirector::Rest#search is deprecated. Use Puppet::HTTP::Client instead.")) - response = do_request(request) do |req| - http_get(req, IndirectedRoutes.request_to_uri(req), headers) - end - - if is_http_200?(response) - content_type, body = parse_response(response) - deserialize_search(content_type, body) || [] - else - [] - end + raise NotImplementedError end def destroy(request) - Puppet.deprecation_warning(_("Puppet::Indirector::Rest#destroy is deprecated. Use Puppet::HTTP::Client instead.")) - raise ArgumentError, _("DELETE does not accept options") unless request.options.empty? - - response = do_request(request) do |req| - http_delete(req, IndirectedRoutes.request_to_uri(req), headers) - end - - if is_http_200?(response) - content_type, body = parse_response(response) - deserialize_destroy(content_type, body) - else - nil - end + raise NotImplementedError end def save(request) - Puppet.deprecation_warning(_("Puppet::Indirector::Rest#save is deprecated. Use Puppet::HTTP::Client instead.")) - raise ArgumentError, _("PUT does not accept options") unless request.options.empty? - - response = do_request(request) do |req| - http_put(req, IndirectedRoutes.request_to_uri(req), req.instance.render, headers.merge({ "Content-Type" => req.instance.mime })) - end - - if is_http_200?(response) - content_type, body = parse_response(response) - deserialize_save(content_type, body) - else - nil - end - end - - # Encapsulate call to request.do_request with the arguments from this class - # Then yield to the code block that was called in - # We certainly could have retained the full request.do_request(...) { |r| ... } - # but this makes the code much cleaner and we only then actually make the call - # to request.do_request from here, thus if we change what we pass or how we - # get it, we only need to change it here. - def do_request(request) - response = request.do_request(self.class.srv_service, self.class.server, self.class.port) { |req| yield(req) } - - handle_response(request, response) if response - - response - end - - def handle_response(request, response) - server_version = response[Puppet::Network::HTTP::HEADER_PUPPET_VERSION] - if server_version - Puppet.lookup(:server_agent_version) do - Puppet.push_context(:server_agent_version => server_version) - end - if SemanticPuppet::Version.parse(server_version).major < MAJOR_VERSION_JSON_DEFAULT && - Puppet[:preferred_serialization_format] != 'pson' - #TRANSLATORS "PSON" should not be translated - Puppet.warning(_("Downgrading to PSON for future requests")) - Puppet[:preferred_serialization_format] = 'pson' - end - end + raise NotImplementedError end def validate_key(request) @@ -244,22 +26,6 @@ def validate_key(request) private - def is_http_200?(response) - case response.code - when "404" - false - when /^2/ - true - else - # Raise the http error if we didn't get a 'success' of some kind. - raise convert_to_http_error(response) - end - end - - def is_http_404?(response) - response.code == "404" - end - def convert_to_http_error(response) if response.body.to_s.empty? && response.respond_to?(:message) returned_message = response.message @@ -283,28 +49,12 @@ def convert_to_http_error(response) # uncompress_body) def parse_response(response) if response['content-type'] - [ response['content-type'].gsub(/\s*;.*$/,''), uncompress_body(response) ] + [ response['content-type'].gsub(/\s*;.*$/,''), response.body ] else raise _("No content type in http response; cannot parse") end end - def deserialize_find(content_type, body) - model.convert_from(content_type, body) - end - - def deserialize_search(content_type, body) - model.convert_from_multiple(content_type, body) - end - - def deserialize_destroy(content_type, body) - model.convert_from(content_type, body) - end - - def deserialize_save(content_type, body) - nil - end - def elide(string, length) if Puppet::Util::Log.level == :debug || string.length <= length string diff --git a/spec/unit/indirector/rest_spec.rb b/spec/unit/indirector/rest_spec.rb index 5e2b0b00a47..4b8bcc9d948 100644 --- a/spec/unit/indirector/rest_spec.rb +++ b/spec/unit/indirector/rest_spec.rb @@ -1,803 +1,49 @@ require 'spec_helper' -require 'puppet/util/json' -require 'puppet/indirector' -require 'puppet/indirector/errors' require 'puppet/indirector/rest' -require 'puppet/util/psych_support' -HTTP_ERROR_CODES = [300, 400, 500] - -# Just one from each category since the code makes no real distinctions -shared_examples_for "a REST terminus method" do |terminus_method| - - describe "when handling the response" do - let(:response) do - mock_response(200, 'OK') - end - - it "falls back to pson for future requests" do - allow(response).to receive(:[]).with(Puppet::Network::HTTP::HEADER_PUPPET_VERSION).and_return("4.10.1") - terminus.send(terminus_method, request) - - expect(Puppet[:preferred_serialization_format]).to eq("pson") - end - - it "doesn't change the serialization format if the X-Puppet-Version header is missing" do - allow(response).to receive(:[]).with(Puppet::Network::HTTP::HEADER_PUPPET_VERSION).and_return(nil) - - terminus.send(terminus_method, request) - - expect(Puppet[:preferred_serialization_format]).to eq("json") - end - - it "doesn't change the serialization format if the server major version is 5" do - allow(response).to receive(:[]).with(Puppet::Network::HTTP::HEADER_PUPPET_VERSION).and_return("5.0.3") - - terminus.send(terminus_method, request) - - expect(Puppet[:preferred_serialization_format]).to eq("json") - end - - it "doesn't change the serialization format if the current format is already pson" do - allow(response).to receive(:[]).with(Puppet::Network::HTTP::HEADER_PUPPET_VERSION).and_return("4.10.1") - Puppet[:preferred_serialization_format] = "pson" - terminus.send(terminus_method, request) - - expect(Puppet[:preferred_serialization_format]).to eq("pson") - end - - it "logs a deprecation warning" do - terminus.send(terminus_method, request) - - expect(@logs).to include(an_object_having_attributes(level: :warning, message: /Puppet::Indirector::Rest##{terminus_method} is deprecated. Use Puppet::HTTP::Client instead./)) - end - - it "omits the warning when deprecations are disabled" do - Puppet[:disable_warnings] = 'deprecations' - terminus.send(terminus_method, request) - - expect(@logs).to eq([]) - end - end - - HTTP_ERROR_CODES.each do |code| - describe "when the response code is #{code}" do - let(:message) { 'error messaged!!!' } - let(:body) do - Puppet::Util::Json.dump({ - :issue_kind => 'server-error', - :message => message - }) - end - let(:response) { mock_response(code, body, 'application/json') } - - describe "when the response is plain text" do - let(:response) { mock_response(code, message) } - - it "raises an http error with the body of the response when plain text" do - - expect { - terminus.send(terminus_method, request) - }.to raise_error(Net::HTTPError, "Error #{code} on SERVER: #{message}") - end - end - - it "raises an http error with the body's message field when json" do - expect { - terminus.send(terminus_method, request) - }.to raise_error(Net::HTTPError, "Error #{code} on SERVER: #{message}") - end - - it "does not attempt to deserialize the response into a model" do - expect(model).not_to receive(:convert_from) - - expect { - terminus.send(terminus_method, request) - }.to raise_error(Net::HTTPError) - end - - # I'm not sure what this means or if it's used - it "if the body is empty raises an http error with the response header" do - allow(response).to receive(:body).and_return("") - allow(response).to receive(:message).and_return("fhqwhgads") - - expect { - terminus.send(terminus_method, request) - }.to raise_error(Net::HTTPError, "Error #{code} on SERVER: #{response.message}") - end - - describe "and the body is compressed" do - it "raises an http error with the decompressed body of the response" do - compressed_body = Zlib::Deflate.deflate(body) - - compressed_response = mock_response(code, compressed_body, 'application/json', 'deflate') - expect(connection).to receive(http_method).and_return(compressed_response) - - expect { - terminus.send(terminus_method, request) - }.to raise_error(Net::HTTPError, "Error #{code} on SERVER: #{message}") - end - end - end - end +class Puppet::TestModel + extend Puppet::Indirector + indirects :test_model end -shared_examples_for "a deserializing terminus method" do |terminus_method| - describe "when the response has no content-type" do - let(:response) { mock_response(200, "body", nil, nil) } - it "raises an error" do - expect { - terminus.send(terminus_method, request) - }.to raise_error(RuntimeError, "No content type in http response; cannot parse") - end - end - - it "doesn't catch errors in deserialization" do - expect(model).to receive(:convert_from).and_raise(Puppet::Error, "Whoa there") - - expect { terminus.send(terminus_method, request) }.to raise_error(Puppet::Error, "Whoa there") - end +# The subclass must not be all caps even though the superclass is +class Puppet::TestModel::Rest < Puppet::Indirector::REST end describe Puppet::Indirector::REST do - before :all do - class Puppet::TestModel - include Puppet::Util::PsychSupport - extend Puppet::Indirector - indirects :test_model - attr_accessor :name, :data - def initialize(name = "name", data = '') - @name = name - @data = data - end - - def self.convert_from(format, string) - new('', string) - end + let(:terminus) { Puppet::TestModel::Rest.new } - def self.convert_from_multiple(format, string) - string.split(',').collect { |s| convert_from(format, s) } - end - - def to_data_hash - { 'name' => @name, 'data' => @data } - end - - def ==(other) - other.is_a? Puppet::TestModel and other.name == name and other.data == data - end - end - - # The subclass must not be all caps even though the superclass is - class Puppet::TestModel::Rest < Puppet::Indirector::REST - end - - Puppet::TestModel.indirection.terminus_class = :rest + before :each do + terminus.indirection.terminus_class = :rest end - after :all do - Puppet::TestModel.indirection.delete - # Remove the class, unlinking it from the rest of the system. - Puppet.send(:remove_const, :TestModel) - end - - let(:terminus_class) { Puppet::TestModel::Rest } - let(:terminus) { Puppet::TestModel.indirection.terminus(:rest) } - let(:indirection) { Puppet::TestModel.indirection } - let(:model) { Puppet::TestModel } - let(:url_prefix) { "#{Puppet::Network::HTTP::MASTER_URL_PREFIX}/v3"} - - around(:each) do |example| - Puppet.override(:current_environment => Puppet::Node::Environment.create(:production, [])) do - example.run - end + it "raises when find is called" do + expect { + terminus.find(Puppet::Indirector::Request.new(:test_model, :find, 'foo', nil)) + }.to raise_error(NotImplementedError) end - def mock_response(code, body, content_type='text/plain', encoding=nil) - obj = double('http 200 ok', :code => code.to_s, :body => body) - allow(obj).to receive(:[]).with('content-type').and_return(content_type) - allow(obj).to receive(:[]).with('content-encoding').and_return(encoding) - allow(obj).to receive(:[]).with(Puppet::Network::HTTP::HEADER_PUPPET_VERSION).and_return(Puppet.version) - obj + it "raises when head is called" do + expect { + terminus.head(Puppet::Indirector::Request.new(:test_model, :head, 'foo', nil)) + }.to raise_error(NotImplementedError) end - def find_request(key, options={}) - Puppet::Indirector::Request.new(:test_model, :find, key, nil, options) + it "raises when search is called" do + expect { + terminus.search(Puppet::Indirector::Request.new(:test_model, :search, 'foo', nil)) + }.to raise_error(NotImplementedError) end - def head_request(key, options={}) - Puppet::Indirector::Request.new(:test_model, :head, key, nil, options) + it "raises when save is called" do + expect { + terminus.save(Puppet::Indirector::Request.new(:test_model, :save, 'foo', Puppet::TestModel.new)) + }.to raise_error(NotImplementedError) end - def search_request(key, options={}) - Puppet::Indirector::Request.new(:test_model, :search, key, nil, options) - end - - def delete_request(key, options={}) - Puppet::Indirector::Request.new(:test_model, :destroy, key, nil, options) - end - - def save_request(key, instance, options={}) - Puppet::Indirector::Request.new(:test_model, :save, key, instance, options) - end - - it "should have a method for specifying what setting a subclass should use to retrieve its server" do - expect(terminus_class).to respond_to(:use_server_setting) - end - - it "should use any specified setting to pick the server" do - expect(terminus_class).to receive(:server_setting).and_return(:ca_server) - Puppet[:ca_server] = "myserver" - expect(terminus_class.server).to eq("myserver") - end - - it "should default to :server for the server setting" do - expect(terminus_class).to receive(:server_setting).and_return(nil) - Puppet[:server] = "myserver" - expect(terminus_class.server).to eq("myserver") - end - - it "should have a method for specifying what setting a subclass should use to retrieve its port" do - expect(terminus_class).to respond_to(:use_port_setting) - end - - it "should use any specified setting to pick the port" do - expect(terminus_class).to receive(:port_setting).and_return(:ca_port) - Puppet[:ca_port] = "321" - expect(terminus_class.port).to eq(321) - end - - it "should default to :port for the port setting" do - expect(terminus_class).to receive(:port_setting).and_return(nil) - Puppet[:masterport] = "543" - expect(terminus_class.port).to eq(543) - end - - it "should use a failover-selected server if set" do - expect(terminus_class).to receive(:server_setting).and_return(nil) - Puppet.override(:server => "myserver") do - expect(terminus_class.server).to eq("myserver") - end - end - - it "should use a failover-selected port if set" do - expect(terminus_class).to receive(:port_setting).and_return(nil) - Puppet.override(:serverport => 321) do - expect(terminus_class.port).to eq(321) - end - end - - it "should use server_list for server when available" do - expect(terminus_class).to receive(:server_setting).and_return(nil) - Puppet[:server_list] = [["foo", "123"]] - expect(terminus_class.server).to eq("foo") - end - - it "should prefer failover-selected server from server list" do - expect(terminus_class).to receive(:server_setting).and_return(nil) - Puppet[:server_list] = [["foo", "123"],["bar", "321"]] - Puppet.override(:server => "bar") do - expect(terminus_class.server).to eq("bar") - end - end - - it "should use server_list for port when available" do - expect(terminus_class).to receive(:port_setting).and_return(nil) - Puppet[:server_list] = [["foo", "123"]] - expect(terminus_class.port).to eq(123) - end - - it "should prefer failover-selected port from server list" do - expect(terminus_class).to receive(:port_setting).and_return(nil) - Puppet[:server_list] = [["foo", "123"],["bar", "321"]] - Puppet.override(:serverport => "321") do - expect(terminus_class.port).to eq(321) - end - end - - it "should use an explicitly specified more-speciic server when failover is active" do - expect(terminus_class).to receive(:server_setting).and_return(:ca_server) - Puppet[:ca_server] = "myserver" - Puppet.override(:server => "anotherserver") do - expect(terminus_class.server).to eq("myserver") - end - end - - it "should use an explicitly specified more-specific port when failover is active" do - expect(terminus_class).to receive(:port_setting).and_return(:ca_port) - Puppet[:ca_port] = 321 - Puppet.override(:serverport => 543) do - expect(terminus_class.port).to eq(321) - end - end - - it "should use a default port when a more-specific server is set" do - expect(terminus_class).to receive(:server_setting).and_return(:ca_server) - expect(terminus_class).to receive(:port_setting).and_return(:ca_port) - Puppet[:ca_server] = "myserver" - Puppet.override(:server => "anotherserver", :port => 666) do - expect(terminus_class.port).to eq(8140) - end - end - - it 'should default to :puppet for the srv_service' do - expect(Puppet::Indirector::REST.srv_service).to eq(:puppet) - end - - it 'excludes yaml from the Accept header' do - expect(model).to receive(:supported_formats).and_return([:json, :pson, :yaml, :binary]) - - expect(terminus.headers['Accept']).to eq('application/json, text/pson, application/octet-stream') - end - - it 'excludes b64_zlib_yaml from the Accept header' do - expect(model).to receive(:supported_formats).and_return([:json, :pson, :b64_zlib_yaml]) - - expect(terminus.headers['Accept']).to eq('application/json, text/pson') - end - - it 'excludes dot from the Accept header' do - expect(model).to receive(:supported_formats).and_return([:json, :dot]) - - expect(terminus.headers['Accept']).to eq('application/json') - end - - describe "when creating an HTTP client" do - it "should use the class's server and port if the indirection request provides neither" do - @request = double('request', :key => "foo", :server => nil, :port => nil) - expect(terminus.class).to receive(:port).and_return(321) - expect(terminus.class).to receive(:server).and_return("myserver") - expect(Puppet::Network::HttpPool).to receive(:connection).with('myserver', 321, anything).and_return("myconn") - expect(terminus.network(@request)).to eq("myconn") - end - - it "should use the server from the indirection request if one is present" do - @request = double('request', :key => "foo", :server => "myserver", :port => nil) - allow(terminus.class).to receive(:port).and_return(321) - expect(Puppet::Network::HttpPool).to receive(:connection).with('myserver', 321, anything).and_return("myconn") - expect(terminus.network(@request)).to eq("myconn") - end - - it "should use the port from the indirection request if one is present" do - @request = double('request', :key => "foo", :server => nil, :port => 321) - allow(terminus.class).to receive(:server).and_return("myserver") - expect(Puppet::Network::HttpPool).to receive(:connection).with('myserver', 321, anything).and_return("myconn") - expect(terminus.network(@request)).to eq("myconn") - end - end - - describe "#find" do - let(:http_method) { :get } - let(:response) { mock_response(200, 'body') } - let(:connection) { double('mock http connection', :get => response, :verify_callback= => nil) } - let(:request) { find_request('foo') } - - before :each do - allow(terminus).to receive(:network).and_return(connection) - end - - it_behaves_like 'a REST terminus method', :find - it_behaves_like 'a deserializing terminus method', :find - - describe "with a long set of parameters" do - it "calls post on the connection with the query params in the body" do - params = {} - 'aa'.upto('zz') do |s| - params[s] = 'foo' - end - - # The request special-cases this parameter, and it - # won't be passed on to the server, so we remove it here - # to avoid a failure. - params.delete('ip') - - params["environment"] = "production" - - request = find_request('whoa', params) - - expect(connection).to receive(:post) do |_,req,_| - expect(req.split("&").flatten).to match_array(params.map {|key,value| "#{key}=#{value}"}) - - mock_response(200, 'body') - end - - terminus.find(request) - end - end - - describe "with no parameters" do - it "calls get on the connection" do - request = find_request('foo bar') - - expect(connection).to receive(:get).with("#{url_prefix}/test_model/foo%20bar?environment=production&", anything).and_return(mock_response('200', 'response body')) - - expect(terminus.find(request)).to eq(model.new('foo bar', 'response body')) - end - end - - it "returns nil on 404" do - response = mock_response('404', nil) - - expect(connection).to receive(:get).and_return(response) - - expect(terminus.find(request)).to eq(nil) - end - - it 'raises no warning for a 404 (when not asked to do so)' do - response = mock_response('404', 'this is the notfound you are looking for') - expect(connection).to receive(:get).and_return(response) - expect{terminus.find(request)}.to_not raise_error() - end - - context 'when fail_on_404 is used in request' do - it 'raises an error for a 404 when asked to do so' do - request = find_request('foo', :fail_on_404 => true) - response = mock_response('404', 'this is the notfound you are looking for') - expect(connection).to receive(:get).and_return(response) - - expect do - terminus.find(request) - end.to raise_error( - Puppet::Error, - "Find #{url_prefix}/test_model/foo?environment=production&fail_on_404=true resulted in 404 with the message: this is the notfound you are looking for") - end - - it 'truncates the URI when it is very long' do - request = find_request('foo', :fail_on_404 => true, :long_param => ('A' * 100) + 'B') - response = mock_response('404', 'this is the notfound you are looking for') - expect(connection).to receive(:get).and_return(response) - - expect do - terminus.find(request) - end.to raise_error( - Puppet::Error, - /\/test_model\/foo.*\?environment=production&.*long_param=A+\.\.\..*resulted in 404 with the message/) - end - - it 'does not truncate the URI when logging debug information' do - Puppet.debug = true - request = find_request('foo', :fail_on_404 => true, :long_param => ('A' * 100) + 'B') - response = mock_response('404', 'this is the notfound you are looking for') - expect(connection).to receive(:get).and_return(response) - - expect do - terminus.find(request) - end.to raise_error( - Puppet::Error, - /\/test_model\/foo.*\?environment=production&.*long_param=A+B.*resulted in 404 with the message/) - end - end - - it "asks the model to deserialize the response body and sets the name on the resulting object to the find key" do - expect(connection).to receive(:get).and_return(response) - - expect(model).to receive(:convert_from).with(response['content-type'], response.body).and_return( - model.new('overwritten', 'decoded body') - ) - - expect(terminus.find(request)).to eq(model.new('foo', 'decoded body')) - end - - it "doesn't require the model to support name=" do - class Puppet::TestModel2 < Puppet::TestModel - undef_method :name= - end - - expect(connection).to receive(:get).and_return(response) - instance = Puppet::TestModel2.new('name', 'decoded body') - - expect(model).to receive(:convert_from).with(response['content-type'], response.body).and_return(instance) - - expect(terminus.find(request)).to eq(model.new('name', 'decoded body')) - end - - it "provides an Accept header containing the list of supported mime types joined with commas" do - expect(connection).to receive(:get).with(anything, hash_including("Accept" => "application/json, text/pson")).and_return(response) - - expect(terminus.model).to receive(:supported_formats).and_return([:json, :pson]) - terminus.find(request) - end - - it "provides a version header with the current puppet version" do - expect(connection).to receive(:get).with(anything, hash_including(Puppet::Network::HTTP::HEADER_PUPPET_VERSION => Puppet.version)).and_return(response) - - terminus.find(request) - end - - it "adds an Accept-Encoding header" do - expect(terminus).to receive(:add_accept_encoding).and_return({"accept-encoding" => "gzip"}) - - expect(connection).to receive(:get).with(anything, hash_including("accept-encoding" => "gzip")).and_return(response) - - terminus.find(request) - end - - it "uses only the mime-type from the content-type header when asking the model to deserialize" do - response = mock_response('200', 'mydata', "text/plain; charset=utf-8") - expect(connection).to receive(:get).and_return(response) - - expect(model).to receive(:convert_from).with("text/plain", "mydata").and_return("myobject") - - expect(terminus.find(request)).to eq("myobject") - end - - it "decompresses the body before passing it to the model for deserialization" do - uncompressed_body = "Why hello there" - compressed_body = Zlib::Deflate.deflate(uncompressed_body) - - response = mock_response('200', compressed_body, 'text/plain', 'deflate') - expect(connection).to receive(:get).and_return(response) - - expect(model).to receive(:convert_from).with("text/plain", uncompressed_body).and_return("myobject") - - expect(terminus.find(request)).to eq("myobject") - end - end - - describe "#head" do - let(:http_method) { :head } - let(:response) { mock_response(200, nil) } - let(:connection) { double('mock http connection', :head => response, :verify_callback= => nil) } - let(:request) { head_request('foo') } - - before :each do - allow(terminus).to receive(:network).and_return(connection) - end - - it_behaves_like 'a REST terminus method', :head - - it "returns true if there was a successful http response" do - expect(connection).to receive(:head).and_return(mock_response('200', nil)) - - expect(terminus.head(request)).to eq(true) - end - - it "returns false on a 404 response" do - expect(connection).to receive(:head).and_return(mock_response('404', nil)) - - expect(terminus.head(request)).to eq(false) - end - - it "provides a version header with the current puppet version" do - expect(connection).to receive(:head).with(anything, hash_including(Puppet::Network::HTTP::HEADER_PUPPET_VERSION => Puppet.version)).and_return(response) - - terminus.head(request) - end - end - - describe "#search" do - let(:http_method) { :get } - let(:response) { mock_response(200, 'data1,data2,data3') } - let(:connection) { double('mock http connection', :get => response, :verify_callback= => nil) } - let(:request) { search_request('foo') } - - before :each do - allow(terminus).to receive(:network).and_return(connection) - end - - it_behaves_like 'a REST terminus method', :search - it_behaves_like 'a deserializing terminus method', :search - - it "should call the GET http method on a network connection" do - expect(connection).to receive(:get).with("#{url_prefix}/test_models/foo?environment=production&", hash_including('Accept' => anything)).and_return(mock_response(200, 'data3, data4')) - - terminus.search(request) - end - - it "returns an empty list on 404" do - response = mock_response('404', nil) - - expect(connection).to receive(:get).and_return(response) - - expect(terminus.search(request)).to eq([]) - end - - it "asks the model to deserialize the response body into multiple instances" do - expect(terminus.search(request)).to eq([model.new('', 'data1'), model.new('', 'data2'), model.new('', 'data3')]) - end - - it "should provide an Accept header containing the list of supported formats joined with commas" do - expect(connection).to receive(:get).with(anything, hash_including("Accept" => "application/json, text/pson")).and_return(mock_response(200, '')) - - expect(terminus.model).to receive(:supported_formats).and_return([:json, :pson]) - terminus.search(request) - end - - it "provides a version header with the current puppet version" do - expect(connection).to receive(:get).with(anything, hash_including(Puppet::Network::HTTP::HEADER_PUPPET_VERSION => Puppet.version)).and_return(mock_response(200, '')) - - terminus.search(request) - end - - it "should return an empty array if serialization returns nil" do - allow(model).to receive(:convert_from_multiple).and_return(nil) - - expect(terminus.search(request)).to eq([]) - end - end - - describe "#destroy" do - let(:http_method) { :delete } - let(:response) { mock_response(200, 'body') } - let(:connection) { double('mock http connection', :delete => response, :verify_callback= => nil) } - let(:request) { delete_request('foo') } - - before :each do - allow(terminus).to receive(:network).and_return(connection) - end - - it_behaves_like 'a REST terminus method', :destroy - it_behaves_like 'a deserializing terminus method', :destroy - - it "should call the DELETE http method on a network connection" do - expect(connection).to receive(:delete).with("#{url_prefix}/test_model/foo?environment=production&", hash_including('Accept' => anything)).and_return(response) - - terminus.destroy(request) - end - - it "should fail if any options are provided, since DELETE apparently does not support query options" do - request = delete_request('foo', :one => "two", :three => "four") - - expect { terminus.destroy(request) }.to raise_error(ArgumentError) - end - - it "should deserialize and return the http response" do - expect(connection).to receive(:delete).and_return(response) - - expect(terminus.destroy(request)).to eq(model.new('', 'body')) - end - - it "returns nil on 404" do - response = mock_response('404', nil) - - expect(connection).to receive(:delete).and_return(response) - - expect(terminus.destroy(request)).to eq(nil) - end - - it "should provide an Accept header containing the list of supported formats joined with commas" do - expect(connection).to receive(:delete).with(anything, hash_including("Accept" => "application/json, text/pson")).and_return(response) - - expect(terminus.model).to receive(:supported_formats).and_return([:json, :pson]) - terminus.destroy(request) - end - - it "provides a version header with the current puppet version" do - expect(connection).to receive(:delete).with(anything, hash_including(Puppet::Network::HTTP::HEADER_PUPPET_VERSION => Puppet.version)).and_return(response) - - terminus.destroy(request) - end - end - - describe "#save" do - let(:http_method) { :put } - let(:response) { mock_response(200, 'body') } - let(:connection) { double('mock http connection', :put => response, :verify_callback= => nil) } - let(:instance) { model.new('the thing', 'some contents') } - let(:request) { save_request(instance.name, instance) } - - before :each do - allow(terminus).to receive(:network).and_return(connection) - end - - it_behaves_like 'a REST terminus method', :save - - it "should call the PUT http method on a network connection" do - expect(connection).to receive(:put).with("#{url_prefix}/test_model/the%20thing?environment=production&", anything, hash_including("Content-Type")).and_return(response) - - terminus.save(request) - end - - it "should fail if any options are provided, since PUT apparently does not support query options" do - request = save_request(instance.name, instance, :one => "two", :three => "four") - - expect { terminus.save(request) }.to raise_error(ArgumentError) - end - - it "should serialize the instance using the default format and pass the result as the body of the request" do - expect(instance).to receive(:render).and_return("serial_instance") - expect(connection).to receive(:put).with(anything, "serial_instance", anything).and_return(response) - - terminus.save(request) - end - - it "returns nil on 404" do - response = mock_response('404', nil) - - expect(connection).to receive(:put).and_return(response) - - expect(terminus.save(request)).to eq(nil) - end - - it "returns nil" do - expect(connection).to receive(:put).and_return(response) - - expect(terminus.save(request)).to be_nil - end - - it "should provide an Accept header containing the list of supported formats joined with commas" do - expect(connection).to receive(:put).with(anything, anything, hash_including("Accept" => "application/json, text/pson")).and_return(response) - - expect(instance).to receive(:render).and_return('') - expect(model).to receive(:supported_formats).and_return([:json, :pson]) - expect(instance).to receive(:mime).and_return("supported") - - terminus.save(request) - end - - it "provides a version header with the current puppet version" do - expect(connection).to receive(:put).with(anything, anything, hash_including(Puppet::Network::HTTP::HEADER_PUPPET_VERSION => Puppet.version)).and_return(response) - - terminus.save(request) - end - - it "should provide a Content-Type header containing the mime-type of the sent object" do - expect(instance).to receive(:mime).and_return("mime") - expect(connection).to receive(:put).with(anything, anything, hash_including('Content-Type' => "mime")).and_return(response) - - terminus.save(request) - end - end - - describe '#handle_response' do - # There are multiple request types to choose from, this may not be the one I want for this situation - let(:response) { mock_response(200, 'body') } - let(:connection) { double('mock http connection', :put => response, :verify_callback= => nil) } - let(:instance) { model.new('the thing', 'some contents') } - let(:request) { save_request(instance.name, instance) } - - before :each do - allow(terminus).to receive(:network).and_return(connection) - end - - it 'adds server_agent_version to the context if not already set' do - expect(Puppet).to receive(:push_context).with(:server_agent_version => Puppet.version) - terminus.handle_response(request, response) - end - - it 'does not add server_agent_version to the context if it is already set' do - Puppet.override(:server_agent_version => "5.3.4") do - expect(Puppet).not_to receive(:push_context) - terminus.handle_response(request, response) - end - end - - it 'downgrades to pson and emits a warning' do - allow(response).to receive(:[]).with(Puppet::Network::HTTP::HEADER_PUPPET_VERSION).and_return('4.2.8') - Puppet[:preferred_serialization_format] = 'other' - - expect(Puppet).to receive(:warning).with('Downgrading to PSON for future requests') - - terminus.handle_response(request, response) - - expect(Puppet[:preferred_serialization_format]).to eq('pson') - end - - it 'preserves the set serialization format' do - Puppet[:preferred_serialization_format] = 'other' - - expect(Puppet[:preferred_serialization_format]).to eq('other') - - terminus.handle_response(request, response) - end - end - - context 'dealing with SRV settings' do - [ - :destroy, - :find, - :head, - :save, - :search - ].each do |method| - it "##{method} passes the SRV service, and fall-back server & port to the request's do_request method" do - request = Puppet::Indirector::Request.new(:indirection, method, 'key', nil) - stub_response = mock_response('200', 'body') - - expect(request).to receive(:do_request).with(terminus.class.srv_service, terminus.class.server, terminus.class.port).and_return(stub_response) - - terminus.send(method, request) - end - end + it "raises when destroy is called" do + expect { + terminus.destroy(Puppet::Indirector::Request.new(:test_model, :destroy, 'foo', nil)) + }.to raise_error(NotImplementedError) end end From 3a22ffd012d44e8b56fba27d0b4ab31712d87b19 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Fri, 24 Jul 2020 15:29:51 -0700 Subject: [PATCH 018/731] (PUP-10440) Remove networking code from indirector request The indirector request object contained logic about how to serialize and encode HTTP parameters and SRV resolution, even though that is specific to HTTP/REST termini, but not memory, file, etc termini. All of the HTTP serialization/encoding logic is in the HTTP client, so remove it from the indirector request. --- lib/puppet/indirector/request.rb | 100 ---------- spec/unit/indirector/request_spec.rb | 264 --------------------------- 2 files changed, 364 deletions(-) diff --git a/lib/puppet/indirector/request.rb b/lib/puppet/indirector/request.rb index 824b3fd8ee9..3588ccf308f 100644 --- a/lib/puppet/indirector/request.rb +++ b/lib/puppet/indirector/request.rb @@ -109,47 +109,6 @@ def plural? method == :search end - # Create the query string, if options are present. - def query_string - return "" if options.nil? || options.empty? - encode_params(expand_into_parameters(options.to_a)) - end - - def expand_into_parameters(data) - data.inject([]) do |params, key_value| - key, value = key_value - - expanded_value = case value - when Array - value.collect { |val| [key, val] } - else - [key_value] - end - - params.concat(expand_primitive_types_into_parameters(expanded_value)) - end - end - - def expand_primitive_types_into_parameters(data) - data.inject([]) do |params, key_value| - key, value = key_value - case value - when nil - params - when true, false, String, Symbol, Integer, Float - params << [key, value] - else - raise ArgumentError, _("HTTP REST queries cannot handle values of type '%{klass}'") % { klass: value.class } - end - end - end - - def encode_params(params) - params.collect do |key, value| - "#{key}=#{Puppet::Util.uri_query_encode(value.to_s)}" - end.join("&") - end - def initialize_from_hash(hash) @indirection_name = hash['indirection_name'].to_sym @method = hash['method'].to_sym @@ -182,65 +141,6 @@ def description return(uri ? uri : "/#{indirection_name}/#{key}") end - def do_request(srv_service=:puppet, default_server=nil, default_port=nil, &block) - # We were given a specific server to use, so just use that one. - # This happens if someone does something like specifying a file - # source using a puppet:// URI with a specific server. - return yield(self) if !self.server.nil? - - if Puppet.settings[:use_srv_records] - # We may want to consider not creating a new resolver here - # every request eventually, to take advantage of the resolver's - # caching behavior. - resolver = Puppet::Network::Resolver.new - resolver.each_srv_record(Puppet.settings[:srv_domain], srv_service) do |srv_server, srv_port| - begin - self.server = srv_server - self.port = srv_port - return yield(self) - rescue SystemCallError => e - Puppet.warning _("Error connecting to %{srv_server}:%{srv_port}: %{message}") % { srv_server: srv_server, srv_port: srv_port, message: e.message } - end - end - end - - if default_server - self.server = default_server - else - self.server = Puppet.lookup(:server) do - primary_server = Puppet.settings[:server_list][0] - if primary_server - #TRANSLATORS 'server_list' is the name of a setting and should not be translated - debug_once _("Selected server from first entry of the `server_list` setting: %{server}") % {server: primary_server[0]} - primary_server[0] - else - #TRANSLATORS 'server' is the name of a setting and should not be translated - debug_once _("Selected server from the `server` setting: %{server}") % {server: Puppet.settings[:server]} - Puppet.settings[:server] - end - end - end - - if default_port - self.port = default_port - else - self.port = Puppet.lookup(:serverport) do - primary_server = Puppet.settings[:server_list][0] - if primary_server - #TRANSLATORS 'server_list' is the name of a setting and should not be translated - debug_once _("Selected port from the first entry of the `server_list` setting: %{port}") % {port: primary_server[1]} - primary_server[1] - else - #TRANSLATORS 'masterport' is the name of a setting and should not be translated - debug_once _("Selected port from the `masterport` setting: %{port}") % {port: Puppet.settings[:masterport]} - Puppet.settings[:masterport] - end - end - end - - return yield(self) - end - def remote? self.node or self.ip end diff --git a/spec/unit/indirector/request_spec.rb b/spec/unit/indirector/request_spec.rb index cd8798ab70c..c4b3f9c5bc3 100644 --- a/spec/unit/indirector/request_spec.rb +++ b/spec/unit/indirector/request_spec.rb @@ -271,229 +271,6 @@ expect(Puppet::Indirector::Request.new(:myind, :find, "my key", nil, :node => 'foo').to_hash[:node]).to eq('foo') end - describe "when building a query string from its options" do - def a_request_with_options(options) - Puppet::Indirector::Request.new(:myind, :find, "my key", nil, options) - end - - def the_parsed_query_string_from(request) - CGI.parse(request.query_string.sub(/^\?/, '')) - end - - it "should return an empty query string if there are no options" do - request = a_request_with_options(nil) - - expect(request.query_string).to eq("") - end - - it "should return an empty query string if the options are empty" do - request = a_request_with_options({}) - - expect(request.query_string).to eq("") - end - - it "should include all options in the query string, separated by '&'" do - request = a_request_with_options(:one => "two", :three => "four") - - expect(the_parsed_query_string_from(request)).to eq({ - "one" => ["two"], - "three" => ["four"] - }) - end - - it "should ignore nil options" do - request = a_request_with_options(:one => "two", :three => nil) - - expect(the_parsed_query_string_from(request)).to eq({ - "one" => ["two"] - }) - end - - it "should convert 'true' option values into strings" do - request = a_request_with_options(:one => true) - - expect(the_parsed_query_string_from(request)).to eq({ - "one" => ["true"] - }) - end - - it "should convert 'false' option values into strings" do - request = a_request_with_options(:one => false) - - expect(the_parsed_query_string_from(request)).to eq({ - "one" => ["false"] - }) - end - - it "should convert to a string all option values that are integers" do - request = a_request_with_options(:one => 50) - - expect(the_parsed_query_string_from(request)).to eq({ - "one" => ["50"] - }) - end - - it "should convert to a string all option values that are floating point numbers" do - request = a_request_with_options(:one => 1.2) - - expect(the_parsed_query_string_from(request)).to eq({ - "one" => ["1.2"] - }) - end - - it "should CGI-escape all option values that are strings" do - request = a_request_with_options(:one => "one two") - - expect(the_parsed_query_string_from(request)).to eq({ - "one" => ["one two"] - }) - end - - it "should convert an array of values into multiple entries for the same key" do - request = a_request_with_options(:one => %w{one two}) - - expect(the_parsed_query_string_from(request)).to eq({ - "one" => ["one", "two"] - }) - end - - it "should stringify simple data types inside an array" do - request = a_request_with_options(:one => ['one', nil]) - - expect(the_parsed_query_string_from(request)).to eq({ - "one" => ["one"] - }) - end - - it "should error if an array contains another array" do - request = a_request_with_options(:one => ['one', ["not allowed"]]) - - expect { request.query_string }.to raise_error(ArgumentError) - end - - it "should error if an array contains illegal data" do - request = a_request_with_options(:one => ['one', { :not => "allowed" }]) - - expect { request.query_string }.to raise_error(ArgumentError) - end - - it "should convert to a string and CGI-escape all option values that are symbols" do - request = a_request_with_options(:one => :"sym bol") - - expect(the_parsed_query_string_from(request)).to eq({ - "one" => ["sym bol"] - }) - end - - it "should fail if options other than booleans or strings are provided" do - request = a_request_with_options(:one => { :one => :two }) - - expect { request.query_string }.to raise_error(ArgumentError) - end - end - - context '#do_request' do - before :each do - @request = Puppet::Indirector::Request.new(:myind, :find, "my key", nil) - end - - context 'when not using SRV records' do - before :each do - Puppet.settings[:use_srv_records] = false - end - - it "yields the request with the default server and port when no server or port were specified on the original request" do - count = 0 - rval = @request.do_request(:puppet, 'puppet.example.com', '90210') do |got| - count += 1 - expect(got.server).to eq('puppet.example.com') - expect(got.port).to eq('90210') - 'Block return value' - end - expect(count).to eq(1) - - expect(rval).to eq('Block return value') - end - end - - context 'when using SRV records' do - before :each do - Puppet.settings[:use_srv_records] = true - Puppet.settings[:srv_domain] = 'example.com' - end - - it "yields the request with the original server and port unmodified" do - @request.server = 'puppet.example.com' - @request.port = '90210' - - count = 0 - rval = @request.do_request do |got| - count += 1 - expect(got.server).to eq('puppet.example.com') - expect(got.port).to eq('90210') - 'Block return value' - end - expect(count).to eq(1) - - expect(rval).to eq('Block return value') - end - - context "when SRV returns servers" do - before :each do - @dns_mock = double('dns') - expect(Resolv::DNS).to receive(:new).and_return(@dns_mock) - - @port = 7205 - @target = 'example.com' - record = Resolv::DNS::Resource::IN::SRV.new(0, 0, @port, @target) - record.instance_variable_set(:@ttl, 10) - @srv_records = [record] - - expect(@dns_mock).to receive(:getresources). - with("_x-puppet._tcp.#{Puppet.settings[:srv_domain]}", Resolv::DNS::Resource::IN::SRV). - and_return(@srv_records) - end - - it "yields a request using the server and port from the SRV record" do - count = 0 - rval = @request.do_request do |got| - count += 1 - expect(got.server).to eq('example.com') - expect(got.port).to eq(7205) - - @block_return - end - expect(count).to eq(1) - - expect(rval).to eq(@block_return) - end - - it "should fall back to the default server when the block raises a SystemCallError" do - count = 0 - second_pass = nil - - rval = @request.do_request(:puppet, 'puppet', 8140) do |got| - count += 1 - - if got.server == 'example.com' then - raise SystemCallError, "example failure" - else - second_pass = got - end - - @block_return - end - - expect(second_pass.server).to eq('puppet') - expect(second_pass.port).to eq(8140) - expect(count).to eq(2) - - expect(rval).to eq(@block_return) - end - end - end - end - describe "#remote?" do def request(options = {}) Puppet::Indirector::Request.new('node', 'find', 'localhost', nil, options) @@ -515,45 +292,4 @@ def request(options = {}) expect(request(:node => 'example.com', :ip => '127.0.0.1')).to be_remote end end - - describe "failover" do - it "should use the provided failover host and port" do - Puppet.override(:server => 'myhost', :serverport => 666) do - req = Puppet::Indirector::Request.new('node', 'find', 'localhost', nil) - req.do_request() do |request| - expect(request.server).to eq('myhost') - expect(request.port).to eq(666) - end - end - end - - it "should not use raw settings when failover fails" do - Puppet.override(:server => nil, :serverport => nil) do - req = Puppet::Indirector::Request.new('node', 'find', 'localhost', nil) - req.do_request() do |request| - expect(request.server).to be_nil - expect(request.port).to be_nil - expect(Puppet.settings[:server]).not_to be_nil - expect(Puppet.settings[:masterport]).not_to be_nil - end - end - end - - it "should use server_list when set and failover has not occured" do - Puppet.settings[:server_list] = [['myhost',666]] - req = Puppet::Indirector::Request.new('node', 'find', 'localhost', nil) - req.do_request() do |request| - expect(request.server).to eq('myhost') - expect(request.port).to eq(666) - end - end - - it "should use server when server_list is not set" do - req = Puppet::Indirector::Request.new('node', 'find', 'localhost', nil) - req.do_request() do |request| - expect(request.server).to eq(Puppet.settings[:server]) - expect(request.port).to eq(Puppet.settings[:masterport]) - end - end - end end From a12a542914dcf0f9646b9ca1576bd24643567e53 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Fri, 24 Jul 2020 15:47:12 -0700 Subject: [PATCH 019/731] (PUP-10440) Remove IndirectedRoutes#request_to_uri* Puppetserver calls the `IndirectedRoutes#call` method to handle an HTTP request for indirected routes like `/puppet/v3/catalog`. Confusingly, the file also contains agent-side methods so that `Puppet::Node.indirection.find` is mapped to an HTTP request containing `/puppet/v3/node?environment=production`. That logic now lives in the respective REST service endpoints in `Puppet::HTTP::Service::*`, so remove it from the indirected routes handler. --- .../network/http/api/indirected_routes.rb | 11 ---- .../http/api/indirected_routes_spec.rb | 55 ------------------- 2 files changed, 66 deletions(-) diff --git a/lib/puppet/network/http/api/indirected_routes.rb b/lib/puppet/network/http/api/indirected_routes.rb index 417e1fec0a3..25eff90dd14 100644 --- a/lib/puppet/network/http/api/indirected_routes.rb +++ b/lib/puppet/network/http/api/indirected_routes.rb @@ -120,17 +120,6 @@ def uri2indirection(http_method, uri, params) [indirection, method, key, params] end - def self.request_to_uri(request) - uri, body = request_to_uri_and_body(request) - "#{uri}?#{body}" - end - - def self.request_to_uri_and_body(request) - url_prefix = IndirectionType.url_prefix_for(request.indirection_name.to_s) - indirection = request.method == :search ? pluralize(request.indirection_name.to_s) : request.indirection_name.to_s - ["#{url_prefix}/#{indirection}/#{Puppet::Util.uri_encode(request.key)}", "environment=#{request.environment.name}&#{request.query_string}"] - end - private # Execute our find. diff --git a/spec/unit/network/http/api/indirected_routes_spec.rb b/spec/unit/network/http/api/indirected_routes_spec.rb index 51adee8b0dc..b67b227d14c 100644 --- a/spec/unit/network/http/api/indirected_routes_spec.rb +++ b/spec/unit/network/http/api/indirected_routes_spec.rb @@ -176,61 +176,6 @@ end - describe "when converting a request into a URI" do - let(:environment) { Puppet::Node::Environment.create(:myenv, []) } - let(:request) { Puppet::Indirector::Request.new(:foo, :find, "with spaces", nil, :foo => :bar, :environment => environment) } - - before do - allow(handler).to receive(:handler).and_return("foo") - end - - it "should include the environment in the query string of the URI" do - expect(handler.class.request_to_uri(request)).to eq("#{master_url_prefix}/foo/with%20spaces?environment=myenv&foo=bar") - end - - it "should include the correct url prefix if it is a ca request" do - allow(request).to receive(:indirection_name).and_return("certificate") - expect(handler.class.request_to_uri(request)).to eq("#{ca_url_prefix}/certificate/with%20spaces?environment=myenv&foo=bar") - end - - it "should pluralize the indirection name if the method is 'search'" do - allow(request).to receive(:method).and_return(:search) - expect(handler.class.request_to_uri(request).split("/")[3]).to eq("foos") - end - - it "should add the query string to the URI" do - expect(request).to receive(:query_string).and_return("query") - expect(handler.class.request_to_uri(request)).to match(/\&query$/) - end - end - - describe "when converting a request into a URI with body" do - let(:environment) { Puppet::Node::Environment.create(:myenv, []) } - let(:request) { Puppet::Indirector::Request.new(:foo, :find, "with spaces", nil, :foo => :bar, :environment => environment) } - - it "should use the indirection as the first field of the URI" do - expect(handler.class.request_to_uri_and_body(request).first.split("/")[3]).to eq("foo") - end - - it "should use the escaped key as the remainder of the URI" do - escaped = Puppet::Util.uri_encode("with spaces") - expect(handler.class.request_to_uri_and_body(request).first.split("/")[4].sub(/\?.+/, '')).to eq(escaped) - end - - it "should include the correct url prefix if it is a master request" do - expect(handler.class.request_to_uri_and_body(request).first).to eq("#{master_url_prefix}/foo/with%20spaces") - end - - it "should include the correct url prefix if it is a ca request" do - allow(request).to receive(:indirection_name).and_return("certificate") - expect(handler.class.request_to_uri_and_body(request).first).to eq("#{ca_url_prefix}/certificate/with%20spaces") - end - - it "should return the URI and body separately" do - expect(handler.class.request_to_uri_and_body(request)).to eq(["#{master_url_prefix}/foo/with%20spaces", "environment=myenv&foo=bar"]) - end - end - describe "when processing a request" do it "should raise not_authorized_error when authorization fails" do data = Puppet::IndirectorTesting.new("my data") From bd1d1a786fbdc731fe29e77a970494ebda361d6f Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Thu, 6 Aug 2020 07:13:40 +0000 Subject: [PATCH 020/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 2 +- man/man8/puppet.8 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index 444223dbe68..d41272b4465 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPETCONF" "5" "July 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPETCONF" "5" "August 2020" "Puppet, Inc." "Puppet manual" \fBThis page is autogenerated; any changes will get overwritten\fR . .SH "Configuration settings" diff --git a/man/man8/puppet.8 b/man/man8/puppet.8 index 9bc8b90fe0d..c7ecbf60aa3 100644 --- a/man/man8/puppet.8 +++ b/man/man8/puppet.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET" "8" "July 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET" "8" "August 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\fR From f60b91c982b35bc9357ca3a20d031013a9dc5071 Mon Sep 17 00:00:00 2001 From: gimmy Date: Thu, 6 Aug 2020 11:40:11 +0300 Subject: [PATCH 021/731] (maint) ship under puppet 7 nightly --- ext/build_defaults.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/build_defaults.yaml b/ext/build_defaults.yaml index 3ebf511cd2b..08855dc6cbd 100644 --- a/ext/build_defaults.yaml +++ b/ext/build_defaults.yaml @@ -16,4 +16,4 @@ apt_signing_server: 'apt.puppetlabs.com' apt_repo_url: 'http://apt.puppetlabs.com' apt_repo_path: '/opt/repository/incoming' tar_host: 'downloads.puppetlabs.com' -nonfinal_gem_path: '/opt/repository-nightlies/downloads/gems/puppet6-nightly' +nonfinal_gem_path: '/opt/repository-nightlies/downloads/gems/puppet7-nightly' From 9dc1c37193b7b7a74b7bb42017e68508a65ad58d Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Thu, 6 Aug 2020 13:13:38 +0000 Subject: [PATCH 022/731] (packaging) Updating the puppet.pot file --- locales/puppet.pot | 157 +++++++++++++++------------------------------ 1 file changed, 52 insertions(+), 105 deletions(-) diff --git a/locales/puppet.pot b/locales/puppet.pot index 8ffe6aad867..c9b9d220e45 100644 --- a/locales/puppet.pot +++ b/locales/puppet.pot @@ -6,11 +6,11 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Puppet automation framework 6.17.0-116-gd30948520d\n" +"Project-Id-Version: Puppet automation framework 6.17.0-134-gc6e708372c\n" "\n" "Report-Msgid-Bugs-To: https://tickets.puppetlabs.com\n" -"POT-Creation-Date: 2020-07-31 16:42+0000\n" -"PO-Revision-Date: 2020-07-31 16:42+0000\n" +"POT-Creation-Date: 2020-08-06 13:13+0000\n" +"PO-Revision-Date: 2020-08-06 13:13+0000\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -400,31 +400,31 @@ msgid "" "%{run_help}" msgstr "" -#: ../lib/puppet/application/lookup.rb:99 +#: ../lib/puppet/application/lookup.rb:105 msgid "Interactive Hiera lookup" msgstr "" -#: ../lib/puppet/application/lookup.rb:266 +#: ../lib/puppet/application/lookup.rb:272 msgid "" "The options %{deep_merge_opts} are only available with '--merge deep'\n" "%{run_help}" msgstr "" -#: ../lib/puppet/application/lookup.rb:277 +#: ../lib/puppet/application/lookup.rb:283 msgid "" "The --merge option only accepts %{strategies}, or %{last_strategy}\n" "%{run_help}" msgstr "" -#: ../lib/puppet/application/lookup.rb:302 +#: ../lib/puppet/application/lookup.rb:308 msgid "No keys were given to lookup." msgstr "" -#: ../lib/puppet/application/lookup.rb:310 +#: ../lib/puppet/application/lookup.rb:316 msgid "Unknown rendering format '%{format}'" msgstr "" -#: ../lib/puppet/application/lookup.rb:360 ../lib/puppet/face/epp.rb:520 +#: ../lib/puppet/application/lookup.rb:366 ../lib/puppet/face/epp.rb:520 msgid "Incorrect formatted data in %{fact_file} given via the --facts flag" msgstr "" @@ -2259,7 +2259,7 @@ msgstr "" msgid "Sleeping for %{interval} seconds before retrying the request" msgstr "" -#: ../lib/puppet/http/client.rb:369 ../lib/puppet/indirector/request.rb:142 +#: ../lib/puppet/http/client.rb:369 msgid "HTTP REST queries cannot handle values of type '%{klass}'" msgstr "" @@ -2291,7 +2291,7 @@ msgstr "" msgid "Ignoring extra header \"%{name}\" as it has no value." msgstr "" -#: ../lib/puppet/http/service.rb:145 ../lib/puppet/indirector/rest.rb:288 +#: ../lib/puppet/http/service.rb:145 ../lib/puppet/indirector/rest.rb:54 msgid "No content type in http response; cannot parse" msgstr "" @@ -2445,7 +2445,7 @@ msgstr "" msgid "Unable to serialize catalog to json, retrying with pson" msgstr "" -#: ../lib/puppet/indirector/catalog/rest.rb:34 ../lib/puppet/indirector/facts/rest.rb:22 ../lib/puppet/indirector/file_content/rest.rb:33 ../lib/puppet/indirector/file_metadata/rest.rb:30 ../lib/puppet/indirector/node/rest.rb:25 ../lib/puppet/indirector/rest.rb:146 ../lib/puppet/indirector/status/rest.rb:21 +#: ../lib/puppet/indirector/catalog/rest.rb:32 ../lib/puppet/indirector/facts/rest.rb:20 ../lib/puppet/indirector/file_content/rest.rb:29 ../lib/puppet/indirector/file_metadata/rest.rb:26 ../lib/puppet/indirector/node/rest.rb:23 ../lib/puppet/indirector/status/rest.rb:19 msgid "Find %{uri} resulted in 404 with the message: %{body}" msgstr "" @@ -2549,7 +2549,7 @@ msgstr "" msgid "You cannot save facts to the code store; it is only used for getting facts from a remote device" msgstr "" -#: ../lib/puppet/indirector/facts/rest.rb:30 ../lib/puppet/indirector/rest.rb:198 +#: ../lib/puppet/indirector/facts/rest.rb:28 msgid "PUT does not accept options" msgstr "" @@ -2776,7 +2776,7 @@ msgstr "" msgid "No report named '%{name}'" msgstr "" -#: ../lib/puppet/indirector/report/rest.rb:36 +#: ../lib/puppet/indirector/report/rest.rb:31 msgid "Server version %{version} does not accept reports in '%{format}', use `preferred_serialization_format=pson`" msgstr "" @@ -2792,31 +2792,7 @@ msgstr "" msgid "Could not find indirection '%{indirection}'" msgstr "" -#: ../lib/puppet/indirector/request.rb:202 -msgid "Error connecting to %{srv_server}:%{srv_port}: %{message}" -msgstr "" - -#. TRANSLATORS 'server_list' is the name of a setting and should not be translated -#: ../lib/puppet/indirector/request.rb:214 -msgid "Selected server from first entry of the `server_list` setting: %{server}" -msgstr "" - -#. TRANSLATORS 'server' is the name of a setting and should not be translated -#: ../lib/puppet/indirector/request.rb:218 -msgid "Selected server from the `server` setting: %{server}" -msgstr "" - -#. TRANSLATORS 'server_list' is the name of a setting and should not be translated -#: ../lib/puppet/indirector/request.rb:231 -msgid "Selected port from the first entry of the `server_list` setting: %{port}" -msgstr "" - -#. TRANSLATORS 'masterport' is the name of a setting and should not be translated -#: ../lib/puppet/indirector/request.rb:235 -msgid "Selected port from the `masterport` setting: %{port}" -msgstr "" - -#: ../lib/puppet/indirector/request.rb:266 +#: ../lib/puppet/indirector/request.rb:166 msgid "Could not understand URL %{key}: %{detail}" msgstr "" @@ -2828,36 +2804,7 @@ msgstr "" msgid "Resource instance does not match request key" msgstr "" -#: ../lib/puppet/indirector/rest.rb:115 -msgid "Puppet::Indirector::Rest#find is deprecated. Use Puppet::HTTP::Client instead." -msgstr "" - -#: ../lib/puppet/indirector/rest.rb:154 -msgid "Puppet::Indirector::Rest#head is deprecated. Use Puppet::HTTP::Client instead." -msgstr "" - -#: ../lib/puppet/indirector/rest.rb:167 -msgid "Puppet::Indirector::Rest#search is deprecated. Use Puppet::HTTP::Client instead." -msgstr "" - -#: ../lib/puppet/indirector/rest.rb:181 -msgid "Puppet::Indirector::Rest#destroy is deprecated. Use Puppet::HTTP::Client instead." -msgstr "" - -#: ../lib/puppet/indirector/rest.rb:182 -msgid "DELETE does not accept options" -msgstr "" - -#: ../lib/puppet/indirector/rest.rb:197 -msgid "Puppet::Indirector::Rest#save is deprecated. Use Puppet::HTTP::Client instead." -msgstr "" - -#. TRANSLATORS "PSON" should not be translated -#: ../lib/puppet/indirector/rest.rb:235 -msgid "Downgrading to PSON for future requests" -msgstr "" - -#: ../lib/puppet/indirector/rest.rb:277 ../lib/puppet/rest/response.rb:31 +#: ../lib/puppet/indirector/rest.rb:43 ../lib/puppet/rest/response.rb:31 msgid "Error %{code} on SERVER: %{returned_message}" msgstr "" @@ -3910,45 +3857,45 @@ msgstr "" msgid "No request key specified in %{uri}" msgstr "" -#: ../lib/puppet/network/http/api/indirected_routes.rb:140 +#: ../lib/puppet/network/http/api/indirected_routes.rb:129 msgid "Could not find %{value0} %{key}" msgstr "" -#: ../lib/puppet/network/http/api/indirected_routes.rb:147 +#: ../lib/puppet/network/http/api/indirected_routes.rb:136 msgid "Rendered result in %{format}" msgstr "" -#: ../lib/puppet/network/http/api/indirected_routes.rb:153 +#: ../lib/puppet/network/http/api/indirected_routes.rb:142 msgid "Sent response" msgstr "" -#: ../lib/puppet/network/http/api/indirected_routes.rb:161 +#: ../lib/puppet/network/http/api/indirected_routes.rb:150 msgid "Could not find %{indirection} %{key}" msgstr "" -#: ../lib/puppet/network/http/api/indirected_routes.rb:173 +#: ../lib/puppet/network/http/api/indirected_routes.rb:162 msgid "Could not find instances in %{indirection} with '%{key}'" msgstr "" -#: ../lib/puppet/network/http/api/indirected_routes.rb:221 ../lib/puppet/network/http/request.rb:61 +#: ../lib/puppet/network/http/api/indirected_routes.rb:210 ../lib/puppet/network/http/request.rb:61 msgid "No supported formats are acceptable (Accept: %{accepted_formats})" msgstr "" -#: ../lib/puppet/network/http/api/indirected_routes.rb:246 +#: ../lib/puppet/network/http/api/indirected_routes.rb:235 msgid "The request body is invalid: %{message}" msgstr "" #. TRANSLATORS "mime-type" is a keyword and should not be translated #. TRANSLATORS "mime-type" is a keyword and should not be translated -#: ../lib/puppet/network/http/api/indirected_routes.rb:252 ../lib/puppet/network/http/request.rb:32 +#: ../lib/puppet/network/http/api/indirected_routes.rb:241 ../lib/puppet/network/http/request.rb:32 msgid "Client sent a mime-type (%{header}) that doesn't correspond to a format we support" msgstr "" -#: ../lib/puppet/network/http/api/indirected_routes.rb:258 +#: ../lib/puppet/network/http/api/indirected_routes.rb:247 msgid "No support for http method %{http_method}" msgstr "" -#: ../lib/puppet/network/http/api/indirected_routes.rb:263 +#: ../lib/puppet/network/http/api/indirected_routes.rb:252 msgid "No support for plurality %{indirection} for %{http_method} operations" msgstr "" @@ -7278,15 +7225,15 @@ msgstr "" msgid "ruby-shadow doesn't support %{method}" msgstr "" -#: ../lib/puppet/provider/user/windows_adsi.rb:128 +#: ../lib/puppet/provider/user/windows_adsi.rb:145 msgid "The user account '%s' is disabled; The password will still be changed" msgstr "" -#: ../lib/puppet/provider/user/windows_adsi.rb:130 +#: ../lib/puppet/provider/user/windows_adsi.rb:147 msgid "The user account '%s' is locked out; The password will still be changed" msgstr "" -#: ../lib/puppet/provider/user/windows_adsi.rb:132 +#: ../lib/puppet/provider/user/windows_adsi.rb:149 msgid "The user account '%s' is expired; The password will still be changed" msgstr "" @@ -8863,15 +8810,15 @@ msgstr "" msgid "Setting enable to %{value} is only supported on Microsoft Windows." msgstr "" -#: ../lib/puppet/type/service.rb:162 +#: ../lib/puppet/type/service.rb:166 msgid "The 'logonaccount' parameter is mandatory when setting 'logonpassword'." msgstr "" -#: ../lib/puppet/type/service.rb:163 ../lib/puppet/type/user.rb:256 +#: ../lib/puppet/type/service.rb:167 ../lib/puppet/type/user.rb:271 msgid "Passwords cannot include ':'" msgstr "" -#: ../lib/puppet/type/service.rb:300 +#: ../lib/puppet/type/service.rb:304 msgid "\"%{value}\" is not a positive integer: the timeout parameter must be specified as a positive integer" msgstr "" @@ -8906,81 +8853,81 @@ msgstr "" msgid "File does not exist" msgstr "" -#: ../lib/puppet/type/user.rb:167 +#: ../lib/puppet/type/user.rb:182 msgid "Could not find group(s) %{groups}" msgstr "" -#: ../lib/puppet/type/user.rb:276 +#: ../lib/puppet/type/user.rb:291 msgid "Password minimum age must be provided as a number." msgstr "" -#: ../lib/puppet/type/user.rb:295 +#: ../lib/puppet/type/user.rb:310 msgid "Password maximum age must be provided as a number." msgstr "" -#: ../lib/puppet/type/user.rb:326 +#: ../lib/puppet/type/user.rb:341 msgid "Group names must be provided, not GID numbers." msgstr "" -#: ../lib/puppet/type/user.rb:328 +#: ../lib/puppet/type/user.rb:343 msgid "Group names must be provided as an array, not a comma-separated list." msgstr "" -#: ../lib/puppet/type/user.rb:329 +#: ../lib/puppet/type/user.rb:344 msgid "Group names must not be empty. If you want to specify \"no groups\" pass an empty array" msgstr "" -#: ../lib/puppet/type/user.rb:422 +#: ../lib/puppet/type/user.rb:437 msgid "User provider %{name} can not manage home directories" msgstr "" #. TRANSLATORS YYYY-MM-DD represents a date with a four-digit year, a two-digit month, and a two-digit day, #. TRANSLATORS separated by dashes. -#: ../lib/puppet/type/user.rb:439 +#: ../lib/puppet/type/user.rb:454 msgid "Expiry dates must be YYYY-MM-DD or the string \"absent\"" msgstr "" -#: ../lib/puppet/type/user.rb:506 +#: ../lib/puppet/type/user.rb:521 msgid "Role names must be provided, not numbers" msgstr "" -#: ../lib/puppet/type/user.rb:508 +#: ../lib/puppet/type/user.rb:523 msgid "Role names must be provided as an array, not a comma-separated list" msgstr "" -#: ../lib/puppet/type/user.rb:545 +#: ../lib/puppet/type/user.rb:560 msgid "Auth names must be provided, not numbers" msgstr "" -#: ../lib/puppet/type/user.rb:547 +#: ../lib/puppet/type/user.rb:562 msgid "Auth names must be provided as an array, not a comma-separated list" msgstr "" -#: ../lib/puppet/type/user.rb:571 +#: ../lib/puppet/type/user.rb:586 msgid "Profile names must be provided, not numbers" msgstr "" -#: ../lib/puppet/type/user.rb:573 +#: ../lib/puppet/type/user.rb:588 msgid "Profile names must be provided as an array, not a comma-separated list" msgstr "" -#: ../lib/puppet/type/user.rb:684 +#: ../lib/puppet/type/user.rb:699 msgid "Ssh_authorized_key type is not available. Cannot purge SSH keys." msgstr "" -#: ../lib/puppet/type/user.rb:722 +#: ../lib/puppet/type/user.rb:737 msgid "Each entry for purge_ssh_keys must be a string, not a %{klass}" msgstr "" -#: ../lib/puppet/type/user.rb:725 +#: ../lib/puppet/type/user.rb:740 msgid "Paths to keyfiles must be absolute, not %{entry}" msgstr "" -#: ../lib/puppet/type/user.rb:729 +#: ../lib/puppet/type/user.rb:744 msgid "purge_ssh_keys must be true, false, or an array of file names, not %{value}" msgstr "" -#: ../lib/puppet/type/user.rb:757 +#: ../lib/puppet/type/user.rb:772 msgid "Class name must be provided." msgstr "" @@ -9899,7 +9846,7 @@ msgstr "" msgid "Unable to read wide strings with %{null_terminator} terminal nulls" msgstr "" -#: ../lib/puppet/util/windows/api_types.rb:216 +#: ../lib/puppet/util/windows/api_types.rb:230 msgid "Bad GUID format." msgstr "" From 176b8e3041e2a90a4b5c8dfd9c1a43398cfccb99 Mon Sep 17 00:00:00 2001 From: Florin Dragos Date: Thu, 6 Aug 2020 16:14:14 +0300 Subject: [PATCH 023/731] (PUP-10605) Revert "(PUP-10091) Add FacterNg dependency" This reverts commit e471d9e86e8aa2b30433bdfff51750fc11698964. # Conflicts: # lib/puppet/defaults.rb # spec/unit/defaults_spec.rb --- Gemfile | 1 - lib/puppet/defaults.rb | 22 ---------------------- spec/unit/defaults_spec.rb | 34 ---------------------------------- 3 files changed, 57 deletions(-) diff --git a/Gemfile b/Gemfile index 2c8e8ab31f4..9af4b023969 100644 --- a/Gemfile +++ b/Gemfile @@ -14,7 +14,6 @@ end # override .gemspec deps - may issue warning depending on Bundler version gem "facter", *location_for(ENV['FACTER_LOCATION']) if ENV.has_key?('FACTER_LOCATION') -gem "facter-ng", *location_for(ENV['FACTER_NG_LOCATION']) if ENV.has_key?('FACTER_NG_LOCATION') gem "hiera", *location_for(ENV['HIERA_LOCATION']) if ENV.has_key?('HIERA_LOCATION') gem "semantic_puppet", *location_for(ENV['SEMANTIC_PUPPET_LOCATION'] || ["~> 1.0"]) gem "puppet-resource_api", *location_for(ENV['RESOURCE_API_LOCATION'] || ["~> 1.5"]) diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb index 8c56cdf5854..875e7f16503 100644 --- a/lib/puppet/defaults.rb +++ b/lib/puppet/defaults.rb @@ -70,28 +70,6 @@ def self.default_vendormoduledir # @return void def self.initialize_default_settings!(settings) settings.define_settings(:main, - :facterng => { - :default => false, - :type => :boolean, - :desc => 'Whether to enable a pre-Facter 4.0 release of Facter (distributed as - the "facter-ng" gem). This is not necessary if Facter 3.x or later is installed. - This setting is still experimental.', - :hook => proc do |value| - if value - begin - original_facter = Object.const_get(:Facter) - Object.send(:remove_const, :Facter) - - require 'facter-ng' - # It is required to re-setup logger for facter-ng - Puppet::Util::Logging.setup_facter_logging! - rescue LoadError - Object.const_set(:Facter, original_facter) - raise ArgumentError, 'facter-ng could not be loaded' - end - end - end - }, :confdir => { :default => nil, :type => :directory, diff --git a/spec/unit/defaults_spec.rb b/spec/unit/defaults_spec.rb index 971b3523387..24ece3177a9 100644 --- a/spec/unit/defaults_spec.rb +++ b/spec/unit/defaults_spec.rb @@ -181,38 +181,4 @@ end end end - - describe "facterng" do - it "defaults to false" do - expect(Puppet[:facterng]).to be_falsey - end - - it "raises an exception if facter-ng could not be loaded" do - allow_any_instance_of(Puppet::Settings::BooleanSetting).to receive(:require).with('facter-ng').and_raise(LoadError) - - expect{ Puppet.settings[:facterng] = true }.to raise_exception ArgumentError, 'facter-ng could not be loaded' - end - - context 'set logger' do - before do - @original_facter = Object.const_get(:Facter) - - Object.send(:remove_const, :Facter) - Object.const_set(:Facter, Module.new) - - allow_any_instance_of(Puppet::Settings::BooleanSetting).to receive(:require).with('facter-ng').and_return(true) - allow(Facter).to receive(:respond_to?).and_return(false) - end - - after do - Object.const_set(:Facter, @original_facter) - end - - it 'calls setup_facter_logging!' do - allow(Puppet::Util::Logging).to receive(:setup_facter_logging!).and_return(true) - Puppet.settings[:facterng] = true - expect(Puppet::Util::Logging).to have_received(:setup_facter_logging!).once - end - end - end end From 2e63231dda327395410a8b7949307e55d023a88e Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Thu, 23 Jul 2020 17:27:44 -0700 Subject: [PATCH 024/731] (PUP-10439) Replace Puppet::Network::HTTP::Connection with adapter The Connection and ConnectionAdapter existed because there were two different HTTP implementations. In Puppet 7, the former implementation is being removed, so it is no longer necessary to keep the Connection implementation. We could delete the Connection class, but some callers assume HttpPool.http_instance returns an instance of the Connection class. We could alias the Connection constant to be the same as ConnectionAdapter, but I think the simplest thing is to collapse the two classes, keeping the Connection class. --- lib/puppet/network/http/connection.rb | 574 ++++++++---------- lib/puppet/network/http/connection_adapter.rb | 184 ------ lib/puppet/network/http_pool.rb | 3 +- lib/puppet/runtime.rb | 3 +- spec/integration/network/http_pool_spec.rb | 4 - spec/unit/network/http/connection_spec.rb | 5 - 6 files changed, 257 insertions(+), 516 deletions(-) delete mode 100644 lib/puppet/network/http/connection_adapter.rb diff --git a/lib/puppet/network/http/connection.rb b/lib/puppet/network/http/connection.rb index 3243e23f5cc..7e7372895ab 100644 --- a/lib/puppet/network/http/connection.rb +++ b/lib/puppet/network/http/connection.rb @@ -1,355 +1,291 @@ -require 'puppet/ssl/openssl_loader' -require 'puppet/ssl/host' -require 'puppet/ssl/validator' -require 'puppet/network/http' -require 'uri' -require 'date' -require 'time' - -module Puppet::Network::HTTP - - # This will be raised if too many redirects happen for a given HTTP request - class RedirectionLimitExceededException < Puppet::Error ; end - - # This class provides simple methods for issuing various types of HTTP - # requests. It's interface is intended to mirror Ruby's Net::HTTP - # object, but it provides a few important bits of additional - # functionality. Notably: +# This will be raised if too many redirects happen for a given HTTP request +class Puppet::Network::HTTP::RedirectionLimitExceededException < Puppet::Error ; end + +# This class provides simple methods for issuing various types of HTTP +# requests. It's interface is intended to mirror Ruby's Net::HTTP +# object, but it provides a few important bits of additional +# functionality. Notably: +# +# * Any HTTPS requests made using this class will use Puppet's SSL +# certificate configuration for their authentication, and +# * Provides some useful error handling for any SSL errors that occur +# during a request. +# +# @deprecated Use {Puppet.runtime[:http]} +# @api public +class Puppet::Network::HTTP::Connection + OPTION_DEFAULTS = { + :use_ssl => true, + :verify => nil, # Puppet::SSL::Validator is deprecated + :verifier => nil, + :redirect_limit => 10, + } + + # Creates a new HTTP client connection to `host`:`port`. + # @param host [String] the host to which this client will connect to + # @param port [Integer] the port to which this client will connect to + # @param options [Hash] options influencing the properties of the created + # connection, + # @option options [Boolean] :use_ssl true to connect with SSL, false + # otherwise, defaults to true + # @option options [#setup_connection] :verify An object that will configure + # any verification to do on the connection + # @option options [Integer] :redirect_limit the number of allowed + # redirections, defaults to 10 passing any other option in the options + # hash results in a Puppet::Error exception # - # * Any HTTPS requests made using this class will use Puppet's SSL - # certificate configuration for their authentication, and - # * Provides some useful error handling for any SSL errors that occur - # during a request. - # @api public - class Connection - - OPTION_DEFAULTS = { - :use_ssl => true, - :verify => nil, # Puppet::SSL::Validator is deprecated - :verifier => nil, - :redirect_limit => 10, - } - - # Creates a new HTTP client connection to `host`:`port`. - # @param host [String] the host to which this client will connect to - # @param port [Integer] the port to which this client will connect to - # @param options [Hash] options influencing the properties of the created - # connection, - # @option options [Boolean] :use_ssl true to connect with SSL, false - # otherwise, defaults to true - # @option options [#setup_connection] :verify An object that will configure - # any verification to do on the connection - # @option options [Integer] :redirect_limit the number of allowed - # redirections, defaults to 10 passing any other option in the options - # hash results in a Puppet::Error exception - # - # @note the HTTP connection itself happens lazily only when {#request}, or - # one of the {#get}, {#post}, {#delete}, {#head} or {#put} is called - # @note The correct way to obtain a connection is to use one of the factory - # methods on {Puppet::Network::HttpPool} - # @api private - def initialize(host, port, options = {}) - @host = host - @port = port - - unknown_options = options.keys - OPTION_DEFAULTS.keys - raise Puppet::Error, _("Unrecognized option(s): %{opts}") % { opts: unknown_options.map(&:inspect).sort.join(', ') } unless unknown_options.empty? - - options = OPTION_DEFAULTS.merge(options) - @use_ssl = options[:use_ssl] - if @use_ssl - if options[:verifier] - unless options[:verifier].is_a?(Puppet::SSL::Verifier) - raise ArgumentError, _("Expected an instance of Puppet::SSL::Verifier but was passed a %{klass}") % { klass: options[:verifier].class } - end - - @verifier = options[:verifier] - else - @verifier = Puppet::SSL::VerifierAdapter.new(options[:verify]) + # @note the HTTP connection itself happens lazily only when {#request}, or + # one of the {#get}, {#post}, {#delete}, {#head} or {#put} is called + # @note The correct way to obtain a connection is to use one of the factory + # methods on {Puppet::Network::HttpPool} + # @api private + def initialize(host, port, options = {}) + unknown_options = options.keys - OPTION_DEFAULTS.keys + raise Puppet::Error, _("Unrecognized option(s): %{opts}") % { opts: unknown_options.map(&:inspect).sort.join(', ') } unless unknown_options.empty? + + options = OPTION_DEFAULTS.merge(options) + @use_ssl = options[:use_ssl] + if @use_ssl + if options[:verifier] + unless options[:verifier].is_a?(Puppet::SSL::Verifier) + raise ArgumentError, _("Expected an instance of Puppet::SSL::Verifier but was passed a %{klass}") % { klass: options[:verifier].class } end - end - @redirect_limit = options[:redirect_limit] - @site = Puppet::Network::HTTP::Site.new(@use_ssl ? 'https' : 'http', host, port) - @pool = Puppet.lookup(:http_pool) - end - - # @!macro [new] common_options - # @param options [Hash] options influencing the request made. Any - # options not recognized by this class will be ignored - no error will - # be thrown. - # @option options [Hash{Symbol => String}] :basic_auth The basic auth - # :username and :password to use for the request, :metric_id Ignored - # by this class - used by Puppet Server only. The metric id by which - # to track metrics on requests. - - # @param path [String] - # @param headers [Hash{String => String}] - # @!macro common_options - # @api public - def get(path, headers = {}, options = {}) - do_request(Net::HTTP::Get.new(path, headers), options) - end - # @param path [String] - # @param data [String] - # @param headers [Hash{String => String}] - # @!macro common_options - # @api public - def post(path, data, headers = nil, options = {}) - request = Net::HTTP::Post.new(path, headers) - request.body = data - do_request(request, options) - end - - # @param path [String] - # @param headers [Hash{String => String}] - # @!macro common_options - # @api public - def head(path, headers = {}, options = {}) - do_request(Net::HTTP::Head.new(path, headers), options) - end - - # @param path [String] - # @param headers [Hash{String => String}] - # @!macro common_options - # @api public - def delete(path, headers = {'Depth' => 'Infinity'}, options = {}) - do_request(Net::HTTP::Delete.new(path, headers), options) + @verifier = options[:verifier] + else + @verifier = Puppet::SSL::VerifierAdapter.new(options[:verify]) + end end + @redirect_limit = options[:redirect_limit] + @site = Puppet::Network::HTTP::Site.new(@use_ssl ? 'https' : 'http', host, port) + @client = Puppet.runtime[:http] + end - # @param path [String] - # @param data [String] - # @param headers [Hash{String => String}] - # @!macro common_options - # @api public - def put(path, data, headers = nil, options = {}) - request = Net::HTTP::Put.new(path, headers) - request.body = data - do_request(request, options) - end + # The address to connect to. + def address + @site.host + end - def request(method, *args) - self.send(method, *args) - end + # The port to connect to. + def port + @site.port + end - # TODO: These are proxies for the Net::HTTP#request_* methods, which are - # almost the same as the "get", "post", etc. methods that we've ported above, - # but they are able to accept a code block and will yield to it, which is - # necessary to stream responses, e.g. file content. For now - # we're not funneling these proxy implementations through our #request - # method above, so they will not inherit the same error handling. In the - # future we may want to refactor these so that they are funneled through - # that method and do inherit the error handling. - def request_get(*args, &block) - with_connection(@site) do |http| - resp = http.request_get(*args, &block) - Puppet.debug("HTTP GET #{@site}#{args.first.split('?').first} returned #{resp.code} #{resp.message}") - resp - end - end + # Whether to use ssl + def use_ssl? + @site.use_ssl? + end - def request_head(*args, &block) - with_connection(@site) do |http| - resp = http.request_head(*args, &block) - Puppet.debug("HTTP HEAD #{@site}#{args.first.split('?').first} returned #{resp.code} #{resp.message}") - resp - end - end + # @api private + def verifier + @verifier + end - def request_post(*args, &block) - with_connection(@site) do |http| - resp = http.request_post(*args, &block) - Puppet.debug("HTTP POST #{@site}#{args.first.split('?').first} returned #{resp.code} #{resp.message}") - resp - end + # @!macro [new] common_options + # @param options [Hash] options influencing the request made. Any + # options not recognized by this class will be ignored - no error will + # be thrown. + # @option options [Hash{Symbol => String}] :basic_auth The basic auth + # :username and :password to use for the request, :metric_id Ignored + # by this class - used by Puppet Server only. The metric id by which + # to track metrics on requests. + + # @param path [String] + # @param headers [Hash{String => String}] + # @!macro common_options + # @api public + def get(path, headers = {}, options = {}) + headers ||= {} + options[:ssl_context] ||= resolve_ssl_context + options[:redirect_limit] ||= @redirect_limit + + with_error_handling do + resp = @client.get(to_url(path), headers: headers, options: options) + resp.nethttp end - # end of Net::HTTP#request_* proxies + end - # The address to connect to. - def address - @site.host + # @param path [String] + # @param data [String] + # @param headers [Hash{String => String}] + # @!macro common_options + # @api public + def post(path, data, headers = nil, options = {}) + headers ||= {} + headers['Content-Type'] ||= "application/x-www-form-urlencoded" + data ||= '' + options[:ssl_context] ||= resolve_ssl_context + options[:redirect_limit] ||= @redirect_limit + + with_error_handling do + resp = @client.post(to_url(path), data, headers: headers, options: options) + resp.nethttp end + end - # The port to connect to. - def port - @site.port + # @param path [String] + # @param headers [Hash{String => String}] + # @!macro common_options + # @api public + def head(path, headers = {}, options = {}) + headers ||= {} + options[:ssl_context] ||= resolve_ssl_context + options[:redirect_limit] ||= @redirect_limit + + with_error_handling do + resp = @client.head(to_url(path), headers: headers, options: options) + resp.nethttp end + end - # Whether to use ssl - def use_ssl? - @site.use_ssl? + # @param path [String] + # @param headers [Hash{String => String}] + # @!macro common_options + # @api public + def delete(path, headers = {'Depth' => 'Infinity'}, options = {}) + headers ||= {} + options[:ssl_context] ||= resolve_ssl_context + options[:redirect_limit] ||= @redirect_limit + + with_error_handling do + resp = @client.delete(to_url(path), headers: headers, options: options) + resp.nethttp end + end - # @api private - def verifier - @verifier + # @param path [String] + # @param data [String] + # @param headers [Hash{String => String}] + # @!macro common_options + # @api public + def put(path, data, headers = nil, options = {}) + headers ||= {} + headers['Content-Type'] ||= "application/x-www-form-urlencoded" + data ||= '' + options[:ssl_context] ||= resolve_ssl_context + options[:redirect_limit] ||= @redirect_limit + + with_error_handling do + resp = @client.put(to_url(path), data, headers: headers, options: options) + resp.nethttp end + end - private - - def do_request(request, options) - current_request = request - current_site = @site - response = nil - - 0.upto(@redirect_limit) do |redirection| - return response if response - - with_connection(current_site) do |connection| - apply_options_to(current_request, options) - - current_response = execute_request(connection, current_request) - - case current_response.code.to_i - when 301, 302, 307 - # handle redirection - location = URI.parse(current_response['location']) - current_site = current_site.move_to(location) - - # update to the current request path - current_request = current_request.class.new(location.path) - current_request.body = request.body - request.each do |header, value| - current_request[header] = value - end - when 429, 503 - if connection.started? - Puppet.debug("Closing connection for #{current_site}") - connection.finish - end - response = handle_retry_after(current_response) - else - response = current_response - end - end - - # and try again... - end + def request_get(*args, &block) + path, headers = *args + headers ||= {} + options = { + ssl_context: resolve_ssl_context, + redirect_limit: @redirect_limit + } - raise RedirectionLimitExceededException, _("Too many HTTP redirections for %{host}:%{port}") % { host: @host, port: @port } + resp = @client.get(to_url(path), headers: headers, options: options) do |response| + yield response.nethttp if block_given? end + resp.nethttp + end - # Handles the Retry-After header of a HTTPResponse - # - # This method checks the response for a Retry-After header and handles - # it by sleeping for the indicated number of seconds. The response is - # returned unmodified if no Retry-After header is present. - # - # @param response [Net::HTTPResponse] A response received from the - # HTTP client. - # - # @return [nil] Sleeps and returns nil if the response contained a - # Retry-After header that indicated the request should be retried. - # @return [Net::HTTPResponse] Returns the `response` unmodified if - # no Retry-After header was present or the Retry-After header could - # not be parsed as an integer or RFC 2822 date. - def handle_retry_after(response) - retry_after = response['Retry-After'] - return response if retry_after.nil? - - retry_sleep = parse_retry_after_header(retry_after) - # Recover remote hostname if Net::HTTPResponse was generated by a - # method that fills in the uri attribute. - # - server_hostname = if response.uri.is_a?(URI) - response.uri.host - else - # TRANSLATORS: Used in the phrase: - # "Received a response from the remote server." - _('the remote server') - end - - if retry_sleep.nil? - Puppet.err(_('Received a %{status_code} response from %{server_hostname}, but the Retry-After header value of "%{retry_after}" could not be converted to an integer or RFC 2822 date.') % - {status_code: response.code, - server_hostname: server_hostname, - retry_after: retry_after.inspect}) - - return response - end - - # Cap maximum sleep at the run interval of the Puppet agent. - retry_sleep = [retry_sleep, Puppet[:runinterval]].min + def request_head(*args, &block) + path, headers = *args + headers ||= {} + options = { + ssl_context: resolve_ssl_context, + redirect_limit: @redirect_limit + } - Puppet.warning(_('Received a %{status_code} response from %{server_hostname}. Sleeping for %{retry_sleep} seconds before retrying the request.') % - {status_code: response.code, - server_hostname: server_hostname, - retry_sleep: retry_sleep}) + response = @client.head(to_url(path), headers: headers, options: options) + yield response.nethttp if block_given? + response.nethttp + end - ::Kernel.sleep(retry_sleep) + def request_post(*args, &block) + path, data, headers = *args + headers ||= {} + headers['Content-Type'] ||= "application/x-www-form-urlencoded" + options = { + ssl_context: resolve_ssl_context, + redirect_limit: @redirect_limit + } - return nil + resp = @client.post(to_url(path), data, headers: headers, options: options) do |response| + yield response.nethttp if block_given? end + resp.nethttp + end - # Parse the value of a Retry-After header - # - # Parses a string containing an Integer or RFC 2822 datestamp and returns - # an integer number of seconds before a request can be retried. - # - # @param header_value [String] The value of the Retry-After header. - # - # @return [Integer] Number of seconds to wait before retrying the - # request. Will be equal to 0 for the case of date that has already - # passed. - # @return [nil] Returns `nil` when the `header_value` can't be - # parsed as an Integer or RFC 2822 date. - def parse_retry_after_header(header_value) - retry_after = begin - Integer(header_value) - rescue TypeError, ArgumentError - begin - DateTime.rfc2822(header_value) - rescue ArgumentError - return nil - end - end - - case retry_after - when Integer - retry_after - when DateTime - sleep = (retry_after.to_time - DateTime.now.to_time).to_i - (sleep > 0) ? sleep : 0 - end + private + + # The old Connection class ignores the ssl_context on the Puppet stack, + # and always loads certs/keys based on what is currently in the filesystem. + # If the files are missing, it would attempt to bootstrap the certs/keys + # while in the process of making a network request, due to the call to + # Puppet.lookup(:ssl_host) in Puppet::SSL::Validator::DefaultValidator#setup_connection. + # This class doesn't preserve the boostrap behavior because that is handled + # outside of this class, and can only be triggered by running `puppet ssl` or + # `puppet agent`. + def resolve_ssl_context + # don't need an ssl context for http connections + return nil unless @site.use_ssl? + + # if our verifier has an ssl_context, use that + ctx = @verifier.ssl_context + return ctx if ctx + + # load available certs + cert = Puppet::X509::CertProvider.new + ssl = Puppet::SSL::SSLProvider.new + begin + password = cert.load_private_key_password + ssl.load_context(certname: Puppet[:certname], password: password) + rescue Puppet::SSL::SSLError => e + Puppet.log_exception(e) + + # if we don't have cacerts, then create a root context that doesn't + # trust anything. The old code used to fallback to VERIFY_NONE, + # which we don't want to emulate. + ssl.create_root_context(cacerts: []) end + end - def apply_options_to(request, options) - request["User-Agent"] = Puppet[:http_user_agent] - - if options[:basic_auth] - request.basic_auth(options[:basic_auth][:user], options[:basic_auth][:password]) - end + def to_url(path) + if path =~ /^https?:\/\// + # The old Connection class accepts a URL as the request path, and sends + # it in "absolute-form" in the request line, e.g. GET https://puppet:8140/. + # See https://httpwg.org/specs/rfc7230.html#absolute-form. It just so happens + # to work because HTTP 1.1 servers are required to accept absolute-form even + # though clients are only supposed to send them to proxies, so the proxy knows + # what upstream server to CONNECT to. This method creates a URL using the + # scheme/host/port that the connection was created with, and appends the path + # and query portions of the absolute-form. The resulting request will use "origin-form" + # as it should have done all along. + abs_form = URI(path) + url = URI("#{@site.addr}/#{normalize_path(abs_form.path)}") + url.query = abs_form.query if abs_form.query + url + else + URI("#{@site.addr}/#{normalize_path(path)}") end + end - def execute_request(connection, request) - start = Time.now - resp = connection.request(request) - Puppet.debug("HTTP #{request.method.upcase} #{@site}#{request.path.split('?').first} returned #{resp.code} #{resp.message}") - resp - rescue => exception - elapsed = (Time.now - start).to_f.round(3) - uri = [@site.addr, request.path.split('?')[0]].join('/') - - case exception - when EOFError - Puppet.log_exception(exception, _('request %{uri} interrupted after %{elapsed} seconds') % {uri: uri, elapsed: elapsed}) - when Timeout::Error - Puppet.log_exception(exception, _('request %{uri} timed out after %{elapsed} seconds') % {uri: uri, elapsed: elapsed}) - else - Puppet.log_exception(exception, _('request %{uri} failed: %{msg}') % {uri: uri, msg: exception.message}) - end - - raise exception + def normalize_path(path) + if path[0] == '/' + path[1..-1] + else + path end + end - def with_connection(site, &block) - Puppet.deprecation_warning(_('Puppet::Network::HTTP::Connection is deprecated. Please use Puppet::Network::HTTP::ConnectionAdapter instead.')) - - response = nil - @pool.with_connection(site, @verifier) do |conn| - response = yield conn - end - response + def with_error_handling(&block) + yield + rescue Puppet::HTTP::TooManyRedirects => e + raise Puppet::Network::HTTP::RedirectionLimitExceededException.new(_("Too many HTTP redirections for %{host}:%{port}") % { host: @host, port: @port }, e) + rescue Puppet::HTTP::HTTPError => e + Puppet.log_exception(e, e.message) + case e.cause + when Net::OpenTimeout, Net::ReadTimeout, Net::HTTPError, EOFError + raise e.cause + else + raise e end end end diff --git a/lib/puppet/network/http/connection_adapter.rb b/lib/puppet/network/http/connection_adapter.rb deleted file mode 100644 index 3555f3b0758..00000000000 --- a/lib/puppet/network/http/connection_adapter.rb +++ /dev/null @@ -1,184 +0,0 @@ -class Puppet::Network::HTTP::ConnectionAdapter < Puppet::Network::HTTP::Connection - def initialize(host, port, options = {}) - super(host, port, options) - - @client = Puppet.runtime[:http] - end - - def get(path, headers = {}, options = {}) - headers ||= {} - options[:ssl_context] ||= resolve_ssl_context - options[:redirect_limit] ||= @redirect_limit - - with_error_handling do - resp = @client.get(to_url(path), headers: headers, options: options) - resp.nethttp - end - end - - def post(path, data, headers = nil, options = {}) - headers ||= {} - headers['Content-Type'] ||= "application/x-www-form-urlencoded" - data ||= '' - options[:ssl_context] ||= resolve_ssl_context - options[:redirect_limit] ||= @redirect_limit - - with_error_handling do - resp = @client.post(to_url(path), data, headers: headers, options: options) - resp.nethttp - end - end - - def head(path, headers = {}, options = {}) - headers ||= {} - options[:ssl_context] ||= resolve_ssl_context - options[:redirect_limit] ||= @redirect_limit - - with_error_handling do - resp = @client.head(to_url(path), headers: headers, options: options) - resp.nethttp - end - end - - def delete(path, headers = {'Depth' => 'Infinity'}, options = {}) - headers ||= {} - options[:ssl_context] ||= resolve_ssl_context - options[:redirect_limit] ||= @redirect_limit - - with_error_handling do - resp = @client.delete(to_url(path), headers: headers, options: options) - resp.nethttp - end - end - - def put(path, data, headers = nil, options = {}) - headers ||= {} - headers['Content-Type'] ||= "application/x-www-form-urlencoded" - data ||= '' - options[:ssl_context] ||= resolve_ssl_context - options[:redirect_limit] ||= @redirect_limit - - with_error_handling do - resp = @client.put(to_url(path), data, headers: headers, options: options) - resp.nethttp - end - end - - def request_get(*args, &block) - path, headers = *args - headers ||= {} - options = { - ssl_context: resolve_ssl_context, - redirect_limit: @redirect_limit - } - - resp = @client.get(to_url(path), headers: headers, options: options) do |response| - yield response.nethttp if block_given? - end - resp.nethttp - end - - def request_head(*args, &block) - path, headers = *args - headers ||= {} - options = { - ssl_context: resolve_ssl_context, - redirect_limit: @redirect_limit - } - - response = @client.head(to_url(path), headers: headers, options: options) - yield response.nethttp if block_given? - response.nethttp - end - - def request_post(*args, &block) - path, data, headers = *args - headers ||= {} - headers['Content-Type'] ||= "application/x-www-form-urlencoded" - options = { - ssl_context: resolve_ssl_context, - redirect_limit: @redirect_limit - } - - resp = @client.post(to_url(path), data, headers: headers, options: options) do |response| - yield response.nethttp if block_given? - end - resp.nethttp - end - - private - - # The old Connection class ignores the ssl_context on the Puppet stack, - # and always loads certs/keys based on what is currently in the filesystem. - # If the files are missing, it would attempt to bootstrap the certs/keys - # while in the process of making a network request, due to the call to - # Puppet.lookup(:ssl_host) in Puppet::SSL::Validator::DefaultValidator#setup_connection. - # This class doesn't preserve the boostrap behavior because that is handled - # outside of this class, and can only be triggered by running `puppet ssl` or - # `puppet agent`. - def resolve_ssl_context - # don't need an ssl context for http connections - return nil unless @site.use_ssl? - - # if our verifier has an ssl_context, use that - ctx = @verifier.ssl_context - return ctx if ctx - - # load available certs - cert = Puppet::X509::CertProvider.new - ssl = Puppet::SSL::SSLProvider.new - begin - password = cert.load_private_key_password - ssl.load_context(certname: Puppet[:certname], password: password) - rescue Puppet::SSL::SSLError => e - Puppet.log_exception(e) - - # if we don't have cacerts, then create a root context that doesn't - # trust anything. The old code used to fallback to VERIFY_NONE, - # which we don't want to emulate. - ssl.create_root_context(cacerts: []) - end - end - - def to_url(path) - if path =~ /^https?:\/\// - # The old Connection class accepts a URL as the request path, and sends - # it in "absolute-form" in the request line, e.g. GET https://puppet:8140/. - # See https://httpwg.org/specs/rfc7230.html#absolute-form. It just so happens - # to work because HTTP 1.1 servers are required to accept absolute-form even - # though clients are only supposed to send them to proxies, so the proxy knows - # what upstream server to CONNECT to. This method creates a URL using the - # scheme/host/port that the connection was created with, and appends the path - # and query portions of the absolute-form. The resulting request will use "origin-form" - # as it should have done all along. - abs_form = URI(path) - url = URI("#{@site.addr}/#{normalize_path(abs_form.path)}") - url.query = abs_form.query if abs_form.query - url - else - URI("#{@site.addr}/#{normalize_path(path)}") - end - end - - def normalize_path(path) - if path[0] == '/' - path[1..-1] - else - path - end - end - - def with_error_handling(&block) - yield - rescue Puppet::HTTP::TooManyRedirects => e - raise Puppet::Network::HTTP::RedirectionLimitExceededException.new(_("Too many HTTP redirections for %{host}:%{port}") % { host: @host, port: @port }, e) - rescue Puppet::HTTP::HTTPError => e - Puppet.log_exception(e, e.message) - case e.cause - when Net::OpenTimeout, Net::ReadTimeout, Net::HTTPError, EOFError - raise e.cause - else - raise e - end - end -end diff --git a/lib/puppet/network/http_pool.rb b/lib/puppet/network/http_pool.rb index ef39c0a23c9..ada46749be6 100644 --- a/lib/puppet/network/http_pool.rb +++ b/lib/puppet/network/http_pool.rb @@ -1,5 +1,4 @@ require 'puppet/network/http/connection' -require 'puppet/network/http/connection_adapter' require 'puppet/util/platform' module Puppet::Network; end @@ -13,7 +12,7 @@ module Puppet::Network; end # module Puppet::Network::HttpPool - @http_client_class = Puppet::Network::HTTP::ConnectionAdapter + @http_client_class = Puppet::Network::HTTP::Connection def self.http_client_class @http_client_class diff --git a/lib/puppet/runtime.rb b/lib/puppet/runtime.rb index c3a517b9662..0db31815779 100644 --- a/lib/puppet/runtime.rb +++ b/lib/puppet/runtime.rb @@ -11,8 +11,7 @@ def initialize @runtime_services = { http: proc do klass = Puppet::Network::HttpPool.http_client_class - if klass == Puppet::Network::HTTP::Connection || - klass == Puppet::Network::HTTP::ConnectionAdapter + if klass == Puppet::Network::HTTP::Connection Puppet::HTTP::Client.new else Puppet::HTTP::ExternalClient.new(klass) diff --git a/spec/integration/network/http_pool_spec.rb b/spec/integration/network/http_pool_spec.rb index 54d91cd65ee..dd83d3897fe 100644 --- a/spec/integration/network/http_pool_spec.rb +++ b/spec/integration/network/http_pool_spec.rb @@ -183,10 +183,6 @@ def connection(host, port) end describe Puppet::Network::HTTP::Connection do - it_behaves_like "an HttpPool connection", described_class, true - end - - describe Puppet::Network::HTTP::ConnectionAdapter do it_behaves_like "an HttpPool connection", described_class, false end end diff --git a/spec/unit/network/http/connection_spec.rb b/spec/unit/network/http/connection_spec.rb index 21c55869705..e6037754ee0 100644 --- a/spec/unit/network/http/connection_spec.rb +++ b/spec/unit/network/http/connection_spec.rb @@ -1,6 +1,5 @@ require 'spec_helper' require 'puppet/network/http/connection' -require 'puppet/network/http/connection_adapter' require 'puppet/test_ca' describe Puppet::Network::HTTP::Connection do @@ -649,10 +648,6 @@ def retry_after(datetime) end describe Puppet::Network::HTTP::Connection do - it_behaves_like "an HTTP connection", described_class, true - end - - describe Puppet::Network::HTTP::ConnectionAdapter do it_behaves_like "an HTTP connection", described_class, false end end From 05e20310dd72cd5c42da0bd2304a7a9cd24ce6d6 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Thu, 23 Jul 2020 16:56:29 -0700 Subject: [PATCH 025/731] (PUP-10439) Remove HttpPool.http_ssl_instance Remove the deprecated `http_ssl_instance` method, because its accepts instances of `Puppet::SSL::Validator` which is also going to be deleted. The `http_instance` and `connection` methods are deprecated, but won't be removed in Puppet 7. --- lib/puppet/network/http_pool.rb | 35 +++++++---------------------- spec/unit/network/http_pool_spec.rb | 4 ---- 2 files changed, 8 insertions(+), 31 deletions(-) diff --git a/lib/puppet/network/http_pool.rb b/lib/puppet/network/http_pool.rb index ada46749be6..d3ed7b25303 100644 --- a/lib/puppet/network/http_pool.rb +++ b/lib/puppet/network/http_pool.rb @@ -33,33 +33,14 @@ def self.http_client_class=(klass) # @api public # def self.http_instance(host, port, use_ssl = true, verify_peer = true) - verifier = if verify_peer - Puppet::SSL::Validator.default_validator() - else - Puppet::SSL::Validator.no_validator() - end - - http_client_class.new(host, port, - :use_ssl => use_ssl, - :verify => verifier) - end - - # Get an http connection that will be secured with SSL and have the - # connection verified with the given verifier - # - # @param host [String] the DNS name to connect to - # @param port [Integer] the port to connect to - # @param verifier [#setup_connection, #peer_certs, #verify_errors] An object that will setup the appropriate - # verification on a Net::HTTP instance and report any errors and the certificates used. - # @return [Puppet::Network::HTTP::Connection] - # - # @deprecated Use {#http_connection} instead. - # @api public - # - def self.http_ssl_instance(host, port, verifier = Puppet::SSL::Validator.default_validator()) - http_client_class.new(host, port, - :use_ssl => true, - :verify => verifier) + if verify_peer + verifier = Puppet::SSL::Verifier.new(host, nil) + http_client_class.new(host, port, use_ssl: use_ssl, verifier: verifier) + else + ssl = Puppet::SSL::SSLProvider.new + verifier = Puppet::SSL::Verifier.new(host, ssl.create_insecure_context) + http_client_class.new(host, port, use_ssl: use_ssl, verifier: verifier) + end end # Retrieve a connection for the given host and port. diff --git a/spec/unit/network/http_pool_spec.rb b/spec/unit/network/http_pool_spec.rb index cf248064339..e041baf9da8 100644 --- a/spec/unit/network/http_pool_spec.rb +++ b/spec/unit/network/http_pool_spec.rb @@ -69,10 +69,6 @@ def initialize(host, port, options = {}) expect(Puppet::Network::HttpPool.http_instance("me", 54321, true)).to be_use_ssl end - it 'has an http_ssl_instance method' do - expect(Puppet::Network::HttpPool.http_ssl_instance("me", 54321)).to be_use_ssl - end - context "when calling 'connection'" do it 'requires an ssl_context' do expect { From 1b71afa2b0c3cda6f03782ff229c2f916dac178d Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Fri, 24 Jul 2020 12:40:30 -0700 Subject: [PATCH 026/731] (PUP-10439) Move Puppet::Network::HTTP::Factory Move client http factory into Puppet::HTTP. --- lib/puppet/http.rb | 7 ++----- lib/puppet/{network => }/http/factory.rb | 4 ++-- lib/puppet/network/http/nocache_pool.rb | 2 +- lib/puppet/network/http/pool.rb | 2 +- spec/unit/http/external_client_spec.rb | 2 +- spec/unit/{network => }/http/factory_spec.rb | 5 ++--- spec/unit/network/http/nocache_pool_spec.rb | 8 ++++---- 7 files changed, 13 insertions(+), 17 deletions(-) rename lib/puppet/{network => }/http/factory.rb (95%) rename spec/unit/{network => }/http/factory_spec.rb (97%) diff --git a/lib/puppet/http.rb b/lib/puppet/http.rb index b10687be101..53e0163465e 100644 --- a/lib/puppet/http.rb +++ b/lib/puppet/http.rb @@ -1,13 +1,8 @@ module Puppet - module HTTP - require 'puppet/http/proxy' - end - module Network module HTTP require 'puppet/network/http/site' require 'puppet/network/http/session' - require 'puppet/network/http/factory' require 'puppet/network/http/base_pool' require 'puppet/network/http/nocache_pool' require 'puppet/network/http/pool' @@ -21,6 +16,8 @@ module HTTP HEADER_PUPPET_VERSION = "X-Puppet-Version".freeze require 'puppet/http/errors' + require 'puppet/http/proxy' + require 'puppet/http/factory' require 'puppet/http/response' require 'puppet/http/service' require 'puppet/http/service/ca' diff --git a/lib/puppet/network/http/factory.rb b/lib/puppet/http/factory.rb similarity index 95% rename from lib/puppet/network/http/factory.rb rename to lib/puppet/http/factory.rb index b836d1ba9bc..4db79edea9a 100644 --- a/lib/puppet/network/http/factory.rb +++ b/lib/puppet/http/factory.rb @@ -1,6 +1,6 @@ require 'puppet/ssl/openssl_loader' require 'net/http' -require 'puppet/http/proxy' +require 'puppet/http' # Factory for Net::HTTP objects. # @@ -9,7 +9,7 @@ # # @api private # -class Puppet::Network::HTTP::Factory +class Puppet::HTTP::Factory @@openssl_initialized = false KEEP_ALIVE_TIMEOUT = 2**31 - 1 diff --git a/lib/puppet/network/http/nocache_pool.rb b/lib/puppet/network/http/nocache_pool.rb index 57184d56a31..8496209a4ef 100644 --- a/lib/puppet/network/http/nocache_pool.rb +++ b/lib/puppet/network/http/nocache_pool.rb @@ -2,7 +2,7 @@ # # @api private class Puppet::Network::HTTP::NoCachePool < Puppet::Network::HTTP::BasePool - def initialize(factory = Puppet::Network::HTTP::Factory.new) + def initialize(factory = Puppet::HTTP::Factory.new) Puppet.deprecation_warning(_('Puppet::Network::HTTP::NoCachePool is deprecated.')) @factory = factory end diff --git a/lib/puppet/network/http/pool.rb b/lib/puppet/network/http/pool.rb index 7543ef7cdb0..64021649a43 100644 --- a/lib/puppet/network/http/pool.rb +++ b/lib/puppet/network/http/pool.rb @@ -13,7 +13,7 @@ class Puppet::Network::HTTP::Pool < Puppet::Network::HTTP::BasePool def initialize(keepalive_timeout) @pool = {} - @factory = Puppet::Network::HTTP::Factory.new + @factory = Puppet::HTTP::Factory.new @keepalive_timeout = keepalive_timeout end diff --git a/spec/unit/http/external_client_spec.rb b/spec/unit/http/external_client_spec.rb index ad3aa27ab4f..653cfae1cc4 100644 --- a/spec/unit/http/external_client_spec.rb +++ b/spec/unit/http/external_client_spec.rb @@ -9,7 +9,7 @@ def initialize(host, port, options = {}) @host = host @port = port @options = options - @factory = Puppet::Network::HTTP::Factory.new + @factory = Puppet::HTTP::Factory.new end def get(path, headers = {}, options = {}) diff --git a/spec/unit/network/http/factory_spec.rb b/spec/unit/http/factory_spec.rb similarity index 97% rename from spec/unit/network/http/factory_spec.rb rename to spec/unit/http/factory_spec.rb index 13244adba4b..1acbf17d0be 100644 --- a/spec/unit/network/http/factory_spec.rb +++ b/spec/unit/http/factory_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' require 'puppet/http' -describe Puppet::Network::HTTP::Factory do +describe Puppet::HTTP::Factory do before(:all) do ENV['http_proxy'] = nil ENV['HTTP_PROXY'] = nil @@ -14,8 +14,7 @@ let(:site) { Puppet::Network::HTTP::Site.new('https', 'www.example.com', 443) } def create_connection(site) - factory = Puppet::Network::HTTP::Factory.new - + factory = described_class.new factory.create_connection(site) end diff --git a/spec/unit/network/http/nocache_pool_spec.rb b/spec/unit/network/http/nocache_pool_spec.rb index 90253202be3..fe2961b9f38 100644 --- a/spec/unit/network/http/nocache_pool_spec.rb +++ b/spec/unit/network/http/nocache_pool_spec.rb @@ -10,7 +10,7 @@ it 'yields a started connection' do http = double('http', start: nil, finish: nil, started?: true) - factory = Puppet::Network::HTTP::Factory.new + factory = Puppet::HTTP::Factory.new allow(factory).to receive(:create_connection).and_return(http) pool = Puppet::Network::HTTP::NoCachePool.new(factory) @@ -23,7 +23,7 @@ http1 = double('http1', start: nil, finish: nil, started?: true) http2 = double('http2', start: nil, finish: nil, started?: true) - factory = Puppet::Network::HTTP::Factory.new + factory = Puppet::HTTP::Factory.new allow(factory).to receive(:create_connection).and_return(http1, http2) pool = Puppet::Network::HTTP::NoCachePool.new(factory) @@ -43,7 +43,7 @@ it 'logs a deprecation warning' do http = double('http', start: nil, finish: nil, started?: true) - factory = Puppet::Network::HTTP::Factory.new + factory = Puppet::HTTP::Factory.new allow(factory).to receive(:create_connection).and_return(http) Puppet::Network::HTTP::NoCachePool.new(factory) @@ -55,7 +55,7 @@ http = double('http', start: nil, finish: nil, started?: true) - factory = Puppet::Network::HTTP::Factory.new + factory = Puppet::HTTP::Factory.new allow(factory).to receive(:create_connection).and_return(http) Puppet::Network::HTTP::NoCachePool.new(factory) From 835b32c4e78f68ddc1939840963fd432b9706ae1 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Fri, 24 Jul 2020 12:46:37 -0700 Subject: [PATCH 027/731] (PUP-10439) Move Puppet::Network::HTTP::Site Move site into Puppet::HTTP --- lib/puppet/http.rb | 2 +- lib/puppet/http/client.rb | 4 ++-- lib/puppet/http/factory.rb | 2 +- lib/puppet/http/session.rb | 4 ++-- lib/puppet/{network => }/http/site.rb | 2 +- lib/puppet/network/http/connection.rb | 2 +- lib/puppet/network/http/pool.rb | 2 +- spec/unit/http/client_spec.rb | 2 +- spec/unit/http/external_client_spec.rb | 2 +- spec/unit/http/factory_spec.rb | 2 +- spec/unit/{network => }/http/site_spec.rb | 6 +++--- spec/unit/network/http/nocache_pool_spec.rb | 2 +- spec/unit/network/http/pool_spec.rb | 14 +++++++------- 13 files changed, 23 insertions(+), 23 deletions(-) rename lib/puppet/{network => }/http/site.rb (96%) rename spec/unit/{network => }/http/site_spec.rb (94%) diff --git a/lib/puppet/http.rb b/lib/puppet/http.rb index 53e0163465e..6a3803b2689 100644 --- a/lib/puppet/http.rb +++ b/lib/puppet/http.rb @@ -1,7 +1,6 @@ module Puppet module Network module HTTP - require 'puppet/network/http/site' require 'puppet/network/http/session' require 'puppet/network/http/base_pool' require 'puppet/network/http/nocache_pool' @@ -16,6 +15,7 @@ module HTTP HEADER_PUPPET_VERSION = "X-Puppet-Version".freeze require 'puppet/http/errors' + require 'puppet/http/site' require 'puppet/http/proxy' require 'puppet/http/factory' require 'puppet/http/response' diff --git a/lib/puppet/http/client.rb b/lib/puppet/http/client.rb index 56f9a05945b..e8dc32bb883 100644 --- a/lib/puppet/http/client.rb +++ b/lib/puppet/http/client.rb @@ -72,7 +72,7 @@ def connect(uri, options: {}, &block) verifier = nil connected = false - site = Puppet::Network::HTTP::Site.from_uri(uri) + site = Puppet::HTTP::Site.from_uri(uri) if site.use_ssl? ssl_context = options.fetch(:ssl_context, nil) include_system_store = options.fetch(:include_system_store, false) @@ -320,7 +320,7 @@ def execute_streaming(request, options: {}, &block) retries += 1 if interval if http.started? - Puppet.debug("Closing connection for #{Puppet::Network::HTTP::Site.from_uri(request.uri)}") + Puppet.debug("Closing connection for #{Puppet::HTTP::Site.from_uri(request.uri)}") http.finish end Puppet.warning(_("Sleeping for %{interval} seconds before retrying the request") % { interval: interval }) diff --git a/lib/puppet/http/factory.rb b/lib/puppet/http/factory.rb index 4db79edea9a..c5e5eecfac0 100644 --- a/lib/puppet/http/factory.rb +++ b/lib/puppet/http/factory.rb @@ -5,7 +5,7 @@ # Factory for Net::HTTP objects. # # Encapsulates the logic for creating a Net::HTTP object based on the -# specified {Puppet::Network::HTTP::Site Site} and puppet settings. +# specified {Puppet::HTTP::Site Site} and puppet settings. # # @api private # diff --git a/lib/puppet/http/session.rb b/lib/puppet/http/session.rb index 86efc6bb860..c1d523186c7 100644 --- a/lib/puppet/http/session.rb +++ b/lib/puppet/http/session.rb @@ -92,7 +92,7 @@ def route_to(name, url: nil, ssl_context: nil) def process_response(response) version = response[Puppet::HTTP::HEADER_PUPPET_VERSION] if version - site = Puppet::Network::HTTP::Site.from_uri(response.url) + site = Puppet::HTTP::Site.from_uri(response.url) @server_versions[site] = version end end @@ -115,7 +115,7 @@ def supports?(name, capability) service = @resolved_services[name] return false unless service - site = Puppet::Network::HTTP::Site.from_uri(service.url) + site = Puppet::HTTP::Site.from_uri(service.url) server_version = @server_versions[site] case capability diff --git a/lib/puppet/network/http/site.rb b/lib/puppet/http/site.rb similarity index 96% rename from lib/puppet/network/http/site.rb rename to lib/puppet/http/site.rb index c8183a56750..f471bcf47be 100644 --- a/lib/puppet/network/http/site.rb +++ b/lib/puppet/http/site.rb @@ -5,7 +5,7 @@ # # @api private # -class Puppet::Network::HTTP::Site +class Puppet::HTTP::Site attr_reader :scheme, :host, :port def self.from_uri(uri) diff --git a/lib/puppet/network/http/connection.rb b/lib/puppet/network/http/connection.rb index 7e7372895ab..4a0304d2d3e 100644 --- a/lib/puppet/network/http/connection.rb +++ b/lib/puppet/network/http/connection.rb @@ -57,7 +57,7 @@ def initialize(host, port, options = {}) end end @redirect_limit = options[:redirect_limit] - @site = Puppet::Network::HTTP::Site.new(@use_ssl ? 'https' : 'http', host, port) + @site = Puppet::HTTP::Site.new(@use_ssl ? 'https' : 'http', host, port) @client = Puppet.runtime[:http] end diff --git a/lib/puppet/network/http/pool.rb b/lib/puppet/network/http/pool.rb index 64021649a43..4a03b4ede84 100644 --- a/lib/puppet/network/http/pool.rb +++ b/lib/puppet/network/http/pool.rb @@ -1,5 +1,5 @@ # A pool for persistent Net::HTTP connections. Connections are -# stored in the pool indexed by their {Puppet::Network::HTTP::Site Site}. +# stored in the pool indexed by their {Puppet::HTTP::Site Site}. # Connections are borrowed from the pool, yielded to the caller, and # released back into the pool. If a connection is expired, it will be # closed either when a connection to that site is requested, or when diff --git a/spec/unit/http/client_spec.rb b/spec/unit/http/client_spec.rb index 108e1b1b426..1163655de2d 100644 --- a/spec/unit/http/client_spec.rb +++ b/spec/unit/http/client_spec.rb @@ -771,7 +771,7 @@ def retry_after(datetime) it "should close the connection before sleeping" do retry_after('42') - site = Puppet::Network::HTTP::Site.from_uri(uri) + site = Puppet::HTTP::Site.from_uri(uri) http1 = Net::HTTP.new(site.host, site.port) http1.use_ssl = true diff --git a/spec/unit/http/external_client_spec.rb b/spec/unit/http/external_client_spec.rb index 653cfae1cc4..e29b5c632d8 100644 --- a/spec/unit/http/external_client_spec.rb +++ b/spec/unit/http/external_client_spec.rb @@ -27,7 +27,7 @@ def do_request(request, options) request.basic_auth(options[:basic_auth][:user], options[:basic_auth][:password]) end - site = Puppet::Network::HTTP::Site.new(@options[:use_ssl] ? 'https' : 'http', @host, @port) + site = Puppet::HTTP::Site.new(@options[:use_ssl] ? 'https' : 'http', @host, @port) http = @factory.create_connection(site) http.start begin diff --git a/spec/unit/http/factory_spec.rb b/spec/unit/http/factory_spec.rb index 1acbf17d0be..f0710310d9d 100644 --- a/spec/unit/http/factory_spec.rb +++ b/spec/unit/http/factory_spec.rb @@ -11,7 +11,7 @@ Puppet::SSL::CertificateRequest.indirection.terminus_class = :memory end - let(:site) { Puppet::Network::HTTP::Site.new('https', 'www.example.com', 443) } + let(:site) { Puppet::HTTP::Site.new('https', 'www.example.com', 443) } def create_connection(site) factory = described_class.new diff --git a/spec/unit/network/http/site_spec.rb b/spec/unit/http/site_spec.rb similarity index 94% rename from spec/unit/network/http/site_spec.rb rename to spec/unit/http/site_spec.rb index fc83d03b34d..69a783d857a 100644 --- a/spec/unit/network/http/site_spec.rb +++ b/spec/unit/http/site_spec.rb @@ -1,14 +1,14 @@ require 'spec_helper' -require 'puppet/network/http' +require 'puppet/http' -describe Puppet::Network::HTTP::Site do +describe Puppet::HTTP::Site do let(:scheme) { 'https' } let(:host) { 'rubygems.org' } let(:port) { 443 } def create_site(scheme, host, port) - Puppet::Network::HTTP::Site.new(scheme, host, port) + described_class.new(scheme, host, port) end it 'accepts scheme, host, and port' do diff --git a/spec/unit/network/http/nocache_pool_spec.rb b/spec/unit/network/http/nocache_pool_spec.rb index fe2961b9f38..a535d61ab89 100644 --- a/spec/unit/network/http/nocache_pool_spec.rb +++ b/spec/unit/network/http/nocache_pool_spec.rb @@ -4,7 +4,7 @@ require 'puppet/network/http/connection' describe Puppet::Network::HTTP::NoCachePool do - let(:site) { Puppet::Network::HTTP::Site.new('https', 'rubygems.org', 443) } + let(:site) { Puppet::HTTP::Site.new('https', 'rubygems.org', 443) } let(:verifier) { double('verifier', :setup_connection => nil) } it 'yields a started connection' do diff --git a/spec/unit/network/http/pool_spec.rb b/spec/unit/network/http/pool_spec.rb index 647e9ac5067..ccc62661aac 100644 --- a/spec/unit/network/http/pool_spec.rb +++ b/spec/unit/network/http/pool_spec.rb @@ -11,11 +11,11 @@ end let(:site) do - Puppet::Network::HTTP::Site.new('https', 'rubygems.org', 443) + Puppet::HTTP::Site.new('https', 'rubygems.org', 443) end let(:different_site) do - Puppet::Network::HTTP::Site.new('https', 'github.com', 443) + Puppet::HTTP::Site.new('https', 'github.com', 443) end let(:ssl_context) { Puppet::SSL::SSLContext.new } @@ -230,11 +230,11 @@ def create_http_connection(site) end it 'returns a new HTTP connection if the cached connection is HTTPS' do - https_site = Puppet::Network::HTTP::Site.new('https', 'www.example.com', 443) + https_site = Puppet::HTTP::Site.new('https', 'www.example.com', 443) old_conn = create_connection(https_site) pool = create_pool_with_connections(https_site, old_conn) - http_site = Puppet::Network::HTTP::Site.new('http', 'www.example.com', 443) + http_site = Puppet::HTTP::Site.new('http', 'www.example.com', 443) new_conn = create_http_connection(http_site) allow(pool.factory).to receive(:create_connection).with(http_site).and_return(new_conn) @@ -242,11 +242,11 @@ def create_http_connection(site) end it 'returns a new HTTPS connection if the cached connection is HTTP' do - http_site = Puppet::Network::HTTP::Site.new('http', 'www.example.com', 443) + http_site = Puppet::HTTP::Site.new('http', 'www.example.com', 443) old_conn = create_http_connection(http_site) pool = create_pool_with_http_connections(http_site, old_conn) - https_site = Puppet::Network::HTTP::Site.new('https', 'www.example.com', 443) + https_site = Puppet::HTTP::Site.new('https', 'www.example.com', 443) new_conn = create_connection(https_site) allow(pool.factory).to receive(:create_connection).with(https_site).and_return(new_conn) @@ -279,7 +279,7 @@ def create_http_connection(site) end it 'returns a cached connection if both connections are http' do - http_site = Puppet::Network::HTTP::Site.new('http', 'www.example.com', 80) + http_site = Puppet::HTTP::Site.new('http', 'www.example.com', 80) old_conn = create_http_connection(http_site) pool = create_pool_with_http_connections(http_site, old_conn) From 9db83cd9c89d6ba64342aa1e4124b67a7f42bfcd Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Fri, 24 Jul 2020 12:56:51 -0700 Subject: [PATCH 028/731] (PUP-10439) Move Puppet::Network::HTTP::Session to PoolEntry The `Puppet::Network::HTTP::Session` refers to an entry in the HTTP connection pool, so move and rename it to `Puppet::HTTP::PoolEntry`. --- lib/puppet/http.rb | 2 +- .../http/session.rb => http/pool_entry.rb} | 4 +- lib/puppet/network/http/pool.rb | 42 +++++++++---------- .../pool_entry_spec.rb} | 6 +-- 4 files changed, 27 insertions(+), 27 deletions(-) rename lib/puppet/{network/http/session.rb => http/pool_entry.rb} (75%) rename spec/unit/{network/http/session_spec.rb => http/pool_entry_spec.rb} (87%) diff --git a/lib/puppet/http.rb b/lib/puppet/http.rb index 6a3803b2689..1ea377ec454 100644 --- a/lib/puppet/http.rb +++ b/lib/puppet/http.rb @@ -1,7 +1,6 @@ module Puppet module Network module HTTP - require 'puppet/network/http/session' require 'puppet/network/http/base_pool' require 'puppet/network/http/nocache_pool' require 'puppet/network/http/pool' @@ -16,6 +15,7 @@ module HTTP require 'puppet/http/errors' require 'puppet/http/site' + require 'puppet/http/pool_entry' require 'puppet/http/proxy' require 'puppet/http/factory' require 'puppet/http/response' diff --git a/lib/puppet/network/http/session.rb b/lib/puppet/http/pool_entry.rb similarity index 75% rename from lib/puppet/network/http/session.rb rename to lib/puppet/http/pool_entry.rb index 7a018815ce8..8d75746e16e 100644 --- a/lib/puppet/network/http/session.rb +++ b/lib/puppet/http/pool_entry.rb @@ -1,9 +1,9 @@ -# An HTTP session that references a persistent HTTP connection and +# An entry in the peristent HTTP pool that references the connection and # an expiration time for the connection. # # @api private # -class Puppet::Network::HTTP::Session +class Puppet::HTTP::PoolEntry attr_reader :connection, :verifier def initialize(connection, verifier, expiration_time) diff --git a/lib/puppet/network/http/pool.rb b/lib/puppet/network/http/pool.rb index 4a03b4ede84..5203f3fa148 100644 --- a/lib/puppet/network/http/pool.rb +++ b/lib/puppet/network/http/pool.rb @@ -40,9 +40,9 @@ def with_connection(site, verifier, &block) end def close - @pool.each_pair do |site, sessions| - sessions.each do |session| - close_connection(site, session.connection) + @pool.each_pair do |site, entries| + entries.each do |entry| + close_connection(site, entry.connection) end end @pool.clear @@ -72,17 +72,17 @@ def close_connection(site, http) # # @api private def borrow(site, verifier) - @pool[site] = active_sessions(site) - index = @pool[site].index do |session| - (verifier.nil? && session.verifier.nil?) || - (!verifier.nil? && verifier.reusable?(session.verifier)) + @pool[site] = active_entries(site) + index = @pool[site].index do |entry| + (verifier.nil? && entry.verifier.nil?) || + (!verifier.nil? && verifier.reusable?(entry.verifier)) end - session = index ? @pool[site].delete_at(index) : nil - if session + entry = index ? @pool[site].delete_at(index) : nil + if entry @pool.delete(site) if @pool[site].empty? Puppet.debug("Using cached connection for #{site}") - session.connection + entry.connection else http = @factory.create_connection(site) @@ -107,27 +107,27 @@ def setsockopts(netio) # @api private def release(site, verifier, http) expiration = Time.now + @keepalive_timeout - session = Puppet::Network::HTTP::Session.new(http, verifier, expiration) + entry = Puppet::HTTP::PoolEntry.new(http, verifier, expiration) Puppet.debug("Caching connection for #{site}") - sessions = @pool[site] - if sessions - sessions.unshift(session) + entries = @pool[site] + if entries + entries.unshift(entry) else - @pool[site] = [session] + @pool[site] = [entry] end end - # Returns an Array of sessions whose connections are not expired. + # Returns an Array of entries whose connections are not expired. # # @api private - def active_sessions(site) + def active_entries(site) now = Time.now - sessions = @pool[site] || [] - sessions.select do |session| - if session.expired?(now) - close_connection(site, session.connection) + entries = @pool[site] || [] + entries.select do |entry| + if entry.expired?(now) + close_connection(site, entry.connection) false else true diff --git a/spec/unit/network/http/session_spec.rb b/spec/unit/http/pool_entry_spec.rb similarity index 87% rename from spec/unit/network/http/session_spec.rb rename to spec/unit/http/pool_entry_spec.rb index bdb8719cd92..9b81efa3c03 100644 --- a/spec/unit/network/http/session_spec.rb +++ b/spec/unit/http/pool_entry_spec.rb @@ -1,15 +1,15 @@ require 'spec_helper' -require 'puppet/network/http' +require 'puppet/http' -describe Puppet::Network::HTTP::Session do +describe Puppet::HTTP::PoolEntry do let(:connection) { double('connection') } let(:verifier) { double('verifier') } def create_session(connection, expiration_time = nil) expiration_time ||= Time.now + 60 * 60 - Puppet::Network::HTTP::Session.new(connection, verifier, expiration_time) + described_class.new(connection, verifier, expiration_time) end it 'provides access to its connection' do From e6d76d5c5410e1bbfb0793657a1bd10be11bb0ba Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Fri, 24 Jul 2020 12:58:28 -0700 Subject: [PATCH 029/731] (PUP-10439) Remove Puppet::Network::HTTP::NoCachePool The caching pool was introduced so the configurer could reuse connections during pluginsync, while everything else used the non-caching pool. In 5.x/6.x, more applications were switched over to the caching version (`device`, `plugin`, etc). Later all puppet networking was switched to the HTTP client, which always uses the caching pool. This commit removes the non-caching pool. --- lib/puppet/http.rb | 1 - lib/puppet/network/http/nocache_pool.rb | 28 --------- spec/unit/network/http/nocache_pool_spec.rb | 64 --------------------- 3 files changed, 93 deletions(-) delete mode 100644 lib/puppet/network/http/nocache_pool.rb delete mode 100644 spec/unit/network/http/nocache_pool_spec.rb diff --git a/lib/puppet/http.rb b/lib/puppet/http.rb index 1ea377ec454..85f473c0b5f 100644 --- a/lib/puppet/http.rb +++ b/lib/puppet/http.rb @@ -2,7 +2,6 @@ module Puppet module Network module HTTP require 'puppet/network/http/base_pool' - require 'puppet/network/http/nocache_pool' require 'puppet/network/http/pool' require 'puppet/network/resolver' end diff --git a/lib/puppet/network/http/nocache_pool.rb b/lib/puppet/network/http/nocache_pool.rb deleted file mode 100644 index 8496209a4ef..00000000000 --- a/lib/puppet/network/http/nocache_pool.rb +++ /dev/null @@ -1,28 +0,0 @@ -# A pool that does not cache HTTP connections. -# -# @api private -class Puppet::Network::HTTP::NoCachePool < Puppet::Network::HTTP::BasePool - def initialize(factory = Puppet::HTTP::Factory.new) - Puppet.deprecation_warning(_('Puppet::Network::HTTP::NoCachePool is deprecated.')) - @factory = factory - end - - # Yields a Net::HTTP connection. - # - # @yieldparam http [Net::HTTP] An HTTP connection - def with_connection(site, verifier, &block) - http = @factory.create_connection(site) - start(site, verifier, http) - begin - yield http - ensure - return unless http.started? - Puppet.debug("Closing connection for #{site}") - http.finish - end - end - - def close - # do nothing - end -end diff --git a/spec/unit/network/http/nocache_pool_spec.rb b/spec/unit/network/http/nocache_pool_spec.rb deleted file mode 100644 index a535d61ab89..00000000000 --- a/spec/unit/network/http/nocache_pool_spec.rb +++ /dev/null @@ -1,64 +0,0 @@ -require 'spec_helper' - -require 'puppet/network/http' -require 'puppet/network/http/connection' - -describe Puppet::Network::HTTP::NoCachePool do - let(:site) { Puppet::HTTP::Site.new('https', 'rubygems.org', 443) } - let(:verifier) { double('verifier', :setup_connection => nil) } - - it 'yields a started connection' do - http = double('http', start: nil, finish: nil, started?: true) - - factory = Puppet::HTTP::Factory.new - allow(factory).to receive(:create_connection).and_return(http) - pool = Puppet::Network::HTTP::NoCachePool.new(factory) - - expect { |b| - pool.with_connection(site, verifier, &b) - }.to yield_with_args(http) - end - - it 'yields a new connection each time' do - http1 = double('http1', start: nil, finish: nil, started?: true) - http2 = double('http2', start: nil, finish: nil, started?: true) - - factory = Puppet::HTTP::Factory.new - allow(factory).to receive(:create_connection).and_return(http1, http2) - pool = Puppet::Network::HTTP::NoCachePool.new(factory) - - expect { |b| - pool.with_connection(site, verifier, &b) - }.to yield_with_args(http1) - - expect { |b| - pool.with_connection(site, verifier, &b) - }.to yield_with_args(http2) - end - - it 'has a close method' do - Puppet::Network::HTTP::NoCachePool.new.close - end - - it 'logs a deprecation warning' do - http = double('http', start: nil, finish: nil, started?: true) - - factory = Puppet::HTTP::Factory.new - allow(factory).to receive(:create_connection).and_return(http) - Puppet::Network::HTTP::NoCachePool.new(factory) - - expect(@logs).to include(an_object_having_attributes(level: :warning, message: /Puppet::Network::HTTP::NoCachePool is deprecated/)) - end - - it 'omits the warning when deprecations are disabled' do - Puppet[:disable_warnings] = 'deprecations' - - http = double('http', start: nil, finish: nil, started?: true) - - factory = Puppet::HTTP::Factory.new - allow(factory).to receive(:create_connection).and_return(http) - Puppet::Network::HTTP::NoCachePool.new(factory) - - expect(@logs).to eq([]) - end -end From 0043191dbe5bab85c42451a8f07759cc885956bc Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Fri, 24 Jul 2020 13:03:40 -0700 Subject: [PATCH 030/731] (PUP-10439) Collapse Pool and BasePool --- lib/puppet/http.rb | 1 - lib/puppet/network/http/base_pool.rb | 36 -------------------------- lib/puppet/network/http/pool.rb | 38 +++++++++++++++++++++++++++- 3 files changed, 37 insertions(+), 38 deletions(-) delete mode 100644 lib/puppet/network/http/base_pool.rb diff --git a/lib/puppet/http.rb b/lib/puppet/http.rb index 85f473c0b5f..cfb0f4de28a 100644 --- a/lib/puppet/http.rb +++ b/lib/puppet/http.rb @@ -1,7 +1,6 @@ module Puppet module Network module HTTP - require 'puppet/network/http/base_pool' require 'puppet/network/http/pool' require 'puppet/network/resolver' end diff --git a/lib/puppet/network/http/base_pool.rb b/lib/puppet/network/http/base_pool.rb deleted file mode 100644 index 0a4d7a7160e..00000000000 --- a/lib/puppet/network/http/base_pool.rb +++ /dev/null @@ -1,36 +0,0 @@ -# Base pool for HTTP connections. -# -# @api private -class Puppet::Network::HTTP::BasePool - def start(site, verifier, http) - Puppet.debug("Starting connection for #{site}") - if site.use_ssl? - verifier.setup_connection(http) - begin - http.start - print_ssl_info(http) if Puppet::Util::Log.sendlevel?(:debug) - rescue OpenSSL::SSL::SSLError => error - verifier.handle_connection_error(http, error) - end - else - http.start - end - end - - private - - def print_ssl_info(http) - buffered_io = http.instance_variable_get(:@socket) - return unless buffered_io - - socket = buffered_io.io - return unless socket - - cipher = if Puppet::Util::Platform.jruby? - socket.cipher - else - socket.cipher.first - end - Puppet.debug("Using #{socket.ssl_version} with cipher #{cipher}") - end -end diff --git a/lib/puppet/network/http/pool.rb b/lib/puppet/network/http/pool.rb index 5203f3fa148..a382928f885 100644 --- a/lib/puppet/network/http/pool.rb +++ b/lib/puppet/network/http/pool.rb @@ -8,7 +8,7 @@ # # @api private # -class Puppet::Network::HTTP::Pool < Puppet::Network::HTTP::BasePool +class Puppet::Network::HTTP::Pool attr_reader :factory, :keepalive_timeout def initialize(keepalive_timeout) @@ -53,6 +53,25 @@ def pool @pool end + # Start a persistent connection + # + # @api private + def start(site, verifier, http) + Puppet.debug("Starting connection for #{site}") + if site.use_ssl? + verifier.setup_connection(http) + begin + http.start + print_ssl_info(http) if Puppet::Util::Log.sendlevel?(:debug) + rescue OpenSSL::SSL::SSLError => error + verifier.handle_connection_error(http, error) + end + else + http.start + end + end + + # Safely close a persistent connection. # Don't try to close a connection that's already closed. # @@ -134,4 +153,21 @@ def active_entries(site) end end end + + private + + def print_ssl_info(http) + buffered_io = http.instance_variable_get(:@socket) + return unless buffered_io + + socket = buffered_io.io + return unless socket + + cipher = if Puppet::Util::Platform.jruby? + socket.cipher + else + socket.cipher.first + end + Puppet.debug("Using #{socket.ssl_version} with cipher #{cipher}") + end end From 6f5f1406903fbd52f79d1f47529430bd76efd966 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Fri, 24 Jul 2020 13:12:32 -0700 Subject: [PATCH 031/731] (PUP-10439) Move Puppet::Network::HTTP::Pool Move to Puppet::HTTP::Pool --- lib/puppet/http.rb | 2 +- lib/puppet/http/client.rb | 6 +++--- lib/puppet/{network => }/http/pool.rb | 2 +- spec/integration/network/http_pool_spec.rb | 2 +- spec/unit/face/plugin_spec.rb | 2 +- spec/unit/http/client_spec.rb | 3 +-- spec/unit/{network => }/http/pool_spec.rb | 10 +++++----- spec/unit/network/http_spec.rb | 2 +- 8 files changed, 14 insertions(+), 15 deletions(-) rename lib/puppet/{network => }/http/pool.rb (99%) rename spec/unit/{network => }/http/pool_spec.rb (98%) diff --git a/lib/puppet/http.rb b/lib/puppet/http.rb index cfb0f4de28a..3e235a8147f 100644 --- a/lib/puppet/http.rb +++ b/lib/puppet/http.rb @@ -1,7 +1,6 @@ module Puppet module Network module HTTP - require 'puppet/network/http/pool' require 'puppet/network/resolver' end end @@ -16,6 +15,7 @@ module HTTP require 'puppet/http/pool_entry' require 'puppet/http/proxy' require 'puppet/http/factory' + require 'puppet/http/pool' require 'puppet/http/response' require 'puppet/http/service' require 'puppet/http/service/ca' diff --git a/lib/puppet/http/client.rb b/lib/puppet/http/client.rb index e8dc32bb883..84f506c6d45 100644 --- a/lib/puppet/http/client.rb +++ b/lib/puppet/http/client.rb @@ -7,7 +7,7 @@ class Puppet::HTTP::Client # @api private - # @return [Puppet::Network::HTTP::Pool] the pool instance associated with + # @return [Puppet::HTTP::Pool] the pool instance associated with # this client attr_reader :pool @@ -17,7 +17,7 @@ class Puppet::HTTP::Client # Create a new http client instance. The client contains a pool of persistent # HTTP connections and creates HTTP sessions. # - # @param [Puppet::Network::HTTP::Pool] pool pool of persistent Net::HTTP + # @param [Puppet::HTTP::Pool] pool pool of persistent Net::HTTP # connections # @param [Puppet::SSL::SSLContext] ssl_context ssl context to be used for # connections @@ -28,7 +28,7 @@ class Puppet::HTTP::Client # @param [Integer] retry_limit number of HTTP reties allowed in a given # request # - def initialize(pool: Puppet::Network::HTTP::Pool.new(Puppet[:http_keepalive_timeout]), ssl_context: nil, system_ssl_context: nil, redirect_limit: 10, retry_limit: 100) + def initialize(pool: Puppet::HTTP::Pool.new(Puppet[:http_keepalive_timeout]), ssl_context: nil, system_ssl_context: nil, redirect_limit: 10, retry_limit: 100) @pool = pool @default_headers = { 'X-Puppet-Version' => Puppet.version, diff --git a/lib/puppet/network/http/pool.rb b/lib/puppet/http/pool.rb similarity index 99% rename from lib/puppet/network/http/pool.rb rename to lib/puppet/http/pool.rb index a382928f885..d8e9a491c69 100644 --- a/lib/puppet/network/http/pool.rb +++ b/lib/puppet/http/pool.rb @@ -8,7 +8,7 @@ # # @api private # -class Puppet::Network::HTTP::Pool +class Puppet::HTTP::Pool attr_reader :factory, :keepalive_timeout def initialize(keepalive_timeout) diff --git a/spec/integration/network/http_pool_spec.rb b/spec/integration/network/http_pool_spec.rb index dd83d3897fe..0a48e37efbe 100644 --- a/spec/integration/network/http_pool_spec.rb +++ b/spec/integration/network/http_pool_spec.rb @@ -107,7 +107,7 @@ def connection(host, port) context "when using persistent HTTPS connections" do around :each do |example| - pool = Puppet::Network::HTTP::Pool.new(15) + pool = Puppet::HTTP::Pool.new(15) Puppet.override(:http_pool => pool) do example.run end diff --git a/spec/unit/face/plugin_spec.rb b/spec/unit/face/plugin_spec.rb index bfbeacfb348..3930764f36a 100644 --- a/spec/unit/face/plugin_spec.rb +++ b/spec/unit/face/plugin_spec.rb @@ -54,7 +54,7 @@ def render(result) it "uses persistent HTTP pool" do allow_any_instance_of(Puppet::Configurer::Downloader).to receive(:evaluate) do - expect(Puppet.lookup(:http_pool)).to be_instance_of(Puppet::Network::HTTP::Pool) + expect(Puppet.lookup(:http_pool)).to be_instance_of(Puppet::HTTP::Pool) end.and_return([]) pluginface.download diff --git a/spec/unit/http/client_spec.rb b/spec/unit/http/client_spec.rb index 1163655de2d..83aa58ed345 100644 --- a/spec/unit/http/client_spec.rb +++ b/spec/unit/http/client_spec.rb @@ -781,8 +781,7 @@ def retry_after(datetime) http2.use_ssl = true allow(http2).to receive(:started?).and_return(true) - - pool = Puppet::Network::HTTP::Pool.new(15) + pool = Puppet::HTTP::Pool.new(15) client = Puppet::HTTP::Client.new(pool: pool) # The "with_connection" method is required to yield started connections diff --git a/spec/unit/network/http/pool_spec.rb b/spec/unit/http/pool_spec.rb similarity index 98% rename from spec/unit/network/http/pool_spec.rb rename to spec/unit/http/pool_spec.rb index ccc62661aac..9cc675ea5a5 100644 --- a/spec/unit/network/http/pool_spec.rb +++ b/spec/unit/http/pool_spec.rb @@ -4,7 +4,7 @@ require 'puppet/network/http' require 'puppet/network/http_pool' -describe Puppet::Network::HTTP::Pool do +describe Puppet::HTTP::Pool do before :each do Puppet::SSL::Key.indirection.terminus_class = :memory Puppet::SSL::CertificateRequest.indirection.terminus_class = :memory @@ -26,11 +26,11 @@ end def create_pool - Puppet::Network::HTTP::Pool.new(15) + Puppet::HTTP::Pool.new(15) end def create_pool_with_connections(site, *connections) - pool = Puppet::Network::HTTP::Pool.new(15) + pool = Puppet::HTTP::Pool.new(15) connections.each do |conn| pool.release(site, verifier, conn) end @@ -38,7 +38,7 @@ def create_pool_with_connections(site, *connections) end def create_pool_with_http_connections(site, *connections) - pool = Puppet::Network::HTTP::Pool.new(15) + pool = Puppet::HTTP::Pool.new(15) connections.each do |conn| pool.release(site, nil, conn) end @@ -48,7 +48,7 @@ def create_pool_with_http_connections(site, *connections) def create_pool_with_expired_connections(site, *connections) # setting keepalive timeout to -1 ensures any newly added # connections have already expired - pool = Puppet::Network::HTTP::Pool.new(-1) + pool = Puppet::HTTP::Pool.new(-1) connections.each do |conn| pool.release(site, verifier, conn) end diff --git a/spec/unit/network/http_spec.rb b/spec/unit/network/http_spec.rb index 05b16e93a98..99b809218ce 100644 --- a/spec/unit/network/http_spec.rb +++ b/spec/unit/network/http_spec.rb @@ -4,6 +4,6 @@ describe Puppet::Network::HTTP do it 'defines an http_pool context' do pool = Puppet.lookup(:http_pool) - expect(pool).to be_a(Puppet::Network::HTTP::Pool) + expect(pool).to be_a(Puppet::HTTP::Pool) end end From 0b014dfc83f9396993d56996b9e91fc730677864 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Fri, 24 Jul 2020 13:28:29 -0700 Subject: [PATCH 032/731] (PUP-10439) Remove Puppet.lookup(:http_pool) All code uses http client and persistent connections so applications don't need to push the pool onto the context or look it up. --- lib/puppet.rb | 1 - lib/puppet/application/device.rb | 204 ++++++++++----------- lib/puppet/configurer.rb | 34 ++-- lib/puppet/face/plugin.rb | 13 +- spec/integration/network/http_pool_spec.rb | 10 +- spec/unit/face/plugin_spec.rb | 8 - spec/unit/network/http/connection_spec.rb | 33 +--- spec/unit/network/http_spec.rb | 9 - 8 files changed, 131 insertions(+), 181 deletions(-) delete mode 100644 spec/unit/network/http_spec.rb diff --git a/lib/puppet.rb b/lib/puppet.rb index 73716f6e654..652c1d5b360 100644 --- a/lib/puppet.rb +++ b/lib/puppet.rb @@ -245,7 +245,6 @@ def self.base_context(settings) { :environments => Puppet::Environments::Cached.new(Puppet::Environments::Combined.new(*loaders)), - :http_pool => proc { Puppet.runtime[:http].pool }, :ssl_context => proc { begin cert = Puppet::X509::CertProvider.new diff --git a/lib/puppet/application/device.rb b/lib/puppet/application/device.rb index 1aa5ce14c5f..c47af62b4b8 100644 --- a/lib/puppet/application/device.rb +++ b/lib/puppet/application/device.rb @@ -259,119 +259,115 @@ def main end end devices.collect do |devicename,device| - pool = Puppet.runtime[:http].pool - Puppet.override(:http_pool => pool) do - # TODO when we drop support for ruby < 2.5 we can remove the extra block here - begin - device_url = URI.parse(device.url) - # Handle nil scheme & port - scheme = "#{device_url.scheme}://" if device_url.scheme - port = ":#{device_url.port}" if device_url.port - - # override local $vardir and $certname - Puppet[:ssldir] = ::File.join(Puppet[:deviceconfdir], device.name, 'ssl') - Puppet[:confdir] = ::File.join(Puppet[:devicedir], device.name) - Puppet[:libdir] = options[:libdir] || ::File.join(Puppet[:devicedir], device.name, 'lib') - Puppet[:vardir] = ::File.join(Puppet[:devicedir], device.name) - Puppet[:certname] = device.name - ssl_context = nil - - # create device directory under $deviceconfdir - Puppet::FileSystem.dir_mkpath(Puppet[:ssldir]) unless Puppet::FileSystem.dir_exist?(Puppet[:ssldir]) - - # this will reload and recompute default settings and create device-specific sub vardir - Puppet.settings.use :main, :agent, :ssl - - # Workaround for PUP-8736: store ssl certs outside the cache directory to prevent accidental removal and keep the old path as symlink - optssldir = File.join(Puppet[:confdir], 'ssl') - Puppet::FileSystem.symlink(Puppet[:ssldir], optssldir) unless Puppet::FileSystem.exist?(optssldir) - - unless options[:resource] || options[:facts] || options[:apply] - # Since it's too complicated to fix properly in the default settings, we workaround for PUP-9642 here. - # See https://github.com/puppetlabs/puppet/pull/7483#issuecomment-483455997 for details. - # This has to happen after `settings.use` above, so the directory is created and before `setup_host` below, where the SSL - # routines would fail with access errors - if Puppet.features.root? && !Puppet::Util::Platform.windows? - user = Puppet::Type.type(:user).new(name: Puppet[:user]).exists? ? Puppet[:user] : nil - group = Puppet::Type.type(:group).new(name: Puppet[:group]).exists? ? Puppet[:group] : nil - Puppet.debug("Fixing perms for #{user}:#{group} on #{Puppet[:confdir]}") - FileUtils.chown(user, group, Puppet[:confdir]) if user || group - end + # TODO when we drop support for ruby < 2.5 we can remove the extra block here + begin + device_url = URI.parse(device.url) + # Handle nil scheme & port + scheme = "#{device_url.scheme}://" if device_url.scheme + port = ":#{device_url.port}" if device_url.port + + # override local $vardir and $certname + Puppet[:ssldir] = ::File.join(Puppet[:deviceconfdir], device.name, 'ssl') + Puppet[:confdir] = ::File.join(Puppet[:devicedir], device.name) + Puppet[:libdir] = options[:libdir] || ::File.join(Puppet[:devicedir], device.name, 'lib') + Puppet[:vardir] = ::File.join(Puppet[:devicedir], device.name) + Puppet[:certname] = device.name + ssl_context = nil + + # create device directory under $deviceconfdir + Puppet::FileSystem.dir_mkpath(Puppet[:ssldir]) unless Puppet::FileSystem.dir_exist?(Puppet[:ssldir]) + + # this will reload and recompute default settings and create device-specific sub vardir + Puppet.settings.use :main, :agent, :ssl + + # Workaround for PUP-8736: store ssl certs outside the cache directory to prevent accidental removal and keep the old path as symlink + optssldir = File.join(Puppet[:confdir], 'ssl') + Puppet::FileSystem.symlink(Puppet[:ssldir], optssldir) unless Puppet::FileSystem.exist?(optssldir) + + unless options[:resource] || options[:facts] || options[:apply] + # Since it's too complicated to fix properly in the default settings, we workaround for PUP-9642 here. + # See https://github.com/puppetlabs/puppet/pull/7483#issuecomment-483455997 for details. + # This has to happen after `settings.use` above, so the directory is created and before `setup_host` below, where the SSL + # routines would fail with access errors + if Puppet.features.root? && !Puppet::Util::Platform.windows? + user = Puppet::Type.type(:user).new(name: Puppet[:user]).exists? ? Puppet[:user] : nil + group = Puppet::Type.type(:group).new(name: Puppet[:group]).exists? ? Puppet[:group] : nil + Puppet.debug("Fixing perms for #{user}:#{group} on #{Puppet[:confdir]}") + FileUtils.chown(user, group, Puppet[:confdir]) if user || group + end - ssl_context = setup_context + ssl_context = setup_context - unless options[:libdir] - Puppet.override(ssl_context: ssl_context) do - Puppet::Configurer::PluginHandler.new.download_plugins(env) if Puppet::Configurer.should_pluginsync? - end + unless options[:libdir] + Puppet.override(ssl_context: ssl_context) do + Puppet::Configurer::PluginHandler.new.download_plugins(env) if Puppet::Configurer.should_pluginsync? end end + end - # this inits the device singleton, so that the facts terminus - # and the various network_device provider can use it - Puppet::Util::NetworkDevice.init(device) - - if options[:resource] - type, name = parse_args(command_line.args) - 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 } - resources = find_resources(type, name) - if options[:to_yaml] - data = resources.map do |resource| - resource.prune_parameters(:parameters_to_include => @extra_params).to_hiera_hash - end.inject(:merge!) - text = YAML.dump(type.downcase => data) - else - text = resources.map do |resource| - resource.prune_parameters(:parameters_to_include => @extra_params).to_manifest.force_encoding(Encoding.default_external) - end.join("\n") - end - (puts text) - 0 - elsif options[:facts] - Puppet.info _("retrieving facts 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 } - remote_facts = Puppet::Node::Facts.indirection.find(name, :environment => env) - # Give a proper name to the facts - remote_facts.name = remote_facts.values['clientcert'] - renderer = Puppet::Network::FormatHandler.format(:console) - puts renderer.render(remote_facts) - 0 - elsif options[:apply] - # avoid reporting to server - Puppet::Transaction::Report.indirection.terminus_class = :yaml - Puppet::Resource::Catalog.indirection.cache_class = nil - - require 'puppet/application/apply' - begin - Puppet[:node_terminus] = :plain - Puppet[:catalog_terminus] = :compiler - Puppet[:catalog_cache_terminus] = nil - Puppet[:facts_terminus] = :network_device - Puppet.override(:network_device => true) do - Puppet::Application::Apply.new(Puppet::Util::CommandLine.new('puppet', ["apply", options[:apply]])).run_command - end - end + # this inits the device singleton, so that the facts terminus + # and the various network_device provider can use it + Puppet::Util::NetworkDevice.init(device) + + if options[:resource] + type, name = parse_args(command_line.args) + 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 } + resources = find_resources(type, name) + if options[:to_yaml] + data = resources.map do |resource| + resource.prune_parameters(:parameters_to_include => @extra_params).to_hiera_hash + end.inject(:merge!) + text = YAML.dump(type.downcase => data) else - Puppet.info _("starting applying configuration to %{target} at %{scheme}%{url_host}%{port}%{url_path}") % { target: device.name, scheme: scheme, url_host: device_url.host, port: port, url_path: device_url.path } - - overrides = {} - overrides[:ssl_context] = ssl_context if ssl_context - Puppet.override(overrides) do - configurer = Puppet::Configurer.new - configurer.run(:network_device => true, :pluginsync => false) + text = resources.map do |resource| + resource.prune_parameters(:parameters_to_include => @extra_params).to_manifest.force_encoding(Encoding.default_external) + end.join("\n") + end + (puts text) + 0 + elsif options[:facts] + Puppet.info _("retrieving facts 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 } + remote_facts = Puppet::Node::Facts.indirection.find(name, :environment => env) + # Give a proper name to the facts + remote_facts.name = remote_facts.values['clientcert'] + renderer = Puppet::Network::FormatHandler.format(:console) + puts renderer.render(remote_facts) + 0 + elsif options[:apply] + # avoid reporting to server + Puppet::Transaction::Report.indirection.terminus_class = :yaml + Puppet::Resource::Catalog.indirection.cache_class = nil + + require 'puppet/application/apply' + begin + Puppet[:node_terminus] = :plain + Puppet[:catalog_terminus] = :compiler + Puppet[:catalog_cache_terminus] = nil + Puppet[:facts_terminus] = :network_device + Puppet.override(:network_device => true) do + Puppet::Application::Apply.new(Puppet::Util::CommandLine.new('puppet', ["apply", options[:apply]])).run_command end end - rescue => detail - Puppet.log_exception(detail) - # If we rescued an error, then we return 1 as the exit code - 1 - ensure - pool.close - Puppet[:libdir] = libdir - Puppet[:vardir] = vardir - Puppet[:confdir] = confdir - Puppet[:ssldir] = ssldir - Puppet[:certname] = certname + else + Puppet.info _("starting applying configuration to %{target} at %{scheme}%{url_host}%{port}%{url_path}") % { target: device.name, scheme: scheme, url_host: device_url.host, port: port, url_path: device_url.path } + + overrides = {} + overrides[:ssl_context] = ssl_context if ssl_context + Puppet.override(overrides) do + configurer = Puppet::Configurer.new + configurer.run(:network_device => true, :pluginsync => false) + end end + rescue => detail + Puppet.log_exception(detail) + # If we rescued an error, then we return 1 as the exit code + 1 + ensure + Puppet[:libdir] = libdir + Puppet[:vardir] = vardir + Puppet[:confdir] = confdir + Puppet[:ssldir] = ssldir + Puppet[:certname] = certname end end end diff --git a/lib/puppet/configurer.rb b/lib/puppet/configurer.rb index c865f373a1f..ef9e1b42569 100644 --- a/lib/puppet/configurer.rb +++ b/lib/puppet/configurer.rb @@ -194,7 +194,6 @@ def apply_catalog(catalog, options) # This just passes any options on to the catalog, # which accepts :tags and :ignoreschedules. def run(options = {}) - pool = Puppet.runtime[:http].pool # We create the report pre-populated with default settings for # environment and transaction_uuid very early, this is to ensure # they are sent regardless of any catalog compilation failures or @@ -207,28 +206,27 @@ def run(options = {}) completed = nil begin - Puppet.override(:http_pool => pool) do - # Skip failover logic if the server_list setting is empty - do_failover = Puppet.settings[:server_list] && !Puppet.settings[:server_list].empty? - - # When we are passed a catalog, that means we're in apply - # mode. We shouldn't try to do any failover in that case. - if options[:catalog].nil? && do_failover - server, port = find_functional_server - if server.nil? - 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) } - else - report.master_used = "#{server}:#{port}" - end - Puppet.override(server: server, serverport: port) do - completed = run_internal(options) - end + # Skip failover logic if the server_list setting is empty + do_failover = Puppet.settings[:server_list] && !Puppet.settings[:server_list].empty? + + # When we are passed a catalog, that means we're in apply + # mode. We shouldn't try to do any failover in that case. + if options[:catalog].nil? && do_failover + server, port = find_functional_server + if server.nil? + 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) } else + report.master_used = "#{server}:#{port}" + end + Puppet.override(server: server, serverport: port) do completed = run_internal(options) end + else + completed = run_internal(options) end ensure - pool.close + # we may sleep for awhile, close connections now + Puppet.runtime[:http].close end completed ? report.exit_status : nil diff --git a/lib/puppet/face/plugin.rb b/lib/puppet/face/plugin.rb index 9f606441f78..562b2e4093d 100644 --- a/lib/puppet/face/plugin.rb +++ b/lib/puppet/face/plugin.rb @@ -41,14 +41,11 @@ when_invoked do |options| remote_environment_for_plugins = Puppet::Node::Environment.remote(Puppet[:environment]) - pool = Puppet.runtime[:http].pool - Puppet.override(:http_pool => pool) do - begin - handler = Puppet::Configurer::PluginHandler.new - handler.download_plugins(remote_environment_for_plugins) - ensure - pool.close - end + begin + handler = Puppet::Configurer::PluginHandler.new + handler.download_plugins(remote_environment_for_plugins) + ensure + Puppet.runtime[:http].close end end diff --git a/spec/integration/network/http_pool_spec.rb b/spec/integration/network/http_pool_spec.rb index 0a48e37efbe..297639ca80a 100644 --- a/spec/integration/network/http_pool_spec.rb +++ b/spec/integration/network/http_pool_spec.rb @@ -101,17 +101,13 @@ def connection(host, port) end end - context "when using single use HTTPS connections" do - include_examples 'HTTPS client' - end - context "when using persistent HTTPS connections" do around :each do |example| - pool = Puppet::HTTP::Pool.new(15) - Puppet.override(:http_pool => pool) do + begin example.run + ensure + Puppet.runtime[:http].close end - pool.close end include_examples 'HTTPS client' diff --git a/spec/unit/face/plugin_spec.rb b/spec/unit/face/plugin_spec.rb index 3930764f36a..3eb8adf559d 100644 --- a/spec/unit/face/plugin_spec.rb +++ b/spec/unit/face/plugin_spec.rb @@ -51,14 +51,6 @@ def render(result) expect(receive_count).to eq(3) expect(render(result)).to eq('Downloaded these plugins: /a, /b, /c') end - - it "uses persistent HTTP pool" do - allow_any_instance_of(Puppet::Configurer::Downloader).to receive(:evaluate) do - expect(Puppet.lookup(:http_pool)).to be_instance_of(Puppet::HTTP::Pool) - end.and_return([]) - - pluginface.download - end end context "download when server_agent_version is 5.3.3" do diff --git a/spec/unit/network/http/connection_spec.rb b/spec/unit/network/http/connection_spec.rb index e6037754ee0..4472391d6ae 100644 --- a/spec/unit/network/http/connection_spec.rb +++ b/spec/unit/network/http/connection_spec.rb @@ -10,7 +10,7 @@ let(:params) { { 'key' => 'a value' } } let(:encoded_url_with_params) { "#{url}?%7B%22key%22:%22a%20value%22%7D" } - shared_examples_for "an HTTP connection" do |klass, legacy_api| + shared_examples_for "an HTTP connection" do |klass| subject { klass.new(host, port, :verify => Puppet::SSL::Validator.no_validator) } context "when providing HTTP connections" do @@ -305,8 +305,6 @@ end it 'defaults content-type to application/x-www-form-urlencoded' do - skip("Net::HTTP sends a default content-type header, but it's not visible to webmock") if legacy_api - stub_request(:put, url).with(headers: {'Content-Type' => 'application/x-www-form-urlencoded'}) subject.put(path, '') @@ -361,8 +359,6 @@ end it 'defaults content-type to application/x-www-form-urlencoded' do - skip("Net::HTTP sends a default content-type header, but it's not visible to webmock") if legacy_api - stub_request(:post, url).with(headers: {'Content-Type' => 'application/x-www-form-urlencoded'}) subject.post(path, "") @@ -473,15 +469,9 @@ def expects_limit_exceeded(conn) it 'raises an exception when the location header is missing' do stub_request(:get, "http://me.example.com:8140/").to_return(status: 302) - if legacy_api - expect { - create_connection.get('/') - }.to raise_error(URI::InvalidURIError, /bad URI/) - else - expect { + expect { create_connection.get('/') }.to raise_error(Puppet::HTTP::ProtocolError, /Location response header is missing/) - end end end @@ -502,14 +492,9 @@ def retry_after(datetime) it "should return a 503 response if Retry-After is not convertible to an Integer or RFC 2822 Date" do retry_after('foo') - if legacy_api - result = subject.get('/foo') - expect(result.code).to eq("503") - else - expect { - subject.get('/foo') - }.to raise_error(Puppet::HTTP::ProtocolError, /Failed to parse Retry-After header 'foo'/) - end + expect { + subject.get('/foo') + }.to raise_error(Puppet::HTTP::ProtocolError, /Failed to parse Retry-After header 'foo'/) end it "should close the connection before sleeping" do @@ -524,11 +509,7 @@ def retry_after(datetime) allow(http1).to receive(:started?).and_return(true) # The "with_connection" method is required to yield started connections - pool = if legacy_api - Puppet.lookup(:http_pool) - else - Puppet.runtime[:http].pool - end + pool = Puppet.runtime[:http].pool allow(pool).to receive(:with_connection).and_yield(http1).and_yield(http2) @@ -648,6 +629,6 @@ def retry_after(datetime) end describe Puppet::Network::HTTP::Connection do - it_behaves_like "an HTTP connection", described_class, false + it_behaves_like "an HTTP connection", described_class end end diff --git a/spec/unit/network/http_spec.rb b/spec/unit/network/http_spec.rb deleted file mode 100644 index 99b809218ce..00000000000 --- a/spec/unit/network/http_spec.rb +++ /dev/null @@ -1,9 +0,0 @@ -require 'spec_helper' -require 'puppet/network/http' - -describe Puppet::Network::HTTP do - it 'defines an http_pool context' do - pool = Puppet.lookup(:http_pool) - expect(pool).to be_a(Puppet::HTTP::Pool) - end -end From e58f9194e04cf06557041afe9967814bfc4992f0 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Thu, 6 Aug 2020 17:29:56 +0000 Subject: [PATCH 033/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 8 -------- 1 file changed, 8 deletions(-) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index d41272b4465..ebace0abba3 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -676,14 +676,6 @@ For more info, see the ENC documentation \fIhttps://puppet\.com/docs/puppet/late . .IP "" 0 . -.SS "facterng" -Whether to enable a pre\-Facter 4\.0 release of Facter (distributed as the "facter\-ng" gem)\. This is not necessary if Facter 3\.x or later is installed\. This setting is still experimental\. -. -.IP "\(bu" 4 -\fIDefault\fR: false -. -.IP "" 0 -. .SS "factpath" Where Puppet should look for facts\. Multiple directories should be separated by the system path separator character\. (The POSIX path separator is \':\', and the Windows path separator is \';\'\.) . From 7c833980bbfd8c619c52a89ce5c3cbcaca7992f9 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Thu, 23 Jul 2020 19:58:08 -0700 Subject: [PATCH 034/731] (PUP-10252) Remove VerifierAdapter The `HttpPool.http_ssl_instance` method accepted an instance of `Puppet::SSL::Validator` and passed it as the `verify` argument to the `Connection#initialize` method. The `http_ssl_instance` method was deleted in PUP-10439 and the connection factory methods don't accept a Validator as an argument. So it's no longer possible for the Connection class to receive a Validator when using the legacy HTTP API. This commit deletes the VerifierAdapter and modifies the Connection class so that it no longer accepts a `verify` option. --- lib/puppet/network/http/connection.rb | 15 ++---- lib/puppet/ssl.rb | 1 - lib/puppet/ssl/verifier_adapter.rb | 58 ----------------------- spec/unit/network/http/connection_spec.rb | 22 +++++---- spec/unit/ssl/verifier_spec.rb | 21 -------- 5 files changed, 17 insertions(+), 100 deletions(-) delete mode 100644 lib/puppet/ssl/verifier_adapter.rb diff --git a/lib/puppet/network/http/connection.rb b/lib/puppet/network/http/connection.rb index 4a0304d2d3e..594b37f6982 100644 --- a/lib/puppet/network/http/connection.rb +++ b/lib/puppet/network/http/connection.rb @@ -16,7 +16,6 @@ class Puppet::Network::HTTP::RedirectionLimitExceededException < Puppet::Error ; class Puppet::Network::HTTP::Connection OPTION_DEFAULTS = { :use_ssl => true, - :verify => nil, # Puppet::SSL::Validator is deprecated :verifier => nil, :redirect_limit => 10, } @@ -28,7 +27,7 @@ class Puppet::Network::HTTP::Connection # connection, # @option options [Boolean] :use_ssl true to connect with SSL, false # otherwise, defaults to true - # @option options [#setup_connection] :verify An object that will configure + # @option options [Puppet::SSL::Verifier] :verifier An object that will configure # any verification to do on the connection # @option options [Integer] :redirect_limit the number of allowed # redirections, defaults to 10 passing any other option in the options @@ -46,15 +45,11 @@ def initialize(host, port, options = {}) options = OPTION_DEFAULTS.merge(options) @use_ssl = options[:use_ssl] if @use_ssl - if options[:verifier] - unless options[:verifier].is_a?(Puppet::SSL::Verifier) - raise ArgumentError, _("Expected an instance of Puppet::SSL::Verifier but was passed a %{klass}") % { klass: options[:verifier].class } - end - - @verifier = options[:verifier] - else - @verifier = Puppet::SSL::VerifierAdapter.new(options[:verify]) + unless options[:verifier].is_a?(Puppet::SSL::Verifier) + raise ArgumentError, _("Expected an instance of Puppet::SSL::Verifier but was passed a %{klass}") % { klass: options[:verifier].class } end + + @verifier = options[:verifier] end @redirect_limit = options[:redirect_limit] @site = Puppet::HTTP::Site.new(@use_ssl ? 'https' : 'http', host, port) diff --git a/lib/puppet/ssl.rb b/lib/puppet/ssl.rb index 4ee96b9e6ab..65cde5a7d40 100644 --- a/lib/puppet/ssl.rb +++ b/lib/puppet/ssl.rb @@ -13,7 +13,6 @@ module Puppet::SSL # :nodoc: require 'puppet/ssl/error' require 'puppet/ssl/ssl_context' require 'puppet/ssl/verifier' - require 'puppet/ssl/verifier_adapter' require 'puppet/ssl/ssl_provider' require 'puppet/ssl/state_machine' end diff --git a/lib/puppet/ssl/verifier_adapter.rb b/lib/puppet/ssl/verifier_adapter.rb deleted file mode 100644 index fe8092f832d..00000000000 --- a/lib/puppet/ssl/verifier_adapter.rb +++ /dev/null @@ -1,58 +0,0 @@ -# Allows a `Puppet::SSL::Validator` to be used in situations where a -# `Verifier` is required, while preserving the legacy validator behavior of: -# -# * Loading CA certs from `ssl_client_ca_auth` or `localcacert` -# * Verifying each cert in the peer's chain is contained in the file -# loaded above. -# -class Puppet::SSL::VerifierAdapter - attr_reader :validator, :ssl_context - - def initialize(validator) - @validator = validator - - if validator.is_a?(Puppet::SSL::Validator::NoValidator) - ssl = Puppet::SSL::SSLProvider.new - @ssl_context = ssl.create_insecure_context - else - # nil means use the default SSLContext - @ssl_context = nil - end - end - - # Return true if `self` is reusable with `verifier` meaning they - # are both using the same class of `Puppet::SSL::Validator`. In this - # case we only care the Validator class is the same. We can't require - # the same instances, because a new instance is created each time - # HttpPool.http_instance is called. - # - # @param verifier [Puppet::SSL::Verifier] the verifier to compare against - # @return [Boolean] return true if a cached connection can be used, false otherwise - def reusable?(verifier) - verifier.instance_of?(self.class) && - verifier.validator.instance_of?(@validator.class) - end - - # Configure the `http` connection based on the current `ssl_context`. - # - # @param http [Net::HTTP] connection - # @api private - def setup_connection(http) - @validator.setup_connection(http) - end - - # Handle an SSL connection error. - # - # @param http [Net::HTTP] connection - # @param error [OpenSSL::SSL::SSLError] connection error - # @return (see Puppet::SSL::Verifier#handle_connection_error) - # @raise [Puppet::SSL::CertVerifyError] SSL connection failed due to a - # verification error with the server's certificate or chain - # @raise [Puppet::Error] server hostname does not match certificate - # @raise [OpenSSL::SSL::SSLError] low-level SSL connection failure - def handle_connection_error(http, error) - raise @validator.last_error if @validator.respond_to?(:last_error) && @validator.last_error - - Puppet::Util::SSL.handle_connection_error(error, @validator, http.address) - end -end diff --git a/spec/unit/network/http/connection_spec.rb b/spec/unit/network/http/connection_spec.rb index 4472391d6ae..2eb6fb9a5cf 100644 --- a/spec/unit/network/http/connection_spec.rb +++ b/spec/unit/network/http/connection_spec.rb @@ -9,21 +9,23 @@ let(:url) { "https://#{host}:#{port}#{path}" } let(:params) { { 'key' => 'a value' } } let(:encoded_url_with_params) { "#{url}?%7B%22key%22:%22a%20value%22%7D" } + let(:ssl_context) { Puppet::SSL::SSLProvider.new.create_system_context(cacerts: []) } + let(:verifier) { Puppet::SSL::Verifier.new(host, ssl_context) } shared_examples_for "an HTTP connection" do |klass| - subject { klass.new(host, port, :verify => Puppet::SSL::Validator.no_validator) } + subject { klass.new(host, port, :verifier => verifier) } context "when providing HTTP connections" do context "when initializing http instances" do it "should return an http instance created with the passed host and port" do - conn = klass.new(host, port, :verify => Puppet::SSL::Validator.no_validator) + conn = klass.new(host, port, :verifier => verifier) expect(conn.address).to eq(host) expect(conn.port).to eq(port) end it "should enable ssl on the http instance by default" do - conn = klass.new(host, port, :verify => Puppet::SSL::Validator.no_validator) + conn = klass.new(host, port, :verifier => verifier) expect(conn).to be_use_ssl end @@ -35,21 +37,21 @@ end it "can enable ssl using an option" do - conn = klass.new(host, port, :use_ssl => true, :verify => Puppet::SSL::Validator.no_validator) + conn = klass.new(host, port, :use_ssl => true, :verifier => verifier) expect(conn).to be_use_ssl end it "ignores the ':verify' option when ssl is disabled" do - conn = klass.new(host, port, :use_ssl => false, :verify => Puppet::SSL::Validator.no_validator) + conn = klass.new(host, port, :use_ssl => false, :verifier => verifier) expect(conn.verifier).to be_nil end it "wraps the validator in an adapter" do - conn = klass.new(host, port, :verify => Puppet::SSL::Validator.no_validator) + conn = klass.new(host, port, :verifier => verifier) - expect(conn.verifier).to be_a_kind_of(Puppet::SSL::VerifierAdapter) + expect(conn.verifier).to be_a(Puppet::SSL::Verifier) end it "should raise Puppet::Error when invalid options are specified" do @@ -65,9 +67,9 @@ it "raises if the wrong verifier class is specified" do expect { - klass.new(host, port, :verifier => Puppet::SSL::Validator.default_validator) + klass.new(host, port, :verifier => Object.new) }.to raise_error(ArgumentError, - "Expected an instance of Puppet::SSL::Verifier but was passed a Puppet::SSL::Validator::DefaultValidator") + "Expected an instance of Puppet::SSL::Verifier but was passed a Object") end end end @@ -420,7 +422,7 @@ def create_connection(options = {}) options[:use_ssl] = false - options[:verify] = Puppet::SSL::Validator.no_validator + options[:verifier] = verifier subject.new(host, port, options) end diff --git a/spec/unit/ssl/verifier_spec.rb b/spec/unit/ssl/verifier_spec.rb index 7857c1cde0d..f36c9e5b912 100644 --- a/spec/unit/ssl/verifier_spec.rb +++ b/spec/unit/ssl/verifier_spec.rb @@ -6,7 +6,6 @@ let(:host) { 'example.com' } let(:http) { Net::HTTP.new(host) } let(:verifier) { described_class.new(host, ssl_context) } - let(:adapter) { Puppet::SSL::VerifierAdapter.new(Puppet::SSL::Validator::DefaultValidator.new) } context '#reusable?' do it 'Verifiers with the same ssl_context are reusable' do @@ -16,26 +15,6 @@ it 'Verifiers with different ssl_contexts are not reusable' do expect(verifier).to_not be_reusable(described_class.new(host, Puppet::SSL::SSLContext.new)) end - - it 'Verifier is not reusable with VerifierAdapter' do - expect(verifier).to_not be_reusable(adapter) - end - - it 'VerifierAdapter is not reusable with Verifier' do - expect(adapter).to_not be_reusable(verifier) - end - - it 'VerifierAdapters with the same class of Validator are reusable' do - expect( - adapter - ).to be_reusable(Puppet::SSL::VerifierAdapter.new(Puppet::SSL::Validator::DefaultValidator.new)) - end - - it 'VerifierAdapters with different classes of Validators are not reusable' do - expect( - adapter - ).to_not be_reusable(Puppet::SSL::VerifierAdapter.new(Puppet::SSL::Validator::NoValidator.new)) - end end context '#setup_connection' do From 13c052cf30c5a2718e085b0545958709b44e2328 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Thu, 23 Jul 2020 20:11:17 -0700 Subject: [PATCH 035/731] (PUP-10252) Remove Puppet::SSL::Validator* The DefaultValidator's setup_connection method could cause nested CSR/cert REST requests while in the middle of configuring a Net::HTTP connection, leading to recursive insanity. It also conflated trusted CA and client certs and could downgrade to VERIFY_NONE. Puppet now uses Puppet::SSL::Verifier to handle HTTPS verification, so delete all of the validators. --- lib/puppet/network/http/connection.rb | 12 +- lib/puppet/ssl.rb | 3 - lib/puppet/ssl/base.rb | 1 - lib/puppet/ssl/validator.rb | 61 ---- lib/puppet/ssl/validator/default_validator.rb | 209 ------------- lib/puppet/ssl/validator/no_validator.rb | 22 -- spec/unit/ssl/validator_spec.rb | 278 ------------------ 7 files changed, 4 insertions(+), 582 deletions(-) delete mode 100644 lib/puppet/ssl/validator.rb delete mode 100644 lib/puppet/ssl/validator/default_validator.rb delete mode 100644 lib/puppet/ssl/validator/no_validator.rb delete mode 100644 spec/unit/ssl/validator_spec.rb diff --git a/lib/puppet/network/http/connection.rb b/lib/puppet/network/http/connection.rb index 594b37f6982..2e94b9aca92 100644 --- a/lib/puppet/network/http/connection.rb +++ b/lib/puppet/network/http/connection.rb @@ -210,14 +210,10 @@ def request_post(*args, &block) private - # The old Connection class ignores the ssl_context on the Puppet stack, - # and always loads certs/keys based on what is currently in the filesystem. - # If the files are missing, it would attempt to bootstrap the certs/keys - # while in the process of making a network request, due to the call to - # Puppet.lookup(:ssl_host) in Puppet::SSL::Validator::DefaultValidator#setup_connection. - # This class doesn't preserve the boostrap behavior because that is handled - # outside of this class, and can only be triggered by running `puppet ssl` or - # `puppet agent`. + # Resolve the ssl_context based on the verifier associated with this + # connection or load the available set of certs and key on disk. + # Don't try to bootstrap the agent, as we only want that to be triggered + # when running `puppet ssl` or `puppet agent`. def resolve_ssl_context # don't need an ssl context for http connections return nil unless @site.use_ssl? diff --git a/lib/puppet/ssl.rb b/lib/puppet/ssl.rb index 65cde5a7d40..cd1f7e9adad 100644 --- a/lib/puppet/ssl.rb +++ b/lib/puppet/ssl.rb @@ -7,9 +7,6 @@ module Puppet::SSL # :nodoc: CA_NAME = "ca".freeze require 'puppet/ssl/host' require 'puppet/ssl/oids' - require 'puppet/ssl/validator' - require 'puppet/ssl/validator/no_validator' - require 'puppet/ssl/validator/default_validator' require 'puppet/ssl/error' require 'puppet/ssl/ssl_context' require 'puppet/ssl/verifier' diff --git a/lib/puppet/ssl/base.rb b/lib/puppet/ssl/base.rb index 707b7b906b0..0507eeca189 100644 --- a/lib/puppet/ssl/base.rb +++ b/lib/puppet/ssl/base.rb @@ -90,7 +90,6 @@ def read(path) # Puppet::Network::HTTP::WEBrickREST (.from_instance) # Puppet::SSL::Host (.indirection.find) # Puppet::SSL::Inventory (.indirection.search, implements its own add / rebuild / serials with encoding UTF8) - # Puppet::SSL::Validator::DefaultValidator (.from_instance) / Puppet::SSL::Validator::NoValidator does nothing @content = wrapped_class.new(Puppet::FileSystem.read(path, :encoding => Encoding::ASCII)) end diff --git a/lib/puppet/ssl/validator.rb b/lib/puppet/ssl/validator.rb deleted file mode 100644 index ae13734f233..00000000000 --- a/lib/puppet/ssl/validator.rb +++ /dev/null @@ -1,61 +0,0 @@ -require 'puppet/ssl/openssl_loader' - -# API for certificate verification -# -# @deprecated -# @api public -class Puppet::SSL::Validator - - # Factory method for creating an instance of a null/no validator. - # This method does not have to be implemented by concrete implementations of this API. - # - # @return [Puppet::SSL::Validator] produces a validator that performs no validation - # - # @api public - # - def self.no_validator() - @@no_validator_cache ||= Puppet::SSL::Validator::NoValidator.new() - end - - # Factory method for creating an instance of the default Puppet validator. - # This method does not have to be implemented by concrete implementations of this API. - # - # @return [Puppet::SSL::Validator] produces a validator that performs no validation - # - # @api public - # - def self.default_validator() - Puppet::SSL::Validator::DefaultValidator.new() - end - - # Array of peer certificates - # @return [Array] peer certificates - # - # @api public - # - def peer_certs - raise NotImplementedError, "Concrete class should have implemented this method" - end - - # Contains the result of validation - # @return [Array, nil] nil, empty Array, or Array with messages - # - # @api public - # - def verify_errors - raise NotImplementedError, "Concrete class should have implemented this method" - end - - # Registers the connection to validate. - # - # @param [Net::HTTP] connection The connection to validate - # - # @return [void] - # - # @api public - # - def setup_connection(connection) - raise NotImplementedError, "Concrete class should have implemented this method" - end -end - diff --git a/lib/puppet/ssl/validator/default_validator.rb b/lib/puppet/ssl/validator/default_validator.rb deleted file mode 100644 index f722bc77ad4..00000000000 --- a/lib/puppet/ssl/validator/default_validator.rb +++ /dev/null @@ -1,209 +0,0 @@ -require 'puppet/ssl/openssl_loader' -require 'puppet/ssl' - -# Perform peer certificate verification against the known CA. -# If there is no CA information known, then no verification is performed -# -# @deprecated -# @api private -# -class Puppet::SSL::Validator::DefaultValidator #< class Puppet::SSL::Validator - attr_reader :peer_certs - attr_reader :verify_errors - attr_reader :last_error - - FIVE_MINUTES_AS_SECONDS = 5 * 60 - - # Creates a new DefaultValidator, optionally with an SSL Configuration and SSL Host. - # - # @param ca_path [String] Filepath for the cacert - # - # @api private - # - def initialize( - ca_path = Puppet[:ssl_client_ca_auth] || Puppet[:localcacert]) - - reset! - @ca_path = ca_path - end - - - # Resets this validator to its initial validation state. The ssl configuration is not changed. - # - # @api private - # - def reset! - @peer_certs = [] - @verify_errors = [] - @hostname = nil - @last_error = nil - end - - # Performs verification of the SSL connection and collection of the - # certificates for use in constructing the error message if the verification - # failed. This callback will be executed once for each certificate in a - # chain being verified. - # - # From the [OpenSSL - # documentation](https://www.openssl.org/docs/ssl/SSL_CTX_set_verify.html): - # The `verify_callback` function is used to control the behaviour when the - # SSL_VERIFY_PEER flag is set. It must be supplied by the application and - # receives two arguments: preverify_ok indicates, whether the verification of - # the certificate in question was passed (preverify_ok=1) or not - # (preverify_ok=0). x509_store_ctx is a pointer to the complete context used for - # the certificate chain verification. - # - # See {Puppet::Network::HTTP::Connection} for more information and where this - # class is intended to be used. - # - # @param [Boolean] preverify_ok indicates whether the verification of the - # certificate in question was passed (preverify_ok=true) - # @param [OpenSSL::X509::StoreContext] store_context holds the X509 store context - # for the chain being verified. - # - # @return [Boolean] false if the peer is invalid, true otherwise. - # - # @api private - # - def call(preverify_ok, store_context) - current_cert = store_context.current_cert - @peer_certs << current_cert - - # We must make a copy since the scope of the store_context will be lost - # across invocations of this method. - if preverify_ok - # If we've copied all of the certs in the chain out of the SSL library - if @peer_certs.length == store_context.chain.length - # (#20027) The peer cert must be issued by a specific authority - preverify_ok = valid_peer? - end - else - error = store_context.error || 0 - error_string = store_context.error_string || "OpenSSL error #{error}" - - case error - when OpenSSL::X509::V_OK - if @hostname - # chain is from leaf to root, opposite of the order that `call` is invoked - chain_cert = store_context.chain.first - - # ruby 2.4 doesn't compare certs based on value, so force to DER byte array - if current_cert && chain_cert && current_cert.to_der == chain_cert.to_der && !OpenSSL::SSL.verify_certificate_identity(current_cert, @hostname) - @last_error = Puppet::SSL::CertMismatchError.new(current_cert, @hostname) - return false - else - @verify_errors << "#{error_string} for #{current_cert.subject.to_utf8}" - end - else - @verify_errors << "#{error_string} for #{current_cert.subject.to_utf8}" - end - - when OpenSSL::X509::V_ERR_CRL_NOT_YET_VALID - # current_crl can be nil - # https://github.com/ruby/ruby/blob/ruby_1_9_3/ext/openssl/ossl_x509store.c#L501-L510 - crl = store_context.current_crl - if crl - if crl.last_update && crl.last_update < Time.now + FIVE_MINUTES_AS_SECONDS - Puppet.debug { "Ignoring CRL not yet valid, current time #{Time.now.utc}, CRL last updated #{crl.last_update.utc}" } - preverify_ok = true - else - @verify_errors << "#{error_string} for #{crl.issuer.to_utf8}" - end - else - @verify_errors << error_string - end - else - @verify_errors << "#{error_string} for #{current_cert.subject.to_utf8}" - end - end - preverify_ok - rescue => ex - @verify_errors << ex.message - false - end - - # Registers the instance's call method with the connection. - # - # @param [Net::HTTP] connection The connection to validate - # - # @param [Puppet::SSL::Host] host The host object containing SSL data - # @return [void] - # - # @api private - # - def setup_connection(connection, ssl_host = Puppet.lookup(:ssl_host)) - @hostname = connection.address - - if ssl_certificates_are_present? - connection.cert_store = ssl_host.ssl_store - connection.ca_file = @ca_path - connection.cert = ssl_host.certificate.content - connection.key = ssl_host.key.content - connection.verify_mode = OpenSSL::SSL::VERIFY_PEER - connection.verify_callback = self - else - connection.verify_mode = OpenSSL::SSL::VERIFY_NONE - end - end - - ## - # Decode a string of concatenated certificates - # - # @return [Array] - def decode_cert_bundle(bundle_str) - re = /-----BEGIN CERTIFICATE-----.*?-----END CERTIFICATE-----/m - pem_ary = bundle_str.scan(re) - pem_ary.map do |pem_str| - OpenSSL::X509::Certificate.new(pem_str) - end - end - - # read_file makes testing easier. - def read_file(path) - # https://www.ietf.org/rfc/rfc2459.txt defines the x509 V3 certificate format - # CA bundles are concatenated X509 certificates, but may also include - # comments, which could have UTF-8 characters - Puppet::FileSystem.read(path, :encoding => Encoding::UTF_8) - end - - # Validates the peer certificates against the authorized certificates. - # - # @api private - # - def valid_peer? - descending_cert_chain = @peer_certs.reverse - authz_ca_certs = decode_cert_bundle(read_file(@ca_path)) - - if not has_authz_peer_cert(descending_cert_chain, authz_ca_certs) - msg = "The server presented a SSL certificate chain which does not include a " << - "CA listed in the ssl_client_ca_auth file. " - msg << "Authorized Issuers: #{authz_ca_certs.collect {|c| c.subject.to_utf8}.join(', ')} " << - "Peer Chain: #{descending_cert_chain.collect {|c| c.subject.to_utf8}.join(' => ')}" - @verify_errors << msg - false - else - true - end - end - - # Checks if the set of peer_certs contains at least one certificate issued - # by a certificate listed in authz_certs - # - # @return [Boolean] - # - # @api private - # - def has_authz_peer_cert(peer_certs, authz_certs) - peer_certs.any? do |peer_cert| - authz_certs.any? do |authz_cert| - peer_cert.verify(authz_cert.public_key) - end - end - end - - # @api private - # - def ssl_certificates_are_present? - Puppet::FileSystem.exist?(Puppet[:hostcert]) && Puppet::FileSystem.exist?(@ca_path) - end -end diff --git a/lib/puppet/ssl/validator/no_validator.rb b/lib/puppet/ssl/validator/no_validator.rb deleted file mode 100644 index 959301f378c..00000000000 --- a/lib/puppet/ssl/validator/no_validator.rb +++ /dev/null @@ -1,22 +0,0 @@ -require 'puppet/ssl/openssl_loader' -require 'puppet/ssl' - -# Performs no SSL verification -# -# @deprecated -# @api private -# -class Puppet::SSL::Validator::NoValidator < Puppet::SSL::Validator - - def setup_connection(connection) - connection.verify_mode = OpenSSL::SSL::VERIFY_NONE - end - - def peer_certs - [] - end - - def verify_errors - [] - end -end diff --git a/spec/unit/ssl/validator_spec.rb b/spec/unit/ssl/validator_spec.rb deleted file mode 100644 index 0cd437516ba..00000000000 --- a/spec/unit/ssl/validator_spec.rb +++ /dev/null @@ -1,278 +0,0 @@ -require 'spec_helper' -require 'puppet/ssl' -require 'puppet_spec/ssl' - -describe Puppet::SSL::Validator::DefaultValidator, unless: Puppet::Util::Platform.jruby? do - include PuppetSpec::Files - let(:ssl_context) do - double('OpenSSL::X509::StoreContext') - end - - before(:all) do - @pki = PuppetSpec::SSL.create_chained_pki - end - - let(:ca_path) do - Puppet[:ssl_client_ca_auth] || Puppet[:localcacert] - end - - let(:ssl_host) do - double('ssl_host', - :ssl_store => nil, - :certificate => double('cert', :content => nil), - :key => double('key', :content => nil)) - end - - subject do - described_class.new(ca_path) - end - - before :each do - allow(subject).to receive(:read_file).and_return(@pki[:root_cert].to_s) - end - - describe '#call' do - before :each do - allow(ssl_context).to receive(:current_cert).and_return(*cert_chain_in_callback_order) - allow(ssl_context).to receive(:chain).and_return(cert_chain) - end - - context 'When pre-verification is not OK' do - context 'and the ssl_context is in an error state' do - let(:root_subject) { @pki[:root_cert].subject.to_utf8 } - let(:code) { OpenSSL::X509::V_ERR_INVALID_CA } - - it 'rejects the connection' do - allow(ssl_context).to receive(:error_string).and_return("Something went wrong") - allow(ssl_context).to receive(:error).and_return(code) - - expect(subject.call(false, ssl_context)).to eq(false) - end - - it 'makes the error available via #verify_errors' do - allow(ssl_context).to receive(:error_string).and_return("Something went wrong") - allow(ssl_context).to receive(:error).and_return(code) - - subject.call(false, ssl_context) - expect(subject.verify_errors).to eq(["Something went wrong for #{root_subject}"]) - end - - it 'uses a generic message if error_string is nil' do - allow(ssl_context).to receive(:error_string).and_return(nil) - allow(ssl_context).to receive(:error).and_return(code) - - subject.call(false, ssl_context) - expect(subject.verify_errors).to eq(["OpenSSL error #{code} for #{root_subject}"]) - end - - it 'uses 0 for nil error codes' do - allow(ssl_context).to receive(:error_string).and_return("Something went wrong") - allow(ssl_context).to receive(:error).and_return(nil) - - subject.call(false, ssl_context) - expect(subject.verify_errors).to eq(["Something went wrong for #{root_subject}"]) - end - - context "when CRL is not yet valid" do - before :each do - allow(ssl_context).to receive(:error_string).and_return("CRL is not yet valid") - allow(ssl_context).to receive(:error).and_return(OpenSSL::X509::V_ERR_CRL_NOT_YET_VALID) - end - - it 'rejects nil CRL' do - allow(ssl_context).to receive(:current_crl).and_return(nil) - - expect(subject.call(false, ssl_context)).to eq(false) - expect(subject.verify_errors).to eq(["CRL is not yet valid"]) - end - - it 'includes the CRL issuer in the verify error message' do - crl = OpenSSL::X509::CRL.new - crl.issuer = OpenSSL::X509::Name.new([['CN','Puppet CA: puppetmaster.example.com']]) - crl.last_update = Time.now + 24 * 60 * 60 - allow(ssl_context).to receive(:current_crl).and_return(crl) - - subject.call(false, ssl_context) - expect(subject.verify_errors).to eq(["CRL is not yet valid for CN=Puppet CA: puppetmaster.example.com"]) - end - - it 'rejects CRLs whose last_update time is more than 5 minutes in the future' do - crl = OpenSSL::X509::CRL.new - crl.issuer = OpenSSL::X509::Name.new([['CN','Puppet CA: puppetmaster.example.com']]) - crl.last_update = Time.now + 24 * 60 * 60 - allow(ssl_context).to receive(:current_crl).and_return(crl) - - expect(subject.call(false, ssl_context)).to eq(false) - end - - it 'accepts CRLs whose last_update time is 10 seconds in the future' do - crl = OpenSSL::X509::CRL.new - crl.issuer = OpenSSL::X509::Name.new([['CN','Puppet CA: puppetmaster.example.com']]) - crl.last_update = Time.now + 10 - allow(ssl_context).to receive(:current_crl).and_return(crl) - - expect(subject.call(false, ssl_context)).to eq(true) - end - end - end - end - - context 'When pre-verification is OK' do - context 'and the ssl_context is in an error state' do - before :each do - allow(ssl_context).to receive(:error_string).and_return("Something went wrong") - end - - it 'does not make the error available via #verify_errors' do - subject.call(true, ssl_context) - expect(subject.verify_errors).to eq([]) - end - end - - context 'and the chain is valid' do - it 'is true for each CA certificate in the chain' do - (cert_chain.length - 1).times do - expect(subject.call(true, ssl_context)).to be_truthy - end - end - - it 'is true for the SSL certificate ending the chain' do - (cert_chain.length - 1).times do - subject.call(true, ssl_context) - end - expect(subject.call(true, ssl_context)).to be_truthy - end - end - - context 'and the chain is invalid' do - before :each do - allow(subject).to receive(:read_file).and_return(@pki[:unrevoked_leaf_node_cert]) - end - - it 'is true for each CA certificate in the chain' do - (cert_chain.length - 1).times do - expect(subject.call(true, ssl_context)).to be_truthy - end - end - - it 'is false for the SSL certificate ending the chain' do - (cert_chain.length - 1).times do - subject.call(true, ssl_context) - end - expect(subject.call(true, ssl_context)).to be_falsey - end - end - - context 'an error is raised inside of #call' do - before :each do - expect(ssl_context).to receive(:current_cert).and_raise(StandardError, "BOOM!") - end - - it 'is false' do - expect(subject.call(true, ssl_context)).to be_falsey - end - - it 'makes the error available through #verify_errors' do - subject.call(true, ssl_context) - expect(subject.verify_errors).to eq(["BOOM!"]) - end - end - end - end - - describe '#setup_connection' do - it 'updates the connection for verification' do - allow(subject).to receive(:ssl_certificates_are_present?).and_return(true) - connection = double('Net::HTTP') - - allow(connection).to receive(:address).and_return('puppet.com') - expect(connection).to receive(:cert_store=).with(ssl_host.ssl_store) - expect(connection).to receive(:ca_file=).with(ca_path) - expect(connection).to receive(:cert=).with(ssl_host.certificate.content) - expect(connection).to receive(:key=).with(ssl_host.key.content) - expect(connection).to receive(:verify_callback=).with(subject) - expect(connection).to receive(:verify_mode=).with(OpenSSL::SSL::VERIFY_PEER) - - subject.setup_connection(connection, ssl_host) - end - - context 'when no file path is found' do - it 'does not perform verification if certificate files are missing' do - allow(subject).to receive(:ssl_certificates_are_present?).and_return(false) - connection = double('Net::HTTP') - - allow(connection).to receive(:address).and_return('puppet.com') - expect(connection).to receive(:verify_mode=).with(OpenSSL::SSL::VERIFY_NONE) - - subject.setup_connection(connection, ssl_host) - end - end - end - - describe '#valid_peer?' do - before :each do - subject.instance_variable_set(:@peer_certs, cert_chain_in_callback_order) - end - - context 'when the peer presents a valid chain' do - before :each do - allow(subject).to receive(:has_authz_peer_cert).and_return(true) - end - - it 'is true' do - expect(subject.valid_peer?).to be_truthy - end - end - - context 'when the peer presents an invalid chain' do - before :each do - allow(subject).to receive(:has_authz_peer_cert).and_return(false) - end - - it 'is false' do - expect(subject.valid_peer?).to be_falsey - end - - it 'makes a helpful error message available via #verify_errors' do - subject.valid_peer? - expect(subject.verify_errors).to eq([< CN=unrevoked-int-caۿᚠ𠜎 => CN=root-ca-𠜎 -END - end - end - end - - describe '#has_authz_peer_cert' do - context 'when the Root CA is listed as authorized' do - it 'returns true when the SSL cert is issued by the Master CA' do - expect(subject.has_authz_peer_cert(cert_chain, [@pki[:root_cert]])).to be_truthy - end - - it 'returns true when the SSL cert is issued by the alternate CA' do - expect(subject.has_authz_peer_cert(cert_chain_alternate, [@pki[:root_cert]])).to be_truthy - end - end - - context 'when one intermediate CA is listed as authorized' do - it 'returns true when the SSL cert is issued by the same intermediate CA' do - expect(subject.has_authz_peer_cert(cert_chain, [@pki[:int_cert]])).to be_truthy - end - - it 'returns false when the SSL cert is issued by a different intermediate CA' do - expect(subject.has_authz_peer_cert(cert_chain_alternate, [@pki[:int_cert]])).to be_falsey - end - end - end - - def cert_chain - [@pki[:int_node_cert], @pki[:int_cert], @pki[:root_cert]] - end - - def cert_chain_alternate - [@pki[:unrevoked_leaf_node_cert], @pki[:leaf_cert], @pki[:revoked_int_cert], @pki[:root_cert]] - end - - def cert_chain_in_callback_order - cert_chain.reverse - end -end From 6ff6bd06a12d251c506575f841822628d9c39b54 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Thu, 23 Jul 2020 20:46:47 -0700 Subject: [PATCH 036/731] (PUP-10252) Remove Puppet::SSL::Host The Host logic for bootstrapping the key/csr/cert was buggy and extremely complicated due to the way the DefaultValidator#setup_connection method could cause network connections while in the middle of configuring a network connection. The Host logic for key/csr/cert parsing and persistence is superseded by Puppet::X509::CertProvider, and the logic for building an OpenSSL::X509::Store is superseded by Puppet::SSL::SSLProvider. This commit deletes the Puppet::SSL::Host class and removes the `:ssl_host` object from the context system. --- docs/indirector.md | 1 - lib/puppet.rb | 1 - lib/puppet/indirector/ssl_file.rb | 5 - lib/puppet/ssl.rb | 7 +- lib/puppet/ssl/base.rb | 1 - lib/puppet/ssl/host.rb | 505 ---------------- lib/puppet/test/test_helper.rb | 1 - spec/integration/network/http_pool_spec.rb | 10 - spec/unit/ssl/host_spec.rb | 650 --------------------- 9 files changed, 6 insertions(+), 1175 deletions(-) delete mode 100644 lib/puppet/ssl/host.rb delete mode 100644 spec/unit/ssl/host_spec.rb diff --git a/docs/indirector.md b/docs/indirector.md index efed0bea395..fffb4f55027 100644 --- a/docs/indirector.md +++ b/docs/indirector.md @@ -203,7 +203,6 @@ The following classes support indirections, but are not documented because they * `Puppet::SSL::Certificate` * `Puppet::SSL::CertificateRevocationList` * `Puppet::SSL::CertificateRequest` -* `Puppet::SSL::Host` * `Puppet::SSL::Key` ## Limitations diff --git a/lib/puppet.rb b/lib/puppet.rb index 652c1d5b360..e861b9ca6ea 100644 --- a/lib/puppet.rb +++ b/lib/puppet.rb @@ -259,7 +259,6 @@ def self.base_context(settings) raise e end }, - :ssl_host => proc { Puppet::SSL::Host.localhost(true) }, :http_session => proc { Puppet.runtime[:http].create_session }, :plugins => proc { Puppet::Plugins::Configuration.load_plugins }, :rich_data => false diff --git a/lib/puppet/indirector/ssl_file.rb b/lib/puppet/indirector/ssl_file.rb index dd7ccb44a53..acfc4865b06 100644 --- a/lib/puppet/indirector/ssl_file.rb +++ b/lib/puppet/indirector/ssl_file.rb @@ -155,8 +155,3 @@ def write(name, path) end end end - -# LAK:NOTE This has to be at the end, because classes like SSL::Key use this -# class, and this require statement loads those, which results in a load loop -# and lots of failures. -require 'puppet/ssl/host' diff --git a/lib/puppet/ssl.rb b/lib/puppet/ssl.rb index cd1f7e9adad..5762df26432 100644 --- a/lib/puppet/ssl.rb +++ b/lib/puppet/ssl.rb @@ -5,11 +5,16 @@ # @api private module Puppet::SSL # :nodoc: CA_NAME = "ca".freeze - require 'puppet/ssl/host' require 'puppet/ssl/oids' require 'puppet/ssl/error' require 'puppet/ssl/ssl_context' require 'puppet/ssl/verifier' require 'puppet/ssl/ssl_provider' require 'puppet/ssl/state_machine' + require 'puppet/ssl/key' + require 'puppet/ssl/certificate' + require 'puppet/ssl/certificate_request' + require 'puppet/ssl/certificate_request_attributes' + require 'puppet/rest/errors' + require 'puppet/rest/routes' end diff --git a/lib/puppet/ssl/base.rb b/lib/puppet/ssl/base.rb index 0507eeca189..ce98421cb47 100644 --- a/lib/puppet/ssl/base.rb +++ b/lib/puppet/ssl/base.rb @@ -88,7 +88,6 @@ def read(path) # Puppet::Network::HTTP::WEBrick (.indirection.find) # Puppet::Network::HTTP::RackREST (.from_instance) # Puppet::Network::HTTP::WEBrickREST (.from_instance) - # Puppet::SSL::Host (.indirection.find) # Puppet::SSL::Inventory (.indirection.search, implements its own add / rebuild / serials with encoding UTF8) @content = wrapped_class.new(Puppet::FileSystem.read(path, :encoding => Encoding::ASCII)) end diff --git a/lib/puppet/ssl/host.rb b/lib/puppet/ssl/host.rb deleted file mode 100644 index c023451549f..00000000000 --- a/lib/puppet/ssl/host.rb +++ /dev/null @@ -1,505 +0,0 @@ -require 'puppet/ssl' -require 'puppet/ssl/key' -require 'puppet/ssl/certificate' -require 'puppet/ssl/certificate_request' -require 'puppet/ssl/certificate_request_attributes' -require 'puppet/ssl/state_machine' -require 'puppet/rest/errors' -require 'puppet/rest/routes' - -# The class that manages all aspects of our SSL certificates -- -# private keys, public keys, requests, etc. -# -# @deprecated Use {Puppet::SSL::SSLProvider} instead. -class Puppet::SSL::Host - # Yay, ruby's strange constant lookups. - Key = Puppet::SSL::Key - CA_NAME = Puppet::SSL::CA_NAME - Certificate = Puppet::SSL::Certificate - CertificateRequest = Puppet::SSL::CertificateRequest - - attr_reader :name, :device, :crl_path - - attr_writer :key, :certificate, :certificate_request, :crl_usage - - def self.localhost(suppress_warning = false) - return @localhost if @localhost - @localhost = new(nil, false, suppress_warning) - @localhost.generate unless @localhost.certificate - @localhost.key - @localhost - end - - def self.reset - @localhost = nil - end - - # Configure how our various classes interact with their various terminuses. - def self.configure_indirection(terminus, cache = nil) - Certificate.indirection.terminus_class = terminus - CertificateRequest.indirection.terminus_class = terminus - - if cache - # This is weird; we don't actually cache our keys, we - # use what would otherwise be the cache as our normal - # terminus. - Key.indirection.terminus_class = cache - else - Key.indirection.terminus_class = terminus - end - - if cache - Certificate.indirection.cache_class = cache - CertificateRequest.indirection.cache_class = cache - else - # Make sure we have no cache configured. puppet master - # switches the configurations around a bit, so it's important - # that we specify the configs for absolutely everything, every - # time. - Certificate.indirection.cache_class = nil - CertificateRequest.indirection.cache_class = nil - end - end - - def self.from_data_hash(data) - instance = new(data["name"]) - if data["desired_state"] - instance.desired_state = data["desired_state"] - end - instance - end - - def key - @key ||= Key.indirection.find(name) - end - - # This is the private key; we can create it from scratch - # with no inputs. - def generate_key - @key = Key.new(name) - @key.generate - begin - Key.indirection.save(@key) - rescue - @key = nil - raise - end - true - end - - # Our certificate request requires the key but that's all. - def generate_certificate_request(options = {}) - generate_key unless key - - # If this CSR is for the current machine... - if name == Puppet[:certname].downcase - # ...add our configured dns_alt_names - if Puppet[:dns_alt_names] and Puppet[:dns_alt_names] != '' - options[:dns_alt_names] ||= Puppet[:dns_alt_names] - end - end - - csr_attributes = Puppet::SSL::CertificateRequestAttributes.new(Puppet[:csr_attributes]) - if csr_attributes.load - options[:csr_attributes] = csr_attributes.custom_attributes - options[:extension_requests] = csr_attributes.extension_requests - end - - @certificate_request = CertificateRequest.new(name) - @certificate_request.generate(key.content, options) - begin - submit_certificate_request(@certificate_request) - save_certificate_request(@certificate_request) - rescue - @certificate_request = nil - raise - end - - true - end - - def certificate - unless @certificate - generate_key unless key - - # get CA and optional CRL - sm = Puppet::SSL::StateMachine.new(onetime: true) - sm.ensure_ca_certificates - - cert = get_host_certificate - return nil unless cert - - validate_certificate_with_key(cert) - @certificate = cert - end - @certificate - end - - # The puppet parameters for commands output by the validate_ methods depend - # upon whether this is an agent or a device. - - def clean_params - @device ? "--target #{Puppet[:certname]}" : '' - end - - def puppet_params - @device ? "device -v --target #{Puppet[:certname]}" : 'agent -t' - end - - # Validate that our private key matches the specified certificate. - # - # @param [Puppet::SSL::Certificate] cert the certificate to check - # @raises [Puppet::Error] if the private key does not match - def validate_certificate_with_key(cert) - raise Puppet::Error, _("No certificate to validate.") unless cert - raise Puppet::Error, _("No private key with which to validate certificate with fingerprint: %{fingerprint}") % { fingerprint: cert.fingerprint } unless key - unless cert.content.check_private_key(key.content) - raise Puppet::Error, _(< detail - Puppet.log_exception(detail, _("Could not request certificate: %{message}") % { message: detail.message }) - if time < 1 - puts _("Exiting; failed to retrieve certificate and waitforcert is disabled") - exit(1) - else - sleep(time) - end - retry - end - - if time < 1 - puts _("Exiting; no certificate found and waitforcert is disabled") - exit(1) - end - - loop do - sleep time - begin - break if certificate - Puppet.notice _("Did not receive certificate") - rescue StandardError => detail - Puppet.log_exception(detail, _("Could not request certificate: %{message}") % { message: detail.message }) - end - end - end - - # Saves the given certificate to disc, at a location determined by this - # host's configuration. - # @param [Puppet::SSL::Certificate] cert the cert to save - def save_host_certificate(cert) - file_path = certificate_location(name) - Puppet::Util.replace_file(file_path, 0644) do |f| - f.write(cert.to_s) - end - end - - private - - # Load a previously generated CSR from disk - # @return [Puppet::SSL::CertificateRequest, nil] - def load_certificate_request_from_file - request_path = certificate_request_location(name) - if Puppet::FileSystem.exist?(request_path) - Puppet::SSL::CertificateRequest.from_s(Puppet::FileSystem.read(request_path)) - end - end - - # Download the CSR for this host from the CA. Returns nil if the CA - # has no saved CSR for this host. - # @raises [Puppet::Error] if the response from the server is not a valid - # CSR or an error occurs while fetching. - # @return [Puppet::SSL::CertificateRequest, nil] - def download_csr_from_ca - begin - body = Puppet::Rest::Routes.get_certificate_request( - name, Puppet::SSL::SSLContext.new(store: ssl_store)) - begin - Puppet::SSL::CertificateRequest.from_s(body) - rescue OpenSSL::X509::RequestError => e - raise Puppet::Error, _("Response from the CA did not contain a valid certificate request: %{message}") % { message: e.message } - end - rescue Puppet::Rest::ResponseError => e - if e.response.code.to_i == 404 - nil - else - raise Puppet::Error, _('Could not download certificate request: %{message}') % { message: e.message } - end - end - end - # Submit the CSR to the CA via an HTTP PUT request. - # @param [Puppet::SSL::CertificateRequest] csr the request to submit - def submit_certificate_request(csr) - Puppet::Rest::Routes.put_certificate_request( - csr.render, name, Puppet::SSL::SSLContext.new(store: ssl_store)) - end - - def save_certificate_request(csr) - Puppet::Util.replace_file(certificate_request_location(name), 0644) do |file| - file.write(csr.render) - end - end - - # @param crl_string [String] CRLs read from disk or obtained from server - # @return [Array] CRLs from chain - # @raise [Puppet::Error] if the CRL chain is malformed - def process_crl_string(crl_string) - delimiters = /-----BEGIN X509 CRL-----.*?-----END X509 CRL-----/m - crl_string.scan(delimiters).map do |crl| - begin - OpenSSL::X509::CRL.new(crl) - rescue OpenSSL::X509::CRLError => e - raise Puppet::Error.new( - _("Failed attempting to load CRL from %{crl_path}! The CRL below caused the error '%{error}':\n%{crl}" % {crl_path: crl_path, error: e.message, crl: crl}), - e) - end - end - end - - # @param path [String] Path to CRL Chain - # @return [Array] CRLs from chain - # @raise [Puppet::Error] if the CRL chain is malformed - def load_crls(path) - crls_pems = Puppet::FileSystem.read(path, encoding: Encoding::UTF_8) - process_crl_string(crls_pems) - end - - # Fetches and saves the crl bundle from the CA server without validating - # its contents. Takes an optional store to use with the http_client, - # necessary for initial download of the CRL because `build_ssl_store` - # calls this `download_and_save_crl_bundle`. If there is an error during - # this downloading process, the file should not be replaced at all. This - # streams the file directly to disk to avoid loading the entire CRL in memory. - # @param [OpenSSL::X509::Store] store optional ssl_store to use with http_client - # @raise [Puppet::Error] if bad response from server - # @return nil - def download_and_save_crl_bundle(store=nil) - begin - # If no SSL store was supplied, use this host's SSL store - store ||= ssl_store - Puppet::Util.replace_file(crl_path, 0644) do |file| - result = Puppet::Rest::Routes.get_crls(CA_NAME, Puppet::SSL::SSLContext.new(store: store)) - file.write(result) - end - rescue Puppet::Rest::ResponseError => e - raise Puppet::Error, _('Could not download CRLs: %{message}') % { message: e.message } - end - end - - # Attempts to load or fetch this host's certificate. Returns nil if - # no certificate could be found. - # @return [Puppet::SSL::Certificate, nil] - def get_host_certificate - cert = check_for_certificate_on_disk(name) - if cert - return cert - else - cert = download_certificate_from_ca(name) - if cert - save_host_certificate(cert) - return cert - else - return nil - end - end - end - - # Checks for the requested certificate on disc, at a location - # determined by this host's configuration. - # @name [String] name the name of the cert to look for - # @raise [Puppet::Error] if contents of certificate file is invalid - # and could not be loaded - # @return [Puppet::SSL::Certificate, nil] - def check_for_certificate_on_disk(cert_name) - file_path = certificate_location(cert_name) - if Puppet::FileSystem.exist?(file_path) - begin - Puppet::SSL::Certificate.from_s(Puppet::FileSystem.read(file_path)) - rescue OpenSSL::X509::CertificateError - raise Puppet::Error, _("The certificate at %{file_path} is invalid. Could not load.") % { file_path: file_path } - end - end - end - public :check_for_certificate_on_disk - - # Attempts to download this host's certificate from the CA server. - # Returns nil if the CA does not yet have a signed cert for this host. - # @param [String] name then name of the cert to fetch - # @raise [Puppet::Error] if response from the CA does not contain a valid - # certificate - # @return [Puppet::SSL::Certificate, nil] - def download_certificate_from_ca(cert_name) - begin - cert = Puppet::Rest::Routes.get_certificate( - cert_name, - Puppet::SSL::SSLContext.new(store: ssl_store) - ) - begin - Puppet::SSL::Certificate.from_s(cert) - rescue OpenSSL::X509::CertificateError - raise Puppet::Error, _("Response from the CA did not contain a valid certificate for %{cert_name}.") % { cert_name: cert_name } - end - rescue Puppet::Rest::ResponseError => e - if e.response.code.to_i == 404 - Puppet.debug _("No certificate for %{cert_name} on CA") % { cert_name: cert_name } - nil - else - raise Puppet::Rest::ResponseError, _("Could not download host certificate: %{message}") % { message: e.message } - end - end - end - public :download_certificate_from_ca - - # Returns the file path for the named certificate, based on this host's - # configuration. - # @param [String] name the name of the cert to find - # @return [String] file path to the cert's location - def certificate_location(cert_name) - cert_name == CA_NAME ? Puppet[:localcacert] : File.join(Puppet[:certdir], "#{cert_name}.pem") - end - - # Returns the file path for the named CSR, based on this host's configuration. - # @param [String] name the name of the CSR to find - # @return [String] file path to the CSR's location - def certificate_request_location(cert_name) - File.join(Puppet[:requestdir], "#{cert_name}.pem") - end - - # @param [OpenSSL::X509::PURPOSE_*] constant defining the kinds of certs - # this store can verify - # @return [OpenSSL::X509::Store] - # @raise [OpenSSL::X509::StoreError] if localcacert is malformed or non-existant - # @raise [Puppet::Error] if the CRL chain is malformed - # @raise [Errno::ENOENT] if the CRL does not exist on disk but use_crl? is true - def build_ssl_store(purpose=OpenSSL::X509::PURPOSE_ANY) - store = OpenSSL::X509::Store.new - store.purpose = purpose - - # Use the file path here, because we don't want to cause - # a lookup in the middle of setting our ssl connection. - store.add_file(Puppet.settings[:localcacert]) - - if use_crl? - if !Puppet::FileSystem.exist?(crl_path) - download_and_save_crl_bundle(store) - end - - crls = load_crls(crl_path) - - flags = OpenSSL::X509::V_FLAG_CRL_CHECK - if use_crl_chain? - flags |= OpenSSL::X509::V_FLAG_CRL_CHECK_ALL - end - - store.flags = flags - crls.each {|crl| store.add_crl(crl) } - end - store - end -end diff --git a/lib/puppet/test/test_helper.rb b/lib/puppet/test/test_helper.rb index e8ff2d1b6c3..7cc89901be2 100644 --- a/lib/puppet/test/test_helper.rb +++ b/lib/puppet/test/test_helper.rb @@ -147,7 +147,6 @@ def self.before_each_test() Puppet::Application.clear! Puppet::Util::Profiler.clear - Puppet::SSL::Host.reset Puppet::Rest::Routes.clear Puppet::Node::Facts.indirection.terminus_class = :memory diff --git a/spec/integration/network/http_pool_spec.rb b/spec/integration/network/http_pool_spec.rb index 297639ca80a..15ecf6aab4a 100644 --- a/spec/integration/network/http_pool_spec.rb +++ b/spec/integration/network/http_pool_spec.rb @@ -81,16 +81,6 @@ def connection(host, port) end end - it "doesn't generate a Puppet::SSL::Host deprecation warning" do - server.start_server do |port| - http = connection(hostname, port) - res = http.get('/') - expect(res.code).to eq('200') - end - - expect(@logs).to eq([]) - end - it "detects when the server has closed the connection and reconnects" do server.start_server do |port| http = connection(hostname, port) diff --git a/spec/unit/ssl/host_spec.rb b/spec/unit/ssl/host_spec.rb deleted file mode 100644 index cd02b4efa02..00000000000 --- a/spec/unit/ssl/host_spec.rb +++ /dev/null @@ -1,650 +0,0 @@ -require 'spec_helper' -require 'puppet/test_ca' - -require 'puppet/ssl/host' -require 'matchers/json' -require 'puppet_spec/ssl' -require 'puppet/rest/routes' - -def base_json_comparison(result, json_hash) - expect(result["fingerprint"]).to eq(json_hash["fingerprint"]) - expect(result["name"]).to eq(json_hash["name"]) - expect(result["state"]).to eq(json_hash["desired_state"]) -end - -describe Puppet::SSL::Host, if: !Puppet::Util::Platform.jruby? do - include JSONMatchers - include PuppetSpec::Files - - before do - # Get a safe temporary file - dir = tmpdir("ssl_host_testing") - Puppet.settings[:confdir] = dir - Puppet.settings[:vardir] = dir - Puppet.settings.use :main, :ssl - - @host = Puppet::SSL::Host.new("myname") - end - - after do - # Cleaned out any cached localhost instance. - Puppet::SSL::Host.reset - end - - it "should use any provided name as its name" do - expect(@host.name).to eq("myname") - end - - it "should retrieve its public key from its private key" do - realkey = double('realkey') - key = double('key', :content => realkey) - allow(Puppet::SSL::Key.indirection).to receive(:find).and_return(key) - pubkey = double('public_key') - expect(realkey).to receive(:public_key).and_return(pubkey) - - expect(@host.public_key).to equal(pubkey) - end - - describe 'localhost' do - before(:each) do - allow_any_instance_of(Puppet::SSL::Host).to receive(:certificate).and_return(nil) - allow_any_instance_of(Puppet::SSL::Host).to receive(:generate) - end - - it "is deprecated" do - Puppet::SSL::Host.localhost - - expect(@logs).to include(an_object_having_attributes(message: /Puppet::SSL::Host is deprecated/)) - end - - it "should allow to reset localhost" do - previous_host = Puppet::SSL::Host.localhost - Puppet::SSL::Host.reset - expect(Puppet::SSL::Host.localhost).not_to eq(previous_host) - end - - it "should generate the certificate for the localhost instance if no certificate is available" do - host = double('host', :key => nil) - expect(Puppet::SSL::Host).to receive(:new).and_return(host) - - expect(host).to receive(:certificate).and_return(nil) - expect(host).to receive(:generate) - - expect(Puppet::SSL::Host.localhost).to equal(host) - end - - it "should always read the key for the localhost instance in from disk" do - host = double('host', :certificate => "eh") - expect(host).to receive(:key) - expect(Puppet::SSL::Host).to receive(:new).and_return(host) - - Puppet::SSL::Host.localhost - end - - it "should cache the localhost instance" do - host = double('host', :certificate => "eh", :key => 'foo') - expect(Puppet::SSL::Host).to receive(:new).once.and_return(host) - expect(Puppet::SSL::Host.localhost).to eq(Puppet::SSL::Host.localhost) - end - end - - context "with dns_alt_names" do - before :each do - @key = double('key content') - key = double('key', :generate => true, :content => @key) - allow(Puppet::SSL::Key).to receive(:new).and_return(key) - allow(Puppet::SSL::Key.indirection).to receive(:save).with(key) - - @cr = double('certificate request', :render => "csr pem") - allow(Puppet::SSL::CertificateRequest).to receive(:new).and_return(@cr) - allow_any_instance_of(Puppet::SSL::Host).to receive(:submit_certificate_request) - end - - describe "explicitly specified" do - before :each do - Puppet[:dns_alt_names] = 'one, two' - end - - it "should not include subjectAltName if not the local node" do - expect(@cr).to receive(:generate).with(@key, {}) - - Puppet::SSL::Host.new('not-the-' + Puppet[:certname]).generate_certificate_request - end - - it "should include subjectAltName if the local node" do - expect(@cr).to receive(:generate).with(@key, { :dns_alt_names => 'one, two' }) - - Puppet::SSL::Host.new(Puppet[:certname]).generate_certificate_request - end - end - end - - it "should be able to verify its certificate matches its key" do - expect(Puppet::SSL::Host.new("foo")).to respond_to(:validate_certificate_with_key) - end - - it "should consider the certificate invalid if it cannot find a key" do - host = Puppet::SSL::Host.new("foo") - certificate = double('cert', :fingerprint => 'DEADBEEF') - expect(host).to receive(:key).and_return(nil) - expect { host.validate_certificate_with_key(certificate) }.to raise_error(Puppet::Error, "No private key with which to validate certificate with fingerprint: DEADBEEF") - end - - it "should consider the certificate invalid if it cannot find a certificate" do - host = Puppet::SSL::Host.new("foo") - expect(host).not_to receive(:key) - expect { host.validate_certificate_with_key(nil) }.to raise_error(Puppet::Error, "No certificate to validate.") - end - - it "should consider the certificate invalid if the SSL certificate's key verification fails" do - host = Puppet::SSL::Host.new("foo") - key = double('key', :content => "private_key") - sslcert = double('sslcert') - certificate = double('cert', {:content => sslcert, :fingerprint => 'DEADBEEF'}) - allow(host).to receive(:key).and_return(key) - expect(sslcert).to receive(:check_private_key).with("private_key").and_return(false) - expect { host.validate_certificate_with_key(certificate) }.to raise_error(Puppet::Error, /DEADBEEF/) - end - - it "should consider the certificate valid if the SSL certificate's key verification succeeds" do - host = Puppet::SSL::Host.new("foo") - key = double('key', :content => "private_key") - sslcert = double('sslcert') - certificate = double('cert', :content => sslcert) - allow(host).to receive(:key).and_return(key) - expect(sslcert).to receive(:check_private_key).with("private_key").and_return(true) - expect{ host.validate_certificate_with_key(certificate) }.not_to raise_error - end - - it "should output agent-specific commands when validation fails" do - host = Puppet::SSL::Host.new("foo") - key = double('key', :content => "private_key") - sslcert = double('sslcert') - certificate = double('cert', {:content => sslcert, :fingerprint => 'DEADBEEF'}) - allow(host).to receive(:key).and_return(key) - expect(sslcert).to receive(:check_private_key).with("private_key").and_return(false) - expect { host.validate_certificate_with_key(certificate) }.to raise_error(Puppet::Error, /puppet ssl clean \n/) - end - - it "should output device-specific commands when validation fails" do - Puppet[:certname] = "device.example.com" - host = Puppet::SSL::Host.new("device.example.com", true) - key = double('key', :content => "private_key") - sslcert = double('sslcert') - certificate = double('cert', {:content => sslcert, :fingerprint => 'DEADBEEF'}) - allow(host).to receive(:key).and_return(key) - expect(sslcert).to receive(:check_private_key).with("private_key").and_return(false) - expect { host.validate_certificate_with_key(certificate) }.to raise_error(Puppet::Error, /puppet ssl clean --target device.example.com/) - end - - describe "when initializing" do - it "should default its name to the :certname setting" do - Puppet[:certname] = "myname" - - expect(Puppet::SSL::Host.new.name).to eq("myname") - end - - it "should downcase a passed in name" do - expect(Puppet::SSL::Host.new("Host.Domain.Com").name).to eq("host.domain.com") - end - end - - describe "when managing its private key" do - before do - @realkey = "mykey" - @key = Puppet::SSL::Key.new("mykey") - @key.content = @realkey - end - - it "should return nil if the key is not set and cannot be found" do - expect(Puppet::SSL::Key.indirection).to receive(:find).with("myname").and_return(nil) - expect(@host.key).to be_nil - end - - it "should find the key in the Key class and return the Puppet instance" do - expect(Puppet::SSL::Key.indirection).to receive(:find).with("myname").and_return(@key) - expect(@host.key).to equal(@key) - end - - it "should be able to generate and save a new key" do - expect(Puppet::SSL::Key).to receive(:new).with("myname").and_return(@key) - - expect(@key).to receive(:generate) - expect(Puppet::SSL::Key.indirection).to receive(:save) - - expect(@host.generate_key).to be_truthy - expect(@host.key).to equal(@key) - end - - it "should not retain keys that could not be saved" do - expect(Puppet::SSL::Key).to receive(:new).with("myname").and_return(@key) - - expect(@key).to receive(:generate) - expect(Puppet::SSL::Key.indirection).to receive(:save).and_raise("eh") - - expect { @host.generate_key }.to raise_error(RuntimeError) - expect(@host.key).to be_nil - end - - it "should return any previously found key without requerying" do - expect(Puppet::SSL::Key.indirection).to receive(:find).with("myname").and_return(@key).once - expect(@host.key).to equal(@key) - expect(@host.key).to equal(@key) - end - end - - describe "when managing its certificate request" do - before(:all) do - @pki = PuppetSpec::SSL.create_chained_pki - end - - before(:each) do - Puppet[:requestdir] = tmpdir('requests') - end - - let(:key) { Puppet::SSL::Key.from_s(@pki[:leaf_key].to_s, @host.name) } - - it "should generate a new key when generating the cert request if no key exists" do - expect(@host).to receive(:key).exactly(2).times.and_return(nil, key) - expect(@host).to receive(:generate_key).and_return(key) - - allow(@host).to receive(:submit_certificate_request) - - @host.generate_certificate_request - expect(Puppet::FileSystem.exist?(File.join(Puppet[:requestdir], "#{@host.name}.pem"))).to be true - end - - it "should be able to generate and save a new request using the private key" do - allow(@host).to receive(:key).and_return(key) - allow(@host).to receive(:submit_certificate_request) - - expect(@host.generate_certificate_request).to be_truthy - expect(Puppet::FileSystem.exist?(File.join(Puppet[:requestdir], "#{@host.name}.pem"))).to be true - end - - it "should send a new request to the CA for signing" do - @http = double("http") - allow(@host).to receive(:http_client).and_return(@http) - allow(@host).to receive(:ssl_store).and_return(double("ssl store")) - allow(@host).to receive(:key).and_return(key) - request = double("request") - allow(request).to receive(:generate) - expect(request).to receive(:render).and_return("my request").twice - expect(Puppet::SSL::CertificateRequest).to receive(:new).and_return(request) - - expect(Puppet::Rest::Routes).to receive(:put_certificate_request) - .with("my request", @host.name, anything) - .and_return(nil) - - expect(@host.generate_certificate_request).to be true - end - - it "should return any previously found request without requerying" do - request = double("request") - expect(@host).to receive(:load_certificate_request_from_file).and_return(request).once - - expect(@host.certificate_request).to equal(request) - expect(@host.certificate_request).to equal(request) - end - - it "should not keep its certificate request in memory if the request cannot be saved" do - allow(@host).to receive(:key).and_return(key) - allow(@host).to receive(:submit_certificate_request) - expect(Puppet::Util).to receive(:replace_file).and_raise(RuntimeError) - - expect { @host.generate_certificate_request }.to raise_error(RuntimeError) - - expect(@host.instance_eval { @certificate_request }).to be_nil - end - end - - describe "when managing its certificate" do - before(:all) do - @pki = PuppetSpec::SSL.create_chained_pki - end - - before(:each) do - Puppet[:certdir] = tmpdir('certs') - allow(@host).to receive(:key).and_return(double("key")) - allow(@host).to receive(:validate_certificate_with_key) - allow(@host).to receive(:http_client).and_return(@http) - allow(@host).to receive(:ssl_store).and_return(double("ssl store")) - end - - let(:ca_cert_response) { @pki[:ca_bundle] } - let(:crl_response) { @pki[:crl_chain] } - let(:host_cert_response) { @pki[:unrevoked_leaf_node_cert] } - - it "should find the CA certificate and save it to disk" do - stub_request(:get, %r{puppet-ca/v1/certificate/ca}).to_return(status: 200, body: ca_cert_response) - stub_request(:get, %r{puppet-ca/v1/certificate_revocation_list/ca}).to_return(status: 200, body: crl_response) - stub_request(:get, %r{puppet-ca/v1/certificate/#{@host.name}}).to_return(status: 404) - - @host.certificate - actual_ca_bundle = Puppet::FileSystem.read(Puppet[:localcacert]) - expect(actual_ca_bundle).to match(/BEGIN CERTIFICATE.*END CERTIFICATE.*BEGIN CERTIFICATE/m) - end - - it "should raise if it cannot find a CA certificate" do - stub_request(:get, %r{puppet-ca/v1/certificate/ca}).to_return(status: 404) - - expect(@host).not_to receive(:get_host_certificate) - - expect { - @host.certificate - }.to raise_error(Puppet::Error, /CA certificate is missing from the server/) - end - - it "should find the key if it does not have one" do - stub_request(:get, %r{puppet-ca/v1/certificate/ca}).to_return(status: 200, body: ca_cert_response) - stub_request(:get, %r{puppet-ca/v1/certificate_revocation_list/ca}).to_return(status: 200, body: crl_response) - - expect(@host).to receive(:get_host_certificate).and_return(nil) - expect(@host).to receive(:key).and_return(double("key")) - @host.certificate - end - - it "should generate the key if one cannot be found" do - stub_request(:get, %r{puppet-ca/v1/certificate/ca}).to_return(status: 200, body: ca_cert_response) - stub_request(:get, %r{puppet-ca/v1/certificate_revocation_list/ca}).to_return(status: 200, body: crl_response) - - expect(@host).to receive(:get_host_certificate).and_return(nil) - expect(@host).to receive(:key).and_return(nil) - expect(@host).to receive(:generate_key) - @host.certificate - end - - it "should find the host certificate, write it to file, and return the Puppet certificate instance" do - stub_request(:get, %r{puppet-ca/v1/certificate/ca}).to_return(status: 200, body: ca_cert_response) - stub_request(:get, %r{puppet-ca/v1/certificate_revocation_list/ca}).to_return(status: 200, body: crl_response) - stub_request(:get, %r{puppet-ca/v1/certificate/#{@host.name}}).to_return(status: 200, body: host_cert_response.to_pem) - - expected_cert = Puppet::SSL::Certificate.from_s(@pki[:unrevoked_leaf_node_cert]) - actual_cert = @host.certificate - expect(actual_cert).to be_a(Puppet::SSL::Certificate) - expect(actual_cert.to_s).to eq(expected_cert.to_s) - host_cert_from_file = Puppet::FileSystem.read(File.join(Puppet[:certdir], "#{@host.name}.pem")) - expect(host_cert_from_file).to eq(expected_cert.to_s) - end - - it "should return any previously found certificate" do - cert = double('cert') - stub_request(:get, %r{puppet-ca/v1/certificate/ca}).to_return(status: 200, body: ca_cert_response) - stub_request(:get, %r{puppet-ca/v1/certificate_revocation_list/ca}).to_return(status: 200, body: crl_response) - expect(@host).to receive(:get_host_certificate).and_return(cert).once - - expect(@host.certificate).to equal(cert) - expect(@host.certificate).to equal(cert) - end - - context 'invalid certificates' do - it "should raise if the CA certificate downloaded from CA is invalid" do - stub_request(:get, %r{puppet-ca/v1/certificate/ca}).to_return(status: 200, body: 'garbage') - - expect { @host.certificate }.to raise_error(OpenSSL::X509::CertificateError, /Failed to parse CA certificates as PEM/) - end - - it "should warn if the host certificate downloaded from CA is invalid" do - stub_request(:get, %r{puppet-ca/v1/certificate/ca}).to_return(status: 200, body: ca_cert_response) - stub_request(:get, %r{puppet-ca/v1/certificate_revocation_list/ca}).to_return(status: 200, body: crl_response) - stub_request(:get, %r{puppet-ca/v1/certificate/#{@host.name}}).to_return(status: 200, body: 'garbage') - - expect { @host.certificate }.to raise_error(Puppet::Error, /did not contain a valid certificate for #{@host.name}/) - end - - it 'should warn if the CA certificate loaded from disk is invalid' do - Puppet::FileSystem.open(Puppet[:localcacert], nil, "w:ASCII") do |f| - f.puts 'garbage' - end - expect { @host.certificate }.to raise_error(OpenSSL::X509::CertificateError, /Failed to parse CA certificates as PEM/) - end - - it 'should warn if the host certificate loaded from disk in invalid' do - stub_request(:get, %r{puppet-ca/v1/certificate/ca}).to_return(status: 200, body: ca_cert_response) - stub_request(:get, %r{puppet-ca/v1/certificate_revocation_list/ca}).to_return(status: 200, body: crl_response) - - Puppet::FileSystem.open(File.join(Puppet[:certdir], "#{@host.name}.pem"), nil, "w:ASCII") do |f| - f.puts 'garbage' - end - expect { @host.certificate }.to raise_error(Puppet::Error, /The certificate.*invalid/) - end - end - end - - it "should have a method for generating all necessary files" do - expect(Puppet::SSL::Host.new("me")).to respond_to(:generate) - end - - describe "when generating files" do - before do - @host = Puppet::SSL::Host.new("me") - allow(@host).to receive(:generate_key) - allow(@host).to receive(:generate_certificate_request) - allow(@host).to receive(:certificate_request) - allow(@host).to receive(:certificate) - end - - it "should generate a key if one is not present" do - allow(@host).to receive(:key).and_return nil - expect(@host).to receive(:generate_key) - - @host.generate - end - - it "should generate a certificate request if one is not present" do - expect(@host).to receive(:certificate_request).and_return nil - expect(@host).to receive(:generate_certificate_request) - - @host.generate - end - end - - it "should have a method for creating an SSL store" do - expect(Puppet::SSL::Host.new("me")).to respond_to(:ssl_store) - end - - describe "when creating an SSL store" do - before do - Puppet[:localcacert] = "ssl_host_testing" - end - - it "should accept a purpose" do - store = double('store', :add_file => nil) - expect(OpenSSL::X509::Store).to receive(:new).and_return(store) - expect(store).to receive(:purpose=).with(OpenSSL::X509::PURPOSE_SSL_SERVER) - host = Puppet::SSL::Host.new("me") - host.crl_usage = false - - host.ssl_store(OpenSSL::X509::PURPOSE_SSL_SERVER) - end - - context "and the CRL is not on disk" do - before do - @pki = PuppetSpec::SSL.create_chained_pki - @revoked_cert = @pki[:revoked_root_node_cert] - localcacert = Puppet.settings[:localcacert] - Puppet::Util.replace_file(localcacert, 0644) {|f| f.write @pki[:ca_bundle] } - @http = double('http') - allow(@host).to receive(:http_client).and_return(@http) - end - - after do - Puppet::FileSystem.unlink(Puppet.settings[:localcacert]) - Puppet::FileSystem.unlink(Puppet.settings[:hostcrl]) - end - - it "retrieves it from the server" do - expect(Puppet::Rest::Routes).to receive(:get_crls) - .with(Puppet::SSL::CA_NAME, anything) - .and_return(@pki[:crl_chain]) - - @host.ssl_store - expect(Puppet::FileSystem.read(Puppet.settings[:hostcrl], :encoding => Encoding::UTF_8)).to eq(@pki[:crl_chain]) - end - end - - describe "and a CRL is available" do - before do - pki = PuppetSpec::SSL.create_chained_pki - - @revoked_cert_from_self_signed_root = pki[:revoked_root_node_cert] - @revoked_cert_from_ca_with_untrusted_chain = pki[:revoked_leaf_node_cert] - @unrevoked_cert_from_self_signed_root = pki[:unrevoked_root_node_cert] - @unrevoked_cert_from_revoked_ca = pki[:unrevoked_int_node_cert] - @unrevoked_cert_from_ca_with_untrusted_chain = pki[:unrevoked_leaf_node_cert] - - localcacert = Puppet.settings[:localcacert] - hostcrl = Puppet.settings[:hostcrl] - - Puppet::Util.replace_file(localcacert, 0644) {|f| f.write pki[:ca_bundle] } - Puppet::Util.replace_file(hostcrl, 0644) {|f| f.write pki[:crl_chain] } - end - - after do - Puppet::FileSystem.unlink(Puppet.settings[:localcacert]) - Puppet::FileSystem.unlink(Puppet.settings[:hostcrl]) - end - - [true, :chain].each do |crl_setting| - describe "and 'certificate_revocation' is #{crl_setting}" do - before do - @host = Puppet::SSL::Host.new(crl_setting.to_s) - @host.crl_usage = crl_setting - end - - it "should verify unrevoked certs" do - expect( - @host.ssl_store.verify(@unrevoked_cert_from_self_signed_root) - ).to be true - end - - it "should not verify revoked certs" do - [@revoked_cert_from_self_signed_root, - @revoked_cert_from_ca_with_untrusted_chain, - @unrevoked_cert_from_revoked_ca, - @unrevoked_cert_from_ca_with_untrusted_chain].each do |cert| - expect(@host.ssl_store.verify(cert)).to be false - end - end - end - end - - describe "and 'certificate_revocation' is leaf" do - before do - @host = Puppet::SSL::Host.new("leaf") - @host.crl_usage = :leaf - end - - it "should verify unrevoked certs regardless of signing CA's revocation status" do - [@unrevoked_cert_from_self_signed_root, - @unrevoked_cert_from_revoked_ca, - @unrevoked_cert_from_ca_with_untrusted_chain].each do |cert| - expect(@host.ssl_store.verify(cert)).to be true - end - end - - it "should not verify certs revoked by their signing CA" do - [@revoked_cert_from_self_signed_root, - @revoked_cert_from_ca_with_untrusted_chain].each do |cert| - expect(@host.ssl_store.verify(cert)).to be false - end - end - end - - describe "and 'certificate_revocation' is false" do - before do - @host = Puppet::SSL::Host.new("host") - @host.crl_usage = false - end - - it "should verify valid certs regardless of revocation status" do - [@revoked_cert_from_self_signed_root, - @revoked_cert_from_ca_with_untrusted_chain, - @unrevoked_cert_from_self_signed_root, - @unrevoked_cert_from_revoked_ca, - @unrevoked_cert_from_ca_with_untrusted_chain].each do |cert| - expect(@host.ssl_store.verify(cert)).to be true - end - end - end - end - end - - describe "when waiting for a cert" do - before do - @host = Puppet::SSL::Host.new("me") - end - - it "should generate its certificate request and attempt to read the certificate again if no certificate is found" do - expect(@host).to receive(:certificate).twice.and_return(nil, "foo") - expect(@host).to receive(:generate) - @host.wait_for_cert(1) - end - - it "should catch and log errors during CSR saving" do - expect(@host).to receive(:certificate).twice.and_return(nil, "foo") - times_generate_called = 0 - expect(@host).to receive(:generate) do - times_generate_called += 1 - raise RuntimeError if times_generate_called == 1 - nil - end - allow(@host).to receive(:sleep) - @host.wait_for_cert(1) - end - - it "should sleep and retry after failures saving the CSR if waitforcert is enabled" do - expect(@host).to receive(:certificate).twice.and_return(nil, "foo") - times_generate_called = 0 - expect(@host).to receive(:generate) do - times_generate_called += 1 - raise RuntimeError if times_generate_called == 1 - nil - end - expect(@host).to receive(:sleep).with(1) - @host.wait_for_cert(1) - end - - it "should exit after failures saving the CSR of waitforcert is disabled" do - expect(@host).to receive(:certificate).and_return(nil) - expect(@host).to receive(:generate).and_raise(RuntimeError) - expect(@host).to receive(:puts) - expect { @host.wait_for_cert(0) }.to exit_with 1 - end - - it "should exit if the wait time is 0 and it can neither find nor retrieve a certificate" do - allow(@host).to receive(:certificate).and_return(nil) - expect(@host).to receive(:generate) - expect(@host).to receive(:puts) - expect { @host.wait_for_cert(0) }.to exit_with 1 - end - - it "should sleep for the specified amount of time if no certificate is found after generating its certificate request" do - expect(@host).to receive(:certificate).exactly(3).times().and_return(nil, nil, "foo") - expect(@host).to receive(:generate) - - expect(@host).to receive(:sleep).with(1) - - @host.wait_for_cert(1) - end - - it "should catch and log exceptions during certificate retrieval" do - times_certificate_called = 0 - expect(@host).to receive(:certificate) do - times_certificate_called += 1 - if times_certificate_called == 1 - return nil - elsif times_certificate_called == 2 - raise RuntimeError - end - "foo" - end.exactly(3).times() - allow(@host).to receive(:generate) - allow(@host).to receive(:sleep) - - expect(Puppet).to receive(:log_exception).at_least(:once) - - @host.wait_for_cert(1) - end - end -end From effd86ea5e80f5c4405061fdaff1fa4007a55498 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Thu, 23 Jul 2020 20:48:49 -0700 Subject: [PATCH 037/731] (PUP-10252) Remove ssl_{server,client}_ca_auth The `ssl_client_ca_auth` setting was an allow-list of root or intermediate CA certificates that the agent would trust when connecting to a server. The setting has been broken for along time and is no longer used. The `ssl_server_ca_auth` setting was used in the ruby puppet webrick/passenger server, but has been dead for a long time. This commit removes both settings and the ExternalCertFixtures helper that referenced the settings but is no longer used in puppet beaker tests. Puppetserver provides its own helper when testing external certs. --- .../acceptance/external_cert_fixtures.rb | 361 ------------------ lib/puppet/defaults.rb | 23 -- 2 files changed, 384 deletions(-) delete mode 100644 acceptance/lib/puppet_x/acceptance/external_cert_fixtures.rb diff --git a/acceptance/lib/puppet_x/acceptance/external_cert_fixtures.rb b/acceptance/lib/puppet_x/acceptance/external_cert_fixtures.rb deleted file mode 100644 index 5a8a0610ae0..00000000000 --- a/acceptance/lib/puppet_x/acceptance/external_cert_fixtures.rb +++ /dev/null @@ -1,361 +0,0 @@ -module PuppetX -module Acceptance -class ExternalCertFixtures - attr_reader :fixture_dir - attr_reader :test_dir - attr_reader :master_name - attr_reader :agent_name - - ## - # ExternalCerts provides a utility class to fill in fixture data and other - # large blobs of text configuration for the acceptance testing of External CA - # behavior. - # - # @param [String] fixture_dir The fixture directory to read from. - # - # @param [String] test_dir The directory on the remote system, used for - # filling in templates. - # - # @param [String] master_name The common name the master should be reachable - # at. This name should match up with the certificate files in the fixture - # directory, e.g. master1.example.org. - # - # @param [String] agent_name The common name the agent is configured to use. - # This name should match up with the certificate files in the fixture - # directory, e.g. - def initialize(fixture_dir, test_dir, master_name = "master1.example.org", agent_name = "agent1.example.org") - @fixture_dir = fixture_dir - @test_dir = test_dir - @master_name = master_name - @agent_name = agent_name - end - - def master_short_name - @master_short_name ||= master_name.gsub(/\..*/, '') - end - - def host_entry - @host_entry ||= "127.0.0.3 #{master_name} #{master_short_name} puppet" - end - - def root_ca_cert - @root_ca_cert ||= File.read(File.join(fixture_dir, 'root', 'ca-root.crt')) - end - - def agent_ca_cert - @agent_ca_cert ||= File.read(File.join(fixture_dir, 'agent-ca', 'ca-agent-ca.crt')) - end - - def master_ca_cert - @master_ca_cert ||= File.read(File.join(fixture_dir, 'master-ca', 'ca-master-ca.crt')) - end - - def master_ca_crl - @master_ca_crl ||= File.read(File.join(fixture_dir, 'master-ca', 'ca-master-ca.crl')) - end - - def agent_cert - @agent_cert ||= File.read(File.join(fixture_dir, 'leaves', "#{agent_name}.issued_by.agent-ca.crt")) - end - - def agent_key - @agent_key ||= File.read(File.join(fixture_dir, 'leaves', "#{agent_name}.issued_by.agent-ca.key")) - end - - def agent_email_cert - @agent_email_cert ||= File.read(File.join(fixture_dir, 'leaves', "#{agent_name}.email.issued_by.agent-ca.crt")) - end - - def agent_email_key - @agent_email_cert ||= File.read(File.join(fixture_dir, 'leaves', "#{agent_name}.email.issued_by.agent-ca.key")) - end - - def master_cert - @master_cert ||= File.read(File.join(fixture_dir, 'leaves', "#{master_name}.issued_by.master-ca.crt")) - end - - def master_key - @master_key ||= File.read(File.join(fixture_dir, 'leaves', "#{master_name}.issued_by.master-ca.key")) - end - - def master_cert_rogue - @master_cert_rogue ||= File.read(File.join(fixture_dir, 'leaves', "#{master_name}.issued_by.agent-ca.crt")) - end - - def master_key_rogue - @master_key_rogue ||= File.read(File.join(fixture_dir, 'leaves', "#{master_name}.issued_by.agent-ca.key")) - end - - ## Configuration files - def agent_conf - @agent_conf ||= <<-EO_AGENT_CONF -[main] -color = false -certname = #{agent_name} -server = #{master_name} -certificate_revocation = false - -# localcacert must contain the Root CA certificate to complete the 2 level CA -# chain when an intermediate CA certificate is being used. Either the HTTP -# server must send the intermediate certificate during the handshake, or the -# agent must use the `ssl_client_ca_auth` setting to provide the client -# certificate. -localcacert = #{test_dir}/ca_root.crt -EO_AGENT_CONF - end - - def agent_conf_email - @agent_conf ||= <<-EO_AGENT_CONF -[main] -color = false -certname = #{agent_name} -server = #{master_name} -certificate_revocation = false -hostcert = #{test_dir}/agent_email.crt -hostkey = #{test_dir}/agent_email.key -localcacert = #{test_dir}/ca_root.crt -EO_AGENT_CONF - end - - def agent_conf_crl - @agent_conf_crl ||= <<-EO_AGENT_CONF -[main] -certname = #{agent_name} -server = #{master_name} - -# localcacert must contain the Root CA certificate to complete the 2 level CA -# chain when an intermediate CA certificate is being used. Either the HTTP -# server must send the intermediate certificate during the handshake, or the -# agent must use the `ssl_client_ca_auth` setting to provide the client -# certificate. -localcacert = #{test_dir}/ca_root.crt -EO_AGENT_CONF - end - - def master_conf - @master_conf ||= <<-EO_MASTER_CONF -[master] -ca = false -certname = #{master_name} -ssl_client_header = HTTP_X_CLIENT_DN -ssl_client_verify_header = HTTP_X_CLIENT_VERIFY -EO_MASTER_CONF - end - - ## - # Passenger Rack compliant config.ru which is responsible for starting the - # Puppet master. - def config_ru - @config_ru ||= <<-EO_CONFIG_RU -\$0 = "master" -ARGV << "--rack" -ARGV << "--confdir=#{test_dir}/etc/master" -ARGV << "--vardir=#{test_dir}/etc/master/var" -require 'puppet/util/command_line' -run Puppet::Util::CommandLine.new.execute -EO_CONFIG_RU - end - - ## - # auth_conf should return auth authorization file that allows *.example.org - # access to to the full REST API. - def auth_conf - @auth_conf_content ||= File.read(File.join(fixture_dir, 'auth.conf')) - end - - ## - # Apache configuration with Passenger - def httpd_conf - @httpd_conf ||= <<-EO_HTTPD_CONF -User apache -Group apache - -ServerRoot "/etc/httpd" -PidFile run/httpd.pid -Timeout 60 -KeepAlive Off -MaxKeepAliveRequests 100 -KeepAliveTimeout 15 - - -StartServers 8 -MinSpareServers 5 -MaxSpareServers 20 -ServerLimit 256 -MaxClients 256 -MaxRequestsPerChild 4000 - - - -StartServers 4 -MaxClients 300 -MinSpareThreads 25 -MaxSpareThreads 75 -ThreadsPerChild 25 -MaxRequestsPerChild 0 - - -LoadModule auth_basic_module modules/mod_auth_basic.so -LoadModule auth_digest_module modules/mod_auth_digest.so -LoadModule authn_file_module modules/mod_authn_file.so -LoadModule authn_alias_module modules/mod_authn_alias.so -LoadModule authn_anon_module modules/mod_authn_anon.so -LoadModule authn_dbm_module modules/mod_authn_dbm.so -LoadModule authn_default_module modules/mod_authn_default.so -LoadModule authz_host_module modules/mod_authz_host.so -LoadModule authz_user_module modules/mod_authz_user.so -LoadModule authz_owner_module modules/mod_authz_owner.so -LoadModule authz_groupfile_module modules/mod_authz_groupfile.so -LoadModule authz_dbm_module modules/mod_authz_dbm.so -LoadModule authz_default_module modules/mod_authz_default.so -LoadModule ldap_module modules/mod_ldap.so -LoadModule authnz_ldap_module modules/mod_authnz_ldap.so -LoadModule include_module modules/mod_include.so -LoadModule log_config_module modules/mod_log_config.so -LoadModule logio_module modules/mod_logio.so -LoadModule env_module modules/mod_env.so -LoadModule ext_filter_module modules/mod_ext_filter.so -LoadModule mime_magic_module modules/mod_mime_magic.so -LoadModule expires_module modules/mod_expires.so -LoadModule deflate_module modules/mod_deflate.so -LoadModule headers_module modules/mod_headers.so -LoadModule usertrack_module modules/mod_usertrack.so -LoadModule setenvif_module modules/mod_setenvif.so -LoadModule mime_module modules/mod_mime.so -LoadModule dav_module modules/mod_dav.so -LoadModule status_module modules/mod_status.so -LoadModule autoindex_module modules/mod_autoindex.so -LoadModule info_module modules/mod_info.so -LoadModule dav_fs_module modules/mod_dav_fs.so -LoadModule vhost_alias_module modules/mod_vhost_alias.so -LoadModule negotiation_module modules/mod_negotiation.so -LoadModule dir_module modules/mod_dir.so -LoadModule actions_module modules/mod_actions.so -LoadModule speling_module modules/mod_speling.so -LoadModule userdir_module modules/mod_userdir.so -LoadModule alias_module modules/mod_alias.so -LoadModule substitute_module modules/mod_substitute.so -LoadModule rewrite_module modules/mod_rewrite.so -LoadModule proxy_module modules/mod_proxy.so -LoadModule proxy_balancer_module modules/mod_proxy_balancer.so -LoadModule proxy_ftp_module modules/mod_proxy_ftp.so -LoadModule proxy_http_module modules/mod_proxy_http.so -LoadModule proxy_ajp_module modules/mod_proxy_ajp.so -LoadModule proxy_connect_module modules/mod_proxy_connect.so -LoadModule cache_module modules/mod_cache.so -LoadModule suexec_module modules/mod_suexec.so -LoadModule disk_cache_module modules/mod_disk_cache.so -LoadModule cgi_module modules/mod_cgi.so -LoadModule version_module modules/mod_version.so - -LoadModule ssl_module modules/mod_ssl.so -LoadModule passenger_module modules/mod_passenger.so - -ServerName #{master_name} -DocumentRoot "#{test_dir}/etc/master/public" - -DefaultType text/plain -TypesConfig /etc/mime.types - -# Same thing, just using a certificate issued by the Agent CA, which should not -# be trusted by the clients. - -Listen 8140 https -Listen 8141 https - - - SSLEngine on - SSLProtocol ALL -SSLv2 - SSLCipherSuite ALL:!ADH:RC4+RSA:+HIGH:+MEDIUM:-LOW:-SSLv2:-EXP - - SSLCertificateFile "#{test_dir}/master.crt" - SSLCertificateKeyFile "#{test_dir}/master.key" - - # The chain file is sent to the client during handshake. - SSLCertificateChainFile "#{test_dir}/ca_master_bundle.crt" - # The CA cert file is used to authenticate clients - SSLCACertificateFile "#{test_dir}/ca_agent_bundle.crt" - - SSLVerifyClient optional - SSLVerifyDepth 2 - SSLOptions +StdEnvVars - RequestHeader set X-SSL-Subject %{SSL_CLIENT_S_DN}e - RequestHeader set X-Client-DN %{SSL_CLIENT_S_DN}e - RequestHeader set X-Client-Verify %{SSL_CLIENT_VERIFY}e - - DocumentRoot "#{test_dir}/etc/master/public" - - PassengerRoot /usr/share/gems/gems/passenger-3.0.17 - PassengerRuby /usr/bin/ruby - - RackAutoDetect On - RackBaseURI / - - - - SSLEngine on - SSLProtocol ALL -SSLv2 - SSLCipherSuite ALL:!ADH:RC4+RSA:+HIGH:+MEDIUM:-LOW:-SSLv2:-EXP - SSLCertificateFile "#{test_dir}/master_rogue.crt" - SSLCertificateKeyFile "#{test_dir}/master_rogue.key" - - SSLCertificateChainFile "#{test_dir}/ca_agent_bundle.crt" - SSLCACertificateFile "#{test_dir}/ca_agent_bundle.crt" - - SSLVerifyClient optional - SSLVerifyDepth 2 - SSLOptions +StdEnvVars - RequestHeader set X-SSL-Subject %{SSL_CLIENT_S_DN}e - RequestHeader set X-Client-DN %{SSL_CLIENT_S_DN}e - RequestHeader set X-Client-Verify %{SSL_CLIENT_VERIFY}e - - DocumentRoot "#{test_dir}/etc/master/public" - - PassengerRoot /usr/share/gems/gems/passenger-3.0.17 - PassengerRuby /usr/bin/ruby - - RackAutoDetect On - RackBaseURI / - -EO_HTTPD_CONF - end - - ## - # webserver.conf for a trustworthy master for use with Jetty - def jetty_webserver_conf_for_trustworthy_master - @jetty_webserver_conf_for_trustworthy_master ||= <<-EO_WEBSERVER_CONF -webserver: { - client-auth: want - ssl-host: 0.0.0.0 - ssl-port: 8140 - - ssl-cert: "#{test_dir}/master.crt" - ssl-key: "#{test_dir}/master.key" - - ssl-cert-chain: "#{test_dir}/ca_master_bundle.crt" - ssl-ca-cert: "#{test_dir}/ca_agent_bundle.crt" -} - EO_WEBSERVER_CONF - end - - ## - # webserver.conf for a rogue master for use with Jetty - def jetty_webserver_conf_for_rogue_master - @jetty_webserver_conf_for_rogue_master ||= <<-EO_WEBSERVER_CONF -webserver: { - client-auth: want - ssl-host: 0.0.0.0 - ssl-port: 8140 - - ssl-cert: "#{test_dir}/master_rogue.crt" - ssl-key: "#{test_dir}/master_rogue.key" - - ssl-cert-chain: "#{test_dir}/ca_agent_bundle.crt" - ssl-ca-cert: "#{test_dir}/ca_agent_bundle.crt" -} - EO_WEBSERVER_CONF - end - -end -end -end diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb index 875e7f16503..d7f294144ba 100644 --- a/lib/puppet/defaults.rb +++ b/lib/puppet/defaults.rb @@ -989,29 +989,6 @@ def self.initialize_default_settings!(settings) puppet module tool and the 'http' report processor. This setting is ignored when making requests to puppet:// URLs such as catalog and report requests.", }, - :ssl_client_ca_auth => { - :type => :file, - :mode => "0644", - :owner => "service", - :group => "service", - :desc => "Certificate authorities who issue server certificates. SSL servers will not be - considered authentic unless they possess a certificate issued by an authority - listed in this file. If this setting has no value then the Puppet master's CA - certificate (localcacert) will be used.", - :hook => proc do |val| - Puppet.deprecation_warning(_("Setting 'ssl_client_ca_auth' is deprecated.")) - end - }, - :ssl_server_ca_auth => { - :type => :file, - :mode => "0644", - :owner => "service", - :group => "service", - :deprecated => :completely, - :desc => "The setting is deprecated and has no effect. Ensure all root and - intermediate certificate authorities used to issue client certificates are - contained in the server's `cacert` file on the server." - }, :hostcrl => { :default => "$ssldir/crl.pem", :type => :file, From 85e9eb510e5b5fa8aecfaa404cfefb98dc9d0263 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Thu, 6 Aug 2020 23:27:50 +0000 Subject: [PATCH 038/731] (packaging) Updating the puppet.pot file --- locales/puppet.pot | 130 +++++++++++++++++---------------------------- 1 file changed, 48 insertions(+), 82 deletions(-) diff --git a/locales/puppet.pot b/locales/puppet.pot index c9b9d220e45..bc8673e328a 100644 --- a/locales/puppet.pot +++ b/locales/puppet.pot @@ -6,11 +6,11 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Puppet automation framework 6.17.0-134-gc6e708372c\n" +"Project-Id-Version: Puppet automation framework 6.17.0-151-g0e5139e2c3\n" "\n" "Report-Msgid-Bugs-To: https://tickets.puppetlabs.com\n" -"POT-Creation-Date: 2020-08-06 13:13+0000\n" -"PO-Revision-Date: 2020-08-06 13:13+0000\n" +"POT-Creation-Date: 2020-08-06 23:27+0000\n" +"PO-Revision-Date: 2020-08-06 23:27+0000\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -57,12 +57,12 @@ msgid "The environmentpath setting cannot be empty or nil." msgstr "" #. TRANSLATORS: `message` is an already translated string of why SSL failed to initialize -#: ../lib/puppet.rb:257 +#: ../lib/puppet.rb:256 msgid "Failed to initialize SSL: %{message}" msgstr "" #. TRANSLATORS: `puppet agent -t` is a command and should not be translated -#: ../lib/puppet.rb:259 +#: ../lib/puppet.rb:258 msgid "Run `puppet agent -t`" msgstr "" @@ -284,23 +284,23 @@ msgstr "" msgid "No device found in %{config}" msgstr "" -#: ../lib/puppet/application/device.rb:316 +#: ../lib/puppet/application/device.rb:314 msgid "retrieving resource: %{resource} from %{target} at %{scheme}%{url_host}%{port}%{url_path}" msgstr "" -#: ../lib/puppet/application/device.rb:331 +#: ../lib/puppet/application/device.rb:329 msgid "retrieving facts from %{target} at %{scheme}%{url_host}%{port}%{url_path}" msgstr "" -#: ../lib/puppet/application/device.rb:354 +#: ../lib/puppet/application/device.rb:352 msgid "starting applying configuration to %{target} at %{scheme}%{url_host}%{port}%{url_path}" msgstr "" -#: ../lib/puppet/application/device.rb:392 ../lib/puppet/application/resource.rb:196 +#: ../lib/puppet/application/device.rb:388 ../lib/puppet/application/resource.rb:196 msgid "You must specify the type to display" msgstr "" -#: ../lib/puppet/application/device.rb:393 ../lib/puppet/application/resource.rb:197 +#: ../lib/puppet/application/device.rb:389 ../lib/puppet/application/resource.rb:197 msgid "Could not find type %{type}" msgstr "" @@ -560,77 +560,77 @@ msgstr "" msgid "Applied catalog in %{seconds} seconds" msgstr "" -#: ../lib/puppet/configurer.rb:219 ../lib/puppet/http/resolver/server_list.rb:68 +#: ../lib/puppet/configurer.rb:217 ../lib/puppet/http/resolver/server_list.rb:68 msgid "Could not select a functional puppet master from server_list: '%{server_list}'" msgstr "" -#: ../lib/puppet/configurer.rb:256 +#: ../lib/puppet/configurer.rb:254 msgid "Local environment: '%{local_env}' doesn't match the environment of the cached catalog '%{catalog_env}', switching agent to '%{catalog_env}'." msgstr "" -#: ../lib/puppet/configurer.rb:301 +#: ../lib/puppet/configurer.rb:299 msgid "Local environment: '%{local_env}' doesn't match server specified node environment '%{node_env}', switching agent to '%{node_env}'." msgstr "" -#: ../lib/puppet/configurer.rb:316 +#: ../lib/puppet/configurer.rb:314 msgid "Using configured environment '%{env}'" msgstr "" -#: ../lib/puppet/configurer.rb:320 +#: ../lib/puppet/configurer.rb:318 msgid "Unable to fetch my node definition, but the agent run will continue:" msgstr "" -#: ../lib/puppet/configurer.rb:348 +#: ../lib/puppet/configurer.rb:346 msgid "Not using catalog because its environment '%{catalog_env}' does not match agent specified environment '%{local_env}' and strict_environment_mode is set" msgstr "" -#: ../lib/puppet/configurer.rb:359 +#: ../lib/puppet/configurer.rb:357 msgid "Catalog environment didn't stabilize after %{tries} fetches, aborting run" msgstr "" -#: ../lib/puppet/configurer.rb:361 +#: ../lib/puppet/configurer.rb:359 msgid "Local environment: '%{local_env}' doesn't match server specified environment '%{catalog_env}', restarting agent run with environment '%{catalog_env}'" msgstr "" -#: ../lib/puppet/configurer.rb:402 +#: ../lib/puppet/configurer.rb:400 msgid "Failed to apply catalog: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:431 ../lib/puppet/http/resolver/server_list.rb:89 +#: ../lib/puppet/configurer.rb:429 ../lib/puppet/http/resolver/server_list.rb:89 msgid "Puppet server %{host}:%{port} is unavailable: %{code} %{reason}" msgstr "" #. TRANSLATORS 'server_list' is the name of a setting and should not be translated #. TRANSLATORS 'server_list' is the name of a setting and should not be translated -#: ../lib/puppet/configurer.rb:435 ../lib/puppet/http/resolver/server_list.rb:95 +#: ../lib/puppet/configurer.rb:433 ../lib/puppet/http/resolver/server_list.rb:95 msgid "Unable to connect to server from server_list setting: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:446 ../lib/puppet/face/report.rb:47 +#: ../lib/puppet/configurer.rb:444 ../lib/puppet/face/report.rb:47 msgid "Could not send report: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:455 +#: ../lib/puppet/configurer.rb:453 msgid "Could not save last run local report: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:474 +#: ../lib/puppet/configurer.rb:472 msgid "Uploading facts for %{node} to %{server}" msgstr "" -#: ../lib/puppet/configurer.rb:482 +#: ../lib/puppet/configurer.rb:480 msgid "Failed to submit facts: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:497 +#: ../lib/puppet/configurer.rb:495 msgid "Could not run command from %{setting}: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:515 +#: ../lib/puppet/configurer.rb:513 msgid "Could not retrieve catalog from cache: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:536 +#: ../lib/puppet/configurer.rb:534 msgid "Could not retrieve catalog from remote server: %{detail}" msgstr "" @@ -698,43 +698,43 @@ msgstr "" msgid "a data type can only have one implementation" msgstr "" -#: ../lib/puppet/defaults.rb:178 +#: ../lib/puppet/defaults.rb:156 msgid "Cannot disable unrecognized warning types '%{invalid}'." msgstr "" -#: ../lib/puppet/defaults.rb:179 +#: ../lib/puppet/defaults.rb:157 msgid "Valid values are '%{values}'." msgstr "" #. TRANSLATORS 'data_binding_terminus' is a setting and should not be translated -#: ../lib/puppet/defaults.rb:546 +#: ../lib/puppet/defaults.rb:524 msgid "Setting 'data_binding_terminus' is deprecated." msgstr "" #. TRANSLATORS 'hiera' should not be translated -#: ../lib/puppet/defaults.rb:548 +#: ../lib/puppet/defaults.rb:526 msgid "Convert custom terminus to hiera 5 API." msgstr "" #. TRANSLATORS 'environment_data_provider' is a setting and should not be translated -#: ../lib/puppet/defaults.rb:747 +#: ../lib/puppet/defaults.rb:725 msgid "Setting 'environment_data_provider' is deprecated." msgstr "" -#: ../lib/puppet/defaults.rb:830 +#: ../lib/puppet/defaults.rb:808 msgid "Certificate names must be lower case" msgstr "" -#: ../lib/puppet/defaults.rb:1024 +#: ../lib/puppet/defaults.rb:1002 msgid "Setting 'ssl_client_ca_auth' is deprecated." msgstr "" -#: ../lib/puppet/defaults.rb:1103 ../lib/puppet/settings/enum_setting.rb:13 ../lib/puppet/settings/symbolic_enum_setting.rb:14 +#: ../lib/puppet/defaults.rb:1081 ../lib/puppet/settings/enum_setting.rb:13 ../lib/puppet/settings/symbolic_enum_setting.rb:14 msgid "Invalid value '%{value}' for parameter %{name}. Allowed values are '%{allowed_values}'" msgstr "" #. TRANSLATORS 'pluginsync' is a setting and should not be translated -#: ../lib/puppet/defaults.rb:1969 +#: ../lib/puppet/defaults.rb:1947 msgid "Setting 'pluginsync' is deprecated." msgstr "" @@ -1481,11 +1481,11 @@ msgid "" " the files downloaded, which will be empty if none were retrieved.\n" msgstr "" -#: ../lib/puppet/face/plugin.rb:57 +#: ../lib/puppet/face/plugin.rb:54 msgid "No plugins downloaded." msgstr "" -#: ../lib/puppet/face/plugin.rb:59 +#: ../lib/puppet/face/plugin.rb:56 msgid "Downloaded these plugins: %{plugins}" msgstr "" @@ -2271,6 +2271,10 @@ msgstr "" msgid "Too many HTTP retries for %{addr}" msgstr "" +#: ../lib/puppet/http/pool.rb:85 +msgid "Failed to close connection for %{site}: %{detail}" +msgstr "" + #: ../lib/puppet/http/redirector.rb:78 msgid "Location response header is missing" msgstr "" @@ -3947,48 +3951,18 @@ msgstr "" msgid "Puppet::Network::HTTP::Compression::IdentityAdapter#uncompress is deprecated." msgstr "" -#: ../lib/puppet/network/http/connection.rb:56 +#: ../lib/puppet/network/http/connection.rb:44 msgid "Unrecognized option(s): %{opts}" msgstr "" -#: ../lib/puppet/network/http/connection.rb:63 +#: ../lib/puppet/network/http/connection.rb:51 msgid "Expected an instance of Puppet::SSL::Verifier but was passed a %{klass}" msgstr "" -#: ../lib/puppet/network/http/connection.rb:229 ../lib/puppet/network/http/connection_adapter.rb:174 +#: ../lib/puppet/network/http/connection.rb:281 msgid "Too many HTTP redirections for %{host}:%{port}" msgstr "" -#. TRANSLATORS: Used in the phrase: -#. "Received a response from the remote server." -#: ../lib/puppet/network/http/connection.rb:259 -msgid "the remote server" -msgstr "" - -#: ../lib/puppet/network/http/connection.rb:263 -msgid "Received a %{status_code} response from %{server_hostname}, but the Retry-After header value of \"%{retry_after}\" could not be converted to an integer or RFC 2822 date." -msgstr "" - -#: ../lib/puppet/network/http/connection.rb:274 -msgid "Received a %{status_code} response from %{server_hostname}. Sleeping for %{retry_sleep} seconds before retrying the request." -msgstr "" - -#: ../lib/puppet/network/http/connection.rb:335 -msgid "request %{uri} interrupted after %{elapsed} seconds" -msgstr "" - -#: ../lib/puppet/network/http/connection.rb:337 -msgid "request %{uri} timed out after %{elapsed} seconds" -msgstr "" - -#: ../lib/puppet/network/http/connection.rb:339 -msgid "request %{uri} failed: %{msg}" -msgstr "" - -#: ../lib/puppet/network/http/connection.rb:346 -msgid "Puppet::Network::HTTP::Connection is deprecated. Please use Puppet::Network::HTTP::ConnectionAdapter instead." -msgstr "" - #: ../lib/puppet/network/http/error.rb:23 msgid "Not Acceptable: %{message}" msgstr "" @@ -4033,14 +4007,6 @@ msgstr "" msgid "Could not resolve %{ip}: %{detail}" msgstr "" -#: ../lib/puppet/network/http/nocache_pool.rb:6 -msgid "Puppet::Network::HTTP::NoCachePool is deprecated." -msgstr "" - -#: ../lib/puppet/network/http/pool.rb:66 -msgid "Failed to close connection for %{site}: %{detail}" -msgstr "" - #: ../lib/puppet/network/http/request.rb:14 msgid "Unknown arguments: %{args}" msgstr "" @@ -4054,12 +4020,12 @@ msgid "Missing required Accept header" msgstr "" #. TRANSLATORS 'ssl_context' is an argument and should not be translated -#: ../lib/puppet/network/http_pool.rb:81 +#: ../lib/puppet/network/http_pool.rb:61 msgid "An ssl_context is required when connecting to 'https://%{host}:%{port}'" msgstr "" #. TRANSLATORS 'ssl_context' is an argument and should not be translated -#: ../lib/puppet/network/http_pool.rb:89 +#: ../lib/puppet/network/http_pool.rb:69 msgid "An ssl_context is unnecessary when connecting to 'http://%{host}:%{port}' and will be ignored" msgstr "" From 8fa4c3aaee752d6d81c16d723c317751d0ab566e Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Thu, 23 Jul 2020 20:57:34 -0700 Subject: [PATCH 039/731] (PUP-10252) Remove SSL related indirections and termini Puppet::SSL::Key will be deleted so exclude key face from documentation test --- docs/indirector.md | 9 - lib/puppet/application/key.rb | 5 +- lib/puppet/face/key.rb | 16 - lib/puppet/indirector/certificate/file.rb | 9 - .../indirector/certificate_request/file.rb | 9 - .../indirector/certificate_request/memory.rb | 7 - lib/puppet/indirector/key/file.rb | 46 --- lib/puppet/indirector/key/memory.rb | 7 - lib/puppet/indirector/ssl_file.rb | 157 --------- lib/puppet/reference/indirection.rb | 2 +- lib/puppet/ssl/certificate.rb | 6 - lib/puppet/ssl/certificate_request.rb | 7 - lib/puppet/ssl/key.rb | 7 - spec/integration/application/help_spec.rb | 2 + spec/unit/application/man_spec.rb | 3 +- spec/unit/face/key_spec.rb | 9 - spec/unit/http/factory_spec.rb | 4 - spec/unit/http/pool_spec.rb | 5 - spec/unit/indirector/certificate/file_spec.rb | 14 - .../certificate_request/file_spec.rb | 14 - spec/unit/indirector/key/file_spec.rb | 79 ----- spec/unit/indirector/ssl_file_spec.rb | 305 ------------------ spec/unit/ssl/certificate_request_spec.rb | 20 -- spec/unit/ssl/certificate_spec.rb | 8 - spec/unit/ssl/key_spec.rb | 8 - 25 files changed, 7 insertions(+), 751 deletions(-) delete mode 100644 lib/puppet/face/key.rb delete mode 100644 lib/puppet/indirector/certificate/file.rb delete mode 100644 lib/puppet/indirector/certificate_request/file.rb delete mode 100644 lib/puppet/indirector/certificate_request/memory.rb delete mode 100644 lib/puppet/indirector/key/file.rb delete mode 100644 lib/puppet/indirector/key/memory.rb delete mode 100644 lib/puppet/indirector/ssl_file.rb delete mode 100644 spec/unit/face/key_spec.rb delete mode 100644 spec/unit/indirector/certificate/file_spec.rb delete mode 100644 spec/unit/indirector/certificate_request/file_spec.rb delete mode 100644 spec/unit/indirector/key/file_spec.rb delete mode 100644 spec/unit/indirector/ssl_file_spec.rb diff --git a/docs/indirector.md b/docs/indirector.md index fffb4f55027..f9acb2c8b12 100644 --- a/docs/indirector.md +++ b/docs/indirector.md @@ -196,15 +196,6 @@ Get status locally. Only used internally. `rest` terminus Get puppet master's status via REST. Useful because it tests the health of both the web server and the indirector. -## Deprecated Indirected Types - -The following classes support indirections, but are not documented because they are deprecated and will be removed soon: - -* `Puppet::SSL::Certificate` -* `Puppet::SSL::CertificateRevocationList` -* `Puppet::SSL::CertificateRequest` -* `Puppet::SSL::Key` - ## Limitations Here are specific issues with the indirector: diff --git a/lib/puppet/application/key.rb b/lib/puppet/application/key.rb index 57835b62716..6d106a5a147 100644 --- a/lib/puppet/application/key.rb +++ b/lib/puppet/application/key.rb @@ -1,4 +1,3 @@ -require 'puppet/application/indirection_base' - -class Puppet::Application::Key < Puppet::Application::IndirectionBase +# Will be removed in PUP-10369 +class Puppet::Application::Key < Puppet::Application end diff --git a/lib/puppet/face/key.rb b/lib/puppet/face/key.rb deleted file mode 100644 index c2bbd9cd268..00000000000 --- a/lib/puppet/face/key.rb +++ /dev/null @@ -1,16 +0,0 @@ -require 'puppet/indirector/face' - -Puppet::Indirector::Face.define(:key, '0.0.1') do - copyright "Puppet Inc.", 2011 - license _("Apache 2 license; see COPYING") - - summary _("Create, save, and remove certificate keys.") - description <<-'EOT' - This subcommand manages certificate private keys. Keys are created - automatically by puppet agent and when certificate requests are generated - with 'puppet ssl submit_request'; it should not be necessary to use this - subcommand directly. - EOT - - deprecate -end diff --git a/lib/puppet/indirector/certificate/file.rb b/lib/puppet/indirector/certificate/file.rb deleted file mode 100644 index 4876846b737..00000000000 --- a/lib/puppet/indirector/certificate/file.rb +++ /dev/null @@ -1,9 +0,0 @@ -require 'puppet/indirector/ssl_file' -require 'puppet/ssl/certificate' - -# @deprecated -class Puppet::SSL::Certificate::File < Puppet::Indirector::SslFile - desc "Manage SSL certificates on disk." - - store_in :certdir -end diff --git a/lib/puppet/indirector/certificate_request/file.rb b/lib/puppet/indirector/certificate_request/file.rb deleted file mode 100644 index 18b54c42c68..00000000000 --- a/lib/puppet/indirector/certificate_request/file.rb +++ /dev/null @@ -1,9 +0,0 @@ -require 'puppet/indirector/ssl_file' -require 'puppet/ssl/certificate_request' - -# @deprecated -class Puppet::SSL::CertificateRequest::File < Puppet::Indirector::SslFile - desc "Manage the collection of certificate requests on disk." - - store_in :requestdir -end diff --git a/lib/puppet/indirector/certificate_request/memory.rb b/lib/puppet/indirector/certificate_request/memory.rb deleted file mode 100644 index e30450e7b40..00000000000 --- a/lib/puppet/indirector/certificate_request/memory.rb +++ /dev/null @@ -1,7 +0,0 @@ -require 'puppet/ssl/certificate_request' -require 'puppet/indirector/memory' - -# @deprecated -class Puppet::SSL::CertificateRequest::Memory < Puppet::Indirector::Memory - desc "Store certificate requests in memory. This is used for testing puppet." -end diff --git a/lib/puppet/indirector/key/file.rb b/lib/puppet/indirector/key/file.rb deleted file mode 100644 index 48fa94b654a..00000000000 --- a/lib/puppet/indirector/key/file.rb +++ /dev/null @@ -1,46 +0,0 @@ -require 'puppet/indirector/ssl_file' -require 'puppet/ssl/key' - -# @deprecated -class Puppet::SSL::Key::File < Puppet::Indirector::SslFile - desc "Manage SSL private and public keys on disk." - - store_in :privatekeydir - - def allow_remote_requests? - false - end - - # Where should we store the public key? - def public_key_path(name) - File.join(Puppet[:publickeydir], name.to_s + ".pem") - end - - # Remove the public key, in addition to the private key - def destroy(request) - super - - key_path = Puppet::FileSystem.pathname(public_key_path(request.key)) - return unless Puppet::FileSystem.exist?(key_path) - - begin - Puppet::FileSystem.unlink(key_path) - rescue => detail - raise Puppet::Error, _("Could not remove %{request} public key: %{detail}") % { request: request.key, detail: detail }, detail.backtrace - end - end - - # Save the public key, in addition to the private key. - def save(request) - super - - begin - # RFC 1421 states PEM is 7-bit ASCII https://tools.ietf.org/html/rfc1421 - Puppet.settings.setting(:publickeydir).open_file(public_key_path(request.key), 'w:ASCII') do |f| - f.print request.instance.content.public_key.to_pem - end - rescue => detail - raise Puppet::Error, _("Could not write %{request}: %{detail}") % { request: request.key, detail: detail }, detail.backtrace - end - end -end diff --git a/lib/puppet/indirector/key/memory.rb b/lib/puppet/indirector/key/memory.rb deleted file mode 100644 index 9e36586f15e..00000000000 --- a/lib/puppet/indirector/key/memory.rb +++ /dev/null @@ -1,7 +0,0 @@ -require 'puppet/ssl/key' -require 'puppet/indirector/memory' - -# @deprecated -class Puppet::SSL::Key::Memory < Puppet::Indirector::Memory - desc "Store keys in memory. This is used for testing puppet." -end diff --git a/lib/puppet/indirector/ssl_file.rb b/lib/puppet/indirector/ssl_file.rb deleted file mode 100644 index acfc4865b06..00000000000 --- a/lib/puppet/indirector/ssl_file.rb +++ /dev/null @@ -1,157 +0,0 @@ -require 'puppet/ssl' - -class Puppet::Indirector::SslFile < Puppet::Indirector::Terminus - # Specify the directory in which multiple files are stored. - def self.store_in(setting) - @directory_setting = setting - end - - # Specify a single file location for storing just one file. - # This is used for things like the CRL. - def self.store_at(setting) - @file_setting = setting - end - - class << self - attr_reader :directory_setting, :file_setting - end - - # The full path to where we should store our files. - def self.collection_directory - return nil unless directory_setting - Puppet.settings[directory_setting] - end - - # The full path to an individual file we would be managing. - def self.file_location - return nil unless file_setting - Puppet.settings[file_setting] - end - - def initialize - Puppet.settings.use(:main, :ssl) - - (collection_directory || file_location) or raise Puppet::DevError, _("No file or directory setting provided; terminus %{class_name} cannot function") % { class_name: self.class.name } - end - - def path(name) - if name =~ Puppet::Indirector::BadNameRegexp then - Puppet.crit(_("directory traversal detected in %{indirection}: %{name}") % { indirection: self.class, name: name.inspect }) - raise ArgumentError, _("invalid key") - end - - if collection_directory - File.join(collection_directory, name.to_s + ".pem") - else - file_location - end - end - - # Remove our file. - def destroy(request) - path = Puppet::FileSystem.pathname(path(request.key)) - return false unless Puppet::FileSystem.exist?(path) - - Puppet.notice _("Removing file %{model} %{request} at '%{path}'") % { model: model, request: request.key, path: path } - begin - Puppet::FileSystem.unlink(path) - rescue => detail - raise Puppet::Error, _("Could not remove %{request}: %{detail}") % { request: request.key, detail: detail }, detail.backtrace - end - end - - # Find the file on disk, returning an instance of the model. - def find(request) - filename = rename_files_with_uppercase(path(request.key)) - - filename ? create_model(request.key, filename) : nil - end - - # Save our file to disk. - def save(request) - path = path(request.key) - dir = File.dirname(path) - - raise Puppet::Error.new(_("Cannot save %{request}; parent directory %{dir} does not exist") % { request: request.key, dir: dir }) unless FileTest.directory?(dir) - raise Puppet::Error.new(_("Cannot save %{request}; parent directory %{dir} is not writable") % { request: request.key, dir: dir }) unless FileTest.writable?(dir) - - write(request.key, path) { |f| f.print request.instance.to_s } - end - - # Search for more than one file. At this point, it just returns - # an instance for every file in the directory. - def search(request) - dir = collection_directory - Dir.entries(dir). - select { |file| file =~ /\.pem$/ }. - collect { |file| create_model(file.sub(/\.pem$/, ''), File.join(dir, file)) }. - compact - end - - private - - def create_model(name, path) - result = model.new(name) - # calls Puppet::SSL::Base#read for subclasses of Puppet::SSL::Base - # with the exception of any overrides, like Puppet::SSL::Key - result.read(path) - result - end - - # Demeterish pointers to class info. - def collection_directory - self.class.collection_directory - end - - def file_location - self.class.file_location - end - - # A hack method to deal with files that exist with a different case. - # Just renames it; doesn't read it in or anything. - # LAK:NOTE This is a copy of the method in sslcertificates/support.rb, - # which we'll be EOL'ing at some point. This method was added at 20080702 - # and should be removed at some point. - def rename_files_with_uppercase(file) - return file if Puppet::FileSystem.exist?(file) - - dir, short = File.split(file) - return nil unless Puppet::FileSystem.exist?(dir) - - raise ArgumentError, _("Tried to fix SSL files to a file containing uppercase") unless short.downcase == short - real_file = Dir.entries(dir).reject { |f| f =~ /^\./ }.find do |other| - other.downcase == short - end - - return nil unless real_file - - full_file = File.join(dir, real_file) - - Puppet.deprecation_warning _("Automatic downcasing and renaming of ssl files is deprecated; please request the file using its correct case: %{full_file}") % { full_file: full_file } - File.rename(full_file, file) - - file - end - - # Yield a filehandle set up appropriately, either with our settings doing - # the work or opening a filehandle manually. - def write(name, path) - # All types serialized to disk contain only ASCII content: - # * SSL::Key may be a .export(OpenSSL::Cipher::DES.new(:EDE3, :CBC), pass) or .to_pem - # * All other classes are translated to strings by calling .to_pem - if file_location - Puppet.settings.setting(self.class.file_setting).open('w:ASCII') { |f| yield f } - else - setting = self.class.directory_setting - if setting - begin - Puppet.settings.setting(setting).open_file(path, 'w:ASCII') { |f| yield f } - rescue => detail - raise Puppet::Error, _("Could not write %{path} to %{setting}: %{detail}") % { path: path, setting: setting, detail: detail }, detail.backtrace - end - else - raise Puppet::DevError, _("You must provide a setting to determine where the files are stored") - end - end - end -end diff --git a/lib/puppet/reference/indirection.rb b/lib/puppet/reference/indirection.rb index 6bbbaa4555e..d42c94a42ca 100644 --- a/lib/puppet/reference/indirection.rb +++ b/lib/puppet/reference/indirection.rb @@ -46,7 +46,7 @@ These methods are available via the `indirection` class method on the indirected classes. For example: - foo_cert = Puppet::SSL::Certificate.indirection.find('foo.example.com') + node = Puppet::Node.indirection.find('foo.example.com') At startup, each indirection is configured with a terminus. In most cases, this is the default terminus defined by the indirected class, but it can be overridden by the application or face, or overridden with the `route_file` configuration. diff --git a/lib/puppet/ssl/certificate.rb b/lib/puppet/ssl/certificate.rb index fe9923cf6d6..c3d2079f6f2 100644 --- a/lib/puppet/ssl/certificate.rb +++ b/lib/puppet/ssl/certificate.rb @@ -11,12 +11,6 @@ class Puppet::SSL::Certificate < Puppet::SSL::Base # This is defined from the base class wraps OpenSSL::X509::Certificate - extend Puppet::Indirector - indirects :certificate, :terminus_class => :file, :doc => < :file, :doc => < :file, :doc => < @public_key) - - @key = double('key', :name => "myname", :content => @real_key) - - @request = double('request', :key => "myname", :instance => @key) - end - - it "should save the public key when saving the private key" do - fh = StringIO.new - - expect(Puppet.settings.setting(:publickeydir)).to receive(:open_file).with(@public_key_path, 'w:ASCII').and_yield(fh) - allow(Puppet.settings.setting(:privatekeydir)).to receive(:open_file) - expect(@public_key).to receive(:to_pem).and_return("my pem") - - @searcher.save(@request) - - expect(fh.string).to eq("my pem") - end - - it "should destroy the public key when destroying the private key" do - expect(Puppet::FileSystem).to receive(:unlink).with(Puppet::FileSystem.pathname(@private_key_path)) - expect(Puppet::FileSystem).to receive(:exist?).with(Puppet::FileSystem.pathname(@private_key_path)).and_return(true) - expect(Puppet::FileSystem).to receive(:exist?).with(Puppet::FileSystem.pathname(@public_key_path)).and_return(true) - expect(Puppet::FileSystem).to receive(:unlink).with(Puppet::FileSystem.pathname(@public_key_path)) - - @searcher.destroy(@request) - end - - it "should not fail if the public key does not exist when deleting the private key" do - allow(Puppet::FileSystem).to receive(:unlink).with(Puppet::FileSystem.pathname(@private_key_path)) - - allow(Puppet::FileSystem).to receive(:exist?).with(Puppet::FileSystem.pathname(@private_key_path)).and_return(true) - expect(Puppet::FileSystem).to receive(:exist?).with(Puppet::FileSystem.pathname(@public_key_path)).and_return(false) - expect(Puppet::FileSystem).not_to receive(:unlink).with(Puppet::FileSystem.pathname(@public_key_path)) - - @searcher.destroy(@request) - end - end -end diff --git a/spec/unit/indirector/ssl_file_spec.rb b/spec/unit/indirector/ssl_file_spec.rb deleted file mode 100644 index b0b629888e1..00000000000 --- a/spec/unit/indirector/ssl_file_spec.rb +++ /dev/null @@ -1,305 +0,0 @@ -require 'spec_helper' - -require 'puppet/indirector/ssl_file' - -describe Puppet::Indirector::SslFile do - include PuppetSpec::Files - - before(:all) do - class Puppet::SslTestModel - extend Puppet::Indirector - indirects :ssl_test_model - end - - class Puppet::SslTestModel::SslFile < Puppet::Indirector::SslFile - end - - Puppet::SslTestModel.indirection.terminus_class = :ssl_file - end - - after(:all) do - Puppet::SslTestModel.indirection.delete - Puppet.send(:remove_const, :SslTestModel) - end - - let(:terminus_class) { Puppet::SslTestModel::SslFile } - let(:model) { Puppet::SslTestModel } - - before :each do - @setting = :certdir - terminus_class.store_in @setting - terminus_class.store_at nil - @path = make_absolute("/thisdoesntexist/my_directory") - Puppet[:noop] = false - Puppet[@setting] = @path - Puppet[:trace] = false - end - - after :each do - terminus_class.store_in nil - terminus_class.store_at nil - end - - it "should use :main and :ssl upon initialization" do - expect(Puppet.settings).to receive(:use).with(:main, :ssl) - terminus_class.new - end - - it "should return a nil collection directory if no directory setting has been provided" do - terminus_class.store_in nil - expect(terminus_class.collection_directory).to be_nil - end - - it "should return a nil file location if no location has been provided" do - terminus_class.store_at nil - expect(terminus_class.file_location).to be_nil - end - - it "should fail if no store directory or file location has been set" do - expect(Puppet.settings).to receive(:use).with(:main, :ssl) - terminus_class.store_in nil - terminus_class.store_at nil - expect { - terminus_class.new - }.to raise_error(Puppet::DevError, /No file or directory setting provided/) - end - - describe "when managing ssl files" do - before do - allow(Puppet.settings).to receive(:use) - @searcher = terminus_class.new - - @cert = double('certificate', :name => "myname") - @certpath = File.join(@path, "myname.pem") - - @request = double('request', :key => @cert.name, :instance => @cert) - end - - describe "when choosing the location for certificates" do - it "should set them at the file location if a file setting is available" do - terminus_class.store_in nil - terminus_class.store_at :hostcrl - - Puppet[:hostcrl] = File.expand_path("/some/file") - - expect(@searcher.path(@cert.name)).to eq(Puppet[:hostcrl]) - end - - it "should set them in the setting directory, with the certificate name plus '.pem', if a directory setting is available" do - expect(@searcher.path(@cert.name)).to eq(@certpath) - end - - ['../foo', '..\\foo', './../foo', '.\\..\\foo', - '/foo', '//foo', '\\foo', '\\\\goo', - "test\0/../bar", "test\0\\..\\bar", - "..\\/bar", "/tmp/bar", "/tmp\\bar", "tmp\\bar", - " / bar", " /../ bar", " \\..\\ bar", - "c:\\foo", "c:/foo", "\\\\?\\UNC\\bar", "\\\\foo\\bar", - "\\\\?\\c:\\foo", "//?/UNC/bar", "//foo/bar", - "//?/c:/foo", - ].each do |input| - it "should resist directory traversal attacks (#{input.inspect})" do - expect { @searcher.path(input) }.to raise_error(ArgumentError, /invalid key/) - end - end - - # REVISIT: Should probably test MS-DOS reserved names here, too, since - # they would represent a vulnerability on a Win32 system, should we ever - # support that path. Don't forget that 'CON.foo' == 'CON' - # --daniel 2011-09-24 - end - - describe "when finding certificates on disk" do - describe "and no certificate is present" do - it "should return nil" do - expect(Puppet::FileSystem).to receive(:exist?).with(@path).and_return(true) - expect(Dir).to receive(:entries).with(@path).and_return([]) - expect(Puppet::FileSystem).to receive(:exist?).with(@certpath).and_return(false) - - expect(@searcher.find(@request)).to be_nil - end - end - - describe "and a certificate is present" do - let(:cert) { double('cert') } - let(:model) { double('model') } - - before(:each) do - allow(terminus_class).to receive(:model).and_return(model) - end - - context "is readable" do - it "should return an instance of the model, which it should use to read the certificate" do - expect(Puppet::FileSystem).to receive(:exist?).with(@certpath).and_return(true) - - expect(model).to receive(:new).with("myname").and_return(cert) - expect(cert).to receive(:read).with(@certpath) - - expect(@searcher.find(@request)).to equal(cert) - end - end - - context "is unreadable" do - it "should raise an exception" do - expect(Puppet::FileSystem).to receive(:exist?).with(@certpath).and_return(true) - - expect(model).to receive(:new).with("myname").and_return(cert) - expect(cert).to receive(:read).with(@certpath).and_raise(Errno::EACCES) - - expect { - @searcher.find(@request) - }.to raise_error(Errno::EACCES) - end - end - end - - describe "and a certificate is present but has uppercase letters" do - before do - @request = double('request', :key => "myhost") - end - - # This is kind of more an integration test; it's for #1382, until - # the support for upper-case certs can be removed around mid-2009. - it "should rename the existing file to the lower-case path" do - @path = @searcher.path("myhost") - expect(Puppet::FileSystem).to receive(:exist?).with(@path).and_return(false) - dir, file = File.split(@path) - expect(Puppet::FileSystem).to receive(:exist?).with(dir).and_return(true) - expect(Dir).to receive(:entries).with(dir).and_return([".", "..", "something.pem", file.upcase]) - - expect(File).to receive(:rename).with(File.join(dir, file.upcase), @path) - - cert = double('cert') - model = double('model') - allow(@searcher).to receive(:model).and_return(model) - expect(@searcher.model).to receive(:new).with("myhost").and_return(cert) - expect(cert).to receive(:read).with(@path) - - @searcher.find(@request) - end - end - end - - describe "when saving certificates to disk" do - before do - allow(FileTest).to receive(:directory?).and_return(true) - allow(FileTest).to receive(:writable?).and_return(true) - end - - it "should fail if the directory is absent" do - expect(FileTest).to receive(:directory?).with(File.dirname(@certpath)).and_return(false) - expect { @searcher.save(@request) }.to raise_error(Puppet::Error) - end - - it "should fail if the directory is not writeable" do - allow(FileTest).to receive(:directory?).and_return(true) - expect(FileTest).to receive(:writable?).with(File.dirname(@certpath)).and_return(false) - expect { @searcher.save(@request) }.to raise_error(Puppet::Error) - end - - it "should save to the path the output of converting the certificate to a string" do - fh = double('filehandle') - expect(fh).to receive(:print).with("mycert") - - allow(@searcher).to receive(:write).and_yield(fh) - expect(@cert).to receive(:to_s).and_return("mycert") - - @searcher.save(@request) - end - - describe "and a directory setting is set" do - it "should use the Settings class to write the file" do - @searcher.class.store_in @setting - fh = double('filehandle') - allow(fh).to receive(:print) - expect(Puppet.settings.setting(@setting)).to receive(:open_file).with(@certpath, 'w:ASCII').and_yield(fh) - - @searcher.save(@request) - end - end - - describe "and a file location is set" do - it "should use the filehandle provided by the Settings" do - @searcher.class.store_at @setting - - fh = double('filehandle') - allow(fh).to receive(:print) - expect(Puppet.settings.setting(@setting)).to receive(:open).with('w:ASCII').and_yield(fh) - @searcher.save(@request) - end - end - end - - describe "when destroying certificates" do - describe "that do not exist" do - before do - expect(Puppet::FileSystem).to receive(:exist?).with(Puppet::FileSystem.pathname(@certpath)).and_return(false) - end - - it "should return false" do - expect(@searcher.destroy(@request)).to be_falsey - end - end - - describe "that exist" do - it "should unlink the certificate file" do - path = Puppet::FileSystem.pathname(@certpath) - expect(Puppet::FileSystem).to receive(:exist?).with(path).and_return(true) - expect(Puppet::FileSystem).to receive(:unlink).with(path) - @searcher.destroy(@request) - end - - it "should log that is removing the file" do - allow(Puppet::FileSystem).to receive(:exist?).and_return(true) - allow(Puppet::FileSystem).to receive(:unlink) - expect(Puppet).to receive(:notice) - @searcher.destroy(@request) - end - end - end - - describe "when searching for certificates" do - let(:one) { double('one') } - let(:two) { double('two') } - let(:one_path) { File.join(@path, 'one.pem') } - let(:two_path) { File.join(@path, 'two.pem') } - let(:model) { double('model') } - - before :each do - allow(terminus_class).to receive(:model).and_return(model) - end - - it "should return a certificate instance for all files that exist" do - expect(Dir).to receive(:entries).with(@path).and_return(%w{. .. one.pem two.pem}) - - expect(model).to receive(:new).with("one").and_return(one) - expect(one).to receive(:read).with(one_path) - expect(model).to receive(:new).with("two").and_return(two) - expect(two).to receive(:read).with(two_path) - - expect(@searcher.search(@request)).to eq([one, two]) - end - - it "should raise an exception if any file is unreadable" do - expect(Dir).to receive(:entries).with(@path).and_return(%w{. .. one.pem two.pem}) - - expect(model).to receive(:new).with("one").and_return(one) - expect(one).to receive(:read).with(one_path) - expect(model).to receive(:new).with("two").and_return(two) - expect(two).to receive(:read).and_raise(Errno::EACCES) - - expect { - @searcher.search(@request) - }.to raise_error(Errno::EACCES) - end - - it "should skip any files that do not match /\.pem$/" do - expect(Dir).to receive(:entries).with(@path).and_return(%w{. .. one two.notpem}) - - expect(model).not_to receive(:new) - - expect(@searcher.search(@request)).to eq([]) - end - end - end -end diff --git a/spec/unit/ssl/certificate_request_spec.rb b/spec/unit/ssl/certificate_request_spec.rb index 57b404ead95..08268111486 100644 --- a/spec/unit/ssl/certificate_request_spec.rb +++ b/spec/unit/ssl/certificate_request_spec.rb @@ -11,14 +11,6 @@ k } - it "should be extended with the Indirector module" do - expect(described_class.singleton_class).to be_include(Puppet::Indirector) - end - - it "should indirect certificate_request" do - expect(described_class.indirection.name).to eq(:certificate_request) - end - it "should use any provided name as its name" do expect(described_class.new("myname").name).to eq("myname") end @@ -390,16 +382,4 @@ }.to raise_error(Puppet::Error) end end - - it "should save the CSR" do - csr = Puppet::SSL::CertificateRequest.new("me") - terminus = double('terminus') - allow(terminus).to receive(:validate) - expect(Puppet::SSL::CertificateRequest.indirection).to receive(:prepare).and_return(terminus) - expect(terminus).to receive(:save) do |request| - expect(request.instance).to eq(csr) - expect(request.key).to eq("me") - end - Puppet::SSL::CertificateRequest.indirection.save(csr) - end end diff --git a/spec/unit/ssl/certificate_spec.rb b/spec/unit/ssl/certificate_spec.rb index 06b826d4a7f..eecf9a08bfe 100644 --- a/spec/unit/ssl/certificate_spec.rb +++ b/spec/unit/ssl/certificate_spec.rb @@ -16,14 +16,6 @@ def sign_wrapped_cert(cert) @class = Puppet::SSL::Certificate end - it "should be extended with the Indirector module" do - expect(@class.singleton_class).to be_include(Puppet::Indirector) - end - - it "should indirect certificate" do - expect(@class.indirection.name).to eq(:certificate) - end - it "should only support the text format" do expect(@class.supported_formats).to eq([:s]) end diff --git a/spec/unit/ssl/key_spec.rb b/spec/unit/ssl/key_spec.rb index 446e1ad9a6d..1647d2a5c59 100644 --- a/spec/unit/ssl/key_spec.rb +++ b/spec/unit/ssl/key_spec.rb @@ -7,14 +7,6 @@ @class = Puppet::SSL::Key end - it "should be extended with the Indirector module" do - expect(@class.singleton_class).to be_include(Puppet::Indirector) - end - - it "should indirect key" do - expect(@class.indirection.name).to eq(:key) - end - it "should only support the text format" do expect(@class.supported_formats).to eq([:s]) end From c3e51da24d5d8759d2795ea871c97d5822bfda97 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Thu, 23 Jul 2020 21:10:45 -0700 Subject: [PATCH 040/731] (PUP-10252) Remove Puppet::SSL::Key We don't use or need to the Key wrapper class anymore. --- lib/puppet/ssl.rb | 1 - lib/puppet/ssl/base.rb | 1 - lib/puppet/ssl/certificate_request.rb | 6 +- lib/puppet/ssl/key.rb | 54 ------ spec/unit/certificate_factory_spec.rb | 2 +- spec/unit/context/trusted_information_spec.rb | 8 +- spec/unit/network/formats_spec.rb | 8 +- spec/unit/ssl/certificate_request_spec.rb | 40 ++--- spec/unit/ssl/certificate_spec.rb | 5 +- spec/unit/ssl/key_spec.rb | 165 ------------------ 10 files changed, 25 insertions(+), 265 deletions(-) delete mode 100644 lib/puppet/ssl/key.rb delete mode 100644 spec/unit/ssl/key_spec.rb diff --git a/lib/puppet/ssl.rb b/lib/puppet/ssl.rb index 5762df26432..e169a8b2df8 100644 --- a/lib/puppet/ssl.rb +++ b/lib/puppet/ssl.rb @@ -11,7 +11,6 @@ module Puppet::SSL # :nodoc: require 'puppet/ssl/verifier' require 'puppet/ssl/ssl_provider' require 'puppet/ssl/state_machine' - require 'puppet/ssl/key' require 'puppet/ssl/certificate' require 'puppet/ssl/certificate_request' require 'puppet/ssl/certificate_request_attributes' diff --git a/lib/puppet/ssl/base.rb b/lib/puppet/ssl/base.rb index ce98421cb47..694210e86a3 100644 --- a/lib/puppet/ssl/base.rb +++ b/lib/puppet/ssl/base.rb @@ -82,7 +82,6 @@ def self.from_s(string, name = nil) # Read content from disk appropriately. def read(path) # applies to Puppet::SSL::Certificate, Puppet::SSL::CertificateRequest - # Puppet::SSL::Key uses this, but also provides its own override # nothing derives from Puppet::SSL::Certificate, but it is called by a number of other SSL Indirectors: # Puppet::Indirector::CertificateStatus::File (.indirection.find) # Puppet::Network::HTTP::WEBrick (.indirection.find) diff --git a/lib/puppet/ssl/certificate_request.rb b/lib/puppet/ssl/certificate_request.rb index cf54693d5fe..fea88462507 100644 --- a/lib/puppet/ssl/certificate_request.rb +++ b/lib/puppet/ssl/certificate_request.rb @@ -40,8 +40,7 @@ def extension_factory # Create a certificate request with our system settings. # - # @param key [OpenSSL::X509::Key, Puppet::SSL::Key] The key pair associated - # with this CSR. + # @param key [OpenSSL::X509::Key] The private key associated with this CSR. # @param options [Hash] # @option options [String] :dns_alt_names A comma separated list of # Subject Alternative Names to include in the CSR extension request. @@ -57,9 +56,6 @@ def extension_factory def generate(key, options = {}) Puppet.info _("Creating a new SSL certificate request for %{name}") % { name: name } - # Support either an actual SSL key, or a Puppet key. - key = key.content if key.is_a?(Puppet::SSL::Key) - # If we're a CSR for the CA, then use the real ca_name, rather than the # fake 'ca' name. This is mostly for backward compatibility with 0.24.x, # but it's also just a good idea. diff --git a/lib/puppet/ssl/key.rb b/lib/puppet/ssl/key.rb deleted file mode 100644 index 2c945789ef5..00000000000 --- a/lib/puppet/ssl/key.rb +++ /dev/null @@ -1,54 +0,0 @@ -require 'puppet/ssl/base' - -# Manage private and public keys as a pair. -# -# @deprecated Use {Puppet::SSL::SSLProvider} instead. -class Puppet::SSL::Key < Puppet::SSL::Base - wraps OpenSSL::PKey::RSA - - # Because of how the format handler class is included, this - # can't be in the base class. - def self.supported_formats - [:s] - end - - attr_accessor :password_file - - # Knows how to create keys with our system defaults. - def generate - Puppet.info _("Creating a new SSL key for %{name}") % { name: name } - @content = OpenSSL::PKey::RSA.new(Puppet[:keylength].to_i) - end - - def initialize(name) - super - - @password_file = Puppet[:passfile] - end - - def password - return nil unless password_file and Puppet::FileSystem.exist?(password_file) - - # Puppet generates files at the default Puppet[:capass] using ASCII - # User configured :passfile could be in any encoding - # Use BINARY given the string is passed to an OpenSSL API accepting bytes - # note this is only called internally - Puppet::FileSystem.read(password_file, :encoding => Encoding::BINARY) - end - - # Optionally support specifying a password file. - def read(path) - return super unless password_file - - # RFC 1421 states PEM is 7-bit ASCII https://tools.ietf.org/html/rfc1421 - @content = wrapped_class.new(Puppet::FileSystem.read(path, :encoding => Encoding::ASCII), password) - end - - def to_s - if password - @content.export(OpenSSL::Cipher::DES.new(:EDE3, :CBC), password) - else - return super - end - end -end diff --git a/spec/unit/certificate_factory_spec.rb b/spec/unit/certificate_factory_spec.rb index ff22baa432c..a763df1af5f 100644 --- a/spec/unit/certificate_factory_spec.rb +++ b/spec/unit/certificate_factory_spec.rb @@ -7,7 +7,7 @@ let :serial do OpenSSL::BN.new('12') end let :name do "example.local" end let :x509_name do OpenSSL::X509::Name.new([['CN', name]]) end - let :key do Puppet::SSL::Key.new(name).generate end + let :key do OpenSSL::PKey::RSA.new(Puppet[:keylength]) end let :csr do csr = Puppet::SSL::CertificateRequest.new(name) csr.generate(key) diff --git a/spec/unit/context/trusted_information_spec.rb b/spec/unit/context/trusted_information_spec.rb index 229d5363a97..6a14b433788 100644 --- a/spec/unit/context/trusted_information_spec.rb +++ b/spec/unit/context/trusted_information_spec.rb @@ -4,11 +4,7 @@ require 'puppet/context/trusted_information' describe Puppet::Context::TrustedInformation, :unless => RUBY_PLATFORM == 'java' do - let(:key) do - key = Puppet::SSL::Key.new("myname") - key.generate - key - end + let(:key) { OpenSSL::PKey::RSA.new(Puppet[:keylength]) } let(:csr) do csr = Puppet::SSL::CertificateRequest.new("csr") @@ -26,7 +22,7 @@ # The cert must be signed so that it can be successfully be DER-decoded later signer = Puppet::SSL::CertificateSigner.new - signer.sign(cert.content, key.content) + signer.sign(cert.content, key) cert end diff --git a/spec/unit/network/formats_spec.rb b/spec/unit/network/formats_spec.rb index b2ed56179ca..1d63ab88712 100644 --- a/spec/unit/network/formats_spec.rb +++ b/spec/unit/network/formats_spec.rb @@ -161,19 +161,19 @@ def self.from_binary(data) end it 'raises when interning an instance of an unacceptable indirected type' do - obj = Puppet::SSL::Key.new('foo') + obj = :something expect { yaml.intern(obj.class, YAML.dump(obj)) - }.to raise_error(Puppet::Network::FormatHandler::FormatError, /Tried to load unspecified class: Puppet::SSL::Key/) + }.to raise_error(Puppet::Network::FormatHandler::FormatError, /Tried to load unspecified class: Symbol/) end it 'raises when interning multple instances of an unacceptable indirected type' do - obj = Puppet::SSL::Key.new('foo') + obj = :something expect { yaml.intern_multiple(obj.class, YAML.dump([obj])) - }.to raise_error(Puppet::Network::FormatHandler::FormatError, /Tried to load unspecified class: Puppet::SSL::Key/) + }.to raise_error(Puppet::Network::FormatHandler::FormatError, /Tried to load unspecified class: Symbol/) end end diff --git a/spec/unit/ssl/certificate_request_spec.rb b/spec/unit/ssl/certificate_request_spec.rb index 08268111486..1dc56486b65 100644 --- a/spec/unit/ssl/certificate_request_spec.rb +++ b/spec/unit/ssl/certificate_request_spec.rb @@ -1,15 +1,10 @@ require 'spec_helper' require 'puppet/ssl/certificate_request' -require 'puppet/ssl/key' describe Puppet::SSL::CertificateRequest do let(:request) { described_class.new("myname") } - let(:key) { - k = Puppet::SSL::Key.new("myname") - k.generate - k - } + let(:key) { OpenSSL::PKey::RSA.new(Puppet[:keylength]) } it "should use any provided name as its name" do expect(described_class.new("myname").name).to eq("myname") @@ -75,14 +70,9 @@ end describe "when generating", :unless => RUBY_PLATFORM == 'java' do - it "should use the content of the provided key if the key is a Puppet::SSL::Key instance" do + it "should verify the CSR using the public key associated with the private key" do request.generate(key) - expect(request.content.verify(key.content.public_key)).to be_truthy - end - - it "should set the subject to [CN, name]" do - request.generate(key) - expect(request.content.subject).to eq OpenSSL::X509::Name.new([['CN', key.name]]) + expect(request.content.verify(key.public_key)).to be_truthy end it "should set the version to 0" do @@ -93,7 +83,7 @@ it "should set the public key to the provided key's public key" do request.generate(key) # The openssl bindings do not define equality on keys so we use to_s - expect(request.content.public_key.to_s).to eq(key.content.public_key.to_s) + expect(request.content.public_key.to_s).to eq(key.public_key.to_s) end context "without subjectAltName / dns_alt_names" do @@ -287,20 +277,20 @@ it "should sign the csr with the provided key" do request.generate(key) - expect(request.content.verify(key.content.public_key)).to be_truthy + expect(request.content.verify(key.public_key)).to be_truthy end it "should verify the generated request using the public key" do # Stupid keys don't have a competent == method. expect_any_instance_of(OpenSSL::X509::Request).to receive(:verify) do |public_key| - public_key.to_s == key.content.public_key.to_s + public_key.to_s == key.public_key.to_s end.and_return(true) request.generate(key) end it "should fail if verification fails" do expect_any_instance_of(OpenSSL::X509::Request).to receive(:verify) do |public_key| - public_key.to_s == key.content.public_key.to_s + public_key.to_s == key.public_key.to_s end.and_return(false) expect do @@ -326,8 +316,8 @@ expect(OpenSSL::Digest).to receive(:const_defined?).with("SHA256").and_return(false) expect(OpenSSL::Digest).to receive(:const_defined?).with("SHA1").and_return(true) signer = Puppet::SSL::CertificateSigner.new - signer.sign(csr, key.content) - expect(csr.verify(key.content)).to be_truthy + signer.sign(csr, key) + expect(csr.verify(key)).to be_truthy end # Attempts to use SHA512 and SHA384 for signing certificates don't seem to work @@ -340,8 +330,8 @@ expect(OpenSSL::Digest).to receive(:const_defined?).with("SHA1").and_return(false) expect(OpenSSL::Digest).to receive(:const_defined?).with("SHA512").and_return(true) signer = Puppet::SSL::CertificateSigner.new - signer.sign(csr, key.content) - expect(csr.verify(key.content)).to be_truthy + signer.sign(csr, key) + expect(csr.verify(key)).to be_truthy end # Attempts to use SHA512 and SHA384 for signing certificates don't seem to work @@ -355,8 +345,8 @@ expect(OpenSSL::Digest).to receive(:const_defined?).with("SHA512").and_return(false) expect(OpenSSL::Digest).to receive(:const_defined?).with("SHA384").and_return(true) signer = Puppet::SSL::CertificateSigner.new - signer.sign(csr, key.content) - expect(csr.verify(key.content)).to be_truthy + signer.sign(csr, key) + expect(csr.verify(key)).to be_truthy end it "should use SHA224 to sign the csr when SHA256/SHA1/SHA512/SHA384 aren't available" do @@ -367,8 +357,8 @@ expect(OpenSSL::Digest).to receive(:const_defined?).with("SHA384").and_return(false) expect(OpenSSL::Digest).to receive(:const_defined?).with("SHA224").and_return(true) signer = Puppet::SSL::CertificateSigner.new - signer.sign(csr, key.content) - expect(csr.verify(key.content)).to be_truthy + signer.sign(csr, key) + expect(csr.verify(key)).to be_truthy end it "should raise an error if neither SHA256/SHA1/SHA512/SHA384/SHA224 are available" do diff --git a/spec/unit/ssl/certificate_spec.rb b/spec/unit/ssl/certificate_spec.rb index eecf9a08bfe..83994bf3aa1 100644 --- a/spec/unit/ssl/certificate_spec.rb +++ b/spec/unit/ssl/certificate_spec.rb @@ -4,7 +4,7 @@ require 'puppet/ssl/certificate' describe Puppet::SSL::Certificate do - let :key do Puppet::SSL::Key.new("test.localdomain").generate end + let :key do OpenSSL::PKey::RSA.new(Puppet[:keylength]) end # Sign the provided cert so that it can be DER-decoded later def sign_wrapped_cert(cert) @@ -74,8 +74,7 @@ def sign_wrapped_cert(cert) describe "when managing instances" do def build_cert(opts) - key = Puppet::SSL::Key.new('quux') - key.generate + key = OpenSSL::PKey::RSA.new(Puppet[:keylength]) csr = Puppet::SSL::CertificateRequest.new('quux') csr.generate(key, opts) diff --git a/spec/unit/ssl/key_spec.rb b/spec/unit/ssl/key_spec.rb deleted file mode 100644 index 1647d2a5c59..00000000000 --- a/spec/unit/ssl/key_spec.rb +++ /dev/null @@ -1,165 +0,0 @@ -require 'spec_helper' - -require 'puppet/ssl/key' - -describe Puppet::SSL::Key do - before do - @class = Puppet::SSL::Key - end - - it "should only support the text format" do - expect(@class.supported_formats).to eq([:s]) - end - - describe "when initializing" do - it "should downcase its name" do - expect(@class.new("MyName").name).to eq("myname") - end - - it "should set its password file to the default password file if it is not the CA key" do - Puppet[:passfile] = File.expand_path("/normal/pass") - - key = Puppet::SSL::Key.new("notca") - expect(key.password_file).to eq(Puppet[:passfile]) - end - end - - describe "when managing instances" do - before do - @key = @class.new("myname") - end - - it "should have a name attribute" do - expect(@key.name).to eq("myname") - end - - it "should have a content attribute" do - expect(@key).to respond_to(:content) - end - - it "should be able to read keys from disk" do - path = "/my/path" - expect(Puppet::FileSystem).to receive(:read).with(path, :encoding => Encoding::ASCII).and_return("my key") - key = double('key') - expect(OpenSSL::PKey::RSA).to receive(:new).and_return(key) - expect(@key.read(path)).to equal(key) - expect(@key.content).to equal(key) - end - - it "should not try to use the provided password file if the file does not exist" do - allow(Puppet::FileSystem).to receive(:exist?).and_return(false) - @key.password_file = "/path/to/password" - - path = "/my/path" - - allow(Puppet::FileSystem).to receive(:read).with(path, :encoding => Encoding::ASCII).and_return("my key") - expect(OpenSSL::PKey::RSA).to receive(:new).with("my key", nil).and_return(double('key')) - expect(Puppet::FileSystem).not_to receive(:read).with("/path/to/password", :encoding => Encoding::BINARY) - - @key.read(path) - end - - it "should read the key with the password retrieved from the password file if one is provided" do - allow(Puppet::FileSystem).to receive(:exist?).and_return(true) - @key.password_file = "/path/to/password" - - path = "/my/path" - expect(Puppet::FileSystem).to receive(:read).with(path, :encoding => Encoding::ASCII).and_return("my key") - expect(Puppet::FileSystem).to receive(:read).with("/path/to/password", :encoding => Encoding::BINARY).and_return("my password") - - key = double('key') - expect(OpenSSL::PKey::RSA).to receive(:new).with("my key", "my password").and_return(key) - expect(@key.read(path)).to equal(key) - expect(@key.content).to equal(key) - end - - it "should return an empty string when converted to a string with no key" do - expect(@key.to_s).to eq("") - end - - it "should convert the key to pem format when converted to a string" do - key = double('key', :to_pem => "pem") - @key.content = key - expect(@key.to_s).to eq("pem") - end - - it "should have a :to_text method that it delegates to the actual key" do - real_key = double('key') - expect(real_key).to receive(:to_text).and_return("keytext") - @key.content = real_key - expect(@key.to_text).to eq("keytext") - end - end - - describe "when generating the private key" do - before do - @instance = @class.new("test") - - @key = double('key') - end - - it "should create an instance of OpenSSL::PKey::RSA" do - expect(OpenSSL::PKey::RSA).to receive(:new).and_return(@key) - - @instance.generate - end - - it "should create the private key with the keylength specified in the settings" do - Puppet[:keylength] = 513 - expect(OpenSSL::PKey::RSA).to receive(:new).with(513).and_return(@key) - - @instance.generate - end - - it "should set the content to the generated key" do - allow(OpenSSL::PKey::RSA).to receive(:new).and_return(@key) - @instance.generate - expect(@instance.content).to equal(@key) - end - - it "should return the generated key" do - allow(OpenSSL::PKey::RSA).to receive(:new).and_return(@key) - expect(@instance.generate).to equal(@key) - end - - it "should return the key in pem format" do - @instance.generate - expect(@instance.content).to receive(:to_pem).and_return("my normal key") - expect(@instance.to_s).to eq("my normal key") - end - - describe "with a password file set" do - it "should return a nil password if the password file does not exist" do - expect(Puppet::FileSystem).to receive(:exist?).with("/path/to/pass").and_return(false) - expect(Puppet::FileSystem).not_to receive(:read).with("/path/to/pass", :encoding => Encoding::BINARY) - - @instance.password_file = "/path/to/pass" - - expect(@instance.password).to be_nil - end - - it "should return the contents of the password file as its password" do - expect(Puppet::FileSystem).to receive(:exist?).with("/path/to/pass").and_return(true) - expect(Puppet::FileSystem).to receive(:read).with("/path/to/pass", :encoding => Encoding::BINARY).and_return("my password") - - @instance.password_file = "/path/to/pass" - - expect(@instance.password).to eq("my password") - end - - it "should export the private key to text using the password" do - @instance.password_file = "/path/to/pass" - allow(@instance).to receive(:password).and_return("my password") - - expect(OpenSSL::PKey::RSA).to receive(:new).and_return(@key) - @instance.generate - - cipher = double('cipher') - expect(OpenSSL::Cipher::DES).to receive(:new).with(:EDE3, :CBC).and_return(cipher) - expect(@key).to receive(:export).with(cipher, "my password").and_return("my encrypted key") - - expect(@instance.to_s).to eq("my encrypted key") - end - end - end -end From f1bd76c5911aa17215c236c22e8dc2ae3ab0e7f1 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Thu, 23 Jul 2020 21:17:35 -0700 Subject: [PATCH 041/731] (PUP-10252) Remove Puppet::Util::SSL The subject_from_dn method is leftover from webrick/passenger and the handle_connection_error method is unused now that puppet uses Puppet::SSL::Verifier exclusively. Move the remaining cn_from_subject to Puppet::SSL::Base which is the only caller. --- lib/puppet/ssl/base.rb | 5 ++- lib/puppet/util/ssl.rb | 83 ---------------------------------- spec/unit/ssl/base_spec.rb | 39 ++++++++++++++-- spec/unit/util/ssl_spec.rb | 91 -------------------------------------- 4 files changed, 39 insertions(+), 179 deletions(-) delete mode 100644 lib/puppet/util/ssl.rb delete mode 100644 spec/unit/util/ssl_spec.rb diff --git a/lib/puppet/ssl/base.rb b/lib/puppet/ssl/base.rb index 694210e86a3..6d5ec46f34d 100644 --- a/lib/puppet/ssl/base.rb +++ b/lib/puppet/ssl/base.rb @@ -1,7 +1,6 @@ require 'puppet/ssl/openssl_loader' require 'puppet/ssl' require 'puppet/ssl/digest' -require 'puppet/util/ssl' # The base class for wrapping SSL instances. class Puppet::SSL::Base @@ -54,7 +53,9 @@ def initialize(name) # # @return [String] the name (CN) extracted from the subject. def self.name_from_subject(subject) - Puppet::Util::SSL.cn_from_subject(subject) + if subject.respond_to? :to_a + (subject.to_a.assoc('CN') || [])[1] + end end # Create an instance of our Puppet::SSL::* class using a given instance of the wrapped class diff --git a/lib/puppet/util/ssl.rb b/lib/puppet/util/ssl.rb deleted file mode 100644 index 0a1dd6a6edf..00000000000 --- a/lib/puppet/util/ssl.rb +++ /dev/null @@ -1,83 +0,0 @@ -require 'puppet/ssl/openssl_loader' - -## -# SSL is a private module with class methods that help work with x.509 -# subjects and errors. -# -# @api private -module Puppet::Util::SSL - - @@dn_parsers = nil - @@no_name = nil - - # Given a DN string, parse it into an OpenSSL certificate subject. This - # method will flexibly handle both OpenSSL and RFC2253 formats, as given by - # nginx and Apache, respectively. - # - # @param [String] dn the x.509 Distinguished Name (DN) string. - # - # @return [OpenSSL::X509::Name] the certificate subject - def self.subject_from_dn(dn) - if is_possibly_valid_dn?(dn) - parsers = @@dn_parsers ||= [ - OpenSSL::X509::Name.method(:parse_rfc2253), - OpenSSL::X509::Name.method(:parse_openssl) - ] - parsers.each do |parser| - begin - return parser.call(dn) - rescue OpenSSL::X509::NameError - end - end - end - - @@no_name ||= OpenSSL::X509::Name.new - end - - ## - # cn_from_subject extracts the CN from the given OpenSSL certificate - # subject. - # - # @api private - # - # @param [OpenSSL::X509::Name] subject the subject to extract the CN field from - # - # @return [String, nil] the CN, or nil if not found - def self.cn_from_subject(subject) - if subject.respond_to? :to_a - (subject.to_a.assoc('CN') || [])[1] - end - end - - def self.is_possibly_valid_dn?(dn) - dn =~ /=/ - end - - ## - # Extract and format meaningful error messages from OpenSSL::OpenSSLErrors - # and a Validator. Re-raises the error if unknown. - # - # @api private - # - # @param [OpenSSL::OpenSSLError] error An error thrown during creating a - # connection - # @param [Puppet::SSL::DefaultValidator] verifier A Validator who may have - # invalidated the connection - # @param [String] host The DNS name of the other end of the SSL connection - # - # @raises [Puppet::Error, OpenSSL::OpenSSLError] - def self.handle_connection_error(error, verifier, host) - # can be nil - peer_cert = verifier.peer_certs.last - - if error.message.include? "certificate verify failed" - msg = error.message - msg << ": [" + verifier.verify_errors.join('; ') + "]" - raise Puppet::Error, msg, error.backtrace - elsif peer_cert && !OpenSSL::SSL.verify_certificate_identity(peer_cert, host) - raise Puppet::SSL::CertMismatchError.new(peer_cert, host) - else - raise error - end - end -end diff --git a/spec/unit/ssl/base_spec.rb b/spec/unit/ssl/base_spec.rb index 554380f0b45..1a0d4434186 100644 --- a/spec/unit/ssl/base_spec.rb +++ b/spec/unit/ssl/base_spec.rb @@ -38,9 +38,8 @@ class TestCertificate < Puppet::SSL::Base describe "when determining a name from a certificate subject" do it "should extract only the CN and not any other components" do - subject = double('sub') - expect(Puppet::Util::SSL).to receive(:cn_from_subject).with(subject).and_return('host.domain.com') - expect(@class.name_from_subject(subject)).to eq('host.domain.com') + name = OpenSSL::X509::Name.parse('/CN=host.domain.com/L=Portland/ST=Oregon') + expect(@class.name_from_subject(name)).to eq('host.domain.com') end end @@ -90,4 +89,38 @@ class TestCertificate < Puppet::SSL::Base }.to raise_error(Puppet::Error, "Unknown signature algorithm 'nonsense'") end end + + describe "when getting a CN from a subject" do + def parse(dn) + OpenSSL::X509::Name.parse(dn) + end + + def cn_from(subject) + @class.name_from_subject(subject) + end + + it "should correctly parse a subject containing only a CN" do + subj = parse('/CN=foo') + expect(cn_from(subj)).to eq('foo') + end + + it "should correctly parse a subject containing other components" do + subj = parse('/CN=Root CA/OU=Server Operations/O=Example Org') + expect(cn_from(subj)).to eq('Root CA') + end + + it "should correctly parse a subject containing other components with CN not first" do + subj = parse('/emailAddress=foo@bar.com/CN=foo.bar.com/O=Example Org') + expect(cn_from(subj)).to eq('foo.bar.com') + end + + it "should return nil for a subject with no CN" do + subj = parse('/OU=Server Operations/O=Example Org') + expect(cn_from(subj)).to eq(nil) + end + + it "should return nil for a bare string" do + expect(cn_from("/CN=foo")).to eq(nil) + end + end end diff --git a/spec/unit/util/ssl_spec.rb b/spec/unit/util/ssl_spec.rb deleted file mode 100644 index f7d2ecfbd53..00000000000 --- a/spec/unit/util/ssl_spec.rb +++ /dev/null @@ -1,91 +0,0 @@ -require 'spec_helper' - -require 'openssl' -require 'puppet/util/ssl' - -describe Puppet::Util::SSL do - def parse(dn) - Puppet::Util::SSL.subject_from_dn(dn) - end - - describe "when getting a subject from a DN" do - RSpec::Matchers.define :be_a_subject_with do |expected| - match do |actual| - parts = actual.to_a.map { |part| part[0..1] }.flatten - Hash[*parts] == expected - end - end - - NO_PARTS = {} - - it "parses a DN with a single part" do - expect(parse('CN=client.example.org')).to be_a_subject_with({ - 'CN' => 'client.example.org' - }) - end - - it "parses a DN with parts separated by slashes" do - expect(parse('/CN=Root CA/OU=Server Operations/O=Example Org')).to be_a_subject_with({ - 'CN' => 'Root CA', - 'OU' => 'Server Operations', - 'O' => 'Example Org' - }) - end - - it "parses a DN with a single part preceded by a slash" do - expect(parse('/CN=client.example.org')).to be_a_subject_with({ - 'CN' => 'client.example.org' - }) - end - - it "parses a DN with parts separated by commas" do - expect(parse('O=Foo\, Inc,CN=client2a.example.org')).to be_a_subject_with({ - 'O' => 'Foo, Inc', - 'CN' => 'client2a.example.org' - }) - end - - it "finds no parts in something that is not a DN" do - expect(parse('(no)')).to be_a_subject_with(NO_PARTS) - end - - it "finds no parts in a DN with an invalid part" do - expect(parse('no=yes,CN=Root CA')).to be_a_subject_with(NO_PARTS) - end - - it "finds no parts in an empty DN" do - expect(parse('')).to be_a_subject_with(NO_PARTS) - end - end - - describe "when getting a CN from a subject" do - def cn_from(subject) - Puppet::Util::SSL.cn_from_subject(subject) - end - - it "should correctly parse a subject containing only a CN" do - subj = parse('/CN=foo') - expect(cn_from(subj)).to eq('foo') - end - - it "should correctly parse a subject containing other components" do - subj = parse('/CN=Root CA/OU=Server Operations/O=Example Org') - expect(cn_from(subj)).to eq('Root CA') - end - - it "should correctly parse a subject containing other components with CN not first" do - subj = parse('/emailAddress=foo@bar.com/CN=foo.bar.com/O=Example Org') - expect(cn_from(subj)).to eq('foo.bar.com') - end - - it "should return nil for a subject with no CN" do - subj = parse('/OU=Server Operations/O=Example Org') - expect(cn_from(subj)).to eq(nil) - end - - it "should return nil for a bare string" do - expect(cn_from("/CN=foo")).to eq(nil) - end - end -end - From c09c5339875a4bf63f99c58477f7d88b1aa35b15 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Thu, 23 Jul 2020 21:20:19 -0700 Subject: [PATCH 042/731] (PUP-10438) Remove Puppet::Rest The Puppet::Rest code used to make certificate related requests, but that changed when the ssl state machine was added. --- lib/puppet/http.rb | 1 + lib/puppet/rest/errors.rb | 15 ---- lib/puppet/rest/response.rb | 35 -------- lib/puppet/rest/route.rb | 85 ------------------ lib/puppet/rest/routes.rb | 135 ---------------------------- lib/puppet/ssl.rb | 2 - lib/puppet/test/test_helper.rb | 2 - lib/puppet/util/connection.rb | 88 ------------------ spec/unit/rest/route_spec.rb | 132 --------------------------- spec/unit/ssl/state_machine_spec.rb | 1 - 10 files changed, 1 insertion(+), 495 deletions(-) delete mode 100644 lib/puppet/rest/errors.rb delete mode 100644 lib/puppet/rest/response.rb delete mode 100644 lib/puppet/rest/route.rb delete mode 100644 lib/puppet/rest/routes.rb delete mode 100644 lib/puppet/util/connection.rb delete mode 100644 spec/unit/rest/route_spec.rb diff --git a/lib/puppet/http.rb b/lib/puppet/http.rb index 3e235a8147f..abf3bd19f73 100644 --- a/lib/puppet/http.rb +++ b/lib/puppet/http.rb @@ -1,6 +1,7 @@ module Puppet module Network module HTTP + require 'puppet/network/http_pool' require 'puppet/network/resolver' end end diff --git a/lib/puppet/rest/errors.rb b/lib/puppet/rest/errors.rb deleted file mode 100644 index 52f1a77296e..00000000000 --- a/lib/puppet/rest/errors.rb +++ /dev/null @@ -1,15 +0,0 @@ -# @deprecated Use {Puppet::HTTP::Client} instead. -module Puppet::Rest - class ResponseError < Puppet::Error - attr_reader :response - - # Error thrown when request status is not OK. - # @param [String] msg the error message - # @param [Puppet::Rest::Response] response the response from the failed - # request - def initialize(msg, response = nil) - super(msg) - @response = response - end - end -end diff --git a/lib/puppet/rest/response.rb b/lib/puppet/rest/response.rb deleted file mode 100644 index 4c8121c934f..00000000000 --- a/lib/puppet/rest/response.rb +++ /dev/null @@ -1,35 +0,0 @@ -# @deprecated Use {Puppet::HTTP::Client} instead. -module Puppet::Rest - # This is a wrapper for the HTTP::Message class of the HTTPClient - # gem. It is designed to wrap a message sent as an HTTP response. - class Response - def initialize(message) - @message = message - end - - def body - @message.body - end - - def content_type - @message.content_type - end - - def content_encoding - @message.headers['Content-Encoding'] - end - - def status_code - @message.status - end - - def ok? - @message.ok? - end - - def to_exception - message = _("Error %{code} on SERVER: %{returned_message}") % { code: status_code, returned_message: body } - Puppet::Rest::ResponseError.new(message, self) - end - end -end diff --git a/lib/puppet/rest/route.rb b/lib/puppet/rest/route.rb deleted file mode 100644 index 8ee71571f20..00000000000 --- a/lib/puppet/rest/route.rb +++ /dev/null @@ -1,85 +0,0 @@ -require 'uri' -require 'puppet/util/connection' - -# @deprecated Use {Puppet::HTTP::Client} instead. -module Puppet::Rest - class Route - attr_reader :server - - # Create a Route containing information for querying the given API, - # hosted at a server determined either by SRV service or by the - # fallback server on the fallback port. - # @param [String] api the path leading to the root of the API. Must - # contain a trailing slash for proper endpoint path - # construction - # @param [Symbol] server_setting the setting to check for special - # server configuration - # @param [Symbol] port_setting the setting to check for speical - # port configuration - # @param [Symbol] srv_service the name of the service when using SRV - # records - def initialize(api:, server_setting: :server, port_setting: :masterport, srv_service: :puppet) - @api = api - @default_server = Puppet::Util::Connection.determine_server(server_setting) - @default_port = Puppet::Util::Connection.determine_port(port_setting, server_setting) - @srv_service = srv_service - end - - # Select a server and port to create a base URL for the API specified by this - # route. If the connection fails and SRV records are in use, the next suitable - # server will be tried. If SRV records are not in use or no successful connection - # could be made, fall back to the configured server and port for this API, taking - # into account failover settings. - # @parma [Puppet::Network::Resolver] dns_resolver the DNS resolver to use to check - # SRV records - # @yield [URI] supply a base URL to make a request with - # @raise [Puppet::Error] if connection to selected server and port fails, and SRV - # records are not in use - def with_base_url(dns_resolver) - if @server && @port - # First try connecting to the previously selected server and port. - begin - return yield(base_url) - rescue SystemCallError => e - if Puppet[:use_srv_records] - Puppet.debug "Connection to cached server and port #{@server}:#{@port} failed, reselecting." - else - raise Puppet::Error, _("Connection to cached server and port %{server}:%{port} failed: %{message}") % - { server: @server, port: @port, message: e.message } - end - end - end - - if Puppet[:use_srv_records] - dns_resolver.each_srv_record(Puppet[:srv_domain], @srv_service) do |srv_server, srv_port| - # Try each of the servers for this service in weighted order - # until a working one is found. - begin - @server = srv_server - @port = srv_port - return yield(base_url) - rescue SystemCallError - Puppet.debug "Connection to selected server and port #{@server}:#{@port} failed. Trying next cached SRV record." - @server = nil - @port = nil - end - end - end - - # If not using SRV records, fall back to the defaults calculated above - @server = @default_server - @port = @default_port - - Puppet.debug "No more servers in SRV record, falling back to #{@server}:#{@port}" if Puppet[:use_srv_records] - return yield(base_url) - end - - private - - # Returns a URI built from the information stored by this route, - # e.g. 'https://myserver.com:555/myapi/v1/' - def base_url - URI::HTTPS.build(host: @server, port: @port, path: @api) - end - end -end diff --git a/lib/puppet/rest/routes.rb b/lib/puppet/rest/routes.rb deleted file mode 100644 index 7ebdc2ae469..00000000000 --- a/lib/puppet/rest/routes.rb +++ /dev/null @@ -1,135 +0,0 @@ -require 'time' -require 'puppet/rest/route' -require 'puppet/network/http_pool' -require 'puppet/network/http/compression' - -# @deprecated Use {Puppet::HTTP::Client} instead. -module Puppet::Rest - module Routes - extend Puppet::Network::HTTP::Compression.module - - ACCEPT_ENCODING = 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3' - - def self.ca - Puppet.deprecation_warning("Puppet::Rest::Routes is deprecated, use Puppet::HTTP::Client instead") - - @ca ||= Route.new(api: '/puppet-ca/v1/', - server_setting: :ca_server, - port_setting: :ca_port, - srv_service: :ca) - end - - def self.clear - @ca = nil - end - - # Make an HTTP request to fetch the named certificate. - # - # @param name [String] the name of the certificate to fetch - # @param ssl_context [Puppet::SSL::SSLContext] the ssl content to use when making the request - # @raise [Puppet::Rest::ResponseError] if the response status is not OK - # @return [String] the PEM-encoded certificate or certificate bundle - def self.get_certificate(name, ssl_context) - ca.with_base_url(Puppet::Network::Resolver.new) do |url| - header = { 'Accept' => 'text/plain', 'Accept-Encoding' => ACCEPT_ENCODING } - url.path += "certificate/#{name}" - - use_ssl = url.is_a? URI::HTTPS - - client = Puppet::Network::HttpPool.connection(url.host, url.port, use_ssl: use_ssl, ssl_context: ssl_context) - - response = client.get(url.request_uri, header) - unless response.code.to_i == 200 - raise Puppet::Rest::ResponseError.new(response.message, response) - end - - Puppet.info _("Downloaded certificate for %{name} from %{server}") % { name: name, server: ca.server } - - uncompress_body(response) - end - end - - # Make an HTTP request to fetch the named crl. - # - # @param name [String] name of the crl to fetch - # @param ssl_context [Puppet::SSL::SSLContext] the ssl content to use when making the request - # @param if_modified_since [Time, nil] If non-nil, then only download the CRL if it has been - # modified since the specified time. - # @raise [Puppet::Rest::ResponseError] if the response status is not OK - # @return [String] the PEM-encoded crl - def self.get_crls(name, ssl_context, if_modified_since: nil) - ca.with_base_url(Puppet::Network::Resolver.new) do |url| - header = { 'Accept' => 'text/plain', 'Accept-Encoding' => ACCEPT_ENCODING } - header['If-Modified-Since'] = if_modified_since.httpdate if if_modified_since - - url.path += "certificate_revocation_list/#{name}" - - use_ssl = url.is_a? URI::HTTPS - - client = Puppet::Network::HttpPool.connection(url.host, url.port, use_ssl: use_ssl, ssl_context: ssl_context) - - response = client.get(url.request_uri, header) - unless response.code.to_i == 200 - raise Puppet::Rest::ResponseError.new(response.message, response) - end - - Puppet.info _("Downloaded certificate revocation list for %{name} from %{server}") % { name: name, server: ca.server } - - uncompress_body(response) - end - end - - # Make an HTTP request to send the named CSR. - # - # @param csr_pem [String] the contents of the CSR to sent to the CA - # @param name [String] the name of the host whose CSR is being submitted - # @param ssl_context [Puppet::SSL::SSLContext] the ssl content to use when making the request - # @raise [Puppet::Rest::ResponseError] if the response status is not OK - def self.put_certificate_request(csr_pem, name, ssl_context) - ca.with_base_url(Puppet::Network::Resolver.new) do |url| - header = { 'Accept' => 'text/plain', - 'Accept-Encoding' => ACCEPT_ENCODING, - 'Content-Type' => 'text/plain' } - url.path += "certificate_request/#{name}" - - use_ssl = url.is_a? URI::HTTPS - - client = Puppet::Network::HttpPool.connection(url.host, url.port, use_ssl: use_ssl, ssl_context: ssl_context) - - response = client.put(url.request_uri, csr_pem, header) - if response.code.to_i == 200 - Puppet.debug "Submitted certificate request to server." - else - raise Puppet::Rest::ResponseError.new(response.message, response) - end - end - end - - # Make an HTTP request to get the named CSR. - # - # @param name [String] the name of the host whose CSR is being queried - # @param ssl_context [Puppet::SSL::SSLContext] the ssl content to use when making the request - # @raise [Puppet::Rest::ResponseError] if the response status is not OK - # @return [String] the PEM encoded certificate request - # @deprecated - def self.get_certificate_request(name, ssl_context) - ca.with_base_url(Puppet::Network::Resolver.new) do |url| - header = { 'Accept' => 'text/plain', 'Accept-Encoding' => ACCEPT_ENCODING } - url.path += "certificate_request/#{name}" - - use_ssl = url.is_a? URI::HTTPS - - client = Puppet::Network::HttpPool.connection(url.host, url.port, use_ssl: use_ssl, ssl_context: ssl_context) - - response = client.get(url.request_uri, header) - unless response.code.to_i == 200 - raise Puppet::Rest::ResponseError.new(response.message, response) - end - - Puppet.debug _("Downloaded existing certificate request for %{name} from %{server}") % { name: name, server: ca.server } - - uncompress_body(response) - end - end - end -end diff --git a/lib/puppet/ssl.rb b/lib/puppet/ssl.rb index e169a8b2df8..2b9625ebfcb 100644 --- a/lib/puppet/ssl.rb +++ b/lib/puppet/ssl.rb @@ -14,6 +14,4 @@ module Puppet::SSL # :nodoc: require 'puppet/ssl/certificate' require 'puppet/ssl/certificate_request' require 'puppet/ssl/certificate_request_attributes' - require 'puppet/rest/errors' - require 'puppet/rest/routes' end diff --git a/lib/puppet/test/test_helper.rb b/lib/puppet/test/test_helper.rb index 7cc89901be2..0f1ad25bab7 100644 --- a/lib/puppet/test/test_helper.rb +++ b/lib/puppet/test/test_helper.rb @@ -147,8 +147,6 @@ def self.before_each_test() Puppet::Application.clear! Puppet::Util::Profiler.clear - Puppet::Rest::Routes.clear - Puppet::Node::Facts.indirection.terminus_class = :memory facts = Puppet::Node::Facts.new(Puppet[:node_name_value]) Puppet::Node::Facts.indirection.save(facts) diff --git a/lib/puppet/util/connection.rb b/lib/puppet/util/connection.rb deleted file mode 100644 index 0e4a82ff7e4..00000000000 --- a/lib/puppet/util/connection.rb +++ /dev/null @@ -1,88 +0,0 @@ -require 'puppet' -require 'puppet/util/warnings' - -module Puppet::Util - module Connection - extend Puppet::Util::Warnings - - # The logic for server and port is kind of gross. In summary: - # IF an endpoint-specific setting is requested AND that setting has been set by the user - # Use that setting. - # The defaults for these settings are the "normal" server/masterport settings, so - # when they are unset we instead want to "fall back" to the failover-selected - # host/port pair. - # ELSE IF we have a failover-selected host/port - # Use what the failover logic came up with - # ELSE IF the server_list setting is in use - # Use the first entry - failover hasn't happened yet, but that - # setting is still authoritative - # ELSE - # Go for the legacy server/masterport settings, and hope for the best - - # Determines which server to use based on the specified setting, taking into - # account HA fallback from server_list. - # @param [Symbol] setting The preferred server setting to use - # @return [String] the name of the server for use in the request - def self.determine_server(setting) - if setting && setting != :server && Puppet.settings.set_by_config?(setting) - debug_once _("Selected server from the %{setting} setting: %{server}") % {setting: setting, server: Puppet.settings[setting]} - Puppet[setting] - else - server = Puppet.lookup(:server) do - primary_server = Puppet.settings[:server_list][0] - if primary_server - #TRANSLATORS 'server_list' is the name of a setting and should not be translated - debug_once _("Dynamically-bound server lookup failed; using first entry from the `server_list` setting: %{server}") % {server: primary_server[0]} - primary_server[0] - else - setting ||= :server - debug_once _("Dynamically-bound server lookup failed, falling back to %{setting} setting: %{server}") % {setting: setting, server: Puppet.settings[setting]} - Puppet.settings[setting] - end - end - server - end - end - - # Determines which port to use based on the specified setting, taking into - # account HA fallback from server_list. - # For port there's a little bit of an extra snag: setting a specific - # server setting and relying on the default port for that server is - # common, so we also want to check if the assocaited SERVER setting - # has been set by the user. If either of those are set we ignore the - # failover-selected port. - # @param [Symbol] port_setting The preferred port setting to use - # @param [Symbol] server_setting The server setting assoicated with this route. - # @return [Integer] the port to use for use in the request - def self.determine_port(port_setting, server_setting) - if (port_setting && port_setting != :masterport && Puppet.settings.set_by_config?(port_setting)) || - (server_setting && server_setting != :server && Puppet.settings.set_by_config?(server_setting)) - debug_once _("Selected port from the %{setting} setting: %{port}") % {setting: port_setting, port: Puppet.settings[port_setting].to_i} - Puppet.settings[port_setting].to_i - else - port = Puppet.lookup(:serverport) do - primary_server = Puppet.settings[:server_list][0] - if primary_server - # Port might not be set, so we want to fallback in that - # case. We know we don't need to use `setting` here, since - # the default value of every port setting is `masterport` - if primary_server[1] - #TRANSLATORS 'server_list' is the name of a setting and should not be translated - debug_once _("Dynamically-bound port lookup failed; using first entry from the `server_list` setting: %{port}") % {port: primary_server[1]} - primary_server[1] - else - #TRANSLATORS 'masterport' is the name of a setting and should not be translated - debug_once _("Dynamically-bound port lookup failed; falling back to `masterport` setting: %{port}") % {port: Puppet.settings[:masterport]} - Puppet.settings[:masterport] - end - else - port_setting ||= :masterport - debug_once _("Dynamically-bound port lookup failed; falling back to %{setting} setting: %{port}") % {setting: port_setting, port: Puppet.settings[port_setting]} - Puppet.settings[port_setting] - end - end - port.to_i - end - end - end -end diff --git a/spec/unit/rest/route_spec.rb b/spec/unit/rest/route_spec.rb deleted file mode 100644 index 57cefbe3e30..00000000000 --- a/spec/unit/rest/route_spec.rb +++ /dev/null @@ -1,132 +0,0 @@ -require 'spec_helper' - -require 'puppet/rest/route' - -describe Puppet::Rest::Route do - describe '#with_base_url'do - let(:dns_resolver) { double('dns resolver') } - - context 'when not using SRV records' do - before :each do - Puppet.settings[:use_srv_records] = false - end - - it "yields a base URL with the values from the specified settings" do - Puppet[:ca_server] = 'testserver' - Puppet[:ca_port] = 555 - ca_route = Puppet::Rest::Route.new(api: '/fakeapi/v1/', - server_setting: :ca_server, - port_setting: :ca_port, - srv_service: :test_service) - count = 0 - rval = ca_route.with_base_url(dns_resolver) do |url| - count += 1 - expect(url.to_s).to eq('https://testserver:555/fakeapi/v1/') - 'Block return value' - end - expect(count).to eq(1) - expect(rval).to eq('Block return value') - end - - it "yields a base URL with Puppet's configured server and port when no defaults are specified" do - Puppet[:server] = 'configured.net' - Puppet[:masterport] = 8140 - fallback_route = Puppet::Rest::Route.new(api: '/fakeapi/v1/') - count = 0 - rval = fallback_route.with_base_url(dns_resolver) do |url| - count += 1 - expect(url.to_s).to eq('https://configured.net:8140/fakeapi/v1/') - 'Block return value' - end - expect(count).to eq(1) - expect(rval).to eq('Block return value') - end - - it 'yields the first entry in the server list when server_list is in use' do - Puppet[:server_list] = [['one.net', 111], ['two.net', 222]] - fallback_route = Puppet::Rest::Route.new(api: '/fakeapi/v1/') - count = 0 - rval = fallback_route.with_base_url(dns_resolver) do |url| - count += 1 - expect(url.to_s).to eq('https://one.net:111/fakeapi/v1/') - 'Block return value' - end - expect(count).to eq(1) - expect(rval).to eq('Block return value') - end - - it 'falls back to :server and :masterport if nil is passed' do - Puppet[:server] = 'one.net' - Puppet[:masterport] = 111 - nil_route = Puppet::Rest::Route.new(api: '/fakeapi/v1/', - server_setting: nil, - port_setting: nil) - count = 0 - rval = nil_route.with_base_url(dns_resolver) do |url| - count += 1 - expect(url.to_s).to eq('https://one.net:111/fakeapi/v1/') - 'Block return value' - end - expect(count).to eq(1) - expect(rval).to eq('Block return value') - end - end - - context 'when using SRV records' do - context "when SRV returns servers" do - let(:route) { Puppet::Rest::Route.new(api: '/fakeapi/v1/', - srv_service: :test_service) } - - before :each do - Puppet.settings[:use_srv_records] = true - Puppet.settings[:srv_domain] = 'example.com' - - @dns_mock = double('dns') - expect(Resolv::DNS).to receive(:new).and_return(@dns_mock) - - @port = 7502 - @target = 'example.com' - record = Resolv::DNS::Resource::IN::SRV.new(0, 0, @port, @target) - record.instance_variable_set(:@ttl, 10) - @srv_records = [record] - - expect(@dns_mock).to receive(:getresources). - with("_x-puppet-test_service._tcp.example.com", Resolv::DNS::Resource::IN::SRV). - and_return(@srv_records) - end - - it "yields a URL using the server and port from the SRV record" do - count = 0 - rval = route.with_base_url(Puppet::Network::Resolver.new) do |url| - count += 1 - expect(url.to_s).to eq('https://example.com:7502/fakeapi/v1/') - 'Block return value' - end - expect(count).to eq(1) - - expect(rval).to eq('Block return value') - end - - it "should fall back to the default server when the block raises a SystemCallError" do - Puppet[:server] = "testserver" - Puppet[:masterport] = 555 - - count = 0 - rval = route.with_base_url(Puppet::Network::Resolver.new) do |url| - count += 1 - if url.to_s =~ /example.com/ then - raise SystemCallError, "example failure" - else - expect(url.to_s).to eq('https://testserver:555/fakeapi/v1/') - end - - 'Block return value' - end - - expect(count).to eq(2) - expect(rval).to eq('Block return value') - end - end - end - end -end diff --git a/spec/unit/ssl/state_machine_spec.rb b/spec/unit/ssl/state_machine_spec.rb index 7e1651afb60..58b56a02397 100644 --- a/spec/unit/ssl/state_machine_spec.rb +++ b/spec/unit/ssl/state_machine_spec.rb @@ -505,7 +505,6 @@ def expect_lockfile_to_contain(pid) Puppet[:certificate_revocation] = false expect(cert_provider).not_to receive(:load_crls) - expect(Puppet::Rest::Routes).not_to receive(:get_crls) state.next_state From a23ee91b07616854b4a6327bf946d0bc47ef4660 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Fri, 24 Jul 2020 15:09:34 -0700 Subject: [PATCH 043/731] (PUP-10438) Remove Puppet::Network::HTTP::Compression Puppet's compression support was added in 052f98fda before Ruby added it in ff7f462bf. Remove the compression tech debt. Puppet's HTTP client supports compression using the Net::HTTP. The Puppet::HTTP::Response automatically decompresses the body if the server sent it compressed. Note puppet still doesn't support sending compressed request bodies, like reports. --- lib/puppet/network/http.rb | 1 - lib/puppet/network/http/compression.rb | 127 ----------- spec/unit/network/http/compression_spec.rb | 240 --------------------- 3 files changed, 368 deletions(-) delete mode 100644 lib/puppet/network/http/compression.rb delete mode 100644 spec/unit/network/http/compression_spec.rb diff --git a/lib/puppet/network/http.rb b/lib/puppet/network/http.rb index f4a361d8453..03b2ccf6fd2 100644 --- a/lib/puppet/network/http.rb +++ b/lib/puppet/network/http.rb @@ -19,7 +19,6 @@ module Puppet::Network::HTTP require 'puppet/network/http/response' require 'puppet/network/http/request' require 'puppet/network/http/memory_response' - require 'puppet/network/http/compression' require 'puppet/http' end diff --git a/lib/puppet/network/http/compression.rb b/lib/puppet/network/http/compression.rb deleted file mode 100644 index 6f44119bcd5..00000000000 --- a/lib/puppet/network/http/compression.rb +++ /dev/null @@ -1,127 +0,0 @@ -require 'puppet/network/http' - -module Puppet::Network::HTTP::Compression - # from https://github.com/ruby/ruby/blob/v2_1_3/lib/net/http/generic_request.rb#L40 - ACCEPT_ENCODING = "gzip;q=1.0,deflate;q=0.6,identity;q=0.3" - - # this module function allows to use the right underlying - # methods depending on zlib presence - def module - return(Puppet.features.zlib? ? Active : None) - end - module_function :module - - module Active - require 'zlib' - require 'stringio' - - # return an uncompressed body if the response has been - # compressed - def uncompress_body(response) - case response['content-encoding'] - when 'gzip' - Puppet.deprecation_warning(_('Puppet::Network::HTTP::Compression::Active#uncompress_body is deprecated.')) - # ZLib::GzipReader has an associated encoding, by default Encoding.default_external - return Zlib::GzipReader.new(StringIO.new(response.body), :encoding => Encoding::BINARY).read - when 'deflate' - Puppet.deprecation_warning(_('Puppet::Network::HTTP::Compression::Active#uncompress_body is deprecated.')) - return Zlib::Inflate.new.inflate(response.body) - when nil, 'identity' - return response.body - else - raise Net::HTTPError.new(_("Unknown content encoding - %{encoding}") % { encoding: response['content-encoding'] }, response) - end - end - - def uncompress(response) - Puppet.deprecation_warning(_('Puppet::Network::HTTP::Compression::Active#uncompress is deprecated.')) - raise Net::HTTPError.new("No block passed", response) unless block_given? - - case response['content-encoding'] - when 'gzip','deflate' - uncompressor = ZlibAdapter.new - when nil, 'identity' - uncompressor = IdentityAdapter.new - else - raise Net::HTTPError.new(_("Unknown content encoding - %{encoding}") % { encoding: response['content-encoding'] }, response) - end - - begin - yield uncompressor - ensure - uncompressor.close - end - end - - def add_accept_encoding(headers={}) - headers['accept-encoding'] = Puppet::Network::HTTP::Compression::ACCEPT_ENCODING - headers - end - - # This adapters knows how to uncompress both 'zlib' stream (the deflate algorithm from Content-Encoding) - # and GZip streams. - class ZlibAdapter - def initialize(uncompressor = Zlib::Inflate.new(15 + 32)) - # Create an inflater that knows to parse GZip streams and zlib streams. - # This uses a property of the C Zlib library, documented as follow: - # windowBits can also be greater than 15 for optional gzip decoding. Add - # 32 to windowBits to enable zlib and gzip decoding with automatic header - # detection, or add 16 to decode only the gzip format (the zlib format will - # return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is - # a crc32 instead of an adler32. - @uncompressor = uncompressor - @first = true - end - - def uncompress(chunk) - Puppet.deprecation_warning(_('Puppet::Network::HTTP::Compression::ZlibAdapter#uncompress is deprecated.')) - out = @uncompressor.inflate(chunk) - @first = false - return out - rescue Zlib::DataError - # it can happen that we receive a raw deflate stream - # which might make our inflate throw a data error. - # in this case, we try with a verbatim (no header) - # deflater. - @uncompressor = Zlib::Inflate.new - if @first then - @first = false - retry - end - raise - end - - def close - @uncompressor.finish - ensure - @uncompressor.close - end - end - end - - module None - def uncompress_body(response) - Puppet.deprecation_warning(_('Puppet::Network::HTTP::Compression::None#uncompress_body is deprecated.')) - response.body - end - - def add_accept_encoding(headers) - headers - end - - def uncompress(response) - Puppet.deprecation_warning(_('Puppet::Network::HTTP::Compression::None#uncompress is deprecated.')) - yield IdentityAdapter.new - end - end - - class IdentityAdapter - def uncompress(chunk) - Puppet.deprecation_warning(_('Puppet::Network::HTTP::Compression::IdentityAdapter#uncompress is deprecated.')) - chunk - end - - def close - end - end -end diff --git a/spec/unit/network/http/compression_spec.rb b/spec/unit/network/http/compression_spec.rb deleted file mode 100644 index 3c36a41c229..00000000000 --- a/spec/unit/network/http/compression_spec.rb +++ /dev/null @@ -1,240 +0,0 @@ -require 'spec_helper' - -describe "http compression" do - let(:data) { "uncompresseddata" } - let(:response) { double('response') } - let(:compressed_zlib) { Zlib::Deflate.deflate(data) } - let(:compressed_gzip) do - str = StringIO.new - writer = Zlib::GzipWriter.new(str) - writer.write(data) - writer.close - str.string - end - - def stubs_response_with(response, content_encoding, body) - allow(response).to receive(:[]).with('content-encoding').and_return(content_encoding) - allow(response).to receive(:body).and_return(body) - end - - describe "when zlib is not available" do - before(:each) do - allow(Puppet.features).to receive(:zlib?).and_return(false) - - require 'puppet/network/http/compression' - class HttpUncompressor - include Puppet::Network::HTTP::Compression::None - end - - @uncompressor = HttpUncompressor.new - end - - it "should have a module function that returns the None underlying module" do - expect(Puppet::Network::HTTP::Compression.module).to eq(Puppet::Network::HTTP::Compression::None) - end - - it "should not add any Accept-Encoding header" do - expect(@uncompressor.add_accept_encoding({})).to eq({}) - end - - it "should not tamper the body" do - response = double('response', :body => data) - expect(@uncompressor.uncompress_body(response)).to eq(data) - end - - it "should yield an identity uncompressor" do - response = double('response') - @uncompressor.uncompress(response) { |u| - expect(u).to be_instance_of(Puppet::Network::HTTP::Compression::IdentityAdapter) - } - end - end - - describe "when zlib is available" do - require 'puppet/network/http/compression' - class ActiveUncompressor - include Puppet::Network::HTTP::Compression::Active - end - - let(:uncompressor) { ActiveUncompressor.new } - - it "should have a module function that returns the Active underlying module" do - expect(Puppet::Network::HTTP::Compression.module).to eq(Puppet::Network::HTTP::Compression::Active) - end - - it "should add an Accept-Encoding header supporting compression" do - headers = uncompressor.add_accept_encoding({}) - expect(headers).to have_key('accept-encoding') - expect(headers['accept-encoding']).to match(/gzip/) - expect(headers['accept-encoding']).to match(/deflate/) - expect(headers['accept-encoding']).to match(/identity/) - end - - describe "when uncompressing response body" do - context "without compression" do - it "should return untransformed response body with no content-encoding" do - stubs_response_with(response, nil, data) - - expect(uncompressor.uncompress_body(response)).to eq(data) - end - - it "should return untransformed response body with 'identity' content-encoding" do - stubs_response_with(response, 'identity', data) - - expect(uncompressor.uncompress_body(response)).to eq(data) - end - end - - context "with 'zlib' content-encoding" do - it "should use a Zlib inflater" do - stubs_response_with(response, 'deflate', compressed_zlib) - - expect(uncompressor.uncompress_body(response)).to eq(data) - end - - end - - context "with 'gzip' content-encoding" do - it "should use a GzipReader" do - stubs_response_with(response, 'gzip', compressed_gzip) - - expect(uncompressor.uncompress_body(response)).to eq(data) - end - - it "should correctly decompress PSON containing UTF-8 in Binary Encoding" do - # Simulate a compressed response body containing PSON containing UTF-8 - # using different UTF-8 widths: - - # \u06ff - ۿ - http://www.fileformat.info/info/unicode/char/06ff/index.htm - 0xDB 0xBF / 219 191 - # \u16A0 - ᚠ - http://www.fileformat.info/info/unicode/char/16A0/index.htm - 0xE1 0x9A 0xA0 / 225 154 160 - # \u{2070E} - 𠜎 - http://www.fileformat.info/info/unicode/char/2070E/index.htm - 0xF0 0xA0 0x9C 0x8E / 240 160 156 142 - - pson = "foo\u06ff\u16A0\u{2070E}".to_pson # unicode expression eqivalent of "foo\xDB\xBF\xE1\x9A\xA0\xF0\xA0\x9C\x8E\" per above - compressed_body_io = StringIO.new - writer = Zlib::GzipWriter.new(compressed_body_io) - writer.write(pson) - writer.close - compressed_body = compressed_body_io.string - - begin - default_external = Encoding.default_external - Encoding.default_external = Encoding::ISO_8859_1 - - stubs_response_with(response, 'gzip', compressed_body) - - uncompressed = uncompressor.uncompress_body(response) - # By default Zlib::GzipReader decompresses into Encoding.default_external, and we want to ensure our result is BINARY too - expect(uncompressed.encoding).to eq(Encoding::BINARY) - expect(uncompressed).to eq("\"foo\xDB\xBF\xE1\x9A\xA0\xF0\xA0\x9C\x8E\"".force_encoding(Encoding::BINARY)) - ensure - Encoding.default_external = default_external - end - end - end - end - - describe "when uncompressing by chunk" do - it "should yield an identity uncompressor with no content-encoding" do - stubs_response_with(response, nil, data) - - expect { |b| - uncompressor.uncompress(response).yield_once_with(Puppet::Network::HTTP::Compression::IdentityAdapter, &b) - } - end - - it "should yield an identity uncompressor with 'identity' content-encoding" do - stubs_response_with(response, 'identity', data) - - expect { |b| - uncompressor.uncompress(response).yield_once_with(Puppet::Network::HTTP::Compression::IdentityAdapter, &b) - } - end - - it "should yield a Zlib uncompressor with 'gzip' content-encoding" do - stubs_response_with(response, 'gzip', compressed_gzip) - - expect { |b| - uncompressor.uncompress(response).yield_once_with(Puppet::Network::HTTP::Compression::ZlibAdapter, &b) - } - end - - it "should yield a Zlib uncompressor with 'deflate' content-encoding" do - stubs_response_with(response, 'deflate', compressed_zlib) - - expect { |b| - uncompressor.uncompress(response).yield_once_with(Puppet::Network::HTTP::Compression::ZlibAdapter, &b) - } - end - - it "should close the underlying adapter" do - stubs_response_with(response, 'identity', data) - adapter = double('adapter') - expect(Puppet::Network::HTTP::Compression::IdentityAdapter).to receive(:new).and_return(adapter) - - expect(adapter).to receive(:close) - uncompressor.uncompress(response) { |u| } - end - - it "should close the underlying adapter if the yielded block raises" do - stubs_response_with(response, 'identity', data) - adapter = double('adapter') - expect(Puppet::Network::HTTP::Compression::IdentityAdapter).to receive(:new).and_return(adapter) - - expect(adapter).to receive(:close) - expect { - uncompressor.uncompress(response) { |u| raise ArgumentError, "whoops" } - }.to raise_error(ArgumentError, "whoops") - end - end - - describe "zlib adapter" do - it "should initialize the underlying inflater with gzip/zlib header parsing" do - expect(Zlib::Inflate).to receive(:new).with(15 + 32) - - Puppet::Network::HTTP::Compression::Active::ZlibAdapter.new - end - - it "should return the given chunk" do - adapter = Puppet::Network::HTTP::Compression::Active::ZlibAdapter.new - - expect(adapter.uncompress(compressed_zlib)).to eq(data) - end - - it "should try a 'regular' inflater on Zlib::DataError" do - inflater = Zlib::Inflate.new(15 + 32) - expect(inflater).to receive(:inflate).and_raise(Zlib::DataError.new("not a zlib stream")) - adapter = Puppet::Network::HTTP::Compression::Active::ZlibAdapter.new(inflater) - - expect(adapter.uncompress(compressed_zlib)).to eq(data) - end - - it "should raise the error the second time" do - inflater = Zlib::Inflate.new(15 + 32) - expect(inflater).to receive(:inflate).and_raise(Zlib::DataError.new("not a zlib stream")) - adapter = Puppet::Network::HTTP::Compression::Active::ZlibAdapter.new(inflater) - - expect { adapter.uncompress("this is not compressed data") }.to raise_error(Zlib::DataError, /incorrect header check/) - end - - it "should finish and close the stream" do - inflater = double('inflater') - expect(inflater).to receive(:finish) - expect(inflater).to receive(:close) - adapter = Puppet::Network::HTTP::Compression::Active::ZlibAdapter.new(inflater) - - adapter.close - end - - it "should close the stream even if finish raises" do - inflater = double('inflater') - expect(inflater).to receive(:finish).and_raise(Zlib::BufError) - expect(inflater).to receive(:close) - - adapter = Puppet::Network::HTTP::Compression::Active::ZlibAdapter.new(inflater) - expect { - adapter.close - }.to raise_error(Zlib::BufError) - end - end - end -end From ccb6e1c9460bedda4f9ae7bea517f51d9e775ffe Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Fri, 24 Jul 2020 15:19:53 -0700 Subject: [PATCH 044/731] (PUP-10438) Move Puppet::Network::Resolver to Puppet::HTTP::DNS Move Resolver to Puppet::HTTP namespace. It is used to resolve SRV records into IP addresses based on SRV weights and priorities. --- lib/puppet/http.rb | 2 +- lib/puppet/{network/resolver.rb => http/dns.rb} | 4 ++-- lib/puppet/http/resolver/srv.rb | 2 +- lib/puppet/indirector/request.rb | 1 - spec/unit/{network/resolver_spec.rb => http/dns_spec.rb} | 6 +++--- spec/unit/http/session_spec.rb | 6 +++--- spec/unit/type/file/source_spec.rb | 1 - 7 files changed, 10 insertions(+), 12 deletions(-) rename lib/puppet/{network/resolver.rb => http/dns.rb} (99%) rename spec/unit/{network/resolver_spec.rb => http/dns_spec.rb} (98%) diff --git a/lib/puppet/http.rb b/lib/puppet/http.rb index abf3bd19f73..6aca791fdbd 100644 --- a/lib/puppet/http.rb +++ b/lib/puppet/http.rb @@ -2,7 +2,6 @@ module Puppet module Network module HTTP require 'puppet/network/http_pool' - require 'puppet/network/resolver' end end @@ -17,6 +16,7 @@ module HTTP require 'puppet/http/proxy' require 'puppet/http/factory' require 'puppet/http/pool' + require 'puppet/http/dns' require 'puppet/http/response' require 'puppet/http/service' require 'puppet/http/service/ca' diff --git a/lib/puppet/network/resolver.rb b/lib/puppet/http/dns.rb similarity index 99% rename from lib/puppet/network/resolver.rb rename to lib/puppet/http/dns.rb index 55b68007b83..bff293825bb 100644 --- a/lib/puppet/network/resolver.rb +++ b/lib/puppet/http/dns.rb @@ -1,7 +1,7 @@ require 'resolv' -module Puppet::Network - class Resolver +module Puppet::HTTP + class DNS class CacheEntry attr_reader :records, :ttl, :resolution_time diff --git a/lib/puppet/http/resolver/srv.rb b/lib/puppet/http/resolver/srv.rb index d8851949984..235f2ebad34 100644 --- a/lib/puppet/http/resolver/srv.rb +++ b/lib/puppet/http/resolver/srv.rb @@ -14,7 +14,7 @@ class Puppet::HTTP::Resolver::SRV < Puppet::HTTP::Resolver def initialize(client, domain:, dns: Resolv::DNS.new) @client = client @srv_domain = domain - @delegate = Puppet::Network::Resolver.new(dns) + @delegate = Puppet::HTTP::DNS.new(dns) end # diff --git a/lib/puppet/indirector/request.rb b/lib/puppet/indirector/request.rb index 3588ccf308f..b5e01f485dc 100644 --- a/lib/puppet/indirector/request.rb +++ b/lib/puppet/indirector/request.rb @@ -1,7 +1,6 @@ require 'cgi' require 'uri' require 'puppet/indirector' -require 'puppet/network/resolver' require 'puppet/util/psych_support' require 'puppet/util/warnings' diff --git a/spec/unit/network/resolver_spec.rb b/spec/unit/http/dns_spec.rb similarity index 98% rename from spec/unit/network/resolver_spec.rb rename to spec/unit/http/dns_spec.rb index a578f0a4827..8b847af2ec5 100644 --- a/spec/unit/network/resolver_spec.rb +++ b/spec/unit/http/dns_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' -require 'puppet/network/resolver' +require 'puppet/http' -describe Puppet::Network::Resolver do +describe Puppet::HTTP::DNS do before do @dns_mock_object = double('dns') allow(Resolv::DNS).to receive(:new).and_return(@dns_mock_object) @@ -26,7 +26,7 @@ end end - let(:resolver) { Puppet::Network::Resolver.new } + let(:resolver) { described_class.new } describe 'when the domain is not known' do before :each do diff --git a/spec/unit/http/session_spec.rb b/spec/unit/http/session_spec.rb index 9e60af5e3a8..7e20f41a5d3 100644 --- a/spec/unit/http/session_spec.rb +++ b/spec/unit/http/session_spec.rb @@ -138,7 +138,7 @@ def resolve(session, name, ssl_context: nil, error_handler: nil) Puppet[:server_list] = 'foo.example.com,bar.example.com,baz.example.com' Puppet[:ca_server] = 'caserver.example.com' - allow_any_instance_of(Puppet::Network::Resolver).to receive(:each_srv_record).and_yield('mars.example.srv', 8140) + allow_any_instance_of(Puppet::HTTP::DNS).to receive(:each_srv_record).and_yield('mars.example.srv', 8140) service = session.route_to(:ca) expect(service.url).to eq(URI("https://mars.example.srv:8140/puppet-ca/v1")) @@ -158,7 +158,7 @@ def resolve(session, name, ssl_context: nil, error_handler: nil) Puppet[:use_srv_records] = true Puppet[:server_list] = 'foo.example.com,bar.example.com,baz.example.com' - allow_any_instance_of(Puppet::Network::Resolver).to receive(:each_srv_record) + allow_any_instance_of(Puppet::HTTP::DNS).to receive(:each_srv_record) stub_request(:get, "https://foo.example.com:8140/status/v1/simple/master").to_return(status: 500) stub_request(:get, "https://bar.example.com:8140/status/v1/simple/master").to_return(status: 200) @@ -170,7 +170,7 @@ def resolve(session, name, ssl_context: nil, error_handler: nil) it "fails if server_list doesn't return anything valid" do Puppet[:server_list] = 'foo.example.com,bar.example.com' - allow_any_instance_of(Puppet::Network::Resolver).to receive(:each_srv_record) + allow_any_instance_of(Puppet::HTTP::DNS).to receive(:each_srv_record) stub_request(:get, "https://foo.example.com:8140/status/v1/simple/master").to_return(status: 500) stub_request(:get, "https://bar.example.com:8140/status/v1/simple/master").to_return(status: 500) diff --git a/spec/unit/type/file/source_spec.rb b/spec/unit/type/file/source_spec.rb index b16ed1a9f92..ab07eaaee5d 100644 --- a/spec/unit/type/file/source_spec.rb +++ b/spec/unit/type/file/source_spec.rb @@ -1,7 +1,6 @@ require 'spec_helper' require 'uri' require 'puppet/network/http_pool' -#require 'puppet/network/resolver' describe Puppet::Type.type(:file).attrclass(:source), :uses_checksums => true do include PuppetSpec::Files From 66aff9da6aeb321ad1d9276386802fec22de3921 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Fri, 24 Jul 2020 16:54:44 -0700 Subject: [PATCH 045/731] (PUP-10438) Deprecate Puppet::Network::HttpPool Deprecate legacy HTTP API for creating connections. We can't remove this class yet as some third-party applications, termini, hiera backends & functions still call it. --- lib/puppet/network/http.rb | 3 +-- lib/puppet/network/http_pool.rb | 14 ++++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/puppet/network/http.rb b/lib/puppet/network/http.rb index 03b2ccf6fd2..bf0ceaa005c 100644 --- a/lib/puppet/network/http.rb +++ b/lib/puppet/network/http.rb @@ -1,3 +1,4 @@ +# This module is used to handle puppet REST requests in puppetserver. module Puppet::Network::HTTP HEADER_ENABLE_PROFILING = "X-Puppet-Profiling" HEADER_PUPPET_VERSION = "X-Puppet-Version" @@ -19,6 +20,4 @@ module Puppet::Network::HTTP require 'puppet/network/http/response' require 'puppet/network/http/request' require 'puppet/network/http/memory_response' - - require 'puppet/http' end diff --git a/lib/puppet/network/http_pool.rb b/lib/puppet/network/http_pool.rb index d3ed7b25303..788490adfe4 100644 --- a/lib/puppet/network/http_pool.rb +++ b/lib/puppet/network/http_pool.rb @@ -1,14 +1,11 @@ require 'puppet/network/http/connection' -require 'puppet/util/platform' module Puppet::Network; end -# This module contains the factory methods that should be used for getting a -# {Puppet::Network::HTTP::Connection} instance. The pool may return a new -# connection or a persistent cached connection, depending on the underlying -# pool implementation in use. +# This module is deprecated. # # @api public +# @deprecated Use {Puppet::HTTP::Client} instead. # module Puppet::Network::HttpPool @@ -29,10 +26,12 @@ def self.http_client_class=(klass) # @param verify_peer [Boolean] Whether to verify the peer credentials, if possible. Verification will not take place if the CA certificate is missing. # @return [Puppet::Network::HTTP::Connection] # - # @deprecated Use {#http_connection} instead. + # @deprecated Use {Puppet.runtime[:http]} instead. # @api public # def self.http_instance(host, port, use_ssl = true, verify_peer = true) + Puppet.warn_once('deprecations', self, "The method 'Puppet::Network::HttpPool.http_instance' is deprecated. Use Puppet.runtime[:http] instead") + if verify_peer verifier = Puppet::SSL::Verifier.new(host, nil) http_client_class.new(host, port, use_ssl: use_ssl, verifier: verifier) @@ -52,9 +51,12 @@ def self.http_instance(host, port, use_ssl = true, verify_peer = true) # when making HTTPS connections. Required when `use_ssl` is `true`. # @return [Puppet::Network::HTTP::Connection] # + # @deprecated Use {Puppet.runtime[:http]} instead. # @api public # def self.connection(host, port, use_ssl: true, ssl_context: nil) + Puppet.warn_once('deprecations', self, "The method 'Puppet::Network::HttpPool.connection' is deprecated. Use Puppet.runtime[:http] instead") + if use_ssl unless ssl_context # TRANSLATORS 'ssl_context' is an argument and should not be translated From c3657ca00f3d090ab703001ab5154c53d9b66b14 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Fri, 7 Aug 2020 03:43:02 +0000 Subject: [PATCH 046/731] (packaging) Updating the puppet.pot file --- locales/puppet.pot | 208 ++++++++------------------------------------- 1 file changed, 36 insertions(+), 172 deletions(-) diff --git a/locales/puppet.pot b/locales/puppet.pot index bc8673e328a..c28d7845f35 100644 --- a/locales/puppet.pot +++ b/locales/puppet.pot @@ -6,11 +6,11 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Puppet automation framework 6.17.0-151-g0e5139e2c3\n" +"Project-Id-Version: Puppet automation framework 6.17.0-160-gb6f708676a\n" "\n" "Report-Msgid-Bugs-To: https://tickets.puppetlabs.com\n" -"POT-Creation-Date: 2020-08-06 23:27+0000\n" -"PO-Revision-Date: 2020-08-06 23:27+0000\n" +"POT-Creation-Date: 2020-08-07 03:42+0000\n" +"PO-Revision-Date: 2020-08-07 03:42+0000\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -480,7 +480,7 @@ msgstr "" msgid "Creating a new EC SSL key for %{name} using curve %{curve}" msgstr "" -#: ../lib/puppet/application/ssl.rb:157 ../lib/puppet/ssl/key.rb:26 +#: ../lib/puppet/application/ssl.rb:157 msgid "Creating a new SSL key for %{name}" msgstr "" @@ -725,16 +725,12 @@ msgstr "" msgid "Certificate names must be lower case" msgstr "" -#: ../lib/puppet/defaults.rb:1002 -msgid "Setting 'ssl_client_ca_auth' is deprecated." -msgstr "" - -#: ../lib/puppet/defaults.rb:1081 ../lib/puppet/settings/enum_setting.rb:13 ../lib/puppet/settings/symbolic_enum_setting.rb:14 +#: ../lib/puppet/defaults.rb:1058 ../lib/puppet/settings/enum_setting.rb:13 ../lib/puppet/settings/symbolic_enum_setting.rb:14 msgid "Invalid value '%{value}' for parameter %{name}. Allowed values are '%{allowed_values}'" msgstr "" #. TRANSLATORS 'pluginsync' is a setting and should not be translated -#: ../lib/puppet/defaults.rb:1947 +#: ../lib/puppet/defaults.rb:1924 msgid "Setting 'pluginsync' is deprecated." msgstr "" @@ -780,7 +776,7 @@ msgstr "" msgid "no matching resources found" msgstr "" -#: ../lib/puppet/face/config.rb:7 ../lib/puppet/face/epp.rb:8 ../lib/puppet/face/facts.rb:6 ../lib/puppet/face/generate.rb:7 ../lib/puppet/face/help.rb:9 ../lib/puppet/face/key.rb:5 ../lib/puppet/face/man.rb:8 ../lib/puppet/face/module.rb:9 ../lib/puppet/face/node.rb:4 ../lib/puppet/face/parser.rb:6 ../lib/puppet/face/plugin.rb:6 ../lib/puppet/face/report.rb:5 ../lib/puppet/face/resource.rb:5 ../lib/puppet/face/status.rb:5 +#: ../lib/puppet/face/config.rb:7 ../lib/puppet/face/epp.rb:8 ../lib/puppet/face/facts.rb:6 ../lib/puppet/face/generate.rb:7 ../lib/puppet/face/help.rb:9 ../lib/puppet/face/man.rb:8 ../lib/puppet/face/module.rb:9 ../lib/puppet/face/node.rb:4 ../lib/puppet/face/parser.rb:6 ../lib/puppet/face/plugin.rb:6 ../lib/puppet/face/report.rb:5 ../lib/puppet/face/resource.rb:5 ../lib/puppet/face/status.rb:5 msgid "Apache 2 license; see COPYING" msgstr "" @@ -1143,10 +1139,6 @@ msgstr "" msgid "Check error logs." msgstr "" -#: ../lib/puppet/face/key.rb:7 -msgid "Create, save, and remove certificate keys." -msgstr "" - #: ../lib/puppet/face/man.rb:10 msgid "Display Puppet manual pages." msgstr "" @@ -2707,7 +2699,7 @@ msgstr "" msgid "directory traversal detected in %{json}: %{name}" msgstr "" -#: ../lib/puppet/indirector/json.rb:41 ../lib/puppet/indirector/msgpack.rb:48 ../lib/puppet/indirector/ssl_file.rb:40 ../lib/puppet/indirector/yaml.rb:40 +#: ../lib/puppet/indirector/json.rb:41 ../lib/puppet/indirector/msgpack.rb:48 ../lib/puppet/indirector/yaml.rb:40 msgid "invalid key" msgstr "" @@ -2719,14 +2711,6 @@ msgstr "" msgid "Could not parse JSON data for %{name} %{key}: %{detail}" msgstr "" -#: ../lib/puppet/indirector/key/file.rb:29 -msgid "Could not remove %{request} public key: %{detail}" -msgstr "" - -#: ../lib/puppet/indirector/key/file.rb:43 -msgid "Could not write %{request}: %{detail}" -msgstr "" - #: ../lib/puppet/indirector/memory.rb:14 msgid "Could not find %{request} to destroy" msgstr "" @@ -2743,7 +2727,7 @@ msgstr "" msgid "Could not destroy %{name} %{request}: %{detail}" msgstr "" -#: ../lib/puppet/indirector/msgpack.rb:47 ../lib/puppet/indirector/ssl_file.rb:39 ../lib/puppet/indirector/yaml.rb:39 +#: ../lib/puppet/indirector/msgpack.rb:47 ../lib/puppet/indirector/yaml.rb:39 msgid "directory traversal detected in %{indirection}: %{name}" msgstr "" @@ -2812,42 +2796,6 @@ msgstr "" msgid "Error %{code} on SERVER: %{returned_message}" msgstr "" -#: ../lib/puppet/indirector/ssl_file.rb:34 -msgid "No file or directory setting provided; terminus %{class_name} cannot function" -msgstr "" - -#: ../lib/puppet/indirector/ssl_file.rb:55 -msgid "Removing file %{model} %{request} at '%{path}'" -msgstr "" - -#: ../lib/puppet/indirector/ssl_file.rb:59 -msgid "Could not remove %{request}: %{detail}" -msgstr "" - -#: ../lib/puppet/indirector/ssl_file.rb:75 -msgid "Cannot save %{request}; parent directory %{dir} does not exist" -msgstr "" - -#: ../lib/puppet/indirector/ssl_file.rb:76 -msgid "Cannot save %{request}; parent directory %{dir} is not writable" -msgstr "" - -#: ../lib/puppet/indirector/ssl_file.rb:121 -msgid "Tried to fix SSL files to a file containing uppercase" -msgstr "" - -#: ../lib/puppet/indirector/ssl_file.rb:130 -msgid "Automatic downcasing and renaming of ssl files is deprecated; please request the file using its correct case: %{full_file}" -msgstr "" - -#: ../lib/puppet/indirector/ssl_file.rb:150 -msgid "Could not write %{path} to %{setting}: %{detail}" -msgstr "" - -#: ../lib/puppet/indirector/ssl_file.rb:153 -msgid "You must provide a setting to determine where the files are stored" -msgstr "" - #: ../lib/puppet/indirector/terminus.rb:37 msgid "Could not find indirection instance %{name} for %{terminus}" msgstr "" @@ -3951,15 +3899,15 @@ msgstr "" msgid "Puppet::Network::HTTP::Compression::IdentityAdapter#uncompress is deprecated." msgstr "" -#: ../lib/puppet/network/http/connection.rb:44 +#: ../lib/puppet/network/http/connection.rb:43 msgid "Unrecognized option(s): %{opts}" msgstr "" -#: ../lib/puppet/network/http/connection.rb:51 +#: ../lib/puppet/network/http/connection.rb:49 msgid "Expected an instance of Puppet::SSL::Verifier but was passed a %{klass}" msgstr "" -#: ../lib/puppet/network/http/connection.rb:281 +#: ../lib/puppet/network/http/connection.rb:272 msgid "Too many HTTP redirections for %{host}:%{port}" msgstr "" @@ -7741,83 +7689,83 @@ msgstr "" msgid "Invalid 'time to live' format '%{value}' for parameter: %{param_name}" msgstr "" -#: ../lib/puppet/ssl/base.rb:27 +#: ../lib/puppet/ssl/base.rb:26 msgid "%{name} has not declared what class it wraps" msgstr "" -#: ../lib/puppet/ssl/base.rb:32 ../lib/puppet/x509/cert_provider.rb:342 +#: ../lib/puppet/ssl/base.rb:31 ../lib/puppet/x509/cert_provider.rb:342 msgid "Certname %{name} must not contain unprintable or non-ASCII characters" msgstr "" -#: ../lib/puppet/ssl/base.rb:38 +#: ../lib/puppet/ssl/base.rb:37 msgid "%{class_name} did not override 'generate'" msgstr "" -#: ../lib/puppet/ssl/base.rb:63 +#: ../lib/puppet/ssl/base.rb:64 msgid "Object must be an instance of %{class_name}, %{actual_class} given" msgstr "" -#: ../lib/puppet/ssl/base.rb:67 +#: ../lib/puppet/ssl/base.rb:68 msgid "Name must be supplied if it cannot be determined from the instance" msgstr "" -#: ../lib/puppet/ssl/base.rb:142 +#: ../lib/puppet/ssl/base.rb:140 msgid "Unknown signature algorithm '%{ln}'" msgstr "" -#: ../lib/puppet/ssl/certificate_request.rb:65 +#: ../lib/puppet/ssl/certificate_request.rb:57 msgid "Creating a new SSL certificate request for %{name}" msgstr "" -#: ../lib/puppet/ssl/certificate_request.rb:101 +#: ../lib/puppet/ssl/certificate_request.rb:90 msgid "CSR sign verification failed; you need to clean the certificate request for %{name} on the server" msgstr "" -#: ../lib/puppet/ssl/certificate_request.rb:107 +#: ../lib/puppet/ssl/certificate_request.rb:96 msgid "Certificate Request fingerprint (%{digest}): %{hex_digest}" msgstr "" -#: ../lib/puppet/ssl/certificate_request.rb:151 +#: ../lib/puppet/ssl/certificate_request.rb:140 msgid "CSR needs content to extract fields" msgstr "" -#: ../lib/puppet/ssl/certificate_request.rb:178 +#: ../lib/puppet/ssl/certificate_request.rb:167 msgid "In %{attr}, expected extension record %{index} to have two or three items, but found %{count}" msgstr "" -#: ../lib/puppet/ssl/certificate_request.rb:229 +#: ../lib/puppet/ssl/certificate_request.rb:218 msgid "Cannot specify CSR attribute %{oid}: conflicts with internally used CSR attribute" msgstr "" -#: ../lib/puppet/ssl/certificate_request.rb:238 +#: ../lib/puppet/ssl/certificate_request.rb:227 msgid "Cannot create CSR with attribute %{oid}: %{message}" msgstr "" -#: ../lib/puppet/ssl/certificate_request.rb:255 +#: ../lib/puppet/ssl/certificate_request.rb:244 msgid "Cannot specify CSR extension request %{oid}: conflicts with internally used extension request" msgstr "" -#: ../lib/puppet/ssl/certificate_request.rb:261 +#: ../lib/puppet/ssl/certificate_request.rb:250 msgid "Cannot create CSR with extension request %{oid}: %{message}" msgstr "" -#: ../lib/puppet/ssl/certificate_request.rb:312 +#: ../lib/puppet/ssl/certificate_request.rb:301 msgid "In %{attr}, expected Set but found %{klass}" msgstr "" -#: ../lib/puppet/ssl/certificate_request.rb:316 +#: ../lib/puppet/ssl/certificate_request.rb:305 msgid "In %{attr}, expected Set[Array] but found %{klass}" msgstr "" -#: ../lib/puppet/ssl/certificate_request.rb:320 +#: ../lib/puppet/ssl/certificate_request.rb:309 msgid "In %{attr}, expected Set[Array] with one value but found %{count} elements" msgstr "" -#: ../lib/puppet/ssl/certificate_request.rb:324 +#: ../lib/puppet/ssl/certificate_request.rb:313 msgid "In %{attr}, expected Set[Array[Sequence[...]]], but found %{klass}" msgstr "" -#: ../lib/puppet/ssl/certificate_request.rb:328 +#: ../lib/puppet/ssl/certificate_request.rb:317 msgid "In %{attr}, expected Set[Array[Sequence[Array[...]]]], but found %{klass}" msgstr "" @@ -7845,94 +7793,6 @@ msgstr "" msgid "Server hostname '%{host}' did not match server certificate; %{expected_certnames}" msgstr "" -#: ../lib/puppet/ssl/host.rb:154 -msgid "No certificate to validate." -msgstr "" - -#: ../lib/puppet/ssl/host.rb:155 -msgid "No private key with which to validate certificate with fingerprint: %{fingerprint}" -msgstr "" - -#: ../lib/puppet/ssl/host.rb:157 -msgid "" -"The certificate retrieved from the master does not match the agent's private key. Did you forget to run as root?\n" -"Certificate fingerprint: %{fingerprint}\n" -"To fix this, remove the certificate from both the master and the agent and then start a puppet run, which will automatically regenerate a certificate.\n" -"On the master:\n" -" puppetserver ca clean --certname %{cert_name}\n" -"On the agent:\n" -" 1. puppet ssl clean %{clean_params}\n" -" 2. puppet %{puppet_params}\n" -msgstr "" - -#: ../lib/puppet/ssl/host.rb:212 -msgid "" -"The CSR retrieved from the master does not match the agent's public key.\n" -"CSR fingerprint: %{fingerprint}\n" -"CSR public key: %{csr_public_key}\n" -"Agent public key: %{agent_public_key}\n" -"To fix this, remove the CSR from both the master and the agent and then start a puppet run, which will automatically regenerate a CSR.\n" -"On the master:\n" -" puppetserver ca clean --certname %{cert_name}\n" -"On the agent:\n" -" 1. puppet ssl clean %{clean_params}\n" -" 2. puppet %{puppet_params}\n" -msgstr "" - -#: ../lib/puppet/ssl/host.rb:235 -msgid "Puppet::SSL::Host is deprecated and will be removed in a future release of Puppet." -msgstr "" - -#: ../lib/puppet/ssl/host.rb:267 ../lib/puppet/ssl/host.rb:288 -msgid "Could not request certificate: %{message}" -msgstr "" - -#: ../lib/puppet/ssl/host.rb:269 -msgid "Exiting; failed to retrieve certificate and waitforcert is disabled" -msgstr "" - -#: ../lib/puppet/ssl/host.rb:278 -msgid "Exiting; no certificate found and waitforcert is disabled" -msgstr "" - -#: ../lib/puppet/ssl/host.rb:286 -msgid "Did not receive certificate" -msgstr "" - -#: ../lib/puppet/ssl/host.rb:326 -msgid "Response from the CA did not contain a valid certificate request: %{message}" -msgstr "" - -#: ../lib/puppet/ssl/host.rb:332 -msgid "Could not download certificate request: %{message}" -msgstr "" - -#: ../lib/puppet/ssl/host.rb:359 -msgid "" -"Failed attempting to load CRL from %{crl_path}! The CRL below caused the error '%{error}':\n" -"%{crl}" -msgstr "" - -#: ../lib/puppet/ssl/host.rb:391 ../lib/puppet/ssl/state_machine.rb:120 -msgid "Could not download CRLs: %{message}" -msgstr "" - -#: ../lib/puppet/ssl/host.rb:425 -msgid "The certificate at %{file_path} is invalid. Could not load." -msgstr "" - -#: ../lib/puppet/ssl/host.rb:446 -msgid "Response from the CA did not contain a valid certificate for %{cert_name}." -msgstr "" - -#: ../lib/puppet/ssl/host.rb:450 -msgid "No certificate for %{cert_name} on CA" -msgstr "" - -#: ../lib/puppet/ssl/host.rb:453 -msgid "Could not download host certificate: %{message}" -msgstr "" - #: ../lib/puppet/ssl/oids.rb:110 msgid "Error loading ssl custom OIDs mapping file from '%{custom_oid_file}': %{err}" msgstr "" @@ -8057,6 +7917,10 @@ msgstr "" msgid "CRL is missing from the server" msgstr "" +#: ../lib/puppet/ssl/state_machine.rb:120 +msgid "Could not download CRLs: %{message}" +msgstr "" + #: ../lib/puppet/ssl/state_machine.rb:127 msgid "Refreshing CRL" msgstr "" From 786a7d5697136950658a6c0752c3573a26d75958 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Fri, 7 Aug 2020 03:44:26 +0000 Subject: [PATCH 047/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 14 ----- man/man8/puppet-key.8 | 126 ----------------------------------------- 2 files changed, 140 deletions(-) delete mode 100644 man/man8/puppet-key.8 diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index ebace0abba3..24779dba865 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -1750,13 +1750,6 @@ The domain which will be queried to find the SRV records of servers to use\. \fIDefault\fR: delivery\.puppetlabs\.net . .IP "" 0 -. -.SS "ssl_client_ca_auth" -Certificate authorities who issue server certificates\. SSL servers will not be considered authentic unless they possess a certificate issued by an authority listed in this file\. If this setting has no value then the Puppet master\'s CA certificate (localcacert) will be used\. -. -.TP -\fIDefault\fR: - . .SS "ssl_client_header" The header containing an authenticated client\'s SSL DN\. This header must be set by the proxy to the authenticated client\'s SSL DN (e\.g\., \fB/CN=puppet\.puppetlabs\.com\fR)\. Puppet will parse out the Common Name (CN) from the Distinguished Name (DN) and use the value of the CN field for authorization\. @@ -1787,13 +1780,6 @@ A lock file to indicate that the ssl bootstrap process is currently in progress\ \fIDefault\fR: $ssldir/ssl\.lock . .IP "" 0 -. -.SS "ssl_server_ca_auth" -The setting is deprecated and has no effect\. Ensure all root and intermediate certificate authorities used to issue client certificates are contained in the server\'s \fBcacert\fR file on the server\. -. -.TP -\fIDefault\fR: - . .SS "ssl_trust_store" A file containing CA certificates in PEM format that puppet should trust when making HTTPS requests\. This \fBonly\fR applies to https requests to non\-puppet infrastructure, such as retrieving file metadata and content from https file sources, puppet module tool and the \'http\' report processor\. This setting is ignored when making requests to puppet:// URLs such as catalog and report requests\. diff --git a/man/man8/puppet-key.8 b/man/man8/puppet-key.8 deleted file mode 100644 index a582f3f26ae..00000000000 --- a/man/man8/puppet-key.8 +++ /dev/null @@ -1,126 +0,0 @@ -.\" generated with Ronn/v0.7.3 -.\" http://github.com/rtomayko/ronn/tree/0.7.3 -. -.TH "PUPPET\-KEY" "8" "August 2020" "Puppet, Inc." "Puppet manual" -. -.SH "NAME" -\fBpuppet\-key\fR \- Create, save, and remove certificate keys\. -. -.SH "SYNOPSIS" -puppet key \fIaction\fR [\-\-terminus _TERMINUS] [\-\-extra HASH] -. -.SH "DESCRIPTION" -This subcommand manages certificate private keys\. Keys are created automatically by puppet agent and when certificate requests are generated with \'puppet ssl submit_request\'; it should not be necessary to use this subcommand directly\. -. -.SH "OPTIONS" -Note that any setting that\'s valid in the configuration file is also a valid long argument, although it may or may not be relevant to the present action\. For example, \fBserver\fR and \fBrun_mode\fR are valid settings, so you can specify \fB\-\-server \fR, or \fB\-\-run_mode \fR as an argument\. -. -.P -See the configuration file documentation at \fIhttps://puppet\.com/docs/puppet/latest/configuration\.html\fR for the full list of acceptable parameters\. A commented list of all configuration options can also be generated by running puppet with \fB\-\-genconfig\fR\. -. -.TP -\-\-render\-as FORMAT -The format in which to render output\. The most common formats are \fBjson\fR, \fBs\fR (string), \fByaml\fR, and \fBconsole\fR, but other options such as \fBdot\fR are sometimes available\. -. -.TP -\-\-verbose -Whether to log verbosely\. -. -.TP -\-\-debug -Whether to log debug information\. -. -.TP -\-\-extra HASH -A terminus can take additional arguments to refine the operation, which are passed as an arbitrary hash to the back\-end\. Anything passed as the extra value is just send direct to the back\-end\. -. -.TP -\-\-terminus _TERMINUS -Indirector faces expose indirected subsystems of Puppet\. These subsystems are each able to retrieve and alter a specific type of data (with the familiar actions of \fBfind\fR, \fBsearch\fR, \fBsave\fR, and \fBdestroy\fR) from an arbitrary number of pluggable backends\. In Puppet parlance, these backends are called terminuses\. -. -.IP -Almost all indirected subsystems have a \fBrest\fR terminus that interacts with the puppet master\'s data\. Most of them have additional terminuses for various local data models, which are in turn used by the indirected subsystem on the puppet master whenever it receives a remote request\. -. -.IP -The terminus for an action is often determined by context, but occasionally needs to be set explicitly\. See the "Notes" section of this face\'s manpage for more details\. -. -.SH "ACTIONS" -. -.TP -\fBdestroy\fR \- Delete an object\. -\fBSYNOPSIS\fR -. -.IP -puppet key destroy [\-\-terminus _TERMINUS] [\-\-extra HASH] \fIkey\fR -. -.IP -\fBDESCRIPTION\fR -. -.IP -Delete an object\. -. -.TP -\fBfind\fR \- Retrieve an object by name\. -\fBSYNOPSIS\fR -. -.IP -puppet key find [\-\-terminus _TERMINUS] [\-\-extra HASH] [\fIkey\fR] -. -.IP -\fBDESCRIPTION\fR -. -.IP -Retrieve an object by name\. -. -.TP -\fBinfo\fR \- Print the default terminus class for this face\. -\fBSYNOPSIS\fR -. -.IP -puppet key info [\-\-terminus _TERMINUS] [\-\-extra HASH] -. -.IP -\fBDESCRIPTION\fR -. -.IP -Prints the default terminus class for this subcommand\. Note that different run modes may have different default termini; when in doubt, specify the run mode with the \'\-\-run_mode\' option\. -. -.TP -\fBsave\fR \- API only: create or overwrite an object\. -\fBSYNOPSIS\fR -. -.IP -puppet key save [\-\-terminus _TERMINUS] [\-\-extra HASH] \fIkey\fR -. -.IP -\fBDESCRIPTION\fR -. -.IP -API only: create or overwrite an object\. As the Faces framework does not currently accept data from STDIN, save actions cannot currently be invoked from the command line\. -. -.TP -\fBsearch\fR \- Search for an object or retrieve multiple objects\. -\fBSYNOPSIS\fR -. -.IP -puppet key search [\-\-terminus _TERMINUS] [\-\-extra HASH] \fIquery\fR -. -.IP -\fBDESCRIPTION\fR -. -.IP -Search for an object or retrieve multiple objects\. -. -.SH "NOTES" -This subcommand is an indirector face, which exposes \fBfind\fR, \fBsearch\fR, \fBsave\fR, and \fBdestroy\fR actions for an indirected subsystem of Puppet\. Valid termini for this face include: -. -.IP "\(bu" 4 -\fBfile\fR -. -.IP "\(bu" 4 -\fBmemory\fR -. -.IP "" 0 -. -.SH "COPYRIGHT AND LICENSE" -Copyright 2011 by Puppet Inc\. Apache 2 license; see COPYING From a495d07fe9ba74cc57777ebaa3dbafea98312be3 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Fri, 7 Aug 2020 05:51:57 +0000 Subject: [PATCH 048/731] (packaging) Updating the puppet.pot file --- locales/puppet.pot | 91 ++++------------------------------------------ 1 file changed, 8 insertions(+), 83 deletions(-) diff --git a/locales/puppet.pot b/locales/puppet.pot index c28d7845f35..5ec6e3ecbaa 100644 --- a/locales/puppet.pot +++ b/locales/puppet.pot @@ -6,11 +6,11 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Puppet automation framework 6.17.0-160-gb6f708676a\n" +"Project-Id-Version: Puppet automation framework 6.17.0-167-g0baaba6576\n" "\n" "Report-Msgid-Bugs-To: https://tickets.puppetlabs.com\n" -"POT-Creation-Date: 2020-08-07 03:42+0000\n" -"PO-Revision-Date: 2020-08-07 03:42+0000\n" +"POT-Creation-Date: 2020-08-07 05:51+0000\n" +"PO-Revision-Date: 2020-08-07 05:51+0000\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -2776,11 +2776,11 @@ msgstr "" msgid "Could not save %{indirection} %{request}: %{detail}" msgstr "" -#: ../lib/puppet/indirector/request.rb:103 +#: ../lib/puppet/indirector/request.rb:102 msgid "Could not find indirection '%{indirection}'" msgstr "" -#: ../lib/puppet/indirector/request.rb:166 +#: ../lib/puppet/indirector/request.rb:165 msgid "Could not understand URL %{key}: %{detail}" msgstr "" @@ -2792,7 +2792,7 @@ msgstr "" msgid "Resource instance does not match request key" msgstr "" -#: ../lib/puppet/indirector/rest.rb:43 ../lib/puppet/rest/response.rb:31 +#: ../lib/puppet/indirector/rest.rb:43 msgid "Error %{code} on SERVER: %{returned_message}" msgstr "" @@ -3871,34 +3871,6 @@ msgstr "" msgid "Application %{app} assigns multiple nodes to component %{comp}" msgstr "" -#: ../lib/puppet/network/http/compression.rb:23 ../lib/puppet/network/http/compression.rb:27 -msgid "Puppet::Network::HTTP::Compression::Active#uncompress_body is deprecated." -msgstr "" - -#: ../lib/puppet/network/http/compression.rb:32 ../lib/puppet/network/http/compression.rb:46 -msgid "Unknown content encoding - %{encoding}" -msgstr "" - -#: ../lib/puppet/network/http/compression.rb:37 -msgid "Puppet::Network::HTTP::Compression::Active#uncompress is deprecated." -msgstr "" - -#: ../lib/puppet/network/http/compression.rb:77 -msgid "Puppet::Network::HTTP::Compression::ZlibAdapter#uncompress is deprecated." -msgstr "" - -#: ../lib/puppet/network/http/compression.rb:104 -msgid "Puppet::Network::HTTP::Compression::None#uncompress_body is deprecated." -msgstr "" - -#: ../lib/puppet/network/http/compression.rb:113 -msgid "Puppet::Network::HTTP::Compression::None#uncompress is deprecated." -msgstr "" - -#: ../lib/puppet/network/http/compression.rb:120 -msgid "Puppet::Network::HTTP::Compression::IdentityAdapter#uncompress is deprecated." -msgstr "" - #: ../lib/puppet/network/http/connection.rb:43 msgid "Unrecognized option(s): %{opts}" msgstr "" @@ -3968,12 +3940,12 @@ msgid "Missing required Accept header" msgstr "" #. TRANSLATORS 'ssl_context' is an argument and should not be translated -#: ../lib/puppet/network/http_pool.rb:61 +#: ../lib/puppet/network/http_pool.rb:63 msgid "An ssl_context is required when connecting to 'https://%{host}:%{port}'" msgstr "" #. TRANSLATORS 'ssl_context' is an argument and should not be translated -#: ../lib/puppet/network/http_pool.rb:69 +#: ../lib/puppet/network/http_pool.rb:71 msgid "An ssl_context is unnecessary when connecting to 'http://%{host}:%{port}' and will be ignored" msgstr "" @@ -7469,22 +7441,6 @@ msgstr "" msgid "Not attempting to load %{type} %{fqname} as this object was missing during a prior compilation" msgstr "" -#: ../lib/puppet/rest/route.rb:47 -msgid "Connection to cached server and port %{server}:%{port} failed: %{message}" -msgstr "" - -#: ../lib/puppet/rest/routes.rb:46 -msgid "Downloaded certificate for %{name} from %{server}" -msgstr "" - -#: ../lib/puppet/rest/routes.rb:76 -msgid "Downloaded certificate revocation list for %{name} from %{server}" -msgstr "" - -#: ../lib/puppet/rest/routes.rb:129 -msgid "Downloaded existing certificate request for %{name} from %{server}" -msgstr "" - #: ../lib/puppet/settings.rb:98 msgid "New environment loaders generated from the requested section." msgstr "" @@ -9073,37 +9029,6 @@ msgstr "" msgid "Trollop::die can only be called after Trollop::options" msgstr "" -#: ../lib/puppet/util/connection.rb:28 -msgid "Selected server from the %{setting} setting: %{server}" -msgstr "" - -#. TRANSLATORS 'server_list' is the name of a setting and should not be translated -#: ../lib/puppet/util/connection.rb:35 -msgid "Dynamically-bound server lookup failed; using first entry from the `server_list` setting: %{server}" -msgstr "" - -#: ../lib/puppet/util/connection.rb:39 -msgid "Dynamically-bound server lookup failed, falling back to %{setting} setting: %{server}" -msgstr "" - -#: ../lib/puppet/util/connection.rb:60 -msgid "Selected port from the %{setting} setting: %{port}" -msgstr "" - -#. TRANSLATORS 'server_list' is the name of a setting and should not be translated -#: ../lib/puppet/util/connection.rb:71 -msgid "Dynamically-bound port lookup failed; using first entry from the `server_list` setting: %{port}" -msgstr "" - -#. TRANSLATORS 'masterport' is the name of a setting and should not be translated -#: ../lib/puppet/util/connection.rb:75 -msgid "Dynamically-bound port lookup failed; falling back to `masterport` setting: %{port}" -msgstr "" - -#: ../lib/puppet/util/connection.rb:80 -msgid "Dynamically-bound port lookup failed; falling back to %{setting} setting: %{port}" -msgstr "" - #: ../lib/puppet/util/diff.rb:30 msgid "Cannot provide diff without the diff/lcs Ruby library" msgstr "" From 1f468fbf52fff8aa9b78fbc9096ee7408003a67c Mon Sep 17 00:00:00 2001 From: gimmy Date: Mon, 22 Jun 2020 16:29:21 +0300 Subject: [PATCH 049/731] (PUP-7445) remove win32-process usage This commit removes Puppet dependecy on win32-process gem and implements the functionalty needed by Puppet code through FFI. --- ext/windows/service/daemon.rb | 4 +- lib/puppet/util/windows.rb | 2 +- .../util/windows/monkey_patches/process.rb | 628 ++++++++++++++++++ lib/puppet/util/windows/process.rb | 2 +- lib/puppet/util/windows/string.rb | 2 - .../windows/monkey_patches/process_spec.rb | 231 +++++++ 6 files changed, 864 insertions(+), 5 deletions(-) create mode 100644 lib/puppet/util/windows/monkey_patches/process.rb create mode 100644 spec/integration/util/windows/monkey_patches/process_spec.rb diff --git a/ext/windows/service/daemon.rb b/ext/windows/service/daemon.rb index e18c19eb32c..1540f33d7d8 100755 --- a/ext/windows/service/daemon.rb +++ b/ext/windows/service/daemon.rb @@ -3,13 +3,15 @@ require 'fileutils' require 'win32/daemon' require 'win32/dir' -require 'win32/process' # This file defines utilities for logging to eventlog. While it lives inside # Puppet, it is completely independent and loads no other parts of Puppet, so we # can safely require *just* it. require 'puppet/util/windows/eventlog' +# monkey patches ruby Process to add .create method +require 'puppet/util/windows/monkey_patches/process' + class WindowsDaemon < Win32::Daemon CREATE_NEW_CONSOLE = 0x00000010 diff --git a/lib/puppet/util/windows.rb b/lib/puppet/util/windows.rb index 32b0ae7453a..2cbd5ffa806 100644 --- a/lib/puppet/util/windows.rb +++ b/lib/puppet/util/windows.rb @@ -25,7 +25,6 @@ class EventLog; end # locales table, here: https://msdn.microsoft.com/en-us/library/ms912047(v=winembedded.10).aspx require 'win32ole' ; WIN32OLE.codepage = WIN32OLE::CP_UTF8 # gems - require 'win32/process' require 'win32/dir' require 'win32/service' @@ -48,5 +47,6 @@ class EventLog; end require 'puppet/util/windows/registry' require 'puppet/util/windows/eventlog' require 'puppet/util/windows/service' + require 'puppet/util/windows/monkey_patches/process' end end diff --git a/lib/puppet/util/windows/monkey_patches/process.rb b/lib/puppet/util/windows/monkey_patches/process.rb new file mode 100644 index 00000000000..185c078c5c3 --- /dev/null +++ b/lib/puppet/util/windows/monkey_patches/process.rb @@ -0,0 +1,628 @@ +# frozen_string_literal: true + +require 'ffi' +require 'puppet/util/windows/api_types' +require 'puppet/util/windows/string' + +module Process + extend FFI::Library + extend Puppet::Util::Windows::APITypes + extend Puppet::Util::Windows::String + + # Priority constants + # https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-setpriorityclass + ABOVE_NORMAL_PRIORITY_CLASS = 0x0008000 + BELOW_NORMAL_PRIORITY_CLASS = 0x0004000 + HIGH_PRIORITY_CLASS = 0x0000080 + IDLE_PRIORITY_CLASS = 0x0000040 + NORMAL_PRIORITY_CLASS = 0x0000020 + REALTIME_PRIORITY_CLASS = 0x0000010 + + # Process Access Rights + # https://docs.microsoft.com/en-us/windows/win32/procthread/process-security-and-access-rights + PROCESS_TERMINATE = 0x00000001 + PROCESS_SET_INFORMATION = 0x00000200 + PROCESS_QUERY_INFORMATION = 0x00000400 + PROCESS_ALL_ACCESS = 0x001F0FFF + PROCESS_VM_READ = 0x00000010 + + # Process creation flags + # https://docs.microsoft.com/en-us/windows/win32/procthread/process-creation-flags + CREATE_BREAKAWAY_FROM_JOB = 0x01000000 + CREATE_DEFAULT_ERROR_MODE = 0x04000000 + CREATE_NEW_CONSOLE = 0x00000010 + CREATE_NEW_PROCESS_GROUP = 0x00000200 + CREATE_NO_WINDOW = 0x08000000 + CREATE_PROTECTED_PROCESS = 0x00040000 + CREATE_PRESERVE_CODE_AUTHZ_LEVEL = 0x02000000 + CREATE_SEPARATE_WOW_VDM = 0x00000800 + CREATE_SHARED_WOW_VDM = 0x00001000 + CREATE_SUSPENDED = 0x00000004 + CREATE_UNICODE_ENVIRONMENT = 0x00000400 + DEBUG_ONLY_THIS_PROCESS = 0x00000002 + DEBUG_PROCESS = 0x00000001 + DETACHED_PROCESS = 0x00000008 + INHERIT_PARENT_AFFINITY = 0x00010000 + + # Logon options + LOGON_WITH_PROFILE = 0x00000001 + + # STARTUPINFOA constants + # https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/ns-processthreadsapi-startupinfoa + STARTF_USESTDHANDLES = 0x00000100 + + # Miscellaneous + HANDLE_FLAG_INHERIT = 0x00000001 + SEM_FAILCRITICALERRORS = 0x00000001 + SEM_NOGPFAULTERRORBOX = 0x00000002 + + # Error constants + INVALID_HANDLE_VALUE = FFI::Pointer.new(-1).address + + ProcessInfo = Struct.new( + 'ProcessInfo', + :process_handle, + :thread_handle, + :process_id, + :thread_id + ) + + private_constant :ProcessInfo + + # https://docs.microsoft.com/en-us/previous-versions/windows/desktop/legacy/aa379560(v=vs.85) + # typedef struct _SECURITY_ATTRIBUTES { + # DWORD nLength; + # LPVOID lpSecurityDescriptor; + # BOOL bInheritHandle; + # } SECURITY_ATTRIBUTES, *PSECURITY_ATTRIBUTES, *LPSECURITY_ATTRIBUTES; + class SECURITY_ATTRIBUTES < FFI::Struct + layout( + :nLength, :dword, + :lpSecurityDescriptor, :lpvoid, + :bInheritHandle, :win32_bool + ) + end + + private_constant :SECURITY_ATTRIBUTES + + # sizeof(STARTUPINFO) == 68 + # https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/ns-processthreadsapi-startupinfoa + # typedef struct _STARTUPINFOA { + # DWORD cb; + # LPSTR lpReserved; + # LPSTR lpDesktop; + # LPSTR lpTitle; + # DWORD dwX; + # DWORD dwY; + # DWORD dwXSize; + # DWORD dwYSize; + # DWORD dwXCountChars; + # DWORD dwYCountChars; + # DWORD dwFillAttribute; + # DWORD dwFlags; + # WORD wShowWindow; + # WORD cbReserved2; + # LPBYTE lpReserved2; + # HANDLE hStdInput; + # HANDLE hStdOutput; + # HANDLE hStdError; + # } STARTUPINFOA, *LPSTARTUPINFOA; + class STARTUPINFO < FFI::Struct + layout( + :cb, :dword, + :lpReserved, :lpcstr, + :lpDesktop, :lpcstr, + :lpTitle, :lpcstr, + :dwX, :dword, + :dwY, :dword, + :dwXSize, :dword, + :dwYSize, :dword, + :dwXCountChars, :dword, + :dwYCountChars, :dword, + :dwFillAttribute, :dword, + :dwFlags, :dword, + :wShowWindow, :word, + :cbReserved2, :word, + :lpReserved2, :pointer, + :hStdInput, :handle, + :hStdOutput, :handle, + :hStdError, :handle + ) + end + + private_constant :STARTUPINFO + + # https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/ns-processthreadsapi-process_information + # typedef struct _PROCESS_INFORMATION { + # HANDLE hProcess; + # HANDLE hThread; + # DWORD dwProcessId; + # DWORD dwThreadId; + # } PROCESS_INFORMATION, *PPROCESS_INFORMATION, *LPPROCESS_INFORMATION; + class PROCESS_INFORMATION < FFI::Struct + layout( + :hProcess, :handle, + :hThread, :handle, + :dwProcessId, :dword, + :dwThreadId, :dword + ) + end + + private_constant :PROCESS_INFORMATION + + ffi_convention :stdcall + + # https://docs.microsoft.com/en-us/windows/win32/api/handleapi/nf-handleapi-sethandleinformation + # BOOL SetHandleInformation( + # HANDLE hObject, + # DWORD dwMask, + # DWORD dwFlags + # ); + ffi_lib :kernel32 + attach_function_private :SetHandleInformation, [:handle, :dword, :dword], :win32_bool + + # https://docs.microsoft.com/en-us/windows/win32/api/errhandlingapi/nf-errhandlingapi-seterrormode + # UINT SetErrorMode( + # UINT uMode + # ); + ffi_lib :kernel32 + attach_function_private :SetErrorMode, [:uint], :uint + + # https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-createprocessw + # BOOL CreateProcessW( + # LPCWSTR lpApplicationName, + # LPWSTR lpCommandLine, + # LPSECURITY_ATTRIBUTES lpProcessAttributes, + # LPSECURITY_ATTRIBUTES lpThreadAttributes, + # BOOL bInheritHandles, + # DWORD dwCreationFlags, + # LPVOID lpEnvironment, + # LPCWSTR lpCurrentDirectory, + # LPSTARTUPINFOW lpStartupInfo, + # LPPROCESS_INFORMATION lpProcessInformation + # ); + ffi_lib :kernel32 + attach_function_private :CreateProcessW, + [:lpcwstr, :lpwstr, :pointer, :pointer, :win32_bool, + :dword, :lpvoid, :lpcwstr, :pointer, :pointer], :bool + + # https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-openprocess + # HANDLE OpenProcess( + # DWORD dwDesiredAccess, + # BOOL bInheritHandle, + # DWORD dwProcessId + # ); + ffi_lib :kernel32 + attach_function_private :OpenProcess, [:dword, :win32_bool, :dword], :handle + + # https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-setpriorityclass + # BOOL SetPriorityClass( + # HANDLE hProcess, + # DWORD dwPriorityClass + # ); + ffi_lib :kernel32 + attach_function_private :SetPriorityClass, [:handle, :dword], :win32_bool + + # https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-createprocesswithlogonw + # BOOL CreateProcessWithLogonW( + # LPCWSTR lpUsername, + # LPCWSTR lpDomain, + # LPCWSTR lpPassword, + # DWORD dwLogonFlags, + # LPCWSTR lpApplicationName, + # LPWSTR lpCommandLine, + # DWORD dwCreationFlags, + # LPVOID lpEnvironment, + # LPCWSTR lpCurrentDirectory, + # LPSTARTUPINFOW lpStartupInfo, + # LPPROCESS_INFORMATION lpProcessInformation + # ); + ffi_lib :advapi32 + attach_function_private :CreateProcessWithLogonW, + [:lpcwstr, :lpcwstr, :lpcwstr, :dword, :lpcwstr, :lpwstr, + :dword, :lpvoid, :lpcwstr, :pointer, :pointer], :bool + + # https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/get-osfhandle?view=vs-2019 + # intptr_t _get_osfhandle( + # int fd + # ); + ffi_lib FFI::Library::LIBC + attach_function_private :get_osfhandle, :_get_osfhandle, [:int], :intptr_t + + begin + # https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/get-errno?view=vs-2019 + # errno_t _get_errno( + # int * pValue + # ); + attach_function_private :get_errno, :_get_errno, [:pointer], :int + rescue FFI::NotFoundError + # Do nothing, Windows XP or earlier. + end + + # Disable popups. This mostly affects the Process.kill method. + SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX) + + class << self + + private :SetHandleInformation, :SetErrorMode, :CreateProcessW, :OpenProcess, + :SetPriorityClass, :CreateProcessWithLogonW, :get_osfhandle, :get_errno + + # Process.create(key => value, ...) => ProcessInfo + # + # This is a wrapper for the CreateProcess() function. It executes a process, + # returning a ProcessInfo struct. It accepts a hash as an argument. + # There are several primary keys: + # + # * command_line (this or app_name must be present) + # * app_name (default: nil) + # * inherit (default: false) + # * process_inherit (default: false) + # * thread_inherit (default: false) + # * creation_flags (default: 0) + # * cwd (default: Dir.pwd) + # * startup_info (default: nil) + # * environment (default: nil) + # * close_handles (default: true) + # * with_logon (default: nil) + # * domain (default: nil) + # * password (default: nil, mandatory if with_logon) + # + # Of these, the 'command_line' or 'app_name' must be specified or an + # error is raised. Both may be set individually, but 'command_line' should + # be preferred if only one of them is set because it does not (necessarily) + # require an explicit path or extension to work. + # + # The 'domain' and 'password' options are only relevent in the context + # of 'with_logon'. If 'with_logon' is set, then the 'password' option is + # mandatory. + # + # The startup_info key takes a hash. Its keys are attributes that are + # part of the StartupInfo struct, and are generally only meaningful for + # GUI or console processes. See the documentation on CreateProcess() + # and the StartupInfo struct on MSDN for more information. + # + # * desktop + # * title + # * x + # * y + # * x_size + # * y_size + # * x_count_chars + # * y_count_chars + # * fill_attribute + # * sw_flags + # * startf_flags + # * stdin + # * stdout + # * stderr + # + # Note that the 'stdin', 'stdout' and 'stderr' options can be either Ruby + # IO objects or file descriptors (i.e. a fileno). However, StringIO objects + # are not currently supported. Unfortunately, setting these is not currently + # an option for JRuby. + # + # If 'stdin', 'stdout' or 'stderr' are specified, then the +inherit+ value + # is automatically set to true and the Process::STARTF_USESTDHANDLES flag is + # automatically OR'd to the +startf_flags+ value. + # + # The ProcessInfo struct contains the following members: + # + # * process_handle - The handle to the newly created process. + # * thread_handle - The handle to the primary thread of the process. + # * process_id - Process ID. + # * thread_id - Thread ID. + # + # If the 'close_handles' option is set to true (the default) then the + # process_handle and the thread_handle are automatically closed for you + # before the ProcessInfo struct is returned. + # + # If the 'with_logon' option is set, then the process runs the specified + # executable file in the security context of the specified credentials. + + VALID_KEYS = %i[ + app_name command_line inherit creation_flags cwd environment + startup_info thread_inherit process_inherit close_handles with_logon + domain password + ].freeze + + VALID_SI_KEYS = %i[ + startf_flags desktop title x y x_size y_size x_count_chars + y_count_chars fill_attribute sw_flags stdin stdout stderr + ].freeze + + private_constant :VALID_KEYS, :VALID_SI_KEYS + + def create(args) + # Validate that args is a Hash + validate_args(args) + + initialize_defaults + + # Validate the keys, and convert symbols and case to lowercase strings. + validate_keys(args) + + # If the startup_info key is present, validate its subkeys + validate_startup_info if hash[:startup_info] + + # validates that 'app_name' or 'command_line' is set + validate_command_line + + if hash[:app_name] && !hash[:command_line] + hash[:command_line] = hash[:app_name] + hash[:app_name] = nil + end + + # Setup stdin, stdout and stderr handlers + setup_std_handlers + + if logon + create_process_with_logon + else + create_process + end + + # Automatically close the process and thread handles in the + # PROCESS_INFORMATION struct unless explicitly told not to. + if hash[:close_handles] + FFI::WIN32.CloseHandle(procinfo[:hProcess]) + FFI::WIN32.CloseHandle(procinfo[:hThread]) + end + + ProcessInfo.new( + procinfo[:hProcess], + procinfo[:hThread], + procinfo[:dwProcessId], + procinfo[:dwThreadId] + ) + end + + remove_method :setpriority + + # Sets the priority class for the specified process id +int+. + # + # The +kind+ parameter is ignored but present for API compatibility. + # You can only retrieve process information, not process group or user + # information, so it is effectively always Process::PRIO_PROCESS. + # + # Possible +int_priority+ values are: + # + # * Process::NORMAL_PRIORITY_CLASS + # * Process::IDLE_PRIORITY_CLASS + # * Process::HIGH_PRIORITY_CLASS + # * Process::REALTIME_PRIORITY_CLASS + # * Process::BELOW_NORMAL_PRIORITY_CLASS + # * Process::ABOVE_NORMAL_PRIORITY_CLASS + + def setpriority(kind, int, int_priority) + raise TypeError unless kind.is_a?(Integer) + raise TypeError unless int.is_a?(Integer) + raise TypeError unless int_priority.is_a?(Integer) + + int = Process.pid if int == 0 + handle = OpenProcess(PROCESS_SET_INFORMATION, 0 , int) + + if handle == 0 + raise SystemCallError, FFI.errno, "OpenProcess" + end + + begin + result = SetPriorityClass(handle, int_priority) + raise SystemCallError, FFI.errno, "SetPriorityClass" unless result + ensure + FFI::WIN32.CloseHandle(handle) + end + + return 0 + end + + private + + def initialize_defaults + @hash = { + app_name: nil, + creation_flags: 0, + close_handles: true + } + @si_hash = nil + @procinfo = nil + end + + def validate_args(args) + raise TypeError, 'hash keyword arguments expected' unless args.is_a?(Hash) + end + + def validate_keys(args) + args.each do |key, val| + key = key.to_s.to_sym + raise ArgumentError, "invalid key '#{key}'" unless VALID_KEYS.include?(key) + + hash[key] = val + end + end + + def validate_startup_info + hash[:startup_info].each do |key, val| + key = key.to_s.to_sym + raise ArgumentError, "invalid startup_info key '#{key}'" unless VALID_SI_KEYS.include?(key) + + si_hash[key] = val + end + end + + def validate_command_line + raise ArgumentError, 'command_line or app_name must be specified' unless hash[:app_name] || hash[:command_line] + end + + def procinfo + @procinfo ||= PROCESS_INFORMATION.new + end + + def hash + @hash ||= {} + end + + def si_hash + @si_hash ||= {} + end + + def app + wide_string(hash[:app_name]) + end + + def cmd + wide_string(hash[:command_line]) + end + + def cwd + wide_string(hash[:cwd]) + end + + def password + wide_string(hash[:password]) + end + + def logon + wide_string(hash[:with_logon]) + end + + def domain + wide_string(hash[:domain]) + end + + def env + env = hash[:environment] + return unless env + + env = env.split(File::PATH_SEPARATOR) unless env.respond_to?(:join) + env = env.map { |e| e + 0.chr }.join('') + 0.chr + env = wide_string(env) if hash[:with_logon] + env + end + + def process_security + return unless hash[:process_inherit] + + process_security = SECURITY_ATTRIBUTES.new + process_security[:nLength] = SECURITY_ATTRIBUTES.size + process_security[:bInheritHandle] = 1 + process_security + end + + def thread_security + return unless hash[:thread_inherit] + + thread_security = SECURITY_ATTRIBUTES.new + thread_security[:nLength] = SECURITY_ATTRIBUTES.size + thread_security[:bInheritHandle] = 1 + thread_security + end + + # Automatically handle stdin, stdout and stderr as either IO objects + # or file descriptors. This won't work for StringIO, however. It also + # will not work on JRuby because of the way it handles internal file + # descriptors. + def setup_std_handlers + %i[stdin stdout stderr].each do |io| + next unless si_hash[io] + + handle = if si_hash[io].respond_to?(:fileno) + get_osfhandle(si_hash[io].fileno) + else + get_osfhandle(si_hash[io]) + end + + if handle == INVALID_HANDLE_VALUE + ptr = FFI::MemoryPointer.new(:int) + + errno = if get_errno(ptr).zero? + ptr.read_int + else + FFI.errno + end + + raise SystemCallError.new('get_osfhandle', errno) + end + + # Most implementations of Ruby on Windows create inheritable + # handles by default, but some do not. RF bug #26988. + bool = SetHandleInformation( + handle, + HANDLE_FLAG_INHERIT, + HANDLE_FLAG_INHERIT + ) + + raise SystemCallError.new('SetHandleInformation', FFI.errno) unless bool + + si_hash[io] = handle + si_hash[:startf_flags] ||= 0 + si_hash[:startf_flags] |= STARTF_USESTDHANDLES + hash[:inherit] = true + end + end + + def startinfo + startinfo = STARTUPINFO.new + + return startinfo if si_hash.empty? + + startinfo[:cb] = startinfo.size + startinfo[:lpDesktop] = si_hash[:desktop] if si_hash[:desktop] + startinfo[:lpTitle] = si_hash[:title] if si_hash[:title] + startinfo[:dwX] = si_hash[:x] if si_hash[:x] + startinfo[:dwY] = si_hash[:y] if si_hash[:y] + startinfo[:dwXSize] = si_hash[:x_size] if si_hash[:x_size] + startinfo[:dwYSize] = si_hash[:y_size] if si_hash[:y_size] + startinfo[:dwXCountChars] = si_hash[:x_count_chars] if si_hash[:x_count_chars] + startinfo[:dwYCountChars] = si_hash[:y_count_chars] if si_hash[:y_count_chars] + startinfo[:dwFillAttribute] = si_hash[:fill_attribute] if si_hash[:fill_attribute] + startinfo[:dwFlags] = si_hash[:startf_flags] if si_hash[:startf_flags] + startinfo[:wShowWindow] = si_hash[:sw_flags] if si_hash[:sw_flags] + startinfo[:cbReserved2] = 0 + startinfo[:hStdInput] = si_hash[:stdin] if si_hash[:stdin] + startinfo[:hStdOutput] = si_hash[:stdout] if si_hash[:stdout] + startinfo[:hStdError] = si_hash[:stderr] if si_hash[:stderr] + startinfo + end + + def create_process_with_logon + raise ArgumentError, 'password must be specified if with_logon is used' unless password + + hash[:creation_flags] |= CREATE_UNICODE_ENVIRONMENT + + bool = CreateProcessWithLogonW( + logon, # User + domain, # Domain + password, # Password + LOGON_WITH_PROFILE, # Logon flags + app, # App name + cmd, # Command line + hash[:creation_flags], # Creation flags + env, # Environment + cwd, # Working directory + startinfo, # Startup Info + procinfo # Process Info + ) + + raise SystemCallError.new('CreateProcessWithLogonW', FFI.errno) unless bool + end + + def create_process + inherit = hash[:inherit] ? 1 : 0 + + bool = CreateProcessW( + app, # App name + cmd, # Command line + process_security, # Process attributes + thread_security, # Thread attributes + inherit, # Inherit handles? + hash[:creation_flags], # Creation flags + env, # Environment + cwd, # Working directory + startinfo, # Startup Info + procinfo # Process Info + ) + + raise SystemCallError.new('CreateProcess', FFI.errno) unless bool + end + end +end diff --git a/lib/puppet/util/windows/process.rb b/lib/puppet/util/windows/process.rb index 98f8d05ac39..605713fd75e 100644 --- a/lib/puppet/util/windows/process.rb +++ b/lib/puppet/util/windows/process.rb @@ -1,6 +1,6 @@ require 'puppet/util/windows' -require 'win32/process' require 'ffi' +require 'puppet/util/windows/monkey_patches/process' module Puppet::Util::Windows::Process extend Puppet::Util::Windows::String diff --git a/lib/puppet/util/windows/string.rb b/lib/puppet/util/windows/string.rb index 2c911ef27a5..de680d25c0a 100644 --- a/lib/puppet/util/windows/string.rb +++ b/lib/puppet/util/windows/string.rb @@ -1,5 +1,3 @@ -require 'puppet/util/windows' - module Puppet::Util::Windows::String def wide_string(str) # if given a nil string, assume caller wants to pass a nil pointer to win32 diff --git a/spec/integration/util/windows/monkey_patches/process_spec.rb b/spec/integration/util/windows/monkey_patches/process_spec.rb new file mode 100644 index 00000000000..53eff034a63 --- /dev/null +++ b/spec/integration/util/windows/monkey_patches/process_spec.rb @@ -0,0 +1,231 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe 'Process', if: Puppet::Util::Platform.windows? do + describe '.create' do + context 'with common flags' do + it do + Process.create( + app_name: 'cmd.exe /c echo 123', + creation_flags: 0x00000008, + process_inherit: false, + thread_inherit: false, + cwd: 'C:\\' + ) + end + + context 'when FFI call fails' do + before do + allow(Process).to receive(:CreateProcessW).and_return(false) + end + + it 'raises SystemCallError' do + expect do + Process.create( + app_name: 'cmd.exe /c echo 123', + creation_flags: 0x00000008 + ) + end.to raise_error(SystemCallError) + end + end + end + + context 'with logon' do + context 'without password' do + it 'raises error' do + expect do + Process.create( + app_name: 'cmd.exe /c echo 123', + creation_flags: 0x00000008, + with_logon: 'test' + ) + end.to raise_error(ArgumentError, 'password must be specified if with_logon is used') + end + end + + context 'with common flags' do + before do + allow(Process).to receive(:CreateProcessWithLogonW).and_return(true) + end + + it do + Process.create( + app_name: 'cmd.exe /c echo 123', + creation_flags: 0x00000008, + process_inherit: false, + thread_inherit: false, + with_logon: 'test', + password: 'password', + cwd: 'C:\\' + ) + end + + context 'when FFI call fails' do + before do + allow(Process).to receive(:CreateProcessWithLogonW).and_return(false) + end + + it 'raises SystemCallError' do + expect do + Process.create( + app_name: 'cmd.exe /c echo 123', + creation_flags: 0x00000008, + with_logon: 'test', + password: 'password' + ) + end.to raise_error(SystemCallError) + end + end + end + end + + describe 'validations' do + context 'when args is not a hash' do + it 'raises TypeError' do + expect do + Process.create('test') + end.to raise_error(TypeError, 'hash keyword arguments expected') + end + end + + context 'when args key is invalid' do + it 'raises ArgumentError' do + expect do + Process.create(invalid_key: 'test') + end.to raise_error(ArgumentError, "invalid key 'invalid_key'") + end + end + + context 'when startup_info is invalid' do + it 'raises ArgumentError' do + expect do + Process.create(startup_info: { invalid_key: 'test' }) + end.to raise_error(ArgumentError, "invalid startup_info key 'invalid_key'") + end + end + + context 'when app_name and command_line are missing' do + it 'raises ArgumentError' do + expect do + Process.create(creation_flags: 0) + end.to raise_error(ArgumentError, 'command_line or app_name must be specified') + end + end + + context 'when executable is not found' do + it 'raises Errno::ENOENT' do + expect do + Process.create(app_name: 'non_existent') + end.to raise_error(Errno::ENOENT) + end + end + end + + context 'when environment is not specified' do + it 'passes local environment' do + stdout_read, stdout_write = IO.pipe + ENV['TEST_ENV'] = 'B' + + Process.create( + app_name: 'cmd.exe /c echo %TEST_ENV%', + creation_flags: 0x00000008, + startup_info: { stdout: stdout_write } + ) + + stdout_write.close + expect(stdout_read.read.chomp).to eql('B') + end + end + + context 'when environment is specified' do + it 'does not pass local environment' do + stdout_read, stdout_write = IO.pipe + ENV['TEST_ENV'] = 'B' + + Process.create( + app_name: 'cmd.exe /c echo %TEST_ENV%', + creation_flags: 0x00000008, + environment: '', + startup_info: { stdout: stdout_write } + ) + + stdout_write.close + expect(stdout_read.read.chomp).to eql('%TEST_ENV%') + end + + it 'supports :environment as a string' do + stdout_read, stdout_write = IO.pipe + + Process.create( + app_name: 'cmd.exe /c echo %A% %B%', + creation_flags: 0x00000008, + environment: 'A=C;B=D', + startup_info: { stdout: stdout_write } + ) + + stdout_write.close + expect(stdout_read.read.chomp).to eql('C D') + end + + it 'supports :environment as a string' do + stdout_read, stdout_write = IO.pipe + + Process.create( + app_name: 'cmd.exe /c echo %A% %C%', + creation_flags: 0x00000008, + environment: ['A=B;X;', 'C=;D;Y'], + startup_info: { stdout: stdout_write } + ) + + stdout_write.close + expect(stdout_read.read.chomp).to eql('B;X; ;D;Y') + end + end + end + + describe '.setpriority' do + let(:priority) { Process::BELOW_NORMAL_PRIORITY_CLASS } + + context 'when success' do + it 'returns 0' do + expect(Process.setpriority(0, Process.pid, priority)).to eql(0) + end + + it 'treats an int argument of zero as the current process' do + expect(Process.setpriority(0, 0, priority)).to eql(0) + end + end + + context 'when invalid arguments are sent' do + it 'raises TypeError' do + expect { + Process.setpriority('test', 0, priority) + }.to raise_error(TypeError) + end + end + + context 'when process is not found' do + before do + allow(Process).to receive(:OpenProcess).and_return(0) + end + it 'raises SystemCallError' do + expect { + Process.setpriority(0, 0, priority) + }.to raise_error(SystemCallError) + end + end + + context 'when priority is not set' do + before do + allow(Process).to receive(:SetPriorityClass).and_return(false) + end + + it 'raises SystemCallError' do + expect { + Process.setpriority(0, 0, priority) + }.to raise_error(SystemCallError) + end + end + end +end From 6c47969cb180ab5e056565854e78a962b43ab82e Mon Sep 17 00:00:00 2001 From: Gabriel Nagy Date: Fri, 7 Aug 2020 16:21:08 +0300 Subject: [PATCH 050/731] (PUP-5758) Pull win32/daemon into our codebase Attempt to get just the parts that we need for our daemon and put functions in the right place. Requiring `puppet/util/windows` will fail when requiring `puppet/util/windows/error` due to a missing `Puppet::Error` constant, so explicitly require `puppet/error` in `puppet/util/windows/error`. Remove requires to `win32/service`. --- ext/windows/service/daemon.rb | 4 +- lib/puppet/util/windows.rb | 1 - lib/puppet/util/windows/daemon.rb | 358 +++++++++++++++++++++ lib/puppet/util/windows/error.rb | 1 + lib/puppet/util/windows/process.rb | 43 +++ lib/puppet/util/windows/service.rb | 46 +++ spec/unit/provider/service/windows_spec.rb | 1 - 7 files changed, 450 insertions(+), 4 deletions(-) create mode 100644 lib/puppet/util/windows/daemon.rb diff --git a/ext/windows/service/daemon.rb b/ext/windows/service/daemon.rb index 1540f33d7d8..903d29bfb0c 100755 --- a/ext/windows/service/daemon.rb +++ b/ext/windows/service/daemon.rb @@ -1,7 +1,7 @@ #!/usr/bin/env ruby require 'fileutils' -require 'win32/daemon' +require 'puppet/util/windows/daemon' require 'win32/dir' # This file defines utilities for logging to eventlog. While it lives inside @@ -12,7 +12,7 @@ # monkey patches ruby Process to add .create method require 'puppet/util/windows/monkey_patches/process' -class WindowsDaemon < Win32::Daemon +class WindowsDaemon < Puppet::Util::Windows::Daemon CREATE_NEW_CONSOLE = 0x00000010 @run_thread = nil diff --git a/lib/puppet/util/windows.rb b/lib/puppet/util/windows.rb index 2cbd5ffa806..5ff5221bf97 100644 --- a/lib/puppet/util/windows.rb +++ b/lib/puppet/util/windows.rb @@ -26,7 +26,6 @@ class EventLog; end require 'win32ole' ; WIN32OLE.codepage = WIN32OLE::CP_UTF8 # gems require 'win32/dir' - require 'win32/service' # these reference platform specific gems require 'puppet/util/windows/api_types' diff --git a/lib/puppet/util/windows/daemon.rb b/lib/puppet/util/windows/daemon.rb new file mode 100644 index 00000000000..b5ad1c44591 --- /dev/null +++ b/lib/puppet/util/windows/daemon.rb @@ -0,0 +1,358 @@ +require 'puppet/util/windows' +require 'ffi' + +module Puppet::Util::Windows + + # The Daemon class, based on the chef/win32-service implementation + class Daemon + include Puppet::Util::Windows::Service + include Puppet::Util::Windows::Process + + extend Puppet::Util::Windows::Service + extend Puppet::Util::Windows::Process + + # Service is not running + STOPPED = SERVICE_STOPPED + + # Service has received a start signal but is not yet running + START_PENDING = SERVICE_START_PENDING + + # Service has received a stop signal but is not yet stopped + STOP_PENDING = SERVICE_STOP_PENDING + + # Service is running + RUNNING = SERVICE_RUNNING + + # Service has received a signal to resume but is not yet running + CONTINUE_PENDING = SERVICE_CONTINUE_PENDING + + # Service has received a signal to pause but is not yet paused + PAUSE_PENDING = SERVICE_PAUSE_PENDING + + # Service is paused + PAUSED = SERVICE_PAUSED + + # Service controls + + # Notifies service that it should stop + CONTROL_STOP = SERVICE_CONTROL_STOP + + # Notifies service that it should pause + CONTROL_PAUSE = SERVICE_CONTROL_PAUSE + + # Notifies service that it should resume + CONTROL_CONTINUE = SERVICE_CONTROL_CONTINUE + + # Notifies service that it should return its current status information + CONTROL_INTERROGATE = SERVICE_CONTROL_INTERROGATE + + # Notifies a service that its parameters have changed + CONTROL_PARAMCHANGE = SERVICE_CONTROL_PARAMCHANGE + + # Notifies a service that there is a new component for binding + CONTROL_NETBINDADD = SERVICE_CONTROL_NETBINDADD + + # Notifies a service that a component for binding has been removed + CONTROL_NETBINDREMOVE = SERVICE_CONTROL_NETBINDREMOVE + + # Notifies a service that a component for binding has been enabled + CONTROL_NETBINDENABLE = SERVICE_CONTROL_NETBINDENABLE + + # Notifies a service that a component for binding has been disabled + CONTROL_NETBINDDISABLE = SERVICE_CONTROL_NETBINDDISABLE + + IDLE = 0 + + # Misc + IDLE_CONTROL_CODE = 0 + WAIT_OBJECT_0 = 0 + WAIT_TIMEOUT = 0x00000102 + WAIT_FAILED = 0xFFFFFFFF + NO_ERROR = 0 + + # Wraps SetServiceStatus. + SetTheServiceStatus = Proc.new do |dwCurrentState, dwWin32ExitCode, dwCheckPoint, dwWaitHint| + ss = SERVICE_STATUS.new # Current status of the service. + + # Disable control requests until the service is started. + if dwCurrentState == SERVICE_START_PENDING + ss[:dwControlsAccepted] = 0 + else + ss[:dwControlsAccepted] = + SERVICE_ACCEPT_STOP|SERVICE_ACCEPT_SHUTDOWN| + SERVICE_ACCEPT_PAUSE_CONTINUE|SERVICE_ACCEPT_PARAMCHANGE + end + + # Initialize ss structure. + ss[:dwServiceType] = SERVICE_WIN32_OWN_PROCESS + ss[:dwServiceSpecificExitCode] = 0 + ss[:dwCurrentState] = dwCurrentState + ss[:dwWin32ExitCode] = dwWin32ExitCode + ss[:dwCheckPoint] = dwCheckPoint + ss[:dwWaitHint] = dwWaitHint + + @@dwServiceState = dwCurrentState + + # Send status of the service to the Service Controller. + if !SetServiceStatus(@@ssh, ss) + SetEvent(@@hStopEvent) + end + end + + ERROR_CALL_NOT_IMPLEMENTED = 0x78 + + # Handles control signals from the service control manager. + Service_Ctrl_ex = Proc.new do |dwCtrlCode, dwEventType, lpEventData, lpContext| + @@waiting_control_code = dwCtrlCode; + return_value = NO_ERROR + + begin + dwState = SERVICE_RUNNING + + case dwCtrlCode + when SERVICE_CONTROL_STOP + dwState = SERVICE_STOP_PENDING + when SERVICE_CONTROL_SHUTDOWN + dwState = SERVICE_STOP_PENDING + when SERVICE_CONTROL_PAUSE + dwState = SERVICE_PAUSED + when SERVICE_CONTROL_CONTINUE + dwState = SERVICE_RUNNING + #else + # TODO: Handle other control codes? Retain the current state? + end + + # Set the status of the service except on interrogation. + unless dwCtrlCode == SERVICE_CONTROL_INTERROGATE + SetTheServiceStatus.call(dwState, NO_ERROR, 0, 0) + end + + # Tell service_main thread to stop. + if dwCtrlCode == SERVICE_CONTROL_STOP || dwCtrlCode == SERVICE_CONTROL_SHUTDOWN + if SetEvent(@@hStopEvent) == 0 + SetTheServiceStatus.call(SERVICE_STOPPED, FFI.errno, 0, 0) + end + end + rescue + return_value = ERROR_CALL_NOT_IMPLEMENTED + end + + return_value + end + + # Called by the service control manager after the call to StartServiceCtrlDispatcher. + Service_Main = FFI::Function.new(:void, [:ulong, :pointer], :blocking => false) do |dwArgc, lpszArgv| + begin + # Obtain the name of the service. + if lpszArgv.address != 0 + argv = lpszArgv.get_array_of_string(0, dwArgc) + lpszServiceName = argv[0] + else + lpszServiceName = '' + end + + # Args passed to Service.start + if(dwArgc > 1) + @@Argv = argv[1..-1] + else + @@Argv = nil + end + + # Register the service ctrl handler. + @@ssh = RegisterServiceCtrlHandlerExA( + lpszServiceName, + Service_Ctrl_ex, + nil + ) + + # No service to stop, no service handle to notify, nothing to do but exit. + break if @@ssh == 0 + + # The service has started. + SetTheServiceStatus.call(SERVICE_RUNNING, NO_ERROR, 0, 0) + + SetEvent(@@hStartEvent) + + # Main loop for the service. + while(WaitForSingleObject(@@hStopEvent, 1000) != WAIT_OBJECT_0) do + end + + # Main loop for the service. + while(WaitForSingleObject(@@hStopCompletedEvent, 1000) != WAIT_OBJECT_0) do + end + ensure + # Stop the service. + SetTheServiceStatus.call(SERVICE_STOPPED, NO_ERROR, 0, 0) + end + end + + ThreadProc = FFI::Function.new(:ulong,[:pointer]) do |lpParameter| + ste = FFI::MemoryPointer.new(SERVICE_TABLE_ENTRYA, 2) + + s = SERVICE_TABLE_ENTRYA.new(ste[0]) + s[:lpServiceName] = FFI::MemoryPointer.from_string('') + s[:lpServiceProc] = lpParameter + + s = SERVICE_TABLE_ENTRYA.new(ste[1]) + s[:lpServiceName] = nil + s[:lpServiceProc] = nil + + # No service to step, no service handle, no ruby exceptions, just terminate the thread.. + if !StartServiceCtrlDispatcherA(ste) + return 1 + end + + return 0 + end + + # This is a shortcut for Daemon.new + Daemon#mainloop. + # + def self.mainloop + self.new.mainloop + end + + # This is the method that actually puts your code into a loop and allows it + # to run as a service. The code that is actually run while in the mainloop + # is what you defined in your own Daemon#service_main method. + # + def mainloop + @@waiting_control_code = IDLE_CONTROL_CODE + @@dwServiceState = 0 + + # Redirect STDIN, STDOUT and STDERR to the NUL device if they're still + # associated with a tty. This helps newbs avoid Errno::EBADF errors. + STDIN.reopen('NUL') if STDIN.isatty + STDOUT.reopen('NUL') if STDOUT.isatty + STDERR.reopen('NUL') if STDERR.isatty + + # Calling init here so that init failures never even tries to start the + # service. Of course that means that init methods must be very quick + # because the SCM will be receiving no START_PENDING messages while + # init's running. + # + # TODO: Fix? + service_init() if respond_to?('service_init') + + # Create the event to signal the service to start. + @@hStartEvent = CreateEventA(nil, 1, 0, nil) + + if @@hStartEvent == 0 + raise SystemCallError.new('CreateEvent', FFI.errno) + end + + # Create the event to signal the service to stop. + @@hStopEvent = CreateEventA(nil, 1, 0, nil) + + if @@hStopEvent == 0 + raise SystemCallError.new('CreateEvent', FFI.errno) + end + + # Create the event to signal the service that stop has completed + @@hStopCompletedEvent = CreateEventA(nil, 1, 0, nil) + + if @@hStopCompletedEvent == 0 + raise SystemCallError.new('CreateEvent', FFI.errno) + end + + hThread = CreateThread(nil, 0, ThreadProc, Service_Main, 0, nil) + + if hThread == 0 + raise SystemCallError.new('CreateThread', FFI.errno) + end + + events = FFI::MemoryPointer.new(:pointer, 2) + events.put_pointer(0, FFI::Pointer.new(hThread)) + events.put_pointer(FFI::Pointer.size, FFI::Pointer.new(@@hStartEvent)) + + while ((index = WaitForMultipleObjects(2, events, 0, 1000)) == WAIT_TIMEOUT) do + end + + if index == WAIT_FAILED + raise SystemCallError.new('WaitForMultipleObjects', FFI.errno) + end + + # The thread exited, so the show is off. + if index == WAIT_OBJECT_0 + raise "Service_Main thread exited abnormally" + end + + thr = Thread.new do + begin + while(WaitForSingleObject(@@hStopEvent, 1000) == WAIT_TIMEOUT) + # Check to see if anything interesting has been signaled + case @@waiting_control_code + when SERVICE_CONTROL_PAUSE + service_pause() if respond_to?('service_pause') + when SERVICE_CONTROL_CONTINUE + service_resume() if respond_to?('service_resume') + when SERVICE_CONTROL_INTERROGATE + service_interrogate() if respond_to?('service_interrogate') + when SERVICE_CONTROL_SHUTDOWN + service_shutdown() if respond_to?('service_shutdown') + when SERVICE_CONTROL_PARAMCHANGE + service_paramchange() if respond_to?('service_paramchange') + when SERVICE_CONTROL_NETBINDADD + service_netbindadd() if respond_to?('service_netbindadd') + when SERVICE_CONTROL_NETBINDREMOVE + service_netbindremove() if respond_to?('service_netbindremove') + when SERVICE_CONTROL_NETBINDENABLE + service_netbindenable() if respond_to?('service_netbindenable') + when SERVICE_CONTROL_NETBINDDISABLE + service_netbinddisable() if respond_to?('service_netbinddisable') + end + @@waiting_control_code = IDLE_CONTROL_CODE + end + + service_stop() if respond_to?('service_stop') + ensure + SetEvent(@@hStopCompletedEvent) + end + end + + if respond_to?('service_main') + service_main(*@@Argv) + end + + thr.join + end + + # Returns the state of the service (as an constant integer) which can be any + # of the service status constants, e.g. RUNNING, PAUSED, etc. + # + # This method is typically used within your service_main method to setup the + # loop. For example: + # + # class MyDaemon < Daemon + # def service_main + # while state == RUNNING || state == PAUSED || state == IDLE + # # Your main loop here + # end + # end + # end + # + # See the Daemon#running? method for an abstraction of the above code. + # + def state + @@dwServiceState + end + + # + # Returns whether or not the service is in a running state, i.e. the service + # status is either RUNNING, PAUSED or IDLE. + # + # This is typically used within your service_main method to setup the main + # loop. For example: + # + # class MyDaemon < Daemon + # def service_main + # while running? + # # Your main loop here + # end + # end + # end + # + def running? + [SERVICE_RUNNING, SERVICE_PAUSED, 0].include?(@@dwServiceState) + end + end +end diff --git a/lib/puppet/util/windows/error.rb b/lib/puppet/util/windows/error.rb index e4e49e77a71..24ecc7b1f69 100644 --- a/lib/puppet/util/windows/error.rb +++ b/lib/puppet/util/windows/error.rb @@ -1,4 +1,5 @@ require 'puppet/util/windows' +require 'puppet/error' # represents an error resulting from a Win32 error code class Puppet::Util::Windows::Error < Puppet::Error diff --git a/lib/puppet/util/windows/process.rb b/lib/puppet/util/windows/process.rb index 605713fd75e..875122eff4b 100644 --- a/lib/puppet/util/windows/process.rb +++ b/lib/puppet/util/windows/process.rb @@ -379,6 +379,49 @@ def supports_elevated_security? attach_function_private :WaitForSingleObject, [:handle, :dword], :dword + # https://docs.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-waitformultipleobjects + # DWORD WaitForMultipleObjects( + # DWORD nCount, + # const HANDLE *lpHandles, + # BOOL bWaitAll, + # DWORD dwMilliseconds + # ); + ffi_lib :kernel32 + attach_function_private :WaitForMultipleObjects, + [:dword, :phandle, :win32_bool, :dword], :dword + + # https://docs.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-createeventa + # HANDLE CreateEventA( + # LPSECURITY_ATTRIBUTES lpEventAttributes, + # BOOL bManualReset, + # BOOL bInitialState, + # LPCSTR lpName + # ); + ffi_lib :kernel32 + attach_function_private :CreateEventA, + [:pointer, :win32_bool, :win32_bool, :lpcstr], :handle + + # https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-createthread + # HANDLE CreateThread( + # LPSECURITY_ATTRIBUTES lpThreadAttributes, + # SIZE_T dwStackSize, + # LPTHREAD_START_ROUTINE lpStartAddress, + # __drv_aliasesMem LPVOID lpParameter, + # DWORD dwCreationFlags, + # LPDWORD lpThreadId + # ); + ffi_lib :kernel32 + attach_function_private :CreateThread, + [:pointer, :size_t, :pointer, :lpvoid, :dword, :lpdword], :handle, :blocking => true + + # https://docs.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-setevent + # BOOL SetEvent( + # HANDLE hEvent + # ); + ffi_lib :kernel32 + attach_function_private :SetEvent, + [:handle], :win32_bool + # https://msdn.microsoft.com/en-us/library/windows/desktop/ms683189(v=vs.85).aspx # BOOL WINAPI GetExitCodeProcess( # _In_ HANDLE hProcess, diff --git a/lib/puppet/util/windows/service.rb b/lib/puppet/util/windows/service.rb index 440fbd2e376..e75481642c5 100644 --- a/lib/puppet/util/windows/service.rb +++ b/lib/puppet/util/windows/service.rb @@ -317,6 +317,17 @@ class QUERY_SERVICE_CONFIGW < FFI::Struct ) end + # typedef struct _SERVICE_TABLE_ENTRYA { + # LPSTR lpServiceName; + # LPSERVICE_MAIN_FUNCTIONA lpServiceProc; + # } SERVICE_TABLE_ENTRYA, *LPSERVICE_TABLE_ENTRYA; + class SERVICE_TABLE_ENTRYA < FFI::Struct + layout( + :lpServiceName, :pointer, + :lpServiceProc, :pointer + ) + end + # Returns true if the service exists, false otherwise. # # @param [String] service_name name of the service @@ -1068,6 +1079,23 @@ def milliseconds_to_seconds(wait_hint) attach_function_private :StartServiceW, [:handle, :dword, :pointer], :win32_bool + # https://docs.microsoft.com/en-us/windows/win32/api/winsvc/nf-winsvc-startservicectrldispatchera + # BOOL StartServiceCtrlDispatcherA( + # const SERVICE_TABLE_ENTRYA *lpServiceStartTable + # ); + ffi_lib :advapi32 + attach_function_private :StartServiceCtrlDispatcherA, + [:pointer], :win32_bool, :blocking => true + + # https://docs.microsoft.com/en-us/windows/win32/api/winsvc/nf-winsvc-setservicestatus + # BOOL SetServiceStatus( + # SERVICE_STATUS_HANDLE hServiceStatus, + # LPSERVICE_STATUS lpServiceStatus + # ); + ffi_lib :advapi32 + attach_function_private :SetServiceStatus, + [:handle, :pointer], :win32_bool + # https://docs.microsoft.com/en-us/windows/desktop/api/winsvc/nf-winsvc-controlservice # BOOL ControlService( # SC_HANDLE hService, @@ -1078,6 +1106,24 @@ def milliseconds_to_seconds(wait_hint) attach_function_private :ControlService, [:handle, :dword, :pointer], :win32_bool + # DWORD LphandlerFunctionEx( + # DWORD dwControl, + # DWORD dwEventType, + # LPVOID lpEventData, + # LPVOID lpContext + # ) + callback :handler_ex, [:dword, :dword, :lpvoid, :lpvoid], :void + + # https://docs.microsoft.com/en-us/windows/win32/api/winsvc/nf-winsvc-registerservicectrlhandlerexa + # SERVICE_STATUS_HANDLE RegisterServiceCtrlHandlerExA( + # LPCSTR lpServiceName, + # LPHANDLER_FUNCTION_EX lpHandlerProc, + # LPVOID lpContext + # ); + ffi_lib :advapi32 + attach_function_private :RegisterServiceCtrlHandlerExA, + [:lpcstr, :handler_ex, :lpvoid], :handle + # https://docs.microsoft.com/en-us/windows/desktop/api/winsvc/nf-winsvc-changeserviceconfigw # BOOL ChangeServiceConfigW( # SC_HANDLE hService, diff --git a/spec/unit/provider/service/windows_spec.rb b/spec/unit/provider/service/windows_spec.rb index f5df0fdd52f..0c6fa01ce94 100644 --- a/spec/unit/provider/service/windows_spec.rb +++ b/spec/unit/provider/service/windows_spec.rb @@ -1,5 +1,4 @@ require 'spec_helper' -require 'win32/service' if Puppet::Util::Platform.windows? describe 'Puppet::Type::Service::Provider::Windows', :if => Puppet::Util::Platform.windows? && !Puppet::Util::Platform.jruby? do From 43d7b48b04b2787ec5dc46958eee5a2f88fd5dda Mon Sep 17 00:00:00 2001 From: Gabriel Nagy Date: Thu, 6 Aug 2020 17:18:25 +0300 Subject: [PATCH 051/731] (PUP-5758) Use wide-char Win32 functions --- lib/puppet/util/windows/daemon.rb | 16 ++++++++-------- lib/puppet/util/windows/process.rb | 10 +++++----- lib/puppet/util/windows/service.rb | 28 ++++++++++++++-------------- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/lib/puppet/util/windows/daemon.rb b/lib/puppet/util/windows/daemon.rb index b5ad1c44591..cd9fc9fabe5 100644 --- a/lib/puppet/util/windows/daemon.rb +++ b/lib/puppet/util/windows/daemon.rb @@ -159,7 +159,7 @@ class Daemon end # Register the service ctrl handler. - @@ssh = RegisterServiceCtrlHandlerExA( + @@ssh = RegisterServiceCtrlHandlerExW( lpszServiceName, Service_Ctrl_ex, nil @@ -187,18 +187,18 @@ class Daemon end ThreadProc = FFI::Function.new(:ulong,[:pointer]) do |lpParameter| - ste = FFI::MemoryPointer.new(SERVICE_TABLE_ENTRYA, 2) + ste = FFI::MemoryPointer.new(SERVICE_TABLE_ENTRYW, 2) - s = SERVICE_TABLE_ENTRYA.new(ste[0]) + s = SERVICE_TABLE_ENTRYW.new(ste[0]) s[:lpServiceName] = FFI::MemoryPointer.from_string('') s[:lpServiceProc] = lpParameter - s = SERVICE_TABLE_ENTRYA.new(ste[1]) + s = SERVICE_TABLE_ENTRYW.new(ste[1]) s[:lpServiceName] = nil s[:lpServiceProc] = nil # No service to step, no service handle, no ruby exceptions, just terminate the thread.. - if !StartServiceCtrlDispatcherA(ste) + if !StartServiceCtrlDispatcherW(ste) return 1 end @@ -234,21 +234,21 @@ def mainloop service_init() if respond_to?('service_init') # Create the event to signal the service to start. - @@hStartEvent = CreateEventA(nil, 1, 0, nil) + @@hStartEvent = CreateEventW(nil, 1, 0, nil) if @@hStartEvent == 0 raise SystemCallError.new('CreateEvent', FFI.errno) end # Create the event to signal the service to stop. - @@hStopEvent = CreateEventA(nil, 1, 0, nil) + @@hStopEvent = CreateEventW(nil, 1, 0, nil) if @@hStopEvent == 0 raise SystemCallError.new('CreateEvent', FFI.errno) end # Create the event to signal the service that stop has completed - @@hStopCompletedEvent = CreateEventA(nil, 1, 0, nil) + @@hStopCompletedEvent = CreateEventW(nil, 1, 0, nil) if @@hStopCompletedEvent == 0 raise SystemCallError.new('CreateEvent', FFI.errno) diff --git a/lib/puppet/util/windows/process.rb b/lib/puppet/util/windows/process.rb index 875122eff4b..4a9e874f07f 100644 --- a/lib/puppet/util/windows/process.rb +++ b/lib/puppet/util/windows/process.rb @@ -390,16 +390,16 @@ def supports_elevated_security? attach_function_private :WaitForMultipleObjects, [:dword, :phandle, :win32_bool, :dword], :dword - # https://docs.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-createeventa - # HANDLE CreateEventA( + # https://docs.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-createeventw + # HANDLE CreateEventW( # LPSECURITY_ATTRIBUTES lpEventAttributes, # BOOL bManualReset, # BOOL bInitialState, - # LPCSTR lpName + # LPCWSTR lpName # ); ffi_lib :kernel32 - attach_function_private :CreateEventA, - [:pointer, :win32_bool, :win32_bool, :lpcstr], :handle + attach_function_private :CreateEventW, + [:pointer, :win32_bool, :win32_bool, :lpcwstr], :handle # https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-createthread # HANDLE CreateThread( diff --git a/lib/puppet/util/windows/service.rb b/lib/puppet/util/windows/service.rb index e75481642c5..16b14ed282d 100644 --- a/lib/puppet/util/windows/service.rb +++ b/lib/puppet/util/windows/service.rb @@ -317,11 +317,11 @@ class QUERY_SERVICE_CONFIGW < FFI::Struct ) end - # typedef struct _SERVICE_TABLE_ENTRYA { - # LPSTR lpServiceName; - # LPSERVICE_MAIN_FUNCTIONA lpServiceProc; - # } SERVICE_TABLE_ENTRYA, *LPSERVICE_TABLE_ENTRYA; - class SERVICE_TABLE_ENTRYA < FFI::Struct + # typedef struct _SERVICE_TABLE_ENTRYW { + # LPWSTR lpServiceName; + # LPSERVICE_MAIN_FUNCTIONW lpServiceProc; + # } SERVICE_TABLE_ENTRYW, *LPSERVICE_TABLE_ENTRYW; + class SERVICE_TABLE_ENTRYW < FFI::Struct layout( :lpServiceName, :pointer, :lpServiceProc, :pointer @@ -1079,12 +1079,12 @@ def milliseconds_to_seconds(wait_hint) attach_function_private :StartServiceW, [:handle, :dword, :pointer], :win32_bool - # https://docs.microsoft.com/en-us/windows/win32/api/winsvc/nf-winsvc-startservicectrldispatchera - # BOOL StartServiceCtrlDispatcherA( - # const SERVICE_TABLE_ENTRYA *lpServiceStartTable + # https://docs.microsoft.com/en-us/windows/win32/api/winsvc/nf-winsvc-startservicectrldispatcherw + # BOOL StartServiceCtrlDispatcherW( + # const SERVICE_TABLE_ENTRYW *lpServiceStartTable # ); ffi_lib :advapi32 - attach_function_private :StartServiceCtrlDispatcherA, + attach_function_private :StartServiceCtrlDispatcherW, [:pointer], :win32_bool, :blocking => true # https://docs.microsoft.com/en-us/windows/win32/api/winsvc/nf-winsvc-setservicestatus @@ -1114,15 +1114,15 @@ def milliseconds_to_seconds(wait_hint) # ) callback :handler_ex, [:dword, :dword, :lpvoid, :lpvoid], :void - # https://docs.microsoft.com/en-us/windows/win32/api/winsvc/nf-winsvc-registerservicectrlhandlerexa - # SERVICE_STATUS_HANDLE RegisterServiceCtrlHandlerExA( - # LPCSTR lpServiceName, + # https://docs.microsoft.com/en-us/windows/win32/api/winsvc/nf-winsvc-registerservicectrlhandlerexw + # SERVICE_STATUS_HANDLE RegisterServiceCtrlHandlerExW( + # LPCWSTR lpServiceName, # LPHANDLER_FUNCTION_EX lpHandlerProc, # LPVOID lpContext # ); ffi_lib :advapi32 - attach_function_private :RegisterServiceCtrlHandlerExA, - [:lpcstr, :handler_ex, :lpvoid], :handle + attach_function_private :RegisterServiceCtrlHandlerExW, + [:lpcwstr, :handler_ex, :lpvoid], :handle # https://docs.microsoft.com/en-us/windows/desktop/api/winsvc/nf-winsvc-changeserviceconfigw # BOOL ChangeServiceConfigW( From 51d0a7dc73a449ba40b86b100eef74c3e3f339c7 Mon Sep 17 00:00:00 2001 From: Gabriel Nagy Date: Wed, 5 Aug 2020 12:24:36 +0300 Subject: [PATCH 052/731] (PUP-5758) Increase timeout for service test Since we now include the entire `puppet/util/windows` tree when using the daemon, starting the puppet service on Windows takes a few seconds more, which causes the `puppet_service_runs_puppet.rb` test to fail at times. Increase the timeout to a more reasonable value. PUP-10606 was filed to extract common FFI to a different module. --- acceptance/tests/resource/service/puppet_service_runs_puppet.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/acceptance/tests/resource/service/puppet_service_runs_puppet.rb b/acceptance/tests/resource/service/puppet_service_runs_puppet.rb index 41ccb8c6a53..a8a591cac81 100644 --- a/acceptance/tests/resource/service/puppet_service_runs_puppet.rb +++ b/acceptance/tests/resource/service/puppet_service_runs_puppet.rb @@ -30,7 +30,7 @@ assert_service_status_on_host(agent, 'puppet', {'ensure' => 'running'}) end - retry_params = {:max_retries => 10, + retry_params = {:max_retries => 15, :retry_interval => 2} step 'Ensure last_run_report.yaml is created' do From e1551000c8c12935f34b9598e1276296cd230064 Mon Sep 17 00:00:00 2001 From: Dorin Pleava Date: Fri, 7 Aug 2020 17:27:47 +0300 Subject: [PATCH 053/731] (PUP-10486) Remove deprecated Enumeration type --- lib/puppet/pops/types/enumeration.rb | 16 -------- lib/puppet/pops/types/types.rb | 1 - spec/unit/pops/types/enumeration_spec.rb | 51 ------------------------ 3 files changed, 68 deletions(-) delete mode 100644 lib/puppet/pops/types/enumeration.rb delete mode 100644 spec/unit/pops/types/enumeration_spec.rb diff --git a/lib/puppet/pops/types/enumeration.rb b/lib/puppet/pops/types/enumeration.rb deleted file mode 100644 index e4bb2959a30..00000000000 --- a/lib/puppet/pops/types/enumeration.rb +++ /dev/null @@ -1,16 +0,0 @@ -# The Enumeration class provides default Enumerable::Enumerator creation for Puppet Programming Language -# runtime objects that supports the concept of enumeration. -# -module Puppet::Pops::Types - class Enumeration - def self.enumerator(o) - Puppet.deprecation_warning(_('Enumeration.enumerator is deprecated. Use Iterable.on instead')) - Iterable.on(o) - end - - def enumerator(o) - Puppet.deprecation_warning(_('Enumeration.enumerator is deprecated. Use Iterable.on instead')) - Iterable.on(o) - end - end -end diff --git a/lib/puppet/pops/types/types.rb b/lib/puppet/pops/types/types.rb index fa79898ffb6..948f86c94e1 100644 --- a/lib/puppet/pops/types/types.rb +++ b/lib/puppet/pops/types/types.rb @@ -1,5 +1,4 @@ require_relative 'iterable' -require_relative 'enumeration' require_relative 'recursion_guard' require_relative 'type_acceptor' require_relative 'type_asserter' diff --git a/spec/unit/pops/types/enumeration_spec.rb b/spec/unit/pops/types/enumeration_spec.rb deleted file mode 100644 index 71663e13a90..00000000000 --- a/spec/unit/pops/types/enumeration_spec.rb +++ /dev/null @@ -1,51 +0,0 @@ -require 'spec_helper' -require 'puppet/pops' - -module Puppet::Pops::Types -describe 'The enumeration support' do - it 'produces an enumerator for Array' do - expect(Enumeration.enumerator([1,2,3]).respond_to?(:next)).to eql(true) - end - - it 'produces an enumerator for Hash' do - expect(Enumeration.enumerator({:a=>1}).respond_to?(:next)).to eql(true) - end - - it 'produces a char enumerator for String' do - enum = Enumeration.enumerator("abc") - expect(enum.respond_to?(:next)).to eql(true) - expect(enum.next).to eql('a') - end - - it 'produces an enumerator for integer times' do - enum = Enumeration.enumerator(2) - expect(enum.next).to eql(0) - expect(enum.next).to eql(1) - expect{enum.next}.to raise_error(StopIteration) - end - - it 'produces an enumerator for Integer range' do - range = TypeFactory.range(1,2) - enum = Enumeration.enumerator(range) - expect(enum.next).to eql(1) - expect(enum.next).to eql(2) - expect{enum.next}.to raise_error(StopIteration) - end - - it 'does not produce an enumerator for infinite Integer range' do - range = TypeFactory.range(1,:default) - enum = Enumeration.enumerator(range) - expect(enum).to be_nil - range = TypeFactory.range(:default,2) - enum = Enumeration.enumerator(range) - expect(enum).to be_nil - end - - [3.14, /.*/, true, false, nil, :something].each do |x| - it "does not produce an enumerator for object of type #{x.class}" do - enum = Enumeration.enumerator(x) - expect(enum).to be_nil - end - end -end -end From 1eec5ce61d30f29f93d15246730cd95298796e4c Mon Sep 17 00:00:00 2001 From: Dorin Pleava Date: Fri, 7 Aug 2020 17:54:03 +0300 Subject: [PATCH 054/731] (PUP-10487) Remove Deprecated TypeCalculator method --- lib/puppet/pops/types/type_calculator.rb | 7 ------- 1 file changed, 7 deletions(-) diff --git a/lib/puppet/pops/types/type_calculator.rb b/lib/puppet/pops/types/type_calculator.rb index 87de7b962ac..df62fa5e09d 100644 --- a/lib/puppet/pops/types/type_calculator.rb +++ b/lib/puppet/pops/types/type_calculator.rb @@ -181,13 +181,6 @@ def assignable?(t, t2) t.is_a?(PAnyType) ? t.assignable?(t2) : false end - # Returns an iterable if the t represents something that can be iterated - def enumerable(t) - #TRANSLATOR 'TypeCalculator.enumerable' and 'iterable' are methods and should not be translated - Puppet.deprecation_warning(_('TypeCalculator.enumerable is deprecated. Use iterable')) - iterable(t) - end - # Returns an iterable if the t represents something that can be iterated def iterable(t) # Create an iterable on the type if possible From 9aba74970cafef06a185b2490a893f1a65154603 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Fri, 24 Jul 2020 16:44:17 -0700 Subject: [PATCH 055/731] (PUP-10369) Remove puppet cert and key applications The cert and key applications were replaced with `puppet ssl`. --- lib/puppet/application/cert.rb | 76 ------------------------------- lib/puppet/application/key.rb | 3 -- spec/unit/application/man_spec.rb | 3 +- 3 files changed, 1 insertion(+), 81 deletions(-) delete mode 100644 lib/puppet/application/cert.rb delete mode 100644 lib/puppet/application/key.rb diff --git a/lib/puppet/application/cert.rb b/lib/puppet/application/cert.rb deleted file mode 100644 index a0cd0145be0..00000000000 --- a/lib/puppet/application/cert.rb +++ /dev/null @@ -1,76 +0,0 @@ -require 'puppet/application' - -class Puppet::Application::Cert < Puppet::Application - - def summary - _("Manage certificates and requests (Disabled)") - end - - def help - <<-HELP -This command is no longer functional, please use `puppetserver ca` instead. - -puppet-cert(8) -- #{summary} -======== - -ACTIONS -------- -Every action except 'list' and 'generate' requires a hostname to act on, -unless the '--all' option is set. - -* clean: - Use `puppetserver ca clean --certname NAME[,NAME...]` - -* fingerprint: - Use openssl directly: - `openssl x509 -noout -fingerprint - -inform pem -in certificate.crt` - -* generate: - Use `puppetserver ca generate --certname NAME[,NAME...]` - -* list: - Use `puppetserver ca list [--all]` - -* print: - Use openssl directly: - `openssl x509 -noout -text -in certificate.pem` - -* revoke: - Use `puppetserver ca revoke --certname NAME[,NAME...]` - -* sign: - Use `puppetserver ca sign --certname NAME[,NAME...]` - -* verify: - Use `puppet ssl verify [--certname NAME]` - -* reinventory: - Removed. - -OPTIONS -------- -There are a couple important notes about previously-supported options. - -* --allow-dns-alt-names: - In order to sign certificates with subject alternative names using - `puppetserver ca sign`, the `allow-subject-alt-names` setting must be - set to true in the `certificate-authority` section of Puppet Server's - config. - -* --allow-authorization-extensions: - In order to sign certificates with authorization extensions using - `puppetserver ca sign`, the `allow-authorization-extensions` setting must be - set to true in the `certificate-authority` section of Puppet Server's - config. -HELP - end - - def setup - deprecate - end - - def parse_options - puts help - exit 1 - end -end diff --git a/lib/puppet/application/key.rb b/lib/puppet/application/key.rb deleted file mode 100644 index 6d106a5a147..00000000000 --- a/lib/puppet/application/key.rb +++ /dev/null @@ -1,3 +0,0 @@ -# Will be removed in PUP-10369 -class Puppet::Application::Key < Puppet::Application -end diff --git a/spec/unit/application/man_spec.rb b/spec/unit/application/man_spec.rb index a0d9fb84c83..e30c0121d67 100644 --- a/spec/unit/application/man_spec.rb +++ b/spec/unit/application/man_spec.rb @@ -37,8 +37,7 @@ allow(Puppet::Util).to receive(:which).with(pager).and_return(pager) Puppet::Application.available_application_names.each do |name| - # Remove key in PUP-10369 - next if %w{man face_base indirection_base key}.include? name + next if %w{man face_base indirection_base}.include? name app = Puppet::Application[:man] app.command_line.args << 'man' << name From 0b8a4e254e8f3e8d6d1004e909ca26a31e2d4d55 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Fri, 7 Aug 2020 23:06:39 +0000 Subject: [PATCH 056/731] (packaging) Updating the puppet.pot file --- locales/puppet.pot | 72 ++++++++++++++++++++++------------------------ 1 file changed, 34 insertions(+), 38 deletions(-) diff --git a/locales/puppet.pot b/locales/puppet.pot index 5ec6e3ecbaa..1316f47d35b 100644 --- a/locales/puppet.pot +++ b/locales/puppet.pot @@ -6,11 +6,11 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Puppet automation framework 6.17.0-167-g0baaba6576\n" +"Project-Id-Version: Puppet automation framework 6.17.0-179-g20fb4911a6\n" "\n" "Report-Msgid-Bugs-To: https://tickets.puppetlabs.com\n" -"POT-Creation-Date: 2020-08-07 05:51+0000\n" -"PO-Revision-Date: 2020-08-07 05:51+0000\n" +"POT-Creation-Date: 2020-08-07 23:06+0000\n" +"PO-Revision-Date: 2020-08-07 23:06+0000\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -248,10 +248,6 @@ msgstr "" msgid "Only one file can be applied per run. Skipping %{files}" msgstr "" -#: ../lib/puppet/application/cert.rb:6 -msgid "Manage certificates and requests (Disabled)" -msgstr "" - #: ../lib/puppet/application/describe.rb:177 msgid "Display help about resource types" msgstr "" @@ -9617,11 +9613,11 @@ msgstr "" msgid "CoCreateInstance failed (%{klass})." msgstr "" -#: ../lib/puppet/util/windows/error.rb:42 +#: ../lib/puppet/util/windows/error.rb:43 msgid "FormatMessageW could not format code %{code}" msgstr "" -#: ../lib/puppet/util/windows/error.rb:48 +#: ../lib/puppet/util/windows/error.rb:49 msgid "FormatMessageW failed to allocate buffer for code %{code}" msgstr "" @@ -9819,119 +9815,119 @@ msgstr "" msgid "Failed to set security information" msgstr "" -#: ../lib/puppet/util/windows/service.rb:338 +#: ../lib/puppet/util/windows/service.rb:349 msgid "Starting the %{service_name} service. Timeout set to: %{timeout} seconds" msgstr "" -#: ../lib/puppet/util/windows/service.rb:348 +#: ../lib/puppet/util/windows/service.rb:359 msgid "Failed to start the service" msgstr "" -#: ../lib/puppet/util/windows/service.rb:352 +#: ../lib/puppet/util/windows/service.rb:363 msgid "Successfully started the %{service_name} service" msgstr "" -#: ../lib/puppet/util/windows/service.rb:361 +#: ../lib/puppet/util/windows/service.rb:372 msgid "Stopping the %{service_name} service. Timeout set to: %{timeout} seconds" msgstr "" -#: ../lib/puppet/util/windows/service.rb:369 +#: ../lib/puppet/util/windows/service.rb:380 msgid "Successfully stopped the %{service_name} service" msgstr "" -#: ../lib/puppet/util/windows/service.rb:378 +#: ../lib/puppet/util/windows/service.rb:389 msgid "Resuming the %{service_name} service. Timeout set to: %{timeout} seconds" msgstr "" -#: ../lib/puppet/util/windows/service.rb:394 +#: ../lib/puppet/util/windows/service.rb:405 msgid "Successfully resumed the %{service_name} service" msgstr "" -#: ../lib/puppet/util/windows/service.rb:410 +#: ../lib/puppet/util/windows/service.rb:421 msgid "Unknown Service state '%{current_state}' for '%{service_name}'" msgstr "" -#: ../lib/puppet/util/windows/service.rb:437 +#: ../lib/puppet/util/windows/service.rb:448 msgid "Unknown start type '%{start_type}' for '%{service_name}'" msgstr "" -#: ../lib/puppet/util/windows/service.rb:487 +#: ../lib/puppet/util/windows/service.rb:498 msgid "Failed to update service configuration" msgstr "" -#: ../lib/puppet/util/windows/service.rb:552 +#: ../lib/puppet/util/windows/service.rb:563 msgid "Failed to fetch services" msgstr "" -#: ../lib/puppet/util/windows/service.rb:601 +#: ../lib/puppet/util/windows/service.rb:612 msgid "Failed to open a handle to the service" msgstr "" -#: ../lib/puppet/util/windows/service.rb:618 +#: ../lib/puppet/util/windows/service.rb:629 msgid "Failed to open a handle to the service control manager" msgstr "" -#: ../lib/puppet/util/windows/service.rb:641 +#: ../lib/puppet/util/windows/service.rb:652 msgid "The service is already in the %{final_state} state. No further work needs to be done." msgstr "" -#: ../lib/puppet/util/windows/service.rb:653 +#: ../lib/puppet/util/windows/service.rb:664 msgid "The service must be in one of the %{valid_initial_states} states to perform this transition. It is currently in the %{current_state} state." msgstr "" -#: ../lib/puppet/util/windows/service.rb:664 +#: ../lib/puppet/util/windows/service.rb:675 msgid "There is already a pending transition to the %{final_state} state for the %{service_name} service." msgstr "" -#: ../lib/puppet/util/windows/service.rb:680 +#: ../lib/puppet/util/windows/service.rb:691 msgid "The service is in the %{pending_state} state, which is an unsafe pending state." msgstr "" -#: ../lib/puppet/util/windows/service.rb:685 +#: ../lib/puppet/util/windows/service.rb:696 msgid "Transitioning the %{service_name} service from %{initial_state} to %{final_state}" msgstr "" -#: ../lib/puppet/util/windows/service.rb:689 +#: ../lib/puppet/util/windows/service.rb:700 msgid "Waiting for the transition to finish" msgstr "" -#: ../lib/puppet/util/windows/service.rb:694 +#: ../lib/puppet/util/windows/service.rb:705 msgid "Failed to transition the %{service_name} service to the %{final_state} state. Detail: %{detail}" msgstr "" -#: ../lib/puppet/util/windows/service.rb:733 ../lib/puppet/util/windows/service.rb:769 +#: ../lib/puppet/util/windows/service.rb:744 ../lib/puppet/util/windows/service.rb:780 msgid "Service query failed" msgstr "" -#: ../lib/puppet/util/windows/service.rb:812 +#: ../lib/puppet/util/windows/service.rb:823 msgid "Service query for %{parameter_name} failed" msgstr "" -#: ../lib/puppet/util/windows/service.rb:835 +#: ../lib/puppet/util/windows/service.rb:846 msgid "Failed to update service %{change} configuration" msgstr "" -#: ../lib/puppet/util/windows/service.rb:862 +#: ../lib/puppet/util/windows/service.rb:873 msgid "Failed to send the %{control_signal} signal to the service. Its current state is %{current_state}. Reason for failure:" msgstr "" -#: ../lib/puppet/util/windows/service.rb:897 +#: ../lib/puppet/util/windows/service.rb:908 msgid "The service transitioned to the %{pending_state} state." msgstr "" -#: ../lib/puppet/util/windows/service.rb:911 +#: ../lib/puppet/util/windows/service.rb:922 msgid "Timed out while waiting for the service to transition from %{initial_state} to %{final_state} OR from %{initial_state} to %{pending_state} to %{final_state}. The service's current state is %{current_state}." msgstr "" -#: ../lib/puppet/util/windows/service.rb:926 +#: ../lib/puppet/util/windows/service.rb:937 msgid "Waiting for the pending transition to the %{final_state} state to finish." msgstr "" -#: ../lib/puppet/util/windows/service.rb:940 +#: ../lib/puppet/util/windows/service.rb:951 msgid "Unexpected transition to the %{current_state} state while waiting for the pending transition from %{pending_state} to %{final_state} to finish." msgstr "" -#: ../lib/puppet/util/windows/service.rb:954 +#: ../lib/puppet/util/windows/service.rb:965 msgid "Timed out while waiting for the pending transition from %{pending_state} to %{final_state} to finish. The current state is %{current_state}." msgstr "" From d5a4ecbc186252e62fb83c3fc45f30397b067bcf Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Fri, 7 Aug 2020 17:07:16 -0700 Subject: [PATCH 057/731] (PUP-8446) Remove man application The `puppet man` application was replaced by `puppet help --ronn ` which is used to pre-generate man pages shipped puppet-agent. --- lib/puppet/application/man.rb | 4 - lib/puppet/face/help.rb | 2 +- lib/puppet/face/man.rb | 145 ------------------------------ spec/unit/application/man_spec.rb | 52 ----------- 4 files changed, 1 insertion(+), 202 deletions(-) delete mode 100644 lib/puppet/application/man.rb delete mode 100644 lib/puppet/face/man.rb delete mode 100644 spec/unit/application/man_spec.rb diff --git a/lib/puppet/application/man.rb b/lib/puppet/application/man.rb deleted file mode 100644 index 1ecc4d691fb..00000000000 --- a/lib/puppet/application/man.rb +++ /dev/null @@ -1,4 +0,0 @@ -require 'puppet/application/face_base' - -class Puppet::Application::Man < Puppet::Application::FaceBase -end diff --git a/lib/puppet/face/help.rb b/lib/puppet/face/help.rb index 88f8ce27420..fead1c8e213 100644 --- a/lib/puppet/face/help.rb +++ b/lib/puppet/face/help.rb @@ -222,7 +222,7 @@ def horribly_extract_summary_from(appname) #private :horribly_extract_summary_from def exclude_from_docs?(appname) - %w{face_base indirection_base cert key man report status}.include? appname + %w{face_base indirection_base report status}.include? appname end # This should absolutely be a private method, but for some reason it appears # that you can't use the 'private' keyword inside of a Face definition. diff --git a/lib/puppet/face/man.rb b/lib/puppet/face/man.rb deleted file mode 100644 index 54a5106baf4..00000000000 --- a/lib/puppet/face/man.rb +++ /dev/null @@ -1,145 +0,0 @@ -require 'puppet/face' -require 'puppet/util' -require 'pathname' -require 'erb' - -Puppet::Face.define(:man, '0.0.1') do - copyright "Puppet Inc.", 2011 - license _("Apache 2 license; see COPYING") - - summary _("Display Puppet manual pages.") - - description <<-EOT - Please use the command 'puppet help ' or the system manpage system - 'man puppet-' to display information about Puppet subcommands. The - deprecated man subcommand displays manual pages for all Puppet subcommands. If - the `ronn` gem () is installed on your - system, puppet man will display fully-formatted man pages. If `ronn` is not - available, puppet man will display the raw (but human-readable) source text - in a pager. - EOT - - notes <<-EOT - The pager used for display will be the first found of `$MANPAGER`, `$PAGER`, - `less`, `most`, or `more`. - EOT - - action(:man) do - summary _("Display the manual page for a Puppet subcommand.") - arguments _("") - #TRANSLATORS '--render-as s' is a command line option and should not be translated - returns _(<<-'EOT') - The man data, in Markdown format, suitable for consumption by Ronn. - - RENDERING ISSUES: To skip fancy formatting and output the raw Markdown - text (e.g. for use in a pipeline), call this action with '--render-as s'. - EOT - examples <<-'EOT' - View the installed manual page for the subcommand 'config': - - $ man puppet-config - - (Deprecated) View the manual page for the subcommand 'config': - - $ puppet man config - EOT - - default - when_invoked do |*args| - # 'args' is an array of the subcommand and arguments from the command line and an options hash - # [, ..., {options}] - _options = args.pop - - unless valid_command_line?(args) - print_man_help - #TRANSLATORS 'puppet man' is a specific command line and should not be translated - raise ArgumentError, _("The 'puppet man' command takes a single subcommand to review the subcommand's manpage") - end - - manpage = args.first - if default_case?(manpage) - print_man_help - return nil - end - - if legacy_applications.include?(manpage) - return Puppet::Application[manpage].help - end - - # set 'face' as it's used in the erb processing. - face = Puppet::Face[manpage.to_sym, :current] - _face = face # suppress the unused variable warning - - file = (Pathname(__FILE__).dirname + "help" + 'man.erb') - erb = ERB.new(file.read, nil, '-') - erb.filename = file.to_s - - # Run the ERB template in our current binding, including all the local - # variables we established just above. --daniel 2011-04-11 - return erb.result(binding) - end - - when_rendering :console do |text| - # OK, if we have Ronn on the path we can delegate to it and override the - # normal output process. Otherwise delegate to a pager on the raw text, - # otherwise we finally just delegate to our parent. Oh, well. - - # These are the same options for less that git normally uses. - # -R : Pass through color control codes (allows display of colors) - # -X : Don't init/deinit terminal (leave display on screen on exit) - # -F : automatically exit if display fits entirely on one screen - # -S : don't wrap long lines - ENV['LESS'] ||= 'FRSX' - - ronn = Puppet::Util.which('ronn') - pager = [ENV['MANPAGER'], ENV['PAGER'], 'less', 'most', 'more']. - detect {|x| x and x.length > 0 and Puppet::Util.which(x) } - - if ronn - # ronn is a stupid about pager selection, we can be smarter. :) - ENV['PAGER'] = pager if pager - - args = "--man --manual='Puppet Manual' --organization='Puppet Inc., LLC'" - # manual pages could contain UTF-8 text - IO.popen("#{ronn} #{args}", 'w:UTF-8') do |fh| fh.write text end - - '' # suppress local output, neh? - elsif pager - # manual pages could contain UTF-8 text - IO.popen(pager, 'w:UTF-8') do |fh| fh.write text end - '' - else - text - end - end - end - - def valid_command_line?(args) - # not too many arguments - # This allows the command line case of "puppet man man man" to not throw an error because face_based eats - # one of the "man"'s, which means this command line ends up looking like this in the code: 'manface.man("man")' - # However when we generate manpages, we do the same call. So we have to allow it and generate the real manpage. - args.length <= 1 - end - - # by default, if you ask for the man manpage "puppet man man" face_base removes the "man" from the args that we - # are passed, so we get nil instead - def default_case?(manpage) - manpage.nil? - end - - def print_man_help - puts Puppet::Face[:help, :current].help(:man) - end - - def legacy_applications - # The list of applications, less those that are duplicated as a face. - Puppet::Application.available_application_names.reject do |appname| - Puppet::Face.face? appname.to_sym, :current or - # ...this is a nasty way to exclude non-applications. :( - %w{face_base indirection_base}.include? appname - end - end - - deprecate -end diff --git a/spec/unit/application/man_spec.rb b/spec/unit/application/man_spec.rb deleted file mode 100644 index e30c0121d67..00000000000 --- a/spec/unit/application/man_spec.rb +++ /dev/null @@ -1,52 +0,0 @@ -require 'spec_helper' -require 'puppet/face' - -describe Puppet::Face[:man, :current] do - let(:pager) { '/path/to/our/pager' } - - around do |example| - Puppet::Util.withenv('MANPAGER' => pager) do - example.run - end - end - - it 'is deprecated' do - expect(subject).to be_deprecated - end - - it 'has a man action' do - expect(subject).to be_action(:man) - end - - it 'accepts a call with no arguments' do - expect { subject.man }.to output(/USAGE: puppet man /).to_stdout - end - - it 'raises an ArgumentError when given too many arguments' do - expect { - subject.man(:man, 'agent', 'extra') - }.to raise_error(ArgumentError) - .and output(/USAGE: puppet man /).to_stdout - end - - it "exits with 0 when generating man documentation for each available application" do - # turn off deprecation warning - Puppet[:disable_warnings] = ['deprecations'] - - allow(Puppet::Util).to receive(:which).with('ronn').and_return(nil) - allow(Puppet::Util).to receive(:which).with(pager).and_return(pager) - - Puppet::Application.available_application_names.each do |name| - next if %w{man face_base indirection_base}.include? name - - app = Puppet::Application[:man] - app.command_line.args << 'man' << name - - expect { - allow(IO).to receive(:popen).with(pager, 'w:UTF-8').and_yield($stdout) - app.run - }.to exit_with(0) - .and output(/puppet-#{name}/m).to_stdout - end - end -end From eb81e348b009b978d60d4e5c3cb0b707636df38d Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Fri, 7 Aug 2020 17:20:03 -0700 Subject: [PATCH 058/731] (PUP-9346) Change default hostcsr setting The default value did not reflect where puppet saves its CSR while waiting for the CA to issue a certificate. Update the default value to match reality. --- lib/puppet/defaults.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb index d7f294144ba..f80c163c6cd 100644 --- a/lib/puppet/defaults.rb +++ b/lib/puppet/defaults.rb @@ -932,13 +932,13 @@ def self.initialize_default_settings!(settings) Generally unused." }, :hostcsr => { - :default => "$ssldir/csr_$certname.pem", + :default => "$requestdir/$certname.pem", :type => :file, :mode => "0644", :owner => "service", :group => "service", - :deprecated => :completely, - :desc => "This setting is deprecated." + :desc => "Where individual hosts store their certificate request (CSR) + while waiting for the CA to issue their certificate." }, :hostcert => { :default => "$certdir/$certname.pem", From 065ab5cb70a2c98f88556c24266d88321e162cff Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Fri, 7 Aug 2020 17:21:54 -0700 Subject: [PATCH 059/731] (PUP-9346) Use the hostcsr setting to resolve the CSR Use the hostcsr setting now that it is valid. --- lib/puppet/application/ssl.rb | 2 +- spec/unit/application/ssl_spec.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/puppet/application/ssl.rb b/lib/puppet/application/ssl.rb index 8488e1ca93a..3fd79814a08 100644 --- a/lib/puppet/application/ssl.rb +++ b/lib/puppet/application/ssl.rb @@ -248,7 +248,7 @@ def clean(certname) paths = { 'private key' => Puppet[:hostprivkey], 'public key' => Puppet[:hostpubkey], - 'certificate request' => File.join(Puppet[:requestdir], "#{Puppet[:certname]}.pem"), + 'certificate request' => Puppet[:hostcsr], 'certificate' => Puppet[:hostcert], 'private key password file' => Puppet[:passfile] } diff --git a/spec/unit/application/ssl_spec.rb b/spec/unit/application/ssl_spec.rb index 9b2cfe082fb..f0436703211 100644 --- a/spec/unit/application/ssl_spec.rb +++ b/spec/unit/application/ssl_spec.rb @@ -92,7 +92,7 @@ def expects_command_to_fail(message) end context 'when submitting a CSR' do - let(:csr_path) { File.join(Puppet[:requestdir], "#{name}.pem") } + let(:csr_path) { Puppet[:hostcsr] } before do ssl.command_line.args << 'submit_request' @@ -318,7 +318,7 @@ def expects_command_to_fail(message) end it 'deletes the request' do - path = File.join(Puppet[:requestdir], "#{Puppet[:certname]}.pem") + path = Puppet[:hostcsr] File.write(path, @host[:csr].to_pem) expects_command_to_pass(%r{Removed certificate request #{path}}) From 24cd836d03de69a3beae50442bcf8f6611d74556 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Mon, 10 Aug 2020 10:36:14 +0000 Subject: [PATCH 060/731] (packaging) Updating the puppet.pot file --- locales/puppet.pot | 44 ++++++++++++++++++-------------------------- 1 file changed, 18 insertions(+), 26 deletions(-) diff --git a/locales/puppet.pot b/locales/puppet.pot index 1316f47d35b..84ec9790d3c 100644 --- a/locales/puppet.pot +++ b/locales/puppet.pot @@ -6,11 +6,11 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Puppet automation framework 6.17.0-179-g20fb4911a6\n" +"Project-Id-Version: Puppet automation framework 6.17.0-193-gb356fdd18b\n" "\n" "Report-Msgid-Bugs-To: https://tickets.puppetlabs.com\n" -"POT-Creation-Date: 2020-08-07 23:06+0000\n" -"PO-Revision-Date: 2020-08-07 23:06+0000\n" +"POT-Creation-Date: 2020-08-10 10:36+0000\n" +"PO-Revision-Date: 2020-08-10 10:36+0000\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -6096,10 +6096,6 @@ msgstr "" msgid "%{klass} cannot be subtracted from a Timestamp" msgstr "" -#: ../lib/puppet/pops/types/enumeration.rb:7 ../lib/puppet/pops/types/enumeration.rb:12 -msgid "Enumeration.enumerator is deprecated. Use Iterable.on instead" -msgstr "" - #: ../lib/puppet/pops/types/p_binary_type.rb:77 msgid "The given string in encoding '%{enc}' is invalid. Cannot create a Binary UTF-8 representation" msgstr "" @@ -6213,10 +6209,6 @@ msgstr "" msgid "Options 'include_containers' and 'include_values' cannot both be false" msgstr "" -#: ../lib/puppet/pops/types/type_calculator.rb:187 -msgid "TypeCalculator.enumerable is deprecated. Use iterable" -msgstr "" - #. TRANSLATORS 'TypeFactory#string' is a class and method name and should not be translated #: ../lib/puppet/pops/types/type_factory.rb:117 msgid "Passing more than one argument to TypeFactory#string is deprecated" @@ -6251,65 +6243,65 @@ msgstr "" msgid "Unknown type <%{type}>" msgstr "" -#: ../lib/puppet/pops/types/types.rb:930 +#: ../lib/puppet/pops/types/types.rb:929 msgid "The string '%{str}' cannot be converted to Numeric" msgstr "" -#: ../lib/puppet/pops/types/types.rb:933 +#: ../lib/puppet/pops/types/types.rb:932 msgid "Value of type %{type} cannot be converted to Numeric" msgstr "" -#: ../lib/puppet/pops/types/types.rb:1171 +#: ../lib/puppet/pops/types/types.rb:1170 msgid "The string '%{str}' cannot be converted to Integer" msgstr "" -#: ../lib/puppet/pops/types/types.rb:1174 +#: ../lib/puppet/pops/types/types.rb:1173 msgid "Value of type %{type} cannot be converted to Integer" msgstr "" -#: ../lib/puppet/pops/types/types.rb:1182 +#: ../lib/puppet/pops/types/types.rb:1181 msgid "Illegal radix: %{radix}, expected 2, 8, 10, 16, or default" msgstr "" -#: ../lib/puppet/pops/types/types.rb:1295 +#: ../lib/puppet/pops/types/types.rb:1294 msgid "The string '%{str}' cannot be converted to Float" msgstr "" -#: ../lib/puppet/pops/types/types.rb:1298 +#: ../lib/puppet/pops/types/types.rb:1297 msgid "Value of type %{type} cannot be converted to Float" msgstr "" #. TRANSLATORS 'PStringType#initialize' is a class and method name and should not be translated -#: ../lib/puppet/pops/types/types.rb:1515 +#: ../lib/puppet/pops/types/types.rb:1514 msgid "Passing more than one argument to PStringType#initialize is deprecated" msgstr "" #. TRANSLATORS 'PStringType#values' and '#value' are classes and method names and should not be translated -#: ../lib/puppet/pops/types/types.rb:1569 +#: ../lib/puppet/pops/types/types.rb:1568 msgid "Method PStringType#values is deprecated. Use #value instead" msgstr "" -#: ../lib/puppet/pops/types/types.rb:1895 +#: ../lib/puppet/pops/types/types.rb:1894 msgid "The string '%{str}' cannot be converted to Boolean" msgstr "" -#: ../lib/puppet/pops/types/types.rb:1898 +#: ../lib/puppet/pops/types/types.rb:1897 msgid "Value of type %{type} cannot be converted to Boolean" msgstr "" -#: ../lib/puppet/pops/types/types.rb:2626 +#: ../lib/puppet/pops/types/types.rb:2625 msgid "Value of type %{type} cannot be converted to Array" msgstr "" -#: ../lib/puppet/pops/types/types.rb:2696 +#: ../lib/puppet/pops/types/types.rb:2695 msgid "Puppet::Pops::Types::PHashType#element_type is deprecated, use #value_type instead" msgstr "" -#: ../lib/puppet/pops/types/types.rb:2833 +#: ../lib/puppet/pops/types/types.rb:2832 msgid "odd number of arguments for Hash" msgstr "" -#: ../lib/puppet/pops/types/types.rb:2844 +#: ../lib/puppet/pops/types/types.rb:2843 msgid "Value of type %{type} cannot be converted to Hash" msgstr "" From 34e7330e6520fa9df00cae3bab29b8cf092a9c52 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Mon, 10 Aug 2020 17:52:34 +0000 Subject: [PATCH 061/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index 24779dba865..b21e2a9c8a8 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -813,10 +813,10 @@ Where the host\'s certificate revocation list can be found\. This is distinct fr .IP "" 0 . .SS "hostcsr" -This setting is deprecated\. +Where individual hosts store their certificate request (CSR) while waiting for the CA to issue their certificate\. . .IP "\(bu" 4 -\fIDefault\fR: $ssldir/csr_$certname\.pem +\fIDefault\fR: $requestdir/$certname\.pem . .IP "" 0 . From 2af05823024afa294e618c07a72db058f81887b4 Mon Sep 17 00:00:00 2001 From: Gabriel Nagy Date: Fri, 7 Aug 2020 17:23:48 +0300 Subject: [PATCH 062/731] (PUP-6184) Pull win32/dir into our codebase Defined missing functions, constants and structs in `puppet/util/windows/file`, and a private `wstrip` function in our monkey-patched Dir class. We had a similar method but we cannot use it since it's defined on FFI::Pointer, whereas we need it on FFI::Buffer. Use constants instead of strings to specify encodings. Remove requires to win32/dir. Fix ruby 2.7 warning in api_types.rb. --- .../lib/puppet/acceptance/windows_utils.rb | 2 +- ext/windows/service/daemon.rb | 4 +- install.rb | 10 +- lib/puppet/util/windows.rb | 3 +- lib/puppet/util/windows/api_types.rb | 2 +- lib/puppet/util/windows/file.rb | 128 ++++++ lib/puppet/util/windows/monkey_patches/dir.rb | 417 ++++++++++++++++++ 7 files changed, 554 insertions(+), 12 deletions(-) create mode 100644 lib/puppet/util/windows/monkey_patches/dir.rb diff --git a/acceptance/lib/puppet/acceptance/windows_utils.rb b/acceptance/lib/puppet/acceptance/windows_utils.rb index c67e4698bd0..b48a0816b5d 100644 --- a/acceptance/lib/puppet/acceptance/windows_utils.rb +++ b/acceptance/lib/puppet/acceptance/windows_utils.rb @@ -9,7 +9,7 @@ module WindowsUtils def profile_base(agent) ruby = Puppet::Acceptance::CommandUtils.ruby_command(agent) getbasedir = <<'END' -require 'win32/dir' +require 'puppet/util/windows/monkey_patches/dir' puts Dir::PROFILE.match(/(.*)\\\\[^\\\\]*/)[1] END on(agent, "#{ruby} -e \"#{getbasedir}\"").stdout.chomp diff --git a/ext/windows/service/daemon.rb b/ext/windows/service/daemon.rb index 903d29bfb0c..1a01d658113 100755 --- a/ext/windows/service/daemon.rb +++ b/ext/windows/service/daemon.rb @@ -2,7 +2,6 @@ require 'fileutils' require 'puppet/util/windows/daemon' -require 'win32/dir' # This file defines utilities for logging to eventlog. While it lives inside # Puppet, it is completely independent and loads no other parts of Puppet, so we @@ -12,6 +11,9 @@ # monkey patches ruby Process to add .create method require 'puppet/util/windows/monkey_patches/process' +# monkey patch Dir to add constants +require 'puppet/util/windows/monkey_patches/dir' + class WindowsDaemon < Puppet::Util::Windows::Daemon CREATE_NEW_CONSOLE = 0x00000010 diff --git a/install.rb b/install.rb index 8ac9600cfdd..3ae1135ea97 100755 --- a/install.rb +++ b/install.rb @@ -243,13 +243,9 @@ def prepare_installation end if $operatingsystem == "windows" - begin - # populates constants used to specify default Windows directories - require 'win32/dir' - rescue LoadError => e - puts "Cannot run on Microsoft Windows without the win32-process, win32-dir & win32-service gems: #{e}" - exit(-1) - end + # TODO check if this can be required here + # may need to change to require_relative + require 'puppet/util/windows/monkey_patches/dir' end if not InstallOptions.configdir.nil? diff --git a/lib/puppet/util/windows.rb b/lib/puppet/util/windows.rb index 5ff5221bf97..d106d624a40 100644 --- a/lib/puppet/util/windows.rb +++ b/lib/puppet/util/windows.rb @@ -24,8 +24,6 @@ class EventLog; end # to 2048 (at least on US English Windows) and is not listed in the MS # locales table, here: https://msdn.microsoft.com/en-us/library/ms912047(v=winembedded.10).aspx require 'win32ole' ; WIN32OLE.codepage = WIN32OLE::CP_UTF8 - # gems - require 'win32/dir' # these reference platform specific gems require 'puppet/util/windows/api_types' @@ -46,6 +44,7 @@ class EventLog; end require 'puppet/util/windows/registry' require 'puppet/util/windows/eventlog' require 'puppet/util/windows/service' + require 'puppet/util/windows/monkey_patches/dir' require 'puppet/util/windows/monkey_patches/process' end end diff --git a/lib/puppet/util/windows/api_types.rb b/lib/puppet/util/windows/api_types.rb index 322df474f31..9a14d638460 100644 --- a/lib/puppet/util/windows/api_types.rb +++ b/lib/puppet/util/windows/api_types.rb @@ -58,7 +58,7 @@ def read_wide_string(char_length, dst_encoding = Encoding::UTF_8, strip = false, str = str[0, i] if i end - str.encode(dst_encoding, str.encoding, encode_options) + str.encode(dst_encoding, str.encoding, **encode_options) rescue EncodingError => e Puppet.debug { "Unable to convert value #{str.nil? ? 'nil' : str.dump} to encoding #{dst_encoding} due to #{e.inspect}" } raise diff --git a/lib/puppet/util/windows/file.rb b/lib/puppet/util/windows/file.rb index 70070f06cbd..9c88b22c7b6 100644 --- a/lib/puppet/util/windows/file.rb +++ b/lib/puppet/util/windows/file.rb @@ -6,6 +6,7 @@ module Puppet::Util::Windows::File extend Puppet::Util::Windows::String FILE_ATTRIBUTE_READONLY = 0x00000001 + FILE_ATTRIBUTE_DIRECTORY = 0x00000010 # https://msdn.microsoft.com/en-us/library/windows/desktop/aa379607(v=vs.85).aspx # The right to use the object for synchronization. This enables a thread to @@ -295,11 +296,15 @@ def symlink?(file_name) GENERIC_WRITE = 0x40000000 GENERIC_EXECUTE = 0x20000000 GENERIC_ALL = 0x10000000 + METHOD_BUFFERED = 0 FILE_SHARE_READ = 1 FILE_SHARE_WRITE = 2 OPEN_EXISTING = 3 + FILE_DEVICE_FILE_SYSTEM = 0x00000009 FILE_FLAG_OPEN_REPARSE_POINT = 0x00200000 FILE_FLAG_BACKUP_SEMANTICS = 0x02000000 + SHGFI_DISPLAYNAME = 0x000000200 + SHGFI_PIDL = 0x000000008 def self.open_symlink(link_name) begin @@ -331,6 +336,7 @@ def readlink(link_name) ERROR_FILE_NOT_FOUND = 2 ERROR_PATH_NOT_FOUND = 3 + ERROR_ALREADY_EXISTS = 183 def get_long_pathname(path) converted = '' @@ -485,6 +491,15 @@ def self.symlink_reparse_point?(path) rescue LoadError end + # https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-getcurrentdirectory + # DWORD GetCurrentDirectory( + # DWORD nBufferLength, + # LPTSTR lpBuffer + # ); + ffi_lib :kernel32 + attach_function_private :GetCurrentDirectoryW, + [:dword, :lpwstr], :dword + # https://msdn.microsoft.com/en-us/library/windows/desktop/aa364944(v=vs.85).aspx # DWORD WINAPI GetFileAttributes( # _In_ LPCTSTR lpFileName @@ -515,6 +530,23 @@ def self.symlink_reparse_point?(path) attach_function_private :CreateFileW, [:lpcwstr, :dword, :dword, :pointer, :dword, :dword, :handle], :handle + # https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createdirectoryw + # BOOL CreateDirectoryW( + # LPCWSTR lpPathName, + # LPSECURITY_ATTRIBUTES lpSecurityAttributes + # ); + ffi_lib :kernel32 + attach_function_private :CreateDirectoryW, + [:lpcwstr, :pointer], :win32_bool + + # https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-removedirectoryw + # BOOL RemoveDirectoryW( + # LPCWSTR lpPathName + # ); + ffi_lib :kernel32 + attach_function_private :RemoveDirectoryW, + [:lpcwstr], :win32_bool + # https://msdn.microsoft.com/en-us/library/windows/desktop/aa363216(v=vs.85).aspx # BOOL WINAPI DeviceIoControl( # _In_ HANDLE hDevice, @@ -567,6 +599,47 @@ class MOUNT_POINT_REPARSE_DATA_BUFFER < FFI::Struct :PathBuffer, [:byte, MAXIMUM_REPARSE_DATA_BUFFER_SIZE - 16] end + # SHFILEINFO + # https://docs.microsoft.com/en-us/windows/win32/api/shellapi/ns-shellapi-shfileinfow + # typedef struct _SHFILEINFOW { + # HICON hIcon; + # int iIcon; + # DWORD dwAttributes; + # WCHAR szDisplayName[MAX_PATH]; + # WCHAR szTypeName[80]; + # } SHFILEINFOW; + class SHFILEINFO < FFI::Struct + layout( + :hIcon, :ulong, + :iIcon, :int, + :dwAttributes, :ulong, + :szDisplayName, [:char, 256], + :szTypeName, [:char, 80] + ) + end + + # REPARSE_JDATA_BUFFER + class REPARSE_JDATA_BUFFER < FFI::Struct + layout( + :ReparseTag, :ulong, + :ReparseDataLength, :ushort, + :Reserved, :ushort, + :SubstituteNameOffset, :ushort, + :SubstituteNameLength, :ushort, + :PrintNameOffset, :ushort, + :PrintNameLength, :ushort, + :PathBuffer, [:char, 1024] + ) + + # The REPARSE_DATA_BUFFER_HEADER_SIZE which is calculated as: + # + # sizeof(ReparseTag) + sizeof(ReparseDataLength) + sizeof(Reserved) + # + def header_size + FFI::Type::ULONG.size + FFI::Type::USHORT.size + FFI::Type::USHORT.size + end + end + # https://msdn.microsoft.com/en-us/library/windows/desktop/aa364980(v=vs.85).aspx # DWORD WINAPI GetLongPathName( # _In_ LPCTSTR lpszShortPath, @@ -586,4 +659,59 @@ class MOUNT_POINT_REPARSE_DATA_BUFFER < FFI::Struct ffi_lib :kernel32 attach_function_private :GetShortPathNameW, [:lpcwstr, :lpwstr, :dword], :dword + + # https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getfullpathnamew + # DWORD GetFullPathNameW( + # LPCWSTR lpFileName, + # DWORD nBufferLength, + # LPWSTR lpBuffer, + # LPWSTR *lpFilePart + # ); + ffi_lib :kernel32 + attach_function_private :GetFullPathNameW, + [:lpcwstr, :dword, :lpwstr, :pointer], :dword + + # https://docs.microsoft.com/en-us/windows/win32/api/shlobj_core/nf-shlobj_core-shgetfolderpathw + # SHFOLDERAPI SHGetFolderPathW( + # HWND hwnd, + # int csidl, + # HANDLE hToken, + # DWORD dwFlags, + # LPWSTR pszPath + # ); + ffi_lib :shell32 + attach_function_private :SHGetFolderPathW, + [:hwnd, :int, :handle, :dword, :lpwstr], :dword + + # https://docs.microsoft.com/en-us/windows/win32/api/shlobj_core/nf-shlobj_core-shgetfolderlocation + # SHSTDAPI SHGetFolderLocation( + # HWND hwnd, + # int csidl, + # HANDLE hToken, + # DWORD dwFlags, + # PIDLIST_ABSOLUTE *ppidl + # ); + ffi_lib :shell32 + attach_function_private :SHGetFolderLocation, + [:hwnd, :int, :handle, :dword, :pointer], :dword + + # https://docs.microsoft.com/en-us/windows/win32/api/shellapi/nf-shellapi-shgetfileinfoa + # DWORD_PTR SHGetFileInfoA( + # LPCSTR pszPath, + # DWORD dwFileAttributes, + # SHFILEINFOA *psfi, + # UINT cbFileInfo, + # UINT uFlags + # ); + ffi_lib :shell32 + attach_function_private :SHGetFileInfo, + [:dword, :dword, :pointer, :uint, :uint], :dword + + # https://docs.microsoft.com/en-us/windows/win32/api/shlwapi/nf-shlwapi-pathisdirectoryemptyw + # BOOL PathIsDirectoryEmptyW( + # LPCWSTR pszPath + # ); + ffi_lib :shlwapi + attach_function_private :PathIsDirectoryEmptyW, + [:lpcwstr], :win32_bool end diff --git a/lib/puppet/util/windows/monkey_patches/dir.rb b/lib/puppet/util/windows/monkey_patches/dir.rb new file mode 100644 index 00000000000..5b756a457c9 --- /dev/null +++ b/lib/puppet/util/windows/monkey_patches/dir.rb @@ -0,0 +1,417 @@ +require 'puppet/util/windows' + +class Dir + include Puppet::Util::Windows::File + extend Puppet::Util::Windows::File + + # CSIDL constants + csidl = Hash[ + "DESKTOP", 0x0000, + "INTERNET", 0x0001, + "PROGRAMS", 0x0002, + "CONTROLS", 0x0003, + "PRINTERS", 0x0004, + "PERSONAL", 0x0005, + "FAVORITES", 0x0006, + "STARTUP", 0x0007, + "RECENT", 0x0008, + "SENDTO", 0x0009, + "BITBUCKET", 0x000a, + "STARTMENU", 0x000b, + "MYDOCUMENTS", 0x000c, + "MYMUSIC", 0x000d, + "MYVIDEO", 0x000e, + "DESKTOPDIRECTORY", 0x0010, + "DRIVES", 0x0011, + "NETWORK", 0x0012, + "NETHOOD", 0x0013, + "FONTS", 0x0014, + "TEMPLATES", 0x0015, + "COMMON_STARTMENU", 0x0016, + "COMMON_PROGRAMS", 0X0017, + "COMMON_STARTUP", 0x0018, + "COMMON_FAVORITES", 0x001f, + "COMMON_DESKTOPDIRECTORY", 0x0019, + "APPDATA", 0x001a, + "PRINTHOOD", 0x001b, + "LOCAL_APPDATA", 0x001c, + "ALTSTARTUP", 0x001d, + "COMMON_ALTSTARTUP", 0x001e, + "INTERNET_CACHE", 0x0020, + "COOKIES", 0x0021, + "HISTORY", 0x0022, + "COMMON_APPDATA", 0x0023, + "WINDOWS", 0x0024, + "SYSTEM", 0x0025, + "PROGRAM_FILES", 0x0026, + "MYPICTURES", 0x0027, + "PROFILE", 0x0028, + "SYSTEMX86", 0x0029, + "PROGRAM_FILESX86", 0x002a, + "PROGRAM_FILES_COMMON", 0x002b, + "PROGRAM_FILES_COMMONX86", 0x002c, + "COMMON_TEMPLATES", 0x002d, + "COMMON_DOCUMENTS", 0x002e, + "CONNECTIONS", 0x0031, + "COMMON_MUSIC", 0x0035, + "COMMON_PICTURES", 0x0036, + "COMMON_VIDEO", 0x0037, + "RESOURCES", 0x0038, + "RESOURCES_LOCALIZED", 0x0039, + "COMMON_OEM_LINKS", 0x003a, + "CDBURN_AREA", 0x003b, + "COMMON_ADMINTOOLS", 0x002f, + "ADMINTOOLS", 0x0030 + ] + + # Dynamically set each of the CSIDL constants + csidl.each do |key, value| + buf = 0.chr * 1024 + path = nil + buf.encode!(Encoding::UTF_16LE) + + if SHGetFolderPathW(0, value, 0, 0, buf) == 0 # Current path + path = buf.strip + elsif SHGetFolderPathW(0, value, 0, 1, buf) == 0 # Default path + path = buf.strip + else + ptr = FFI::MemoryPointer.new(:long) + info = SHFILEINFO.new + flags = SHGFI_DISPLAYNAME | SHGFI_PIDL + + if SHGetFolderLocation(0, value, 0, 0, ptr) == 0 + if SHGetFileInfo(ptr.read_long, 0, info, info.size, flags) != 0 + path = info[:szDisplayName].to_s + path.force_encoding(Encoding.default_external) + end + end + end + + begin + Dir.const_set(key, path.encode(Encoding.default_external)) if path + rescue Encoding::UndefinedConversionError + Dir.const_set(key, path.encode(Encoding::UTF_8)) if path + end + end + + # Set Dir::MYDOCUMENTS to the same as Dir::PERSONAL if undefined + unless defined? MYDOCUMENTS + MYDOCUMENTS = PERSONAL + end + + class << self + alias old_glob glob + + # Same as the standard MRI Dir.glob method except that it handles + # backslashes in path names. + # + def glob(glob_pattern, flags = 0, &block) + if glob_pattern.is_a?(Array) + temp = glob_pattern.map! { |pattern| string_check(pattern).tr("\\", "/") } + else + temp = string_check(glob_pattern).tr("\\", "/") + end + + if flags.is_a?(Hash) + old_glob(temp, **flags, &block) + else + old_glob(temp, flags, &block) + end + end + + alias old_ref [] + + # Same as the standard MRI Dir[] method except that it handles + # backslashes in path names. + # + def [](*glob_patterns) + temp = glob_patterns.map! { |pattern| "#{pattern}".tr("\\", "/") } + old_ref(*temp) + end + + # JRuby normalizes the path by default. + unless RUBY_PLATFORM == "java" + alias oldgetwd getwd + alias oldpwd pwd + + # Returns the present working directory. Unlike MRI, this method always + # normalizes the path. + # + # Examples: + # + # Dir.chdir("C:/Progra~1") + # Dir.getwd # => C:\Program Files + # + # Dir.chdir("C:/PROGRAM FILES") + # Dir.getwd # => C:\Program Files + # + def getwd + path1 = FFI::Buffer.new(:wint_t, 1024, true) + path2 = FFI::Buffer.new(:wint_t, 1024, true) + path3 = FFI::Buffer.new(:wint_t, 1024, true) + + length = GetCurrentDirectoryW(path1.size, path1) + + if length == 0 || length > path1.size + raise SystemCallError.new("GetCurrentDirectoryW", FFI.errno) + end + + length = GetShortPathNameW(path1, path2, path2.size) + + if length == 0 || length > path2.size + raise SystemCallError.new("GetShortPathNameW", FFI.errno) + end + + length = GetLongPathNameW(path2, path3, path3.size) + + if length == 0 || length > path3.size + raise SystemCallError.new("GetLongPathNameW", FFI.errno) + end + + path = wstrip(path3.read_bytes(length * 2)) + + begin + path.encode(Encoding.default_external) + rescue Encoding::UndefinedConversionError + path.encode(Encoding::UTF_8) + end + end + + alias :pwd :getwd + + private + + # Read a wide character string up until the first double null, and delete + # any remaining null characters. + def wstrip(str) + str.force_encoding(Encoding::UTF_16LE).encode(Encoding::UTF_8, invalid: :replace, undef: :replace). + split("\x00")[0].encode(Encoding.default_external) + end + end + end + + # Creates the symlink +to+, linked to the existing directory +from+. If the + # +to+ directory already exists, it must be empty or an error is raised. + # + # Example: + # + # Dir.mkdir('C:/from') + # Dir.create_junction('C:/to', 'C:/from') + # + def self.create_junction(to, from) + to = Puppet::Util::Windows::String.wide_string(string_check(to)) + from = Puppet::Util::Windows::String.wide_string(string_check(from)) + + from_path = (0.chr * 1024).encode(Encoding::UTF_16LE) + + length = GetFullPathNameW(from, from_path.size, from_path, nil) + + if length == 0 || length > from_path.size + raise SystemCallError.new("GetFullPathNameW", FFI.errno) + else + from_path.strip! + end + + to_path = (0.chr * 1024).encode(Encoding::UTF_16LE) + + length = GetFullPathNameW(to, to_path.size, to_path, nil) + + if length == 0 || length > to_path.size + raise SystemCallError.new("GetFullPathNameW", FFI.errno) + else + to_path.strip! + end + + # You can create a junction to a directory that already exists, so + # long as it's empty. + unless CreateDirectoryW(to_path, nil) + if FFI.errno != ERROR_ALREADY_EXISTS + raise SystemCallError.new("CreateDirectoryW", FFI.errno) + end + end + + begin + # Generic read & write + open existing + reparse point & backup semantics + handle = CreateFileW( + to_path, + GENERIC_READ | GENERIC_WRITE, + 0, + nil, + OPEN_EXISTING, + FILE_FLAG_OPEN_REPARSE_POINT | FILE_FLAG_BACKUP_SEMANTICS, + 0 + ) + + if handle == INVALID_HANDLE_VALUE + raise SystemCallError.new("CreateFileW", FFI.errno) + end + + target = "\\??\\".encode(Encoding::UTF_16LE) + from_path + + rdb = REPARSE_JDATA_BUFFER.new + rdb[:ReparseTag] = 2684354563 # IO_REPARSE_TAG_MOUNT_POINT + rdb[:ReparseDataLength] = target.bytesize + 12 + rdb[:Reserved] = 0 + rdb[:SubstituteNameOffset] = 0 + rdb[:SubstituteNameLength] = target.bytesize + rdb[:PrintNameOffset] = target.bytesize + 2 + rdb[:PrintNameLength] = 0 + rdb[:PathBuffer] = target + + bytes = FFI::MemoryPointer.new(:ulong) + + begin + bool = DeviceIoControl( + handle, + CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 41, METHOD_BUFFERED, 0), + rdb, + rdb[:ReparseDataLength] + rdb.header_size, + nil, + 0, + bytes, + nil + ) + + error = FFI.errno + + unless bool + RemoveDirectoryW(to_path) + raise SystemCallError.new("DeviceIoControl", error) + end + ensure + CloseHandle(handle) + end + end + + self + end + + # Returns the path that a given junction points to. Raises an + # Errno::ENOENT error if the given path does not exist. Returns false + # if it is not a junction. + # + # Example: + # + # Dir.mkdir('C:/from') + # Dir.create_junction('C:/to', 'C:/from') + # Dir.read_junction("c:/to") # => "c:/from" + # + def self.read_junction(junction) + return false unless Dir.junction?(junction) + + junction = Puppet::Util::Windows::String.wide_string(string_check(junction)) + + junction_path = (0.chr * 1024).encode(Encoding::UTF_16LE) + + length = GetFullPathNameW(junction, junction_path.size, junction_path, nil) + + if length == 0 || length > junction_path.size + raise SystemCallError.new("GetFullPathNameW", FFI.errno) + else + junction_path.strip! + end + + begin + # Generic read & write + open existing + reparse point & backup semantics + handle = CreateFileW( + junction_path, + GENERIC_READ | GENERIC_WRITE, + 0, + nil, + OPEN_EXISTING, + FILE_FLAG_OPEN_REPARSE_POINT | FILE_FLAG_BACKUP_SEMANTICS, + 0 + ) + + if handle == INVALID_HANDLE_VALUE + raise SystemCallError.new("CreateFileW", FFI.errno) + end + + rdb = REPARSE_JDATA_BUFFER.new + rdb[:ReparseTag] = 0 + rdb[:ReparseDataLength] = 0 + rdb[:Reserved] = 0 + rdb[:SubstituteNameOffset] = 0 + rdb[:SubstituteNameLength] = 0 + rdb[:PrintNameOffset] = 0 + rdb[:PrintNameLength] = 0 + rdb[:PathBuffer] = "" + + bytes = FFI::MemoryPointer.new(:ulong) + + begin + bool = DeviceIoControl( + handle, + CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 42, METHOD_BUFFERED, 0), + nil, + 0, + rdb, + 1024, + bytes, + nil + ) + + error = FFI.errno + + unless bool + raise SystemCallError.new("DeviceIoControl", error) + end + ensure + CloseHandle(handle) + end + end + + # MSDN says print and substitute names can be in any order + jname = (rdb[:PathBuffer].to_ptr + rdb[:SubstituteNameOffset]).read_string(rdb[:SubstituteNameLength]) + jname = jname.bytes.to_a.pack("C*") + jname = jname.force_encoding(Encoding::UTF_16LE) + raise "Invalid junction name: #{jname.encode(Encoding::UTF_8)}" unless jname[0..3] == "\\??\\".encode(Encoding::UTF_16LE) + begin + File.expand_path(jname[4..-1].encode(Encoding.default_external)) + rescue Encoding::UndefinedConversionError + File.expand_path(jname[4..-1].encode(Encoding::UTF_8)) + end + end + + # Returns whether or not +path+ is empty. Returns false if +path+ is not + # a directory, or contains any files other than '.' or '..'. + # + def self.empty?(path) + PathIsDirectoryEmptyW(Puppet::Util::Windows::String.wide_string(path)) + end + + # Returns whether or not +path+ is a junction. + # + def self.junction?(path) + string_check(path) + bool = true + + attrib = GetFileAttributesW(Puppet::Util::Windows::String.wide_string(path)) + + # Only directories with a reparse point attribute can be junctions + if attrib == INVALID_FILE_ATTRIBUTES || + attrib & FILE_ATTRIBUTE_DIRECTORY == 0 || + attrib & FILE_ATTRIBUTE_REPARSE_POINT == 0 + bool = false + end + + bool + end + + class << self + alias reparse_dir? junction? + + # Simulate MRI's contortions for a stringiness check. + def string_check(arg) + return arg if arg.is_a?(String) + return arg.send(:to_str) if arg.respond_to?(:to_str, true) # MRI honors it, even if private + return arg.to_path if arg.respond_to?(:to_path) + raise TypeError + end + + # Macro from Windows header file, used by the create_junction method. + def CTL_CODE(device, function, method, access) + ((device) << 16) | ((access) << 14) | ((function) << 2) | (method) + end + end +end From 3a80c93b89e0af8c45ae8858d2bcf6a8079af20b Mon Sep 17 00:00:00 2001 From: Gabriel Nagy Date: Mon, 10 Aug 2020 11:57:56 +0300 Subject: [PATCH 063/731] (PUP-6184) Add spec tests for Dir monkeypatch --- lib/puppet/util/windows/monkey_patches/dir.rb | 9 +- .../util/windows/monkey_patches/dir_spec.rb | 231 ++++++++++++++++++ 2 files changed, 236 insertions(+), 4 deletions(-) create mode 100644 spec/integration/util/windows/monkey_patches/dir_spec.rb diff --git a/lib/puppet/util/windows/monkey_patches/dir.rb b/lib/puppet/util/windows/monkey_patches/dir.rb index 5b756a457c9..33ffa55b20d 100644 --- a/lib/puppet/util/windows/monkey_patches/dir.rb +++ b/lib/puppet/util/windows/monkey_patches/dir.rb @@ -279,7 +279,7 @@ def self.create_junction(to, from) raise SystemCallError.new("DeviceIoControl", error) end ensure - CloseHandle(handle) + FFI::WIN32.CloseHandle(handle) end end @@ -357,7 +357,7 @@ def self.read_junction(junction) raise SystemCallError.new("DeviceIoControl", error) end ensure - CloseHandle(handle) + FFI::WIN32.CloseHandle(handle) end end @@ -377,13 +377,14 @@ def self.read_junction(junction) # a directory, or contains any files other than '.' or '..'. # def self.empty?(path) - PathIsDirectoryEmptyW(Puppet::Util::Windows::String.wide_string(path)) + path = string_check(path) + PathIsDirectoryEmptyW(Puppet::Util::Windows::String.wide_string(path)) != 0 end # Returns whether or not +path+ is a junction. # def self.junction?(path) - string_check(path) + path = string_check(path) bool = true attrib = GetFileAttributesW(Puppet::Util::Windows::String.wide_string(path)) diff --git a/spec/integration/util/windows/monkey_patches/dir_spec.rb b/spec/integration/util/windows/monkey_patches/dir_spec.rb new file mode 100644 index 00000000000..b15b0f94e30 --- /dev/null +++ b/spec/integration/util/windows/monkey_patches/dir_spec.rb @@ -0,0 +1,231 @@ +# coding: utf-8 +# frozen_string_literal: true + +require 'spec_helper' + +describe 'Dir', if: Puppet::Util::Platform.windows? do + + before(:all) do + @temp = Dir.tmpdir + @from = File.join(@temp, 'test_from_directory') + @ascii_to = File.join(@temp, 'test_to_directory') + @unicode_to = File.join(@temp, 'Ελλάσ') + @test_file = File.join(@from, 'test.txt') + + Dir.mkdir(@from) + end + + after(:all) do + FileUtils.rm_rf(@ascii_to) + FileUtils.rm_rf(@unicode_to) + FileUtils.rm_rf(@from) + end + + let(:pattern1) { "C:\\Program Files\\Common Files\\System\\*.dll" } + let(:pattern2) { "C:\\Windows\\*.exe" } + let(:pathname1) { Pathname.new(pattern1) } + let(:pathname2) { Pathname.new(pattern2) } + + let(:from) { @from } + let(:ascii_to) { @ascii_to } + let(:unicode_to) { @unicode_to } + let(:test_file) { @test_file } + + describe '.glob' do + it 'handles backslashes' do + expect { Dir.glob(pattern1) }.not_to raise_error + expect(Dir.glob(pattern1)).not_to be_empty + end + + it 'handles multiple strings' do + expect { Dir.glob([pattern1, pattern2]) }.not_to raise_error + expect(Dir.glob([pattern1, pattern2])).not_to be_empty + end + + it 'still observes flags' do + expect { Dir.glob('*', File::FNM_DOTMATCH) }.not_to raise_error + expect(Dir.glob('*', File::FNM_DOTMATCH)).to include('.') + end + + it 'still honors block' do + array = [] + expect do + Dir.glob('*', File::FNM_DOTMATCH) { |m| array << m } + end.not_to raise_error + expect(array).to include('.') + end + + it 'handles Pathname objects' do + expect { Dir.glob([pathname1, pathname2]) }.not_to raise_error + expect(Dir.glob([pathname1, pathname2])).not_to be_empty + end + + it 'requires a stringy argument' do + expect { Dir.glob(nil) }.to raise_error(TypeError) + end + end + + describe '.[]' do + it 'handles backslashes' do + expect { Dir[pattern1] }.not_to raise_error + expect(Dir[pattern1]).not_to be_empty + end + + it 'handles multiple arguments' do + expect { Dir[pattern1, pattern2] }.not_to raise_error + expect(Dir[pattern1, pattern2]).not_to be_empty + end + + it 'handles Pathname arguments' do + expect { Dir[pathname1, pathname2] }.not_to raise_error + expect(Dir[pathname1, pathname2]).not_to be_empty + end + end + + describe '.create_junction' do + after(:all) { FileUtils.rm_f(@test_file) } + + it 'is callable' do + expect(Dir).to respond_to(:create_junction) + end + + it 'works as expected with ASCII characters' do + expect { Dir.create_junction(ascii_to, from) }.not_to raise_error + expect(File).to exist(ascii_to) + File.open(test_file, 'w') { |fh| fh.puts 'Hello World' } + expect(Dir.entries(from)).to eq(Dir.entries(ascii_to)) + end + + it 'works as expected with unicode characters' do + expect { Dir.create_junction(unicode_to, from) }.not_to raise_error + expect(File).to exist(unicode_to) + File.open(test_file, 'w') { |fh| fh.puts 'Hello World' } + expect(Dir.entries(from)).to eq(Dir.entries(unicode_to)) + end + + it 'works as expected with Pathname objects' do + expect { Dir.create_junction(Pathname.new(ascii_to), Pathname.new(from)) }.not_to raise_error + expect(File).to exist(ascii_to) + File.open(test_file, 'w') { |fh| fh.puts 'Hello World' } + expect(Dir.entries(from)).to eq(Dir.entries(ascii_to)) + end + + it 'requires stringy arguments' do + expect { Dir.create_junction(nil, from) }.to raise_error(TypeError) + expect { Dir.create_junction(ascii_to, nil) }.to raise_error(TypeError) + end + end + + describe '.read_junction' do + it 'works as expected with ASCII characters' do + expect { Dir.create_junction(ascii_to, from) }.not_to raise_error + expect(File).to exist(ascii_to) + expect(Dir.read_junction(ascii_to)).to eq(from) + end + + it 'works as expected with unicode characters' do + expect { Dir.create_junction(unicode_to, from) }.not_to raise_error + expect(File).to exist(unicode_to) + expect(Dir.read_junction(unicode_to)).to eq(from) + end + + it 'is joinable with unicode characters' do + expect { Dir.create_junction(unicode_to, from) }.not_to raise_error + expect(File).to exist(unicode_to) + expect { File.join(Dir.read_junction(unicode_to), 'foo') }.not_to raise_error + end + + it 'works as expected with Pathname objects' do + expect { Dir.create_junction(Pathname.new(ascii_to), Pathname.new(from)) }.not_to raise_error + expect(File).to exist(ascii_to) + expect(Dir.read_junction(ascii_to)).to eq(from) + end + + it 'requires a stringy argument' do + expect { Dir.read_junction(nil) }.to raise_error(TypeError) + expect { Dir.read_junction([]) }.to raise_error(TypeError) + end + end + + describe '.junction?' do + it 'returns a boolean value' do + expect(Dir).to respond_to(:junction?) + expect { Dir.create_junction(ascii_to, from) }.not_to raise_error + expect(Dir.junction?(from)).to be false + expect(Dir.junction?(ascii_to)).to be true + expect(Dir.junction?(Pathname.new(ascii_to))).to be true + end + end + + describe '.reparse_dir?' do + it 'aliases junction' do + expect(Dir).to respond_to(:reparse_dir?) + expect(Dir.method(:reparse_dir?)).to eq(Dir.method(:junction?)) + end + end + + describe '.empty?' do + it 'returns expected result' do + expect(Dir).to respond_to(:empty?) + expect(Dir.empty?("C:\\")).to be false + expect(Dir.empty?(from)).to be true + expect(Dir.empty?(Pathname.new(from))).to be true + end + end + + describe '.pwd' do + it 'has basic functionality' do + expect(Dir).to respond_to(:pwd) + expect { Dir.pwd }.not_to raise_error + expect(Dir.pwd).to be_a_kind_of(String) + end + + it 'aliases getwd' do + expect(Dir.method(:pwd)).to eq(Dir.method(:getwd)) + end + + it 'returns full path even if short path was just used' do + Dir.chdir("C:\\Progra~1") + expect(Dir.pwd).to eq("C:\\Program Files") + end + + it 'returns full path even if long path was just used' do + Dir.chdir("C:\\Program Files") + expect(Dir.pwd).to eq("C:\\Program Files") + end + + it 'uses standard case conventions' do + Dir.chdir("C:\\PROGRAM FILES") + expect(Dir.pwd).to eq("C:\\Program Files") + end + + it 'converts forward slashes to backslashes' do + Dir.chdir("C:/Program Files") + expect(Dir.pwd).to eq("C:\\Program Files") + end + end + + describe 'constants' do + ["DESKTOP", "INTERNET", "PROGRAMS", "CONTROLS", + "PRINTERS", "PERSONAL", "FAVORITES", "STARTUP", "RECENT", "SENDTO", + "BITBUCKET", "STARTMENU", "MYDOCUMENTS", "MYMUSIC", "MYVIDEO", + "DESKTOPDIRECTORY", "DRIVES", "NETWORK", "NETHOOD", "FONTS", + "TEMPLATES", "COMMON_STARTMENU", "COMMON_PROGRAMS", + "COMMON_STARTUP", "COMMON_FAVORITES", "COMMON_DESKTOPDIRECTORY", + "APPDATA", "PRINTHOOD", "LOCAL_APPDATA", "ALTSTARTUP", + "COMMON_ALTSTARTUP", "INTERNET_CACHE", "COOKIES", "HISTORY", + "COMMON_APPDATA", "WINDOWS", "SYSTEM", "PROGRAM_FILES", + "MYPICTURES", "PROFILE", "SYSTEMX86", "PROGRAM_FILESX86", + "PROGRAM_FILES_COMMON", "PROGRAM_FILES_COMMONX86", + "COMMON_TEMPLATES", "COMMON_DOCUMENTS", "CONNECTIONS", + "COMMON_MUSIC", "COMMON_PICTURES", "COMMON_VIDEO", "RESOURCES", + "RESOURCES_LOCALIZED", "COMMON_OEM_LINKS", "CDBURN_AREA", + "COMMON_ADMINTOOLS", "ADMINTOOLS"].each do |constant| + it "#{constant} is set" do + expect { Dir.const_get(constant) }.not_to raise_error + expect(Dir.const_get(constant)).to be_a_kind_of(String) + end + end + end + +end From 7bdefb7f7d5c0398efec559c841316e18f1ddb43 Mon Sep 17 00:00:00 2001 From: Gabriel Nagy Date: Mon, 10 Aug 2020 15:53:03 +0300 Subject: [PATCH 064/731] (PUP-6184) Remove require to Win32API The Win32API library has been deprecated since Ruby 1.9. It was originally added in b5fd95336e71ad428109cddf6cd2f33bdd31e025 but sometime ago puppet has switched to using FFI for Win32 API calls. --- lib/puppet/util/windows.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/puppet/util/windows.rb b/lib/puppet/util/windows.rb index d106d624a40..24fae209547 100644 --- a/lib/puppet/util/windows.rb +++ b/lib/puppet/util/windows.rb @@ -15,8 +15,6 @@ class Principal; end class EventLog; end if Puppet::Util::Platform.windows? - require 'Win32API' # case matters in this require! - # Note: Setting codepage here globally ensures all strings returned via # WIN32OLE (Ruby's late-bound COM support) are encoded in Encoding::UTF_8 # From bb7efed83aaea2e9c150167411e7edee245668cb Mon Sep 17 00:00:00 2001 From: Gabriel Nagy Date: Mon, 10 Aug 2020 16:04:00 +0300 Subject: [PATCH 065/731] (PUP-7034) Remove win32/dir dependency from install.rb We cannot require puppet stuff in the install.rb script as Puppet is not installed at that point. Use environment variables for what we need so we don't depend on win32/dir at all. Dir::COMMON_APPDATA maps to ENV['ALLUSERSPROFILE'] Dir::PROGRAM_FILES maps to ENV['PROGRAMFILES'] --- install.rb | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/install.rb b/install.rb index 3ae1135ea97..e28d36c7d62 100755 --- a/install.rb +++ b/install.rb @@ -242,16 +242,10 @@ def prepare_installation $operatingsystem = Facter.value :operatingsystem end - if $operatingsystem == "windows" - # TODO check if this can be required here - # may need to change to require_relative - require 'puppet/util/windows/monkey_patches/dir' - end - if not InstallOptions.configdir.nil? configdir = InstallOptions.configdir elsif $operatingsystem == "windows" - configdir = File.join(Dir::COMMON_APPDATA, "PuppetLabs", "puppet", "etc") + configdir = File.join(ENV['ALLUSERSPROFILE'], "PuppetLabs", "puppet", "etc") else configdir = "/etc/puppetlabs/puppet" end @@ -259,7 +253,7 @@ def prepare_installation if not InstallOptions.codedir.nil? codedir = InstallOptions.codedir elsif $operatingsystem == "windows" - codedir = File.join(Dir::COMMON_APPDATA, "PuppetLabs", "code") + codedir = File.join(ENV['ALLUSERSPROFILE'], "PuppetLabs", "code") else codedir = "/etc/puppetlabs/code" end @@ -267,7 +261,7 @@ def prepare_installation if not InstallOptions.vardir.nil? vardir = InstallOptions.vardir elsif $operatingsystem == "windows" - vardir = File.join(Dir::COMMON_APPDATA, "PuppetLabs", "puppet", "cache") + vardir = File.join(ENV['ALLUSERSPROFILE'], "PuppetLabs", "puppet", "cache") else vardir = "/opt/puppetlabs/puppet/cache" end @@ -275,7 +269,7 @@ def prepare_installation if not InstallOptions.rundir.nil? rundir = InstallOptions.rundir elsif $operatingsystem == "windows" - rundir = File.join(Dir::COMMON_APPDATA, "PuppetLabs", "puppet", "var", "run") + rundir = File.join(ENV['ALLUSERSPROFILE'], "PuppetLabs", "puppet", "var", "run") else rundir = "/var/run/puppetlabs" end @@ -283,7 +277,7 @@ def prepare_installation if not InstallOptions.logdir.nil? logdir = InstallOptions.logdir elsif $operatingsystem == "windows" - logdir = File.join(Dir::COMMON_APPDATA, "PuppetLabs", "puppet", "var", "log") + logdir = File.join(ENV['ALLUSERSPROFILE'], "PuppetLabs", "puppet", "var", "log") else logdir = "/var/log/puppetlabs/puppet" end @@ -298,7 +292,7 @@ def prepare_installation localedir = InstallOptions.localedir else if $operatingsystem == "windows" - localedir = File.join(Dir::PROGRAM_FILES, "Puppet Labs", "Puppet", "puppet", "share", "locale") + localedir = File.join(ENV['PROGRAMFILES'], "Puppet Labs", "Puppet", "puppet", "share", "locale") else localedir = "/opt/puppetlabs/puppet/share/locale" end From e95350fa583c6a4fa1706bd9519a83a299114492 Mon Sep 17 00:00:00 2001 From: Gabriel Nagy Date: Tue, 11 Aug 2020 14:56:37 +0300 Subject: [PATCH 066/731] (PUP-10600) Undefined constant on Windows via AWS Before this commit, attempts of installing or running puppet on Windows via AWS Session Manager failed constantly with a `': uninitialized constant Dir::PERSONAL (Name Error)` error. This behaviour was identified on EC2 Windows Server 2019 instances. The issue is found in the `win32-dir` gem which at some point tries to assign the `Dir::PERSONAL` constant to `Dir::MYDOCUMENTS` without checking if it is initialized/defined first, resulting in the `Name Error` error above. The unlikely scenario where this happens is as follows: The AWS Session Manager communicates with a `SSM Agent` installed on the desired instance. A user called `ssm-user` is created, either manually or automatically by the `SSM Agent` installer (only versions older than 2.3.612.0), to facilitate the connection between the two entities. The root cause comes from this user which does not have a unique user profile and instead is using `C:\Windows\system32\config\systemprofile` so the gem cannot find a `Documents\My Documents` folder since such folders don't actually exist for it. Since Puppet doesn't actually use/needs this path, current fix is defining the `MYDOCUMENTS` constant only if `PERSONAL` is also defined. --- lib/puppet/util/windows/monkey_patches/dir.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/puppet/util/windows/monkey_patches/dir.rb b/lib/puppet/util/windows/monkey_patches/dir.rb index 33ffa55b20d..46c17da16a5 100644 --- a/lib/puppet/util/windows/monkey_patches/dir.rb +++ b/lib/puppet/util/windows/monkey_patches/dir.rb @@ -96,7 +96,7 @@ class Dir # Set Dir::MYDOCUMENTS to the same as Dir::PERSONAL if undefined unless defined? MYDOCUMENTS - MYDOCUMENTS = PERSONAL + MYDOCUMENTS = PERSONAL if defined? PERSONAL end class << self From 9a3699e35927996cad667ed53cd2a55fc17b754e Mon Sep 17 00:00:00 2001 From: Gabriel Nagy Date: Tue, 11 Aug 2020 16:54:04 +0300 Subject: [PATCH 067/731] (PUP-6184) Remove win32-dir from project_data.yaml --- ext/project_data.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/ext/project_data.yaml b/ext/project_data.yaml index 51b6d8f9bd3..bb0f921d19a 100644 --- a/ext/project_data.yaml +++ b/ext/project_data.yaml @@ -39,16 +39,12 @@ gem_platform_dependencies: x86-mingw32: gem_runtime_dependencies: ffi: ['> 1.9.24', '< 2'] - # win32-xxxx gems are pinned due to PUP-6445 - win32-dir: '= 0.4.9' # Use of win32-security is deprecated win32-security: '= 0.2.5' minitar: '~> 0.9' x64-mingw32: gem_runtime_dependencies: ffi: ['> 1.9.24', '< 2'] - # win32-xxxx gems are pinned due to PUP-6445 - win32-dir: '= 0.4.9' # Use of win32-security is deprecated win32-security: '= 0.2.5' minitar: '~> 0.9' From b04b9d20135c958feaf2168b87b03a87adacf6fe Mon Sep 17 00:00:00 2001 From: Gabriel Nagy Date: Tue, 11 Aug 2020 16:54:24 +0300 Subject: [PATCH 068/731] (PUP-5735) Remove win32-security from project_data.yaml --- ext/project_data.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/ext/project_data.yaml b/ext/project_data.yaml index bb0f921d19a..6efbeae9057 100644 --- a/ext/project_data.yaml +++ b/ext/project_data.yaml @@ -39,14 +39,10 @@ gem_platform_dependencies: x86-mingw32: gem_runtime_dependencies: ffi: ['> 1.9.24', '< 2'] - # Use of win32-security is deprecated - win32-security: '= 0.2.5' minitar: '~> 0.9' x64-mingw32: gem_runtime_dependencies: ffi: ['> 1.9.24', '< 2'] - # Use of win32-security is deprecated - win32-security: '= 0.2.5' minitar: '~> 0.9' bundle_platforms: universal-darwin: all From 229bf1095aaed188b5bf50e2ec1825bffed88dbe Mon Sep 17 00:00:00 2001 From: Gabriel Nagy Date: Wed, 12 Aug 2020 17:18:49 +0300 Subject: [PATCH 069/731] (PUP-6184) Reorganize monkey-patched Dir code --- lib/puppet/util/windows/monkey_patches/dir.rb | 451 +++++++++--------- 1 file changed, 224 insertions(+), 227 deletions(-) diff --git a/lib/puppet/util/windows/monkey_patches/dir.rb b/lib/puppet/util/windows/monkey_patches/dir.rb index 46c17da16a5..b3f69892d28 100644 --- a/lib/puppet/util/windows/monkey_patches/dir.rb +++ b/lib/puppet/util/windows/monkey_patches/dir.rb @@ -100,7 +100,216 @@ class Dir end class << self - alias old_glob glob + # Creates the symlink +to+, linked to the existing directory +from+. If the + # +to+ directory already exists, it must be empty or an error is raised. + # + # Example: + # + # Dir.mkdir('C:/from') + # Dir.create_junction('C:/to', 'C:/from') + # + def create_junction(to, from) + to = Puppet::Util::Windows::String.wide_string(string_check(to)) + from = Puppet::Util::Windows::String.wide_string(string_check(from)) + + from_path = (0.chr * 1024).encode(Encoding::UTF_16LE) + + length = GetFullPathNameW(from, from_path.size, from_path, nil) + + if length == 0 || length > from_path.size + raise SystemCallError.new("GetFullPathNameW", FFI.errno) + else + from_path.strip! + end + + to_path = (0.chr * 1024).encode(Encoding::UTF_16LE) + + length = GetFullPathNameW(to, to_path.size, to_path, nil) + + if length == 0 || length > to_path.size + raise SystemCallError.new("GetFullPathNameW", FFI.errno) + else + to_path.strip! + end + + # You can create a junction to a directory that already exists, so + # long as it's empty. + unless CreateDirectoryW(to_path, nil) + if FFI.errno != ERROR_ALREADY_EXISTS + raise SystemCallError.new("CreateDirectoryW", FFI.errno) + end + end + + begin + # Generic read & write + open existing + reparse point & backup semantics + handle = CreateFileW( + to_path, + GENERIC_READ | GENERIC_WRITE, + 0, + nil, + OPEN_EXISTING, + FILE_FLAG_OPEN_REPARSE_POINT | FILE_FLAG_BACKUP_SEMANTICS, + 0 + ) + + if handle == INVALID_HANDLE_VALUE + raise SystemCallError.new("CreateFileW", FFI.errno) + end + + target = "\\??\\".encode(Encoding::UTF_16LE) + from_path + + rdb = REPARSE_JDATA_BUFFER.new + rdb[:ReparseTag] = 2684354563 # IO_REPARSE_TAG_MOUNT_POINT + rdb[:ReparseDataLength] = target.bytesize + 12 + rdb[:Reserved] = 0 + rdb[:SubstituteNameOffset] = 0 + rdb[:SubstituteNameLength] = target.bytesize + rdb[:PrintNameOffset] = target.bytesize + 2 + rdb[:PrintNameLength] = 0 + rdb[:PathBuffer] = target + + bytes = FFI::MemoryPointer.new(:ulong) + + begin + bool = DeviceIoControl( + handle, + CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 41, METHOD_BUFFERED, 0), + rdb, + rdb[:ReparseDataLength] + rdb.header_size, + nil, + 0, + bytes, + nil + ) + + error = FFI.errno + + unless bool + RemoveDirectoryW(to_path) + raise SystemCallError.new("DeviceIoControl", error) + end + ensure + FFI::WIN32.CloseHandle(handle) + end + end + + self + end + + # Returns the path that a given junction points to. Raises an + # Errno::ENOENT error if the given path does not exist. Returns false + # if it is not a junction. + # + # Example: + # + # Dir.mkdir('C:/from') + # Dir.create_junction('C:/to', 'C:/from') + # Dir.read_junction("c:/to") # => "c:/from" + # + def read_junction(junction) + return false unless Dir.junction?(junction) + + junction = Puppet::Util::Windows::String.wide_string(string_check(junction)) + + junction_path = (0.chr * 1024).encode(Encoding::UTF_16LE) + + length = GetFullPathNameW(junction, junction_path.size, junction_path, nil) + + if length == 0 || length > junction_path.size + raise SystemCallError.new("GetFullPathNameW", FFI.errno) + else + junction_path.strip! + end + + begin + # Generic read & write + open existing + reparse point & backup semantics + handle = CreateFileW( + junction_path, + GENERIC_READ | GENERIC_WRITE, + 0, + nil, + OPEN_EXISTING, + FILE_FLAG_OPEN_REPARSE_POINT | FILE_FLAG_BACKUP_SEMANTICS, + 0 + ) + + if handle == INVALID_HANDLE_VALUE + raise SystemCallError.new("CreateFileW", FFI.errno) + end + + rdb = REPARSE_JDATA_BUFFER.new + rdb[:ReparseTag] = 0 + rdb[:ReparseDataLength] = 0 + rdb[:Reserved] = 0 + rdb[:SubstituteNameOffset] = 0 + rdb[:SubstituteNameLength] = 0 + rdb[:PrintNameOffset] = 0 + rdb[:PrintNameLength] = 0 + rdb[:PathBuffer] = "" + + bytes = FFI::MemoryPointer.new(:ulong) + + begin + bool = DeviceIoControl( + handle, + CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 42, METHOD_BUFFERED, 0), + nil, + 0, + rdb, + 1024, + bytes, + nil + ) + + error = FFI.errno + + unless bool + raise SystemCallError.new("DeviceIoControl", error) + end + ensure + FFI::WIN32.CloseHandle(handle) + end + end + + # MSDN says print and substitute names can be in any order + jname = (rdb[:PathBuffer].to_ptr + rdb[:SubstituteNameOffset]).read_string(rdb[:SubstituteNameLength]) + jname = jname.bytes.to_a.pack("C*") + jname = jname.force_encoding(Encoding::UTF_16LE) + raise "Invalid junction name: #{jname.encode(Encoding::UTF_8)}" unless jname[0..3] == "\\??\\".encode(Encoding::UTF_16LE) + begin + File.expand_path(jname[4..-1].encode(Encoding.default_external)) + rescue Encoding::UndefinedConversionError + File.expand_path(jname[4..-1].encode(Encoding::UTF_8)) + end + end + + # Returns whether or not +path+ is empty. Returns false if +path+ is not + # a directory, or contains any files other than '.' or '..'. + # + def empty?(path) + path = string_check(path) + PathIsDirectoryEmptyW(Puppet::Util::Windows::String.wide_string(path)) != 0 + end + + # Returns whether or not +path+ is a junction. + # + def junction?(path) + path = string_check(path) + bool = true + + attrib = GetFileAttributesW(Puppet::Util::Windows::String.wide_string(path)) + + # Only directories with a reparse point attribute can be junctions + if attrib == INVALID_FILE_ATTRIBUTES || + attrib & FILE_ATTRIBUTE_DIRECTORY == 0 || + attrib & FILE_ATTRIBUTE_REPARSE_POINT == 0 + bool = false + end + + bool + end + + alias :old_glob :glob # Same as the standard MRI Dir.glob method except that it handles # backslashes in path names. @@ -178,9 +387,23 @@ def getwd end alias :pwd :getwd + alias :reparse_dir? :junction? private + # Simulate MRI's contortions for a stringiness check. + def string_check(arg) + return arg if arg.is_a?(String) + return arg.send(:to_str) if arg.respond_to?(:to_str, true) # MRI honors it, even if private + return arg.to_path if arg.respond_to?(:to_path) + raise TypeError + end + + # Macro from Windows header file, used by the create_junction method. + def CTL_CODE(device, function, method, access) + ((device) << 16) | ((access) << 14) | ((function) << 2) | (method) + end + # Read a wide character string up until the first double null, and delete # any remaining null characters. def wstrip(str) @@ -189,230 +412,4 @@ def wstrip(str) end end end - - # Creates the symlink +to+, linked to the existing directory +from+. If the - # +to+ directory already exists, it must be empty or an error is raised. - # - # Example: - # - # Dir.mkdir('C:/from') - # Dir.create_junction('C:/to', 'C:/from') - # - def self.create_junction(to, from) - to = Puppet::Util::Windows::String.wide_string(string_check(to)) - from = Puppet::Util::Windows::String.wide_string(string_check(from)) - - from_path = (0.chr * 1024).encode(Encoding::UTF_16LE) - - length = GetFullPathNameW(from, from_path.size, from_path, nil) - - if length == 0 || length > from_path.size - raise SystemCallError.new("GetFullPathNameW", FFI.errno) - else - from_path.strip! - end - - to_path = (0.chr * 1024).encode(Encoding::UTF_16LE) - - length = GetFullPathNameW(to, to_path.size, to_path, nil) - - if length == 0 || length > to_path.size - raise SystemCallError.new("GetFullPathNameW", FFI.errno) - else - to_path.strip! - end - - # You can create a junction to a directory that already exists, so - # long as it's empty. - unless CreateDirectoryW(to_path, nil) - if FFI.errno != ERROR_ALREADY_EXISTS - raise SystemCallError.new("CreateDirectoryW", FFI.errno) - end - end - - begin - # Generic read & write + open existing + reparse point & backup semantics - handle = CreateFileW( - to_path, - GENERIC_READ | GENERIC_WRITE, - 0, - nil, - OPEN_EXISTING, - FILE_FLAG_OPEN_REPARSE_POINT | FILE_FLAG_BACKUP_SEMANTICS, - 0 - ) - - if handle == INVALID_HANDLE_VALUE - raise SystemCallError.new("CreateFileW", FFI.errno) - end - - target = "\\??\\".encode(Encoding::UTF_16LE) + from_path - - rdb = REPARSE_JDATA_BUFFER.new - rdb[:ReparseTag] = 2684354563 # IO_REPARSE_TAG_MOUNT_POINT - rdb[:ReparseDataLength] = target.bytesize + 12 - rdb[:Reserved] = 0 - rdb[:SubstituteNameOffset] = 0 - rdb[:SubstituteNameLength] = target.bytesize - rdb[:PrintNameOffset] = target.bytesize + 2 - rdb[:PrintNameLength] = 0 - rdb[:PathBuffer] = target - - bytes = FFI::MemoryPointer.new(:ulong) - - begin - bool = DeviceIoControl( - handle, - CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 41, METHOD_BUFFERED, 0), - rdb, - rdb[:ReparseDataLength] + rdb.header_size, - nil, - 0, - bytes, - nil - ) - - error = FFI.errno - - unless bool - RemoveDirectoryW(to_path) - raise SystemCallError.new("DeviceIoControl", error) - end - ensure - FFI::WIN32.CloseHandle(handle) - end - end - - self - end - - # Returns the path that a given junction points to. Raises an - # Errno::ENOENT error if the given path does not exist. Returns false - # if it is not a junction. - # - # Example: - # - # Dir.mkdir('C:/from') - # Dir.create_junction('C:/to', 'C:/from') - # Dir.read_junction("c:/to") # => "c:/from" - # - def self.read_junction(junction) - return false unless Dir.junction?(junction) - - junction = Puppet::Util::Windows::String.wide_string(string_check(junction)) - - junction_path = (0.chr * 1024).encode(Encoding::UTF_16LE) - - length = GetFullPathNameW(junction, junction_path.size, junction_path, nil) - - if length == 0 || length > junction_path.size - raise SystemCallError.new("GetFullPathNameW", FFI.errno) - else - junction_path.strip! - end - - begin - # Generic read & write + open existing + reparse point & backup semantics - handle = CreateFileW( - junction_path, - GENERIC_READ | GENERIC_WRITE, - 0, - nil, - OPEN_EXISTING, - FILE_FLAG_OPEN_REPARSE_POINT | FILE_FLAG_BACKUP_SEMANTICS, - 0 - ) - - if handle == INVALID_HANDLE_VALUE - raise SystemCallError.new("CreateFileW", FFI.errno) - end - - rdb = REPARSE_JDATA_BUFFER.new - rdb[:ReparseTag] = 0 - rdb[:ReparseDataLength] = 0 - rdb[:Reserved] = 0 - rdb[:SubstituteNameOffset] = 0 - rdb[:SubstituteNameLength] = 0 - rdb[:PrintNameOffset] = 0 - rdb[:PrintNameLength] = 0 - rdb[:PathBuffer] = "" - - bytes = FFI::MemoryPointer.new(:ulong) - - begin - bool = DeviceIoControl( - handle, - CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 42, METHOD_BUFFERED, 0), - nil, - 0, - rdb, - 1024, - bytes, - nil - ) - - error = FFI.errno - - unless bool - raise SystemCallError.new("DeviceIoControl", error) - end - ensure - FFI::WIN32.CloseHandle(handle) - end - end - - # MSDN says print and substitute names can be in any order - jname = (rdb[:PathBuffer].to_ptr + rdb[:SubstituteNameOffset]).read_string(rdb[:SubstituteNameLength]) - jname = jname.bytes.to_a.pack("C*") - jname = jname.force_encoding(Encoding::UTF_16LE) - raise "Invalid junction name: #{jname.encode(Encoding::UTF_8)}" unless jname[0..3] == "\\??\\".encode(Encoding::UTF_16LE) - begin - File.expand_path(jname[4..-1].encode(Encoding.default_external)) - rescue Encoding::UndefinedConversionError - File.expand_path(jname[4..-1].encode(Encoding::UTF_8)) - end - end - - # Returns whether or not +path+ is empty. Returns false if +path+ is not - # a directory, or contains any files other than '.' or '..'. - # - def self.empty?(path) - path = string_check(path) - PathIsDirectoryEmptyW(Puppet::Util::Windows::String.wide_string(path)) != 0 - end - - # Returns whether or not +path+ is a junction. - # - def self.junction?(path) - path = string_check(path) - bool = true - - attrib = GetFileAttributesW(Puppet::Util::Windows::String.wide_string(path)) - - # Only directories with a reparse point attribute can be junctions - if attrib == INVALID_FILE_ATTRIBUTES || - attrib & FILE_ATTRIBUTE_DIRECTORY == 0 || - attrib & FILE_ATTRIBUTE_REPARSE_POINT == 0 - bool = false - end - - bool - end - - class << self - alias reparse_dir? junction? - - # Simulate MRI's contortions for a stringiness check. - def string_check(arg) - return arg if arg.is_a?(String) - return arg.send(:to_str) if arg.respond_to?(:to_str, true) # MRI honors it, even if private - return arg.to_path if arg.respond_to?(:to_path) - raise TypeError - end - - # Macro from Windows header file, used by the create_junction method. - def CTL_CODE(device, function, method, access) - ((device) << 16) | ((access) << 14) | ((function) << 2) | (method) - end - end end From 5005bc00141dae716c321f6f3a2e28ca6bd8fe54 Mon Sep 17 00:00:00 2001 From: Justin Stoller Date: Thu, 13 Aug 2020 08:34:39 -0700 Subject: [PATCH 070/731] (PUP-10436) Remove node_name setting and usage This was only used when the deprecated stric_hostname_checking setting was false, which is no longer a valid workflow. --- lib/puppet/defaults.rb | 19 ------------------- lib/puppet/node.rb | 9 --------- spec/unit/node_spec.rb | 30 ------------------------------ 3 files changed, 58 deletions(-) diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb index 8c56cdf5854..6ec3cf65192 100644 --- a/lib/puppet/defaults.rb +++ b/lib/puppet/defaults.rb @@ -1359,25 +1359,6 @@ def self.initialize_default_settings!(settings) with Puppet Server. (eg `puppet facts upload`, `puppet agent`). May be overridden by more specific settings (see `ca_port`, `report_port`).", }, - :node_name => { - :default => 'cert', - :type => :enum, - :values => ['cert', 'facter'], - :deprecated => :completely, - :hook => proc { |val| - if val != 'cert' - Puppet.deprecation_warning("The node_name setting is deprecated and will be removed in a future release.") - end - }, - :desc => "How the puppet master determines the client's identity - and sets the 'hostname', 'fqdn' and 'domain' facts for use in the manifest, - in particular for determining which 'node' statement applies to the client. - Possible values are 'cert' (use the subject's CN in the client's - certificate) and 'facter' (use the hostname that the client - reported in its facts). - - This setting is deprecated, please use explicit fact matching for classification.", - }, :bucketdir => { :default => "$vardir/bucket", :type => :directory, diff --git a/lib/puppet/node.rb b/lib/puppet/node.rb index dd91127687a..ea189bb9d7c 100644 --- a/lib/puppet/node.rb +++ b/lib/puppet/node.rb @@ -203,15 +203,6 @@ def names # list to search, in order of longest to shortest. names += split_name(fqdn) if fqdn - # And make sure the node name is first, since that's the most - # likely usage. - # The name is usually the Certificate CN, but it can be - # set to the 'facter' hostname instead. - if Puppet[:node_name] == 'cert' - names.unshift name - else - names.unshift parameters["hostname"] - end names.uniq end diff --git a/spec/unit/node_spec.rb b/spec/unit/node_spec.rb index cbc0acade99..7f1dd8ec228 100644 --- a/spec/unit/node_spec.rb +++ b/spec/unit/node_spec.rb @@ -447,34 +447,4 @@ def from_json(json) expect(@node.names).to include("foo.deep.sub.domain") expect(@node.names).to include("foo.deep.sub") end - - describe "and :node_name is set to 'cert'" do - before do - Puppet[:node_name] = "cert" - end - - it "uses the passed-in key as the first value" do - expect(@node.names[0]).to eq("foo.domain.com") - end - - describe "and strict hostname checking is enabled" do - before do - Puppet[:strict_hostname_checking] = true - end - - it "only uses the passed-in key" do - expect(@node.names).to eq(["foo.domain.com"]) - end - end - end - - describe "and :node_name is set to 'facter'" do - before do - Puppet[:node_name] = "facter" - end - - it "uses the node's 'hostname' fact as the first value" do - expect(@node.names[0]).to eq("yay") - end - end end From 036f63d09ddebf457907cc02cc90e84aa770f644 Mon Sep 17 00:00:00 2001 From: Justin Stoller Date: Thu, 13 Aug 2020 09:40:13 -0700 Subject: [PATCH 071/731] (PUP-10436) Remove strict_hostname_checking setting --- lib/puppet/defaults.rb | 18 +----------------- lib/puppet/node.rb | 22 +--------------------- spec/integration/parser/node_spec.rb | 9 --------- spec/unit/node_spec.rb | 26 ++------------------------ 4 files changed, 4 insertions(+), 71 deletions(-) diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb index 6ec3cf65192..2b80c97fa93 100644 --- a/lib/puppet/defaults.rb +++ b/lib/puppet/defaults.rb @@ -1478,23 +1478,7 @@ def self.initialize_default_settings!(settings) :default => "$confdir/fileserver.conf", :type => :file, :desc => "Where the fileserver configuration is stored.", - }, - :strict_hostname_checking => { - :default => true, - :type => :boolean, - :desc => "Whether to only search for the complete - hostname as it is in the certificate when searching for node information - in the catalogs or to match dot delimited segments of the cert's certname - and the hostname, fqdn, and/or domain facts. - - This setting is deprecated and will be removed in a future release.", - :hook => proc { |val| - if val != true - Puppet.deprecation_warning("Setting strict_hostname_checking to false is deprecated and will be removed in a future release. Please use regular expressions in your node declarations or explicit fact matching for classification (though be warned that fact based classification may be considered insecure).") - end - } - } - ) + }) settings.define_settings(:device, :devicedir => { diff --git a/lib/puppet/node.rb b/lib/puppet/node.rb index ea189bb9d7c..9e433bb9ff3 100644 --- a/lib/puppet/node.rb +++ b/lib/puppet/node.rb @@ -183,27 +183,7 @@ def add_server_facts(facts) # Calculate the list of names we might use for looking # up our node. This is only used for AST nodes. def names - return [name] if Puppet.settings[:strict_hostname_checking] - - names = [] - - names += split_name(name) if name.include?(".") - - # First, get the fqdn - fqdn = parameters["fqdn"] - unless fqdn - if parameters["hostname"] and parameters["domain"] - fqdn = parameters["hostname"] + "." + parameters["domain"] - else - Puppet.warning _("Host is missing hostname and/or domain: %{name}") % { name: name } - end - end - - # Now that we (might) have the fqdn, add each piece to the name - # list to search, in order of longest to shortest. - names += split_name(fqdn) if fqdn - - names.uniq + @names ||= [name] end def split_name(name) diff --git a/spec/integration/parser/node_spec.rb b/spec/integration/parser/node_spec.rb index 1ab44c66dbe..998a6bded9d 100644 --- a/spec/integration/parser/node_spec.rb +++ b/spec/integration/parser/node_spec.rb @@ -117,15 +117,6 @@ class foo { expect(catalog).to have_resource('Notify[matched]') end - it 'selects a node that is a prefix of the agent name' do - Puppet[:strict_hostname_checking] = false - catalog = compile_to_catalog(<<-MANIFEST, Puppet::Node.new("node.name.com")) - node 'node.name' { notify { matched: } } - MANIFEST - - expect(catalog).to have_resource('Notify[matched]') - end - it 'does not treat regex symbols as a regex inside a string literal' do catalog = compile_to_catalog(<<-MANIFEST, Puppet::Node.new("nodexname")) node 'node.name' { notify { 'not matched': } } diff --git a/spec/unit/node_spec.rb b/spec/unit/node_spec.rb index 7f1dd8ec228..37e21c49d1b 100644 --- a/spec/unit/node_spec.rb +++ b/spec/unit/node_spec.rb @@ -417,34 +417,12 @@ def from_json(json) describe Puppet::Node, "when generating the list of names to search through" do before do - Puppet[:strict_hostname_checking] = false @node = Puppet::Node.new("foo.domain.com", :parameters => {"hostname" => "yay", "domain" => "domain.com"}) end - it "returns an array of names" do + it "returns an array of one name" do expect(@node.names).to be_instance_of(Array) - end - - describe "and the node name is fully qualified" do - it "contains an entry for each part of the node name" do - expect(@node.names).to include("foo.domain.com") - expect(@node.names).to include("foo.domain") - expect(@node.names).to include("foo") - end - end - - it "includes the node's fqdn" do - expect(@node.names).to include("yay.domain.com") - end - - it "combines and include the node's hostname and domain if no fqdn is available" do - expect(@node.names).to include("yay.domain.com") - end - - it "contains an entry for each name available by stripping a segment of the fqdn" do - @node.parameters["fqdn"] = "foo.deep.sub.domain.com" - expect(@node.names).to include("foo.deep.sub.domain") - expect(@node.names).to include("foo.deep.sub") + expect(@node.names).to eq ["foo.domain.com"] end end From fa38eaffc2dc7e24aaa9d68cd5904aa4f5ed7ea0 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Thu, 13 Aug 2020 22:21:22 +0000 Subject: [PATCH 072/731] (packaging) Updating the puppet.pot file --- locales/puppet.pot | 40 ++++++++++++++++++---------------------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/locales/puppet.pot b/locales/puppet.pot index 84ec9790d3c..6b938e4a7b7 100644 --- a/locales/puppet.pot +++ b/locales/puppet.pot @@ -6,11 +6,11 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Puppet automation framework 6.17.0-193-gb356fdd18b\n" +"Project-Id-Version: Puppet automation framework 6.17.0-223-g3749da0dad\n" "\n" "Report-Msgid-Bugs-To: https://tickets.puppetlabs.com\n" -"POT-Creation-Date: 2020-08-10 10:36+0000\n" -"PO-Revision-Date: 2020-08-10 10:36+0000\n" +"POT-Creation-Date: 2020-08-13 22:21+0000\n" +"PO-Revision-Date: 2020-08-13 22:21+0000\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -726,7 +726,7 @@ msgid "Invalid value '%{value}' for parameter %{name}. Allowed values are '%{all msgstr "" #. TRANSLATORS 'pluginsync' is a setting and should not be translated -#: ../lib/puppet/defaults.rb:1924 +#: ../lib/puppet/defaults.rb:1889 msgid "Setting 'pluginsync' is deprecated." msgstr "" @@ -3985,11 +3985,7 @@ msgstr "" msgid "The node parameter '%{param_name}' for node '%{node_name}' was already set to '%{value}'. It could not be set to '%{desired_value}'" msgstr "" -#: ../lib/puppet/node.rb:198 -msgid "Host is missing hostname and/or domain: %{name}" -msgstr "" - -#: ../lib/puppet/node.rb:230 +#: ../lib/puppet/node.rb:201 msgid "Trusted node data modified for node %{name}" msgstr "" @@ -3997,7 +3993,7 @@ msgstr "" msgid "The 'disable_per_environment_manifest' setting is true, and the '%{env_name}' environment has an environment.conf manifest that conflicts with the 'default_manifest' setting." msgstr "" -#: ../lib/puppet/node/environment.rb:562 ../lib/puppet/pops/loaders.rb:301 +#: ../lib/puppet/node/environment.rb:568 ../lib/puppet/pops/loaders.rb:301 msgid "Could not parse for environment %{env}: %{detail}" msgstr "" @@ -4381,31 +4377,31 @@ msgstr "" msgid "The method 'Puppet::Parser::Functions.autoloader#loaded?(\"%{name}\")' is deprecated in favor of using 'Scope#call_function'." msgstr "" -#: ../lib/puppet/parser/functions.rb:186 +#: ../lib/puppet/parser/functions.rb:190 msgid "Overwriting previous definition for function %{name}" msgstr "" -#: ../lib/puppet/parser/functions.rb:192 +#: ../lib/puppet/parser/functions.rb:196 msgid "Invalid statement type %{type}" msgstr "" -#: ../lib/puppet/parser/functions.rb:204 +#: ../lib/puppet/parser/functions.rb:208 msgid "Called %{name}" msgstr "" -#: ../lib/puppet/parser/functions.rb:207 +#: ../lib/puppet/parser/functions.rb:211 msgid "%{name}(): Wrong number of arguments given (%{arg_count} for %{arity})" msgstr "" -#: ../lib/puppet/parser/functions.rb:209 +#: ../lib/puppet/parser/functions.rb:213 msgid "%{name}(): Wrong number of arguments given (%{arg_count} for minimum %{min_arg_count})" msgstr "" -#: ../lib/puppet/parser/functions.rb:215 +#: ../lib/puppet/parser/functions.rb:219 msgid "custom functions must be called with a single array that contains the arguments. For example, function_example([1]) instead of function_example(1)" msgstr "" -#: ../lib/puppet/parser/functions.rb:314 +#: ../lib/puppet/parser/functions.rb:318 msgid "%{name}() can only be called using the 4.x function API. See Scope#call_function" msgstr "" @@ -8800,11 +8796,11 @@ msgstr "" msgid "Failed to abandon a child process contract" msgstr "" -#: ../lib/puppet/util/autoload.rb:75 +#: ../lib/puppet/util/autoload.rb:83 msgid "Could not autoload %{name}: %{detail}" msgstr "" -#: ../lib/puppet/util/autoload.rb:182 +#: ../lib/puppet/util/autoload.rb:184 msgid "Autoload paths cannot be fully qualified" msgstr "" @@ -9632,15 +9628,15 @@ msgstr "" msgid "(Win32 error: %{detail})" msgstr "" -#: ../lib/puppet/util/windows/file.rb:180 +#: ../lib/puppet/util/windows/file.rb:181 msgid "Failed to set file attributes" msgstr "" -#: ../lib/puppet/util/windows/file.rb:255 +#: ../lib/puppet/util/windows/file.rb:256 msgid "out_buffer is required" msgstr "" -#: ../lib/puppet/util/windows/file.rb:342 +#: ../lib/puppet/util/windows/file.rb:348 msgid "Failed to call GetLongPathName" msgstr "" From 39c94829809fbd2836d96a87b2423d195bb38596 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Thu, 13 Aug 2020 22:22:46 +0000 Subject: [PATCH 073/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index b21e2a9c8a8..e5525f34ac9 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -1289,17 +1289,6 @@ How to store cached nodes\. Valid values are (none), \'json\', \'msgpack\', or \ .TP \fIDefault\fR: -. -.SS "node_name" -How the puppet master determines the client\'s identity and sets the \'hostname\', \'fqdn\' and \'domain\' facts for use in the manifest, in particular for determining which \'node\' statement applies to the client\. Possible values are \'cert\' (use the subject\'s CN in the client\'s certificate) and \'facter\' (use the hostname that the client reported in its facts)\. -. -.P -This setting is deprecated, please use explicit fact matching for classification\. -. -.IP "\(bu" 4 -\fIDefault\fR: cert -. -.IP "" 0 . .SS "node_name_fact" The fact name used to determine the node name used for all requests the agent makes to the master\. WARNING: This setting is mutually exclusive with node_name_value\. Changing this setting also requires changes to the default auth\.conf configuration on the Puppet Master\. Please see http://links\.puppet\.com/node_name_fact for more information\. @@ -1886,17 +1875,6 @@ Whether the agent specified environment should be considered authoritative, caus . .IP "" 0 . -.SS "strict_hostname_checking" -Whether to only search for the complete hostname as it is in the certificate when searching for node information in the catalogs or to match dot delimited segments of the cert\'s certname and the hostname, fqdn, and/or domain facts\. -. -.P -This setting is deprecated and will be removed in a future release\. -. -.IP "\(bu" 4 -\fIDefault\fR: true -. -.IP "" 0 -. .SS "strict_variables" Causes an evaluation error when referencing unknown variables\. (This does not affect referencing variables that are explicitly set to undef)\. . From 1746c6fb3beeef7e2e8b3916d5f40de53b3e86f2 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Mon, 17 Aug 2020 02:06:15 +0000 Subject: [PATCH 074/731] (packaging) Updating the puppet.pot file --- locales/puppet.pot | 58 +++++++++++++--------------------------------- 1 file changed, 16 insertions(+), 42 deletions(-) diff --git a/locales/puppet.pot b/locales/puppet.pot index 6b938e4a7b7..53e810bb3fc 100644 --- a/locales/puppet.pot +++ b/locales/puppet.pot @@ -6,11 +6,11 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Puppet automation framework 6.17.0-223-g3749da0dad\n" +"Project-Id-Version: Puppet automation framework 6.17.0-236-g14fe3bff21\n" "\n" "Report-Msgid-Bugs-To: https://tickets.puppetlabs.com\n" -"POT-Creation-Date: 2020-08-13 22:21+0000\n" -"PO-Revision-Date: 2020-08-13 22:21+0000\n" +"POT-Creation-Date: 2020-08-17 02:06+0000\n" +"PO-Revision-Date: 2020-08-17 02:06+0000\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -772,7 +772,7 @@ msgstr "" msgid "no matching resources found" msgstr "" -#: ../lib/puppet/face/config.rb:7 ../lib/puppet/face/epp.rb:8 ../lib/puppet/face/facts.rb:6 ../lib/puppet/face/generate.rb:7 ../lib/puppet/face/help.rb:9 ../lib/puppet/face/man.rb:8 ../lib/puppet/face/module.rb:9 ../lib/puppet/face/node.rb:4 ../lib/puppet/face/parser.rb:6 ../lib/puppet/face/plugin.rb:6 ../lib/puppet/face/report.rb:5 ../lib/puppet/face/resource.rb:5 ../lib/puppet/face/status.rb:5 +#: ../lib/puppet/face/config.rb:7 ../lib/puppet/face/epp.rb:8 ../lib/puppet/face/facts.rb:6 ../lib/puppet/face/generate.rb:7 ../lib/puppet/face/help.rb:9 ../lib/puppet/face/module.rb:9 ../lib/puppet/face/node.rb:4 ../lib/puppet/face/parser.rb:6 ../lib/puppet/face/plugin.rb:6 ../lib/puppet/face/report.rb:5 ../lib/puppet/face/resource.rb:5 ../lib/puppet/face/status.rb:5 msgid "Apache 2 license; see COPYING" msgstr "" @@ -1135,32 +1135,6 @@ msgstr "" msgid "Check error logs." msgstr "" -#: ../lib/puppet/face/man.rb:10 -msgid "Display Puppet manual pages." -msgstr "" - -#: ../lib/puppet/face/man.rb:28 -msgid "Display the manual page for a Puppet subcommand." -msgstr "" - -#: ../lib/puppet/face/man.rb:29 -msgid "" -msgstr "" - -#. TRANSLATORS '--render-as s' is a command line option and should not be translated -#: ../lib/puppet/face/man.rb:31 -msgid "" -" The man data, in Markdown format, suitable for consumption by Ronn.\n" -"\n" -" RENDERING ISSUES: To skip fancy formatting and output the raw Markdown\n" -" text (e.g. for use in a pipeline), call this action with '--render-as s'.\n" -msgstr "" - -#. TRANSLATORS 'puppet man' is a specific command line and should not be translated -#: ../lib/puppet/face/man.rb:56 -msgid "The 'puppet man' command takes a single subcommand to review the subcommand's manpage" -msgstr "" - #: ../lib/puppet/face/module.rb:11 msgid "Creates, installs and searches for modules on the Puppet Forge." msgstr "" @@ -4025,54 +3999,54 @@ msgstr "" #. TRANSLATORS: do not translate the variable names in this error message #. TRANSLATORS: do not translate the variable names in this error message -#: ../lib/puppet/pal/pal_impl.rb:73 ../lib/puppet/pal/pal_impl.rb:171 +#: ../lib/puppet/pal/pal_impl.rb:75 ../lib/puppet/pal/pal_impl.rb:173 msgid "manifest_file or code_string cannot be given when configured_by_env is true" msgstr "" -#: ../lib/puppet/pal/pal_impl.rb:219 +#: ../lib/puppet/pal/pal_impl.rb:221 msgid "temporary environment name" msgstr "" #. TRANSLATORS: do not translate variable name string in these assertions -#: ../lib/puppet/pal/pal_impl.rb:224 +#: ../lib/puppet/pal/pal_impl.rb:226 msgid "A block must be given to 'in_tmp_environment'" msgstr "" #. TRANSLATORS terms in the assertions below are names of terms in code -#: ../lib/puppet/pal/pal_impl.rb:278 +#: ../lib/puppet/pal/pal_impl.rb:280 msgid "A block must be given to 'in_environment'" msgstr "" #. TRANSLATORS 'in_environment' is a name, do not translate -#: ../lib/puppet/pal/pal_impl.rb:283 +#: ../lib/puppet/pal/pal_impl.rb:285 msgid "The environment directory '%{env_dir}' does not exist" msgstr "" -#: ../lib/puppet/pal/pal_impl.rb:306 +#: ../lib/puppet/pal/pal_impl.rb:308 msgid "No directory found for the environment '%{env_name}' on the path '%{envpath}'" msgstr "" -#: ../lib/puppet/pal/pal_impl.rb:360 +#: ../lib/puppet/pal/pal_impl.rb:362 msgid "Given variables must be a hash, got %{type}" msgstr "" -#: ../lib/puppet/pal/pal_impl.rb:366 +#: ../lib/puppet/pal/pal_impl.rb:368 msgid "Given variable '%{varname}' has illegal name" msgstr "" -#: ../lib/puppet/pal/pal_impl.rb:370 +#: ../lib/puppet/pal/pal_impl.rb:372 msgid "Given value for '%{varname}' has illegal type - got: %{type}" msgstr "" -#: ../lib/puppet/pal/pal_impl.rb:485 +#: ../lib/puppet/pal/pal_impl.rb:509 msgid "Puppet Pal: %{what}" msgstr "" -#: ../lib/puppet/pal/pal_impl.rb:499 +#: ../lib/puppet/pal/pal_impl.rb:523 msgid "Cannot use '%{a_term}' and '%{b_term}' at the same time" msgstr "" -#: ../lib/puppet/pal/pal_impl.rb:506 +#: ../lib/puppet/pal/pal_impl.rb:530 msgid "A block must be given" msgstr "" From de6de62149137dfbec866a6e866ac2e89e605cff Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Mon, 17 Aug 2020 02:07:25 +0000 Subject: [PATCH 075/731] (packaging) Updating manpage file for main --- man/man8/puppet-man.8 | 76 ------------------------------------------- 1 file changed, 76 deletions(-) delete mode 100644 man/man8/puppet-man.8 diff --git a/man/man8/puppet-man.8 b/man/man8/puppet-man.8 deleted file mode 100644 index bb0764e60c7..00000000000 --- a/man/man8/puppet-man.8 +++ /dev/null @@ -1,76 +0,0 @@ -.\" generated with Ronn/v0.7.3 -.\" http://github.com/rtomayko/ronn/tree/0.7.3 -. -.TH "PUPPET\-MAN" "8" "August 2020" "Puppet, Inc." "Puppet manual" -. -.SH "NAME" -\fBpuppet\-man\fR \- Display Puppet manual pages\. -. -.SH "SYNOPSIS" -puppet man \fIaction\fR -. -.SH "DESCRIPTION" -Please use the command \'puppet help \fIsubcommand\fR\' or the system manpage system \'man puppet\-\fIsubcommand\fR\' to display information about Puppet subcommands\. The deprecated man subcommand displays manual pages for all Puppet subcommands\. If the \fBronn\fR gem (\fIhttps://github\.com/rtomayko/ronn/\fR) is installed on your system, puppet man will display fully\-formatted man pages\. If \fBronn\fR is not available, puppet man will display the raw (but human\-readable) source text in a pager\. -. -.SH "OPTIONS" -Note that any setting that\'s valid in the configuration file is also a valid long argument, although it may or may not be relevant to the present action\. For example, \fBserver\fR and \fBrun_mode\fR are valid settings, so you can specify \fB\-\-server \fR, or \fB\-\-run_mode \fR as an argument\. -. -.P -See the configuration file documentation at \fIhttps://puppet\.com/docs/puppet/latest/configuration\.html\fR for the full list of acceptable parameters\. A commented list of all configuration options can also be generated by running puppet with \fB\-\-genconfig\fR\. -. -.TP -\-\-render\-as FORMAT -The format in which to render output\. The most common formats are \fBjson\fR, \fBs\fR (string), \fByaml\fR, and \fBconsole\fR, but other options such as \fBdot\fR are sometimes available\. -. -.TP -\-\-verbose -Whether to log verbosely\. -. -.TP -\-\-debug -Whether to log debug information\. -. -.SH "ACTIONS" -. -.TP -\fBman\fR \- Display the manual page for a Puppet subcommand\. -\fBSYNOPSIS\fR -. -.IP -puppet man \fIsubcommand\fR -. -.IP -\fBDESCRIPTION\fR -. -.IP -Display the manual page for a Puppet subcommand\. -. -.IP -\fBRETURNS\fR -. -.IP -The man data, in Markdown format, suitable for consumption by Ronn\. -. -.IP -RENDERING ISSUES: To skip fancy formatting and output the raw Markdown text (e\.g\. for use in a pipeline), call this action with \'\-\-render\-as s\'\. -. -.SH "EXAMPLES" -\fBman\fR -. -.P -View the installed manual page for the subcommand \'config\': -. -.P -$ man puppet\-config -. -.P -(Deprecated) View the manual page for the subcommand \'config\': -. -.P -$ puppet man config -. -.SH "NOTES" -The pager used for display will be the first found of \fB$MANPAGER\fR, \fB$PAGER\fR, \fBless\fR, \fBmost\fR, or \fBmore\fR\. -. -.SH "COPYRIGHT AND LICENSE" -Copyright 2011 by Puppet Inc\. Apache 2 license; see COPYING From ee97ee7553cbab06862cfbf742d9af65daff7471 Mon Sep 17 00:00:00 2001 From: Dorin Pleava Date: Mon, 10 Aug 2020 16:15:35 +0300 Subject: [PATCH 076/731] (PUP-10597) Remove deprecated held --- .../dpkg_ensure_held_package_is_latest.rb | 26 ------------------- ...re_held_package_should_preserve_version.rb | 22 ---------------- .../dpkg_hold_true_package_is_latest.rb | 4 +-- .../dpkg_hold_true_should_preserve_version.rb | 10 +++---- .../package/ips/should_be_holdable.rb | 4 +-- lib/puppet/provider/package/dpkg.rb | 6 +---- lib/puppet/provider/package/pkg.rb | 4 --- lib/puppet/provider/package/portage.rb | 2 +- lib/puppet/type/package.rb | 18 ++++--------- spec/unit/provider/package/dpkg_spec.rb | 11 +++----- spec/unit/type/package_spec.rb | 2 +- 11 files changed, 21 insertions(+), 88 deletions(-) delete mode 100644 acceptance/tests/provider/package/dpkg_ensure_held_package_is_latest.rb delete mode 100644 acceptance/tests/provider/package/dpkg_ensure_held_package_should_preserve_version.rb diff --git a/acceptance/tests/provider/package/dpkg_ensure_held_package_is_latest.rb b/acceptance/tests/provider/package/dpkg_ensure_held_package_is_latest.rb deleted file mode 100644 index efa72833f75..00000000000 --- a/acceptance/tests/provider/package/dpkg_ensure_held_package_is_latest.rb +++ /dev/null @@ -1,26 +0,0 @@ -test_name "dpkg ensure held package is latest installed" -confine :to, :platform => /debian-8-amd64/ -tag 'audit:low' - -require 'puppet/acceptance/common_utils' -extend Puppet::Acceptance::PackageUtils -extend Puppet::Acceptance::ManifestUtils - - -package = "nginx" - -agents.each do |agent| - teardown do - package_absent(agent, package, '--force-yes') - end -end - -step"Ensure that package is installed first if not present" do - expected_package_version = on(agent.name, "apt-cache policy #{package} | sed -n -e 's/Candidate: //p'").stdout - package_manifest = resource_manifest('package', package, ensure: "held") - - apply_manifest_on(agent, package_manifest) do |result| - installed_package_version = on(agent.name, "apt-cache policy #{package} | sed -n -e 's/Installed: //p'").stdout - assert_match(expected_package_version, installed_package_version) - end -end diff --git a/acceptance/tests/provider/package/dpkg_ensure_held_package_should_preserve_version.rb b/acceptance/tests/provider/package/dpkg_ensure_held_package_should_preserve_version.rb deleted file mode 100644 index 4ec83145504..00000000000 --- a/acceptance/tests/provider/package/dpkg_ensure_held_package_should_preserve_version.rb +++ /dev/null @@ -1,22 +0,0 @@ -test_name "dpkg ensure held package should preserve version if package is already installed" do - confine :to, :platform => /debian-8-amd64/ - tag 'audit:high' - - require 'puppet/acceptance/common_utils' - extend Puppet::Acceptance::PackageUtils - extend Puppet::Acceptance::ManifestUtils - - package = "openssl" - - step "Ensure held should lock to specific installed version" do - existing_installed_version = on(agent.name, "dpkg -s #{package} | sed -n -e 's/Version: //p'").stdout - existing_installed_version.delete!(' ') - - package_manifest_held = resource_manifest('package', package, ensure: 'held') - apply_manifest_on(agent, package_manifest_held) do - installed_version = on(agent.name, "apt-cache policy #{package} | sed -n -e 's/Installed: //p'").stdout - installed_version.delete!(' ') - assert_match(existing_installed_version, installed_version) - end - end -end diff --git a/acceptance/tests/provider/package/dpkg_hold_true_package_is_latest.rb b/acceptance/tests/provider/package/dpkg_hold_true_package_is_latest.rb index 1bf37869dcb..052b7932a4f 100644 --- a/acceptance/tests/provider/package/dpkg_hold_true_package_is_latest.rb +++ b/acceptance/tests/provider/package/dpkg_hold_true_package_is_latest.rb @@ -1,5 +1,5 @@ -test_name "dpkg ensure held package is latest installed" do - confine :to, :platform => /debian-8-amd64/ +test_name "dpkg ensure hold package is latest installed" do + confine :to, :platform => /debian-9-amd64/ tag 'audit:high' require 'puppet/acceptance/common_utils' diff --git a/acceptance/tests/provider/package/dpkg_hold_true_should_preserve_version.rb b/acceptance/tests/provider/package/dpkg_hold_true_should_preserve_version.rb index 72bbe2ed278..4d7dd8d73f7 100644 --- a/acceptance/tests/provider/package/dpkg_hold_true_should_preserve_version.rb +++ b/acceptance/tests/provider/package/dpkg_hold_true_should_preserve_version.rb @@ -1,5 +1,5 @@ -test_name "dpkg ensure held package should preserve version if package is already installed" do - confine :to, :platform => /debian-8-amd64/ +test_name "dpkg ensure hold package should preserve version if package is already installed" do + confine :to, :platform => /debian-9-amd64/ tag 'audit:high' require 'puppet/acceptance/common_utils' @@ -8,12 +8,12 @@ package = "openssl" - step "Ensure held should lock to specific installed version" do + step "Ensure hold should lock to specific installed version" do existing_installed_version = on(agent.name, "dpkg -s #{package} | sed -n -e 's/Version: //p'").stdout existing_installed_version.delete!(' ') - package_manifest_held = resource_manifest('package', package, mark: "hold") - apply_manifest_on(agent, package_manifest_held) do + package_manifest_hold = resource_manifest('package', package, mark: "hold") + apply_manifest_on(agent, package_manifest_hold) do installed_version = on(agent.name, "apt-cache policy #{package} | sed -n -e 's/Installed: //p'").stdout installed_version.delete!(' ') assert_match(existing_installed_version, installed_version) diff --git a/acceptance/tests/resource/package/ips/should_be_holdable.rb b/acceptance/tests/resource/package/ips/should_be_holdable.rb index 71813040fe8..02600f03292 100644 --- a/acceptance/tests/resource/package/ips/should_be_holdable.rb +++ b/acceptance/tests/resource/package/ips/should_be_holdable.rb @@ -53,8 +53,8 @@ assert_match( /mypkg2@0.0.2/, result.stdout, "err: #{agent}") end - step "IPS: it should not upgrade current and dependent package if dependent package is held" - apply_manifest_on(agent, 'package {mypkg : ensure=>"held", provider=>"pkg"}') do + step "IPS: it should not upgrade current and dependent package if dependent package is hold" + apply_manifest_on(agent, 'package {mypkg : ensure=>"present", mark=>"hold", provider=>"pkg"}') do assert_match( //, result.stdout, "err: #{agent}") end setup_fakeroot agent diff --git a/lib/puppet/provider/package/dpkg.rb b/lib/puppet/provider/package/dpkg.rb index ddf65da0259..f7324230df1 100644 --- a/lib/puppet/provider/package/dpkg.rb +++ b/lib/puppet/provider/package/dpkg.rb @@ -173,14 +173,10 @@ def purge dpkg "--purge", @resource[:name] end - def deprecated_hold + def hold if package_not_installed? self.install end - hold - end - - def hold Tempfile.open('puppet_dpkg_set_selection') do |tmpfile| tmpfile.write("#{@resource[:name]} hold\n") tmpfile.flush diff --git a/lib/puppet/provider/package/pkg.rb b/lib/puppet/provider/package/pkg.rb index 166ea1821c2..c6777ce5d25 100644 --- a/lib/puppet/provider/package/pkg.rb +++ b/lib/puppet/provider/package/pkg.rb @@ -114,10 +114,6 @@ def self.parse_line(line) end).merge({:provider => self.name}) end - def deprecated_hold - hold - end - def hold pkg(:freeze, @resource[:name]) end diff --git a/lib/puppet/provider/package/portage.rb b/lib/puppet/provider/package/portage.rb index 0db81808c62..3f463beeda3 100644 --- a/lib/puppet/provider/package/portage.rb +++ b/lib/puppet/provider/package/portage.rb @@ -112,7 +112,7 @@ def qatom # do the search should = @resource[:ensure] case should - # The terms present, absent, purged, held, installed, latest in :ensure + # The terms present, absent, purged, installed, latest in :ensure # resolve as Symbols, and we do not need specific package version in this case when true, false, Symbol search = @resource[:name] diff --git a/lib/puppet/type/package.rb b/lib/puppet/type/package.rb index 230a4dac295..d722daeb0bc 100644 --- a/lib/puppet/type/package.rb +++ b/lib/puppet/type/package.rb @@ -106,10 +106,6 @@ module Puppet provider.purge end - newvalue(:held, :event => :package_held, :required_features => :holdable) do - provider.deprecated_hold - end - newvalue(:disabled, :required_features => :disableable) do provider.disable end @@ -161,7 +157,7 @@ def insync?(is) @should.each { |should| case should when :present - return true unless [:absent, :purged, :held, :disabled].include?(is) + return true unless [:absent, :purged, :disabled].include?(is) when :latest # Short-circuit packages that are not present return false if is == :absent || is == :purged @@ -657,8 +653,7 @@ def refresh if provider.reinstallable? && @parameters[:reinstall_on_refresh].value == :true && @parameters[:ensure].value != :purged && - @parameters[:ensure].value != :absent && - @parameters[:ensure].value != :held + @parameters[:ensure].value != :absent provider.reinstall end @@ -673,7 +668,7 @@ def refresh Default is "none". Mark can be specified with or without `ensure`, if `ensure` is missing will default to "present". - Mark cannot be specified together with "purged", "absent" or "held" + Mark cannot be specified together with "purged", or "absent" values for `ensure`. EOT newvalues(:hold, :none) @@ -710,11 +705,8 @@ def sync end validate do - if :held == @parameters[:ensure].should - warning '"ensure=>held" has been deprecated and will be removed in a future version, use "mark=hold" instead' - end - if @parameters[:mark] && [:absent, :purged, :held].include?(@parameters[:ensure].should) - raise ArgumentError, _('You cannot use "mark" property while "ensure" is one of ["absent", "purged", "held"]') + if @parameters[:mark] && [:absent, :purged].include?(@parameters[:ensure].should) + raise ArgumentError, _('You cannot use "mark" property while "ensure" is one of ["absent", "purged"]') end end end diff --git a/spec/unit/provider/package/dpkg_spec.rb b/spec/unit/provider/package/dpkg_spec.rb index 28fb0aa5ce5..d3fcc8f6e0e 100644 --- a/spec/unit/provider/package/dpkg_spec.rb +++ b/spec/unit/provider/package/dpkg_spec.rb @@ -381,24 +381,21 @@ def parser_test(dpkg_output_string, gold_hash, number_of_debug_logs = 0) allow(provider).to receive(:execute) allow(provider).to receive(:package_not_installed?).and_return(true) expect(provider).to receive(:install).once - expect(provider).to receive(:hold) - provider.deprecated_hold + provider.hold end - it "skips install new package if hold is true" do + it "install new package if hold is true and package not installed" do allow(provider).to receive(:execute) allow(provider).to receive(:package_not_installed?).and_return(true) expect(provider).to receive(:install).once - expect(provider).to receive(:hold) - provider.deprecated_hold + provider.hold end it "skips install new package if package is allready installed" do allow(provider).to receive(:execute) allow(provider).to receive(:package_not_installed?).and_return(false) expect(provider).not_to receive(:install) - expect(provider).to receive(:hold) - provider.deprecated_hold + provider.hold end it "executes dpkg --set-selections when holding" do diff --git a/spec/unit/type/package_spec.rb b/spec/unit/type/package_spec.rb index 6fe0d7e68b3..346b9411f74 100644 --- a/spec/unit/type/package_spec.rb +++ b/spec/unit/type/package_spec.rb @@ -349,7 +349,7 @@ def setprops(properties) end end - [:purged, :absent, :held].each do |state| + [:purged, :absent].each do |state| it "should not reinstall if it should be #{state.to_s} and reinstall_on_refresh is true" do @package[:ensure] = state allow(@provider).to receive(:reinstallable?).and_return(true) From 5a55bbb2a855b3d6fc9707570ad5fb92c4be8da3 Mon Sep 17 00:00:00 2001 From: Dorin Pleava Date: Tue, 18 Aug 2020 15:42:29 +0300 Subject: [PATCH 077/731] (PUP-10597) Also removed package_not_installed? As provider.hold does not install packages, method package_not_installed? is no longer needed. Also removed package_not_installed? tests and tests that expect provider.hold to call provider.install --- lib/puppet/provider/package/dpkg.rb | 6 ---- spec/unit/provider/package/dpkg_spec.rb | 45 ------------------------- 2 files changed, 51 deletions(-) diff --git a/lib/puppet/provider/package/dpkg.rb b/lib/puppet/provider/package/dpkg.rb index f7324230df1..9e400ec0311 100644 --- a/lib/puppet/provider/package/dpkg.rb +++ b/lib/puppet/provider/package/dpkg.rb @@ -174,9 +174,6 @@ def purge end def hold - if package_not_installed? - self.install - end Tempfile.open('puppet_dpkg_set_selection') do |tmpfile| tmpfile.write("#{@resource[:name]} hold\n") tmpfile.flush @@ -192,7 +189,4 @@ def unhold end end - def package_not_installed? - query[:status] != "installed" - end end diff --git a/spec/unit/provider/package/dpkg_spec.rb b/spec/unit/provider/package/dpkg_spec.rb index d3fcc8f6e0e..00ce03ffec6 100644 --- a/spec/unit/provider/package/dpkg_spec.rb +++ b/spec/unit/provider/package/dpkg_spec.rb @@ -377,36 +377,13 @@ def parser_test(dpkg_output_string, gold_hash, number_of_debug_logs = 0) allow(Tempfile).to receive(:open).and_yield(tempfile) end - it "installs first if package is not present and ensure holding" do - allow(provider).to receive(:execute) - allow(provider).to receive(:package_not_installed?).and_return(true) - expect(provider).to receive(:install).once - provider.hold - end - - it "install new package if hold is true and package not installed" do - allow(provider).to receive(:execute) - allow(provider).to receive(:package_not_installed?).and_return(true) - expect(provider).to receive(:install).once - provider.hold - end - - it "skips install new package if package is allready installed" do - allow(provider).to receive(:execute) - allow(provider).to receive(:package_not_installed?).and_return(false) - expect(provider).not_to receive(:install) - provider.hold - end - it "executes dpkg --set-selections when holding" do - allow(provider).to receive(:package_not_installed?).and_return(false) allow(provider).to receive(:install) expect(provider).to receive(:execute).with([:dpkg, '--set-selections'], {:failonfail => false, :combine => false, :stdinfile => tempfile.path}).once provider.hold end it "executes dpkg --set-selections when unholding" do - allow(provider).to receive(:package_not_installed?).and_return(false) allow(provider).to receive(:install) expect(provider).to receive(:execute).with([:dpkg, '--set-selections'], {:failonfail => false, :combine => false, :stdinfile => tempfile.path}).once provider.hold @@ -449,26 +426,4 @@ def parser_test(dpkg_output_string, gold_hash, number_of_debug_logs = 0) provider.purge end - context "package_not_installed?" do - context "allow_virtual false" do - before do - allow(resource).to receive(:allow_virtual?).and_return(false) - end - - it "returns true if package is not found" do - expect(provider).to receive(:dpkgquery).with("-W", "--showformat", "'${Status} ${Package} ${Version}\\n'", resource_name).and_raise(Puppet::ExecutionFailure.new("eh")) - expect(provider.package_not_installed?).to eq(true) - end - - it "returns true if package is not installed" do - expect(provider).to receive(:dpkgquery).with("-W", "--showformat", "'${Status} ${Package} ${Version}\\n'", resource_name).and_return("unknown ok not-installed #{resource_name}") - expect(provider.package_not_installed?).to eq(true) - end - - it "returns false if package is installed" do - expect(provider).to receive(:dpkgquery).with("-W", "--showformat", "'${Status} ${Package} ${Version}\\n'", resource_name).and_return("install ok installed resource_name 1.2.3") - expect(provider.package_not_installed?).to eq(false) - end - end - end end From 6dbb4319d8a191caf230a30bfdc1530fd74bd309 Mon Sep 17 00:00:00 2001 From: Dorin Pleava Date: Fri, 14 Aug 2020 14:55:42 +0300 Subject: [PATCH 078/731] (PUP-10606) Extract FFI from util/windows Move FFI related functions, constants and structures out from Puppet::Util::Windows, as loading Puppet::Util::Windows is extremely expensive. --- lib/puppet/ffi.rb | 2 + lib/puppet/ffi/windows.rb | 6 + lib/puppet/ffi/windows/constants.rb | 404 ++++++++++ lib/puppet/ffi/windows/functions.rb | 628 ++++++++++++++++ lib/puppet/ffi/windows/structs.rb | 338 +++++++++ lib/puppet/settings/priority_setting.rb | 9 +- lib/puppet/util/windows.rb | 1 + lib/puppet/util/windows/file.rb | 376 +--------- .../util/windows/monkey_patches/process.rb | 226 +----- lib/puppet/util/windows/process.rb | 270 +------ lib/puppet/util/windows/service.rb | 701 +++++------------- spec/unit/settings/priority_setting_spec.rb | 8 +- 12 files changed, 1604 insertions(+), 1365 deletions(-) create mode 100644 lib/puppet/ffi.rb create mode 100644 lib/puppet/ffi/windows.rb create mode 100644 lib/puppet/ffi/windows/constants.rb create mode 100644 lib/puppet/ffi/windows/functions.rb create mode 100644 lib/puppet/ffi/windows/structs.rb diff --git a/lib/puppet/ffi.rb b/lib/puppet/ffi.rb new file mode 100644 index 00000000000..dbfaa696d60 --- /dev/null +++ b/lib/puppet/ffi.rb @@ -0,0 +1,2 @@ +module Puppet::FFI +end diff --git a/lib/puppet/ffi/windows.rb b/lib/puppet/ffi/windows.rb new file mode 100644 index 00000000000..84f929e7a3e --- /dev/null +++ b/lib/puppet/ffi/windows.rb @@ -0,0 +1,6 @@ +require 'puppet/ffi' +module Puppet::FFI::Windows + require 'puppet/ffi/windows/structs' + require 'puppet/ffi/windows/functions' + require 'puppet/ffi/windows/constants' +end diff --git a/lib/puppet/ffi/windows/constants.rb b/lib/puppet/ffi/windows/constants.rb new file mode 100644 index 00000000000..f03009b22d3 --- /dev/null +++ b/lib/puppet/ffi/windows/constants.rb @@ -0,0 +1,404 @@ +require 'ffi' + +module Puppet::FFI::Windows + module Constants + extend FFI::Library + + FILE_ATTRIBUTE_READONLY = 0x00000001 + FILE_ATTRIBUTE_DIRECTORY = 0x00000010 + + # https://msdn.microsoft.com/en-us/library/windows/desktop/aa379607(v=vs.85).aspx + # The right to use the object for synchronization. This enables a thread to + # wait until the object is in the signaled state. Some object types do not + # support this access right. + SYNCHRONIZE = 0x100000 + # The right to delete the object. + DELETE = 0x00010000 + # The right to read the information in the object's security descriptor, not including the information in the system access control list (SACL). + # READ_CONTROL = 0x00020000 + # The right to modify the discretionary access control list (DACL) in the object's security descriptor. + WRITE_DAC = 0x00040000 + # The right to change the owner in the object's security descriptor. + WRITE_OWNER = 0x00080000 + + # Combines DELETE, READ_CONTROL, WRITE_DAC, and WRITE_OWNER access. + STANDARD_RIGHTS_REQUIRED = 0xf0000 + # Currently defined to equal READ_CONTROL. + STANDARD_RIGHTS_READ = 0x20000 + # Currently defined to equal READ_CONTROL. + STANDARD_RIGHTS_WRITE = 0x20000 + # Currently defined to equal READ_CONTROL. + STANDARD_RIGHTS_EXECUTE = 0x20000 + # Combines DELETE, READ_CONTROL, WRITE_DAC, WRITE_OWNER, and SYNCHRONIZE access. + STANDARD_RIGHTS_ALL = 0x1F0000 + SPECIFIC_RIGHTS_ALL = 0xFFFF + + FILE_READ_DATA = 1 + FILE_WRITE_DATA = 2 + FILE_APPEND_DATA = 4 + FILE_READ_EA = 8 + FILE_WRITE_EA = 16 + FILE_EXECUTE = 32 + FILE_DELETE_CHILD = 64 + FILE_READ_ATTRIBUTES = 128 + FILE_WRITE_ATTRIBUTES = 256 + + FILE_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x1FF + + FILE_GENERIC_READ = + STANDARD_RIGHTS_READ | + FILE_READ_DATA | + FILE_READ_ATTRIBUTES | + FILE_READ_EA | + SYNCHRONIZE + + FILE_GENERIC_WRITE = + STANDARD_RIGHTS_WRITE | + FILE_WRITE_DATA | + FILE_WRITE_ATTRIBUTES | + FILE_WRITE_EA | + FILE_APPEND_DATA | + SYNCHRONIZE + + FILE_GENERIC_EXECUTE = + STANDARD_RIGHTS_EXECUTE | + FILE_READ_ATTRIBUTES | + FILE_EXECUTE | + SYNCHRONIZE + + REPLACEFILE_WRITE_THROUGH = 0x1 + REPLACEFILE_IGNORE_MERGE_ERRORS = 0x2 + REPLACEFILE_IGNORE_ACL_ERRORS = 0x3 + + INVALID_FILE_ATTRIBUTES = 0xFFFFFFFF #define INVALID_FILE_ATTRIBUTES (DWORD (-1)) + + IO_REPARSE_TAG_MOUNT_POINT = 0xA0000003 + IO_REPARSE_TAG_HSM = 0xC0000004 + IO_REPARSE_TAG_HSM2 = 0x80000006 + IO_REPARSE_TAG_SIS = 0x80000007 + IO_REPARSE_TAG_WIM = 0x80000008 + IO_REPARSE_TAG_CSV = 0x80000009 + IO_REPARSE_TAG_DFS = 0x8000000A + IO_REPARSE_TAG_SYMLINK = 0xA000000C + IO_REPARSE_TAG_DFSR = 0x80000012 + IO_REPARSE_TAG_DEDUP = 0x80000013 + IO_REPARSE_TAG_NFS = 0x80000014 + + FILE_ATTRIBUTE_REPARSE_POINT = 0x400 + + GENERIC_READ = 0x80000000 + GENERIC_WRITE = 0x40000000 + GENERIC_EXECUTE = 0x20000000 + GENERIC_ALL = 0x10000000 + METHOD_BUFFERED = 0 + FILE_SHARE_READ = 1 + FILE_SHARE_WRITE = 2 + OPEN_EXISTING = 3 + FILE_DEVICE_FILE_SYSTEM = 0x00000009 + FILE_FLAG_OPEN_REPARSE_POINT = 0x00200000 + FILE_FLAG_BACKUP_SEMANTICS = 0x02000000 + SHGFI_DISPLAYNAME = 0x000000200 + SHGFI_PIDL = 0x000000008 + + ERROR_FILE_NOT_FOUND = 2 + ERROR_PATH_NOT_FOUND = 3 + ERROR_ALREADY_EXISTS = 183 + + # https://msdn.microsoft.com/en-us/library/windows/desktop/aa364571(v=vs.85).aspx + FSCTL_GET_REPARSE_POINT = 0x900a8 + + MAXIMUM_REPARSE_DATA_BUFFER_SIZE = 16384 + + # Priority constants + # https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-setpriorityclass + ABOVE_NORMAL_PRIORITY_CLASS = 0x0008000 + BELOW_NORMAL_PRIORITY_CLASS = 0x0004000 + HIGH_PRIORITY_CLASS = 0x0000080 + IDLE_PRIORITY_CLASS = 0x0000040 + NORMAL_PRIORITY_CLASS = 0x0000020 + REALTIME_PRIORITY_CLASS = 0x0000010 + + # Process Access Rights + # https://docs.microsoft.com/en-us/windows/win32/procthread/process-security-and-access-rights + PROCESS_TERMINATE = 0x00000001 + PROCESS_SET_INFORMATION = 0x00000200 + PROCESS_QUERY_INFORMATION = 0x00000400 + PROCESS_ALL_ACCESS = 0x001F0FFF + PROCESS_VM_READ = 0x00000010 + + # Process creation flags + # https://docs.microsoft.com/en-us/windows/win32/procthread/process-creation-flags + CREATE_BREAKAWAY_FROM_JOB = 0x01000000 + CREATE_DEFAULT_ERROR_MODE = 0x04000000 + CREATE_NEW_CONSOLE = 0x00000010 + CREATE_NEW_PROCESS_GROUP = 0x00000200 + CREATE_NO_WINDOW = 0x08000000 + CREATE_PROTECTED_PROCESS = 0x00040000 + CREATE_PRESERVE_CODE_AUTHZ_LEVEL = 0x02000000 + CREATE_SEPARATE_WOW_VDM = 0x00000800 + CREATE_SHARED_WOW_VDM = 0x00001000 + CREATE_SUSPENDED = 0x00000004 + CREATE_UNICODE_ENVIRONMENT = 0x00000400 + DEBUG_ONLY_THIS_PROCESS = 0x00000002 + DEBUG_PROCESS = 0x00000001 + DETACHED_PROCESS = 0x00000008 + INHERIT_PARENT_AFFINITY = 0x00010000 + + # Logon options + LOGON_WITH_PROFILE = 0x00000001 + + # STARTUPINFOA constants + # https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/ns-processthreadsapi-startupinfoa + STARTF_USESTDHANDLES = 0x00000100 + + # Miscellaneous + HANDLE_FLAG_INHERIT = 0x00000001 + SEM_FAILCRITICALERRORS = 0x00000001 + SEM_NOGPFAULTERRORBOX = 0x00000002 + + # Error constants + INVALID_HANDLE_VALUE = FFI::Pointer.new(-1).address + + # https://msdn.microsoft.com/en-us/library/windows/desktop/aa379626(v=vs.85).aspx + TOKEN_INFORMATION_CLASS = enum( + :TokenUser, 1, + :TokenGroups, + :TokenPrivileges, + :TokenOwner, + :TokenPrimaryGroup, + :TokenDefaultDacl, + :TokenSource, + :TokenType, + :TokenImpersonationLevel, + :TokenStatistics, + :TokenRestrictedSids, + :TokenSessionId, + :TokenGroupsAndPrivileges, + :TokenSessionReference, + :TokenSandBoxInert, + :TokenAuditPolicy, + :TokenOrigin, + :TokenElevationType, + :TokenLinkedToken, + :TokenElevation, + :TokenHasRestrictions, + :TokenAccessInformation, + :TokenVirtualizationAllowed, + :TokenVirtualizationEnabled, + :TokenIntegrityLevel, + :TokenUIAccess, + :TokenMandatoryPolicy, + :TokenLogonSid, + :TokenIsAppContainer, + :TokenCapabilities, + :TokenAppContainerSid, + :TokenAppContainerNumber, + :TokenUserClaimAttributes, + :TokenDeviceClaimAttributes, + :TokenRestrictedUserClaimAttributes, + :TokenRestrictedDeviceClaimAttributes, + :TokenDeviceGroups, + :TokenRestrictedDeviceGroups, + :TokenSecurityAttributes, + :TokenIsRestricted, + :MaxTokenInfoClass + ) + + # Service error codes + # https://docs.microsoft.com/en-us/windows/desktop/debug/system-error-codes--1000-1299- + ERROR_SERVICE_DOES_NOT_EXIST = 0x00000424 + + # Service control codes + # https://docs.microsoft.com/en-us/windows/desktop/api/Winsvc/nf-winsvc-controlserviceexw + SERVICE_CONTROL_STOP = 0x00000001 + SERVICE_CONTROL_PAUSE = 0x00000002 + SERVICE_CONTROL_CONTINUE = 0x00000003 + SERVICE_CONTROL_INTERROGATE = 0x00000004 + SERVICE_CONTROL_SHUTDOWN = 0x00000005 + SERVICE_CONTROL_PARAMCHANGE = 0x00000006 + SERVICE_CONTROL_NETBINDADD = 0x00000007 + SERVICE_CONTROL_NETBINDREMOVE = 0x00000008 + SERVICE_CONTROL_NETBINDENABLE = 0x00000009 + SERVICE_CONTROL_NETBINDDISABLE = 0x0000000A + SERVICE_CONTROL_DEVICEEVENT = 0x0000000B + SERVICE_CONTROL_HARDWAREPROFILECHANGE = 0x0000000C + SERVICE_CONTROL_POWEREVENT = 0x0000000D + SERVICE_CONTROL_SESSIONCHANGE = 0x0000000E + SERVICE_CONTROL_PRESHUTDOWN = 0x0000000F + SERVICE_CONTROL_TIMECHANGE = 0x00000010 + SERVICE_CONTROL_TRIGGEREVENT = 0x00000020 + SERVICE_CONTROL_SIGNALS = { + SERVICE_CONTROL_STOP => :SERVICE_CONTROL_STOP, + SERVICE_CONTROL_PAUSE => :SERVICE_CONTROL_PAUSE, + SERVICE_CONTROL_CONTINUE => :SERVICE_CONTROL_CONTINUE, + SERVICE_CONTROL_INTERROGATE => :SERVICE_CONTROL_INTERROGATE, + SERVICE_CONTROL_SHUTDOWN => :SERVICE_CONTROL_SHUTDOWN, + SERVICE_CONTROL_PARAMCHANGE => :SERVICE_CONTROL_PARAMCHANGE, + SERVICE_CONTROL_NETBINDADD => :SERVICE_CONTROL_NETBINDADD, + SERVICE_CONTROL_NETBINDREMOVE => :SERVICE_CONTROL_NETBINDREMOVE, + SERVICE_CONTROL_NETBINDENABLE => :SERVICE_CONTROL_NETBINDENABLE, + SERVICE_CONTROL_NETBINDDISABLE => :SERVICE_CONTROL_NETBINDDISABLE, + SERVICE_CONTROL_DEVICEEVENT => :SERVICE_CONTROL_DEVICEEVENT, + SERVICE_CONTROL_HARDWAREPROFILECHANGE => :SERVICE_CONTROL_HARDWAREPROFILECHANGE, + SERVICE_CONTROL_POWEREVENT => :SERVICE_CONTROL_POWEREVENT, + SERVICE_CONTROL_SESSIONCHANGE => :SERVICE_CONTROL_SESSIONCHANGE, + SERVICE_CONTROL_PRESHUTDOWN => :SERVICE_CONTROL_PRESHUTDOWN, + SERVICE_CONTROL_TIMECHANGE => :SERVICE_CONTROL_TIMECHANGE, + SERVICE_CONTROL_TRIGGEREVENT => :SERVICE_CONTROL_TRIGGEREVENT + } + + # Service start type codes + # https://docs.microsoft.com/en-us/windows/desktop/api/Winsvc/nf-winsvc-changeserviceconfigw + SERVICE_AUTO_START = 0x00000002 + SERVICE_BOOT_START = 0x00000000 + SERVICE_DEMAND_START = 0x00000003 + SERVICE_DISABLED = 0x00000004 + SERVICE_SYSTEM_START = 0x00000001 + SERVICE_START_TYPES = { + SERVICE_AUTO_START => :SERVICE_AUTO_START, + SERVICE_BOOT_START => :SERVICE_BOOT_START, + SERVICE_DEMAND_START => :SERVICE_DEMAND_START, + SERVICE_DISABLED => :SERVICE_DISABLED, + SERVICE_SYSTEM_START => :SERVICE_SYSTEM_START, + } + + # Service type codes + # https://docs.microsoft.com/en-us/windows/desktop/api/Winsvc/nf-winsvc-changeserviceconfigw + SERVICE_FILE_SYSTEM_DRIVER = 0x00000002 + SERVICE_KERNEL_DRIVER = 0x00000001 + SERVICE_WIN32_OWN_PROCESS = 0x00000010 + SERVICE_WIN32_SHARE_PROCESS = 0x00000020 + SERVICE_USER_OWN_PROCESS = 0x00000050 + SERVICE_USER_SHARE_PROCESS = 0x00000060 + # Available only if service is also SERVICE_WIN32_OWN_PROCESS or SERVICE_WIN32_SHARE_PROCESS + SERVICE_INTERACTIVE_PROCESS = 0x00000100 + ALL_SERVICE_TYPES = + SERVICE_FILE_SYSTEM_DRIVER | + SERVICE_KERNEL_DRIVER | + SERVICE_WIN32_OWN_PROCESS | + SERVICE_WIN32_SHARE_PROCESS + + # Current state codes + # https://docs.microsoft.com/en-us/windows/desktop/api/winsvc/ns-winsvc-_service_status_process + SERVICE_CONTINUE_PENDING = 0x00000005 + SERVICE_PAUSE_PENDING = 0x00000006 + SERVICE_PAUSED = 0x00000007 + SERVICE_RUNNING = 0x00000004 + SERVICE_START_PENDING = 0x00000002 + SERVICE_STOP_PENDING = 0x00000003 + SERVICE_STOPPED = 0x00000001 + UNSAFE_PENDING_STATES = [SERVICE_START_PENDING, SERVICE_STOP_PENDING] + FINAL_STATES = { + SERVICE_CONTINUE_PENDING => SERVICE_RUNNING, + SERVICE_PAUSE_PENDING => SERVICE_PAUSED, + SERVICE_START_PENDING => SERVICE_RUNNING, + SERVICE_STOP_PENDING => SERVICE_STOPPED + } + SERVICE_STATES = { + SERVICE_CONTINUE_PENDING => :SERVICE_CONTINUE_PENDING, + SERVICE_PAUSE_PENDING => :SERVICE_PAUSE_PENDING, + SERVICE_PAUSED => :SERVICE_PAUSED, + SERVICE_RUNNING => :SERVICE_RUNNING, + SERVICE_START_PENDING => :SERVICE_START_PENDING, + SERVICE_STOP_PENDING => :SERVICE_STOP_PENDING, + SERVICE_STOPPED => :SERVICE_STOPPED, + } + + # Service accepts control codes + # https://docs.microsoft.com/en-us/windows/desktop/api/winsvc/ns-winsvc-_service_status_process + SERVICE_ACCEPT_STOP = 0x00000001 + SERVICE_ACCEPT_PAUSE_CONTINUE = 0x00000002 + SERVICE_ACCEPT_SHUTDOWN = 0x00000004 + SERVICE_ACCEPT_PARAMCHANGE = 0x00000008 + SERVICE_ACCEPT_NETBINDCHANGE = 0x00000010 + SERVICE_ACCEPT_HARDWAREPROFILECHANGE = 0x00000020 + SERVICE_ACCEPT_POWEREVENT = 0x00000040 + SERVICE_ACCEPT_SESSIONCHANGE = 0x00000080 + SERVICE_ACCEPT_PRESHUTDOWN = 0x00000100 + SERVICE_ACCEPT_TIMECHANGE = 0x00000200 + SERVICE_ACCEPT_TRIGGEREVENT = 0x00000400 + SERVICE_ACCEPT_USER_LOGOFF = 0x00000800 + + # Service manager access codes + # https://docs.microsoft.com/en-us/windows/desktop/Services/service-security-and-access-rights + SC_MANAGER_CREATE_SERVICE = 0x00000002 + SC_MANAGER_CONNECT = 0x00000001 + SC_MANAGER_ENUMERATE_SERVICE = 0x00000004 + SC_MANAGER_LOCK = 0x00000008 + SC_MANAGER_MODIFY_BOOT_CONFIG = 0x00000020 + SC_MANAGER_QUERY_LOCK_STATUS = 0x00000010 + SC_MANAGER_ALL_ACCESS = + STANDARD_RIGHTS_REQUIRED | + SC_MANAGER_CREATE_SERVICE | + SC_MANAGER_CONNECT | + SC_MANAGER_ENUMERATE_SERVICE | + SC_MANAGER_LOCK | + SC_MANAGER_MODIFY_BOOT_CONFIG | + SC_MANAGER_QUERY_LOCK_STATUS + + # Service access codes + # https://docs.microsoft.com/en-us/windows/desktop/Services/service-security-and-access-rights + SERVICE_CHANGE_CONFIG = 0x0002 + SERVICE_ENUMERATE_DEPENDENTS = 0x0008 + SERVICE_INTERROGATE = 0x0080 + SERVICE_PAUSE_CONTINUE = 0x0040 + SERVICE_QUERY_STATUS = 0x0004 + SERVICE_QUERY_CONFIG = 0x0001 + SERVICE_START = 0x0010 + SERVICE_STOP = 0x0020 + SERVICE_USER_DEFINED_CONTROL = 0x0100 + SERVICE_ALL_ACCESS = + STANDARD_RIGHTS_REQUIRED | + SERVICE_CHANGE_CONFIG | + SERVICE_ENUMERATE_DEPENDENTS | + SERVICE_INTERROGATE | + SERVICE_PAUSE_CONTINUE | + SERVICE_QUERY_STATUS | + SERVICE_QUERY_CONFIG | + SERVICE_START | + SERVICE_STOP | + SERVICE_USER_DEFINED_CONTROL + + # Service config codes + # From the windows 10 SDK: + # // + # // Value to indicate no change to an optional parameter + # // + # #define SERVICE_NO_CHANGE 0xffffffff + # https://docs.microsoft.com/en-us/windows/win32/api/winsvc/nf-winsvc-changeserviceconfig2w + SERVICE_CONFIG_DESCRIPTION = 0x00000001 + SERVICE_CONFIG_FAILURE_ACTIONS = 0x00000002 + SERVICE_CONFIG_DELAYED_AUTO_START_INFO = 0x00000003 + SERVICE_CONFIG_FAILURE_ACTIONS_FLAG = 0x00000004 + SERVICE_CONFIG_SERVICE_SID_INFO = 0x00000005 + SERVICE_CONFIG_REQUIRED_PRIVILEGES_INFO = 0x00000006 + SERVICE_CONFIG_PRESHUTDOWN_INFO = 0x00000007 + SERVICE_CONFIG_TRIGGER_INFO = 0x00000008 + SERVICE_CONFIG_PREFERRED_NODE = 0x00000009 + SERVICE_CONFIG_LAUNCH_PROTECTED = 0x00000012 + SERVICE_NO_CHANGE = 0xffffffff + SERVICE_CONFIG_TYPES = { + SERVICE_CONFIG_DESCRIPTION => :SERVICE_CONFIG_DESCRIPTION, + SERVICE_CONFIG_FAILURE_ACTIONS => :SERVICE_CONFIG_FAILURE_ACTIONS, + SERVICE_CONFIG_DELAYED_AUTO_START_INFO => :SERVICE_CONFIG_DELAYED_AUTO_START_INFO, + SERVICE_CONFIG_FAILURE_ACTIONS_FLAG => :SERVICE_CONFIG_FAILURE_ACTIONS_FLAG, + SERVICE_CONFIG_SERVICE_SID_INFO => :SERVICE_CONFIG_SERVICE_SID_INFO, + SERVICE_CONFIG_REQUIRED_PRIVILEGES_INFO => :SERVICE_CONFIG_REQUIRED_PRIVILEGES_INFO, + SERVICE_CONFIG_PRESHUTDOWN_INFO => :SERVICE_CONFIG_PRESHUTDOWN_INFO, + SERVICE_CONFIG_TRIGGER_INFO => :SERVICE_CONFIG_TRIGGER_INFO, + SERVICE_CONFIG_PREFERRED_NODE => :SERVICE_CONFIG_PREFERRED_NODE, + SERVICE_CONFIG_LAUNCH_PROTECTED => :SERVICE_CONFIG_LAUNCH_PROTECTED, + } + + # Service enum codes + # https://docs.microsoft.com/en-us/windows/desktop/api/winsvc/nf-winsvc-enumservicesstatusexa + SERVICE_ACTIVE = 0x00000001 + SERVICE_INACTIVE = 0x00000002 + SERVICE_STATE_ALL = + SERVICE_ACTIVE | + SERVICE_INACTIVE + + # https://docs.microsoft.com/en-us/windows/desktop/api/winsvc/ns-winsvc-_enum_service_status_processw + SERVICENAME_MAX = 256 + end +end \ No newline at end of file diff --git a/lib/puppet/ffi/windows/functions.rb b/lib/puppet/ffi/windows/functions.rb new file mode 100644 index 00000000000..851934a44d8 --- /dev/null +++ b/lib/puppet/ffi/windows/functions.rb @@ -0,0 +1,628 @@ +require 'puppet/ffi/windows/constants' + +module Puppet::FFI::Windows + module Functions + + extend FFI::Library + include Puppet::FFI::Windows::Constants + + ffi_convention :stdcall + + # https://docs.microsoft.com/en-us/windows/win32/api/handleapi/nf-handleapi-sethandleinformation + # BOOL SetHandleInformation( + # HANDLE hObject, + # DWORD dwMask, + # DWORD dwFlags + # ); + ffi_lib :kernel32 + attach_function_private :SetHandleInformation, [:handle, :dword, :dword], :win32_bool + + # https://docs.microsoft.com/en-us/windows/win32/api/errhandlingapi/nf-errhandlingapi-seterrormode + # UINT SetErrorMode( + # UINT uMode + # ); + ffi_lib :kernel32 + attach_function_private :SetErrorMode, [:uint], :uint + + # https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-createprocessw + # BOOL CreateProcessW( + # LPCWSTR lpApplicationName, + # LPWSTR lpCommandLine, + # LPSECURITY_ATTRIBUTES lpProcessAttributes, + # LPSECURITY_ATTRIBUTES lpThreadAttributes, + # BOOL bInheritHandles, + # DWORD dwCreationFlags, + # LPVOID lpEnvironment, + # LPCWSTR lpCurrentDirectory, + # LPSTARTUPINFOW lpStartupInfo, + # LPPROCESS_INFORMATION lpProcessInformation + # ); + ffi_lib :kernel32 + attach_function_private :CreateProcessW, + [:lpcwstr, :lpwstr, :pointer, :pointer, :win32_bool, + :dword, :lpvoid, :lpcwstr, :pointer, :pointer], :bool + + # https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-openprocess + # HANDLE OpenProcess( + # DWORD dwDesiredAccess, + # BOOL bInheritHandle, + # DWORD dwProcessId + # ); + ffi_lib :kernel32 + attach_function_private :OpenProcess, [:dword, :win32_bool, :dword], :handle + + # https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-setpriorityclass + # BOOL SetPriorityClass( + # HANDLE hProcess, + # DWORD dwPriorityClass + # ); + ffi_lib :kernel32 + attach_function_private :SetPriorityClass, [:handle, :dword], :win32_bool + + # https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-createprocesswithlogonw + # BOOL CreateProcessWithLogonW( + # LPCWSTR lpUsername, + # LPCWSTR lpDomain, + # LPCWSTR lpPassword, + # DWORD dwLogonFlags, + # LPCWSTR lpApplicationName, + # LPWSTR lpCommandLine, + # DWORD dwCreationFlags, + # LPVOID lpEnvironment, + # LPCWSTR lpCurrentDirectory, + # LPSTARTUPINFOW lpStartupInfo, + # LPPROCESS_INFORMATION lpProcessInformation + # ); + ffi_lib :advapi32 + attach_function_private :CreateProcessWithLogonW, + [:lpcwstr, :lpcwstr, :lpcwstr, :dword, :lpcwstr, :lpwstr, + :dword, :lpvoid, :lpcwstr, :pointer, :pointer], :bool + + # https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/get-osfhandle?view=vs-2019 + # intptr_t _get_osfhandle( + # int fd + # ); + ffi_lib FFI::Library::LIBC + attach_function_private :get_osfhandle, :_get_osfhandle, [:int], :intptr_t + + begin + # https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/get-errno?view=vs-2019 + # errno_t _get_errno( + # int * pValue + # ); + attach_function_private :get_errno, :_get_errno, [:pointer], :int + rescue FFI::NotFoundError + # Do nothing, Windows XP or earlier. + end + + # https://msdn.microsoft.com/en-us/library/windows/desktop/ms687032(v=vs.85).aspx + # DWORD WINAPI WaitForSingleObject( + # _In_ HANDLE hHandle, + # _In_ DWORD dwMilliseconds + # ); + ffi_lib :kernel32 + attach_function_private :WaitForSingleObject, + [:handle, :dword], :dword + + # https://docs.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-waitformultipleobjects + # DWORD WaitForMultipleObjects( + # DWORD nCount, + # const HANDLE *lpHandles, + # BOOL bWaitAll, + # DWORD dwMilliseconds + # ); + ffi_lib :kernel32 + attach_function_private :WaitForMultipleObjects, + [:dword, :phandle, :win32_bool, :dword], :dword + + # https://docs.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-createeventw + # HANDLE CreateEventW( + # LPSECURITY_ATTRIBUTES lpEventAttributes, + # BOOL bManualReset, + # BOOL bInitialState, + # LPCWSTR lpName + # ); + ffi_lib :kernel32 + attach_function_private :CreateEventW, + [:pointer, :win32_bool, :win32_bool, :lpcwstr], :handle + + # https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-createthread + # HANDLE CreateThread( + # LPSECURITY_ATTRIBUTES lpThreadAttributes, + # SIZE_T dwStackSize, + # LPTHREAD_START_ROUTINE lpStartAddress, + # __drv_aliasesMem LPVOID lpParameter, + # DWORD dwCreationFlags, + # LPDWORD lpThreadId + # ); + ffi_lib :kernel32 + attach_function_private :CreateThread, + [:pointer, :size_t, :pointer, :lpvoid, :dword, :lpdword], :handle, :blocking => true + + # https://docs.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-setevent + # BOOL SetEvent( + # HANDLE hEvent + # ); + ffi_lib :kernel32 + attach_function_private :SetEvent, + [:handle], :win32_bool + + # https://msdn.microsoft.com/en-us/library/windows/desktop/ms683189(v=vs.85).aspx + # BOOL WINAPI GetExitCodeProcess( + # _In_ HANDLE hProcess, + # _Out_ LPDWORD lpExitCode + # ); + ffi_lib :kernel32 + attach_function_private :GetExitCodeProcess, + [:handle, :lpdword], :win32_bool + + # https://msdn.microsoft.com/en-us/library/windows/desktop/ms683179(v=vs.85).aspx + # HANDLE WINAPI GetCurrentProcess(void); + ffi_lib :kernel32 + attach_function_private :GetCurrentProcess, [], :handle + + # https://msdn.microsoft.com/en-us/library/windows/desktop/ms683187(v=vs.85).aspx + # LPTCH GetEnvironmentStrings(void); + ffi_lib :kernel32 + attach_function_private :GetEnvironmentStringsW, [], :pointer + + # https://msdn.microsoft.com/en-us/library/windows/desktop/ms683151(v=vs.85).aspx + # BOOL FreeEnvironmentStrings( + # _In_ LPTCH lpszEnvironmentBlock + # ); + ffi_lib :kernel32 + attach_function_private :FreeEnvironmentStringsW, + [:pointer], :win32_bool + + # https://msdn.microsoft.com/en-us/library/windows/desktop/ms686206(v=vs.85).aspx + # BOOL WINAPI SetEnvironmentVariableW( + # _In_ LPCTSTR lpName, + # _In_opt_ LPCTSTR lpValue + # ); + ffi_lib :kernel32 + attach_function_private :SetEnvironmentVariableW, + [:lpcwstr, :lpcwstr], :win32_bool + + # https://msdn.microsoft.com/en-us/library/windows/desktop/ms684320(v=vs.85).aspx + # HANDLE WINAPI OpenProcess( + # _In_ DWORD DesiredAccess, + # _In_ BOOL InheritHandle, + # _In_ DWORD ProcessId + # ); + ffi_lib :kernel32 + attach_function_private :OpenProcess, + [:dword, :win32_bool, :dword], :handle + + # https://msdn.microsoft.com/en-us/library/windows/desktop/aa379295(v=vs.85).aspx + # BOOL WINAPI OpenProcessToken( + # _In_ HANDLE ProcessHandle, + # _In_ DWORD DesiredAccess, + # _Out_ PHANDLE TokenHandle + # ); + ffi_lib :advapi32 + attach_function_private :OpenProcessToken, + [:handle, :dword, :phandle], :win32_bool + + # https://docs.microsoft.com/en-us/windows/desktop/api/winbase/nf-winbase-queryfullprocessimagenamew + # BOOL WINAPI QueryFullProcessImageName( + # _In_ HANDLE hProcess, + # _In_ DWORD dwFlags, + # _Out_ LPWSTR lpExeName, + # _In_ PDWORD lpdwSize, + # ); + ffi_lib :kernel32 + attach_function_private :QueryFullProcessImageNameW, + [:handle, :dword, :lpwstr, :pdword], :win32_bool + + # https://msdn.microsoft.com/en-us/library/Windows/desktop/aa379180(v=vs.85).aspx + # BOOL WINAPI LookupPrivilegeValue( + # _In_opt_ LPCTSTR lpSystemName, + # _In_ LPCTSTR lpName, + # _Out_ PLUID lpLuid + # ); + ffi_lib :advapi32 + attach_function_private :LookupPrivilegeValueW, + [:lpcwstr, :lpcwstr, :pointer], :win32_bool + + # https://msdn.microsoft.com/en-us/library/windows/desktop/aa446671(v=vs.85).aspx + # BOOL WINAPI GetTokenInformation( + # _In_ HANDLE TokenHandle, + # _In_ TOKEN_INFORMATION_CLASS TokenInformationClass, + # _Out_opt_ LPVOID TokenInformation, + # _In_ DWORD TokenInformationLength, + # _Out_ PDWORD ReturnLength + # ); + ffi_lib :advapi32 + attach_function_private :GetTokenInformation, + [:handle, TOKEN_INFORMATION_CLASS, :lpvoid, :dword, :pdword ], :win32_bool + + # https://msdn.microsoft.com/en-us/library/windows/desktop/ms724451(v=vs.85).aspx + # BOOL WINAPI GetVersionEx( + # _Inout_ LPOSVERSIONINFO lpVersionInfo + # ); + ffi_lib :kernel32 + attach_function_private :GetVersionExW, + [:pointer], :win32_bool + + # https://msdn.microsoft.com/en-us/library/windows/desktop/dd318123(v=vs.85).aspx + # LANGID GetSystemDefaultUILanguage(void); + ffi_lib :kernel32 + attach_function_private :GetSystemDefaultUILanguage, [], :word + + # https://docs.microsoft.com/en-us/windows/desktop/api/Winsvc/nf-winsvc-openscmanagerw + # SC_HANDLE OpenSCManagerW( + # LPCWSTR lpMachineName, + # LPCWSTR lpDatabaseName, + # DWORD dwDesiredAccess + # ); + ffi_lib :advapi32 + attach_function_private :OpenSCManagerW, + [:lpcwstr, :lpcwstr, :dword], :handle + + # https://docs.microsoft.com/en-us/windows/desktop/api/Winsvc/nf-winsvc-openservicew + # SC_HANDLE OpenServiceW( + # SC_HANDLE hSCManager, + # LPCWSTR lpServiceName, + # DWORD dwDesiredAccess + # ); + ffi_lib :advapi32 + attach_function_private :OpenServiceW, + [:handle, :lpcwstr, :dword], :handle + + # https://docs.microsoft.com/en-us/windows/desktop/api/Winsvc/nf-winsvc-closeservicehandle + # BOOL CloseServiceHandle( + # SC_HANDLE hSCObject + # ); + ffi_lib :advapi32 + attach_function_private :CloseServiceHandle, + [:handle], :win32_bool + + # https://docs.microsoft.com/en-us/windows/desktop/api/winsvc/nf-winsvc-queryservicestatusex + # BOOL QueryServiceStatusEx( + # SC_HANDLE hService, + # SC_STATUS_TYPE InfoLevel, + # LPBYTE lpBuffer, + # DWORD cbBufSize, + # LPDWORD pcbBytesNeeded + # ); + SC_STATUS_TYPE = enum( + :SC_STATUS_PROCESS_INFO, 0, + ) + ffi_lib :advapi32 + attach_function_private :QueryServiceStatusEx, + [:handle, SC_STATUS_TYPE, :lpbyte, :dword, :lpdword], :win32_bool + + # https://docs.microsoft.com/en-us/windows/desktop/api/Winsvc/nf-winsvc-queryserviceconfigw + # BOOL QueryServiceConfigW( + # SC_HANDLE hService, + # LPQUERY_SERVICE_CONFIGW lpServiceConfig, + # DWORD cbBufSize, + # LPDWORD pcbBytesNeeded + # ); + ffi_lib :advapi32 + attach_function_private :QueryServiceConfigW, + [:handle, :lpbyte, :dword, :lpdword], :win32_bool + + # https://docs.microsoft.com/en-us/windows/win32/api/winsvc/nf-winsvc-queryserviceconfig2w + # BOOL QueryServiceConfig2W( + # SC_HANDLE hService, + # DWORD dwInfoLevel, + # LPBYTE lpBuffer, + # DWORD cbBufSize, + # LPDWORD pcbBytesNeeded + # ); + ffi_lib :advapi32 + attach_function_private :QueryServiceConfig2W, + [:handle, :dword, :lpbyte, :dword, :lpdword], :win32_bool + + # https://docs.microsoft.com/en-us/windows/desktop/api/Winsvc/nf-winsvc-startservicew + # BOOL StartServiceW( + # SC_HANDLE hService, + # DWORD dwNumServiceArgs, + # LPCWSTR *lpServiceArgVectors + # ); + ffi_lib :advapi32 + attach_function_private :StartServiceW, + [:handle, :dword, :pointer], :win32_bool + + # https://docs.microsoft.com/en-us/windows/win32/api/winsvc/nf-winsvc-startservicectrldispatcherw + # BOOL StartServiceCtrlDispatcherW( + # const SERVICE_TABLE_ENTRYW *lpServiceStartTable + # ); + ffi_lib :advapi32 + attach_function_private :StartServiceCtrlDispatcherW, + [:pointer], :win32_bool, :blocking => true + + # https://docs.microsoft.com/en-us/windows/win32/api/winsvc/nf-winsvc-setservicestatus + # BOOL SetServiceStatus( + # SERVICE_STATUS_HANDLE hServiceStatus, + # LPSERVICE_STATUS lpServiceStatus + # ); + ffi_lib :advapi32 + attach_function_private :SetServiceStatus, + [:handle, :pointer], :win32_bool + + # https://docs.microsoft.com/en-us/windows/desktop/api/winsvc/nf-winsvc-controlservice + # BOOL ControlService( + # SC_HANDLE hService, + # DWORD dwControl, + # LPSERVICE_STATUS lpServiceStatus + # ); + ffi_lib :advapi32 + attach_function_private :ControlService, + [:handle, :dword, :pointer], :win32_bool + + # DWORD LphandlerFunctionEx( + # DWORD dwControl, + # DWORD dwEventType, + # LPVOID lpEventData, + # LPVOID lpContext + # ) + callback :handler_ex, [:dword, :dword, :lpvoid, :lpvoid], :void + + # https://docs.microsoft.com/en-us/windows/win32/api/winsvc/nf-winsvc-registerservicectrlhandlerexw + # SERVICE_STATUS_HANDLE RegisterServiceCtrlHandlerExW( + # LPCWSTR lpServiceName, + # LPHANDLER_FUNCTION_EX lpHandlerProc, + # LPVOID lpContext + # ); + ffi_lib :advapi32 + attach_function_private :RegisterServiceCtrlHandlerExW, + [:lpcwstr, :handler_ex, :lpvoid], :handle + + # https://docs.microsoft.com/en-us/windows/desktop/api/winsvc/nf-winsvc-changeserviceconfigw + # BOOL ChangeServiceConfigW( + # SC_HANDLE hService, + # DWORD dwServiceType, + # DWORD dwStartType, + # DWORD dwErrorControl, + # LPCWSTR lpBinaryPathName, + # LPCWSTR lpLoadOrderGroup, + # LPDWORD lpdwTagId, + # LPCWSTR lpDependencies, + # LPCWSTR lpServiceStartName, + # LPCWSTR lpPassword, + # LPCWSTR lpDisplayName + # ); + ffi_lib :advapi32 + attach_function_private :ChangeServiceConfigW, + [ + :handle, + :dword, + :dword, + :dword, + :lpcwstr, + :lpcwstr, + :lpdword, + :lpcwstr, + :lpcwstr, + :lpcwstr, + :lpcwstr + ], :win32_bool + + # https://docs.microsoft.com/en-us/windows/win32/api/winsvc/nf-winsvc-changeserviceconfig2w + # BOOL ChangeServiceConfig2W( + # SC_HANDLE hService, + # DWORD dwInfoLevel, + # LPVOID lpInfo + # ); + ffi_lib :advapi32 + attach_function_private :ChangeServiceConfig2W, + [:handle, :dword, :lpvoid], :win32_bool + + # https://docs.microsoft.com/en-us/windows/desktop/api/winsvc/nf-winsvc-enumservicesstatusexw + # BOOL EnumServicesStatusExW( + # SC_HANDLE hSCManager, + # SC_ENUM_TYPE InfoLevel, + # DWORD dwServiceType, + # DWORD dwServiceState, + # LPBYTE lpServices, + # DWORD cbBufSize, + # LPDWORD pcbBytesNeeded, + # LPDWORD lpServicesReturned, + # LPDWORD lpResumeHandle, + # LPCWSTR pszGroupName + # ); + SC_ENUM_TYPE = enum( + :SC_ENUM_PROCESS_INFO, 0, + ) + ffi_lib :advapi32 + attach_function_private :EnumServicesStatusExW, + [ + :handle, + SC_ENUM_TYPE, + :dword, + :dword, + :lpbyte, + :dword, + :lpdword, + :lpdword, + :lpdword, + :lpcwstr + ], :win32_bool + + # https://msdn.microsoft.com/en-us/library/windows/desktop/aa365512(v=vs.85).aspx + # BOOL WINAPI ReplaceFile( + # _In_ LPCTSTR lpReplacedFileName, + # _In_ LPCTSTR lpReplacementFileName, + # _In_opt_ LPCTSTR lpBackupFileName, + # _In_ DWORD dwReplaceFlags - 0x1 REPLACEFILE_WRITE_THROUGH, + # 0x2 REPLACEFILE_IGNORE_MERGE_ERRORS, + # 0x4 REPLACEFILE_IGNORE_ACL_ERRORS + # _Reserved_ LPVOID lpExclude, + # _Reserved_ LPVOID lpReserved + # ); + ffi_lib :kernel32 + attach_function_private :ReplaceFileW, + [:lpcwstr, :lpcwstr, :lpcwstr, :dword, :lpvoid, :lpvoid], :win32_bool + + # https://msdn.microsoft.com/en-us/library/windows/desktop/aa365240(v=vs.85).aspx + # BOOL WINAPI MoveFileEx( + # _In_ LPCTSTR lpExistingFileName, + # _In_opt_ LPCTSTR lpNewFileName, + # _In_ DWORD dwFlags + # ); + ffi_lib :kernel32 + attach_function_private :MoveFileExW, + [:lpcwstr, :lpcwstr, :dword], :win32_bool + + # BOOLEAN WINAPI CreateSymbolicLink( + # _In_ LPTSTR lpSymlinkFileName, - symbolic link to be created + # _In_ LPTSTR lpTargetFileName, - name of target for symbolic link + # _In_ DWORD dwFlags - 0x0 target is a file, 0x1 target is a directory + # ); + # rescue on Windows < 6.0 so that code doesn't explode + begin + ffi_lib :kernel32 + attach_function_private :CreateSymbolicLinkW, + [:lpwstr, :lpwstr, :dword], :boolean + rescue LoadError + end + + # https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-getcurrentdirectory + # DWORD GetCurrentDirectory( + # DWORD nBufferLength, + # LPTSTR lpBuffer + # ); + ffi_lib :kernel32 + attach_function_private :GetCurrentDirectoryW, + [:dword, :lpwstr], :dword + + # https://msdn.microsoft.com/en-us/library/windows/desktop/aa364944(v=vs.85).aspx + # DWORD WINAPI GetFileAttributes( + # _In_ LPCTSTR lpFileName + # ); + ffi_lib :kernel32 + attach_function_private :GetFileAttributesW, + [:lpcwstr], :dword + + # https://msdn.microsoft.com/en-us/library/windows/desktop/aa365535(v=vs.85).aspx + # BOOL WINAPI SetFileAttributes( + # _In_ LPCTSTR lpFileName, + # _In_ DWORD dwFileAttributes + # ); + ffi_lib :kernel32 + attach_function_private :SetFileAttributesW, + [:lpcwstr, :dword], :win32_bool + + # HANDLE WINAPI CreateFile( + # _In_ LPCTSTR lpFileName, + # _In_ DWORD dwDesiredAccess, + # _In_ DWORD dwShareMode, + # _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, + # _In_ DWORD dwCreationDisposition, + # _In_ DWORD dwFlagsAndAttributes, + # _In_opt_ HANDLE hTemplateFile + # ); + ffi_lib :kernel32 + attach_function_private :CreateFileW, + [:lpcwstr, :dword, :dword, :pointer, :dword, :dword, :handle], :handle + + # https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createdirectoryw + # BOOL CreateDirectoryW( + # LPCWSTR lpPathName, + # LPSECURITY_ATTRIBUTES lpSecurityAttributes + # ); + ffi_lib :kernel32 + attach_function_private :CreateDirectoryW, + [:lpcwstr, :pointer], :win32_bool + + # https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-removedirectoryw + # BOOL RemoveDirectoryW( + # LPCWSTR lpPathName + # ); + ffi_lib :kernel32 + attach_function_private :RemoveDirectoryW, + [:lpcwstr], :win32_bool + + # https://msdn.microsoft.com/en-us/library/windows/desktop/aa363216(v=vs.85).aspx + # BOOL WINAPI DeviceIoControl( + # _In_ HANDLE hDevice, + # _In_ DWORD dwIoControlCode, + # _In_opt_ LPVOID lpInBuffer, + # _In_ DWORD nInBufferSize, + # _Out_opt_ LPVOID lpOutBuffer, + # _In_ DWORD nOutBufferSize, + # _Out_opt_ LPDWORD lpBytesReturned, + # _Inout_opt_ LPOVERLAPPED lpOverlapped + # ); + ffi_lib :kernel32 + attach_function_private :DeviceIoControl, + [:handle, :dword, :lpvoid, :dword, :lpvoid, :dword, :lpdword, :pointer], :win32_bool + + # https://msdn.microsoft.com/en-us/library/windows/desktop/aa364980(v=vs.85).aspx + # DWORD WINAPI GetLongPathName( + # _In_ LPCTSTR lpszShortPath, + # _Out_ LPTSTR lpszLongPath, + # _In_ DWORD cchBuffer + # ); + ffi_lib :kernel32 + attach_function_private :GetLongPathNameW, + [:lpcwstr, :lpwstr, :dword], :dword + + # https://msdn.microsoft.com/en-us/library/windows/desktop/aa364989(v=vs.85).aspx + # DWORD WINAPI GetShortPathName( + # _In_ LPCTSTR lpszLongPath, + # _Out_ LPTSTR lpszShortPath, + # _In_ DWORD cchBuffer + # ); + ffi_lib :kernel32 + attach_function_private :GetShortPathNameW, + [:lpcwstr, :lpwstr, :dword], :dword + + # https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getfullpathnamew + # DWORD GetFullPathNameW( + # LPCWSTR lpFileName, + # DWORD nBufferLength, + # LPWSTR lpBuffer, + # LPWSTR *lpFilePart + # ); + ffi_lib :kernel32 + attach_function_private :GetFullPathNameW, + [:lpcwstr, :dword, :lpwstr, :pointer], :dword + + # https://docs.microsoft.com/en-us/windows/win32/api/shlobj_core/nf-shlobj_core-shgetfolderpathw + # SHFOLDERAPI SHGetFolderPathW( + # HWND hwnd, + # int csidl, + # HANDLE hToken, + # DWORD dwFlags, + # LPWSTR pszPath + # ); + ffi_lib :shell32 + attach_function_private :SHGetFolderPathW, + [:hwnd, :int, :handle, :dword, :lpwstr], :dword + + # https://docs.microsoft.com/en-us/windows/win32/api/shlobj_core/nf-shlobj_core-shgetfolderlocation + # SHSTDAPI SHGetFolderLocation( + # HWND hwnd, + # int csidl, + # HANDLE hToken, + # DWORD dwFlags, + # PIDLIST_ABSOLUTE *ppidl + # ); + ffi_lib :shell32 + attach_function_private :SHGetFolderLocation, + [:hwnd, :int, :handle, :dword, :pointer], :dword + + # https://docs.microsoft.com/en-us/windows/win32/api/shellapi/nf-shellapi-shgetfileinfoa + # DWORD_PTR SHGetFileInfoA( + # LPCSTR pszPath, + # DWORD dwFileAttributes, + # SHFILEINFOA *psfi, + # UINT cbFileInfo, + # UINT uFlags + # ); + ffi_lib :shell32 + attach_function_private :SHGetFileInfo, + [:dword, :dword, :pointer, :uint, :uint], :dword + + # https://docs.microsoft.com/en-us/windows/win32/api/shlwapi/nf-shlwapi-pathisdirectoryemptyw + # BOOL PathIsDirectoryEmptyW( + # LPCWSTR pszPath + # ); + ffi_lib :shlwapi + attach_function_private :PathIsDirectoryEmptyW, + [:lpcwstr], :win32_bool + end +end \ No newline at end of file diff --git a/lib/puppet/ffi/windows/structs.rb b/lib/puppet/ffi/windows/structs.rb new file mode 100644 index 00000000000..c1bc2eeea58 --- /dev/null +++ b/lib/puppet/ffi/windows/structs.rb @@ -0,0 +1,338 @@ +require 'puppet/ffi/windows' +require 'puppet/util/windows/api_types' + +module Puppet::FFI::Windows + module Structs + + extend FFI::Library + extend Puppet::Util::Windows::APITypes + + # https://docs.microsoft.com/en-us/previous-versions/windows/desktop/legacy/aa379560(v=vs.85) + # typedef struct _SECURITY_ATTRIBUTES { + # DWORD nLength; + # LPVOID lpSecurityDescriptor; + # BOOL bInheritHandle; + # } SECURITY_ATTRIBUTES, *PSECURITY_ATTRIBUTES, *LPSECURITY_ATTRIBUTES; + class SECURITY_ATTRIBUTES < FFI::Struct + layout( + :nLength, :dword, + :lpSecurityDescriptor, :lpvoid, + :bInheritHandle, :win32_bool + ) + end + + private_constant :SECURITY_ATTRIBUTES + + # sizeof(STARTUPINFO) == 68 + # https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/ns-processthreadsapi-startupinfoa + # typedef struct _STARTUPINFOA { + # DWORD cb; + # LPSTR lpReserved; + # LPSTR lpDesktop; + # LPSTR lpTitle; + # DWORD dwX; + # DWORD dwY; + # DWORD dwXSize; + # DWORD dwYSize; + # DWORD dwXCountChars; + # DWORD dwYCountChars; + # DWORD dwFillAttribute; + # DWORD dwFlags; + # WORD wShowWindow; + # WORD cbReserved2; + # LPBYTE lpReserved2; + # HANDLE hStdInput; + # HANDLE hStdOutput; + # HANDLE hStdError; + # } STARTUPINFOA, *LPSTARTUPINFOA; + class STARTUPINFO < FFI::Struct + layout( + :cb, :dword, + :lpReserved, :lpcstr, + :lpDesktop, :lpcstr, + :lpTitle, :lpcstr, + :dwX, :dword, + :dwY, :dword, + :dwXSize, :dword, + :dwYSize, :dword, + :dwXCountChars, :dword, + :dwYCountChars, :dword, + :dwFillAttribute, :dword, + :dwFlags, :dword, + :wShowWindow, :word, + :cbReserved2, :word, + :lpReserved2, :pointer, + :hStdInput, :handle, + :hStdOutput, :handle, + :hStdError, :handle + ) + end + + private_constant :STARTUPINFO + + # https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/ns-processthreadsapi-process_information + # typedef struct _PROCESS_INFORMATION { + # HANDLE hProcess; + # HANDLE hThread; + # DWORD dwProcessId; + # DWORD dwThreadId; + # } PROCESS_INFORMATION, *PPROCESS_INFORMATION, *LPPROCESS_INFORMATION; + class PROCESS_INFORMATION < FFI::Struct + layout( + :hProcess, :handle, + :hThread, :handle, + :dwProcessId, :dword, + :dwThreadId, :dword + ) + end + + private_constant :PROCESS_INFORMATION + + # https://msdn.microsoft.com/en-us/library/windows/desktop/aa379261(v=vs.85).aspx + # typedef struct _LUID { + # DWORD LowPart; + # LONG HighPart; + # } LUID, *PLUID; + class LUID < FFI::Struct + layout :LowPart, :dword, + :HighPart, :win32_long + end + + # https://msdn.microsoft.com/en-us/library/windows/desktop/aa379263(v=vs.85).aspx + # typedef struct _LUID_AND_ATTRIBUTES { + # LUID Luid; + # DWORD Attributes; + # } LUID_AND_ATTRIBUTES, *PLUID_AND_ATTRIBUTES; + class LUID_AND_ATTRIBUTES < FFI::Struct + layout :Luid, LUID, + :Attributes, :dword + end + + # https://msdn.microsoft.com/en-us/library/windows/desktop/aa379630(v=vs.85).aspx + # typedef struct _TOKEN_PRIVILEGES { + # DWORD PrivilegeCount; + # LUID_AND_ATTRIBUTES Privileges[ANYSIZE_ARRAY]; + # } TOKEN_PRIVILEGES, *PTOKEN_PRIVILEGES; + class TOKEN_PRIVILEGES < FFI::Struct + layout :PrivilegeCount, :dword, + :Privileges, [LUID_AND_ATTRIBUTES, 1] # placeholder for offset + end + + # https://msdn.microsoft.com/en-us/library/windows/desktop/bb530717(v=vs.85).aspx + # typedef struct _TOKEN_ELEVATION { + # DWORD TokenIsElevated; + # } TOKEN_ELEVATION, *PTOKEN_ELEVATION; + class TOKEN_ELEVATION < FFI::Struct + layout :TokenIsElevated, :dword + end + + # https://docs.microsoft.com/en-us/windows/desktop/api/winsvc/ns-winsvc-_service_status_process + # typedef struct _SERVICE_STATUS_PROCESS { + # DWORD dwServiceType; + # DWORD dwCurrentState; + # DWORD dwControlsAccepted; + # DWORD dwWin32ExitCode; + # DWORD dwServiceSpecificExitCode; + # DWORD dwCheckPoint; + # DWORD dwWaitHint; + # DWORD dwProcessId; + # DWORD dwServiceFlags; + # } SERVICE_STATUS_PROCESS, *LPSERVICE_STATUS_PROCESS; + class SERVICE_STATUS_PROCESS < FFI::Struct + layout( + :dwServiceType, :dword, + :dwCurrentState, :dword, + :dwControlsAccepted, :dword, + :dwWin32ExitCode, :dword, + :dwServiceSpecificExitCode, :dword, + :dwCheckPoint, :dword, + :dwWaitHint, :dword, + :dwProcessId, :dword, + :dwServiceFlags, :dword + ) + end + + # https://docs.microsoft.com/en-us/windows/win32/api/winsvc/ns-winsvc-service_delayed_auto_start_info + # typedef struct _SERVICE_DELAYED_AUTO_START_INFO { + # BOOL fDelayedAutostart; + # } SERVICE_DELAYED_AUTO_START_INFO, *LPSERVICE_DELAYED_AUTO_START_INFO; + class SERVICE_DELAYED_AUTO_START_INFO < FFI::Struct + layout(:fDelayedAutostart, :int) + alias aset []= + # Intercept the accessor so that we can handle either true/false or 1/0. + # Since there is only one member, there’s no need to check the key name. + def []=(key, value) + [0, false].include?(value) ? aset(key, 0) : aset(key, 1) + end + end + + # https://docs.microsoft.com/en-us/windows/desktop/api/winsvc/ns-winsvc-_enum_service_status_processw + # typedef struct _ENUM_SERVICE_STATUS_PROCESSW { + # LPWSTR lpServiceName; + # LPWSTR lpDisplayName; + # SERVICE_STATUS_PROCESS ServiceStatusProcess; + # } ENUM_SERVICE_STATUS_PROCESSW, *LPENUM_SERVICE_STATUS_PROCESSW; + class ENUM_SERVICE_STATUS_PROCESSW < FFI::Struct + layout( + :lpServiceName, :pointer, + :lpDisplayName, :pointer, + :ServiceStatusProcess, SERVICE_STATUS_PROCESS + ) + end + + # typedef struct _SERVICE_STATUS { + # DWORD dwServiceType; + # DWORD dwCurrentState; + # DWORD dwControlsAccepted; + # DWORD dwWin32ExitCode; + # DWORD dwServiceSpecificExitCode; + # DWORD dwCheckPoint; + # DWORD dwWaitHint; + # } SERVICE_STATUS, *LPSERVICE_STATUS; + class SERVICE_STATUS < FFI::Struct + layout( + :dwServiceType, :dword, + :dwCurrentState, :dword, + :dwControlsAccepted, :dword, + :dwWin32ExitCode, :dword, + :dwServiceSpecificExitCode, :dword, + :dwCheckPoint, :dword, + :dwWaitHint, :dword, + ) + end + + # typedef struct _QUERY_SERVICE_CONFIGW { + # DWORD dwServiceType; + # DWORD dwStartType; + # DWORD dwErrorControl; + # LPWSTR lpBinaryPathName; + # LPWSTR lpLoadOrderGroup; + # DWORD dwTagId; + # LPWSTR lpDependencies; + # LPWSTR lpServiceStartName; + # LPWSTR lpDisplayName; + # } QUERY_SERVICE_CONFIGW, *LPQUERY_SERVICE_CONFIGW; + class QUERY_SERVICE_CONFIGW < FFI::Struct + layout( + :dwServiceType, :dword, + :dwStartType, :dword, + :dwErrorControl, :dword, + :lpBinaryPathName, :pointer, + :lpLoadOrderGroup, :pointer, + :dwTagId, :dword, + :lpDependencies, :pointer, + :lpServiceStartName, :pointer, + :lpDisplayName, :pointer, + ) + end + + # typedef struct _SERVICE_TABLE_ENTRYW { + # LPWSTR lpServiceName; + # LPSERVICE_MAIN_FUNCTIONW lpServiceProc; + # } SERVICE_TABLE_ENTRYW, *LPSERVICE_TABLE_ENTRYW; + class SERVICE_TABLE_ENTRYW < FFI::Struct + layout( + :lpServiceName, :pointer, + :lpServiceProc, :pointer + ) + end + + # https://msdn.microsoft.com/en-us/library/windows/desktop/ms724834%28v=vs.85%29.aspx + # typedef struct _OSVERSIONINFO { + # DWORD dwOSVersionInfoSize; + # DWORD dwMajorVersion; + # DWORD dwMinorVersion; + # DWORD dwBuildNumber; + # DWORD dwPlatformId; + # TCHAR szCSDVersion[128]; + # } OSVERSIONINFO; + class OSVERSIONINFO < FFI::Struct + layout( + :dwOSVersionInfoSize, :dword, + :dwMajorVersion, :dword, + :dwMinorVersion, :dword, + :dwBuildNumber, :dword, + :dwPlatformId, :dword, + :szCSDVersion, [:wchar, 128] + ) + end + + MAXIMUM_REPARSE_DATA_BUFFER_SIZE = 16384 + + # SYMLINK_REPARSE_DATA_BUFFER + # https://msdn.microsoft.com/en-us/library/cc232006.aspx + # https://msdn.microsoft.com/en-us/library/windows/hardware/ff552012(v=vs.85).aspx + # struct is always MAXIMUM_REPARSE_DATA_BUFFER_SIZE bytes + class SYMLINK_REPARSE_DATA_BUFFER < FFI::Struct + layout :ReparseTag, :win32_ulong, + :ReparseDataLength, :ushort, + :Reserved, :ushort, + :SubstituteNameOffset, :ushort, + :SubstituteNameLength, :ushort, + :PrintNameOffset, :ushort, + :PrintNameLength, :ushort, + :Flags, :win32_ulong, + # max less above fields dword / uint 4 bytes, ushort 2 bytes + # technically a WCHAR buffer, but we care about size in bytes here + :PathBuffer, [:byte, MAXIMUM_REPARSE_DATA_BUFFER_SIZE - 20] + end + + # MOUNT_POINT_REPARSE_DATA_BUFFER + # https://msdn.microsoft.com/en-us/library/cc232007.aspx + # https://msdn.microsoft.com/en-us/library/windows/hardware/ff552012(v=vs.85).aspx + # struct is always MAXIMUM_REPARSE_DATA_BUFFER_SIZE bytes + class MOUNT_POINT_REPARSE_DATA_BUFFER < FFI::Struct + layout :ReparseTag, :win32_ulong, + :ReparseDataLength, :ushort, + :Reserved, :ushort, + :SubstituteNameOffset, :ushort, + :SubstituteNameLength, :ushort, + :PrintNameOffset, :ushort, + :PrintNameLength, :ushort, + # max less above fields dword / uint 4 bytes, ushort 2 bytes + # technically a WCHAR buffer, but we care about size in bytes here + :PathBuffer, [:byte, MAXIMUM_REPARSE_DATA_BUFFER_SIZE - 16] + end + + # SHFILEINFO + # https://docs.microsoft.com/en-us/windows/win32/api/shellapi/ns-shellapi-shfileinfow + # typedef struct _SHFILEINFOW { + # HICON hIcon; + # int iIcon; + # DWORD dwAttributes; + # WCHAR szDisplayName[MAX_PATH]; + # WCHAR szTypeName[80]; + # } SHFILEINFOW; + class SHFILEINFO < FFI::Struct + layout( + :hIcon, :ulong, + :iIcon, :int, + :dwAttributes, :ulong, + :szDisplayName, [:char, 256], + :szTypeName, [:char, 80] + ) + end + + # REPARSE_JDATA_BUFFER + class REPARSE_JDATA_BUFFER < FFI::Struct + layout( + :ReparseTag, :ulong, + :ReparseDataLength, :ushort, + :Reserved, :ushort, + :SubstituteNameOffset, :ushort, + :SubstituteNameLength, :ushort, + :PrintNameOffset, :ushort, + :PrintNameLength, :ushort, + :PathBuffer, [:char, 1024] + ) + + # The REPARSE_DATA_BUFFER_HEADER_SIZE which is calculated as: + # + # sizeof(ReparseTag) + sizeof(ReparseDataLength) + sizeof(Reserved) + # + def header_size + FFI::Type::ULONG.size + FFI::Type::USHORT.size + FFI::Type::USHORT.size + end + end + end +end \ No newline at end of file diff --git a/lib/puppet/settings/priority_setting.rb b/lib/puppet/settings/priority_setting.rb index b102ea9787e..de87926a411 100644 --- a/lib/puppet/settings/priority_setting.rb +++ b/lib/puppet/settings/priority_setting.rb @@ -6,11 +6,12 @@ class Puppet::Settings::PrioritySetting < Puppet::Settings::BaseSetting PRIORITY_MAP = if Puppet::Util::Platform.windows? require 'puppet/util/windows/process' + require 'puppet/ffi/windows/constants' { - :high => Puppet::Util::Windows::Process::HIGH_PRIORITY_CLASS, - :normal => Puppet::Util::Windows::Process::NORMAL_PRIORITY_CLASS, - :low => Puppet::Util::Windows::Process::BELOW_NORMAL_PRIORITY_CLASS, - :idle => Puppet::Util::Windows::Process::IDLE_PRIORITY_CLASS + :high => Puppet::FFI::Windows::Constants::HIGH_PRIORITY_CLASS, + :normal => Puppet::FFI::Windows::Constants::NORMAL_PRIORITY_CLASS, + :low => Puppet::FFI::Windows::Constants::BELOW_NORMAL_PRIORITY_CLASS, + :idle => Puppet::FFI::Windows::Constants::IDLE_PRIORITY_CLASS } else { diff --git a/lib/puppet/util/windows.rb b/lib/puppet/util/windows.rb index 24fae209547..18fbfb6e97c 100644 --- a/lib/puppet/util/windows.rb +++ b/lib/puppet/util/windows.rb @@ -1,4 +1,5 @@ require 'puppet/util/platform' + module Puppet::Util::Windows module ADSI class ADSIObject; end diff --git a/lib/puppet/util/windows/file.rb b/lib/puppet/util/windows/file.rb index 9c88b22c7b6..da266a92d87 100644 --- a/lib/puppet/util/windows/file.rb +++ b/lib/puppet/util/windows/file.rb @@ -1,75 +1,17 @@ -require 'puppet/util/windows' +require 'puppet/ffi/windows' module Puppet::Util::Windows::File require 'ffi' extend FFI::Library extend Puppet::Util::Windows::String - FILE_ATTRIBUTE_READONLY = 0x00000001 - FILE_ATTRIBUTE_DIRECTORY = 0x00000010 - - # https://msdn.microsoft.com/en-us/library/windows/desktop/aa379607(v=vs.85).aspx - # The right to use the object for synchronization. This enables a thread to - # wait until the object is in the signaled state. Some object types do not - # support this access right. - SYNCHRONIZE = 0x100000 - # The right to delete the object. - DELETE = 0x00010000 - # The right to read the information in the object's security descriptor, not including the information in the system access control list (SACL). - # READ_CONTROL = 0x00020000 - # The right to modify the discretionary access control list (DACL) in the object's security descriptor. - WRITE_DAC = 0x00040000 - # The right to change the owner in the object's security descriptor. - WRITE_OWNER = 0x00080000 - - # Combines DELETE, READ_CONTROL, WRITE_DAC, and WRITE_OWNER access. - STANDARD_RIGHTS_REQUIRED = 0xf0000 - # Currently defined to equal READ_CONTROL. - STANDARD_RIGHTS_READ = 0x20000 - # Currently defined to equal READ_CONTROL. - STANDARD_RIGHTS_WRITE = 0x20000 - # Currently defined to equal READ_CONTROL. - STANDARD_RIGHTS_EXECUTE = 0x20000 - # Combines DELETE, READ_CONTROL, WRITE_DAC, WRITE_OWNER, and SYNCHRONIZE access. - STANDARD_RIGHTS_ALL = 0x1F0000 - SPECIFIC_RIGHTS_ALL = 0xFFFF - - FILE_READ_DATA = 1 - FILE_WRITE_DATA = 2 - FILE_APPEND_DATA = 4 - FILE_READ_EA = 8 - FILE_WRITE_EA = 16 - FILE_EXECUTE = 32 - FILE_DELETE_CHILD = 64 - FILE_READ_ATTRIBUTES = 128 - FILE_WRITE_ATTRIBUTES = 256 - - FILE_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x1FF - - FILE_GENERIC_READ = - STANDARD_RIGHTS_READ | - FILE_READ_DATA | - FILE_READ_ATTRIBUTES | - FILE_READ_EA | - SYNCHRONIZE - - FILE_GENERIC_WRITE = - STANDARD_RIGHTS_WRITE | - FILE_WRITE_DATA | - FILE_WRITE_ATTRIBUTES | - FILE_WRITE_EA | - FILE_APPEND_DATA | - SYNCHRONIZE - - FILE_GENERIC_EXECUTE = - STANDARD_RIGHTS_EXECUTE | - FILE_READ_ATTRIBUTES | - FILE_EXECUTE | - SYNCHRONIZE - - REPLACEFILE_WRITE_THROUGH = 0x1 - REPLACEFILE_IGNORE_MERGE_ERRORS = 0x2 - REPLACEFILE_IGNORE_ACL_ERRORS = 0x3 + include Puppet::FFI::Windows::Constants + + extend Puppet::FFI::Windows::Structs + include Puppet::FFI::Windows::Structs + + include Puppet::FFI::Windows::Functions + extend Puppet::FFI::Windows::Functions def replace_file(target, source) target_encoded = wide_string(target.to_s) @@ -112,7 +54,6 @@ def symlink(target, symlink) end module_function :symlink - def exist?(path) path = path.to_str if path.respond_to?(:to_str) # support WatchedFile path = path.to_s # support String and Pathname @@ -145,9 +86,6 @@ def exist?(path) end module_function :exist? - - INVALID_FILE_ATTRIBUTES = 0xFFFFFFFF #define INVALID_FILE_ATTRIBUTES (DWORD (-1)) - def get_attributes(file_name, raise_on_invalid = true) result = GetFileAttributesW(wide_string(file_name.to_s)) if raise_on_invalid && result == INVALID_FILE_ATTRIBUTES @@ -200,18 +138,6 @@ def self.create_file(file_name, desired_access, share_mode, security_attributes, "#{flags_and_attributes.to_s(8)}, #{template_file_handle})") end - IO_REPARSE_TAG_MOUNT_POINT = 0xA0000003 - IO_REPARSE_TAG_HSM = 0xC0000004 - IO_REPARSE_TAG_HSM2 = 0x80000006 - IO_REPARSE_TAG_SIS = 0x80000007 - IO_REPARSE_TAG_WIM = 0x80000008 - IO_REPARSE_TAG_CSV = 0x80000009 - IO_REPARSE_TAG_DFS = 0x8000000A - IO_REPARSE_TAG_SYMLINK = 0xA000000C - IO_REPARSE_TAG_DFSR = 0x80000012 - IO_REPARSE_TAG_DEDUP = 0x80000013 - IO_REPARSE_TAG_NFS = 0x80000014 - def self.get_reparse_point_data(handle, &block) # must be multiple of 1024, min 10240 FFI::MemoryPointer.new(MAXIMUM_REPARSE_DATA_BUFFER_SIZE) do |reparse_data_buffer_ptr| @@ -277,7 +203,6 @@ def self.device_io_control(handle, io_control_code, in_buffer = nil, out_buffer out_buffer end - FILE_ATTRIBUTE_REPARSE_POINT = 0x400 def reparse_point?(file_name) attributes = get_attributes(file_name, false) @@ -292,20 +217,6 @@ def symlink?(file_name) end module_function :symlink? - GENERIC_READ = 0x80000000 - GENERIC_WRITE = 0x40000000 - GENERIC_EXECUTE = 0x20000000 - GENERIC_ALL = 0x10000000 - METHOD_BUFFERED = 0 - FILE_SHARE_READ = 1 - FILE_SHARE_WRITE = 2 - OPEN_EXISTING = 3 - FILE_DEVICE_FILE_SYSTEM = 0x00000009 - FILE_FLAG_OPEN_REPARSE_POINT = 0x00200000 - FILE_FLAG_BACKUP_SEMANTICS = 0x02000000 - SHGFI_DISPLAYNAME = 0x000000200 - SHGFI_PIDL = 0x000000008 - def self.open_symlink(link_name) begin yield handle = create_file( @@ -334,10 +245,6 @@ def readlink(link_name) end module_function :readlink - ERROR_FILE_NOT_FOUND = 2 - ERROR_PATH_NOT_FOUND = 3 - ERROR_ALREADY_EXISTS = 183 - def get_long_pathname(path) converted = '' FFI::Pointer.from_string_to_wide_string(path) do |path_ptr| @@ -417,9 +324,6 @@ def stat.ftype end module_function :lstat - # https://msdn.microsoft.com/en-us/library/windows/desktop/aa364571(v=vs.85).aspx - FSCTL_GET_REPARSE_POINT = 0x900a8 - def self.resolve_symlink(handle) path = nil get_reparse_point_data(handle) do |reparse_data| @@ -450,268 +354,4 @@ def self.symlink_reparse_point?(path) symlink end private_class_method :symlink_reparse_point? - - ffi_convention :stdcall - - # https://msdn.microsoft.com/en-us/library/windows/desktop/aa365512(v=vs.85).aspx - # BOOL WINAPI ReplaceFile( - # _In_ LPCTSTR lpReplacedFileName, - # _In_ LPCTSTR lpReplacementFileName, - # _In_opt_ LPCTSTR lpBackupFileName, - # _In_ DWORD dwReplaceFlags - 0x1 REPLACEFILE_WRITE_THROUGH, - # 0x2 REPLACEFILE_IGNORE_MERGE_ERRORS, - # 0x4 REPLACEFILE_IGNORE_ACL_ERRORS - # _Reserved_ LPVOID lpExclude, - # _Reserved_ LPVOID lpReserved - # ); - ffi_lib :kernel32 - attach_function_private :ReplaceFileW, - [:lpcwstr, :lpcwstr, :lpcwstr, :dword, :lpvoid, :lpvoid], :win32_bool - - # https://msdn.microsoft.com/en-us/library/windows/desktop/aa365240(v=vs.85).aspx - # BOOL WINAPI MoveFileEx( - # _In_ LPCTSTR lpExistingFileName, - # _In_opt_ LPCTSTR lpNewFileName, - # _In_ DWORD dwFlags - # ); - ffi_lib :kernel32 - attach_function_private :MoveFileExW, - [:lpcwstr, :lpcwstr, :dword], :win32_bool - - # BOOLEAN WINAPI CreateSymbolicLink( - # _In_ LPTSTR lpSymlinkFileName, - symbolic link to be created - # _In_ LPTSTR lpTargetFileName, - name of target for symbolic link - # _In_ DWORD dwFlags - 0x0 target is a file, 0x1 target is a directory - # ); - # rescue on Windows < 6.0 so that code doesn't explode - begin - ffi_lib :kernel32 - attach_function_private :CreateSymbolicLinkW, - [:lpwstr, :lpwstr, :dword], :boolean - rescue LoadError - end - - # https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-getcurrentdirectory - # DWORD GetCurrentDirectory( - # DWORD nBufferLength, - # LPTSTR lpBuffer - # ); - ffi_lib :kernel32 - attach_function_private :GetCurrentDirectoryW, - [:dword, :lpwstr], :dword - - # https://msdn.microsoft.com/en-us/library/windows/desktop/aa364944(v=vs.85).aspx - # DWORD WINAPI GetFileAttributes( - # _In_ LPCTSTR lpFileName - # ); - ffi_lib :kernel32 - attach_function_private :GetFileAttributesW, - [:lpcwstr], :dword - - # https://msdn.microsoft.com/en-us/library/windows/desktop/aa365535(v=vs.85).aspx - # BOOL WINAPI SetFileAttributes( - # _In_ LPCTSTR lpFileName, - # _In_ DWORD dwFileAttributes - # ); - ffi_lib :kernel32 - attach_function_private :SetFileAttributesW, - [:lpcwstr, :dword], :win32_bool - - # HANDLE WINAPI CreateFile( - # _In_ LPCTSTR lpFileName, - # _In_ DWORD dwDesiredAccess, - # _In_ DWORD dwShareMode, - # _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, - # _In_ DWORD dwCreationDisposition, - # _In_ DWORD dwFlagsAndAttributes, - # _In_opt_ HANDLE hTemplateFile - # ); - ffi_lib :kernel32 - attach_function_private :CreateFileW, - [:lpcwstr, :dword, :dword, :pointer, :dword, :dword, :handle], :handle - - # https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createdirectoryw - # BOOL CreateDirectoryW( - # LPCWSTR lpPathName, - # LPSECURITY_ATTRIBUTES lpSecurityAttributes - # ); - ffi_lib :kernel32 - attach_function_private :CreateDirectoryW, - [:lpcwstr, :pointer], :win32_bool - - # https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-removedirectoryw - # BOOL RemoveDirectoryW( - # LPCWSTR lpPathName - # ); - ffi_lib :kernel32 - attach_function_private :RemoveDirectoryW, - [:lpcwstr], :win32_bool - - # https://msdn.microsoft.com/en-us/library/windows/desktop/aa363216(v=vs.85).aspx - # BOOL WINAPI DeviceIoControl( - # _In_ HANDLE hDevice, - # _In_ DWORD dwIoControlCode, - # _In_opt_ LPVOID lpInBuffer, - # _In_ DWORD nInBufferSize, - # _Out_opt_ LPVOID lpOutBuffer, - # _In_ DWORD nOutBufferSize, - # _Out_opt_ LPDWORD lpBytesReturned, - # _Inout_opt_ LPOVERLAPPED lpOverlapped - # ); - ffi_lib :kernel32 - attach_function_private :DeviceIoControl, - [:handle, :dword, :lpvoid, :dword, :lpvoid, :dword, :lpdword, :pointer], :win32_bool - - MAXIMUM_REPARSE_DATA_BUFFER_SIZE = 16384 - - # SYMLINK_REPARSE_DATA_BUFFER - # https://msdn.microsoft.com/en-us/library/cc232006.aspx - # https://msdn.microsoft.com/en-us/library/windows/hardware/ff552012(v=vs.85).aspx - # struct is always MAXIMUM_REPARSE_DATA_BUFFER_SIZE bytes - class SYMLINK_REPARSE_DATA_BUFFER < FFI::Struct - layout :ReparseTag, :win32_ulong, - :ReparseDataLength, :ushort, - :Reserved, :ushort, - :SubstituteNameOffset, :ushort, - :SubstituteNameLength, :ushort, - :PrintNameOffset, :ushort, - :PrintNameLength, :ushort, - :Flags, :win32_ulong, - # max less above fields dword / uint 4 bytes, ushort 2 bytes - # technically a WCHAR buffer, but we care about size in bytes here - :PathBuffer, [:byte, MAXIMUM_REPARSE_DATA_BUFFER_SIZE - 20] - end - - # MOUNT_POINT_REPARSE_DATA_BUFFER - # https://msdn.microsoft.com/en-us/library/cc232007.aspx - # https://msdn.microsoft.com/en-us/library/windows/hardware/ff552012(v=vs.85).aspx - # struct is always MAXIMUM_REPARSE_DATA_BUFFER_SIZE bytes - class MOUNT_POINT_REPARSE_DATA_BUFFER < FFI::Struct - layout :ReparseTag, :win32_ulong, - :ReparseDataLength, :ushort, - :Reserved, :ushort, - :SubstituteNameOffset, :ushort, - :SubstituteNameLength, :ushort, - :PrintNameOffset, :ushort, - :PrintNameLength, :ushort, - # max less above fields dword / uint 4 bytes, ushort 2 bytes - # technically a WCHAR buffer, but we care about size in bytes here - :PathBuffer, [:byte, MAXIMUM_REPARSE_DATA_BUFFER_SIZE - 16] - end - - # SHFILEINFO - # https://docs.microsoft.com/en-us/windows/win32/api/shellapi/ns-shellapi-shfileinfow - # typedef struct _SHFILEINFOW { - # HICON hIcon; - # int iIcon; - # DWORD dwAttributes; - # WCHAR szDisplayName[MAX_PATH]; - # WCHAR szTypeName[80]; - # } SHFILEINFOW; - class SHFILEINFO < FFI::Struct - layout( - :hIcon, :ulong, - :iIcon, :int, - :dwAttributes, :ulong, - :szDisplayName, [:char, 256], - :szTypeName, [:char, 80] - ) - end - - # REPARSE_JDATA_BUFFER - class REPARSE_JDATA_BUFFER < FFI::Struct - layout( - :ReparseTag, :ulong, - :ReparseDataLength, :ushort, - :Reserved, :ushort, - :SubstituteNameOffset, :ushort, - :SubstituteNameLength, :ushort, - :PrintNameOffset, :ushort, - :PrintNameLength, :ushort, - :PathBuffer, [:char, 1024] - ) - - # The REPARSE_DATA_BUFFER_HEADER_SIZE which is calculated as: - # - # sizeof(ReparseTag) + sizeof(ReparseDataLength) + sizeof(Reserved) - # - def header_size - FFI::Type::ULONG.size + FFI::Type::USHORT.size + FFI::Type::USHORT.size - end - end - - # https://msdn.microsoft.com/en-us/library/windows/desktop/aa364980(v=vs.85).aspx - # DWORD WINAPI GetLongPathName( - # _In_ LPCTSTR lpszShortPath, - # _Out_ LPTSTR lpszLongPath, - # _In_ DWORD cchBuffer - # ); - ffi_lib :kernel32 - attach_function_private :GetLongPathNameW, - [:lpcwstr, :lpwstr, :dword], :dword - - # https://msdn.microsoft.com/en-us/library/windows/desktop/aa364989(v=vs.85).aspx - # DWORD WINAPI GetShortPathName( - # _In_ LPCTSTR lpszLongPath, - # _Out_ LPTSTR lpszShortPath, - # _In_ DWORD cchBuffer - # ); - ffi_lib :kernel32 - attach_function_private :GetShortPathNameW, - [:lpcwstr, :lpwstr, :dword], :dword - - # https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getfullpathnamew - # DWORD GetFullPathNameW( - # LPCWSTR lpFileName, - # DWORD nBufferLength, - # LPWSTR lpBuffer, - # LPWSTR *lpFilePart - # ); - ffi_lib :kernel32 - attach_function_private :GetFullPathNameW, - [:lpcwstr, :dword, :lpwstr, :pointer], :dword - - # https://docs.microsoft.com/en-us/windows/win32/api/shlobj_core/nf-shlobj_core-shgetfolderpathw - # SHFOLDERAPI SHGetFolderPathW( - # HWND hwnd, - # int csidl, - # HANDLE hToken, - # DWORD dwFlags, - # LPWSTR pszPath - # ); - ffi_lib :shell32 - attach_function_private :SHGetFolderPathW, - [:hwnd, :int, :handle, :dword, :lpwstr], :dword - - # https://docs.microsoft.com/en-us/windows/win32/api/shlobj_core/nf-shlobj_core-shgetfolderlocation - # SHSTDAPI SHGetFolderLocation( - # HWND hwnd, - # int csidl, - # HANDLE hToken, - # DWORD dwFlags, - # PIDLIST_ABSOLUTE *ppidl - # ); - ffi_lib :shell32 - attach_function_private :SHGetFolderLocation, - [:hwnd, :int, :handle, :dword, :pointer], :dword - - # https://docs.microsoft.com/en-us/windows/win32/api/shellapi/nf-shellapi-shgetfileinfoa - # DWORD_PTR SHGetFileInfoA( - # LPCSTR pszPath, - # DWORD dwFileAttributes, - # SHFILEINFOA *psfi, - # UINT cbFileInfo, - # UINT uFlags - # ); - ffi_lib :shell32 - attach_function_private :SHGetFileInfo, - [:dword, :dword, :pointer, :uint, :uint], :dword - - # https://docs.microsoft.com/en-us/windows/win32/api/shlwapi/nf-shlwapi-pathisdirectoryemptyw - # BOOL PathIsDirectoryEmptyW( - # LPCWSTR pszPath - # ); - ffi_lib :shlwapi - attach_function_private :PathIsDirectoryEmptyW, - [:lpcwstr], :win32_bool end diff --git a/lib/puppet/util/windows/monkey_patches/process.rb b/lib/puppet/util/windows/monkey_patches/process.rb index 185c078c5c3..48e6bc49adf 100644 --- a/lib/puppet/util/windows/monkey_patches/process.rb +++ b/lib/puppet/util/windows/monkey_patches/process.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true require 'ffi' +require 'puppet/ffi/windows' require 'puppet/util/windows/api_types' require 'puppet/util/windows/string' @@ -8,56 +9,11 @@ module Process extend FFI::Library extend Puppet::Util::Windows::APITypes extend Puppet::Util::Windows::String - - # Priority constants - # https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-setpriorityclass - ABOVE_NORMAL_PRIORITY_CLASS = 0x0008000 - BELOW_NORMAL_PRIORITY_CLASS = 0x0004000 - HIGH_PRIORITY_CLASS = 0x0000080 - IDLE_PRIORITY_CLASS = 0x0000040 - NORMAL_PRIORITY_CLASS = 0x0000020 - REALTIME_PRIORITY_CLASS = 0x0000010 - - # Process Access Rights - # https://docs.microsoft.com/en-us/windows/win32/procthread/process-security-and-access-rights - PROCESS_TERMINATE = 0x00000001 - PROCESS_SET_INFORMATION = 0x00000200 - PROCESS_QUERY_INFORMATION = 0x00000400 - PROCESS_ALL_ACCESS = 0x001F0FFF - PROCESS_VM_READ = 0x00000010 - - # Process creation flags - # https://docs.microsoft.com/en-us/windows/win32/procthread/process-creation-flags - CREATE_BREAKAWAY_FROM_JOB = 0x01000000 - CREATE_DEFAULT_ERROR_MODE = 0x04000000 - CREATE_NEW_CONSOLE = 0x00000010 - CREATE_NEW_PROCESS_GROUP = 0x00000200 - CREATE_NO_WINDOW = 0x08000000 - CREATE_PROTECTED_PROCESS = 0x00040000 - CREATE_PRESERVE_CODE_AUTHZ_LEVEL = 0x02000000 - CREATE_SEPARATE_WOW_VDM = 0x00000800 - CREATE_SHARED_WOW_VDM = 0x00001000 - CREATE_SUSPENDED = 0x00000004 - CREATE_UNICODE_ENVIRONMENT = 0x00000400 - DEBUG_ONLY_THIS_PROCESS = 0x00000002 - DEBUG_PROCESS = 0x00000001 - DETACHED_PROCESS = 0x00000008 - INHERIT_PARENT_AFFINITY = 0x00010000 - - # Logon options - LOGON_WITH_PROFILE = 0x00000001 - - # STARTUPINFOA constants - # https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/ns-processthreadsapi-startupinfoa - STARTF_USESTDHANDLES = 0x00000100 - - # Miscellaneous - HANDLE_FLAG_INHERIT = 0x00000001 - SEM_FAILCRITICALERRORS = 0x00000001 - SEM_NOGPFAULTERRORBOX = 0x00000002 - - # Error constants - INVALID_HANDLE_VALUE = FFI::Pointer.new(-1).address + extend Puppet::FFI::Windows::Functions + extend Puppet::FFI::Windows::Structs + + include Puppet::FFI::Windows::Constants + include Puppet::FFI::Windows::Structs ProcessInfo = Struct.new( 'ProcessInfo', @@ -69,176 +25,6 @@ module Process private_constant :ProcessInfo - # https://docs.microsoft.com/en-us/previous-versions/windows/desktop/legacy/aa379560(v=vs.85) - # typedef struct _SECURITY_ATTRIBUTES { - # DWORD nLength; - # LPVOID lpSecurityDescriptor; - # BOOL bInheritHandle; - # } SECURITY_ATTRIBUTES, *PSECURITY_ATTRIBUTES, *LPSECURITY_ATTRIBUTES; - class SECURITY_ATTRIBUTES < FFI::Struct - layout( - :nLength, :dword, - :lpSecurityDescriptor, :lpvoid, - :bInheritHandle, :win32_bool - ) - end - - private_constant :SECURITY_ATTRIBUTES - - # sizeof(STARTUPINFO) == 68 - # https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/ns-processthreadsapi-startupinfoa - # typedef struct _STARTUPINFOA { - # DWORD cb; - # LPSTR lpReserved; - # LPSTR lpDesktop; - # LPSTR lpTitle; - # DWORD dwX; - # DWORD dwY; - # DWORD dwXSize; - # DWORD dwYSize; - # DWORD dwXCountChars; - # DWORD dwYCountChars; - # DWORD dwFillAttribute; - # DWORD dwFlags; - # WORD wShowWindow; - # WORD cbReserved2; - # LPBYTE lpReserved2; - # HANDLE hStdInput; - # HANDLE hStdOutput; - # HANDLE hStdError; - # } STARTUPINFOA, *LPSTARTUPINFOA; - class STARTUPINFO < FFI::Struct - layout( - :cb, :dword, - :lpReserved, :lpcstr, - :lpDesktop, :lpcstr, - :lpTitle, :lpcstr, - :dwX, :dword, - :dwY, :dword, - :dwXSize, :dword, - :dwYSize, :dword, - :dwXCountChars, :dword, - :dwYCountChars, :dword, - :dwFillAttribute, :dword, - :dwFlags, :dword, - :wShowWindow, :word, - :cbReserved2, :word, - :lpReserved2, :pointer, - :hStdInput, :handle, - :hStdOutput, :handle, - :hStdError, :handle - ) - end - - private_constant :STARTUPINFO - - # https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/ns-processthreadsapi-process_information - # typedef struct _PROCESS_INFORMATION { - # HANDLE hProcess; - # HANDLE hThread; - # DWORD dwProcessId; - # DWORD dwThreadId; - # } PROCESS_INFORMATION, *PPROCESS_INFORMATION, *LPPROCESS_INFORMATION; - class PROCESS_INFORMATION < FFI::Struct - layout( - :hProcess, :handle, - :hThread, :handle, - :dwProcessId, :dword, - :dwThreadId, :dword - ) - end - - private_constant :PROCESS_INFORMATION - - ffi_convention :stdcall - - # https://docs.microsoft.com/en-us/windows/win32/api/handleapi/nf-handleapi-sethandleinformation - # BOOL SetHandleInformation( - # HANDLE hObject, - # DWORD dwMask, - # DWORD dwFlags - # ); - ffi_lib :kernel32 - attach_function_private :SetHandleInformation, [:handle, :dword, :dword], :win32_bool - - # https://docs.microsoft.com/en-us/windows/win32/api/errhandlingapi/nf-errhandlingapi-seterrormode - # UINT SetErrorMode( - # UINT uMode - # ); - ffi_lib :kernel32 - attach_function_private :SetErrorMode, [:uint], :uint - - # https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-createprocessw - # BOOL CreateProcessW( - # LPCWSTR lpApplicationName, - # LPWSTR lpCommandLine, - # LPSECURITY_ATTRIBUTES lpProcessAttributes, - # LPSECURITY_ATTRIBUTES lpThreadAttributes, - # BOOL bInheritHandles, - # DWORD dwCreationFlags, - # LPVOID lpEnvironment, - # LPCWSTR lpCurrentDirectory, - # LPSTARTUPINFOW lpStartupInfo, - # LPPROCESS_INFORMATION lpProcessInformation - # ); - ffi_lib :kernel32 - attach_function_private :CreateProcessW, - [:lpcwstr, :lpwstr, :pointer, :pointer, :win32_bool, - :dword, :lpvoid, :lpcwstr, :pointer, :pointer], :bool - - # https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-openprocess - # HANDLE OpenProcess( - # DWORD dwDesiredAccess, - # BOOL bInheritHandle, - # DWORD dwProcessId - # ); - ffi_lib :kernel32 - attach_function_private :OpenProcess, [:dword, :win32_bool, :dword], :handle - - # https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-setpriorityclass - # BOOL SetPriorityClass( - # HANDLE hProcess, - # DWORD dwPriorityClass - # ); - ffi_lib :kernel32 - attach_function_private :SetPriorityClass, [:handle, :dword], :win32_bool - - # https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-createprocesswithlogonw - # BOOL CreateProcessWithLogonW( - # LPCWSTR lpUsername, - # LPCWSTR lpDomain, - # LPCWSTR lpPassword, - # DWORD dwLogonFlags, - # LPCWSTR lpApplicationName, - # LPWSTR lpCommandLine, - # DWORD dwCreationFlags, - # LPVOID lpEnvironment, - # LPCWSTR lpCurrentDirectory, - # LPSTARTUPINFOW lpStartupInfo, - # LPPROCESS_INFORMATION lpProcessInformation - # ); - ffi_lib :advapi32 - attach_function_private :CreateProcessWithLogonW, - [:lpcwstr, :lpcwstr, :lpcwstr, :dword, :lpcwstr, :lpwstr, - :dword, :lpvoid, :lpcwstr, :pointer, :pointer], :bool - - # https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/get-osfhandle?view=vs-2019 - # intptr_t _get_osfhandle( - # int fd - # ); - ffi_lib FFI::Library::LIBC - attach_function_private :get_osfhandle, :_get_osfhandle, [:int], :intptr_t - - begin - # https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/get-errno?view=vs-2019 - # errno_t _get_errno( - # int * pValue - # ); - attach_function_private :get_errno, :_get_errno, [:pointer], :int - rescue FFI::NotFoundError - # Do nothing, Windows XP or earlier. - end - # Disable popups. This mostly affects the Process.kill method. SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX) diff --git a/lib/puppet/util/windows/process.rb b/lib/puppet/util/windows/process.rb index 4a9e874f07f..ba3cd84761b 100644 --- a/lib/puppet/util/windows/process.rb +++ b/lib/puppet/util/windows/process.rb @@ -1,8 +1,9 @@ -require 'puppet/util/windows' -require 'ffi' require 'puppet/util/windows/monkey_patches/process' +require 'puppet/ffi/windows' module Puppet::Util::Windows::Process + extend Puppet::FFI::Windows::Functions + include Puppet::FFI::Windows::Structs extend Puppet::Util::Windows::String extend FFI::Library @@ -361,269 +362,4 @@ def supports_elevated_security? end module_function :supports_elevated_security? - ABOVE_NORMAL_PRIORITY_CLASS = 0x0008000 - BELOW_NORMAL_PRIORITY_CLASS = 0x0004000 - HIGH_PRIORITY_CLASS = 0x0000080 - IDLE_PRIORITY_CLASS = 0x0000040 - NORMAL_PRIORITY_CLASS = 0x0000020 - REALTIME_PRIORITY_CLASS = 0x0000010 - - ffi_convention :stdcall - - # https://msdn.microsoft.com/en-us/library/windows/desktop/ms687032(v=vs.85).aspx - # DWORD WINAPI WaitForSingleObject( - # _In_ HANDLE hHandle, - # _In_ DWORD dwMilliseconds - # ); - ffi_lib :kernel32 - attach_function_private :WaitForSingleObject, - [:handle, :dword], :dword - - # https://docs.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-waitformultipleobjects - # DWORD WaitForMultipleObjects( - # DWORD nCount, - # const HANDLE *lpHandles, - # BOOL bWaitAll, - # DWORD dwMilliseconds - # ); - ffi_lib :kernel32 - attach_function_private :WaitForMultipleObjects, - [:dword, :phandle, :win32_bool, :dword], :dword - - # https://docs.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-createeventw - # HANDLE CreateEventW( - # LPSECURITY_ATTRIBUTES lpEventAttributes, - # BOOL bManualReset, - # BOOL bInitialState, - # LPCWSTR lpName - # ); - ffi_lib :kernel32 - attach_function_private :CreateEventW, - [:pointer, :win32_bool, :win32_bool, :lpcwstr], :handle - - # https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-createthread - # HANDLE CreateThread( - # LPSECURITY_ATTRIBUTES lpThreadAttributes, - # SIZE_T dwStackSize, - # LPTHREAD_START_ROUTINE lpStartAddress, - # __drv_aliasesMem LPVOID lpParameter, - # DWORD dwCreationFlags, - # LPDWORD lpThreadId - # ); - ffi_lib :kernel32 - attach_function_private :CreateThread, - [:pointer, :size_t, :pointer, :lpvoid, :dword, :lpdword], :handle, :blocking => true - - # https://docs.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-setevent - # BOOL SetEvent( - # HANDLE hEvent - # ); - ffi_lib :kernel32 - attach_function_private :SetEvent, - [:handle], :win32_bool - - # https://msdn.microsoft.com/en-us/library/windows/desktop/ms683189(v=vs.85).aspx - # BOOL WINAPI GetExitCodeProcess( - # _In_ HANDLE hProcess, - # _Out_ LPDWORD lpExitCode - # ); - ffi_lib :kernel32 - attach_function_private :GetExitCodeProcess, - [:handle, :lpdword], :win32_bool - - # https://msdn.microsoft.com/en-us/library/windows/desktop/ms683179(v=vs.85).aspx - # HANDLE WINAPI GetCurrentProcess(void); - ffi_lib :kernel32 - attach_function_private :GetCurrentProcess, [], :handle - - # https://msdn.microsoft.com/en-us/library/windows/desktop/ms683187(v=vs.85).aspx - # LPTCH GetEnvironmentStrings(void); - ffi_lib :kernel32 - attach_function_private :GetEnvironmentStringsW, [], :pointer - - # https://msdn.microsoft.com/en-us/library/windows/desktop/ms683151(v=vs.85).aspx - # BOOL FreeEnvironmentStrings( - # _In_ LPTCH lpszEnvironmentBlock - # ); - ffi_lib :kernel32 - attach_function_private :FreeEnvironmentStringsW, - [:pointer], :win32_bool - - # https://msdn.microsoft.com/en-us/library/windows/desktop/ms686206(v=vs.85).aspx - # BOOL WINAPI SetEnvironmentVariableW( - # _In_ LPCTSTR lpName, - # _In_opt_ LPCTSTR lpValue - # ); - ffi_lib :kernel32 - attach_function_private :SetEnvironmentVariableW, - [:lpcwstr, :lpcwstr], :win32_bool - - # https://msdn.microsoft.com/en-us/library/windows/desktop/ms684320(v=vs.85).aspx - # HANDLE WINAPI OpenProcess( - # _In_ DWORD DesiredAccess, - # _In_ BOOL InheritHandle, - # _In_ DWORD ProcessId - # ); - ffi_lib :kernel32 - attach_function_private :OpenProcess, - [:dword, :win32_bool, :dword], :handle - - # https://msdn.microsoft.com/en-us/library/windows/desktop/aa379295(v=vs.85).aspx - # BOOL WINAPI OpenProcessToken( - # _In_ HANDLE ProcessHandle, - # _In_ DWORD DesiredAccess, - # _Out_ PHANDLE TokenHandle - # ); - ffi_lib :advapi32 - attach_function_private :OpenProcessToken, - [:handle, :dword, :phandle], :win32_bool - - # https://docs.microsoft.com/en-us/windows/desktop/api/winbase/nf-winbase-queryfullprocessimagenamew - # BOOL WINAPI QueryFullProcessImageName( - # _In_ HANDLE hProcess, - # _In_ DWORD dwFlags, - # _Out_ LPWSTR lpExeName, - # _In_ PDWORD lpdwSize, - # ); - ffi_lib :kernel32 - attach_function_private :QueryFullProcessImageNameW, - [:handle, :dword, :lpwstr, :pdword], :win32_bool - - # https://msdn.microsoft.com/en-us/library/windows/desktop/aa379261(v=vs.85).aspx - # typedef struct _LUID { - # DWORD LowPart; - # LONG HighPart; - # } LUID, *PLUID; - class LUID < FFI::Struct - layout :LowPart, :dword, - :HighPart, :win32_long - end - - # https://msdn.microsoft.com/en-us/library/Windows/desktop/aa379180(v=vs.85).aspx - # BOOL WINAPI LookupPrivilegeValue( - # _In_opt_ LPCTSTR lpSystemName, - # _In_ LPCTSTR lpName, - # _Out_ PLUID lpLuid - # ); - ffi_lib :advapi32 - attach_function_private :LookupPrivilegeValueW, - [:lpcwstr, :lpcwstr, :pointer], :win32_bool - - # https://msdn.microsoft.com/en-us/library/windows/desktop/aa379626(v=vs.85).aspx - TOKEN_INFORMATION_CLASS = enum( - :TokenUser, 1, - :TokenGroups, - :TokenPrivileges, - :TokenOwner, - :TokenPrimaryGroup, - :TokenDefaultDacl, - :TokenSource, - :TokenType, - :TokenImpersonationLevel, - :TokenStatistics, - :TokenRestrictedSids, - :TokenSessionId, - :TokenGroupsAndPrivileges, - :TokenSessionReference, - :TokenSandBoxInert, - :TokenAuditPolicy, - :TokenOrigin, - :TokenElevationType, - :TokenLinkedToken, - :TokenElevation, - :TokenHasRestrictions, - :TokenAccessInformation, - :TokenVirtualizationAllowed, - :TokenVirtualizationEnabled, - :TokenIntegrityLevel, - :TokenUIAccess, - :TokenMandatoryPolicy, - :TokenLogonSid, - :TokenIsAppContainer, - :TokenCapabilities, - :TokenAppContainerSid, - :TokenAppContainerNumber, - :TokenUserClaimAttributes, - :TokenDeviceClaimAttributes, - :TokenRestrictedUserClaimAttributes, - :TokenRestrictedDeviceClaimAttributes, - :TokenDeviceGroups, - :TokenRestrictedDeviceGroups, - :TokenSecurityAttributes, - :TokenIsRestricted, - :MaxTokenInfoClass - ) - - # https://msdn.microsoft.com/en-us/library/windows/desktop/aa379263(v=vs.85).aspx - # typedef struct _LUID_AND_ATTRIBUTES { - # LUID Luid; - # DWORD Attributes; - # } LUID_AND_ATTRIBUTES, *PLUID_AND_ATTRIBUTES; - class LUID_AND_ATTRIBUTES < FFI::Struct - layout :Luid, LUID, - :Attributes, :dword - end - - # https://msdn.microsoft.com/en-us/library/windows/desktop/aa379630(v=vs.85).aspx - # typedef struct _TOKEN_PRIVILEGES { - # DWORD PrivilegeCount; - # LUID_AND_ATTRIBUTES Privileges[ANYSIZE_ARRAY]; - # } TOKEN_PRIVILEGES, *PTOKEN_PRIVILEGES; - class TOKEN_PRIVILEGES < FFI::Struct - layout :PrivilegeCount, :dword, - :Privileges, [LUID_AND_ATTRIBUTES, 1] # placeholder for offset - end - - # https://msdn.microsoft.com/en-us/library/windows/desktop/bb530717(v=vs.85).aspx - # typedef struct _TOKEN_ELEVATION { - # DWORD TokenIsElevated; - # } TOKEN_ELEVATION, *PTOKEN_ELEVATION; - class TOKEN_ELEVATION < FFI::Struct - layout :TokenIsElevated, :dword - end - - # https://msdn.microsoft.com/en-us/library/windows/desktop/aa446671(v=vs.85).aspx - # BOOL WINAPI GetTokenInformation( - # _In_ HANDLE TokenHandle, - # _In_ TOKEN_INFORMATION_CLASS TokenInformationClass, - # _Out_opt_ LPVOID TokenInformation, - # _In_ DWORD TokenInformationLength, - # _Out_ PDWORD ReturnLength - # ); - ffi_lib :advapi32 - attach_function_private :GetTokenInformation, - [:handle, TOKEN_INFORMATION_CLASS, :lpvoid, :dword, :pdword ], :win32_bool - - # https://msdn.microsoft.com/en-us/library/windows/desktop/ms724834%28v=vs.85%29.aspx - # typedef struct _OSVERSIONINFO { - # DWORD dwOSVersionInfoSize; - # DWORD dwMajorVersion; - # DWORD dwMinorVersion; - # DWORD dwBuildNumber; - # DWORD dwPlatformId; - # TCHAR szCSDVersion[128]; - # } OSVERSIONINFO; - class OSVERSIONINFO < FFI::Struct - layout( - :dwOSVersionInfoSize, :dword, - :dwMajorVersion, :dword, - :dwMinorVersion, :dword, - :dwBuildNumber, :dword, - :dwPlatformId, :dword, - :szCSDVersion, [:wchar, 128] - ) - end - - # https://msdn.microsoft.com/en-us/library/windows/desktop/ms724451(v=vs.85).aspx - # BOOL WINAPI GetVersionEx( - # _Inout_ LPOSVERSIONINFO lpVersionInfo - # ); - ffi_lib :kernel32 - attach_function_private :GetVersionExW, - [:pointer], :win32_bool - - # https://msdn.microsoft.com/en-us/library/windows/desktop/dd318123(v=vs.85).aspx - # LANGID GetSystemDefaultUILanguage(void); - ffi_lib :kernel32 - attach_function_private :GetSystemDefaultUILanguage, [], :word end diff --git a/lib/puppet/util/windows/service.rb b/lib/puppet/util/windows/service.rb index 16b14ed282d..c7ed43a0750 100644 --- a/lib/puppet/util/windows/service.rb +++ b/lib/puppet/util/windows/service.rb @@ -1,6 +1,6 @@ # coding: utf-8 -require 'puppet/util/windows' require 'ffi' +require 'puppet/ffi/windows' module Puppet::Util::Windows # This module is designed to provide an API between the windows system and puppet for @@ -11,323 +11,20 @@ module Service extend FFI::Library extend Puppet::Util::Windows::String - FILE = Puppet::Util::Windows::File + include Puppet::FFI::Windows::Constants + extend Puppet::FFI::Windows::Constants + + include Puppet::FFI::Windows::Structs + extend Puppet::FFI::Windows::Structs + + include Puppet::FFI::Windows::Functions + extend Puppet::FFI::Windows::Functions # integer value of the floor for timeouts when waiting for service pending states. # puppet will wait the length of dwWaitHint if it is longer than this value, but # no shorter DEFAULT_TIMEOUT = 30 - # Service error codes - # https://docs.microsoft.com/en-us/windows/desktop/debug/system-error-codes--1000-1299- - ERROR_SERVICE_DOES_NOT_EXIST = 0x00000424 - - # Service control codes - # https://docs.microsoft.com/en-us/windows/desktop/api/Winsvc/nf-winsvc-controlserviceexw - SERVICE_CONTROL_STOP = 0x00000001 - SERVICE_CONTROL_PAUSE = 0x00000002 - SERVICE_CONTROL_CONTINUE = 0x00000003 - SERVICE_CONTROL_INTERROGATE = 0x00000004 - SERVICE_CONTROL_SHUTDOWN = 0x00000005 - SERVICE_CONTROL_PARAMCHANGE = 0x00000006 - SERVICE_CONTROL_NETBINDADD = 0x00000007 - SERVICE_CONTROL_NETBINDREMOVE = 0x00000008 - SERVICE_CONTROL_NETBINDENABLE = 0x00000009 - SERVICE_CONTROL_NETBINDDISABLE = 0x0000000A - SERVICE_CONTROL_DEVICEEVENT = 0x0000000B - SERVICE_CONTROL_HARDWAREPROFILECHANGE = 0x0000000C - SERVICE_CONTROL_POWEREVENT = 0x0000000D - SERVICE_CONTROL_SESSIONCHANGE = 0x0000000E - SERVICE_CONTROL_PRESHUTDOWN = 0x0000000F - SERVICE_CONTROL_TIMECHANGE = 0x00000010 - SERVICE_CONTROL_TRIGGEREVENT = 0x00000020 - SERVICE_CONTROL_SIGNALS = { - SERVICE_CONTROL_STOP => :SERVICE_CONTROL_STOP, - SERVICE_CONTROL_PAUSE => :SERVICE_CONTROL_PAUSE, - SERVICE_CONTROL_CONTINUE => :SERVICE_CONTROL_CONTINUE, - SERVICE_CONTROL_INTERROGATE => :SERVICE_CONTROL_INTERROGATE, - SERVICE_CONTROL_SHUTDOWN => :SERVICE_CONTROL_SHUTDOWN, - SERVICE_CONTROL_PARAMCHANGE => :SERVICE_CONTROL_PARAMCHANGE, - SERVICE_CONTROL_NETBINDADD => :SERVICE_CONTROL_NETBINDADD, - SERVICE_CONTROL_NETBINDREMOVE => :SERVICE_CONTROL_NETBINDREMOVE, - SERVICE_CONTROL_NETBINDENABLE => :SERVICE_CONTROL_NETBINDENABLE, - SERVICE_CONTROL_NETBINDDISABLE => :SERVICE_CONTROL_NETBINDDISABLE, - SERVICE_CONTROL_DEVICEEVENT => :SERVICE_CONTROL_DEVICEEVENT, - SERVICE_CONTROL_HARDWAREPROFILECHANGE => :SERVICE_CONTROL_HARDWAREPROFILECHANGE, - SERVICE_CONTROL_POWEREVENT => :SERVICE_CONTROL_POWEREVENT, - SERVICE_CONTROL_SESSIONCHANGE => :SERVICE_CONTROL_SESSIONCHANGE, - SERVICE_CONTROL_PRESHUTDOWN => :SERVICE_CONTROL_PRESHUTDOWN, - SERVICE_CONTROL_TIMECHANGE => :SERVICE_CONTROL_TIMECHANGE, - SERVICE_CONTROL_TRIGGEREVENT => :SERVICE_CONTROL_TRIGGEREVENT - } - - - # Service start type codes - # https://docs.microsoft.com/en-us/windows/desktop/api/Winsvc/nf-winsvc-changeserviceconfigw - SERVICE_AUTO_START = 0x00000002 - SERVICE_BOOT_START = 0x00000000 - SERVICE_DEMAND_START = 0x00000003 - SERVICE_DISABLED = 0x00000004 - SERVICE_SYSTEM_START = 0x00000001 - SERVICE_START_TYPES = { - SERVICE_AUTO_START => :SERVICE_AUTO_START, - SERVICE_BOOT_START => :SERVICE_BOOT_START, - SERVICE_DEMAND_START => :SERVICE_DEMAND_START, - SERVICE_DISABLED => :SERVICE_DISABLED, - SERVICE_SYSTEM_START => :SERVICE_SYSTEM_START, - } - - # Service type codes - # https://docs.microsoft.com/en-us/windows/desktop/api/Winsvc/nf-winsvc-changeserviceconfigw - SERVICE_FILE_SYSTEM_DRIVER = 0x00000002 - SERVICE_KERNEL_DRIVER = 0x00000001 - SERVICE_WIN32_OWN_PROCESS = 0x00000010 - SERVICE_WIN32_SHARE_PROCESS = 0x00000020 - SERVICE_USER_OWN_PROCESS = 0x00000050 - SERVICE_USER_SHARE_PROCESS = 0x00000060 - # Available only if service is also SERVICE_WIN32_OWN_PROCESS or SERVICE_WIN32_SHARE_PROCESS - SERVICE_INTERACTIVE_PROCESS = 0x00000100 - ALL_SERVICE_TYPES = - SERVICE_FILE_SYSTEM_DRIVER | - SERVICE_KERNEL_DRIVER | - SERVICE_WIN32_OWN_PROCESS | - SERVICE_WIN32_SHARE_PROCESS - - # Current state codes - # https://docs.microsoft.com/en-us/windows/desktop/api/winsvc/ns-winsvc-_service_status_process - SERVICE_CONTINUE_PENDING = 0x00000005 - SERVICE_PAUSE_PENDING = 0x00000006 - SERVICE_PAUSED = 0x00000007 - SERVICE_RUNNING = 0x00000004 - SERVICE_START_PENDING = 0x00000002 - SERVICE_STOP_PENDING = 0x00000003 - SERVICE_STOPPED = 0x00000001 - UNSAFE_PENDING_STATES = [SERVICE_START_PENDING, SERVICE_STOP_PENDING] - FINAL_STATES = { - SERVICE_CONTINUE_PENDING => SERVICE_RUNNING, - SERVICE_PAUSE_PENDING => SERVICE_PAUSED, - SERVICE_START_PENDING => SERVICE_RUNNING, - SERVICE_STOP_PENDING => SERVICE_STOPPED - } - SERVICE_STATES = { - SERVICE_CONTINUE_PENDING => :SERVICE_CONTINUE_PENDING, - SERVICE_PAUSE_PENDING => :SERVICE_PAUSE_PENDING, - SERVICE_PAUSED => :SERVICE_PAUSED, - SERVICE_RUNNING => :SERVICE_RUNNING, - SERVICE_START_PENDING => :SERVICE_START_PENDING, - SERVICE_STOP_PENDING => :SERVICE_STOP_PENDING, - SERVICE_STOPPED => :SERVICE_STOPPED, - } - - # Service accepts control codes - # https://docs.microsoft.com/en-us/windows/desktop/api/winsvc/ns-winsvc-_service_status_process - SERVICE_ACCEPT_STOP = 0x00000001 - SERVICE_ACCEPT_PAUSE_CONTINUE = 0x00000002 - SERVICE_ACCEPT_SHUTDOWN = 0x00000004 - SERVICE_ACCEPT_PARAMCHANGE = 0x00000008 - SERVICE_ACCEPT_NETBINDCHANGE = 0x00000010 - SERVICE_ACCEPT_HARDWAREPROFILECHANGE = 0x00000020 - SERVICE_ACCEPT_POWEREVENT = 0x00000040 - SERVICE_ACCEPT_SESSIONCHANGE = 0x00000080 - SERVICE_ACCEPT_PRESHUTDOWN = 0x00000100 - SERVICE_ACCEPT_TIMECHANGE = 0x00000200 - SERVICE_ACCEPT_TRIGGEREVENT = 0x00000400 - SERVICE_ACCEPT_USER_LOGOFF = 0x00000800 - - # Service manager access codes - # https://docs.microsoft.com/en-us/windows/desktop/Services/service-security-and-access-rights - SC_MANAGER_CREATE_SERVICE = 0x00000002 - SC_MANAGER_CONNECT = 0x00000001 - SC_MANAGER_ENUMERATE_SERVICE = 0x00000004 - SC_MANAGER_LOCK = 0x00000008 - SC_MANAGER_MODIFY_BOOT_CONFIG = 0x00000020 - SC_MANAGER_QUERY_LOCK_STATUS = 0x00000010 - SC_MANAGER_ALL_ACCESS = - FILE::STANDARD_RIGHTS_REQUIRED | - SC_MANAGER_CREATE_SERVICE | - SC_MANAGER_CONNECT | - SC_MANAGER_ENUMERATE_SERVICE | - SC_MANAGER_LOCK | - SC_MANAGER_MODIFY_BOOT_CONFIG | - SC_MANAGER_QUERY_LOCK_STATUS - - - # Service access codes - # https://docs.microsoft.com/en-us/windows/desktop/Services/service-security-and-access-rights - SERVICE_CHANGE_CONFIG = 0x0002 - SERVICE_ENUMERATE_DEPENDENTS = 0x0008 - SERVICE_INTERROGATE = 0x0080 - SERVICE_PAUSE_CONTINUE = 0x0040 - SERVICE_QUERY_STATUS = 0x0004 - SERVICE_QUERY_CONFIG = 0x0001 - SERVICE_START = 0x0010 - SERVICE_STOP = 0x0020 - SERVICE_USER_DEFINED_CONTROL = 0x0100 - SERVICE_ALL_ACCESS = - FILE::STANDARD_RIGHTS_REQUIRED | - SERVICE_CHANGE_CONFIG | - SERVICE_ENUMERATE_DEPENDENTS | - SERVICE_INTERROGATE | - SERVICE_PAUSE_CONTINUE | - SERVICE_QUERY_STATUS | - SERVICE_QUERY_CONFIG | - SERVICE_START | - SERVICE_STOP | - SERVICE_USER_DEFINED_CONTROL - - # Service config codes - # From the windows 10 SDK: - # // - # // Value to indicate no change to an optional parameter - # // - # #define SERVICE_NO_CHANGE 0xffffffff - # https://docs.microsoft.com/en-us/windows/win32/api/winsvc/nf-winsvc-changeserviceconfig2w - SERVICE_CONFIG_DESCRIPTION = 0x00000001 - SERVICE_CONFIG_FAILURE_ACTIONS = 0x00000002 - SERVICE_CONFIG_DELAYED_AUTO_START_INFO = 0x00000003 - SERVICE_CONFIG_FAILURE_ACTIONS_FLAG = 0x00000004 - SERVICE_CONFIG_SERVICE_SID_INFO = 0x00000005 - SERVICE_CONFIG_REQUIRED_PRIVILEGES_INFO = 0x00000006 - SERVICE_CONFIG_PRESHUTDOWN_INFO = 0x00000007 - SERVICE_CONFIG_TRIGGER_INFO = 0x00000008 - SERVICE_CONFIG_PREFERRED_NODE = 0x00000009 - SERVICE_CONFIG_LAUNCH_PROTECTED = 0x00000012 - SERVICE_NO_CHANGE = 0xffffffff - SERVICE_CONFIG_TYPES = { - SERVICE_CONFIG_DESCRIPTION => :SERVICE_CONFIG_DESCRIPTION, - SERVICE_CONFIG_FAILURE_ACTIONS => :SERVICE_CONFIG_FAILURE_ACTIONS, - SERVICE_CONFIG_DELAYED_AUTO_START_INFO => :SERVICE_CONFIG_DELAYED_AUTO_START_INFO, - SERVICE_CONFIG_FAILURE_ACTIONS_FLAG => :SERVICE_CONFIG_FAILURE_ACTIONS_FLAG, - SERVICE_CONFIG_SERVICE_SID_INFO => :SERVICE_CONFIG_SERVICE_SID_INFO, - SERVICE_CONFIG_REQUIRED_PRIVILEGES_INFO => :SERVICE_CONFIG_REQUIRED_PRIVILEGES_INFO, - SERVICE_CONFIG_PRESHUTDOWN_INFO => :SERVICE_CONFIG_PRESHUTDOWN_INFO, - SERVICE_CONFIG_TRIGGER_INFO => :SERVICE_CONFIG_TRIGGER_INFO, - SERVICE_CONFIG_PREFERRED_NODE => :SERVICE_CONFIG_PREFERRED_NODE, - SERVICE_CONFIG_LAUNCH_PROTECTED => :SERVICE_CONFIG_LAUNCH_PROTECTED, - } - - # Service enum codes - # https://docs.microsoft.com/en-us/windows/desktop/api/winsvc/nf-winsvc-enumservicesstatusexa - SERVICE_ACTIVE = 0x00000001 - SERVICE_INACTIVE = 0x00000002 - SERVICE_STATE_ALL = - SERVICE_ACTIVE | - SERVICE_INACTIVE - - # https://docs.microsoft.com/en-us/windows/desktop/api/winsvc/ns-winsvc-_enum_service_status_processw - SERVICENAME_MAX = 256 - - # https://docs.microsoft.com/en-us/windows/desktop/api/winsvc/ns-winsvc-_service_status_process - # typedef struct _SERVICE_STATUS_PROCESS { - # DWORD dwServiceType; - # DWORD dwCurrentState; - # DWORD dwControlsAccepted; - # DWORD dwWin32ExitCode; - # DWORD dwServiceSpecificExitCode; - # DWORD dwCheckPoint; - # DWORD dwWaitHint; - # DWORD dwProcessId; - # DWORD dwServiceFlags; - # } SERVICE_STATUS_PROCESS, *LPSERVICE_STATUS_PROCESS; - class SERVICE_STATUS_PROCESS < FFI::Struct - layout( - :dwServiceType, :dword, - :dwCurrentState, :dword, - :dwControlsAccepted, :dword, - :dwWin32ExitCode, :dword, - :dwServiceSpecificExitCode, :dword, - :dwCheckPoint, :dword, - :dwWaitHint, :dword, - :dwProcessId, :dword, - :dwServiceFlags, :dword - ) - end - - # https://docs.microsoft.com/en-us/windows/win32/api/winsvc/ns-winsvc-service_delayed_auto_start_info - # typedef struct _SERVICE_DELAYED_AUTO_START_INFO { - # BOOL fDelayedAutostart; - # } SERVICE_DELAYED_AUTO_START_INFO, *LPSERVICE_DELAYED_AUTO_START_INFO; - class SERVICE_DELAYED_AUTO_START_INFO < FFI::Struct - layout(:fDelayedAutostart, :int) - alias aset []= - # Intercept the accessor so that we can handle either true/false or 1/0. - # Since there is only one member, there’s no need to check the key name. - def []=(key, value) - [0, false].include?(value) ? aset(key, 0) : aset(key, 1) - end - end - - # https://docs.microsoft.com/en-us/windows/desktop/api/winsvc/ns-winsvc-_enum_service_status_processw - # typedef struct _ENUM_SERVICE_STATUS_PROCESSW { - # LPWSTR lpServiceName; - # LPWSTR lpDisplayName; - # SERVICE_STATUS_PROCESS ServiceStatusProcess; - # } ENUM_SERVICE_STATUS_PROCESSW, *LPENUM_SERVICE_STATUS_PROCESSW; - class ENUM_SERVICE_STATUS_PROCESSW < FFI::Struct - layout( - :lpServiceName, :pointer, - :lpDisplayName, :pointer, - :ServiceStatusProcess, SERVICE_STATUS_PROCESS - ) - end - - # typedef struct _SERVICE_STATUS { - # DWORD dwServiceType; - # DWORD dwCurrentState; - # DWORD dwControlsAccepted; - # DWORD dwWin32ExitCode; - # DWORD dwServiceSpecificExitCode; - # DWORD dwCheckPoint; - # DWORD dwWaitHint; - # } SERVICE_STATUS, *LPSERVICE_STATUS; - class SERVICE_STATUS < FFI::Struct - layout( - :dwServiceType, :dword, - :dwCurrentState, :dword, - :dwControlsAccepted, :dword, - :dwWin32ExitCode, :dword, - :dwServiceSpecificExitCode, :dword, - :dwCheckPoint, :dword, - :dwWaitHint, :dword, - ) - end - - # typedef struct _QUERY_SERVICE_CONFIGW { - # DWORD dwServiceType; - # DWORD dwStartType; - # DWORD dwErrorControl; - # LPWSTR lpBinaryPathName; - # LPWSTR lpLoadOrderGroup; - # DWORD dwTagId; - # LPWSTR lpDependencies; - # LPWSTR lpServiceStartName; - # LPWSTR lpDisplayName; - # } QUERY_SERVICE_CONFIGW, *LPQUERY_SERVICE_CONFIGW; - class QUERY_SERVICE_CONFIGW < FFI::Struct - layout( - :dwServiceType, :dword, - :dwStartType, :dword, - :dwErrorControl, :dword, - :lpBinaryPathName, :pointer, - :lpLoadOrderGroup, :pointer, - :dwTagId, :dword, - :lpDependencies, :pointer, - :lpServiceStartName, :pointer, - :lpDisplayName, :pointer, - ) - end - - # typedef struct _SERVICE_TABLE_ENTRYW { - # LPWSTR lpServiceName; - # LPSERVICE_MAIN_FUNCTIONW lpServiceProc; - # } SERVICE_TABLE_ENTRYW, *LPSERVICE_TABLE_ENTRYW; - class SERVICE_TABLE_ENTRYW < FFI::Struct - layout( - :lpServiceName, :pointer, - :lpServiceProc, :pointer - ) - end - # Returns true if the service exists, false otherwise. # # @param [String] service_name name of the service @@ -1003,196 +700,196 @@ def milliseconds_to_seconds(wait_hint) private :milliseconds_to_seconds end - # https://docs.microsoft.com/en-us/windows/desktop/api/Winsvc/nf-winsvc-openscmanagerw - # SC_HANDLE OpenSCManagerW( - # LPCWSTR lpMachineName, - # LPCWSTR lpDatabaseName, - # DWORD dwDesiredAccess - # ); - ffi_lib :advapi32 - attach_function_private :OpenSCManagerW, - [:lpcwstr, :lpcwstr, :dword], :handle - - # https://docs.microsoft.com/en-us/windows/desktop/api/Winsvc/nf-winsvc-openservicew - # SC_HANDLE OpenServiceW( - # SC_HANDLE hSCManager, - # LPCWSTR lpServiceName, - # DWORD dwDesiredAccess - # ); - ffi_lib :advapi32 - attach_function_private :OpenServiceW, - [:handle, :lpcwstr, :dword], :handle - - # https://docs.microsoft.com/en-us/windows/desktop/api/Winsvc/nf-winsvc-closeservicehandle - # BOOL CloseServiceHandle( - # SC_HANDLE hSCObject - # ); - ffi_lib :advapi32 - attach_function_private :CloseServiceHandle, - [:handle], :win32_bool - - # https://docs.microsoft.com/en-us/windows/desktop/api/winsvc/nf-winsvc-queryservicestatusex - # BOOL QueryServiceStatusEx( - # SC_HANDLE hService, - # SC_STATUS_TYPE InfoLevel, - # LPBYTE lpBuffer, - # DWORD cbBufSize, - # LPDWORD pcbBytesNeeded - # ); - SC_STATUS_TYPE = enum( - :SC_STATUS_PROCESS_INFO, 0, - ) - ffi_lib :advapi32 - attach_function_private :QueryServiceStatusEx, - [:handle, SC_STATUS_TYPE, :lpbyte, :dword, :lpdword], :win32_bool - - # https://docs.microsoft.com/en-us/windows/desktop/api/Winsvc/nf-winsvc-queryserviceconfigw - # BOOL QueryServiceConfigW( - # SC_HANDLE hService, - # LPQUERY_SERVICE_CONFIGW lpServiceConfig, - # DWORD cbBufSize, - # LPDWORD pcbBytesNeeded - # ); - ffi_lib :advapi32 - attach_function_private :QueryServiceConfigW, - [:handle, :lpbyte, :dword, :lpdword], :win32_bool - - # https://docs.microsoft.com/en-us/windows/win32/api/winsvc/nf-winsvc-queryserviceconfig2w - # BOOL QueryServiceConfig2W( - # SC_HANDLE hService, - # DWORD dwInfoLevel, - # LPBYTE lpBuffer, - # DWORD cbBufSize, - # LPDWORD pcbBytesNeeded - # ); - ffi_lib :advapi32 - attach_function_private :QueryServiceConfig2W, - [:handle, :dword, :lpbyte, :dword, :lpdword], :win32_bool - - # https://docs.microsoft.com/en-us/windows/desktop/api/Winsvc/nf-winsvc-startservicew - # BOOL StartServiceW( - # SC_HANDLE hService, - # DWORD dwNumServiceArgs, - # LPCWSTR *lpServiceArgVectors - # ); - ffi_lib :advapi32 - attach_function_private :StartServiceW, - [:handle, :dword, :pointer], :win32_bool - - # https://docs.microsoft.com/en-us/windows/win32/api/winsvc/nf-winsvc-startservicectrldispatcherw - # BOOL StartServiceCtrlDispatcherW( - # const SERVICE_TABLE_ENTRYW *lpServiceStartTable - # ); - ffi_lib :advapi32 - attach_function_private :StartServiceCtrlDispatcherW, - [:pointer], :win32_bool, :blocking => true - - # https://docs.microsoft.com/en-us/windows/win32/api/winsvc/nf-winsvc-setservicestatus - # BOOL SetServiceStatus( - # SERVICE_STATUS_HANDLE hServiceStatus, - # LPSERVICE_STATUS lpServiceStatus - # ); - ffi_lib :advapi32 - attach_function_private :SetServiceStatus, - [:handle, :pointer], :win32_bool - - # https://docs.microsoft.com/en-us/windows/desktop/api/winsvc/nf-winsvc-controlservice - # BOOL ControlService( - # SC_HANDLE hService, - # DWORD dwControl, - # LPSERVICE_STATUS lpServiceStatus - # ); - ffi_lib :advapi32 - attach_function_private :ControlService, - [:handle, :dword, :pointer], :win32_bool - - # DWORD LphandlerFunctionEx( - # DWORD dwControl, - # DWORD dwEventType, - # LPVOID lpEventData, - # LPVOID lpContext + # # https://docs.microsoft.com/en-us/windows/desktop/api/Winsvc/nf-winsvc-openscmanagerw + # # SC_HANDLE OpenSCManagerW( + # # LPCWSTR lpMachineName, + # # LPCWSTR lpDatabaseName, + # # DWORD dwDesiredAccess + # # ); + # ffi_lib :advapi32 + # attach_function_private :OpenSCManagerW, + # [:lpcwstr, :lpcwstr, :dword], :handle + + # # https://docs.microsoft.com/en-us/windows/desktop/api/Winsvc/nf-winsvc-openservicew + # # SC_HANDLE OpenServiceW( + # # SC_HANDLE hSCManager, + # # LPCWSTR lpServiceName, + # # DWORD dwDesiredAccess + # # ); + # ffi_lib :advapi32 + # attach_function_private :OpenServiceW, + # [:handle, :lpcwstr, :dword], :handle + + # # https://docs.microsoft.com/en-us/windows/desktop/api/Winsvc/nf-winsvc-closeservicehandle + # # BOOL CloseServiceHandle( + # # SC_HANDLE hSCObject + # # ); + # ffi_lib :advapi32 + # attach_function_private :CloseServiceHandle, + # [:handle], :win32_bool + + # # https://docs.microsoft.com/en-us/windows/desktop/api/winsvc/nf-winsvc-queryservicestatusex + # # BOOL QueryServiceStatusEx( + # # SC_HANDLE hService, + # # SC_STATUS_TYPE InfoLevel, + # # LPBYTE lpBuffer, + # # DWORD cbBufSize, + # # LPDWORD pcbBytesNeeded + # # ); + # SC_STATUS_TYPE = enum( + # :SC_STATUS_PROCESS_INFO, 0, + # ) + # ffi_lib :advapi32 + # attach_function_private :QueryServiceStatusEx, + # [:handle, SC_STATUS_TYPE, :lpbyte, :dword, :lpdword], :win32_bool + + # # https://docs.microsoft.com/en-us/windows/desktop/api/Winsvc/nf-winsvc-queryserviceconfigw + # # BOOL QueryServiceConfigW( + # # SC_HANDLE hService, + # # LPQUERY_SERVICE_CONFIGW lpServiceConfig, + # # DWORD cbBufSize, + # # LPDWORD pcbBytesNeeded + # # ); + # ffi_lib :advapi32 + # attach_function_private :QueryServiceConfigW, + # [:handle, :lpbyte, :dword, :lpdword], :win32_bool + + # # https://docs.microsoft.com/en-us/windows/win32/api/winsvc/nf-winsvc-queryserviceconfig2w + # # BOOL QueryServiceConfig2W( + # # SC_HANDLE hService, + # # DWORD dwInfoLevel, + # # LPBYTE lpBuffer, + # # DWORD cbBufSize, + # # LPDWORD pcbBytesNeeded + # # ); + # ffi_lib :advapi32 + # attach_function_private :QueryServiceConfig2W, + # [:handle, :dword, :lpbyte, :dword, :lpdword], :win32_bool + + # # https://docs.microsoft.com/en-us/windows/desktop/api/Winsvc/nf-winsvc-startservicew + # # BOOL StartServiceW( + # # SC_HANDLE hService, + # # DWORD dwNumServiceArgs, + # # LPCWSTR *lpServiceArgVectors + # # ); + # ffi_lib :advapi32 + # attach_function_private :StartServiceW, + # [:handle, :dword, :pointer], :win32_bool + + # # https://docs.microsoft.com/en-us/windows/win32/api/winsvc/nf-winsvc-startservicectrldispatcherw + # # BOOL StartServiceCtrlDispatcherW( + # # const SERVICE_TABLE_ENTRYW *lpServiceStartTable + # # ); + # ffi_lib :advapi32 + # attach_function_private :StartServiceCtrlDispatcherW, + # [:pointer], :win32_bool, :blocking => true + + # # https://docs.microsoft.com/en-us/windows/win32/api/winsvc/nf-winsvc-setservicestatus + # # BOOL SetServiceStatus( + # # SERVICE_STATUS_HANDLE hServiceStatus, + # # LPSERVICE_STATUS lpServiceStatus + # # ); + # ffi_lib :advapi32 + # attach_function_private :SetServiceStatus, + # [:handle, :pointer], :win32_bool + + # # https://docs.microsoft.com/en-us/windows/desktop/api/winsvc/nf-winsvc-controlservice + # # BOOL ControlService( + # # SC_HANDLE hService, + # # DWORD dwControl, + # # LPSERVICE_STATUS lpServiceStatus + # # ); + # ffi_lib :advapi32 + # attach_function_private :ControlService, + # [:handle, :dword, :pointer], :win32_bool + + # # DWORD LphandlerFunctionEx( + # # DWORD dwControl, + # # DWORD dwEventType, + # # LPVOID lpEventData, + # # LPVOID lpContext + # # ) + # callback :handler_ex, [:dword, :dword, :lpvoid, :lpvoid], :void + + # # https://docs.microsoft.com/en-us/windows/win32/api/winsvc/nf-winsvc-registerservicectrlhandlerexw + # # SERVICE_STATUS_HANDLE RegisterServiceCtrlHandlerExW( + # # LPCWSTR lpServiceName, + # # LPHANDLER_FUNCTION_EX lpHandlerProc, + # # LPVOID lpContext + # # ); + # ffi_lib :advapi32 + # attach_function_private :RegisterServiceCtrlHandlerExW, + # [:lpcwstr, :handler_ex, :lpvoid], :handle + + # # https://docs.microsoft.com/en-us/windows/desktop/api/winsvc/nf-winsvc-changeserviceconfigw + # # BOOL ChangeServiceConfigW( + # # SC_HANDLE hService, + # # DWORD dwServiceType, + # # DWORD dwStartType, + # # DWORD dwErrorControl, + # # LPCWSTR lpBinaryPathName, + # # LPCWSTR lpLoadOrderGroup, + # # LPDWORD lpdwTagId, + # # LPCWSTR lpDependencies, + # # LPCWSTR lpServiceStartName, + # # LPCWSTR lpPassword, + # # LPCWSTR lpDisplayName + # # ); + # ffi_lib :advapi32 + # attach_function_private :ChangeServiceConfigW, + # [ + # :handle, + # :dword, + # :dword, + # :dword, + # :lpcwstr, + # :lpcwstr, + # :lpdword, + # :lpcwstr, + # :lpcwstr, + # :lpcwstr, + # :lpcwstr + # ], :win32_bool + + # # https://docs.microsoft.com/en-us/windows/win32/api/winsvc/nf-winsvc-changeserviceconfig2w + # # BOOL ChangeServiceConfig2W( + # # SC_HANDLE hService, + # # DWORD dwInfoLevel, + # # LPVOID lpInfo + # # ); + # ffi_lib :advapi32 + # attach_function_private :ChangeServiceConfig2W, + # [:handle, :dword, :lpvoid], :win32_bool + + # # https://docs.microsoft.com/en-us/windows/desktop/api/winsvc/nf-winsvc-enumservicesstatusexw + # # BOOL EnumServicesStatusExW( + # # SC_HANDLE hSCManager, + # # SC_ENUM_TYPE InfoLevel, + # # DWORD dwServiceType, + # # DWORD dwServiceState, + # # LPBYTE lpServices, + # # DWORD cbBufSize, + # # LPDWORD pcbBytesNeeded, + # # LPDWORD lpServicesReturned, + # # LPDWORD lpResumeHandle, + # # LPCWSTR pszGroupName + # # ); + # SC_ENUM_TYPE = enum( + # :SC_ENUM_PROCESS_INFO, 0, # ) - callback :handler_ex, [:dword, :dword, :lpvoid, :lpvoid], :void - - # https://docs.microsoft.com/en-us/windows/win32/api/winsvc/nf-winsvc-registerservicectrlhandlerexw - # SERVICE_STATUS_HANDLE RegisterServiceCtrlHandlerExW( - # LPCWSTR lpServiceName, - # LPHANDLER_FUNCTION_EX lpHandlerProc, - # LPVOID lpContext - # ); - ffi_lib :advapi32 - attach_function_private :RegisterServiceCtrlHandlerExW, - [:lpcwstr, :handler_ex, :lpvoid], :handle - - # https://docs.microsoft.com/en-us/windows/desktop/api/winsvc/nf-winsvc-changeserviceconfigw - # BOOL ChangeServiceConfigW( - # SC_HANDLE hService, - # DWORD dwServiceType, - # DWORD dwStartType, - # DWORD dwErrorControl, - # LPCWSTR lpBinaryPathName, - # LPCWSTR lpLoadOrderGroup, - # LPDWORD lpdwTagId, - # LPCWSTR lpDependencies, - # LPCWSTR lpServiceStartName, - # LPCWSTR lpPassword, - # LPCWSTR lpDisplayName - # ); - ffi_lib :advapi32 - attach_function_private :ChangeServiceConfigW, - [ - :handle, - :dword, - :dword, - :dword, - :lpcwstr, - :lpcwstr, - :lpdword, - :lpcwstr, - :lpcwstr, - :lpcwstr, - :lpcwstr - ], :win32_bool - - # https://docs.microsoft.com/en-us/windows/win32/api/winsvc/nf-winsvc-changeserviceconfig2w - # BOOL ChangeServiceConfig2W( - # SC_HANDLE hService, - # DWORD dwInfoLevel, - # LPVOID lpInfo - # ); - ffi_lib :advapi32 - attach_function_private :ChangeServiceConfig2W, - [:handle, :dword, :lpvoid], :win32_bool - - # https://docs.microsoft.com/en-us/windows/desktop/api/winsvc/nf-winsvc-enumservicesstatusexw - # BOOL EnumServicesStatusExW( - # SC_HANDLE hSCManager, - # SC_ENUM_TYPE InfoLevel, - # DWORD dwServiceType, - # DWORD dwServiceState, - # LPBYTE lpServices, - # DWORD cbBufSize, - # LPDWORD pcbBytesNeeded, - # LPDWORD lpServicesReturned, - # LPDWORD lpResumeHandle, - # LPCWSTR pszGroupName - # ); - SC_ENUM_TYPE = enum( - :SC_ENUM_PROCESS_INFO, 0, - ) - ffi_lib :advapi32 - attach_function_private :EnumServicesStatusExW, - [ - :handle, - SC_ENUM_TYPE, - :dword, - :dword, - :lpbyte, - :dword, - :lpdword, - :lpdword, - :lpdword, - :lpcwstr - ], :win32_bool + # ffi_lib :advapi32 + # attach_function_private :EnumServicesStatusExW, + # [ + # :handle, + # SC_ENUM_TYPE, + # :dword, + # :dword, + # :lpbyte, + # :dword, + # :lpdword, + # :lpdword, + # :lpdword, + # :lpcwstr + # ], :win32_bool end end diff --git a/spec/unit/settings/priority_setting_spec.rb b/spec/unit/settings/priority_setting_spec.rb index bdd2458dd83..40ef8b6964b 100644 --- a/spec/unit/settings/priority_setting_spec.rb +++ b/spec/unit/settings/priority_setting_spec.rb @@ -52,10 +52,10 @@ describe "on a Windows-like platform it", :if => Puppet::Util::Platform.windows? do it "parses high, normal, low, and idle priorities" do { - 'high' => Puppet::Util::Windows::Process::HIGH_PRIORITY_CLASS, - 'normal' => Puppet::Util::Windows::Process::NORMAL_PRIORITY_CLASS, - 'low' => Puppet::Util::Windows::Process::BELOW_NORMAL_PRIORITY_CLASS, - 'idle' => Puppet::Util::Windows::Process::IDLE_PRIORITY_CLASS + 'high' => Puppet::FFI::Windows::Constants::HIGH_PRIORITY_CLASS, + 'normal' => Puppet::FFI::Windows::Constants::NORMAL_PRIORITY_CLASS, + 'low' => Puppet::FFI::Windows::Constants::BELOW_NORMAL_PRIORITY_CLASS, + 'idle' => Puppet::FFI::Windows::Constants::IDLE_PRIORITY_CLASS }.each do |value, converted_value| expect(setting.munge(value)).to eq(converted_value) end From 94ce5345da413158612e31229d7899778df730fb Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Tue, 18 Aug 2020 10:42:30 -0700 Subject: [PATCH 079/731] (PUP-10472) Remove Puppet.define_settings Settings are registered by calling Puppet::Settings#define_settings, so remove the deprecated Puppet.define_settings method. --- lib/puppet.rb | 6 ------ 1 file changed, 6 deletions(-) diff --git a/lib/puppet.rb b/lib/puppet.rb index e861b9ca6ea..61502af818c 100644 --- a/lib/puppet.rb +++ b/lib/puppet.rb @@ -97,12 +97,6 @@ def self.[](param) # Load the base features. require 'puppet/feature/base' - # Store a new default value. - def self.define_settings(section, hash) - Puppet.deprecation_warning('The method Puppet.define_settings is deprecated and will be removed in a future release') - @@settings.define_settings(section, hash) - end - # setting access and stuff def self.[]=(param,value) @@settings[param] = value From 2ddb9bbb96bdc016a4231585b8b968e35862c941 Mon Sep 17 00:00:00 2001 From: Ciprian Badescu Date: Wed, 19 Aug 2020 16:43:25 +0300 Subject: [PATCH 080/731] (PUP-10474) Remove deprecated Puppet::Resource methods * Puppet::Resource.set_default_parameters * Puppet::Resource.validate_complete * Puppet::Resource::Type.assign_parameter_values --- lib/puppet/resource.rb | 63 ------------------------------------- lib/puppet/resource/type.rb | 15 --------- spec/unit/resource_spec.rb | 56 --------------------------------- 3 files changed, 134 deletions(-) diff --git a/lib/puppet/resource.rb b/lib/puppet/resource.rb index 0b8f9fb3abd..cff329c1531 100644 --- a/lib/puppet/resource.rb +++ b/lib/puppet/resource.rb @@ -515,38 +515,6 @@ def missing_arguments end private :missing_arguments - # @deprecated Not used by Puppet - # @api private - def set_default_parameters(scope) - Puppet.deprecation_warning(_('The method Puppet::Resource.set_default_parameters is deprecated and will be removed in the next major release of Puppet.')) - - return [] unless resource_type and resource_type.respond_to?(:arguments) - - unless is_a?(Puppet::Parser::Resource) - fail Puppet::DevError, _("Cannot evaluate default parameters for %{resource} - not a parser resource") % { resource: self } - end - - missing_arguments.collect do |param, default| - rtype = resource_type - if rtype.type == :hostclass - using_bound_value = false - catch(:no_such_key) do - bound_value = Puppet::Pops::Lookup.search_and_merge("#{rtype.name}::#{param}", Puppet::Pops::Lookup::Invocation.new(scope), nil) - # Assign bound value but don't let an undef trump a default expression - unless bound_value.nil? && !default.nil? - self[param.to_sym] = bound_value - using_bound_value = true - end - end - end - unless using_bound_value - next if default.nil? - self[param.to_sym] = default.safeevaluate(scope) - end - param - end.compact - end - def copy_as_resource Puppet::Resource.new(self) end @@ -555,37 +523,6 @@ def valid_parameter?(name) resource_type.valid_parameter?(name) end - # Verify that all required arguments are either present or - # have been provided with defaults. - # Must be called after 'set_default_parameters'. We can't join the methods - # because Type#set_parameters needs specifically ordered behavior. - # - # @deprecated Not used by Puppet - # @api private - def validate_complete - Puppet.deprecation_warning(_('The method Puppet::Resource.validate_complete is deprecated and will be removed in the next major release of Puppet.')) - - return unless resource_type and resource_type.respond_to?(:arguments) - - resource_type.arguments.each do |param, default| - param = param.to_sym - fail Puppet::ParseError, _("Must pass %{param} to %{resource}") % { param: param, resource: self } unless parameters.include?(param) - end - - # Perform optional type checking - arg_types = resource_type.argument_types - # Parameters is a map from name, to parameter, and the parameter again has name and value - parameters.each do |name, value| - t = arg_types[name.to_s] # untyped, and parameters are symbols here (aargh, strings in the type) - next unless t - unless Puppet::Pops::Types::TypeCalculator.instance?(t, value.value) - inferred_type = Puppet::Pops::Types::TypeCalculator.infer_set(value.value) - actual = inferred_type.generalize() - fail Puppet::ParseError, _("Expected parameter '%{name}' of '%{value0}' to have type %{value1}, got %{value2}") % { name: name, value0: self, value1: t.to_s, value2: actual.to_s } - end - end - end - def validate_parameter(name) raise Puppet::ParseError.new(_("no parameter named '%{name}'") % { name: name }, file, line) unless valid_parameter?(name) end diff --git a/lib/puppet/resource/type.rb b/lib/puppet/resource/type.rb index 37fd4ec78bc..2ce2e577a4d 100644 --- a/lib/puppet/resource/type.rb +++ b/lib/puppet/resource/type.rb @@ -288,21 +288,6 @@ def name_is_regex? @name.is_a?(Regexp) end - # @deprecated Not used by Puppet - # @api private - def assign_parameter_values(parameters, resource) - Puppet.deprecation_warning(_('The method Puppet::Resource::Type.assign_parameter_values is deprecated and will be removed in the next major release of Puppet.')) - - return unless parameters - - # It'd be nice to assign default parameter values here, - # but we can't because they often rely on local variables - # created during set_resource_parameters. - parameters.each do |name, value| - resource.set_parameter name, value - end - end - def parent_type(scope = nil) return nil unless parent diff --git a/spec/unit/resource_spec.rb b/spec/unit/resource_spec.rb index ea0b6cd9b8c..06f11300d0c 100644 --- a/spec/unit/resource_spec.rb +++ b/spec/unit/resource_spec.rb @@ -286,39 +286,6 @@ def ast_leaf(value) Puppet::Parser::AST::Leaf.new(value: value) end - it "should fail when asked to set default values and it is not a parser resource" do - environment.known_resource_types.add( - Puppet::Resource::Type.new(:definition, "default_param", :arguments => {"a" => ast_leaf("default")}) - ) - resource = Puppet::Resource.new("default_param", "name", :environment => environment) - expect { resource.set_default_parameters(scope) }.to raise_error(Puppet::DevError) - end - - it "should evaluate and set any default values when no value is provided" do - environment.known_resource_types.add( - Puppet::Resource::Type.new(:definition, "default_param", :arguments => {"a" => ast_leaf("a_default_value")}) - ) - resource = Puppet::Parser::Resource.new("default_param", "name", :scope => scope) - resource.set_default_parameters(scope) - expect(resource["a"]).to eq("a_default_value") - end - - it "should skip attributes with no default value" do - environment.known_resource_types.add( - Puppet::Resource::Type.new(:definition, "no_default_param", :arguments => {"a" => ast_leaf("a_default_value")}) - ) - resource = Puppet::Parser::Resource.new("no_default_param", "name", :scope => scope) - expect { resource.set_default_parameters(scope) }.not_to raise_error - end - - it "should return the list of default parameters set" do - environment.known_resource_types.add( - Puppet::Resource::Type.new(:definition, "default_param", :arguments => {"a" => ast_leaf("a_default_value")}) - ) - resource = Puppet::Parser::Resource.new("default_param", "name", :scope => scope) - expect(resource.set_default_parameters(scope)).to eq(["a"]) - end - describe "when the resource type is :hostclass" do let(:environment_name) { "testing env" } let(:fact_values) { { :a => 1 } } @@ -405,7 +372,6 @@ def inject_and_set_defaults(resource, scope) it "should use the value provided" do expect(Puppet::DataBinding.indirection).not_to receive(:find) - expect(resource.set_default_parameters(scope)).to eq([]) expect(resource[:port]).to eq('8080') end @@ -447,28 +413,6 @@ def inject_and_set_defaults(resource, scope) end end - describe "when validating all required parameters are present" do - it "should be able to validate that all required parameters are present" do - environment.known_resource_types.add( - Puppet::Resource::Type.new(:definition, "required_param", :arguments => {"a" => nil}) - ) - expect { Puppet::Resource.new("required_param", "name", :environment => environment).validate_complete }.to raise_error(Puppet::ParseError) - end - - it "should not fail when all required parameters are present" do - environment.known_resource_types.add( - Puppet::Resource::Type.new(:definition, "no_required_param") - ) - resource = Puppet::Resource.new("no_required_param", "name", :environment => environment) - resource["a"] = "meh" - expect { resource.validate_complete }.not_to raise_error - end - - it "should not validate against builtin types" do - expect { Puppet::Resource.new("file", "/bar").validate_complete }.not_to raise_error - end - end - describe "when referring to a resource with name canonicalization" do it "should canonicalize its own name" do res = Puppet::Resource.new("file", "/path/") From c439b29d8404fe7bd77e0faa69b7ad54f39862f7 Mon Sep 17 00:00:00 2001 From: Dorin Pleava Date: Tue, 18 Aug 2020 17:50:09 +0300 Subject: [PATCH 081/731] (PUP-10606) Daemon.rb file --- lib/puppet/util/windows/daemon.rb | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/puppet/util/windows/daemon.rb b/lib/puppet/util/windows/daemon.rb index cd9fc9fabe5..185afbd7d14 100644 --- a/lib/puppet/util/windows/daemon.rb +++ b/lib/puppet/util/windows/daemon.rb @@ -1,15 +1,20 @@ -require 'puppet/util/windows' require 'ffi' +require 'puppet/ffi/windows/constants' +require 'puppet/ffi/windows/structs' +require 'puppet/ffi/windows/functions' module Puppet::Util::Windows # The Daemon class, based on the chef/win32-service implementation class Daemon - include Puppet::Util::Windows::Service - include Puppet::Util::Windows::Process + include Puppet::FFI::Windows::Constants + extend Puppet::FFI::Windows::Constants - extend Puppet::Util::Windows::Service - extend Puppet::Util::Windows::Process + include Puppet::FFI::Windows::Structs + extend Puppet::FFI::Windows::Structs + + include Puppet::FFI::Windows::Functions + extend Puppet::FFI::Windows::Functions # Service is not running STOPPED = SERVICE_STOPPED From 6845a57b96f47a351ef0d56458664088133f98e6 Mon Sep 17 00:00:00 2001 From: Gabriel Nagy Date: Wed, 19 Aug 2020 17:41:35 +0300 Subject: [PATCH 082/731] (PUP-10625) Bump minimum Ruby version for puppet7 Puppet 7 will no longer support versions of Ruby that reached end-of-life (2.3 reached EOL on 2019-03-31 and 2.4 on 2020-03-31). Remove them and increase the minimum allowed Ruby version. See: https://www.ruby-lang.org/en/downloads/branches/ --- .gemspec | 2 +- .travis.yml | 6 ------ appveyor.yml | 2 -- ext/project_data.yaml | 2 +- lib/puppet.rb | 6 +++--- 5 files changed, 5 insertions(+), 13 deletions(-) diff --git a/.gemspec b/.gemspec index 8d5f559a559..ba06deedebe 100644 --- a/.gemspec +++ b/.gemspec @@ -18,7 +18,7 @@ Gem::Specification.new do |s| s.version = mdata ? mdata[1] : version s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") - s.required_ruby_version = Gem::Requirement.new(">= 2.3.0") + s.required_ruby_version = Gem::Requirement.new(">= 2.5.0") s.authors = ["Puppet Labs"] s.date = "2012-08-17" s.description = "Puppet, an automated configuration management tool" diff --git a/.travis.yml b/.travis.yml index b494f274a17..f69bb42c2d5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,12 +10,6 @@ notifications: matrix: include: - - rvm: 2.3 - env: "CHECK=parallel:spec\\[2\\]" - - - rvm: 2.4 - env: "CHECK=parallel:spec\\[2\\]" - - rvm: 2.5 env: "CHECK=parallel:spec\\[2\\]" diff --git a/appveyor.yml b/appveyor.yml index 996f4f633e6..fd53d99e9cb 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -14,8 +14,6 @@ matrix: platform: - Ruby26-x64 - Ruby25-x64 - - Ruby24-x64 - - Ruby23-x64 # Note that locales are mainly code page changes and are not the FULL set of localization # changes that happen when you install French/Germam/Japanese etc. Windows diff --git a/ext/project_data.yaml b/ext/project_data.yaml index 6efbeae9057..3545c644deb 100644 --- a/ext/project_data.yaml +++ b/ext/project_data.yaml @@ -14,7 +14,7 @@ gem_test_files: 'spec/**/*' gem_executables: 'puppet' gem_default_executables: 'puppet' gem_forge_project: 'puppet' -gem_required_ruby_version: '>= 2.3.0' +gem_required_ruby_version: '>= 2.5.0' gem_required_rubygems_version: '> 1.3.1' gem_runtime_dependencies: facter: ['> 2.0.1', '< 5'] diff --git a/lib/puppet.rb b/lib/puppet.rb index 61502af818c..f726358a249 100644 --- a/lib/puppet.rb +++ b/lib/puppet.rb @@ -1,11 +1,11 @@ require 'puppet/version' require 'puppet/concurrent/synchronized' -if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new("2.3.0") - raise LoadError, "Puppet #{Puppet.version} requires Ruby 2.3.0 or greater, found Ruby #{RUBY_VERSION.dup}." +if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new("2.5.0") + raise LoadError, "Puppet #{Puppet.version} requires Ruby 2.5.0 or greater, found Ruby #{RUBY_VERSION.dup}." end -Puppet::OLDEST_RECOMMENDED_RUBY_VERSION = '2.3.0' +Puppet::OLDEST_RECOMMENDED_RUBY_VERSION = '2.5.0' $LOAD_PATH.extend(Puppet::Concurrent::Synchronized) From c9e2afa3f70d4bbc6081e998e9eac9a7031e26e5 Mon Sep 17 00:00:00 2001 From: Ciprian Badescu Date: Thu, 20 Aug 2020 10:20:40 +0300 Subject: [PATCH 083/731] (PUP-7584) Remove deprecated execfail method --- lib/puppet/provider.rb | 13 ------------- lib/puppet/util/execution.rb | 11 ----------- spec/unit/provider_spec.rb | 12 ------------ spec/unit/util/execution_spec.rb | 29 ----------------------------- 4 files changed, 65 deletions(-) diff --git a/lib/puppet/provider.rb b/lib/puppet/provider.rb index ac156bd9c4e..0cfd86b5879 100644 --- a/lib/puppet/provider.rb +++ b/lib/puppet/provider.rb @@ -117,19 +117,6 @@ def self.execpipe(*args, &block) Puppet::Util::Execution.execpipe(*args, &block) end - # Convenience methods - see class method with the same name. - # @return (see self.execfail) - # @deprecated - def execfail(*args) - Puppet::Util::Execution.execfail(*args) - end - - # (see Puppet::Util::Execution.execfail) - # @deprecated - def self.execfail(*args) - Puppet::Util::Execution.execfail(*args) - end - # Returns the absolute path to the executable for the command referenced by the given name. # @raise [Puppet::DevError] if the name does not reference an existing command. # @return [String] the absolute path to the found executable for the command diff --git a/lib/puppet/util/execution.rb b/lib/puppet/util/execution.rb index 5f78777ceea..e3e3916d412 100644 --- a/lib/puppet/util/execution.rb +++ b/lib/puppet/util/execution.rb @@ -94,17 +94,6 @@ def self.exitstatus end private_class_method :exitstatus - # Wraps execution of {execute} with mapping of exception to given exception (and output as argument). - # @raise [exception] under same conditions as {execute}, but raises the given `exception` with the output as argument - # @return (see execute) - # @api public - # @deprecated - def self.execfail(command, exception) - execute(command) - rescue Puppet::ExecutionFailure => detail - raise exception, detail.message, detail.backtrace - end - # Default empty options for {execute} NoOptionsSpecified = {} diff --git a/spec/unit/provider_spec.rb b/spec/unit/provider_spec.rb index 6a1aa681c1a..697a7338821 100644 --- a/spec/unit/provider_spec.rb +++ b/spec/unit/provider_spec.rb @@ -670,18 +670,6 @@ def existing_command provider.send(:execpipe, "a_command", true, block) end - - it "delegates instance execfail to Puppet::Util::Execution" do - expect(Puppet::Util::Execution).to receive(:execfail).with("a_command", "an exception to raise") - - provider.new.send(:execfail, "a_command", "an exception to raise") - end - - it "delegates class execfail to Puppet::Util::Execution" do - expect(Puppet::Util::Execution).to receive(:execfail).with("a_command", "an exception to raise") - - provider.send(:execfail, "a_command", "an exception to raise") - end end context "mk_resource_methods" do diff --git a/spec/unit/util/execution_spec.rb b/spec/unit/util/execution_spec.rb index 850ae0f652c..5c64cb60e39 100644 --- a/spec/unit/util/execution_spec.rb +++ b/spec/unit/util/execution_spec.rb @@ -935,33 +935,4 @@ def expect_cwd_to_be(cwd) expect(Puppet::Util::Execution.execpipe('echo hello', false)).to eq('error message') end end - - describe "execfail" do - it "returns the executed command output" do - allow(Puppet::Util::Execution).to receive(:execute) - .and_return(Puppet::Util::Execution::ProcessOutput.new("process output", 0)) - expect(Puppet::Util::Execution.execfail('echo hello', Puppet::Error)).to eq('process output') - end - - it "raises a caller-specified exception on failure with the backtrace" do - allow(Puppet::Util::Execution).to receive(:execute).and_raise(Puppet::ExecutionFailure, "failed to execute") - expect { - Puppet::Util::Execution.execfail("this will fail", Puppet::Error) - }.to raise_error(Puppet::Error, /failed to execute/) - end - - it "raises exceptions that don't extend ExecutionFailure" do - allow(Puppet::Util::Execution).to receive(:execute).and_raise(ArgumentError, "failed to execute") - expect { - Puppet::Util::Execution.execfail("this will fail", Puppet::Error) - }.to raise_error(ArgumentError, /failed to execute/) - end - - it "raises a TypeError if the exception class is nil" do - allow(Puppet::Util::Execution).to receive(:execute).and_raise(Puppet::ExecutionFailure, "failed to execute") - expect { - Puppet::Util::Execution.execfail('echo hello', nil) - }.to raise_error(TypeError, /exception class\/object expected/) - end - end end From 8e53afb395e9810c00982106fa22bc72b3a20665 Mon Sep 17 00:00:00 2001 From: Ciprian Badescu Date: Wed, 19 Aug 2020 16:03:44 +0300 Subject: [PATCH 084/731] (PUP-10387) Remove puppet module build, generate and search actions --- lib/puppet/face/module/build.rb | 14 -- lib/puppet/face/module/generate.rb | 14 -- lib/puppet/face/module/search.rb | 103 -------- lib/puppet/module_tool/applications.rb | 1 - .../module_tool/applications/searcher.rb | 29 --- spec/unit/face/module/search_spec.rb | 231 ------------------ .../module_tool/applications/searcher_spec.rb | 38 --- 7 files changed, 430 deletions(-) delete mode 100644 lib/puppet/face/module/build.rb delete mode 100644 lib/puppet/face/module/generate.rb delete mode 100644 lib/puppet/face/module/search.rb delete mode 100644 lib/puppet/module_tool/applications/searcher.rb delete mode 100644 spec/unit/face/module/search_spec.rb delete mode 100644 spec/unit/module_tool/applications/searcher_spec.rb diff --git a/lib/puppet/face/module/build.rb b/lib/puppet/face/module/build.rb deleted file mode 100644 index f7bd07d345d..00000000000 --- a/lib/puppet/face/module/build.rb +++ /dev/null @@ -1,14 +0,0 @@ -Puppet::Face.define(:module, '1.0.0') do - action(:build) do - summary _("Build a module release package.") - #TRANSLATORS 'Puppet Development Kit' is the name of the software package replacing this action and should not be translated. - description _("This action has been replaced by Puppet Development Kit. For more information visit https://puppet.com/docs/pdk/latest/pdk.html.") - - when_invoked do |*args| - #TRANSLATORS 'Puppet Development Kit' is the name of the software package replacing this action and should not be translated. - raise _("This action has been replaced by Puppet Development Kit. For more information visit https://puppet.com/docs/pdk/latest/pdk.html.") - end - - deprecate - end -end diff --git a/lib/puppet/face/module/generate.rb b/lib/puppet/face/module/generate.rb deleted file mode 100644 index 690a79d2ae9..00000000000 --- a/lib/puppet/face/module/generate.rb +++ /dev/null @@ -1,14 +0,0 @@ -Puppet::Face.define(:module, '1.0.0') do - action(:generate) do - summary _("Generate boilerplate for a new module.") - #TRANSLATORS 'Puppet Development Kit' is the name of the software package replacing this action and should not be translated. - description _("This action has been replaced by Puppet Development Kit. For more information visit https://puppet.com/docs/pdk/latest/pdk.html.") - - when_invoked do |*args| - #TRANSLATORS 'Puppet Development Kit' is the name of the software package replacing this action and should not be translated. - raise _("This action has been replaced by Puppet Development Kit. For more information visit https://puppet.com/docs/pdk/latest/pdk.html.") - end - - deprecate - end -end diff --git a/lib/puppet/face/module/search.rb b/lib/puppet/face/module/search.rb deleted file mode 100644 index c1a14d3dc72..00000000000 --- a/lib/puppet/face/module/search.rb +++ /dev/null @@ -1,103 +0,0 @@ -require 'puppet/util/terminal' -require 'puppet/forge' - -Puppet::Face.define(:module, '1.0.0') do - action(:search) do - summary _("Search the Puppet Forge for a module.") - description <<-EOT - This action has been deprecated. Please use the Puppet Forge to search for modules. - - Searches a repository for modules whose names, descriptions, or keywords - match the provided search term. - EOT - - returns _("Array of module metadata hashes") - - examples <<-EOT - Search the Puppet Forge for a module: - - $ puppet module search puppetlabs - NAME DESCRIPTION AUTHOR KEYWORDS - bacula This is a generic Apache module @puppetlabs backups - EOT - - arguments _("") - - when_invoked do |term, options| - Puppet.deprecation_warning(_("This action has been deprecated. Please use the Puppet Forge to search for modules.")) - Puppet::ModuleTool.set_option_defaults options - Puppet::ModuleTool::Applications::Searcher.new(term, Puppet::Forge.new(options[:module_repository] || Puppet[:module_repository]), options).run - end - - when_rendering :console do |results, term, options| - if results[:result] == :failure - raise results[:error][:multiline] - end - - return _("No results found for '%{term}'.") % { term: term } if results[:answers].empty? - - padding = ' ' - headers = { - 'full_name' => 'NAME', - 'desc' => 'DESCRIPTION', - 'author' => 'AUTHOR', - 'tag_list' => 'KEYWORDS', - } - - min_widths = Hash[ *headers.map { |k,v| [k, v.length] }.flatten ] - min_widths['full_name'] = min_widths['author'] = 12 - - min_width = min_widths.inject(0) { |sum,pair| sum + pair.last } + (padding.length * (headers.length - 1)) - - terminal_width = [Puppet::Util::Terminal.width, min_width].max - - columns = results[:answers].inject(min_widths) do |hash, result| - deprecated_buffer = result['deprecated_at'].nil? ? 0 : 11 # ' DEPRECATED'.length - - { - 'full_name' => [ hash['full_name'], result['full_name'].length + deprecated_buffer ].max, - 'desc' => [ hash['desc'], result['desc'].length ].max, - 'author' => [ hash['author'], "@#{result['author']}".length ].max, - 'tag_list' => [ hash['tag_list'], result['tag_list'].join(' ').length ].max, - } - end - - flex_width = terminal_width - columns['full_name'] - columns['author'] - (padding.length * (headers.length - 1)) - tag_lists = results[:answers].map { |r| r['tag_list'] } - - while (columns['tag_list'] > flex_width / 3) - longest_tag_list = tag_lists.sort_by { |tl| tl.join(' ').length }.last - break if [ [], [term] ].include? longest_tag_list - longest_tag_list.delete(longest_tag_list.sort_by { |t| t == term ? -1 : t.length }.last) - columns['tag_list'] = tag_lists.map { |tl| tl.join(' ').length }.max - end - - columns['tag_list'] = [ - flex_width / 3, - tag_lists.map { |tl| tl.join(' ').length }.max, - ].max - columns['desc'] = flex_width - columns['tag_list'] - - format = %w{full_name desc author tag_list}.map do |k| - "%-#{ [ columns[k], min_widths[k] ].max }s" - end.join(padding) + "\n" - - highlight = proc do |s| - s = s.gsub(term, colorize(:green, term)) - s = s.gsub(term.tr('/', '-'), colorize(:green, term.tr('/', '-'))) if term =~ /\// - s = s.gsub(' DEPRECATED', colorize(:red, ' DEPRECATED')) - s - end - - format % [ headers['full_name'], headers['desc'], headers['author'], headers['tag_list'] ] + - results[:answers].map do |match| - name, desc, author, keywords = %w{full_name desc author tag_list}.map { |k| match[k] } - name += ' DEPRECATED' unless match['deprecated_at'].nil? - desc = desc[0...(columns['desc'] - 3)] + '...' if desc.length > columns['desc'] - highlight[format % [ name.sub('/', '-'), desc, "@#{author}", [keywords].flatten.join(' ') ]] - end.join - end - - deprecate - end -end diff --git a/lib/puppet/module_tool/applications.rb b/lib/puppet/module_tool/applications.rb index 1db8c1d8971..9591f129692 100644 --- a/lib/puppet/module_tool/applications.rb +++ b/lib/puppet/module_tool/applications.rb @@ -5,7 +5,6 @@ module Applications require 'puppet/module_tool/applications/application' require 'puppet/module_tool/applications/checksummer' require 'puppet/module_tool/applications/installer' - require 'puppet/module_tool/applications/searcher' require 'puppet/module_tool/applications/unpacker' require 'puppet/module_tool/applications/uninstaller' require 'puppet/module_tool/applications/upgrader' diff --git a/lib/puppet/module_tool/applications/searcher.rb b/lib/puppet/module_tool/applications/searcher.rb deleted file mode 100644 index 24dadf6fc41..00000000000 --- a/lib/puppet/module_tool/applications/searcher.rb +++ /dev/null @@ -1,29 +0,0 @@ -module Puppet::ModuleTool - module Applications - class Searcher < Application - include Puppet::Forge::Errors - - def initialize(term, forge, options = {}) - @term = term - @forge = forge - super(options) - end - - def run - results = {} - begin - Puppet.notice _("Searching %{host} ...") % { host: @forge.host } - results[:answers] = @forge.search(@term) - results[:result] = :success - rescue ForgeError => e - results[:result] = :failure - results[:error] = { - :oneline => e.message, - :multiline => e.multiline, - } - end - results - end - end - end -end diff --git a/spec/unit/face/module/search_spec.rb b/spec/unit/face/module/search_spec.rb deleted file mode 100644 index 633060f3cb8..00000000000 --- a/spec/unit/face/module/search_spec.rb +++ /dev/null @@ -1,231 +0,0 @@ -require 'spec_helper' -require 'puppet/face' -require 'puppet/application/module' -require 'puppet/module_tool' - -describe "puppet module search" do - subject { Puppet::Face[:module, :current] } - - let(:options) do - {} - end - - describe Puppet::Application::Module do - subject do - app = Puppet::Application::Module.new - allow(app).to receive(:action).and_return(Puppet::Face.find_action(:module, :search)) - app - end - - before do - subject.render_as = :console - allow(Puppet::Util::Terminal).to receive(:width).and_return(100) - end - - it 'should output nothing when receiving an empty dataset' do - expect(subject.render({:answers => [], :result => :success}, ['apache', {}])).to eq("No results found for 'apache'.") - end - - it 'should return error and exit when error returned' do - results = { - :result => :failure, - :error => { - :oneline => 'Something failed', - :multiline => 'Something failed', - } - } - expect { subject.render(results, ['apache', {}]) }.to raise_error 'Something failed' - end - - it 'should output a header when receiving a non-empty dataset' do - results = { - :result => :success, - :answers => [ - {'full_name' => '', 'author' => '', 'desc' => '', 'tag_list' => [] }, - ], - } - - expect(subject.render(results, ['apache', {}])).to match(/NAME/) - expect(subject.render(results, ['apache', {}])).to match(/DESCRIPTION/) - expect(subject.render(results, ['apache', {}])).to match(/AUTHOR/) - expect(subject.render(results, ['apache', {}])).to match(/KEYWORDS/) - end - - it 'should output the relevant fields when receiving a non-empty dataset' do - results = { - :result => :success, - :answers => [ - {'full_name' => 'Name', 'author' => 'Author', 'desc' => 'Summary', 'tag_list' => ['tag1', 'tag2'] }, - ] - } - - expect(subject.render(results, ['apache', {}])).to match(/Name/) - expect(subject.render(results, ['apache', {}])).to match(/Author/) - expect(subject.render(results, ['apache', {}])).to match(/Summary/) - expect(subject.render(results, ['apache', {}])).to match(/tag1/) - expect(subject.render(results, ['apache', {}])).to match(/tag2/) - end - - it 'should mark deprecated modules in search results' do - results = { - :result => :success, - :answers => [ - {'full_name' => 'puppetlabs-corosync', 'deprecated_at' => Time.new, 'author' => 'Author', 'desc' => 'Summary', 'tag_list' => ['tag1', 'tag2'] }, - ] - } - - expect(subject.render(results, ['apache', {}])).to match(/puppetlabs-corosync.*DEPRECATED/i) - end - - it 'should elide really long descriptions' do - results = { - :result => :success, - :answers => [ - { - 'full_name' => 'Name', - 'author' => 'Author', - 'desc' => 'This description is really too long to fit in a single data table, guys -- we should probably set about truncating it', - 'tag_list' => ['tag1', 'tag2'], - }, - ] - } - - expect(subject.render(results, ['apache', {}])).to match(/\.{3} @Author/) - end - - it 'should never truncate the module name' do - results = { - :result => :success, - :answers => [ - { - 'full_name' => 'This-module-has-a-really-really-long-name', - 'author' => 'Author', - 'desc' => 'Description', - 'tag_list' => ['tag1', 'tag2'], - }, - ] - } - - expect(subject.render(results, ['apache', {}])).to match(/This-module-has-a-really-really-long-name/) - end - - it 'should never truncate the author name' do - results = { - :result => :success, - :answers => [ - { - 'full_name' => 'Name', - 'author' => 'This-author-has-a-really-really-long-name', - 'desc' => 'Description', - 'tag_list' => ['tag1', 'tag2'], - }, - ] - } - - expect(subject.render(results, ['apache', {}])).to match(/@This-author-has-a-really-really-long-name/) - end - - it 'should never remove tags that match the search term' do - results = { - :results => :success, - :answers => [ - { - 'full_name' => 'Name', - 'author' => 'Author', - 'desc' => 'Description', - 'tag_list' => ['Supercalifragilisticexpialidocious'] + (1..100).map { |i| "tag#{i}" }, - }, - ] - } - - expect(subject.render(results, ['Supercalifragilisticexpialidocious', {}])).to match(/Supercalifragilisticexpialidocious/) - expect(subject.render(results, ['Supercalifragilisticexpialidocious', {}])).not_to match(/tag/) - end - - { - 100 => "NAME DESCRIPTION AUTHOR KEYWORDS#{' '*15}\n"\ - "Name This description is really too long to fit ... @JohnnyApples tag1 tag2 taggitty3#{' '*4}\n", - - 70 => "NAME DESCRIPTION AUTHOR KEYWORDS#{' '*5}\n"\ - "Name This description is rea... @JohnnyApples tag1 tag2#{' '*4}\n", - - 80 => "NAME DESCRIPTION AUTHOR KEYWORDS#{' '*8}\n"\ - "Name This description is really too... @JohnnyApples tag1 tag2#{' '*7}\n", - - 200 => "NAME DESCRIPTION AUTHOR KEYWORDS#{' '*48}\n"\ - "Name This description is really too long to fit in a single data table, guys -- we should probably set about trunca... @JohnnyApples tag1 tag2 taggitty3#{' '*37}\n" - }.each do |width, expectation| - it "should resize the table to fit the screen, when #{width} columns" do - results = { - :result => :success, - :answers => [ - { - 'full_name' => 'Name', - 'author' => 'JohnnyApples', - 'desc' => 'This description is really too long to fit in a single data table, guys -- we should probably set about truncating it', - 'tag_list' => ['tag1', 'tag2', 'taggitty3'], - }, - ] - } - - expect(Puppet::Util::Terminal).to receive(:width).and_return(width) - result = subject.render(results, ['apache', {}]) - expect(result.lines.sort_by(&:length).last.chomp.length).to be <= width - expect(result).to eq(expectation) - end - end - end - - describe "option validation" do - context "without any options" do - it "should require a search term" do - pattern = /wrong number of arguments/ - expect { subject.search }.to raise_error ArgumentError, pattern - end - end - - it "should accept the --module_repository option" do - forge = double("Puppet::Forge") - searcher = double("Searcher") - options[:module_repository] = "http://forge.example.com" - - expect(Puppet::Forge).to receive(:new).with("http://forge.example.com").and_return(forge) - expect(Puppet::ModuleTool::Applications::Searcher).to receive(:new).with("puppetlabs-apache", forge, hash_including(options)).and_return(searcher) - expect(searcher).to receive(:run) - - subject.search("puppetlabs-apache", options) - end - end - - describe "inline documentation" do - subject { Puppet::Face[:module, :current].get_action :search } - - its(:summary) { should =~ /search.*module/im } - its(:description) { should =~ /search.*module/im } - its(:returns) { should =~ /array/i } - its(:examples) { should_not be_empty } - - %w{ license copyright summary description returns examples }.each do |doc| - context "of the" do - its(doc.to_sym) { should_not =~ /(FIXME|REVISIT|TODO)/ } - end - end - end - - it "should include a deprecation warning" do - stub_request(:get, "https://forgeapi.puppet.com/v3/modules?query=puppetlabs-apache").to_return(status: 200, body: [answers: [], result: :success]) - - subject.search("puppetlabs-apache") - - expect(@logs).to include(an_object_having_attributes(level: :warning, message: /This action has been deprecated. Please use the Puppet Forge to search for modules./)) - end - - it "omits the warning when deprecations are disabled" do - stub_request(:get, "https://forgeapi.puppet.com/v3/modules?query=puppetlabs-apache").to_return(status: 200, body: [answers: [], result: :success]) - - Puppet[:disable_warnings] = 'deprecations' - subject.search("puppetlabs-apache") - - expect(@logs).not_to include(an_object_having_attributes(level: :warning)) - end -end diff --git a/spec/unit/module_tool/applications/searcher_spec.rb b/spec/unit/module_tool/applications/searcher_spec.rb deleted file mode 100644 index 5b91fb87daf..00000000000 --- a/spec/unit/module_tool/applications/searcher_spec.rb +++ /dev/null @@ -1,38 +0,0 @@ -require 'spec_helper' -require 'puppet/module_tool/applications' -require 'puppet_spec/modules' - -describe Puppet::ModuleTool::Applications::Searcher do - include PuppetSpec::Files - - describe "when searching" do - let(:forge) { double('forge', :host => 'http://nowhe.re') } - let(:searcher) do - described_class.new('search_term', forge) - end - - it "should return results from a forge query when successful" do - results = 'mock results' - expect(forge).to receive(:search).with('search_term').and_return(results) - - search_result = searcher.run - expect(search_result).to eq({ - :result => :success, - :answers => results, - }) - end - - it "should return an error when the forge query throws an exception" do - expect(forge).to receive(:search).with('search_term').and_raise(Puppet::Forge::Errors::ForgeError.new("something went wrong")) - - search_result = searcher.run - expect(search_result).to eq({ - :result => :failure, - :error => { - :oneline => 'something went wrong', - :multiline => 'something went wrong', - }, - }) - end - end -end From 3d3ac2f80d5c6067c46d170b55f372c405e8e5a0 Mon Sep 17 00:00:00 2001 From: Ciprian Badescu Date: Thu, 20 Aug 2020 11:02:44 +0300 Subject: [PATCH 085/731] (PUP-10488) Remove NameService deprecated method `listbyname` --- lib/puppet/provider/nameservice.rb | 18 -------- spec/unit/provider/nameservice_spec.rb | 57 -------------------------- 2 files changed, 75 deletions(-) diff --git a/lib/puppet/provider/nameservice.rb b/lib/puppet/provider/nameservice.rb index 535a142d28c..8ad3d82522c 100644 --- a/lib/puppet/provider/nameservice.rb +++ b/lib/puppet/provider/nameservice.rb @@ -54,24 +54,6 @@ def options(name, hash) end end - # List everything out by name. Abstracted a bit so that it works - # for both users and groups. - def listbyname - Puppet.deprecation_warning(_("listbyname is deprecated and will be removed in a future release of Puppet. Please use `self.instances` to obtain a list of users.")) - names = [] - Puppet::Etc.send("set#{section()}ent") - begin - while ent = Puppet::Etc.send("get#{section()}ent") #rubocop:disable Lint/AssignmentInCondition - names << ent.name - yield ent.name if block_given? - end - ensure - Puppet::Etc.send("end#{section()}ent") - end - - names - end - def resource_type=(resource_type) super @resource_type.validproperties.each do |prop| diff --git a/spec/unit/provider/nameservice_spec.rb b/spec/unit/provider/nameservice_spec.rb index 37117643316..491ba639598 100644 --- a/spec/unit/provider/nameservice_spec.rb +++ b/spec/unit/provider/nameservice_spec.rb @@ -149,63 +149,6 @@ end end - describe "#listbyname" do - it "should be deprecated" do - expect(Puppet).to receive(:deprecation_warning).with(/listbyname is deprecated/) - described_class.listbyname - end - - it "should return a list of users if resource_type is user" do - described_class.resource_type = Puppet::Type.type(:user) - expect(Puppet::Etc).to receive(:setpwent) - allow(Puppet::Etc).to receive(:getpwent).and_return(*users) - expect(Puppet::Etc).to receive(:endpwent) - expect(described_class.listbyname).to eq(%w{root foo}) - end - - context "encoding handling" do - described_class.resource_type = Puppet::Type.type(:user) - - # These two tests simulate an environment where there are two users with - # the same name on disk, but each name is stored on disk in a different - # encoding - it "should return names with invalid byte sequences replaced with '?'" do - allow(Etc).to receive(:getpwent).and_return(*utf_8_mixed_users) - expect(invalid_utf_8_jose).to_not be_valid_encoding - result = PuppetSpec::CharacterEncoding.with_external_encoding(Encoding::UTF_8) do - described_class.listbyname - end - expect(result).to eq(['root', 'foo', utf_8_jose, escaped_utf_8_jose]) - end - - it "should return names in their original encoding/bytes if they would not be valid UTF-8" do - allow(Etc).to receive(:getpwent).and_return(*latin_1_mixed_users) - result = PuppetSpec::CharacterEncoding.with_external_encoding(Encoding::ISO_8859_1) do - described_class.listbyname - end - expect(result).to eq(['root'.force_encoding(Encoding::UTF_8), 'foo'.force_encoding(Encoding::UTF_8), utf_8_jose, valid_latin1_jose]) - end - end - - it "should return a list of groups if resource_type is group", :unless => Puppet::Util::Platform.windows? do - described_class.resource_type = Puppet::Type.type(:group) - expect(Puppet::Etc).to receive(:setgrent) - allow(Puppet::Etc).to receive(:getgrent).and_return(*groups) - expect(Puppet::Etc).to receive(:endgrent) - expect(described_class.listbyname).to eq(%w{root bin}) - end - - it "should yield if a block given" do - yield_results = [] - described_class.resource_type = Puppet::Type.type(:user) - expect(Puppet::Etc).to receive(:setpwent) - allow(Puppet::Etc).to receive(:getpwent).and_return(*users) - expect(Puppet::Etc).to receive(:endpwent) - described_class.listbyname {|x| yield_results << x } - expect(yield_results).to eq(%w{root foo}) - end - end - describe "instances" do it "should return a list of objects in UTF-8 with any invalid characters replaced with '?'" do # These two tests simulate an environment where there are two users with From eb3a32b5bb73acd628142228b5e8cf0f0a110622 Mon Sep 17 00:00:00 2001 From: Ciprian Badescu Date: Thu, 20 Aug 2020 11:12:27 +0300 Subject: [PATCH 086/731] (PUP-10489) remove DirectoryService deprecated method `write_to_file` --- lib/puppet/provider/user/directoryservice.rb | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/lib/puppet/provider/user/directoryservice.rb b/lib/puppet/provider/user/directoryservice.rb index a0aca703dd5..65bde4fea37 100644 --- a/lib/puppet/provider/user/directoryservice.rb +++ b/lib/puppet/provider/user/directoryservice.rb @@ -657,14 +657,4 @@ def set_salted_pbkdf2(users_plist, shadow_hash_data, field, value) def write_users_plist_to_disk(users_plist) Puppet::Util::Plist.write_plist_file(users_plist, "#{users_plist_dir}/#{@resource.name}.plist", :binary) end - - # This is a simple wrapper method for writing values to a file. - def write_to_file(filename, value) - Puppet.deprecation_warning("Puppet::Type.type(:user).provider(:directoryservice).write_to_file is deprecated and will be removed in Puppet 5.") - begin - File.open(filename, 'w') { |f| f.write(value)} - rescue Errno::EACCES => detail - raise Puppet::Error, "Could not write to file #{filename}: #{detail}", detail.backtrace - end - end end From c28783d56afb304cfecf323ab55a46cfceec50da Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Tue, 18 Aug 2020 21:34:53 -0700 Subject: [PATCH 087/731] (PUP-9405) Mark resources as failed if prefetch raises StandardError If prefetch raises a StandardError, always mark the resources associated with that provider as failed, so the transaction continues applying unrelated resources. The overall report status will be computed based on the failed resource statuses. --- lib/puppet/transaction.rb | 3 - spec/unit/transaction_spec.rb | 121 ++++++++++++---------------------- 2 files changed, 43 insertions(+), 81 deletions(-) diff --git a/lib/puppet/transaction.rb b/lib/puppet/transaction.rb index c1e141a97b0..252e2d1a5f9 100644 --- a/lib/puppet/transaction.rb +++ b/lib/puppet/transaction.rb @@ -383,9 +383,6 @@ def prefetch(provider_class, resources) rescue StandardError => detail message = _("Could not prefetch %{type_name} provider '%{name}': %{detail}") % { type_name: type_name, name: provider_class.name, detail: detail } Puppet.log_exception(detail, message) - - raise unless Puppet.settings[:future_features] - @prefetch_failed_providers[type_name][provider_class.name] = true end @prefetched_providers[type_name][provider_class.name] = true diff --git a/spec/unit/transaction_spec.rb b/spec/unit/transaction_spec.rb index 1bfac00c351..34dd196b1a4 100644 --- a/spec/unit/transaction_spec.rb +++ b/spec/unit/transaction_spec.rb @@ -598,115 +598,80 @@ def transaction_with_resource(resource) transaction.prefetch_if_necessary(resource) end - it "should not rescue SystemExit without future_features flag" do - Puppet.settings[:future_features] = false + it "should not rescue SystemExit" do expect(resource.provider.class).to receive(:prefetch).and_raise(SystemExit, "SystemMessage") expect { transaction.prefetch_if_necessary(resource) }.to raise_error(SystemExit, "SystemMessage") end - it "should not rescue SystemExit with future_features flag" do - Puppet.settings[:future_features] = true - expect(resource.provider.class).to receive(:prefetch).and_raise(SystemExit, "SystemMessage") - expect { transaction.prefetch_if_necessary(resource) }.to raise_error(SystemExit, "SystemMessage") - end - - it "should rescue LoadError without future_features flag" do - Puppet.settings[:future_features] = false + it "should rescue LoadError" do expect(resource.provider.class).to receive(:prefetch).and_raise(LoadError, "LoadMessage") expect { transaction.prefetch_if_necessary(resource) }.not_to raise_error end - it "should rescue LoadError with future_features flag" do - Puppet.settings[:future_features] = true - expect(resource.provider.class).to receive(:prefetch).and_raise(LoadError, "LoadMessage") - expect { transaction.prefetch_if_necessary(resource) }.not_to raise_error - end - - describe "and prefetching fails" do + describe "and prefetching raises Puppet::Error" do before :each do expect(resource.provider.class).to receive(:prefetch).and_raise(Puppet::Error, "message") end - context "without future_features flag" do - before :each do - Puppet.settings[:future_features] = false - end - - it "should not rescue prefetch executions" do - expect { transaction.prefetch_if_necessary(resource) }.to raise_error(Puppet::Error) - end + it "should rescue prefetch executions" do + transaction.prefetch_if_necessary(resource) - it "should log the exception during prefetch" do - expect(Puppet).to receive(:log_exception).with(anything, "Could not prefetch package provider 'pkgng': message") - expect { transaction.prefetch_if_necessary(resource) }.to raise_error(Puppet::Error, "message") - end + expect(transaction.prefetched_providers[:package][:pkgng]).to be_truthy end - context "with future_features flag" do - before :each do - Puppet.settings[:future_features] = true - end + it "should mark resources as failed", :unless => RUBY_PLATFORM == 'java' do + transaction.evaluate - it "should rescue prefetch executions" do - transaction.prefetch_if_necessary(resource) + expect(transaction.resource_status(resource).failed?).to be_truthy + end - expect(transaction.prefetched_providers[:package][:pkgng]).to be_truthy - end + it "should mark a provider that has failed prefetch" do + transaction.prefetch_if_necessary(resource) - it "should mark resources as failed", :unless => RUBY_PLATFORM == 'java' do - transaction.evaluate + expect(transaction.prefetch_failed_providers[:package][:pkgng]).to be_truthy + end - expect(transaction.resource_status(resource).failed?).to be_truthy + describe "and new resources are generated" do + let(:generator) { Puppet::Type.type(:notify).new :title => "generator" } + let(:generated) do + %w[a b c].map { |name| Puppet::Type.type(:package).new :title => "foo", :name => name, :provider => :apt } end - it "should mark a provider that has failed prefetch" do - transaction.prefetch_if_necessary(resource) - - expect(transaction.prefetch_failed_providers[:package][:pkgng]).to be_truthy + before :each do + catalog.add_resource generator + allow(generator).to receive(:generate).and_return(generated) + allow(catalog).to receive(:container_of).and_return(generator) end - describe "and new resources are generated" do - let(:generator) { Puppet::Type.type(:notify).new :title => "generator" } - let(:generated) do - %w[a b c].map { |name| Puppet::Type.type(:package).new :title => "foo", :name => name, :provider => :apt } - end - - before :each do - catalog.add_resource generator - allow(generator).to receive(:generate).and_return(generated) - allow(catalog).to receive(:container_of).and_return(generator) - end - - it "should not evaluate resources with a failed provider, even if the prefetch is rescued" do - #Only the generator resource should be applied, all the other resources are failed, and skipped. - catalog.remove_resource resource2 - expect(transaction).to receive(:apply).once + it "should not evaluate resources with a failed provider, even if the prefetch is rescued" do + #Only the generator resource should be applied, all the other resources are failed, and skipped. + catalog.remove_resource resource2 + expect(transaction).to receive(:apply).once - transaction.evaluate - end + transaction.evaluate + end - it "should not fail other resources added after the failing resource", :unless => RUBY_PLATFORM == 'java' do - new_resource = Puppet::Type.type(:notify).new :name => "baz" - catalog.add_resource(new_resource) + it "should not fail other resources added after the failing resource", :unless => RUBY_PLATFORM == 'java' do + new_resource = Puppet::Type.type(:notify).new :name => "baz" + catalog.add_resource(new_resource) - transaction.evaluate + transaction.evaluate - expect(transaction.resource_status(new_resource).failed?).to be_falsey - end + expect(transaction.resource_status(new_resource).failed?).to be_falsey + end - it "should fail other resources that require the failing resource" do - new_resource = Puppet::Type.type(:notify).new(:name => "baz", :require => resource) - catalog.add_resource(new_resource) + it "should fail other resources that require the failing resource" do + new_resource = Puppet::Type.type(:notify).new(:name => "baz", :require => resource) + catalog.add_resource(new_resource) - catalog.remove_resource resource2 - expect(transaction).to receive(:apply).once + catalog.remove_resource resource2 + expect(transaction).to receive(:apply).once - transaction.evaluate + transaction.evaluate - expect(transaction.resource_status(resource).failed?).to be_truthy - expect(transaction.resource_status(new_resource).dependency_failed?).to be_truthy - expect(transaction.skip?(new_resource)).to be_truthy - end + expect(transaction.resource_status(resource).failed?).to be_truthy + expect(transaction.resource_status(new_resource).dependency_failed?).to be_truthy + expect(transaction.skip?(new_resource)).to be_truthy end end end From 9f85c1c1ee189066e3619ca353d641e6b725c448 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Thu, 20 Aug 2020 15:02:10 -0700 Subject: [PATCH 088/731] (PUP-9405) Mark resources as failed for LoadError and MissingCommand Puppet defers evaluation of a resource until its provider becomes suitable or the provider is the default. If the provider implements prefetch, then it will be called to determine the current state of all resources of that type. Previously, if prefetch raised LoadError or MissingCommand, then the resources associated with the provider were not marked as failed. Instead, puppet assumed no resources of that type existed, and puppet would call the provider to create them(!), possibly corrupting the system such as occurred in PUP-2643 with crontab entries. This commit modifies prefetch so if the method raises LoadError or MissingCommand, then all associated resources are marked as failed. --- lib/puppet/transaction.rb | 5 +---- spec/unit/transaction_spec.rb | 5 +++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/puppet/transaction.rb b/lib/puppet/transaction.rb index 252e2d1a5f9..678e2bd0518 100644 --- a/lib/puppet/transaction.rb +++ b/lib/puppet/transaction.rb @@ -376,13 +376,10 @@ def prefetch(provider_class, resources) Puppet.debug { "Prefetching #{provider_class.name} resources for #{type_name}" } begin provider_class.prefetch(resources) - rescue LoadError, Puppet::MissingCommand => detail + rescue LoadError, StandardError => detail #TRANSLATORS `prefetch` is a function name and should not be translated message = _("Could not prefetch %{type_name} provider '%{name}': %{detail}") % { type_name: type_name, name: provider_class.name, detail: detail } Puppet.log_exception(detail, message) - rescue StandardError => detail - message = _("Could not prefetch %{type_name} provider '%{name}': %{detail}") % { type_name: type_name, name: provider_class.name, detail: detail } - Puppet.log_exception(detail, message) @prefetch_failed_providers[type_name][provider_class.name] = true end @prefetched_providers[type_name][provider_class.name] = true diff --git a/spec/unit/transaction_spec.rb b/spec/unit/transaction_spec.rb index 34dd196b1a4..c9c1841ab9d 100644 --- a/spec/unit/transaction_spec.rb +++ b/spec/unit/transaction_spec.rb @@ -603,9 +603,10 @@ def transaction_with_resource(resource) expect { transaction.prefetch_if_necessary(resource) }.to raise_error(SystemExit, "SystemMessage") end - it "should rescue LoadError" do + it "should mark resources as failed when prefetching raises LoadError" do expect(resource.provider.class).to receive(:prefetch).and_raise(LoadError, "LoadMessage") - expect { transaction.prefetch_if_necessary(resource) }.not_to raise_error + transaction.prefetch_if_necessary(resource) + expect(transaction.prefetched_providers[:package][:pkgng]).to be_truthy end describe "and prefetching raises Puppet::Error" do From 75982560e7d15af064d158dd5c64618dbcd94093 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Thu, 20 Aug 2020 17:33:01 -0700 Subject: [PATCH 089/731] (PUP-9426) Remove future_features setting --- lib/puppet/defaults.rb | 7 ------- 1 file changed, 7 deletions(-) diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb index 1f967d60ace..2c0d3bc9659 100644 --- a/lib/puppet/defaults.rb +++ b/lib/puppet/defaults.rb @@ -241,13 +241,6 @@ def self.initialize_default_settings!(settings) :type => :boolean, :desc => "Whether to enable experimental performance profiling", }, - :future_features => { - :default => false, - :type => :boolean, - :desc => "Whether or not to enable all features currently being developed for future - major releases of Puppet. Should be used with caution, as in development - features are experimental and can have unexpected effects." - }, :versioned_environment_dirs => { :default => false, :type => :boolean, From 1ef1d0bdae04b20400542b3ec32e398741bc4b57 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Fri, 21 Aug 2020 07:21:27 +0000 Subject: [PATCH 090/731] (packaging) Updating the puppet.pot file --- locales/puppet.pot | 78 ++++++++++------------------------------------ 1 file changed, 17 insertions(+), 61 deletions(-) diff --git a/locales/puppet.pot b/locales/puppet.pot index 53e810bb3fc..1a2cb849655 100644 --- a/locales/puppet.pot +++ b/locales/puppet.pot @@ -6,11 +6,11 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Puppet automation framework 6.17.0-236-g14fe3bff21\n" +"Project-Id-Version: Puppet automation framework 6.17.0-253-g472216a64e\n" "\n" "Report-Msgid-Bugs-To: https://tickets.puppetlabs.com\n" -"POT-Creation-Date: 2020-08-17 02:06+0000\n" -"PO-Revision-Date: 2020-08-17 02:06+0000\n" +"POT-Creation-Date: 2020-08-21 07:21+0000\n" +"PO-Revision-Date: 2020-08-21 07:21+0000\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -48,21 +48,21 @@ msgstr "" msgid "Config file %{hiera_config} not found, using Hiera defaults" msgstr "" -#: ../lib/puppet.rb:144 +#: ../lib/puppet.rb:138 msgid "Support for ruby version %{version} is deprecated and will be removed in a future release. See https://puppet.com/docs/puppet/latest/system_requirements.html for a list of supported ruby versions." msgstr "" -#: ../lib/puppet.rb:230 +#: ../lib/puppet.rb:224 msgid "The environmentpath setting cannot be empty or nil." msgstr "" #. TRANSLATORS: `message` is an already translated string of why SSL failed to initialize -#: ../lib/puppet.rb:256 +#: ../lib/puppet.rb:250 msgid "Failed to initialize SSL: %{message}" msgstr "" #. TRANSLATORS: `puppet agent -t` is a command and should not be translated -#: ../lib/puppet.rb:258 +#: ../lib/puppet.rb:252 msgid "Run `puppet agent -t`" msgstr "" @@ -1139,18 +1139,6 @@ msgstr "" msgid "Creates, installs and searches for modules on the Puppet Forge." msgstr "" -#: ../lib/puppet/face/module/build.rb:3 -msgid "Build a module release package." -msgstr "" - -#. TRANSLATORS 'Puppet Development Kit' is the name of the software package replacing this action and should not be translated. -#. TRANSLATORS 'Puppet Development Kit' is the name of the software package replacing this action and should not be translated. -#. TRANSLATORS 'Puppet Development Kit' is the name of the software package replacing this action and should not be translated. -#. TRANSLATORS 'Puppet Development Kit' is the name of the software package replacing this action and should not be translated. -#: ../lib/puppet/face/module/build.rb:5 ../lib/puppet/face/module/build.rb:9 ../lib/puppet/face/module/generate.rb:5 ../lib/puppet/face/module/generate.rb:9 -msgid "This action has been replaced by Puppet Development Kit. For more information visit https://puppet.com/docs/pdk/latest/pdk.html." -msgstr "" - #: ../lib/puppet/face/module/changes.rb:3 msgid "Show modified files of an installed module." msgstr "" @@ -1175,10 +1163,6 @@ msgstr "" msgid "%{count} files modified" msgstr "" -#: ../lib/puppet/face/module/generate.rb:3 -msgid "Generate boilerplate for a new module." -msgstr "" - #: ../lib/puppet/face/module/install.rb:8 msgid "Install a module from the Puppet Forge or a release archive." msgstr "" @@ -1254,26 +1238,6 @@ msgstr "" msgid "invalid" msgstr "" -#: ../lib/puppet/face/module/search.rb:6 -msgid "Search the Puppet Forge for a module." -msgstr "" - -#: ../lib/puppet/face/module/search.rb:14 -msgid "Array of module metadata hashes" -msgstr "" - -#: ../lib/puppet/face/module/search.rb:24 -msgid "" -msgstr "" - -#: ../lib/puppet/face/module/search.rb:27 -msgid "This action has been deprecated. Please use the Puppet Forge to search for modules." -msgstr "" - -#: ../lib/puppet/face/module/search.rb:37 -msgid "No results found for '%{term}'." -msgstr "" - #: ../lib/puppet/face/module/uninstall.rb:3 msgid "Uninstall a puppet module." msgstr "" @@ -2566,7 +2530,7 @@ msgstr "" msgid "Invalid checksum %{checksum}" msgstr "" -#: ../lib/puppet/indirector/file_metadata/http.rb:31 +#: ../lib/puppet/indirector/file_metadata/http.rb:32 msgid "cannot lookup multiple files" msgstr "" @@ -3220,10 +3184,6 @@ msgstr "" msgid "Installing -- do not interrupt ..." msgstr "" -#: ../lib/puppet/module_tool/applications/searcher.rb:15 -msgid "Searching %{host} ..." -msgstr "" - #: ../lib/puppet/module_tool/applications/uninstaller.rb:92 msgid "Either the `--ignore_changes` or `--force` argument must be specified to uninstall modules when running in FIPS mode." msgstr "" @@ -6390,11 +6350,11 @@ msgstr "" msgid "aix.object_info(): Could not find %{resource}[%{name}]" msgstr "" -#: ../lib/puppet/provider/aix_object.rb:471 ../lib/puppet/provider/nameservice.rb:182 ../lib/puppet/provider/nameservice/directoryservice.rb:425 +#: ../lib/puppet/provider/aix_object.rb:471 ../lib/puppet/provider/nameservice.rb:164 ../lib/puppet/provider/nameservice/directoryservice.rb:425 msgid "Could not create %{resource} %{name}: %{detail}" msgstr "" -#: ../lib/puppet/provider/aix_object.rb:483 ../lib/puppet/provider/nameservice.rb:196 +#: ../lib/puppet/provider/aix_object.rb:483 ../lib/puppet/provider/nameservice.rb:178 msgid "Could not delete %{resource} %{name}: %{detail}" msgstr "" @@ -6483,32 +6443,28 @@ msgstr "" msgid "%{name} is not a valid attribute for %{resource_type}" msgstr "" -#: ../lib/puppet/provider/nameservice.rb:60 -msgid "listbyname is deprecated and will be removed in a future release of Puppet. Please use `self.instances` to obtain a list of users." -msgstr "" - -#: ../lib/puppet/provider/nameservice.rb:103 +#: ../lib/puppet/provider/nameservice.rb:85 msgid "Invalid value %{value}: %{error}" msgstr "" #. TRANSLATORS "autogen_id()" is a method name and should not be translated -#: ../lib/puppet/provider/nameservice.rb:148 +#: ../lib/puppet/provider/nameservice.rb:130 msgid "autogen_id() does not support auto generation of id for resource type %{resource_type}" msgstr "" -#: ../lib/puppet/provider/nameservice.rb:170 ../lib/puppet/provider/nameservice/directoryservice.rb:379 +#: ../lib/puppet/provider/nameservice.rb:152 ../lib/puppet/provider/nameservice/directoryservice.rb:379 msgid "already exists" msgstr "" -#: ../lib/puppet/provider/nameservice.rb:188 +#: ../lib/puppet/provider/nameservice.rb:170 msgid "already absent" msgstr "" -#: ../lib/puppet/provider/nameservice.rb:282 +#: ../lib/puppet/provider/nameservice.rb:264 msgid "Nameservice command must be an array" msgstr "" -#: ../lib/puppet/provider/nameservice.rb:287 ../lib/puppet/provider/nameservice/directoryservice.rb:340 ../lib/puppet/provider/nameservice/directoryservice.rb:369 +#: ../lib/puppet/provider/nameservice.rb:269 ../lib/puppet/provider/nameservice/directoryservice.rb:340 ../lib/puppet/provider/nameservice/directoryservice.rb:369 msgid "Could not set %{param} on %{resource}[%{name}]: %{detail}" msgstr "" @@ -8442,7 +8398,7 @@ msgid "Not managing symlink mode" msgstr "" #. TRANSLATORS "source_permissions" is a parameter name and should not be translated -#: ../lib/puppet/type/file/source.rb:368 +#: ../lib/puppet/type/file/source.rb:373 msgid "The `source_permissions` parameter is deprecated. Explicitly set `owner`, `group`, and `mode`." msgstr "" From 91b8262a255c2f10537ee71ca8f630865e32f550 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Fri, 21 Aug 2020 07:22:50 +0000 Subject: [PATCH 091/731] (packaging) Updating manpage file for main --- man/man8/puppet-module.8 | 57 ---------------------------------------- 1 file changed, 57 deletions(-) diff --git a/man/man8/puppet-module.8 b/man/man8/puppet-module.8 index cc94ffac152..606b69a8832 100644 --- a/man/man8/puppet-module.8 +++ b/man/man8/puppet-module.8 @@ -53,19 +53,6 @@ Setting a global value for \fBmodulepath\fR in puppet\.conf is not allowed (but .SH "ACTIONS" . .TP -\fBbuild\fR \- Build a module release package\. -\fBSYNOPSIS\fR -. -.IP -puppet module build -. -.IP -\fBDESCRIPTION\fR -. -.IP -This action has been replaced by Puppet Development Kit\. For more information visit https://puppet\.com/docs/pdk/latest/pdk\.html\. -. -.TP \fBchanges\fR \- Show modified files of an installed module\. \fBSYNOPSIS\fR . @@ -85,19 +72,6 @@ Shows any files in a module that have been modified since it was installed\. Thi Array of strings representing paths of modified files\. . .TP -\fBgenerate\fR \- Generate boilerplate for a new module\. -\fBSYNOPSIS\fR -. -.IP -puppet module generate -. -.IP -\fBDESCRIPTION\fR -. -.IP -This action has been replaced by Puppet Development Kit\. For more information visit https://puppet\.com/docs/pdk/latest/pdk\.html\. -. -.TP \fBinstall\fR \- Install a module from the Puppet Forge or a release archive\. \fBSYNOPSIS\fR . @@ -160,28 +134,6 @@ The output of this action includes information from the module\'s metadata, incl hash of paths to module objects . .TP -\fBsearch\fR \- Search the Puppet Forge for a module\. -\fBSYNOPSIS\fR -. -.IP -puppet module search \fIsearch_term\fR -. -.IP -\fBDESCRIPTION\fR -. -.IP -This action has been deprecated\. Please use the Puppet Forge to search for modules\. -. -.IP -Searches a repository for modules whose names, descriptions, or keywords match the provided search term\. -. -.IP -\fBRETURNS\fR -. -.IP -Array of module metadata hashes -. -.TP \fBuninstall\fR \- Uninstall a puppet module\. \fBSYNOPSIS\fR . @@ -322,15 +274,6 @@ List installed modules from a specified modulepath: $ puppet module list \-\-modulepath /opt/puppetlabs/puppet/modules /opt/puppetlabs/puppet/modules (no modules installed) . .P -\fBsearch\fR -. -.P -Search the Puppet Forge for a module: -. -.P -$ puppet module search puppetlabs NAME DESCRIPTION AUTHOR KEYWORDS bacula This is a generic Apache module @puppetlabs backups -. -.P \fBuninstall\fR . .P From ce75b54a7100c7eb2b0173163b0a5506828f240f Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Fri, 21 Aug 2020 08:21:34 +0000 Subject: [PATCH 092/731] (packaging) Updating the puppet.pot file --- locales/puppet.pot | 48 ++++++++++++---------------------------------- 1 file changed, 12 insertions(+), 36 deletions(-) diff --git a/locales/puppet.pot b/locales/puppet.pot index 1a2cb849655..b743a869b43 100644 --- a/locales/puppet.pot +++ b/locales/puppet.pot @@ -6,11 +6,11 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Puppet automation framework 6.17.0-253-g472216a64e\n" +"Project-Id-Version: Puppet automation framework 6.17.0-257-gec9143f74c\n" "\n" "Report-Msgid-Bugs-To: https://tickets.puppetlabs.com\n" -"POT-Creation-Date: 2020-08-21 07:21+0000\n" -"PO-Revision-Date: 2020-08-21 07:21+0000\n" +"POT-Creation-Date: 2020-08-21 08:21+0000\n" +"PO-Revision-Date: 2020-08-21 08:21+0000\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -7121,35 +7121,15 @@ msgstr "" msgid "Invalid resource type %{type}" msgstr "" -#: ../lib/puppet/resource.rb:521 -msgid "The method Puppet::Resource.set_default_parameters is deprecated and will be removed in the next major release of Puppet." -msgstr "" - -#: ../lib/puppet/resource.rb:526 -msgid "Cannot evaluate default parameters for %{resource} - not a parser resource" -msgstr "" - -#: ../lib/puppet/resource.rb:566 -msgid "The method Puppet::Resource.validate_complete is deprecated and will be removed in the next major release of Puppet." -msgstr "" - -#: ../lib/puppet/resource.rb:572 -msgid "Must pass %{param} to %{resource}" -msgstr "" - -#: ../lib/puppet/resource.rb:584 -msgid "Expected parameter '%{name}' of '%{value0}' to have type %{value1}, got %{value2}" -msgstr "" - -#: ../lib/puppet/resource.rb:590 +#: ../lib/puppet/resource.rb:527 msgid "no parameter named '%{name}'" msgstr "" -#: ../lib/puppet/resource.rb:635 +#: ../lib/puppet/resource.rb:572 msgid "No title provided and %{type} is not a valid resource reference" msgstr "" -#: ../lib/puppet/resource.rb:709 +#: ../lib/puppet/resource.rb:646 msgid "No set of title patterns matched the title \"%{title}\"." msgstr "" @@ -7275,31 +7255,27 @@ msgstr "" msgid "Cannot create resources for defined resource types" msgstr "" -#: ../lib/puppet/resource/type.rb:294 -msgid "The method Puppet::Resource::Type.assign_parameter_values is deprecated and will be removed in the next major release of Puppet." -msgstr "" - -#: ../lib/puppet/resource/type.rb:310 +#: ../lib/puppet/resource/type.rb:295 msgid "Could not find parent resource type '%{parent}' of type %{parent_type} in %{env}" msgstr "" -#: ../lib/puppet/resource/type.rb:437 +#: ../lib/puppet/resource/type.rb:422 msgid "Parameter '%{name}' is given a type, but is not a valid parameter." msgstr "" -#: ../lib/puppet/resource/type.rb:440 +#: ../lib/puppet/resource/type.rb:425 msgid "Parameter '%{name}' is given a type that is not a Puppet Type, got %{class_name}" msgstr "" -#: ../lib/puppet/resource/type.rb:482 +#: ../lib/puppet/resource/type.rb:467 msgid "Could not find scope for %{class_name}" msgstr "" -#: ../lib/puppet/resource/type.rb:503 +#: ../lib/puppet/resource/type.rb:488 msgid "%{param} is a metaparam; this value will inherit to all contained resources in the %{name} definition" msgstr "" -#: ../lib/puppet/resource/type.rb:505 +#: ../lib/puppet/resource/type.rb:490 msgid "%{param} is a metaparameter; please choose another parameter name in the %{name} definition" msgstr "" From 20068ef3f713b822cdb96159135bb0b6fbf3a958 Mon Sep 17 00:00:00 2001 From: Gabriel Nagy Date: Wed, 19 Aug 2020 17:49:33 +0300 Subject: [PATCH 093/731] (maint) Add Ruby 2.7 to AppVeyor test matrix AppVeyor only provides Ruby 2.7 with VS2019 images, and we are currently using VS2015. For some reason, runs with VS2019 take longer than 20 minutes, so update the build matrix to only run Ruby 2.7 with VS2019. In addition, VS2019 has the RUBYOPT variable set to `-Eutf-8` which forces Ruby to use UTF-8 encoding, causing some spec tests to fail due to them expecting different encodings. Unset the variable. --- appveyor.yml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index fd53d99e9cb..ec9c5729304 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,17 +1,26 @@ version: 4.1.0.{build} +image: + - Visual Studio 2015 + - Visual Studio 2019 clone_depth: 10 install: build: off matrix: fast_finish: true exclude: + - platform: Ruby27-x64 + image: Visual Studio 2015 + - platform: Ruby26-x64 + image: Visual Studio 2019 - platform: Ruby25-x64 - LOCALE: ja-JP - - platform: Ruby24-x64 + image: Visual Studio 2019 + - platform: Ruby25-x64 + image: Visual Studio 2015 LOCALE: ja-JP # Ruby versions under test platform: + - Ruby27-x64 - Ruby26-x64 - Ruby25-x64 @@ -51,6 +60,9 @@ test_script: $Env:PATH = "C:\${Env:PLATFORM}\bin;${Env:PATH}" $Env:LOG_SPEC_ORDER = 'true' Get-ChildItem Env: | % { Write-Output "$($_.Key): $($_.Value)" } + # override RUBYOPT so we don't use UTF-8 encoding when running specs + # if Ruby is installed via RubyInstaller it probably defaults to '-Eutf-8' + $Env:RUBYOPT = '' # list current OpenSSL install gem list openssl ruby -ropenssl -e 'puts \"OpenSSL Version - #{OpenSSL::OPENSSL_VERSION}\"; puts \"OpenSSL Library Version - #{OpenSSL::OPENSSL_LIBRARY_VERSION}\"' From 1aaa532698cf9b531cbecbfa1429f85b45ddcd49 Mon Sep 17 00:00:00 2001 From: Gabriel Nagy Date: Fri, 21 Aug 2020 15:19:22 +0300 Subject: [PATCH 094/731] (PUP-10623) Audit acceptance based on currently supported OSes This commit removes confines to EOLed platforms, and removes 2 tests which used to only run on EL 5. The tests were previously confined to EL 5 due to them not being meaningful on newer EL versions[1]. [1] https://github.com/puppetlabs/puppet/commit/18bf7e9a0c0b4299f5150f4a20658e924a9f8fb8 --- .../tests/face/loadable_from_modules.rb | 1 - .../tests/resource/file/symbolic_modes.rb | 1 - ...mon_package_name_in_different_providers.rb | 1 - acceptance/tests/resource/package/yum.rb | 1 - ...ket_4123_should_list_all_running_redhat.rb | 15 ---------- ...ket_4123_should_list_all_running_redhat.sh | 29 ------------------- .../ticket_4124_should_list_all_disabled.rb | 15 ---------- .../ticket_4124_should_list_all_disabled.sh | 29 ------------------- ...s_without_service_user_or_group_present.rb | 1 - 9 files changed, 93 deletions(-) delete mode 100644 acceptance/tests/resource/service/ticket_4123_should_list_all_running_redhat.rb delete mode 100755 acceptance/tests/resource/service/ticket_4123_should_list_all_running_redhat.sh delete mode 100644 acceptance/tests/resource/service/ticket_4124_should_list_all_disabled.rb delete mode 100755 acceptance/tests/resource/service/ticket_4124_should_list_all_disabled.sh diff --git a/acceptance/tests/face/loadable_from_modules.rb b/acceptance/tests/face/loadable_from_modules.rb index ceb71e7d227..7339ee73505 100644 --- a/acceptance/tests/face/loadable_from_modules.rb +++ b/acceptance/tests/face/loadable_from_modules.rb @@ -2,7 +2,6 @@ # Because the module tool does not work on windows, we can't run this test there confine :except, :platform => 'windows' -confine :except, :platform => /centos-4|el-4/ # PUP-5226 tag 'audit:medium', 'audit:acceptance', # This has been OS sensitive. diff --git a/acceptance/tests/resource/file/symbolic_modes.rb b/acceptance/tests/resource/file/symbolic_modes.rb index b7cc1121460..720a0cc2a80 100644 --- a/acceptance/tests/resource/file/symbolic_modes.rb +++ b/acceptance/tests/resource/file/symbolic_modes.rb @@ -1,6 +1,5 @@ test_name 'file resource: symbolic modes' do confine :except, :platform => /^eos-/ # See ARISTA-37 - confine :except, :platform => /^solaris-10/ confine :except, :platform => /^windows/ confine :to, {}, hosts.select {|host| !host[:roles].include?('master')} diff --git a/acceptance/tests/resource/package/common_package_name_in_different_providers.rb b/acceptance/tests/resource/package/common_package_name_in_different_providers.rb index c73654de600..9cbd195db50 100644 --- a/acceptance/tests/resource/package/common_package_name_in_different_providers.rb +++ b/acceptance/tests/resource/package/common_package_name_in_different_providers.rb @@ -1,7 +1,6 @@ test_name "ticket 1073: common package name in two different providers should be allowed" do confine :to, {:platform => /(?:centos|el-|fedora)/}, agents - confine :except, :platform => /centos-4|el-4/ # PUP-5227 # Skipping tests if facter finds this is an ec2 host, PUP-7774 agents.each do |agent| skip_test('Skipping EC2 Hosts') if fact_on(agent, 'ec2_metadata') diff --git a/acceptance/tests/resource/package/yum.rb b/acceptance/tests/resource/package/yum.rb index 097a812f15c..596432c3263 100644 --- a/acceptance/tests/resource/package/yum.rb +++ b/acceptance/tests/resource/package/yum.rb @@ -1,7 +1,6 @@ test_name "test the yum package provider" do confine :to, {:platform => /(?:centos|el-|fedora)/}, agents - confine :except, :platform => /centos-4|el-4/ # PUP-5227 # Skipping tests if facter finds this is an ec2 host, PUP-7774 agents.each do |agent| skip_test('Skipping EC2 Hosts') if fact_on(agent, 'ec2_metadata') diff --git a/acceptance/tests/resource/service/ticket_4123_should_list_all_running_redhat.rb b/acceptance/tests/resource/service/ticket_4123_should_list_all_running_redhat.rb deleted file mode 100644 index ca36145bda4..00000000000 --- a/acceptance/tests/resource/service/ticket_4123_should_list_all_running_redhat.rb +++ /dev/null @@ -1,15 +0,0 @@ -test_name "#4123: should list all running services on Redhat/CentOS" do - confine :to, :platform => /(el|centos|oracle|redhat|scientific)-5/ - tag 'audit:medium', - 'audit:integration' # Doesn't change the system it runs on - - step "Validate services running agreement ralsh vs. OS service count" do - # This will remotely exec: - # ticket_4123_should_list_all_running_redhat.sh - - agents.each do |agent| - run_script_on(agent, File.join(File.dirname(__FILE__), 'ticket_4123_should_list_all_running_redhat.sh')) - end - end - -end diff --git a/acceptance/tests/resource/service/ticket_4123_should_list_all_running_redhat.sh b/acceptance/tests/resource/service/ticket_4123_should_list_all_running_redhat.sh deleted file mode 100755 index 59a1c2c9d91..00000000000 --- a/acceptance/tests/resource/service/ticket_4123_should_list_all_running_redhat.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - -# A platform must be specified the only command line arg -# This will facilitate expansion of this tests to include -# the ability to test other OSes - -RALSH_FILE=/tmp/ralsh-running-list-$$ -SERVICE_FILE=/tmp/service-running-list-$$ - -puppet resource service | egrep -B1 "ensure.*=>.*'running" | grep 'service {' | gawk -F"'" '{print $2}' | sort > "$RALSH_FILE" - -if [ -e "$SERVICE_FILE" ]; then - rm "$SERVICE_FILE" -fi - -SERVICEDIR='/etc/init.d' -for SERVICE in $( ls "$SERVICEDIR" | sort | egrep -v "(functions|halt|killall|single|linuxconf)" ) ; do - if env -i LANG="$LANG" PATH="$PATH" TERM="$TERM" "${SERVICEDIR}/${SERVICE}" status; then - echo "$SERVICE" >> "$SERVICE_FILE" - fi -done - -if diff "$RALSH_FILE" "$SERVICE_FILE" ; then - echo "Ralsh and system service count agree" - exit 0 -else - echo "Ralsh and system service count NOT in agreement" - exit 1 -fi diff --git a/acceptance/tests/resource/service/ticket_4124_should_list_all_disabled.rb b/acceptance/tests/resource/service/ticket_4124_should_list_all_disabled.rb deleted file mode 100644 index 3f87990233e..00000000000 --- a/acceptance/tests/resource/service/ticket_4124_should_list_all_disabled.rb +++ /dev/null @@ -1,15 +0,0 @@ -test_name "#4124: should list all disabled services on Redhat/CentOS" do - confine :to, :platform => /(el|centos|oracle|redhat|scientific)-5/ - tag 'audit:medium', - 'audit:integration' # Doesn't change the system it runs on - - step "Validate disabled services agreement ralsh vs. OS service count" do - # This will remotely exec: - # ticket_4124_should_list_all_disabled.sh - - agents.each do |agent| - run_script_on(agent, File.join(File.dirname(__FILE__), 'ticket_4124_should_list_all_disabled.sh')) - end - end - -end diff --git a/acceptance/tests/resource/service/ticket_4124_should_list_all_disabled.sh b/acceptance/tests/resource/service/ticket_4124_should_list_all_disabled.sh deleted file mode 100755 index 88710692b42..00000000000 --- a/acceptance/tests/resource/service/ticket_4124_should_list_all_disabled.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - -# A platform must be specified the only command line arg -# This will facilitate expansion of this tests to include -# the ability to test other OSes - -RALSH_FILE=/tmp/ralsh-disabled-list-$$ -SERVICE_FILE=/tmp/service-disabled-list-$$ - -puppet resource service | egrep -B2 "enable.*=>.*'false" | grep "service {" | awk -F"'" '{print $2}' | sort > "$RALSH_FILE" - -if [ -e "$SERVICE_FILE" ]; then - rm "$SERVICE_FILE" -fi - -SERVICEDIR='/etc/init.d' -for SERVICE in $( ls "$SERVICEDIR" | sort | egrep -v "(functions|halt|killall|single|linuxconf)" ) ; do - if ! chkconfig "$SERVICE"; then - echo "$SERVICE" >> "$SERVICE_FILE" - fi -done - -if diff "$RALSH_FILE" "$SERVICE_FILE" ; then - echo "Ralsh and system service count agree" - exit 0 -else - echo "Ralsh and system service count NOT in agreement" - exit 1 -fi diff --git a/acceptance/tests/ticket_9862_puppet_runs_without_service_user_or_group_present.rb b/acceptance/tests/ticket_9862_puppet_runs_without_service_user_or_group_present.rb index a776fa75867..bf8c9c7d864 100644 --- a/acceptance/tests/ticket_9862_puppet_runs_without_service_user_or_group_present.rb +++ b/acceptance/tests/ticket_9862_puppet_runs_without_service_user_or_group_present.rb @@ -8,7 +8,6 @@ # puppet doesn't try to manage ownership on windows. confine :except, :platform => 'windows' -confine :except, :platform => /solaris-10/ # See PUP-5200 confine :except, :platform => /^eos-/ confine :except, :platform => /^cisco_/ # See PUP-5828 From 4f30d93c3eec899ebaca4d7b8eb89aaae89c746f Mon Sep 17 00:00:00 2001 From: Gabriel Nagy Date: Tue, 25 Aug 2020 15:12:13 +0300 Subject: [PATCH 095/731] (PUP-10623) Remove confines to unsupported platforms Remove acceptance test confines for Cisco, EOS, Cumulus, HuaweiOS platforms. --- .../lib/puppet/acceptance/common_utils.rb | 23 ------------------- .../tests/agent/agent_disable_lockfile.rb | 2 -- .../tests/i18n/check_puppet_run_message.rb | 3 --- .../tests/i18n/enable_option_disable_i18n.rb | 3 --- acceptance/tests/i18n/modules/puppet_agent.rb | 3 --- .../modules/puppet_agent_cached_catalog.rb | 3 --- ...puppet_agent_with_multiple_environments.rb | 3 --- acceptance/tests/i18n/modules/puppet_apply.rb | 3 --- .../i18n/modules/puppet_apply_module_lang.rb | 1 - .../tests/i18n/modules/puppet_describe.rb | 3 --- acceptance/tests/i18n/modules/puppet_face.rb | 3 --- acceptance/tests/i18n/modules/puppet_facts.rb | 3 --- .../tests/i18n/modules/puppet_resource.rb | 3 --- .../tests/language/exported_resources.rb | 2 -- ...uginfacts_should_be_resolvable_on_agent.rb | 4 +--- .../tests/resource/file/symbolic_modes.rb | 1 - .../tests/resource/group/should_create.rb | 2 +- .../tests/resource/group/should_destroy.rb | 2 +- .../tests/resource/group/should_modify_gid.rb | 2 +- .../group/should_not_create_existing.rb | 2 +- .../group/should_not_destoy_unexisting.rb | 2 +- .../tests/resource/group/should_query.rb | 2 +- .../tests/resource/group/should_query_all.rb | 2 +- .../service/should_not_change_the_system.rb | 1 - .../tests/resource/user/should_create.rb | 2 -- .../user/should_create_with_expiry_absent.rb | 4 +--- .../resource/user/should_create_with_gid.rb | 2 -- .../tests/resource/user/should_destroy.rb | 3 +-- .../user/should_destroy_with_managehome.rb | 3 +-- .../resource/user/should_manage_groups.rb | 2 -- .../resource/user/should_manage_shell.rb | 2 -- .../tests/resource/user/should_modify.rb | 2 -- .../tests/resource/user/should_modify_gid.rb | 2 -- .../should_modify_when_not_managing_home.rb | 3 +-- .../user/should_modify_while_managing_home.rb | 3 +-- .../user/should_not_create_existing.rb | 3 +-- .../user/should_not_destoy_unexisting.rb | 3 +-- .../tests/resource/user/should_purge.rb | 2 -- .../tests/resource/user/should_query.rb | 3 +-- .../tests/resource/user/should_query_all.rb | 2 +- .../tests/resource/user/utf8_user_comments.rb | 3 +-- .../security/cve-2013-1640_facter_string.rb | 1 - acceptance/tests/ssl/autosign_command.rb | 2 -- .../tests/ssl/certificate_extensions.rb | 2 -- ...s_without_service_user_or_group_present.rb | 2 -- .../tests/utf8/utf8-in-file-resource.rb | 4 ---- .../tests/utf8/utf8-in-function-args.rb | 4 ---- .../tests/utf8/utf8-in-puppet-describe.rb | 5 ---- acceptance/tests/utf8/utf8-recursive-copy.rb | 3 --- 49 files changed, 18 insertions(+), 127 deletions(-) diff --git a/acceptance/lib/puppet/acceptance/common_utils.rb b/acceptance/lib/puppet/acceptance/common_utils.rb index 5597d350b2b..fdd487a4df8 100644 --- a/acceptance/lib/puppet/acceptance/common_utils.rb +++ b/acceptance/lib/puppet/acceptance/common_utils.rb @@ -5,29 +5,6 @@ module BeakerUtils def assert_matching_arrays(expected, actual, message = "") assert_equal(expected.sort, actual.sort, message) end - - # TODO: Remove the wrappers to user_present - # and user_absent if Beaker::Host's user_present - # and user_absent functions are fixed to work with - # Arista (EOS). - - def user_present(host, username) - case host['platform'] - when /eos/ - on(host, "useradd #{username}") - else - host.user_present(username) - end - end - - def user_absent(host, username) - case host['platform'] - when /eos/ - on(host, "userdel #{username}", acceptable_exit_codes: [0, 1]) - else - host.user_absent(username) - end - end end module PackageUtils diff --git a/acceptance/tests/agent/agent_disable_lockfile.rb b/acceptance/tests/agent/agent_disable_lockfile.rb index 132d0718eb1..7b7de9cf488 100644 --- a/acceptance/tests/agent/agent_disable_lockfile.rb +++ b/acceptance/tests/agent/agent_disable_lockfile.rb @@ -1,6 +1,4 @@ test_name "C4553 - agent --disable/--enable functionality should manage the agent lockfile properly" -confine :except, :platform => 'cisco_nexus' #See BKR-749 - tag 'audit:integration', # lockfile uses the standard `vardir` location to store/query lockfile. # The validation of the `vardir` at the OS level # should be accomplished in another test. diff --git a/acceptance/tests/i18n/check_puppet_run_message.rb b/acceptance/tests/i18n/check_puppet_run_message.rb index d0cd3ace85a..75e5954fad7 100644 --- a/acceptance/tests/i18n/check_puppet_run_message.rb +++ b/acceptance/tests/i18n/check_puppet_run_message.rb @@ -1,7 +1,4 @@ test_name 'C100559: puppet agent run output with a supported language should be localized' do - confine :except, :platform => /^eos-/ # translation not supported - confine :except, :platform => /^cisco_/ # translation not supported - confine :except, :platform => /^cumulus/ # translation not supported confine :except, :platform => /^solaris/ # translation not supported confine :except, :platform => /^aix/ # QENG-5283 needed for this to work diff --git a/acceptance/tests/i18n/enable_option_disable_i18n.rb b/acceptance/tests/i18n/enable_option_disable_i18n.rb index 9104d952870..c9cb152068f 100644 --- a/acceptance/tests/i18n/enable_option_disable_i18n.rb +++ b/acceptance/tests/i18n/enable_option_disable_i18n.rb @@ -1,7 +1,4 @@ test_name 'C100561: verify that disable_i18n can be set to true and have translations disabled' do - confine :except, :platform => /^eos-/ # translation not supported - confine :except, :platform => /^cisco_/ # translation not supported - confine :except, :platform => /^cumulus/ # translation not supported confine :except, :platform => /^solaris/ # translation not supported confine :except, :platform => /^aix/ # QENG-5283 needed for this to work diff --git a/acceptance/tests/i18n/modules/puppet_agent.rb b/acceptance/tests/i18n/modules/puppet_agent.rb index 56a4ed7a385..6d5e378475c 100644 --- a/acceptance/tests/i18n/modules/puppet_agent.rb +++ b/acceptance/tests/i18n/modules/puppet_agent.rb @@ -1,7 +1,4 @@ test_name 'C100565: puppet agent with module should translate messages' do - confine :except, :platform => /^eos-/ # translation not supported - confine :except, :platform => /^cisco/ # translation not supported - confine :except, :platform => /^cumulus/ # translation not supported confine :except, :platform => /^solaris/ # translation not supported tag 'audit:medium', diff --git a/acceptance/tests/i18n/modules/puppet_agent_cached_catalog.rb b/acceptance/tests/i18n/modules/puppet_agent_cached_catalog.rb index feb9d5e6154..1ed637c483d 100644 --- a/acceptance/tests/i18n/modules/puppet_agent_cached_catalog.rb +++ b/acceptance/tests/i18n/modules/puppet_agent_cached_catalog.rb @@ -1,7 +1,4 @@ test_name 'C100566: puppet agent with module should translate messages when using a cached catalog' do - confine :except, :platform => /^eos-/ # translation not supported - confine :except, :platform => /^cisco/ # translation not supported - confine :except, :platform => /^cumulus/ # translation not supported confine :except, :platform => /^solaris/ # translation not supported tag 'audit:medium', diff --git a/acceptance/tests/i18n/modules/puppet_agent_with_multiple_environments.rb b/acceptance/tests/i18n/modules/puppet_agent_with_multiple_environments.rb index a6d3708658a..1319d6ad338 100644 --- a/acceptance/tests/i18n/modules/puppet_agent_with_multiple_environments.rb +++ b/acceptance/tests/i18n/modules/puppet_agent_with_multiple_environments.rb @@ -1,7 +1,4 @@ test_name 'C100575: puppet agent with different modules in different environments should translate based on their module' do - confine :except, :platform => /^eos-/ # translation not supported - confine :except, :platform => /^cisco/ # translation not supported - confine :except, :platform => /^cumulus/ # translation not supported confine :except, :platform => /^solaris/ # translation not supported tag 'audit:medium', diff --git a/acceptance/tests/i18n/modules/puppet_apply.rb b/acceptance/tests/i18n/modules/puppet_apply.rb index 089532a9966..b9b097060d9 100644 --- a/acceptance/tests/i18n/modules/puppet_apply.rb +++ b/acceptance/tests/i18n/modules/puppet_apply.rb @@ -1,7 +1,4 @@ test_name 'C100567: puppet apply of module should translate messages' do - confine :except, :platform => /^eos-/ # translation not supported - confine :except, :platform => /^cisco/ # translation not supported - confine :except, :platform => /^cumulus/ # translation not supported confine :except, :platform => /^solaris/ # translation not supported skip_test "Localizations are unavailable" diff --git a/acceptance/tests/i18n/modules/puppet_apply_module_lang.rb b/acceptance/tests/i18n/modules/puppet_apply_module_lang.rb index 4696d54a2ed..a4950e89dfe 100644 --- a/acceptance/tests/i18n/modules/puppet_apply_module_lang.rb +++ b/acceptance/tests/i18n/modules/puppet_apply_module_lang.rb @@ -1,6 +1,5 @@ test_name 'C100574: puppet apply using a module should translate messages in a language not supported by puppet' do - confine :except, :platform => /^cisco/ # translation not supported confine :except, :platform => /^windows/ # Can't print Finish on an English or Japanese code page tag 'audit:medium', diff --git a/acceptance/tests/i18n/modules/puppet_describe.rb b/acceptance/tests/i18n/modules/puppet_describe.rb index 66a8d0781e1..8d0cbb13e87 100644 --- a/acceptance/tests/i18n/modules/puppet_describe.rb +++ b/acceptance/tests/i18n/modules/puppet_describe.rb @@ -1,7 +1,4 @@ test_name 'C100576: puppet describe with module type translates message' do - confine :except, :platform => /^eos-/ # translation not supported - confine :except, :platform => /^cisco/ # translation not supported - confine :except, :platform => /^cumulus/ # translation not supported confine :except, :platform => /^solaris/ # translation not supported tag 'audit:medium', diff --git a/acceptance/tests/i18n/modules/puppet_face.rb b/acceptance/tests/i18n/modules/puppet_face.rb index 170c30de291..5259065a5e6 100644 --- a/acceptance/tests/i18n/modules/puppet_face.rb +++ b/acceptance/tests/i18n/modules/puppet_face.rb @@ -1,7 +1,4 @@ test_name 'C100573: puppet application/face with module translates messages' do - confine :except, :platform => /^eos-/ # translation not supported - confine :except, :platform => /^cisco/ # translation not supported - confine :except, :platform => /^cumulus/ # translation not supported confine :except, :platform => /^solaris/ # translation not supported tag 'audit:medium', diff --git a/acceptance/tests/i18n/modules/puppet_facts.rb b/acceptance/tests/i18n/modules/puppet_facts.rb index 1ad9f641417..889543ee513 100644 --- a/acceptance/tests/i18n/modules/puppet_facts.rb +++ b/acceptance/tests/i18n/modules/puppet_facts.rb @@ -1,7 +1,4 @@ test_name 'C100564: puppet facts translates the fact error message' do - confine :except, :platform => /^eos-/ # translation not supported - confine :except, :platform => /^cisco/ # translation not supported - confine :except, :platform => /^cumulus/ # translation not supported confine :except, :platform => /^solaris/ # translation not supported tag 'audit:medium', diff --git a/acceptance/tests/i18n/modules/puppet_resource.rb b/acceptance/tests/i18n/modules/puppet_resource.rb index c83bbc1130f..c6ffc02d937 100644 --- a/acceptance/tests/i18n/modules/puppet_resource.rb +++ b/acceptance/tests/i18n/modules/puppet_resource.rb @@ -1,7 +1,4 @@ test_name 'C100572: puppet resource with module translates messages' do - confine :except, :platform => /^eos-/ # translation not supported - confine :except, :platform => /^cisco/ # translation not supported - confine :except, :platform => /^cumulus/ # translation not supported confine :except, :platform => /^solaris/ # translation not supported tag 'audit:medium', diff --git a/acceptance/tests/language/exported_resources.rb b/acceptance/tests/language/exported_resources.rb index db394e4749b..48d43d8c9ad 100644 --- a/acceptance/tests/language/exported_resources.rb +++ b/acceptance/tests/language/exported_resources.rb @@ -7,8 +7,6 @@ 'audit:refactor', # This could be a component of a larger workflow scenario. 'server' - # user resource doesn't have a provider on arista - skip_test if agents.any? {|agent| agent['platform'] =~ /^eos/ } # see PUP-5404, ARISTA-42 skip_test 'requires puppetserver to service restart' if @options[:type] != 'aio' app_type = File.basename(__FILE__, '.*') diff --git a/acceptance/tests/pluginsync/4420_pluginfacts_should_be_resolvable_on_agent.rb b/acceptance/tests/pluginsync/4420_pluginfacts_should_be_resolvable_on_agent.rb index 31ada0eace7..e7ccf2542ee 100644 --- a/acceptance/tests/pluginsync/4420_pluginfacts_should_be_resolvable_on_agent.rb +++ b/acceptance/tests/pluginsync/4420_pluginfacts_should_be_resolvable_on_agent.rb @@ -1,6 +1,4 @@ test_name "Pluginsync'ed external facts should be resolvable on the agent" do - confine :except, :platform => 'cisco_nexus' #See BKR-749 - tag 'audit:medium', 'audit:integration' @@ -129,4 +127,4 @@ end end end -end \ No newline at end of file +end diff --git a/acceptance/tests/resource/file/symbolic_modes.rb b/acceptance/tests/resource/file/symbolic_modes.rb index 720a0cc2a80..c6aff6a9cbd 100644 --- a/acceptance/tests/resource/file/symbolic_modes.rb +++ b/acceptance/tests/resource/file/symbolic_modes.rb @@ -1,5 +1,4 @@ test_name 'file resource: symbolic modes' do - confine :except, :platform => /^eos-/ # See ARISTA-37 confine :except, :platform => /^windows/ confine :to, {}, hosts.select {|host| !host[:roles].include?('master')} diff --git a/acceptance/tests/resource/group/should_create.rb b/acceptance/tests/resource/group/should_create.rb index 0e88ab15b51..aed9ebea162 100644 --- a/acceptance/tests/resource/group/should_create.rb +++ b/acceptance/tests/resource/group/should_create.rb @@ -1,5 +1,5 @@ test_name "should create a group" -confine :except, :platform => /^cisco_/ # See PUP-5828 + tag 'audit:high', 'audit:refactor', # Use block style `test_name` 'audit:acceptance' # Could be done at the integration (or unit) layer though diff --git a/acceptance/tests/resource/group/should_destroy.rb b/acceptance/tests/resource/group/should_destroy.rb index ce95d765457..c0dfcb26138 100644 --- a/acceptance/tests/resource/group/should_destroy.rb +++ b/acceptance/tests/resource/group/should_destroy.rb @@ -1,5 +1,5 @@ test_name "should destroy a group" -confine :except, :platform => /^cisco_/ # See PUP-5828 + tag 'audit:high', 'audit:refactor', # Use block style `test_name` 'audit:acceptance' # Could be done at the integration (or unit) layer though diff --git a/acceptance/tests/resource/group/should_modify_gid.rb b/acceptance/tests/resource/group/should_modify_gid.rb index 0e33f17caa1..191bb0cc819 100644 --- a/acceptance/tests/resource/group/should_modify_gid.rb +++ b/acceptance/tests/resource/group/should_modify_gid.rb @@ -1,6 +1,6 @@ test_name "should modify gid of existing group" confine :except, :platform => 'windows' -confine :except, :platform => /^cisco_/ # See PUP-5828 + tag 'audit:high', 'audit:refactor', # Use block style `test_name` 'audit:acceptance' # Could be done at the integration (or unit) layer though diff --git a/acceptance/tests/resource/group/should_not_create_existing.rb b/acceptance/tests/resource/group/should_not_create_existing.rb index 6884d090ad6..eb046d857d3 100644 --- a/acceptance/tests/resource/group/should_not_create_existing.rb +++ b/acceptance/tests/resource/group/should_not_create_existing.rb @@ -1,5 +1,5 @@ test_name "group should not create existing group" -confine :except, :platform => /^cisco_/ # See PUP-5828 + tag 'audit:high', 'audit:refactor', # Use block style `test_name` 'audit:acceptance' # Could be done at the integration (or unit) layer though diff --git a/acceptance/tests/resource/group/should_not_destoy_unexisting.rb b/acceptance/tests/resource/group/should_not_destoy_unexisting.rb index 0fa9e23216b..38397e80f5c 100644 --- a/acceptance/tests/resource/group/should_not_destoy_unexisting.rb +++ b/acceptance/tests/resource/group/should_not_destoy_unexisting.rb @@ -1,5 +1,5 @@ test_name "should not destroy a group that doesn't exist" -confine :except, :platform => /^cisco_/ # See PUP-5828 + tag 'audit:high', 'audit:refactor', # Use block style `test_name` 'audit:acceptance' # Could be done at the integration (or unit) layer though diff --git a/acceptance/tests/resource/group/should_query.rb b/acceptance/tests/resource/group/should_query.rb index aa99685d03e..07e3f6423e1 100644 --- a/acceptance/tests/resource/group/should_query.rb +++ b/acceptance/tests/resource/group/should_query.rb @@ -1,5 +1,5 @@ test_name "test that we can query and find a group that exists." -confine :except, :platform => /^cisco_/ # See PUP-5828 + tag 'audit:high', 'audit:refactor', # Use block style `test_name` 'audit:acceptance' # Could be done at the integration (or unit) layer though diff --git a/acceptance/tests/resource/group/should_query_all.rb b/acceptance/tests/resource/group/should_query_all.rb index b72ee6f6495..3fb16c36560 100644 --- a/acceptance/tests/resource/group/should_query_all.rb +++ b/acceptance/tests/resource/group/should_query_all.rb @@ -1,5 +1,5 @@ test_name "should query all groups" -confine :except, :platform => /^cisco_/ # See PUP-5828 + tag 'audit:high', 'audit:refactor', # Use block style `test_name` 'audit:integration' # Does not modify system running test diff --git a/acceptance/tests/resource/service/should_not_change_the_system.rb b/acceptance/tests/resource/service/should_not_change_the_system.rb index 7da3d06028d..b173b230a7a 100644 --- a/acceptance/tests/resource/service/should_not_change_the_system.rb +++ b/acceptance/tests/resource/service/should_not_change_the_system.rb @@ -6,7 +6,6 @@ confine :except, :platform => 'windows' confine :except, :platform => 'solaris' -confine :except, :platform => /^cisco_/ # See PUP-5827 # For each script in /etc/init.d, the init service provider will call # the script with the `status` argument, except for blacklisted diff --git a/acceptance/tests/resource/user/should_create.rb b/acceptance/tests/resource/user/should_create.rb index ab402be8b2f..e91e3f3dd9a 100644 --- a/acceptance/tests/resource/user/should_create.rb +++ b/acceptance/tests/resource/user/should_create.rb @@ -1,6 +1,4 @@ test_name "should create a user" -confine :except, :platform => /^eos-/ # See ARISTA-37 -confine :except, :platform => /^cisco_/ # See PUP-5828 tag 'audit:medium', 'audit:refactor', # Use block style `test_run` diff --git a/acceptance/tests/resource/user/should_create_with_expiry_absent.rb b/acceptance/tests/resource/user/should_create_with_expiry_absent.rb index c5c817eb792..b08bd9a4c5c 100644 --- a/acceptance/tests/resource/user/should_create_with_expiry_absent.rb +++ b/acceptance/tests/resource/user/should_create_with_expiry_absent.rb @@ -1,7 +1,5 @@ test_name "verifies that puppet resource creates a user and assigns the correct expiry date when absent" do confine :except, :platform => 'windows' - confine :except, :platform => /^eos-/ # See ARISTA-37 - confine :except, :platform => /^cisco_/ # See PUP-5828 tag 'audit:medium', 'audit:acceptance' # Could be done as integration tests, but would @@ -31,4 +29,4 @@ assert_no_match(/expiry.*=>/, result.stdout) end end -end \ No newline at end of file +end diff --git a/acceptance/tests/resource/user/should_create_with_gid.rb b/acceptance/tests/resource/user/should_create_with_gid.rb index d221b307fae..d6b913c656f 100644 --- a/acceptance/tests/resource/user/should_create_with_gid.rb +++ b/acceptance/tests/resource/user/should_create_with_gid.rb @@ -1,7 +1,5 @@ test_name "verifies that puppet resource creates a user and assigns the correct group" confine :except, :platform => 'windows' -confine :except, :platform => /^eos-/ # See ARISTA-37 -confine :except, :platform => /^cisco_/ # See PUP-5828 tag 'audit:medium', 'audit:refactor', # Use block style `test_run` diff --git a/acceptance/tests/resource/user/should_destroy.rb b/acceptance/tests/resource/user/should_destroy.rb index b95e1b08dcc..343b64f12bb 100644 --- a/acceptance/tests/resource/user/should_destroy.rb +++ b/acceptance/tests/resource/user/should_destroy.rb @@ -1,6 +1,5 @@ test_name "should delete a user" -confine :except, :platform => /^eos-/ # See ARISTA-37 -confine :except, :platform => /^cisco_/ # See PUP-5828 + tag 'audit:medium', 'audit:refactor', # Use block style `test_run` 'audit:acceptance' # Could be done as integration tests, but would diff --git a/acceptance/tests/resource/user/should_destroy_with_managehome.rb b/acceptance/tests/resource/user/should_destroy_with_managehome.rb index 3b6e12299f3..4c02b32a649 100644 --- a/acceptance/tests/resource/user/should_destroy_with_managehome.rb +++ b/acceptance/tests/resource/user/should_destroy_with_managehome.rb @@ -1,6 +1,5 @@ test_name "should delete a user with managehome=true" -confine :except, :platform => /^eos-/ # See ARISTA-37 -confine :except, :platform => /^cisco_/ # See PUP-5828 + tag 'audit:medium', 'audit:refactor', # Use block style `test_run` 'audit:acceptance' # Could be done as integration tests, but would diff --git a/acceptance/tests/resource/user/should_manage_groups.rb b/acceptance/tests/resource/user/should_manage_groups.rb index a4e67e5b5fe..8c889a3a10c 100644 --- a/acceptance/tests/resource/user/should_manage_groups.rb +++ b/acceptance/tests/resource/user/should_manage_groups.rb @@ -5,8 +5,6 @@ # sense. confine :except, :platform => /windows/ - confine :except, :platform => /eos-/ # See ARISTA-37 - confine :except, :platform => /cisco_/ # See PUP-5828 tag 'audit:medium', 'audit:acceptance' # Could be done as integration tests, but would diff --git a/acceptance/tests/resource/user/should_manage_shell.rb b/acceptance/tests/resource/user/should_manage_shell.rb index c4cdfabf028..7caa889cc0c 100644 --- a/acceptance/tests/resource/user/should_manage_shell.rb +++ b/acceptance/tests/resource/user/should_manage_shell.rb @@ -10,8 +10,6 @@ name = "pl#{rand(999999).to_i}" confine :except, :platform => 'windows' -confine :except, :platform => /^eos-/ # See ARISTA-37 -confine :except, :platform => /^cisco_/ # See PUP-5828 agents.each do |agent| step "ensure the user and group do not exist" diff --git a/acceptance/tests/resource/user/should_modify.rb b/acceptance/tests/resource/user/should_modify.rb index 93b23a34f2f..4bbc93a3dd3 100644 --- a/acceptance/tests/resource/user/should_modify.rb +++ b/acceptance/tests/resource/user/should_modify.rb @@ -1,6 +1,4 @@ test_name "should modify a user" -confine :except, :platform => /^eos-/ # See ARISTA-37 -confine :except, :platform => /^cisco_/ # See PUP-5828 tag 'audit:medium', 'audit:refactor', # Use block style `test_run` 'audit:acceptance' # Could be done as integration tests, but would diff --git a/acceptance/tests/resource/user/should_modify_gid.rb b/acceptance/tests/resource/user/should_modify_gid.rb index 29138349110..f28a32d37ac 100644 --- a/acceptance/tests/resource/user/should_modify_gid.rb +++ b/acceptance/tests/resource/user/should_modify_gid.rb @@ -1,8 +1,6 @@ test_name "verify that we can modify the gid" confine :except, :platform => 'windows' confine :except, :platform => /aix/ # PUP-5358 -confine :except, :platform => /^eos-/ # See ARISTA-37 -confine :except, :platform => /^cisco_/ # See PUP-5828 tag 'audit:medium', 'audit:refactor', # Use block style `test_run` diff --git a/acceptance/tests/resource/user/should_modify_when_not_managing_home.rb b/acceptance/tests/resource/user/should_modify_when_not_managing_home.rb index 48236271c50..6a3eea17362 100644 --- a/acceptance/tests/resource/user/should_modify_when_not_managing_home.rb +++ b/acceptance/tests/resource/user/should_modify_when_not_managing_home.rb @@ -1,6 +1,5 @@ test_name "should modify a user when no longer managing home (#20726)" -confine :except, :platform => /^eos-/ # See ARISTA-37 -confine :except, :platform => /^cisco_/ # See PUP-5828 + tag 'audit:medium', 'audit:refactor', # Use block style `test_run` 'audit:acceptance' # Could be done as integration tests, but would diff --git a/acceptance/tests/resource/user/should_modify_while_managing_home.rb b/acceptance/tests/resource/user/should_modify_while_managing_home.rb index 5bf9a891f2b..6b848280443 100644 --- a/acceptance/tests/resource/user/should_modify_while_managing_home.rb +++ b/acceptance/tests/resource/user/should_modify_while_managing_home.rb @@ -1,6 +1,5 @@ test_name "should modify a user without changing home directory (pending #19542)" -confine :except, :platform => /^eos-/ # See ARISTA-37 -confine :except, :platform => /^cisco_/ # See PUP-5828 + tag 'audit:medium', 'audit:refactor', # Use block style `test_run` 'audit:acceptance' # Could be done as integration tests, but would diff --git a/acceptance/tests/resource/user/should_not_create_existing.rb b/acceptance/tests/resource/user/should_not_create_existing.rb index 7b3c084e027..c452f7129ab 100644 --- a/acceptance/tests/resource/user/should_not_create_existing.rb +++ b/acceptance/tests/resource/user/should_not_create_existing.rb @@ -1,6 +1,5 @@ test_name "tests that user resource will not add users that already exist." do - confine :except, :platform => /^eos-/ # See ARISTA-37 - confine :except, :platform => /^cisco_/ # See PUP-5828 + tag 'audit:medium', 'audit:acceptance' # Could be done as integration tests, but would # require changing the system running the test diff --git a/acceptance/tests/resource/user/should_not_destoy_unexisting.rb b/acceptance/tests/resource/user/should_not_destoy_unexisting.rb index 7b324bb2338..c40ebf3f4d9 100644 --- a/acceptance/tests/resource/user/should_not_destoy_unexisting.rb +++ b/acceptance/tests/resource/user/should_not_destoy_unexisting.rb @@ -1,6 +1,5 @@ test_name "ensure that puppet does not report removing a user that does not exist" -confine :except, :platform => /^eos-/ # See ARISTA-37 -confine :except, :platform => /^cisco_/ # See PUP-5828 + tag 'audit:medium', 'audit:refactor', # Use block style `test_run` 'audit:acceptance' # Could be done as integration tests, but would diff --git a/acceptance/tests/resource/user/should_purge.rb b/acceptance/tests/resource/user/should_purge.rb index 471e50cf230..597c11f0af9 100644 --- a/acceptance/tests/resource/user/should_purge.rb +++ b/acceptance/tests/resource/user/should_purge.rb @@ -1,6 +1,4 @@ test_name "should purge a user" do - confine :except, :platform => /^eos-/ # See ARISTA-37 - confine :except, :platform => /^cisco_/ # See PUP-5828 # Until purging works on AIX, Solaris, and OSX. See PUP-9188 confine :except, :platform => /^aix/ confine :except, :platform => /^solaris/ diff --git a/acceptance/tests/resource/user/should_query.rb b/acceptance/tests/resource/user/should_query.rb index 119ca73e6a7..018820e5d09 100644 --- a/acceptance/tests/resource/user/should_query.rb +++ b/acceptance/tests/resource/user/should_query.rb @@ -1,6 +1,5 @@ test_name "test that we can query and find a user that exists." -confine :except, :platform => /^eos-/ # See ARISTA-37 -confine :except, :platform => /^cisco_/ # See PUP-5828 + tag 'audit:medium', 'audit:refactor', # Use block style `test_run` 'audit:acceptance' # Could be done as integration tests, but would diff --git a/acceptance/tests/resource/user/should_query_all.rb b/acceptance/tests/resource/user/should_query_all.rb index f6221ab019f..fa8073588ed 100644 --- a/acceptance/tests/resource/user/should_query_all.rb +++ b/acceptance/tests/resource/user/should_query_all.rb @@ -1,5 +1,5 @@ test_name "should query all users" -confine :except, :platform => /^cisco_/ # See PUP-5828 + tag 'audit:medium', 'audit:refactor', # Use block style `test_run` 'audit:integration' diff --git a/acceptance/tests/resource/user/utf8_user_comments.rb b/acceptance/tests/resource/user/utf8_user_comments.rb index ed846177417..3d639eb59bc 100644 --- a/acceptance/tests/resource/user/utf8_user_comments.rb +++ b/acceptance/tests/resource/user/utf8_user_comments.rb @@ -15,10 +15,9 @@ # in ways that might require special permissions # or be harmful to the system running the test - # PUP-7049 / ARISTA-42 - user provider bug on Arista # AIX providers are separate from most other platforms, # and have not been made unicode-aware yet. - confine :except, :platform => /^(eos|aix)-/ + confine :except, :platform => /aix/ user0 = "foo#{rand(99999).to_i}" user1 = "bar#{rand(99999).to_i}" diff --git a/acceptance/tests/security/cve-2013-1640_facter_string.rb b/acceptance/tests/security/cve-2013-1640_facter_string.rb index b14721f7cb8..8d895422411 100644 --- a/acceptance/tests/security/cve-2013-1640_facter_string.rb +++ b/acceptance/tests/security/cve-2013-1640_facter_string.rb @@ -7,7 +7,6 @@ 'audit:integration' confine :except, :platform => 'windows' - confine :except, :platform => 'cisco_nexus' # See BKR-749 on agents, %q[ FACTER_string="<%= %x{ /bin/echo hax0rd } %>" ] + %q[ puppet apply -e ] + diff --git a/acceptance/tests/ssl/autosign_command.rb b/acceptance/tests/ssl/autosign_command.rb index 7a3231f9142..b764d20880a 100644 --- a/acceptance/tests/ssl/autosign_command.rb +++ b/acceptance/tests/ssl/autosign_command.rb @@ -1,6 +1,4 @@ test_name "autosign command and csr attributes behavior (#7243,#7244)" do - confine :except, :platform => /^cisco_/ # See PUP-5827 - skip_test "Test requires at least one non-master agent" if hosts.length == 1 tag 'audit:high', # cert/ca core behavior diff --git a/acceptance/tests/ssl/certificate_extensions.rb b/acceptance/tests/ssl/certificate_extensions.rb index ebdcad48e70..a12fe63fdba 100644 --- a/acceptance/tests/ssl/certificate_extensions.rb +++ b/acceptance/tests/ssl/certificate_extensions.rb @@ -2,8 +2,6 @@ extend Puppet::Acceptance::TempFileUtils test_name "certificate extensions available as trusted data" do - confine :except, :platform => /^cisco_/ # See PUP-5827 - skip_test "Test requires at least one non-master agent" if hosts.length == 1 tag 'audit:high', # ca/cert core functionality diff --git a/acceptance/tests/ticket_9862_puppet_runs_without_service_user_or_group_present.rb b/acceptance/tests/ticket_9862_puppet_runs_without_service_user_or_group_present.rb index bf8c9c7d864..ea0b0235947 100644 --- a/acceptance/tests/ticket_9862_puppet_runs_without_service_user_or_group_present.rb +++ b/acceptance/tests/ticket_9862_puppet_runs_without_service_user_or_group_present.rb @@ -8,8 +8,6 @@ # puppet doesn't try to manage ownership on windows. confine :except, :platform => 'windows' -confine :except, :platform => /^eos-/ -confine :except, :platform => /^cisco_/ # See PUP-5828 require 'puppet/acceptance/temp_file_utils' extend Puppet::Acceptance::TempFileUtils diff --git a/acceptance/tests/utf8/utf8-in-file-resource.rb b/acceptance/tests/utf8/utf8-in-file-resource.rb index b0a95bea835..6583a0fa0f9 100755 --- a/acceptance/tests/utf8/utf8-in-file-resource.rb +++ b/acceptance/tests/utf8/utf8-in-file-resource.rb @@ -5,11 +5,7 @@ confine :except, :platform => [ 'windows', # PUP-6983 - 'eos-4', # PUP-7146 - 'cumulus', # PUP-7147 - 'cisco_ios', # PUP-7150 'aix', # PUP-7194 - 'huawei', # PUP-7195 ] # utf8chars = "€‰ㄘ万竹ÜÖ" diff --git a/acceptance/tests/utf8/utf8-in-function-args.rb b/acceptance/tests/utf8/utf8-in-function-args.rb index c0ef9fa2d62..efc924519e5 100644 --- a/acceptance/tests/utf8/utf8-in-function-args.rb +++ b/acceptance/tests/utf8/utf8-in-function-args.rb @@ -6,11 +6,7 @@ confine :except, :platform => [ 'windows', # PUP-6983 - 'eos-4', # PUP-7146 - 'cumulus', # PUP-7147 - 'cisco', # PUP-7150 'aix', # PUP-7194 - 'huawei', # PUP-7195 ] # utf8chars = "€‰ㄘ万竹ÜÖ" diff --git a/acceptance/tests/utf8/utf8-in-puppet-describe.rb b/acceptance/tests/utf8/utf8-in-puppet-describe.rb index 7ceb22d504f..7f4c4c67c35 100644 --- a/acceptance/tests/utf8/utf8-in-puppet-describe.rb +++ b/acceptance/tests/utf8/utf8-in-puppet-describe.rb @@ -6,11 +6,6 @@ # remove with_puppet_running_on unless pluginsync is absolutely necessary # (if it is, add 'server' tag - platforms = hosts.map {|val| val[:platform]} - if (platforms.any? { |val| /^eos-/ =~ val}) - skip_test "Skipping because Puppet describe fails when the Arista module is installed (ARISTA-51)" - end - # utf8chars = "€‰ㄘ万竹ÜÖ" utf8chars = "\u20ac\u2030\u3118\u4e07\u7af9\u00dc\u00d6" diff --git a/acceptance/tests/utf8/utf8-recursive-copy.rb b/acceptance/tests/utf8/utf8-recursive-copy.rb index dc48721aa21..13de5c7a4e8 100644 --- a/acceptance/tests/utf8/utf8-recursive-copy.rb +++ b/acceptance/tests/utf8/utf8-recursive-copy.rb @@ -4,9 +4,6 @@ 'audit:integration' # not package dependent but may want to vary platform by LOCALE/encoding # Translation is not supported on these platforms: - confine :except, :platform => /^eos-/ - confine :except, :platform => /^cisco/ - confine :except, :platform => /^cumulus/ confine :except, :platform => /^solaris/ # for file_exists? From eedb72d7b3d3953b3e30e2777c1a5489f74a9894 Mon Sep 17 00:00:00 2001 From: Gabriel Nagy Date: Tue, 25 Aug 2020 15:13:44 +0300 Subject: [PATCH 096/731] (maint) Correct spelling in test file name s/destoy/destroy/ --- ..._not_destoy_unexisting.rb => should_not_destroy_unexisting.rb} | 0 ..._not_destoy_unexisting.rb => should_not_destroy_unexisting.rb} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename acceptance/tests/resource/group/{should_not_destoy_unexisting.rb => should_not_destroy_unexisting.rb} (100%) rename acceptance/tests/resource/user/{should_not_destoy_unexisting.rb => should_not_destroy_unexisting.rb} (100%) diff --git a/acceptance/tests/resource/group/should_not_destoy_unexisting.rb b/acceptance/tests/resource/group/should_not_destroy_unexisting.rb similarity index 100% rename from acceptance/tests/resource/group/should_not_destoy_unexisting.rb rename to acceptance/tests/resource/group/should_not_destroy_unexisting.rb diff --git a/acceptance/tests/resource/user/should_not_destoy_unexisting.rb b/acceptance/tests/resource/user/should_not_destroy_unexisting.rb similarity index 100% rename from acceptance/tests/resource/user/should_not_destoy_unexisting.rb rename to acceptance/tests/resource/user/should_not_destroy_unexisting.rb From 1fe73028b5c363cb7b2dc59db75acaa5c39fd695 Mon Sep 17 00:00:00 2001 From: Gabriel Nagy Date: Wed, 26 Aug 2020 10:25:11 +0300 Subject: [PATCH 097/731] (PUP-10623) Use Beaker::Host#user_* methods Commit 4f30d93c3eec899ebaca4d7b8eb89aaae89c746f removed the wrappers for `Beaker::Host#user_present` and `user_absent`. This commit changes the code to also use the Beaker methods. --- .../tests/resource/exec/should_run_command_as_user.rb | 6 +++--- .../resource/user/osx_10.4_should_fail_when_modify_home.rb | 2 +- .../resource/user/osx_10.4_should_fail_when_modify_uid.rb | 2 +- acceptance/tests/resource/user/should_modify_home.rb | 2 +- acceptance/tests/resource/user/should_modify_uid.rb | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/acceptance/tests/resource/exec/should_run_command_as_user.rb b/acceptance/tests/resource/exec/should_run_command_as_user.rb index 93e229652fe..6a3d2a3350b 100644 --- a/acceptance/tests/resource/exec/should_run_command_as_user.rb +++ b/acceptance/tests/resource/exec/should_run_command_as_user.rb @@ -36,9 +36,9 @@ def exec_resource_manifest(params = {}) username = random_username # Create our user. Ensure that we start with a clean slate. - user_absent(agent, username) - user_present(agent, username) - teardown { user_absent(agent, username) } + agent.user_absent(username) + agent.user_present(username) + teardown { agent.user_absent(username) } tmpdir = agent.tmpdir("forbidden") on(agent, "chmod 700 #{tmpdir}") diff --git a/acceptance/tests/resource/user/osx_10.4_should_fail_when_modify_home.rb b/acceptance/tests/resource/user/osx_10.4_should_fail_when_modify_home.rb index ee7a93efc48..54a9a796c3c 100644 --- a/acceptance/tests/resource/user/osx_10.4_should_fail_when_modify_home.rb +++ b/acceptance/tests/resource/user/osx_10.4_should_fail_when_modify_home.rb @@ -15,7 +15,7 @@ agents.each do |agent| teardown do - user_absent(agent, user) + agent.user_absent(user) end step "ensure the user is present" do diff --git a/acceptance/tests/resource/user/osx_10.4_should_fail_when_modify_uid.rb b/acceptance/tests/resource/user/osx_10.4_should_fail_when_modify_uid.rb index a2ca431ca56..50d9bf14ab9 100644 --- a/acceptance/tests/resource/user/osx_10.4_should_fail_when_modify_uid.rb +++ b/acceptance/tests/resource/user/osx_10.4_should_fail_when_modify_uid.rb @@ -15,7 +15,7 @@ agents.each do |agent| teardown do - user_absent(agent, user) + agent.user_absent(user) end step "ensure the user is present" do diff --git a/acceptance/tests/resource/user/should_modify_home.rb b/acceptance/tests/resource/user/should_modify_home.rb index 4c012e32066..bad6f4b581d 100644 --- a/acceptance/tests/resource/user/should_modify_home.rb +++ b/acceptance/tests/resource/user/should_modify_home.rb @@ -16,7 +16,7 @@ agents.each do |agent| teardown do - user_absent(agent, user) + agent.user_absent(user) end step "ensure the user is present" do diff --git a/acceptance/tests/resource/user/should_modify_uid.rb b/acceptance/tests/resource/user/should_modify_uid.rb index 6aeb7dcafbe..b3abe048930 100644 --- a/acceptance/tests/resource/user/should_modify_uid.rb +++ b/acceptance/tests/resource/user/should_modify_uid.rb @@ -16,7 +16,7 @@ agents.each do |agent| teardown do - user_absent(agent, user) + agent.user_absent(user) end step "ensure the user is present" do From 1415cb907ddeba71c6b2934339f634f57f4e814b Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Wed, 26 Aug 2020 13:51:17 +0000 Subject: [PATCH 098/731] (packaging) Updating the puppet.pot file --- locales/puppet.pot | 34 ++++++++++++---------------------- 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/locales/puppet.pot b/locales/puppet.pot index b743a869b43..6a257bf0e16 100644 --- a/locales/puppet.pot +++ b/locales/puppet.pot @@ -6,11 +6,11 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Puppet automation framework 6.17.0-257-gec9143f74c\n" +"Project-Id-Version: Puppet automation framework 6.18.0-146-gf906a68208\n" "\n" "Report-Msgid-Bugs-To: https://tickets.puppetlabs.com\n" -"POT-Creation-Date: 2020-08-21 08:21+0000\n" -"PO-Revision-Date: 2020-08-21 08:21+0000\n" +"POT-Creation-Date: 2020-08-26 13:51+0000\n" +"PO-Revision-Date: 2020-08-26 13:51+0000\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -120,16 +120,6 @@ msgstr "" msgid "Failed to acquire lock" msgstr "" -#. TRANSLATORS 'Puppet::Agent::Locker.running?' is a method name and should not be translated -#: ../lib/puppet/agent/locker.rb:33 -msgid "Puppet::Agent::Locker.running? is deprecated as it is inherently unsafe." -msgstr "" - -#. TRANSLATORS 'LockError' should not be translated -#: ../lib/puppet/agent/locker.rb:35 -msgid "The only safe way to know if the lock is locked is to try lock and perform some action and then handle the LockError that may result." -msgstr "" - #: ../lib/puppet/application.rb:238 msgid "Unable to find application '%{application_name}'. %{error}" msgstr "" @@ -6310,19 +6300,19 @@ msgstr "" msgid "Key/value pairs must be separated by '%{separator}'" msgstr "" -#: ../lib/puppet/provider.rb:145 +#: ../lib/puppet/provider.rb:132 msgid "No command %{command} defined for provider %{provider}" msgstr "" -#: ../lib/puppet/provider.rb:397 +#: ../lib/puppet/provider.rb:384 msgid "To support listing resources of this type the '%{provider}' provider needs to implement an 'instances' class method returning the current set of resources. We recommend porting your module to the simpler Resource API instead: https://puppet.com/search/docs?keys=resource+api" msgstr "" -#: ../lib/puppet/provider.rb:470 +#: ../lib/puppet/provider.rb:457 msgid "'%{parameter_name}' is not a valid parameter for %{resource_type}" msgstr "" -#: ../lib/puppet/provider.rb:556 +#: ../lib/puppet/provider.rb:543 msgid "No resource and no name in property hash in %{class_name} instance" msgstr "" @@ -8951,23 +8941,23 @@ msgstr "" msgid "%{klass} failed with error %{error_type}: %{detail}" msgstr "" -#: ../lib/puppet/util/execution.rb:196 +#: ../lib/puppet/util/execution.rb:185 msgid "Working directory %{cwd} does not exist!" msgstr "" -#: ../lib/puppet/util/execution.rb:288 +#: ../lib/puppet/util/execution.rb:277 msgid "Could not get output" msgstr "" -#: ../lib/puppet/util/execution.rb:297 +#: ../lib/puppet/util/execution.rb:286 msgid "Execution of '%{str}' returned %{exit_status}: %{output}" msgstr "" -#: ../lib/puppet/util/execution.rb:374 +#: ../lib/puppet/util/execution.rb:363 msgid "Could not execute posix command: %{detail}" msgstr "" -#: ../lib/puppet/util/execution.rb:422 +#: ../lib/puppet/util/execution.rb:411 msgid "Waiting for output; will sleep %{time_to_sleep} seconds" msgstr "" From 8e9657f998adfbc6989ffbc44f8ed8823d1e4fed Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Fri, 7 Aug 2020 17:39:18 -0700 Subject: [PATCH 099/731] (PUP-9407) Disable filebuckets by default Previously puppet stored a copy of any file it overwrote or deleted in its local filebucket. However, the local filebucket grows unbounded over time and a cron job or tidy resource must be used to delete old files. Change the `backup` parameter's default value to false. The old behavior can be reenabled by adding a resource default: File { backup => 'puppet' } --- .../tests/ticket_1334_clientbucket_corrupted.rb | 2 +- .../tests/ticket_6541_invalid_filebucket_files.rb | 6 +++--- lib/puppet/type/file.rb | 12 +++++------- spec/unit/type/file/content_spec.rb | 2 +- spec/unit/type/file_spec.rb | 13 +++++++++---- spec/unit/util/backups_spec.rb | 2 -- 6 files changed, 19 insertions(+), 18 deletions(-) diff --git a/acceptance/tests/ticket_1334_clientbucket_corrupted.rb b/acceptance/tests/ticket_1334_clientbucket_corrupted.rb index e2841daf7f3..155353647d7 100644 --- a/acceptance/tests/ticket_1334_clientbucket_corrupted.rb +++ b/acceptance/tests/ticket_1334_clientbucket_corrupted.rb @@ -14,7 +14,7 @@ end managed_content = "managed\n" - manifest = "file { '#{tmpfile}': content => '#{managed_content}', }" + manifest = "file { '#{tmpfile}': content => '#{managed_content}', backup => 'puppet' }" step 'create unmanaged file' do create_remote_file(agent, tmpfile, unmanaged_content) diff --git a/acceptance/tests/ticket_6541_invalid_filebucket_files.rb b/acceptance/tests/ticket_6541_invalid_filebucket_files.rb index 6beebff3482..e826ed65b9d 100644 --- a/acceptance/tests/ticket_6541_invalid_filebucket_files.rb +++ b/acceptance/tests/ticket_6541_invalid_filebucket_files.rb @@ -15,7 +15,7 @@ apply_manifest_on(agent, manifest) step "overwrite file, causing zero-length file to be backed up" - manifest = "file { '#{target}': content => 'some text' }" + manifest = "file { '#{target}': content => 'some text', backup => 'puppet' }" apply_manifest_on(agent, manifest) test_name "verify invalid hashes should not change the file" @@ -40,9 +40,9 @@ test_name "verify that an empty file can be retrieved from the filebucket" if fips_mode - manifest = "file { '#{target}': content => '{sha256}e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855' }" + manifest = "file { '#{target}': content => '{sha256}e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', backup => 'puppet' }" else - manifest = "file { '#{target}': content => '{md5}d41d8cd98f00b204e9800998ecf8427e' }" + manifest = "file { '#{target}': content => '{md5}d41d8cd98f00b204e9800998ecf8427e', backup => 'puppet' }" end apply_manifest_on(agent, manifest) do diff --git a/lib/puppet/type/file.rb b/lib/puppet/type/file.rb index 495747fd006..06dbdd72ba6 100644 --- a/lib/puppet/type/file.rb +++ b/lib/puppet/type/file.rb @@ -83,13 +83,11 @@ def self.title_patterns use copy the file in the same directory with that value as the extension of the backup. (A value of `true` is a synonym for `.puppet-bak`.) * If set to any other string, Puppet will try to back up to a filebucket - with that title. See the `filebucket` resource type for more details. - (This is the preferred method for backup, since it can be centralized - and queried.) + with that title. Puppet automatically creates a **local** filebucket + named `puppet` if one doesn't already exist. See the `filebucket` resource + type for more details. - Default value: `puppet`, which backs up to a filebucket of the same name. - (Puppet automatically creates a **local** filebucket named `puppet` if one - doesn't already exist.) + Default value: `false` Backing up to a local filebucket isn't particularly useful. If you want to make organized use of backups, you will generally want to use the @@ -125,7 +123,7 @@ def self.title_patterns - Restrict the directory to a maximum size after which the oldest items are removed. EOT - defaultto "puppet" + defaultto false munge do |value| # I don't really know how this is happening. diff --git a/spec/unit/type/file/content_spec.rb b/spec/unit/type/file/content_spec.rb index e4045435e35..928868c10cd 100644 --- a/spec/unit/type/file/content_spec.rb +++ b/spec/unit/type/file/content_spec.rb @@ -7,7 +7,7 @@ let(:filename) { tmpfile('testfile') } let(:environment) { Puppet::Node::Environment.create(:testing, []) } let(:catalog) { Puppet::Resource::Catalog.new(:test, environment) } - let(:resource) { Puppet::Type.type(:file).new :path => filename, :catalog => catalog } + let(:resource) { Puppet::Type.type(:file).new :path => filename, :catalog => catalog, :backup => 'puppet' } before do File.open(filename, 'w') {|f| f.write "initial file content"} diff --git a/spec/unit/type/file_spec.rb b/spec/unit/type/file_spec.rb index 603f3c0bb5f..d3914c3db73 100644 --- a/spec/unit/type/file_spec.rb +++ b/spec/unit/type/file_spec.rb @@ -133,6 +133,10 @@ end describe "the backup parameter" do + it 'should be disabled by default' do + expect(file[:backup]).to eq(nil) + end + [false, 'false', :false].each do |value| it "should disable backup if the value is #{value.inspect}" do file[:backup] = value @@ -928,7 +932,7 @@ end it "should fail if it can't backup the file" do - # Default: file[:backup] = true + file[:backup] = true allow(file).to receive(:stat).and_return(double('stat', :ftype => 'file')) allow(file).to receive(:perform_backup).and_return(false) @@ -937,7 +941,7 @@ describe "backing up directories" do it "should not backup directories if backup is true and force is false" do - # Default: file[:backup] = true + file[:backup] = true file[:force] = false allow(file).to receive(:stat).and_return(double('stat', :ftype => 'directory')) @@ -947,7 +951,7 @@ end it "should backup directories if backup is true and force is true" do - # Default: file[:backup] = true + file[:backup] = true file[:force] = true allow(file).to receive(:stat).and_return(double('stat', :ftype => 'directory')) @@ -974,7 +978,7 @@ end it "should remove a directory if backup is true and force is true" do - # Default: file[:backup] = true + file[:backup] = true file[:force] = true allow(file).to receive(:stat).and_return(double('stat', :ftype => 'directory')) @@ -1006,6 +1010,7 @@ end it "should fail if the file is not a directory, link, file, fifo, socket, or is unknown" do + file[:backup] = 'puppet' allow(file).to receive(:stat).and_return(double('stat', :ftype => 'blockSpecial')) expect(file).to receive(:warning).with("Could not back up file of type blockSpecial") diff --git a/spec/unit/util/backups_spec.rb b/spec/unit/util/backups_spec.rb index c1c0791b033..6406329b43c 100644 --- a/spec/unit/util/backups_spec.rb +++ b/spec/unit/util/backups_spec.rb @@ -16,8 +16,6 @@ let(:path) { make_absolute('/no/such/file') } it "should noop if the file does not exist" do - file = Puppet::Type.type(:file).new(:name => path) - expect(file).not_to receive(:bucket) expect(Puppet::FileSystem).to receive(:exist?).with(path).and_return(false) From 9c7e09c9b6867bdfdc88fcc5562dd7e7e33e649b Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Thu, 27 Aug 2020 10:52:48 +0000 Subject: [PATCH 100/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 8 -------- 1 file changed, 8 deletions(-) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index e5525f34ac9..f0be0837f9f 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -731,14 +731,6 @@ Causes validation of loaded legacy Ruby functions (3x API) to raise errors about . .IP "" 0 . -.SS "future_features" -Whether or not to enable all features currently being developed for future major releases of Puppet\. Should be used with caution, as in development features are experimental and can have unexpected effects\. -. -.IP "\(bu" 4 -\fIDefault\fR: false -. -.IP "" 0 -. .SS "genconfig" When true, causes Puppet applications to print an example config file to stdout and exit\. The example will include descriptions of each setting, and the current (or default) value of each setting, incorporating any settings overridden on the CLI (with the exception of \fBgenconfig\fR itself)\. This setting only makes sense when specified on the command line as \fB\-\-genconfig\fR\. . From 741a2d51388c569fc11a11455f05987d717afd98 Mon Sep 17 00:00:00 2001 From: Gabriel Nagy Date: Wed, 26 Aug 2020 11:57:36 +0300 Subject: [PATCH 101/731] (PUP-10606) Separate puppet/ffi from puppet/util This commit attempts to make the `puppet/ffi/windows` tree usable without having to load the entire `puppet/util/windows` module. Move the APITypes module from `util` to `ffi`, since all the code there is FFI-related. Do a nested initialization of the `Puppet::Util::Windows::String` module so it can be used without loading the base `Puppet::Util::Windows` module. --- lib/puppet/ffi.rb | 6 +- lib/puppet/ffi/windows.rb | 4 +- lib/puppet/ffi/windows/api_types.rb | 311 ++++++++++++++++++ lib/puppet/ffi/windows/constants.rb | 4 +- lib/puppet/ffi/windows/functions.rb | 4 +- lib/puppet/ffi/windows/structs.rb | 6 +- lib/puppet/util/windows.rb | 2 +- lib/puppet/util/windows/api_types.rb | 309 ----------------- lib/puppet/util/windows/daemon.rb | 5 +- .../util/windows/monkey_patches/process.rb | 6 +- lib/puppet/util/windows/string.rb | 18 +- 11 files changed, 343 insertions(+), 332 deletions(-) create mode 100644 lib/puppet/ffi/windows/api_types.rb delete mode 100644 lib/puppet/util/windows/api_types.rb diff --git a/lib/puppet/ffi.rb b/lib/puppet/ffi.rb index dbfaa696d60..22322677705 100644 --- a/lib/puppet/ffi.rb +++ b/lib/puppet/ffi.rb @@ -1,2 +1,6 @@ -module Puppet::FFI +require 'ffi' + +module Puppet + module FFI + end end diff --git a/lib/puppet/ffi/windows.rb b/lib/puppet/ffi/windows.rb index 84f929e7a3e..0fcf4550bd2 100644 --- a/lib/puppet/ffi/windows.rb +++ b/lib/puppet/ffi/windows.rb @@ -1,6 +1,8 @@ require 'puppet/ffi' + module Puppet::FFI::Windows + require 'puppet/ffi/windows/api_types' + require 'puppet/ffi/windows/constants' require 'puppet/ffi/windows/structs' require 'puppet/ffi/windows/functions' - require 'puppet/ffi/windows/constants' end diff --git a/lib/puppet/ffi/windows/api_types.rb b/lib/puppet/ffi/windows/api_types.rb new file mode 100644 index 00000000000..dd855442306 --- /dev/null +++ b/lib/puppet/ffi/windows/api_types.rb @@ -0,0 +1,311 @@ +require 'puppet/ffi/windows' +require 'puppet/util/windows/string' + +module Puppet::FFI::Windows + module APITypes + module ::FFI + WIN32_FALSE = 0 + + # standard Win32 error codes + ERROR_SUCCESS = 0 + end + + module ::FFI::Library + # Wrapper method for attach_function + private + def attach_function_private(*args) + attach_function(*args) + private args[0] + end + end + + class ::FFI::Pointer + NULL_HANDLE = 0 + WCHAR_NULL = "\0\0".encode('UTF-16LE').freeze + + def self.from_string_to_wide_string(str, &block) + str = Puppet::Util::Windows::String.wide_string(str) + FFI::MemoryPointer.from_wide_string(str, &block) + + # ptr has already had free called, so nothing to return + nil + end + + def read_win32_bool + # BOOL is always a 32-bit integer in Win32 + # some Win32 APIs return 1 for true, while others are non-0 + read_int32 != FFI::WIN32_FALSE + end + + alias_method :read_dword, :read_uint32 + alias_method :read_win32_ulong, :read_uint32 + alias_method :read_qword, :read_uint64 + + alias_method :read_hresult, :read_int32 + + def read_handle + type_size == 4 ? read_uint32 : read_uint64 + end + + alias_method :read_wchar, :read_uint16 + alias_method :read_word, :read_uint16 + alias_method :read_array_of_wchar, :read_array_of_uint16 + + def read_wide_string(char_length, dst_encoding = Encoding::UTF_8, strip = false, encode_options = {}) + # char_length is number of wide chars (typically excluding NULLs), *not* bytes + str = get_bytes(0, char_length * 2).force_encoding('UTF-16LE') + + if strip + i = str.index(WCHAR_NULL) + str = str[0, i] if i + end + + str.encode(dst_encoding, str.encoding, **encode_options) + rescue EncodingError => e + Puppet.debug { "Unable to convert value #{str.nil? ? 'nil' : str.dump} to encoding #{dst_encoding} due to #{e.inspect}" } + raise + end + + # @param max_char_length [Integer] Maximum number of wide chars to return (typically excluding NULLs), *not* bytes + # @param null_terminator [Symbol] Number of number of null wchar characters, *not* bytes, that determine the end of the string + # null_terminator = :single_null, then the terminating sequence is two bytes of zero. This is UNIT16 = 0 + # null_terminator = :double_null, then the terminating sequence is four bytes of zero. This is UNIT32 = 0 + # @param encode_options [Hash] Accepts the same option hash that may be passed to String#encode in Ruby + def read_arbitrary_wide_string_up_to(max_char_length = 512, null_terminator = :single_null, encode_options = {}) + idx = case null_terminator + when :single_null + # find index of wide null between 0 and max (exclusive) + (0...max_char_length).find do |i| + get_uint16(i * 2) == 0 + end + when :double_null + # find index of double-wide null between 0 and max - 1 (exclusive) + (0...max_char_length - 1).find do |i| + get_uint32(i * 2) == 0 + end + else + raise _("Unable to read wide strings with %{null_terminator} terminal nulls") % { null_terminator: null_terminator } + end + + read_wide_string(idx || max_char_length, Encoding::UTF_8, false, encode_options) + end + + def read_win32_local_pointer(&block) + ptr = read_pointer + begin + yield ptr + ensure + if !ptr.null? && FFI::WIN32::LocalFree(ptr.address) != FFI::Pointer::NULL_HANDLE + Puppet.debug "LocalFree memory leak" + end + end + + # ptr has already had LocalFree called, so nothing to return + nil + end + + def read_com_memory_pointer(&block) + ptr = read_pointer + begin + yield ptr + ensure + FFI::WIN32::CoTaskMemFree(ptr) unless ptr.null? + end + + # ptr has already had CoTaskMemFree called, so nothing to return + nil + end + + alias_method :write_dword, :write_uint32 + alias_method :write_word, :write_uint16 + end + + class FFI::MemoryPointer + # Return a MemoryPointer that points to wide string. This is analogous to the + # FFI::MemoryPointer.from_string method. + def self.from_wide_string(wstr) + ptr = FFI::MemoryPointer.new(:uchar, wstr.bytesize + 2) + ptr.put_array_of_uchar(0, wstr.bytes.to_a) + ptr.put_uint16(wstr.bytesize, 0) + + yield ptr if block_given? + + ptr + end + end + + # FFI Types + # https://github.com/ffi/ffi/wiki/Types + + # Windows - Common Data Types + # https://msdn.microsoft.com/en-us/library/cc230309.aspx + + # Windows Data Types + # https://msdn.microsoft.com/en-us/library/windows/desktop/aa383751(v=vs.85).aspx + + FFI.typedef :uint16, :word + FFI.typedef :uint32, :dword + # uintptr_t is defined in an FFI conf as platform specific, either + # ulong_long on x64 or just ulong on x86 + FFI.typedef :uintptr_t, :handle + FFI.typedef :uintptr_t, :hwnd + + # buffer_inout is similar to pointer (platform specific), but optimized for buffers + FFI.typedef :buffer_inout, :lpwstr + # buffer_in is similar to pointer (platform specific), but optimized for CONST read only buffers + FFI.typedef :buffer_in, :lpcwstr + FFI.typedef :buffer_in, :lpcolestr + + # string is also similar to pointer, but should be used for const char * + # NOTE that this is not wide, useful only for A suffixed functions + FFI.typedef :string, :lpcstr + + # pointer in FFI is platform specific + # NOTE: for API calls with reserved lpvoid parameters, pass a FFI::Pointer::NULL + FFI.typedef :pointer, :lpcvoid + FFI.typedef :pointer, :lpvoid + FFI.typedef :pointer, :lpword + FFI.typedef :pointer, :lpbyte + FFI.typedef :pointer, :lpdword + FFI.typedef :pointer, :pdword + FFI.typedef :pointer, :phandle + FFI.typedef :pointer, :ulong_ptr + FFI.typedef :pointer, :pbool + FFI.typedef :pointer, :lpunknown + + # any time LONG / ULONG is in a win32 API definition DO NOT USE platform specific width + # which is what FFI uses by default + # instead create new aliases for these very special cases + # NOTE: not a good idea to redefine FFI :ulong since other typedefs may rely on it + FFI.typedef :uint32, :win32_ulong + FFI.typedef :int32, :win32_long + # FFI bool can be only 1 byte at times, + # Win32 BOOL is a signed int, and is always 4 bytes, even on x64 + # https://blogs.msdn.com/b/oldnewthing/archive/2011/03/28/10146459.aspx + FFI.typedef :int32, :win32_bool + + # BOOLEAN (unlike BOOL) is a BYTE - typedef unsigned char BYTE; + FFI.typedef :uchar, :boolean + + # Same as a LONG, a 32-bit signed integer + FFI.typedef :int32, :hresult + + # NOTE: FFI already defines (u)short as a 16-bit (un)signed like this: + # FFI.typedef :uint16, :ushort + # FFI.typedef :int16, :short + + # 8 bits per byte + FFI.typedef :uchar, :byte + FFI.typedef :uint16, :wchar + + # Definitions for data types used in LSA structures and functions + # https://docs.microsoft.com/en-us/windows/win32/api/ntsecapi/ + # https://docs.microsoft.com/sr-latn-rs/windows/win32/secmgmt/management-data-types + FFI.typedef :pointer, :pwstr + FFI.typedef :pointer, :pulong + FFI.typedef :pointer, :lsa_handle + FFI.typedef :pointer, :plsa_handle + FFI.typedef :pointer, :psid + FFI.typedef :pointer, :pvoid + FFI.typedef :pointer, :plsa_unicode_string + FFI.typedef :pointer, :plsa_object_attributes + FFI.typedef :uint32, :ntstatus + FFI.typedef :dword, :access_mask + + module ::FFI::WIN32 + extend ::FFI::Library + + # https://msdn.microsoft.com/en-us/library/windows/desktop/aa373931(v=vs.85).aspx + # typedef struct _GUID { + # DWORD Data1; + # WORD Data2; + # WORD Data3; + # BYTE Data4[8]; + # } GUID; + class GUID < FFI::Struct + layout :Data1, :dword, + :Data2, :word, + :Data3, :word, + :Data4, [:byte, 8] + + def self.[](s) + raise _('Bad GUID format.') unless s =~ /^[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}$/i + + new.tap do |guid| + guid[:Data1] = s[0, 8].to_i(16) + guid[:Data2] = s[9, 4].to_i(16) + guid[:Data3] = s[14, 4].to_i(16) + guid[:Data4][0] = s[19, 2].to_i(16) + guid[:Data4][1] = s[21, 2].to_i(16) + s[24, 12].split('').each_slice(2).with_index do |a, i| + guid[:Data4][i + 2] = a.join('').to_i(16) + end + end + end + + def ==(other) Windows.memcmp(other, self, size) == 0 end + end + + # https://msdn.microsoft.com/en-us/library/windows/desktop/ms724950(v=vs.85).aspx + # typedef struct _SYSTEMTIME { + # WORD wYear; + # WORD wMonth; + # WORD wDayOfWeek; + # WORD wDay; + # WORD wHour; + # WORD wMinute; + # WORD wSecond; + # WORD wMilliseconds; + # } SYSTEMTIME, *PSYSTEMTIME; + class SYSTEMTIME < FFI::Struct + layout :wYear, :word, + :wMonth, :word, + :wDayOfWeek, :word, + :wDay, :word, + :wHour, :word, + :wMinute, :word, + :wSecond, :word, + :wMilliseconds, :word + + def to_local_time + Time.local(self[:wYear], self[:wMonth], self[:wDay], + self[:wHour], self[:wMinute], self[:wSecond], self[:wMilliseconds] * 1000) + end + end + + # https://msdn.microsoft.com/en-us/library/windows/desktop/ms724284(v=vs.85).aspx + # Contains a 64-bit value representing the number of 100-nanosecond + # intervals since January 1, 1601 (UTC). + # typedef struct _FILETIME { + # DWORD dwLowDateTime; + # DWORD dwHighDateTime; + # } FILETIME, *PFILETIME; + class FILETIME < FFI::Struct + layout :dwLowDateTime, :dword, + :dwHighDateTime, :dword + end + + ffi_convention :stdcall + + # https://msdn.microsoft.com/en-us/library/windows/desktop/aa366730(v=vs.85).aspx + # HLOCAL WINAPI LocalFree( + # _In_ HLOCAL hMem + # ); + ffi_lib :kernel32 + attach_function :LocalFree, [:handle], :handle + + # https://msdn.microsoft.com/en-us/library/windows/desktop/ms724211(v=vs.85).aspx + # BOOL WINAPI CloseHandle( + # _In_ HANDLE hObject + # ); + ffi_lib :kernel32 + attach_function_private :CloseHandle, [:handle], :win32_bool + + # https://msdn.microsoft.com/en-us/library/windows/desktop/ms680722(v=vs.85).aspx + # void CoTaskMemFree( + # _In_opt_ LPVOID pv + # ); + ffi_lib :ole32 + attach_function :CoTaskMemFree, [:lpvoid], :void + end + end +end diff --git a/lib/puppet/ffi/windows/constants.rb b/lib/puppet/ffi/windows/constants.rb index f03009b22d3..64e69f22c05 100644 --- a/lib/puppet/ffi/windows/constants.rb +++ b/lib/puppet/ffi/windows/constants.rb @@ -1,4 +1,4 @@ -require 'ffi' +require 'puppet/ffi/windows' module Puppet::FFI::Windows module Constants @@ -401,4 +401,4 @@ module Constants # https://docs.microsoft.com/en-us/windows/desktop/api/winsvc/ns-winsvc-_enum_service_status_processw SERVICENAME_MAX = 256 end -end \ No newline at end of file +end diff --git a/lib/puppet/ffi/windows/functions.rb b/lib/puppet/ffi/windows/functions.rb index 851934a44d8..4d72eda7f20 100644 --- a/lib/puppet/ffi/windows/functions.rb +++ b/lib/puppet/ffi/windows/functions.rb @@ -1,4 +1,4 @@ -require 'puppet/ffi/windows/constants' +require 'puppet/ffi/windows' module Puppet::FFI::Windows module Functions @@ -625,4 +625,4 @@ module Functions attach_function_private :PathIsDirectoryEmptyW, [:lpcwstr], :win32_bool end -end \ No newline at end of file +end diff --git a/lib/puppet/ffi/windows/structs.rb b/lib/puppet/ffi/windows/structs.rb index c1bc2eeea58..be9b382f43d 100644 --- a/lib/puppet/ffi/windows/structs.rb +++ b/lib/puppet/ffi/windows/structs.rb @@ -1,11 +1,11 @@ +# coding: utf-8 require 'puppet/ffi/windows' -require 'puppet/util/windows/api_types' module Puppet::FFI::Windows module Structs extend FFI::Library - extend Puppet::Util::Windows::APITypes + extend Puppet::FFI::Windows::APITypes # https://docs.microsoft.com/en-us/previous-versions/windows/desktop/legacy/aa379560(v=vs.85) # typedef struct _SECURITY_ATTRIBUTES { @@ -335,4 +335,4 @@ def header_size end end end -end \ No newline at end of file +end diff --git a/lib/puppet/util/windows.rb b/lib/puppet/util/windows.rb index 18fbfb6e97c..d8898bfec79 100644 --- a/lib/puppet/util/windows.rb +++ b/lib/puppet/util/windows.rb @@ -25,7 +25,7 @@ class EventLog; end require 'win32ole' ; WIN32OLE.codepage = WIN32OLE::CP_UTF8 # these reference platform specific gems - require 'puppet/util/windows/api_types' + require 'puppet/ffi/windows' require 'puppet/util/windows/string' require 'puppet/util/windows/error' require 'puppet/util/windows/com' diff --git a/lib/puppet/util/windows/api_types.rb b/lib/puppet/util/windows/api_types.rb deleted file mode 100644 index 9a14d638460..00000000000 --- a/lib/puppet/util/windows/api_types.rb +++ /dev/null @@ -1,309 +0,0 @@ -require 'ffi' -require 'puppet/util/windows/string' - -module Puppet::Util::Windows::APITypes - module ::FFI - WIN32_FALSE = 0 - - # standard Win32 error codes - ERROR_SUCCESS = 0 - end - - module ::FFI::Library - # Wrapper method for attach_function + private - def attach_function_private(*args) - attach_function(*args) - private args[0] - end - end - - class ::FFI::Pointer - NULL_HANDLE = 0 - WCHAR_NULL = "\0\0".encode('UTF-16LE').freeze - - def self.from_string_to_wide_string(str, &block) - str = Puppet::Util::Windows::String.wide_string(str) - FFI::MemoryPointer.from_wide_string(str, &block) - - # ptr has already had free called, so nothing to return - nil - end - - def read_win32_bool - # BOOL is always a 32-bit integer in Win32 - # some Win32 APIs return 1 for true, while others are non-0 - read_int32 != FFI::WIN32_FALSE - end - - alias_method :read_dword, :read_uint32 - alias_method :read_win32_ulong, :read_uint32 - alias_method :read_qword, :read_uint64 - - alias_method :read_hresult, :read_int32 - - def read_handle - type_size == 4 ? read_uint32 : read_uint64 - end - - alias_method :read_wchar, :read_uint16 - alias_method :read_word, :read_uint16 - alias_method :read_array_of_wchar, :read_array_of_uint16 - - def read_wide_string(char_length, dst_encoding = Encoding::UTF_8, strip = false, encode_options = {}) - # char_length is number of wide chars (typically excluding NULLs), *not* bytes - str = get_bytes(0, char_length * 2).force_encoding('UTF-16LE') - - if strip - i = str.index(WCHAR_NULL) - str = str[0, i] if i - end - - str.encode(dst_encoding, str.encoding, **encode_options) - rescue EncodingError => e - Puppet.debug { "Unable to convert value #{str.nil? ? 'nil' : str.dump} to encoding #{dst_encoding} due to #{e.inspect}" } - raise - end - - # @param max_char_length [Integer] Maximum number of wide chars to return (typically excluding NULLs), *not* bytes - # @param null_terminator [Symbol] Number of number of null wchar characters, *not* bytes, that determine the end of the string - # null_terminator = :single_null, then the terminating sequence is two bytes of zero. This is UNIT16 = 0 - # null_terminator = :double_null, then the terminating sequence is four bytes of zero. This is UNIT32 = 0 - # @param encode_options [Hash] Accepts the same option hash that may be passed to String#encode in Ruby - def read_arbitrary_wide_string_up_to(max_char_length = 512, null_terminator = :single_null, encode_options = {}) - idx = case null_terminator - when :single_null - # find index of wide null between 0 and max (exclusive) - (0...max_char_length).find do |i| - get_uint16(i * 2) == 0 - end - when :double_null - # find index of double-wide null between 0 and max - 1 (exclusive) - (0...max_char_length - 1).find do |i| - get_uint32(i * 2) == 0 - end - else - raise _("Unable to read wide strings with %{null_terminator} terminal nulls") % { null_terminator: null_terminator } - end - - read_wide_string(idx || max_char_length, Encoding::UTF_8, false, encode_options) - end - - def read_win32_local_pointer(&block) - ptr = read_pointer - begin - yield ptr - ensure - if !ptr.null? && FFI::WIN32::LocalFree(ptr.address) != FFI::Pointer::NULL_HANDLE - Puppet.debug "LocalFree memory leak" - end - end - - # ptr has already had LocalFree called, so nothing to return - nil - end - - def read_com_memory_pointer(&block) - ptr = read_pointer - begin - yield ptr - ensure - FFI::WIN32::CoTaskMemFree(ptr) unless ptr.null? - end - - # ptr has already had CoTaskMemFree called, so nothing to return - nil - end - - alias_method :write_dword, :write_uint32 - alias_method :write_word, :write_uint16 - end - - class FFI::MemoryPointer - # Return a MemoryPointer that points to wide string. This is analogous to the - # FFI::MemoryPointer.from_string method. - def self.from_wide_string(wstr) - ptr = FFI::MemoryPointer.new(:uchar, wstr.bytesize + 2) - ptr.put_array_of_uchar(0, wstr.bytes.to_a) - ptr.put_uint16(wstr.bytesize, 0) - - yield ptr if block_given? - - ptr - end - end - - # FFI Types - # https://github.com/ffi/ffi/wiki/Types - - # Windows - Common Data Types - # https://msdn.microsoft.com/en-us/library/cc230309.aspx - - # Windows Data Types - # https://msdn.microsoft.com/en-us/library/windows/desktop/aa383751(v=vs.85).aspx - - FFI.typedef :uint16, :word - FFI.typedef :uint32, :dword - # uintptr_t is defined in an FFI conf as platform specific, either - # ulong_long on x64 or just ulong on x86 - FFI.typedef :uintptr_t, :handle - FFI.typedef :uintptr_t, :hwnd - - # buffer_inout is similar to pointer (platform specific), but optimized for buffers - FFI.typedef :buffer_inout, :lpwstr - # buffer_in is similar to pointer (platform specific), but optimized for CONST read only buffers - FFI.typedef :buffer_in, :lpcwstr - FFI.typedef :buffer_in, :lpcolestr - - # string is also similar to pointer, but should be used for const char * - # NOTE that this is not wide, useful only for A suffixed functions - FFI.typedef :string, :lpcstr - - # pointer in FFI is platform specific - # NOTE: for API calls with reserved lpvoid parameters, pass a FFI::Pointer::NULL - FFI.typedef :pointer, :lpcvoid - FFI.typedef :pointer, :lpvoid - FFI.typedef :pointer, :lpword - FFI.typedef :pointer, :lpbyte - FFI.typedef :pointer, :lpdword - FFI.typedef :pointer, :pdword - FFI.typedef :pointer, :phandle - FFI.typedef :pointer, :ulong_ptr - FFI.typedef :pointer, :pbool - FFI.typedef :pointer, :lpunknown - - # any time LONG / ULONG is in a win32 API definition DO NOT USE platform specific width - # which is what FFI uses by default - # instead create new aliases for these very special cases - # NOTE: not a good idea to redefine FFI :ulong since other typedefs may rely on it - FFI.typedef :uint32, :win32_ulong - FFI.typedef :int32, :win32_long - # FFI bool can be only 1 byte at times, - # Win32 BOOL is a signed int, and is always 4 bytes, even on x64 - # https://blogs.msdn.com/b/oldnewthing/archive/2011/03/28/10146459.aspx - FFI.typedef :int32, :win32_bool - - # BOOLEAN (unlike BOOL) is a BYTE - typedef unsigned char BYTE; - FFI.typedef :uchar, :boolean - - # Same as a LONG, a 32-bit signed integer - FFI.typedef :int32, :hresult - - # NOTE: FFI already defines (u)short as a 16-bit (un)signed like this: - # FFI.typedef :uint16, :ushort - # FFI.typedef :int16, :short - - # 8 bits per byte - FFI.typedef :uchar, :byte - FFI.typedef :uint16, :wchar - - # Definitions for data types used in LSA structures and functions - # https://docs.microsoft.com/en-us/windows/win32/api/ntsecapi/ - # https://docs.microsoft.com/sr-latn-rs/windows/win32/secmgmt/management-data-types - FFI.typedef :pointer, :pwstr - FFI.typedef :pointer, :pulong - FFI.typedef :pointer, :lsa_handle - FFI.typedef :pointer, :plsa_handle - FFI.typedef :pointer, :psid - FFI.typedef :pointer, :pvoid - FFI.typedef :pointer, :plsa_unicode_string - FFI.typedef :pointer, :plsa_object_attributes - FFI.typedef :uint32, :ntstatus - FFI.typedef :dword, :access_mask - - module ::FFI::WIN32 - extend ::FFI::Library - - # https://msdn.microsoft.com/en-us/library/windows/desktop/aa373931(v=vs.85).aspx - # typedef struct _GUID { - # DWORD Data1; - # WORD Data2; - # WORD Data3; - # BYTE Data4[8]; - # } GUID; - class GUID < FFI::Struct - layout :Data1, :dword, - :Data2, :word, - :Data3, :word, - :Data4, [:byte, 8] - - def self.[](s) - raise _('Bad GUID format.') unless s =~ /^[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}$/i - - new.tap do |guid| - guid[:Data1] = s[0, 8].to_i(16) - guid[:Data2] = s[9, 4].to_i(16) - guid[:Data3] = s[14, 4].to_i(16) - guid[:Data4][0] = s[19, 2].to_i(16) - guid[:Data4][1] = s[21, 2].to_i(16) - s[24, 12].split('').each_slice(2).with_index do |a, i| - guid[:Data4][i + 2] = a.join('').to_i(16) - end - end - end - - def ==(other) Windows.memcmp(other, self, size) == 0 end - end - - # https://msdn.microsoft.com/en-us/library/windows/desktop/ms724950(v=vs.85).aspx - # typedef struct _SYSTEMTIME { - # WORD wYear; - # WORD wMonth; - # WORD wDayOfWeek; - # WORD wDay; - # WORD wHour; - # WORD wMinute; - # WORD wSecond; - # WORD wMilliseconds; - # } SYSTEMTIME, *PSYSTEMTIME; - class SYSTEMTIME < FFI::Struct - layout :wYear, :word, - :wMonth, :word, - :wDayOfWeek, :word, - :wDay, :word, - :wHour, :word, - :wMinute, :word, - :wSecond, :word, - :wMilliseconds, :word - - def to_local_time - Time.local(self[:wYear], self[:wMonth], self[:wDay], - self[:wHour], self[:wMinute], self[:wSecond], self[:wMilliseconds] * 1000) - end - end - - # https://msdn.microsoft.com/en-us/library/windows/desktop/ms724284(v=vs.85).aspx - # Contains a 64-bit value representing the number of 100-nanosecond - # intervals since January 1, 1601 (UTC). - # typedef struct _FILETIME { - # DWORD dwLowDateTime; - # DWORD dwHighDateTime; - # } FILETIME, *PFILETIME; - class FILETIME < FFI::Struct - layout :dwLowDateTime, :dword, - :dwHighDateTime, :dword - end - - ffi_convention :stdcall - - # https://msdn.microsoft.com/en-us/library/windows/desktop/aa366730(v=vs.85).aspx - # HLOCAL WINAPI LocalFree( - # _In_ HLOCAL hMem - # ); - ffi_lib :kernel32 - attach_function :LocalFree, [:handle], :handle - - # https://msdn.microsoft.com/en-us/library/windows/desktop/ms724211(v=vs.85).aspx - # BOOL WINAPI CloseHandle( - # _In_ HANDLE hObject - # ); - ffi_lib :kernel32 - attach_function_private :CloseHandle, [:handle], :win32_bool - - # https://msdn.microsoft.com/en-us/library/windows/desktop/ms680722(v=vs.85).aspx - # void CoTaskMemFree( - # _In_opt_ LPVOID pv - # ); - ffi_lib :ole32 - attach_function :CoTaskMemFree, [:lpvoid], :void - end -end diff --git a/lib/puppet/util/windows/daemon.rb b/lib/puppet/util/windows/daemon.rb index 185afbd7d14..27af3d449fa 100644 --- a/lib/puppet/util/windows/daemon.rb +++ b/lib/puppet/util/windows/daemon.rb @@ -1,7 +1,4 @@ -require 'ffi' -require 'puppet/ffi/windows/constants' -require 'puppet/ffi/windows/structs' -require 'puppet/ffi/windows/functions' +require 'puppet/ffi/windows' module Puppet::Util::Windows diff --git a/lib/puppet/util/windows/monkey_patches/process.rb b/lib/puppet/util/windows/monkey_patches/process.rb index 48e6bc49adf..cda9ac1049e 100644 --- a/lib/puppet/util/windows/monkey_patches/process.rb +++ b/lib/puppet/util/windows/monkey_patches/process.rb @@ -2,16 +2,16 @@ require 'ffi' require 'puppet/ffi/windows' -require 'puppet/util/windows/api_types' require 'puppet/util/windows/string' module Process extend FFI::Library - extend Puppet::Util::Windows::APITypes extend Puppet::Util::Windows::String + + extend Puppet::FFI::Windows::APITypes extend Puppet::FFI::Windows::Functions extend Puppet::FFI::Windows::Structs - + include Puppet::FFI::Windows::Constants include Puppet::FFI::Windows::Structs diff --git a/lib/puppet/util/windows/string.rb b/lib/puppet/util/windows/string.rb index de680d25c0a..3aee129fc3f 100644 --- a/lib/puppet/util/windows/string.rb +++ b/lib/puppet/util/windows/string.rb @@ -1,9 +1,15 @@ -module Puppet::Util::Windows::String - def wide_string(str) - # if given a nil string, assume caller wants to pass a nil pointer to win32 - return nil if str.nil? +module Puppet + module Util + module Windows + module String + def wide_string(str) + # if given a nil string, assume caller wants to pass a nil pointer to win32 + return nil if str.nil? - str.encode('UTF-16LE') + str.encode('UTF-16LE') + end + module_function :wide_string + end + end end - module_function :wide_string end From f121ee460ec9872ba1b2faa8c03409a721f2c929 Mon Sep 17 00:00:00 2001 From: Gabriel Nagy Date: Thu, 27 Aug 2020 20:06:03 +0300 Subject: [PATCH 102/731] (maint) Make WaitForSingleObject block Calls to WaitForSingleObject should be blocking, otherwise the daemon startup takes much longer. Without this commit: 57 seconds 2020-08-27 16:34:38 +0000 Puppet (notice): Service stopping / killing worker thread 2020-08-27 16:34:39 +0000 Puppet (notice): Service stopped 2020-08-27 16:34:51 +0000 Puppet (notice): Using 'C:/Program Files/Puppet Labs/Puppet/puppet/bin/puppet' 2020-08-27 16:35:08 +0000 Puppet (notice): Service started 2020-08-27 16:35:27 +0000 Puppet (notice): Executing agent with arguments: 2020-08-27 16:35:32 +0000 Puppet (notice): Process created: 1452 2020-08-27 16:35:35 +0000 Puppet (notice): Service worker thread waiting for 1800 seconds After this commit: 21 seconds 2020-08-27 16:50:29 +0000 Puppet (notice): Service stopping / killing worker thread 2020-08-27 16:50:32 +0000 Puppet (notice): Service stopped 2020-08-27 16:50:38 +0000 Puppet (notice): Using 'C:/Program Files/Puppet Labs/Puppet/puppet/bin/puppet' 2020-08-27 16:50:44 +0000 Puppet (notice): Service started 2020-08-27 16:50:50 +0000 Puppet (notice): Executing agent with arguments: 2020-08-27 16:50:50 +0000 Puppet (notice): Process created: 2724 2020-08-27 16:50:50 +0000 Puppet (notice): Service worker thread waiting for 1800 seconds --- lib/puppet/ffi/windows/functions.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/puppet/ffi/windows/functions.rb b/lib/puppet/ffi/windows/functions.rb index 4d72eda7f20..12534142985 100644 --- a/lib/puppet/ffi/windows/functions.rb +++ b/lib/puppet/ffi/windows/functions.rb @@ -102,7 +102,7 @@ module Functions # ); ffi_lib :kernel32 attach_function_private :WaitForSingleObject, - [:handle, :dword], :dword + [:handle, :dword], :dword, :blocking => true # https://docs.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-waitformultipleobjects # DWORD WaitForMultipleObjects( From f43a41335a6e7485add34ec54290ef2a255a06aa Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Thu, 27 Aug 2020 17:51:21 +0000 Subject: [PATCH 103/731] (packaging) Updating the puppet.pot file --- locales/puppet.pot | 109 ++++++++++++++++++++++----------------------- 1 file changed, 54 insertions(+), 55 deletions(-) diff --git a/locales/puppet.pot b/locales/puppet.pot index 6a257bf0e16..7900a6722e9 100644 --- a/locales/puppet.pot +++ b/locales/puppet.pot @@ -6,11 +6,11 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Puppet automation framework 6.18.0-146-gf906a68208\n" +"Project-Id-Version: Puppet automation framework 6.18.0-162-g52fc63610e\n" "\n" "Report-Msgid-Bugs-To: https://tickets.puppetlabs.com\n" -"POT-Creation-Date: 2020-08-26 13:51+0000\n" -"PO-Revision-Date: 2020-08-26 13:51+0000\n" +"POT-Creation-Date: 2020-08-27 17:51+0000\n" +"PO-Revision-Date: 2020-08-27 17:51+0000\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -546,7 +546,7 @@ msgstr "" msgid "Applied catalog in %{seconds} seconds" msgstr "" -#: ../lib/puppet/configurer.rb:217 ../lib/puppet/http/resolver/server_list.rb:68 +#: ../lib/puppet/configurer.rb:217 ../lib/puppet/http/resolver/server_list.rb:78 msgid "Could not select a functional puppet master from server_list: '%{server_list}'" msgstr "" @@ -582,13 +582,12 @@ msgstr "" msgid "Failed to apply catalog: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:429 ../lib/puppet/http/resolver/server_list.rb:89 +#: ../lib/puppet/configurer.rb:429 ../lib/puppet/http/resolver/server_list.rb:67 msgid "Puppet server %{host}:%{port} is unavailable: %{code} %{reason}" msgstr "" #. TRANSLATORS 'server_list' is the name of a setting and should not be translated -#. TRANSLATORS 'server_list' is the name of a setting and should not be translated -#: ../lib/puppet/configurer.rb:433 ../lib/puppet/http/resolver/server_list.rb:95 +#: ../lib/puppet/configurer.rb:433 ../lib/puppet/http/resolver/server_list.rb:72 msgid "Unable to connect to server from server_list setting: %{detail}" msgstr "" @@ -693,30 +692,30 @@ msgid "Valid values are '%{values}'." msgstr "" #. TRANSLATORS 'data_binding_terminus' is a setting and should not be translated -#: ../lib/puppet/defaults.rb:524 +#: ../lib/puppet/defaults.rb:517 msgid "Setting 'data_binding_terminus' is deprecated." msgstr "" #. TRANSLATORS 'hiera' should not be translated -#: ../lib/puppet/defaults.rb:526 +#: ../lib/puppet/defaults.rb:519 msgid "Convert custom terminus to hiera 5 API." msgstr "" #. TRANSLATORS 'environment_data_provider' is a setting and should not be translated -#: ../lib/puppet/defaults.rb:725 +#: ../lib/puppet/defaults.rb:718 msgid "Setting 'environment_data_provider' is deprecated." msgstr "" -#: ../lib/puppet/defaults.rb:808 +#: ../lib/puppet/defaults.rb:801 msgid "Certificate names must be lower case" msgstr "" -#: ../lib/puppet/defaults.rb:1058 ../lib/puppet/settings/enum_setting.rb:13 ../lib/puppet/settings/symbolic_enum_setting.rb:14 +#: ../lib/puppet/defaults.rb:1051 ../lib/puppet/settings/enum_setting.rb:13 ../lib/puppet/settings/symbolic_enum_setting.rb:14 msgid "Invalid value '%{value}' for parameter %{name}. Allowed values are '%{allowed_values}'" msgstr "" #. TRANSLATORS 'pluginsync' is a setting and should not be translated -#: ../lib/puppet/defaults.rb:1889 +#: ../lib/puppet/defaults.rb:1882 msgid "Setting 'pluginsync' is deprecated." msgstr "" @@ -2203,15 +2202,15 @@ msgstr "" msgid "Failed to parse Retry-After header '%{retry_after}' as an integer or RFC 2822 date" msgstr "" -#: ../lib/puppet/http/service.rb:119 +#: ../lib/puppet/http/service.rb:121 msgid "Ignoring extra header \"%{name}\" as it was previously set." msgstr "" -#: ../lib/puppet/http/service.rb:122 +#: ../lib/puppet/http/service.rb:124 msgid "Ignoring extra header \"%{name}\" as it has no value." msgstr "" -#: ../lib/puppet/http/service.rb:145 ../lib/puppet/indirector/rest.rb:54 +#: ../lib/puppet/http/service.rb:147 ../lib/puppet/indirector/rest.rb:54 msgid "No content type in http response; cannot parse" msgstr "" @@ -6746,27 +6745,27 @@ msgstr "" msgid "Unknown line format %{resource_name}: %{parse_line}" msgstr "" -#: ../lib/puppet/provider/package/pkg.rb:127 +#: ../lib/puppet/provider/package/pkg.rb:123 msgid "Unable to unfreeze %{package}" msgstr "" -#: ../lib/puppet/provider/package/pkg.rb:162 +#: ../lib/puppet/provider/package/pkg.rb:158 msgid "Implicit version %{should} has %{n} possible matches" msgstr "" -#: ../lib/puppet/provider/package/pkg.rb:174 +#: ../lib/puppet/provider/package/pkg.rb:170 msgid "Selecting version '%{version}' for implicit '%{should}'" msgstr "" -#: ../lib/puppet/provider/package/pkg.rb:179 +#: ../lib/puppet/provider/package/pkg.rb:175 msgid "No version of %{name} matching %{should} is installable, even though the package is currently installed" msgstr "" -#: ../lib/puppet/provider/package/pkg.rb:198 +#: ../lib/puppet/provider/package/pkg.rb:194 msgid "pkg warning: %{warnings}" msgstr "" -#: ../lib/puppet/provider/package/pkg.rb:242 ../lib/puppet/provider/package/pkg.rb:268 +#: ../lib/puppet/provider/package/pkg.rb:238 ../lib/puppet/provider/package/pkg.rb:264 msgid "Unable to update %{package}" msgstr "" @@ -7963,19 +7962,19 @@ msgid "Prefetch failed for %{type_name} provider '%{name}'" msgstr "" #. TRANSLATORS `prefetch` is a function name and should not be translated -#: ../lib/puppet/transaction.rb:381 ../lib/puppet/transaction.rb:384 +#: ../lib/puppet/transaction.rb:381 msgid "Could not prefetch %{type_name} provider '%{name}': %{detail}" msgstr "" -#: ../lib/puppet/transaction.rb:421 +#: ../lib/puppet/transaction.rb:415 msgid "Skipping resources in class because of failed class dependencies" msgstr "" -#: ../lib/puppet/transaction.rb:425 +#: ../lib/puppet/transaction.rb:419 msgid "Skipping because of failed dependencies" msgstr "" -#: ../lib/puppet/transaction.rb:430 +#: ../lib/puppet/transaction.rb:424 msgid "Skipping because provider prefetch failed" msgstr "" @@ -8243,86 +8242,86 @@ msgstr "" msgid "File paths must be fully qualified, not '%{path}'" msgstr "" -#: ../lib/puppet/type/file.rb:142 +#: ../lib/puppet/type/file.rb:140 msgid "Invalid backup type %{value}" msgstr "" -#: ../lib/puppet/type/file.rb:186 ../lib/puppet/type/tidy.rb:48 +#: ../lib/puppet/type/file.rb:184 ../lib/puppet/type/tidy.rb:48 msgid "Invalid recurse value %{value}" msgstr "" -#: ../lib/puppet/type/file.rb:218 +#: ../lib/puppet/type/file.rb:216 msgid "Invalid recurselimit value %{value}" msgstr "" -#: ../lib/puppet/type/file.rb:418 +#: ../lib/puppet/type/file.rb:416 msgid "You cannot specify more than one of %{creators}" msgstr "" -#: ../lib/puppet/type/file.rb:420 +#: ../lib/puppet/type/file.rb:418 msgid "You cannot specify a remote recursion without a source" msgstr "" -#: ../lib/puppet/type/file.rb:422 +#: ../lib/puppet/type/file.rb:420 msgid "You cannot specify source when using checksum 'none'" msgstr "" -#: ../lib/puppet/type/file.rb:425 +#: ../lib/puppet/type/file.rb:423 msgid "You cannot specify content when using checksum '%{checksum_type}'" msgstr "" -#: ../lib/puppet/type/file.rb:428 +#: ../lib/puppet/type/file.rb:426 msgid "Possible error: recurselimit is set but not recurse, no recursion will happen" msgstr "" -#: ../lib/puppet/type/file.rb:436 +#: ../lib/puppet/type/file.rb:434 msgid "Checksum value '%{value}' is not a valid checksum type %{checksum}" msgstr "" -#: ../lib/puppet/type/file.rb:439 +#: ../lib/puppet/type/file.rb:437 msgid "Checksum value is ignored unless content or source are specified" msgstr "" -#: ../lib/puppet/type/file.rb:477 +#: ../lib/puppet/type/file.rb:475 msgid "Can not find filebucket for backups without a catalog" msgstr "" -#: ../lib/puppet/type/file.rb:482 +#: ../lib/puppet/type/file.rb:480 msgid "Could not find filebucket %{backup} specified in backup" msgstr "" -#: ../lib/puppet/type/file.rb:780 +#: ../lib/puppet/type/file.rb:778 msgid "Could not back up file of type %{current_type}" msgstr "" -#: ../lib/puppet/type/file.rb:795 +#: ../lib/puppet/type/file.rb:793 msgid "Could not remove files of type %{current_type}" msgstr "" #. TRANSLATORS "source_permissions => ignore" should not be translated -#: ../lib/puppet/type/file.rb:806 +#: ../lib/puppet/type/file.rb:804 msgid "Copying owner/mode/group from the source file on Windows is not supported; use source_permissions => ignore." msgstr "" #. TRANSLATORS "stat" is a program name and should not be translated -#: ../lib/puppet/type/file.rb:887 ../lib/puppet/type/tidy.rb:352 +#: ../lib/puppet/type/file.rb:885 ../lib/puppet/type/tidy.rb:352 msgid "Could not stat; permission denied" msgstr "" -#: ../lib/puppet/type/file.rb:890 +#: ../lib/puppet/type/file.rb:888 msgid "Could not stat; invalid pathname" msgstr "" -#: ../lib/puppet/type/file.rb:1018 +#: ../lib/puppet/type/file.rb:1016 msgid "Not removing directory; use 'force' to override" msgstr "" #. TRANSLATORS refers to a file which could not be backed up -#: ../lib/puppet/type/file.rb:1043 +#: ../lib/puppet/type/file.rb:1041 msgid "Could not back up; will not remove" msgstr "" -#: ../lib/puppet/type/file.rb:1058 +#: ../lib/puppet/type/file.rb:1056 msgid "File written to disk did not match desired checksum; discarding changes (%{content_checksum} vs %{desired_checksum})" msgstr "" @@ -8388,36 +8387,36 @@ msgstr "" msgid "Invalid GID %{gid}" msgstr "" -#: ../lib/puppet/type/package.rb:128 ../lib/puppet/type/package.rb:142 +#: ../lib/puppet/type/package.rb:124 ../lib/puppet/type/package.rb:138 msgid "Could not update: %{detail}" msgstr "" -#: ../lib/puppet/type/package.rb:177 +#: ../lib/puppet/type/package.rb:173 msgid "Could not get latest version: %{detail}" msgstr "" -#: ../lib/puppet/type/package.rb:277 +#: ../lib/puppet/type/package.rb:273 msgid "Name must be a String not %{klass}" msgstr "" -#: ../lib/puppet/type/package.rb:423 +#: ../lib/puppet/type/package.rb:419 msgid "Cannot have both `ensure => disabled` and `flavor`" msgstr "" -#: ../lib/puppet/type/package.rb:522 +#: ../lib/puppet/type/package.rb:518 msgid "Cannot have both `enable_only => true` and `flavor`" msgstr "" -#: ../lib/puppet/type/package.rb:525 +#: ../lib/puppet/type/package.rb:521 msgid "Cannot have both `ensure => disabled` and `enable_only => true`" msgstr "" -#: ../lib/puppet/type/package.rb:687 +#: ../lib/puppet/type/package.rb:682 msgid "Invalid hold value %{value}. %{doc}" msgstr "" -#: ../lib/puppet/type/package.rb:717 -msgid "You cannot use \"mark\" property while \"ensure\" is one of [\"absent\", \"purged\", \"held\"]" +#: ../lib/puppet/type/package.rb:709 +msgid "You cannot use \"mark\" property while \"ensure\" is one of [\"absent\", \"purged\"]" msgstr "" #: ../lib/puppet/type/resources.rb:15 From 2242e623def996aaddcf1fcb0c06f678f99ffa3a Mon Sep 17 00:00:00 2001 From: Gabriel Nagy Date: Thu, 27 Aug 2020 20:21:21 +0300 Subject: [PATCH 104/731] (PUP-10606) Do not require util in the dir monkey patch Now that we separated FFI functions, structs and constants, we no longer need to require `puppet/util/windows` in the dir monkeypatch. This should considerably speed up the loading of the file. --- lib/puppet/util/windows/monkey_patches/dir.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/puppet/util/windows/monkey_patches/dir.rb b/lib/puppet/util/windows/monkey_patches/dir.rb index b3f69892d28..386ca854648 100644 --- a/lib/puppet/util/windows/monkey_patches/dir.rb +++ b/lib/puppet/util/windows/monkey_patches/dir.rb @@ -1,8 +1,12 @@ -require 'puppet/util/windows' +require 'puppet/ffi/windows' +require 'puppet/util/windows/string' class Dir - include Puppet::Util::Windows::File - extend Puppet::Util::Windows::File + extend Puppet::FFI::Windows::Functions + extend Puppet::FFI::Windows::Structs + + include Puppet::FFI::Windows::Constants + include Puppet::FFI::Windows::Structs # CSIDL constants csidl = Hash[ From 4e67094dc4dcc6e31e80c191f12b3a6ae0117cf9 Mon Sep 17 00:00:00 2001 From: Gabriel Nagy Date: Fri, 28 Aug 2020 13:16:23 +0300 Subject: [PATCH 105/731] (PUP-10606) Remove unused code --- lib/puppet/util/windows/file.rb | 2 - lib/puppet/util/windows/process.rb | 1 - lib/puppet/util/windows/service.rb | 194 ----------------------------- 3 files changed, 197 deletions(-) diff --git a/lib/puppet/util/windows/file.rb b/lib/puppet/util/windows/file.rb index da266a92d87..3ae8296066e 100644 --- a/lib/puppet/util/windows/file.rb +++ b/lib/puppet/util/windows/file.rb @@ -1,8 +1,6 @@ require 'puppet/ffi/windows' module Puppet::Util::Windows::File - require 'ffi' - extend FFI::Library extend Puppet::Util::Windows::String include Puppet::FFI::Windows::Constants diff --git a/lib/puppet/util/windows/process.rb b/lib/puppet/util/windows/process.rb index ba3cd84761b..ccdbf3ca0b5 100644 --- a/lib/puppet/util/windows/process.rb +++ b/lib/puppet/util/windows/process.rb @@ -5,7 +5,6 @@ module Puppet::Util::Windows::Process extend Puppet::FFI::Windows::Functions include Puppet::FFI::Windows::Structs extend Puppet::Util::Windows::String - extend FFI::Library WAIT_TIMEOUT = 0x102 WAIT_INTERVAL = 200 diff --git a/lib/puppet/util/windows/service.rb b/lib/puppet/util/windows/service.rb index c7ed43a0750..98552e4f6b8 100644 --- a/lib/puppet/util/windows/service.rb +++ b/lib/puppet/util/windows/service.rb @@ -1,5 +1,4 @@ # coding: utf-8 -require 'ffi' require 'puppet/ffi/windows' module Puppet::Util::Windows @@ -8,7 +7,6 @@ module Puppet::Util::Windows # # for an overview of the service state transitions see: https://docs.microsoft.com/en-us/windows/desktop/Services/service-status-transitions module Service - extend FFI::Library extend Puppet::Util::Windows::String include Puppet::FFI::Windows::Constants @@ -699,197 +697,5 @@ def milliseconds_to_seconds(wait_hint) end private :milliseconds_to_seconds end - - # # https://docs.microsoft.com/en-us/windows/desktop/api/Winsvc/nf-winsvc-openscmanagerw - # # SC_HANDLE OpenSCManagerW( - # # LPCWSTR lpMachineName, - # # LPCWSTR lpDatabaseName, - # # DWORD dwDesiredAccess - # # ); - # ffi_lib :advapi32 - # attach_function_private :OpenSCManagerW, - # [:lpcwstr, :lpcwstr, :dword], :handle - - # # https://docs.microsoft.com/en-us/windows/desktop/api/Winsvc/nf-winsvc-openservicew - # # SC_HANDLE OpenServiceW( - # # SC_HANDLE hSCManager, - # # LPCWSTR lpServiceName, - # # DWORD dwDesiredAccess - # # ); - # ffi_lib :advapi32 - # attach_function_private :OpenServiceW, - # [:handle, :lpcwstr, :dword], :handle - - # # https://docs.microsoft.com/en-us/windows/desktop/api/Winsvc/nf-winsvc-closeservicehandle - # # BOOL CloseServiceHandle( - # # SC_HANDLE hSCObject - # # ); - # ffi_lib :advapi32 - # attach_function_private :CloseServiceHandle, - # [:handle], :win32_bool - - # # https://docs.microsoft.com/en-us/windows/desktop/api/winsvc/nf-winsvc-queryservicestatusex - # # BOOL QueryServiceStatusEx( - # # SC_HANDLE hService, - # # SC_STATUS_TYPE InfoLevel, - # # LPBYTE lpBuffer, - # # DWORD cbBufSize, - # # LPDWORD pcbBytesNeeded - # # ); - # SC_STATUS_TYPE = enum( - # :SC_STATUS_PROCESS_INFO, 0, - # ) - # ffi_lib :advapi32 - # attach_function_private :QueryServiceStatusEx, - # [:handle, SC_STATUS_TYPE, :lpbyte, :dword, :lpdword], :win32_bool - - # # https://docs.microsoft.com/en-us/windows/desktop/api/Winsvc/nf-winsvc-queryserviceconfigw - # # BOOL QueryServiceConfigW( - # # SC_HANDLE hService, - # # LPQUERY_SERVICE_CONFIGW lpServiceConfig, - # # DWORD cbBufSize, - # # LPDWORD pcbBytesNeeded - # # ); - # ffi_lib :advapi32 - # attach_function_private :QueryServiceConfigW, - # [:handle, :lpbyte, :dword, :lpdword], :win32_bool - - # # https://docs.microsoft.com/en-us/windows/win32/api/winsvc/nf-winsvc-queryserviceconfig2w - # # BOOL QueryServiceConfig2W( - # # SC_HANDLE hService, - # # DWORD dwInfoLevel, - # # LPBYTE lpBuffer, - # # DWORD cbBufSize, - # # LPDWORD pcbBytesNeeded - # # ); - # ffi_lib :advapi32 - # attach_function_private :QueryServiceConfig2W, - # [:handle, :dword, :lpbyte, :dword, :lpdword], :win32_bool - - # # https://docs.microsoft.com/en-us/windows/desktop/api/Winsvc/nf-winsvc-startservicew - # # BOOL StartServiceW( - # # SC_HANDLE hService, - # # DWORD dwNumServiceArgs, - # # LPCWSTR *lpServiceArgVectors - # # ); - # ffi_lib :advapi32 - # attach_function_private :StartServiceW, - # [:handle, :dword, :pointer], :win32_bool - - # # https://docs.microsoft.com/en-us/windows/win32/api/winsvc/nf-winsvc-startservicectrldispatcherw - # # BOOL StartServiceCtrlDispatcherW( - # # const SERVICE_TABLE_ENTRYW *lpServiceStartTable - # # ); - # ffi_lib :advapi32 - # attach_function_private :StartServiceCtrlDispatcherW, - # [:pointer], :win32_bool, :blocking => true - - # # https://docs.microsoft.com/en-us/windows/win32/api/winsvc/nf-winsvc-setservicestatus - # # BOOL SetServiceStatus( - # # SERVICE_STATUS_HANDLE hServiceStatus, - # # LPSERVICE_STATUS lpServiceStatus - # # ); - # ffi_lib :advapi32 - # attach_function_private :SetServiceStatus, - # [:handle, :pointer], :win32_bool - - # # https://docs.microsoft.com/en-us/windows/desktop/api/winsvc/nf-winsvc-controlservice - # # BOOL ControlService( - # # SC_HANDLE hService, - # # DWORD dwControl, - # # LPSERVICE_STATUS lpServiceStatus - # # ); - # ffi_lib :advapi32 - # attach_function_private :ControlService, - # [:handle, :dword, :pointer], :win32_bool - - # # DWORD LphandlerFunctionEx( - # # DWORD dwControl, - # # DWORD dwEventType, - # # LPVOID lpEventData, - # # LPVOID lpContext - # # ) - # callback :handler_ex, [:dword, :dword, :lpvoid, :lpvoid], :void - - # # https://docs.microsoft.com/en-us/windows/win32/api/winsvc/nf-winsvc-registerservicectrlhandlerexw - # # SERVICE_STATUS_HANDLE RegisterServiceCtrlHandlerExW( - # # LPCWSTR lpServiceName, - # # LPHANDLER_FUNCTION_EX lpHandlerProc, - # # LPVOID lpContext - # # ); - # ffi_lib :advapi32 - # attach_function_private :RegisterServiceCtrlHandlerExW, - # [:lpcwstr, :handler_ex, :lpvoid], :handle - - # # https://docs.microsoft.com/en-us/windows/desktop/api/winsvc/nf-winsvc-changeserviceconfigw - # # BOOL ChangeServiceConfigW( - # # SC_HANDLE hService, - # # DWORD dwServiceType, - # # DWORD dwStartType, - # # DWORD dwErrorControl, - # # LPCWSTR lpBinaryPathName, - # # LPCWSTR lpLoadOrderGroup, - # # LPDWORD lpdwTagId, - # # LPCWSTR lpDependencies, - # # LPCWSTR lpServiceStartName, - # # LPCWSTR lpPassword, - # # LPCWSTR lpDisplayName - # # ); - # ffi_lib :advapi32 - # attach_function_private :ChangeServiceConfigW, - # [ - # :handle, - # :dword, - # :dword, - # :dword, - # :lpcwstr, - # :lpcwstr, - # :lpdword, - # :lpcwstr, - # :lpcwstr, - # :lpcwstr, - # :lpcwstr - # ], :win32_bool - - # # https://docs.microsoft.com/en-us/windows/win32/api/winsvc/nf-winsvc-changeserviceconfig2w - # # BOOL ChangeServiceConfig2W( - # # SC_HANDLE hService, - # # DWORD dwInfoLevel, - # # LPVOID lpInfo - # # ); - # ffi_lib :advapi32 - # attach_function_private :ChangeServiceConfig2W, - # [:handle, :dword, :lpvoid], :win32_bool - - # # https://docs.microsoft.com/en-us/windows/desktop/api/winsvc/nf-winsvc-enumservicesstatusexw - # # BOOL EnumServicesStatusExW( - # # SC_HANDLE hSCManager, - # # SC_ENUM_TYPE InfoLevel, - # # DWORD dwServiceType, - # # DWORD dwServiceState, - # # LPBYTE lpServices, - # # DWORD cbBufSize, - # # LPDWORD pcbBytesNeeded, - # # LPDWORD lpServicesReturned, - # # LPDWORD lpResumeHandle, - # # LPCWSTR pszGroupName - # # ); - # SC_ENUM_TYPE = enum( - # :SC_ENUM_PROCESS_INFO, 0, - # ) - # ffi_lib :advapi32 - # attach_function_private :EnumServicesStatusExW, - # [ - # :handle, - # SC_ENUM_TYPE, - # :dword, - # :dword, - # :lpbyte, - # :dword, - # :lpdword, - # :lpdword, - # :lpdword, - # :lpcwstr - # ], :win32_bool end end From afed1076ce7004d91b5a9951710161eedea701e7 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Fri, 28 Aug 2020 12:35:00 -0700 Subject: [PATCH 106/731] (PUP-10617) Thread ssl_context through when resolving server list Commit 01f72c395cd1 modified the resolver so it no longer passed the SSLContext through to the HTTP client. This was ok if the client had completed SSL initialization previously. But if called during `puppet ssl bootstrap`, then the client would attempt to load the default SSLContext and fail, since the CA cert hadn't been retrieved yet. --- lib/puppet/http/resolver/server_list.rb | 2 +- lib/puppet/http/service/puppetserver.rb | 5 ++++- spec/unit/http/resolver_spec.rb | 9 +++++++++ spec/unit/http/service/puppetserver_spec.rb | 12 ++++++++++++ 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/lib/puppet/http/resolver/server_list.rb b/lib/puppet/http/resolver/server_list.rb index f0a9cd27e0e..28645cde268 100644 --- a/lib/puppet/http/resolver/server_list.rb +++ b/lib/puppet/http/resolver/server_list.rb @@ -60,7 +60,7 @@ def resolve(session, name, ssl_context: nil, error_handler: nil) service = Puppet::HTTP::Service.create_service(@client, session, :puppetserver, host, port) begin - service.get_simple_status + service.get_simple_status(ssl_context: ssl_context) @resolved_url = service.url return Puppet::HTTP::Service.create_service(@client, session, name, @resolved_url.host, @resolved_url.port) rescue Puppet::HTTP::ResponseError => detail diff --git a/lib/puppet/http/service/puppetserver.rb b/lib/puppet/http/service/puppetserver.rb index 37a06b786f8..f7babef5247 100644 --- a/lib/puppet/http/service/puppetserver.rb +++ b/lib/puppet/http/service/puppetserver.rb @@ -20,13 +20,16 @@ def initialize(client, session, server, port) # Request the puppetserver's simple status # + # @param [Puppet::SSL::SSLContext] ssl_context to use when establishing + # the connection. # @return Puppet::HTTP::Response The HTTP response # @api private # - def get_simple_status + def get_simple_status(ssl_context: nil) response = @client.get( with_base_url("/status/v1/simple/master"), headers: add_puppet_headers({}), + options: {ssl_context: ssl_context} ) process_response(response) diff --git a/spec/unit/http/resolver_spec.rb b/spec/unit/http/resolver_spec.rb index 3d05bed9681..797279dcf1b 100644 --- a/spec/unit/http/resolver_spec.rb +++ b/spec/unit/http/resolver_spec.rb @@ -52,6 +52,15 @@ subject.resolve(session, :ca) end + it 'uses the provided ssl context during resolution' do + stub_request(:get, "https://ca.example.com:8141/status/v1/simple/master").to_return(status: 200) + + other_ctx = Puppet::SSL::SSLContext.new + expect(client).to receive(:connect).with(URI("https://ca.example.com:8141/status/v1/simple/master"), options: {ssl_context: other_ctx}).and_call_original + + subject.resolve(session, :ca, ssl_context: other_ctx) + end + it 'logs unsuccessful HTTP 500 responses' do Puppet[:log_level] = "debug" diff --git a/spec/unit/http/service/puppetserver_spec.rb b/spec/unit/http/service/puppetserver_spec.rb index d73cc3bcaaa..4909aa4b06d 100644 --- a/spec/unit/http/service/puppetserver_spec.rb +++ b/spec/unit/http/service/puppetserver_spec.rb @@ -66,5 +66,17 @@ expect(err.response.code).to eq(500) end end + + it 'accepts an ssl context' do + stub_request(:get, url) + .to_return(body: "running", headers: {'Content-Type' => 'text/plain;charset=utf-8'}) + + other_ctx = Puppet::SSL::SSLContext.new + expect(client).to receive(:connect).with(URI(url), options: {ssl_context: other_ctx}).and_call_original + + session = client.create_session + service = Puppet::HTTP::Service.create_service(client, session, :puppetserver, 'puppetserver.example.com', 8140) + service.get_simple_status(ssl_context: other_ctx) + end end end From 5f039e1003a0c29f16a4e3453a4af27b2125dc34 Mon Sep 17 00:00:00 2001 From: Ciprian Badescu Date: Mon, 31 Aug 2020 11:56:28 +0300 Subject: [PATCH 107/731] (PUP-10386) Remove status application --- docs/indirector.md | 7 +-- lib/puppet.rb | 1 - lib/puppet/application/status.rb | 4 -- lib/puppet/face/status.rb | 51 --------------- lib/puppet/http/service/compiler.rb | 27 -------- lib/puppet/indirector/status.rb | 3 - lib/puppet/indirector/status/local.rb | 12 ---- lib/puppet/indirector/status/rest.rb | 25 -------- lib/puppet/status.rb | 40 ------------ spec/unit/agent_spec.rb | 2 - spec/unit/face/status_spec.rb | 9 --- spec/unit/http/service/compiler_spec.rb | 62 ------------------- spec/unit/http/service_spec.rb | 1 - spec/unit/indirector/status/local_spec.rb | 10 --- spec/unit/indirector/status/rest_spec.rb | 50 --------------- .../http/api/indirected_routes_spec.rb | 4 -- spec/unit/status_spec.rb | 45 -------------- 17 files changed, 1 insertion(+), 352 deletions(-) delete mode 100644 lib/puppet/application/status.rb delete mode 100644 lib/puppet/face/status.rb delete mode 100644 lib/puppet/indirector/status.rb delete mode 100644 lib/puppet/indirector/status/local.rb delete mode 100644 lib/puppet/indirector/status/rest.rb delete mode 100644 lib/puppet/status.rb delete mode 100644 spec/unit/face/status_spec.rb delete mode 100644 spec/unit/indirector/status/local_spec.rb delete mode 100644 spec/unit/indirector/status/rest_spec.rb delete mode 100644 spec/unit/status_spec.rb diff --git a/docs/indirector.md b/docs/indirector.md index f9acb2c8b12..be37e3cf108 100644 --- a/docs/indirector.md +++ b/docs/indirector.md @@ -188,11 +188,6 @@ Manipulate resources with the resource abstraction layer. Only used internally. `store_configs` terminus Part of the "storeconfigs" feature. Should not be directly set by end users. -### status -Indirected Class: `Puppet::Status` -`local` terminus -Get status locally. Only used internally. - `rest` terminus Get puppet master's status via REST. Useful because it tests the health of both the web server and the indirector. @@ -210,4 +205,4 @@ Here are specific issues with the indirector: * Exceptions from the remote side of the `rest` terminus, don't propagate back. So if `find` returns nil, the caller doesn't know if it the resource doesn't exist, or an exception occurred for a different reason, such as the environment doesn't exist. The `fail_on_404` option was created to handle that case, but is meaningless for non-REST termini. * Can't process the HTTP response header to do something intelligent, e.g. to switch facts to JSON instead of PSON * Doesn't support streaming as objects must be fully loaded in memory. -* Concrete termini, e.g. `Puppet::Node::Facts::Rest`, must inherit from an abstract terminus like `Puppet::Indirector::REST`, `Puppet::Indirector::Code`, etc. Also concrete termini can't inherit from other concrete termini. \ No newline at end of file +* Concrete termini, e.g. `Puppet::Node::Facts::Rest`, must inherit from an abstract terminus like `Puppet::Indirector::REST`, `Puppet::Indirector::Code`, etc. Also concrete termini can't inherit from other concrete termini. diff --git a/lib/puppet.rb b/lib/puppet.rb index f726358a249..f53431f1d1f 100644 --- a/lib/puppet.rb +++ b/lib/puppet.rb @@ -356,7 +356,6 @@ def self.runtime require 'puppet/module' require 'puppet/data_binding' require 'puppet/util/storage' -require 'puppet/status' require 'puppet/file_bucket/file' require 'puppet/plugins/configuration' require 'puppet/pal/pal_api' diff --git a/lib/puppet/application/status.rb b/lib/puppet/application/status.rb deleted file mode 100644 index 1c3ca054e83..00000000000 --- a/lib/puppet/application/status.rb +++ /dev/null @@ -1,4 +0,0 @@ -require 'puppet/application/indirection_base' - -class Puppet::Application::Status < Puppet::Application::IndirectionBase -end diff --git a/lib/puppet/face/status.rb b/lib/puppet/face/status.rb deleted file mode 100644 index fe12e8562bd..00000000000 --- a/lib/puppet/face/status.rb +++ /dev/null @@ -1,51 +0,0 @@ -require 'puppet/indirector/face' - -Puppet::Indirector::Face.define(:status, '0.0.1') do - copyright "Puppet Inc.", 2011 - license _("Apache 2 license; see COPYING") - - summary _("View puppet server status.") - - deactivate_action(:destroy) - deactivate_action(:save) - deactivate_action(:search) - - find = get_action(:find) - find.default = true - find.summary _("Check status of puppet master server.") - #TRANSLATORS the string 'Puppet::Status' is a Puppet language object and should not be translated - find.returns _(<<-'EOT') - A "true" response or a low-level connection error. When used from the Ruby - API: returns a Puppet::Status object. - EOT - find.description <<-'EOT' - Checks whether a Puppet server is properly receiving and processing - HTTP requests. This action is only useful when used with '--terminus - rest'; when invoked with the `local` terminus, `find` will always - return true. - - Over REST, this action will query the configured puppet master by default. - To query other servers, including puppet agent nodes started with the - <--listen> option, you can set the global <--server> and <--masterport> - options on the command line; note that agent nodes listen on port 8139. - EOT - find.short_description <<-EOT - Checks whether a Puppet server is properly receiving and processing HTTP - requests. This action is only useful when used with '--terminus rest', - and will always return true when invoked locally. - EOT - find.notes <<-'EOT' - This action requires that the server's `auth.conf` file allow find - access to the `status` REST terminus. Puppet agent does not use this - facility, and it is turned off by default. See - - for more details. - EOT - find.examples <<-'EOT' - Check the status of the configured puppet master: - - $ puppet status find --terminus rest - EOT - - deprecate -end diff --git a/lib/puppet/http/service/compiler.rb b/lib/puppet/http/service/compiler.rb index 4ba0fcf375b..906c990e780 100644 --- a/lib/puppet/http/service/compiler.rb +++ b/lib/puppet/http/service/compiler.rb @@ -186,33 +186,6 @@ def put_facts(name, environment:, facts:) response end - # - # @api private - # - # Submit a GET request to find the status of a compiler - # - # @param [String] name The name of the node that a status being requested for - # - # @return [Array] An array containing - # the request response and the deserialized status returned from the server - # - def get_status(name) - headers = add_puppet_headers('Accept' => get_mime_types(Puppet::Status).join(', ')) - - response = @client.get( - with_base_url("/status/#{name}"), - headers: headers, - params: { - # environment is required, but meaningless, default to production - environment: 'production' - }, - ) - - process_response(response) - - [response, deserialize(response, Puppet::Status)] - end - # # @api private # diff --git a/lib/puppet/indirector/status.rb b/lib/puppet/indirector/status.rb deleted file mode 100644 index f40bbc4d82b..00000000000 --- a/lib/puppet/indirector/status.rb +++ /dev/null @@ -1,3 +0,0 @@ -# A stub class, so our constants work. -class Puppet::Indirector::Status -end diff --git a/lib/puppet/indirector/status/local.rb b/lib/puppet/indirector/status/local.rb deleted file mode 100644 index fc674eea964..00000000000 --- a/lib/puppet/indirector/status/local.rb +++ /dev/null @@ -1,12 +0,0 @@ -require 'puppet/indirector/status' - -class Puppet::Indirector::Status::Local < Puppet::Indirector::Code - - desc "Get status locally. Only used internally." - - def find( *anything ) - status = model.new - status.version= Puppet.version - status - end -end diff --git a/lib/puppet/indirector/status/rest.rb b/lib/puppet/indirector/status/rest.rb deleted file mode 100644 index a985fc466fb..00000000000 --- a/lib/puppet/indirector/status/rest.rb +++ /dev/null @@ -1,25 +0,0 @@ -require 'puppet/indirector/status' -require 'puppet/indirector/rest' - -class Puppet::Indirector::Status::Rest < Puppet::Indirector::REST - - desc "Get puppet master's status via REST. Useful because it tests the health - of both the web server and the indirector." - - def find(request) - session = Puppet.lookup(:http_session) - api = session.route_to(:puppet) - _, status = api.get_status(request.key) - status - rescue Puppet::HTTP::ResponseError => e - if e.response.code == 404 - return nil unless request.options[:fail_on_404] - - _, body = parse_response(e.response.nethttp) - msg = _("Find %{uri} resulted in 404 with the message: %{body}") % { uri: elide(e.response.url.path, 100), body: body } - raise Puppet::Error, msg - else - raise convert_to_http_error(e.response.nethttp) - end - end -end diff --git a/lib/puppet/status.rb b/lib/puppet/status.rb deleted file mode 100644 index 35aaf539681..00000000000 --- a/lib/puppet/status.rb +++ /dev/null @@ -1,40 +0,0 @@ -require 'puppet/indirector' - -class Puppet::Status - extend Puppet::Indirector - indirects :status, :terminus_class => :local - - attr_accessor :status - - def initialize( status = nil ) - @status = status || {"is_alive" => true} - end - - def to_data_hash - @status - end - - def self.from_data_hash(data) - if data.include?('status') - self.new(data['status']) - else - self.new(data) - end - end - - def name - "status" - end - - def name=(name) - # NOOP - end - - def version - @status['version'] - end - - def version=(version) - @status['version'] = version - end -end diff --git a/spec/unit/agent_spec.rb b/spec/unit/agent_spec.rb index 6072520271f..6bad7ed1a27 100644 --- a/spec/unit/agent_spec.rb +++ b/spec/unit/agent_spec.rb @@ -20,8 +20,6 @@ def without_warnings describe Puppet::Agent do before do - allow(Puppet::Status.indirection).to receive(:find).and_return(Puppet::Status.new("version" => Puppet.version)) - @agent = Puppet::Agent.new(AgentTestClient, false) # make Puppet::Application safe for stubbing; restore in an :after block; silence warnings for this. diff --git a/spec/unit/face/status_spec.rb b/spec/unit/face/status_spec.rb deleted file mode 100644 index c3a4ea1d6c4..00000000000 --- a/spec/unit/face/status_spec.rb +++ /dev/null @@ -1,9 +0,0 @@ -require 'spec_helper' -require 'puppet/face' - -describe Puppet::Face[:status, '0.0.1'] do - it "should be deprecated" do - expect(subject.deprecated?).to be_truthy - end -end - diff --git a/spec/unit/http/service/compiler_spec.rb b/spec/unit/http/service/compiler_spec.rb index 6921ea6dc6f..fad70bb73bd 100644 --- a/spec/unit/http/service/compiler_spec.rb +++ b/spec/unit/http/service/compiler_spec.rb @@ -11,7 +11,6 @@ let(:node) { Puppet::Node.new(certname) } let(:facts) { Puppet::Node::Facts.new(certname) } let(:catalog) { Puppet::Resource::Catalog.new(certname) } - let(:status) { Puppet::Status.new } let(:formatter) { Puppet::Network::FormatHandler.format(:json) } before :each do @@ -417,67 +416,6 @@ end end - context 'when getting status' do - let(:uri) { %r{/puppet/v3/status/ziggy} } - let(:status_response) { { body: formatter.render(status), headers: {'Content-Type' => formatter.mime } } } - - it 'always sends production' do - stub_request(:get, uri) - .with(query: hash_including("environment" => "production")) - .to_return(**status_response) - - subject.get_status(certname) - end - - it 'returns a deserialized status' do - stub_request(:get, uri) - .to_return(**status_response) - - _, s = subject.get_status(certname) - expect(s).to be_a(Puppet::Status) - expect(s.status).to eq("is_alive" => true) - end - - it 'returns the request response' do - stub_request(:get, uri) - .to_return(**status_response) - - resp, _ = subject.get_status(certname) - expect(resp).to be_a(Puppet::HTTP::Response) - end - - it 'raises a response error if unsuccessful' do - stub_request(:get, uri) - .to_return(status: [500, "Server Error"]) - - expect { - subject.get_status(certname) - }.to raise_error do |err| - expect(err).to be_an_instance_of(Puppet::HTTP::ResponseError) - expect(err.message).to eq('Server Error') - expect(err.response.code).to eq(500) - end - end - - it 'raises a protocol error if the content-type header is missing' do - stub_request(:get, uri) - .to_return(body: "content-type is missing") - - expect { - subject.get_status(certname) - }.to raise_error(Puppet::HTTP::ProtocolError, /No content type in http response; cannot parse/) - end - - it 'raises a serialization error if the content is invalid' do - stub_request(:get, uri) - .to_return(body: "this isn't valid JSON", headers: {'Content-Type' => 'application/json'}) - - expect { - subject.get_status(certname) - }.to raise_error(Puppet::HTTP::SerializationError, /Failed to deserialize Puppet::Status from json/) - end - end - context 'filebucket' do let(:filebucket_file) { Puppet::FileBucket::File.new('file to store') } let(:formatter) { Puppet::Network::FormatHandler.format(:binary) } diff --git a/spec/unit/http/service_spec.rb b/spec/unit/http/service_spec.rb index 8fda5e37ce5..827e98f8bb8 100644 --- a/spec/unit/http/service_spec.rb +++ b/spec/unit/http/service_spec.rb @@ -126,7 +126,6 @@ def mime_types(model) Puppet::Node::Facts, Puppet::Transaction::Report, Puppet::FileServing::Metadata, - Puppet::Status ].each do |model| expect(service.mime_types(model)).to eq(mimes) end diff --git a/spec/unit/indirector/status/local_spec.rb b/spec/unit/indirector/status/local_spec.rb deleted file mode 100644 index f68f9292cc4..00000000000 --- a/spec/unit/indirector/status/local_spec.rb +++ /dev/null @@ -1,10 +0,0 @@ -require 'spec_helper' - -require 'puppet/indirector/status/local' - -describe Puppet::Indirector::Status::Local do - it "should set the puppet version" do - Puppet::Status.indirection.terminus_class = :local - expect(Puppet::Status.indirection.find('*').version).to eq(Puppet.version) - end -end diff --git a/spec/unit/indirector/status/rest_spec.rb b/spec/unit/indirector/status/rest_spec.rb deleted file mode 100644 index 7f19006db4d..00000000000 --- a/spec/unit/indirector/status/rest_spec.rb +++ /dev/null @@ -1,50 +0,0 @@ -require 'spec_helper' - -require 'puppet/indirector/status/rest' - -describe Puppet::Indirector::Status::Rest do - let(:certname) { 'ziggy' } - let(:uri) { %r{/puppet/v3/status/ziggy} } - let(:formatter) { Puppet::Network::FormatHandler.format(:json) } - - before :each do - Puppet[:server] = 'compiler.example.com' - Puppet[:masterport] = 8140 - - described_class.indirection.terminus_class = :rest - end - - def status_response(node) - { body: formatter.render(node), headers: {'Content-Type' => formatter.mime } } - end - - it 'finds server status' do - node = Puppet::Status.new(certname) - - stub_request(:get, uri).to_return(**status_response(node)) - - expect(described_class.indirection.find(certname)).to be_a(Puppet::Status) - end - - it 'returns nil if the node does not exist' do - stub_request(:get, uri).to_return(status: 404, headers: { 'Content-Type' => 'application/json' }, body: "{}") - - expect(described_class.indirection.find(certname)).to be_nil - end - - it 'raises if fail_on_404 is specified' do - stub_request(:get, uri).to_return(status: 404, headers: { 'Content-Type' => 'application/json' }, body: "{}") - - expect{ - described_class.indirection.find(certname, fail_on_404: true) - }.to raise_error(Puppet::Error, %r{Find /puppet/v3/status/ziggy resulted in 404 with the message: {}}) - end - - it 'raises Net::HTTPError on 500' do - stub_request(:get, uri).to_return(status: 500) - - expect{ - described_class.indirection.find(certname) - }.to raise_error(Net::HTTPError, %r{Error 500 on SERVER: }) - end -end diff --git a/spec/unit/network/http/api/indirected_routes_spec.rb b/spec/unit/network/http/api/indirected_routes_spec.rb index b67b227d14c..6249b493fe8 100644 --- a/spec/unit/network/http/api/indirected_routes_spec.rb +++ b/spec/unit/network/http/api/indirected_routes_spec.rb @@ -123,10 +123,6 @@ expect(handler.uri2indirection("PUT", "#{master_url_prefix}/facts/puppet.node.test", params)[0].name).to eq(:facts) end - it "should change indirection name to 'status' if the http method is a GET and the indirection name is statuses" do - expect(handler.uri2indirection("GET", "#{master_url_prefix}/statuses/bar", params)[0].name).to eq(:status) - end - it "should change indirection name to 'node' if the http method is a GET and the indirection name is nodes" do expect(handler.uri2indirection("GET", "#{master_url_prefix}/nodes/bar", params)[0].name).to eq(:node) end diff --git a/spec/unit/status_spec.rb b/spec/unit/status_spec.rb deleted file mode 100644 index 95ca31b6f3a..00000000000 --- a/spec/unit/status_spec.rb +++ /dev/null @@ -1,45 +0,0 @@ -#! /usr/bin/env ruby -require 'spec_helper' - -require 'matchers/json' - -describe Puppet::Status do - include JSONMatchers - - it "should implement find" do - expect(Puppet::Status.indirection.find( :default )).to be_is_a(Puppet::Status) - expect(Puppet::Status.indirection.find( :default ).status["is_alive"]).to eq(true) - end - - it "should default to is_alive is true" do - expect(Puppet::Status.new.status["is_alive"]).to eq(true) - end - - it "should return a json hash" do - expect(Puppet::Status.new.status.to_json).to eq('{"is_alive":true}') - end - - it "should render to a json hash" do - expect(JSON::pretty_generate(Puppet::Status.new)).to match(/"is_alive":\s*true/) - end - - it "should accept a hash from json" do - status = Puppet::Status.new( { "is_alive" => false } ) - expect(status.status).to eq({ "is_alive" => false }) - end - - it "should have a name" do - Puppet::Status.new.name - end - - it "should allow a name to be set" do - Puppet::Status.new.name = "status" - end - - it "serializes to JSON that conforms to the status schema" do - status = Puppet::Status.new - status.version = Puppet.version - - expect(status.render('json')).to validate_against('api/schemas/status.json') - end -end From f3c90046d4cfd8b634b0e5f326cbedc48ba03ca7 Mon Sep 17 00:00:00 2001 From: Ciprian Badescu Date: Mon, 31 Aug 2020 12:53:55 +0300 Subject: [PATCH 108/731] (PUP-10475) remove deprecated Puppet::Util::Yaml.load_file method --- lib/puppet/util/yaml.rb | 22 --------------- spec/unit/util/yaml_spec.rb | 54 ------------------------------------- 2 files changed, 76 deletions(-) diff --git a/lib/puppet/util/yaml.rb b/lib/puppet/util/yaml.rb index 88cbb2742ad..994fe957096 100644 --- a/lib/puppet/util/yaml.rb +++ b/lib/puppet/util/yaml.rb @@ -42,28 +42,6 @@ def self.safe_load_file(filename, allowed_classes = []) safe_load(yaml, allowed_classes, filename) end - # @deprecated Use {#safe_load_file} instead. - def self.load_file(filename, default_value = false, strip_classes = false) - Puppet.deprecation_warning(_("Puppet::Util::Yaml.load_file is deprecated. Use safe_load_file instead.")) - - if(strip_classes) then - data = YAML::parse_file(filename) - data.root.each do |o| - if o.respond_to?(:tag=) and - o.tag != nil and - o.tag.start_with?("!ruby") - o.tag = nil - end - end - data.to_ruby || default_value - else - yaml = YAML.load_file(filename) - yaml || default_value - end - rescue *YamlLoadExceptions => detail - raise YamlLoadError.new(detail.message, detail) - end - def self.dump(structure, filename) Puppet::FileSystem.replace_file(filename, 0660) do |fh| YAML.dump(structure, fh) diff --git a/spec/unit/util/yaml_spec.rb b/spec/unit/util/yaml_spec.rb index d189ff10c93..025c65253c6 100644 --- a/spec/unit/util/yaml_spec.rb +++ b/spec/unit/util/yaml_spec.rb @@ -139,60 +139,6 @@ end end - context '#load_file' do - it_should_behave_like 'yaml file loader', Puppet::Util::Yaml.method(:load_file) - - it 'raises an error when the file is invalid YAML' do - write_file(filename, '{ invalid') - - expect { - Puppet::Util::Yaml.load_file(filename) - }.to raise_error(Puppet::Util::Yaml::YamlLoadError, %r{\(#{filename}\): .* at line \d+ column \d+}) - end - - it 'raises an error when the filename is illegal' do - expect { - Puppet::Util::Yaml.load_file("not\0allowed") - }.to raise_error(Puppet::Util::Yaml::YamlLoadError, /null byte/) - end - - it 'raises an error when the file does not exist' do - expect { - Puppet::Util::Yaml.load_file('does/not/exist.yaml') - }.to raise_error(Puppet::Util::Yaml::YamlLoadError, /No such file or directory/) - end - - it 'allows return value to be overridden' do - Puppet::FileSystem.touch(filename) - - expect(Puppet::Util::Yaml.load_file(filename, {})).to eq({}) - end - - it 'loads arbitrary objects' do - write_file(filename, "--- !ruby/object {}\n") - - expect(Puppet::Util::Yaml.load_file(filename, {})).to be_instance_of(Object) - end - - it 'should allow one to strip ruby tags that would otherwise not parse' do - write_file(filename, "---\nweirddata: !ruby/hash:Not::A::Valid::Class {}") - - expect(Puppet::Util::Yaml.load_file(filename, {}, true)).to eq({"weirddata" => {}}) - end - - it 'should not strip non-ruby tags' do - write_file(filename, "---\nweirddata: !binary |-\n e21kNX04MTE4ZGY2NmM5MTc3OTg4ZWE4Y2JiOWEzMjMyNzFkYg==") - - expect(Puppet::Util::Yaml.load_file(filename, {}, true)).to eq({"weirddata" => "{md5}8118df66c9177988ea8cbb9a323271db"}) - end - - it 'writes data formatted as YAML to disk' do - Puppet::Util::Yaml.dump({ "my" => "data" }, filename) - - expect(Puppet::Util::Yaml.load_file(filename)).to eq({ "my" => "data" }) - end - end - def write_file(name, contents) File.open(name, "w:UTF-8") do |fh| fh.write(contents) From 28e6cc2ac970ad8d8bd9609eabd21fd1954b30ae Mon Sep 17 00:00:00 2001 From: Ciprian Badescu Date: Mon, 31 Aug 2020 13:59:06 +0300 Subject: [PATCH 109/731] (PUP-10598) Change default value of `ignore_plugin_errors` to false If `ignore_plugin_errors` is true(default value before this commit), puppet agents can fail to pluginsync and will be missing facts/types/providers that may be needed to request and apply the catalog. For example, missing custom/external facts can change which classes are included in the catalog or cause compilation failures if the manifests references the missing fact --- lib/puppet/defaults.rb | 2 +- spec/unit/configurer/downloader_spec.rb | 8 ++++++-- spec/unit/configurer_spec.rb | 4 ++++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb index 2c0d3bc9659..d9aaabfd0c5 100644 --- a/lib/puppet/defaults.rb +++ b/lib/puppet/defaults.rb @@ -1887,7 +1887,7 @@ def self.initialize_default_settings!(settings) :desc => "What files to ignore when pulling down plugins.", }, :ignore_plugin_errors => { - :default => true, + :default => false, :type => :boolean, :desc => "Whether the puppet run should ignore errors during pluginsync. If the setting is false and there are errors during pluginsync, then the agent will abort the run and diff --git a/spec/unit/configurer/downloader_spec.rb b/spec/unit/configurer/downloader_spec.rb index bcbda27e3cd..cdc2413d816 100644 --- a/spec/unit/configurer/downloader_spec.rb +++ b/spec/unit/configurer/downloader_spec.rb @@ -189,6 +189,8 @@ def generate_file_resource(options = {}) end it "should return all changed file paths" do + Puppet[:ignore_plugin_errors] = true + trans = double('transaction') catalog = double('catalog') @@ -204,6 +206,8 @@ def generate_file_resource(options = {}) end it "should yield the resources if a block is given" do + Puppet[:ignore_plugin_errors] = true + trans = double('transaction') catalog = double('catalog') @@ -221,6 +225,8 @@ def generate_file_resource(options = {}) end it "should catch and log exceptions" do + Puppet[:ignore_plugin_errors] = true + expect(Puppet).to receive(:log_exception) # The downloader creates a new catalog for each apply, and really the only object # that it is possible to stub for the purpose of generating a puppet error @@ -230,8 +236,6 @@ def generate_file_resource(options = {}) end it "raises an exception if catalog application fails" do - Puppet[:ignore_plugin_errors] = false - expect(@dler.file).to receive(:retrieve).and_raise(Puppet::Error, "testing") expect { diff --git a/spec/unit/configurer_spec.rb b/spec/unit/configurer_spec.rb index 81fa9281a2c..e3e716c4cd7 100644 --- a/spec/unit/configurer_spec.rb +++ b/spec/unit/configurer_spec.rb @@ -639,6 +639,8 @@ def expects_neither_new_or_cached_catalog end it "should pluginsync and compile a new catalog if none is found in the cache" do + Puppet[:ignore_plugin_errors] = true + expects_fallback_to_new_catalog(catalog) stub_request(:get, %r{/puppet/v3/file_metadatas?/plugins}).to_return(:status => 404) stub_request(:get, %r{/puppet/v3/file_metadatas?/pluginfacts}).to_return(:status => 404) @@ -650,6 +652,8 @@ def expects_neither_new_or_cached_catalog end it "should not attempt to retrieve a cached catalog again if the first attempt failed" do + Puppet[:ignore_plugin_errors] = true + expect(Puppet::Node.indirection).to receive(:find).and_return(nil) expects_neither_new_or_cached_catalog expects_pluginsync From 3c5e6d8b2204272f454d1b0a1470875eeb08df4c Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Tue, 1 Sep 2020 11:51:20 +0000 Subject: [PATCH 110/731] (packaging) Updating the puppet.pot file --- locales/puppet.pot | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/locales/puppet.pot b/locales/puppet.pot index 7900a6722e9..3f54bc387d4 100644 --- a/locales/puppet.pot +++ b/locales/puppet.pot @@ -6,11 +6,11 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Puppet automation framework 6.18.0-162-g52fc63610e\n" +"Project-Id-Version: Puppet automation framework 6.18.0-173-ga4deba7894\n" "\n" "Report-Msgid-Bugs-To: https://tickets.puppetlabs.com\n" -"POT-Creation-Date: 2020-08-27 17:51+0000\n" -"PO-Revision-Date: 2020-08-27 17:51+0000\n" +"POT-Creation-Date: 2020-09-01 11:51+0000\n" +"PO-Revision-Date: 2020-09-01 11:51+0000\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -9850,10 +9850,6 @@ msgstr "" msgid "Failed to unload user profile %{user}" msgstr "" -#: ../lib/puppet/util/yaml.rb:47 -msgid "Puppet::Util::Yaml.load_file is deprecated. Use safe_load_file instead." -msgstr "" - #: ../lib/puppet/x509/cert_provider.rb:39 msgid "Failed to save CA certificates to '%{capath}'" msgstr "" From 8427686c0fd6c0f994e202a378263a0d5f565e96 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Tue, 1 Sep 2020 11:52:37 +0000 Subject: [PATCH 111/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 2 +- man/man8/puppet-agent.8 | 2 +- man/man8/puppet-apply.8 | 2 +- man/man8/puppet-catalog.8 | 2 +- man/man8/puppet-config.8 | 2 +- man/man8/puppet-describe.8 | 2 +- man/man8/puppet-device.8 | 2 +- man/man8/puppet-doc.8 | 2 +- man/man8/puppet-epp.8 | 2 +- man/man8/puppet-facts.8 | 2 +- man/man8/puppet-filebucket.8 | 2 +- man/man8/puppet-generate.8 | 2 +- man/man8/puppet-help.8 | 2 +- man/man8/puppet-lookup.8 | 2 +- man/man8/puppet-module.8 | 2 +- man/man8/puppet-node.8 | 2 +- man/man8/puppet-parser.8 | 2 +- man/man8/puppet-plugin.8 | 2 +- man/man8/puppet-report.8 | 2 +- man/man8/puppet-resource.8 | 2 +- man/man8/puppet-script.8 | 2 +- man/man8/puppet-ssl.8 | 2 +- man/man8/puppet-status.8 | 2 +- man/man8/puppet.8 | 2 +- 24 files changed, 24 insertions(+), 24 deletions(-) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index f0be0837f9f..2839c727e23 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPETCONF" "5" "August 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPETCONF" "5" "September 2020" "Puppet, Inc." "Puppet manual" \fBThis page is autogenerated; any changes will get overwritten\fR . .SH "Configuration settings" diff --git a/man/man8/puppet-agent.8 b/man/man8/puppet-agent.8 index efdace3436d..17ec2193ce6 100644 --- a/man/man8/puppet-agent.8 +++ b/man/man8/puppet-agent.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-AGENT" "8" "August 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-AGENT" "8" "September 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-agent\fR \- The puppet agent daemon diff --git a/man/man8/puppet-apply.8 b/man/man8/puppet-apply.8 index e4d1f29a837..3db7bd45a4f 100644 --- a/man/man8/puppet-apply.8 +++ b/man/man8/puppet-apply.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-APPLY" "8" "August 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-APPLY" "8" "September 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-apply\fR \- Apply Puppet manifests locally diff --git a/man/man8/puppet-catalog.8 b/man/man8/puppet-catalog.8 index 256a4c54a79..d80588fa8ae 100644 --- a/man/man8/puppet-catalog.8 +++ b/man/man8/puppet-catalog.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-CATALOG" "8" "August 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-CATALOG" "8" "September 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-catalog\fR \- Compile, save, view, and convert catalogs\. diff --git a/man/man8/puppet-config.8 b/man/man8/puppet-config.8 index 424f957cd8e..f6f7c2eec51 100644 --- a/man/man8/puppet-config.8 +++ b/man/man8/puppet-config.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-CONFIG" "8" "August 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-CONFIG" "8" "September 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-config\fR \- Interact with Puppet\'s settings\. diff --git a/man/man8/puppet-describe.8 b/man/man8/puppet-describe.8 index 278cc384ecc..270c34d8c0d 100644 --- a/man/man8/puppet-describe.8 +++ b/man/man8/puppet-describe.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-DESCRIBE" "8" "August 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-DESCRIBE" "8" "September 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-describe\fR \- Display help about resource types diff --git a/man/man8/puppet-device.8 b/man/man8/puppet-device.8 index da6e6c104bf..6e4c9b933d5 100644 --- a/man/man8/puppet-device.8 +++ b/man/man8/puppet-device.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-DEVICE" "8" "August 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-DEVICE" "8" "September 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-device\fR \- Manage remote network devices diff --git a/man/man8/puppet-doc.8 b/man/man8/puppet-doc.8 index aa062148918..e6a77cffb59 100644 --- a/man/man8/puppet-doc.8 +++ b/man/man8/puppet-doc.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-DOC" "8" "August 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-DOC" "8" "September 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-doc\fR \- Generate Puppet references diff --git a/man/man8/puppet-epp.8 b/man/man8/puppet-epp.8 index d771f9f34c3..2c296fb3f5c 100644 --- a/man/man8/puppet-epp.8 +++ b/man/man8/puppet-epp.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-EPP" "8" "August 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-EPP" "8" "September 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-epp\fR \- Interact directly with the EPP template parser/renderer\. diff --git a/man/man8/puppet-facts.8 b/man/man8/puppet-facts.8 index f3fd0e40f7a..4cb424ee8f9 100644 --- a/man/man8/puppet-facts.8 +++ b/man/man8/puppet-facts.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-FACTS" "8" "August 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-FACTS" "8" "September 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-facts\fR \- Retrieve and store facts\. diff --git a/man/man8/puppet-filebucket.8 b/man/man8/puppet-filebucket.8 index 83fd98320c3..aca4fdb9c0a 100644 --- a/man/man8/puppet-filebucket.8 +++ b/man/man8/puppet-filebucket.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-FILEBUCKET" "8" "August 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-FILEBUCKET" "8" "September 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-filebucket\fR \- Store and retrieve files in a filebucket diff --git a/man/man8/puppet-generate.8 b/man/man8/puppet-generate.8 index b0570fd2452..b5b5343674c 100644 --- a/man/man8/puppet-generate.8 +++ b/man/man8/puppet-generate.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-GENERATE" "8" "August 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-GENERATE" "8" "September 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-generate\fR \- Generates Puppet code from Ruby definitions\. diff --git a/man/man8/puppet-help.8 b/man/man8/puppet-help.8 index 4c971edc14b..e397ffe0d01 100644 --- a/man/man8/puppet-help.8 +++ b/man/man8/puppet-help.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-HELP" "8" "August 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-HELP" "8" "September 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-help\fR \- Display Puppet help\. diff --git a/man/man8/puppet-lookup.8 b/man/man8/puppet-lookup.8 index 724ecc63137..b0e20c79095 100644 --- a/man/man8/puppet-lookup.8 +++ b/man/man8/puppet-lookup.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-LOOKUP" "8" "August 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-LOOKUP" "8" "September 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-lookup\fR \- Interactive Hiera lookup diff --git a/man/man8/puppet-module.8 b/man/man8/puppet-module.8 index 606b69a8832..c86f7df7d63 100644 --- a/man/man8/puppet-module.8 +++ b/man/man8/puppet-module.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-MODULE" "8" "August 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-MODULE" "8" "September 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-module\fR \- Creates, installs and searches for modules on the Puppet Forge\. diff --git a/man/man8/puppet-node.8 b/man/man8/puppet-node.8 index 11ea4e3bc71..def01f5ee22 100644 --- a/man/man8/puppet-node.8 +++ b/man/man8/puppet-node.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-NODE" "8" "August 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-NODE" "8" "September 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-node\fR \- View and manage node definitions\. diff --git a/man/man8/puppet-parser.8 b/man/man8/puppet-parser.8 index be8399365d7..b0ef4173a70 100644 --- a/man/man8/puppet-parser.8 +++ b/man/man8/puppet-parser.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-PARSER" "8" "August 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-PARSER" "8" "September 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-parser\fR \- Interact directly with the parser\. diff --git a/man/man8/puppet-plugin.8 b/man/man8/puppet-plugin.8 index f481dc5bb77..acda8a2efd5 100644 --- a/man/man8/puppet-plugin.8 +++ b/man/man8/puppet-plugin.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-PLUGIN" "8" "August 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-PLUGIN" "8" "September 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-plugin\fR \- Interact with the Puppet plugin system\. diff --git a/man/man8/puppet-report.8 b/man/man8/puppet-report.8 index efc3f969cdb..0e979f26fa9 100644 --- a/man/man8/puppet-report.8 +++ b/man/man8/puppet-report.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-REPORT" "8" "August 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-REPORT" "8" "September 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-report\fR \- Create, display, and submit reports\. diff --git a/man/man8/puppet-resource.8 b/man/man8/puppet-resource.8 index cd83e60024d..ad1ee3716ce 100644 --- a/man/man8/puppet-resource.8 +++ b/man/man8/puppet-resource.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-RESOURCE" "8" "August 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-RESOURCE" "8" "September 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-resource\fR \- The resource abstraction layer shell diff --git a/man/man8/puppet-script.8 b/man/man8/puppet-script.8 index 126c942ca44..cda66166ac2 100644 --- a/man/man8/puppet-script.8 +++ b/man/man8/puppet-script.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-SCRIPT" "8" "August 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-SCRIPT" "8" "September 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-script\fR \- Run a puppet manifests as a script without compiling a catalog diff --git a/man/man8/puppet-ssl.8 b/man/man8/puppet-ssl.8 index 993de3e8c95..4e8a7adbe3d 100644 --- a/man/man8/puppet-ssl.8 +++ b/man/man8/puppet-ssl.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-SSL" "8" "August 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-SSL" "8" "September 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-ssl\fR \- Manage SSL keys and certificates for puppet SSL clients diff --git a/man/man8/puppet-status.8 b/man/man8/puppet-status.8 index 52be5c6ef8c..f3a44947f52 100644 --- a/man/man8/puppet-status.8 +++ b/man/man8/puppet-status.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-STATUS" "8" "August 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-STATUS" "8" "September 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-status\fR \- View puppet server status\. diff --git a/man/man8/puppet.8 b/man/man8/puppet.8 index c7ecbf60aa3..35137d2f4a0 100644 --- a/man/man8/puppet.8 +++ b/man/man8/puppet.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET" "8" "August 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET" "8" "September 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\fR From 41f906e0bf38389b59b24dc72b2722ecc0c8e73a Mon Sep 17 00:00:00 2001 From: Gabriel Nagy Date: Tue, 1 Sep 2020 18:57:52 +0300 Subject: [PATCH 112/731] (PUP-10606) Remove lib/puppet/ffi.rb Remove `lib/puppet/ffi.rb` and set up namespacing from `lib/puppet/ffi/windows.rb`. --- lib/puppet/ffi.rb | 6 ------ lib/puppet/ffi/windows.rb | 16 ++++++++++------ 2 files changed, 10 insertions(+), 12 deletions(-) delete mode 100644 lib/puppet/ffi.rb diff --git a/lib/puppet/ffi.rb b/lib/puppet/ffi.rb deleted file mode 100644 index 22322677705..00000000000 --- a/lib/puppet/ffi.rb +++ /dev/null @@ -1,6 +0,0 @@ -require 'ffi' - -module Puppet - module FFI - end -end diff --git a/lib/puppet/ffi/windows.rb b/lib/puppet/ffi/windows.rb index 0fcf4550bd2..c3fe12e9381 100644 --- a/lib/puppet/ffi/windows.rb +++ b/lib/puppet/ffi/windows.rb @@ -1,8 +1,12 @@ -require 'puppet/ffi' +require 'ffi' -module Puppet::FFI::Windows - require 'puppet/ffi/windows/api_types' - require 'puppet/ffi/windows/constants' - require 'puppet/ffi/windows/structs' - require 'puppet/ffi/windows/functions' +module Puppet + module FFI + module Windows + require 'puppet/ffi/windows/api_types' + require 'puppet/ffi/windows/constants' + require 'puppet/ffi/windows/structs' + require 'puppet/ffi/windows/functions' + end + end end From 17b2735731f6468aef92a5540b35292e056726e3 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Tue, 1 Sep 2020 16:23:01 +0000 Subject: [PATCH 113/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index 2839c727e23..3054f6e7125 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -915,7 +915,7 @@ The HTTP User\-Agent string to send when making network requests\. Whether the puppet run should ignore errors during pluginsync\. If the setting is false and there are errors during pluginsync, then the agent will abort the run and submit a report containing information about the failed run\. . .IP "\(bu" 4 -\fIDefault\fR: true +\fIDefault\fR: false . .IP "" 0 . From 53383edec64a7a3aa670be2e04aac7db8646b2e4 Mon Sep 17 00:00:00 2001 From: Luchian Nemes Date: Mon, 17 Aug 2020 20:03:47 +0300 Subject: [PATCH 114/731] (PUP-10627) Makes last_run_summary.yaml readable for regular users Before this commit, the `last_run_summary.yaml` report file (automatically generated after an agent run) was located in `/opt/puppetlabs/puppet/cache/state` on Linux and `C:\ProgramData\PuppetLabs\puppet\cache\state` on Microsoft Windows which isn't accessible by any user since it can sometimes contain other files with sensitive data in them. The `last_run_summary.yaml` does not contain such information. This commit adds the `public` folder (full path being `/opt/puppetlabs/puppet/public` on Linux and `C:\ProgramData\PuppetLabs\puppet\public` on Microsoft Windows) with `0755` (rwxr-xr-x) permissions and changes the `last_run_summary.yaml` file default path inside it for public access. Similar files can easily be moved here in the future. The folder's existence is ensured after installation or upgrade of a puppet-agent. The `puppet config set publicdir ` cli command or adding the `publicdir = ` line in the `puppet.conf` file can be used for changing the path. --- .../tests/agent/last_run_summary_report.rb | 104 ++++++++++++++++++ .../PUP-9719_windows_system_first_pa_run.rb | 18 +-- install.rb | 14 +++ lib/puppet/defaults.rb | 8 +- lib/puppet/reference/configuration.rb | 2 + lib/puppet/settings.rb | 15 +-- lib/puppet/test/test_helper.rb | 1 + lib/puppet/util/run_mode.rb | 8 ++ spec/lib/puppet_spec/settings.rb | 1 + spec/spec_helper.rb | 2 + spec/unit/util/run_mode_spec.rb | 40 +++++++ 11 files changed, 197 insertions(+), 16 deletions(-) create mode 100644 acceptance/tests/agent/last_run_summary_report.rb diff --git a/acceptance/tests/agent/last_run_summary_report.rb b/acceptance/tests/agent/last_run_summary_report.rb new file mode 100644 index 00000000000..c232a007583 --- /dev/null +++ b/acceptance/tests/agent/last_run_summary_report.rb @@ -0,0 +1,104 @@ +test_name "The 'last_run_summary.yaml' report has the right location and permissions" do + tag 'audit:high' + + require 'puppet/acceptance/temp_file_utils' + extend Puppet::Acceptance::TempFileUtils + + agents.each do |agent| + custom_publicdir = agent.tmpdir('custom_public_dir') + + statedir = on(agent, puppet('config print statedir')).stdout.chomp + fail_test("The 'statedir' config is not set!") if statedir.empty? + + publicdir = on(agent, puppet('config print publicdir')).stdout.chomp + fail_test("The 'publicdir' config is not set!") if publicdir.empty? + + teardown do + agent.rm_rf(custom_publicdir) + agent.rm_rf("#{publicdir}/*") unless publicdir.empty? + on(agent, puppet("config set publicdir #{publicdir}")) + end + + step "Check if '#{publicdir}' was created during puppet installation" do + on(agent, "ls #{publicdir}", :acceptable_exit_codes => [0]) + end + + step "Check if '#{publicdir}' has '0755' permissions" do + if agent['platform'] =~ /windows/ + on(agent, "icacls #{publicdir}") do |result| + # Linux 'Owner' permissions class equivalent + assert_match(/BUILTIN\\Administrators:.*\(F\)/, result.stdout) + + # Known issue on Windows: 'C:\ProgramData\PuppetLabs\puppet' permissions are inherited + # by its subfolders and it does not have any permissions for 'Everyone' (see 'PuppetAppDir' + # in 'puppet-agent/resources/windows/wix/appdatafiles.wxs') + # Below line should be added when solution is found: + # assert_match(/Everyone:.*\(RX\)/, result.stdout) + end + else + on(agent, "ls -al #{publicdir}") do |result| + assert_match(/rwxr-xr-x.+\.$/, result.stdout) + end + end + end + + step "Create the 'last_run_summary.yaml' report file by applying catalog" do + on(agent, puppet('agent -t')) do |result| + assert_match('Applied catalog', result.stdout) + end + end + + step "Check if the 'last_run_summary.yaml' report file created has '0644' permissions" do + if agent['platform'] =~ /windows/ + on(agent, "icacls #{File.join(publicdir, 'last_run_summary.yaml')}") do |result| + # Linux 'Owner' premissions class equivalent + assert_match('Administrator:(R,W', result.stdout) + # Linux 'Group' permissions class equivalent + assert_match('None:(R)', result.stdout) + # Linux 'Public' permissions class equivalent + assert_match('Everyone:(R)', result.stdout) + end + else + on(agent, "ls -al #{publicdir}") do |result| + assert_match(/rw-r--r--.+last_run_summary\.yaml$/, result.stdout) + end + end + end + + step "Check that '#{statedir}' exists and has no 'last_run_summary.yaml' file" do + on(agent, "ls #{statedir}",:acceptable_exit_codes => [0]) do |result| + assert_no_match(/last_run_summary.yaml/, result.stdout) + end + end + + step "Check that 'publicdir' can be reconfigured" do + on(agent, puppet("config set publicdir #{custom_publicdir}")) + on(agent, puppet('config print publicdir')) do |result| + assert_match(custom_publicdir, result.stdout) + end + end + + step "Create a new 'last_run_summary.yaml' report file by applying catalog" do + on(agent, puppet('agent -t')) do |result| + assert_match('Applied catalog', result.stdout) + end + end + + step "Check if the 'last_run_summary.yaml' report file was created in the new location and still has '0644' permissions" do + if agent['platform'] =~ /windows/ + on(agent, "icacls #{File.join(custom_publicdir, 'last_run_summary.yaml')}") do |result| + # Linux 'Owner' premissions class equivalent + assert_match('Administrator:(R,W', result.stdout) + # Linux 'Group' permissions class equivalent + assert_match('None:(R)', result.stdout) + # Linux 'Public' permissions class equivalent + assert_match('Everyone:(R)', result.stdout) + end + else + on(agent, "ls -al #{custom_publicdir}") do |result| + assert_match(/rw-r--r--.+last_run_summary\.yaml$/, result.stdout) + end + end + end + end +end diff --git a/acceptance/tests/windows/PUP-9719_windows_system_first_pa_run.rb b/acceptance/tests/windows/PUP-9719_windows_system_first_pa_run.rb index b7d8b879b31..3d8fd444295 100644 --- a/acceptance/tests/windows/PUP-9719_windows_system_first_pa_run.rb +++ b/acceptance/tests/windows/PUP-9719_windows_system_first_pa_run.rb @@ -1,8 +1,7 @@ # frozen_string_literal: true test_name 'PUP-9719 Windows First Agent run as SYSTEM sets cache file permissions correctly' do - tag 'risk:medium', - 'audit:high', + tag 'audit:high', 'audit:integration' confine :to, platform: 'windows' @@ -11,17 +10,20 @@ extend Puppet::Acceptance::TempFileUtils agents.each do |agent| - statedir = on(agent, puppet('config print statedir')).stdout.chomp + publicdir = on(agent, puppet('config print publicdir')).stdout.chomp client_datadir = on(agent, puppet('config print client_datadir')).stdout.chomp teardown do on agent, 'schtasks /delete /tn PuppetSystemRun /F' - on agent, "rm -rf #{statedir}/*" - on agent, "rm -rf #{client_datadir}/catalog/*" + on agent, "rm -rf #{publicdir}/*" unless publicdir.empty? + on agent, "rm -rf #{client_datadir}/catalog/*" unless client_datadir.empty? end - step 'Clean the ProgramData cache directory first' do - on agent, "rm -rf #{statedir}/*" + step 'Clean the public and catalog directories first' do + fail_test("The publicdir config is not set!") if publicdir.empty? + fail_test("The client_datadir config is not set!") if client_datadir.empty? + + on agent, "rm -rf #{publicdir}/*" on agent, "rm -rf #{client_datadir}/catalog/*" end @@ -40,7 +42,7 @@ end step 'Wait for Puppet Agent run to complete' do - last_puppet_run = File.join(statedir, 'last_run_summary.yaml') + last_puppet_run = File.join(publicdir, 'last_run_summary.yaml') trymax = 10 try = 1 last_wait = 2 diff --git a/install.rb b/install.rb index e28d36c7d62..3b6376f9570 100755 --- a/install.rb +++ b/install.rb @@ -178,6 +178,9 @@ def prepare_installation opts.on('--vardir[=OPTIONAL]', 'Installation directory for var files', 'Default /opt/puppetlabs/puppet/cache') do |vardir| InstallOptions.vardir = vardir end + opts.on('--publicdir[=OPTIONAL]', 'Installation directory for public files such as the `last_run_summary.yaml` report', 'Default /opt/puppetlabs/puppet/public') do |publicdir| + InstallOptions.publicdir = publicdir + end opts.on('--rundir[=OPTIONAL]', 'Installation directory for state files', 'Default /var/run/puppetlabs') do |rundir| InstallOptions.rundir = rundir end @@ -266,6 +269,14 @@ def prepare_installation vardir = "/opt/puppetlabs/puppet/cache" end + if not InstallOptions.publicdir.nil? + publicdir = InstallOptions.publicdir + elsif $operatingsystem == "windows" + publicdir = File.join(ENV['ALLUSERSPROFILE'], "PuppetLabs", "puppet", "public") + else + publicdir = "/opt/puppetlabs/puppet/public" + end + if not InstallOptions.rundir.nil? rundir = InstallOptions.rundir elsif $operatingsystem == "windows" @@ -332,6 +343,7 @@ def prepare_installation configdir = join(destdir, configdir) codedir = join(destdir, codedir) vardir = join(destdir, vardir) + publicdir = join(destdir, publicdir) rundir = join(destdir, rundir) logdir = join(destdir, logdir) bindir = join(destdir, bindir) @@ -345,6 +357,7 @@ def prepare_installation FileUtils.makedirs(mandir) FileUtils.makedirs(sitelibdir) FileUtils.makedirs(vardir) + FileUtils.makedirs(publicdir) FileUtils.makedirs(rundir) FileUtils.makedirs(logdir) FileUtils.makedirs(localedir) @@ -356,6 +369,7 @@ def prepare_installation InstallOptions.lib_dir = libdir InstallOptions.man_dir = mandir InstallOptions.var_dir = vardir + InstallOptions.public_dir = publicdir InstallOptions.run_dir = rundir InstallOptions.log_dir = logdir InstallOptions.locale_dir = localedir diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb index d9aaabfd0c5..8ba34df1340 100644 --- a/lib/puppet/defaults.rb +++ b/lib/puppet/defaults.rb @@ -1751,8 +1751,14 @@ def self.initialize_default_settings!(settings) for the node stored in puppetdb are current. However, this will double the fact submission load on puppetdb, so it is disabled by default.", }, + :publicdir => { + :default => nil, + :type => :directory, + :mode => "0755", + :desc => "Where Puppet stores public files." + }, :lastrunfile => { - :default => "$statedir/last_run_summary.yaml", + :default => "$publicdir/last_run_summary.yaml", :type => :file, :mode => "0644", :desc => "Where puppet agent stores the last run report summary in yaml format." diff --git a/lib/puppet/reference/configuration.rb b/lib/puppet/reference/configuration.rb index e747f9aecd2..4f301159736 100644 --- a/lib/puppet/reference/configuration.rb +++ b/lib/puppet/reference/configuration.rb @@ -24,6 +24,8 @@ val = object.default if name.to_s == 'vardir' val = 'Unix/Linux: /opt/puppetlabs/puppet/cache -- Windows: C:\ProgramData\PuppetLabs\puppet\cache -- Non-root user: ~/.puppetlabs/opt/puppet/cache' + elsif name.to_s == 'publicdir' + val = 'Unix/Linux: /opt/puppetlabs/puppet/public -- Windows: C:\ProgramData\PuppetLabs\puppet\public -- Non-root user: ~/.puppetlabs/opt/puppet/public' elsif name.to_s == 'confdir' val = 'Unix/Linux: /etc/puppetlabs/puppet -- Windows: C:\ProgramData\PuppetLabs\puppet\etc -- Non-root user: ~/.puppetlabs/etc/puppet' elsif name.to_s == 'codedir' diff --git a/lib/puppet/settings.rb b/lib/puppet/settings.rb index 8bfdd7f8f9b..78b9ed686bb 100644 --- a/lib/puppet/settings.rb +++ b/lib/puppet/settings.rb @@ -52,13 +52,14 @@ class Puppet::Settings # returns reasonable application default settings values for a given run_mode. def self.app_defaults_for_run_mode(run_mode) { - :name => run_mode.to_s, - :run_mode => run_mode.name, - :confdir => run_mode.conf_dir, - :codedir => run_mode.code_dir, - :vardir => run_mode.var_dir, - :rundir => run_mode.run_dir, - :logdir => run_mode.log_dir, + :name => run_mode.to_s, + :run_mode => run_mode.name, + :confdir => run_mode.conf_dir, + :codedir => run_mode.code_dir, + :vardir => run_mode.var_dir, + :publicdir => run_mode.public_dir, + :rundir => run_mode.run_dir, + :logdir => run_mode.log_dir, } end diff --git a/lib/puppet/test/test_helper.rb b/lib/puppet/test/test_helper.rb index 0f1ad25bab7..c78c8d1ebc0 100644 --- a/lib/puppet/test/test_helper.rb +++ b/lib/puppet/test/test_helper.rb @@ -220,6 +220,7 @@ def self.app_defaults_for_tests() { :logdir => "/dev/null", :confdir => "/dev/null", + :publicdir => "/dev/null", :codedir => "/dev/null", :vardir => "/dev/null", :rundir => "/dev/null", diff --git a/lib/puppet/util/run_mode.rb b/lib/puppet/util/run_mode.rb index d0f9b9a5fb6..c21a20366d1 100644 --- a/lib/puppet/util/run_mode.rb +++ b/lib/puppet/util/run_mode.rb @@ -70,6 +70,10 @@ def var_dir which_dir("/opt/puppetlabs/puppet/cache", "~/.puppetlabs/opt/puppet/cache") end + def public_dir + which_dir("/opt/puppetlabs/puppet/public", "~/.puppetlabs/opt/puppet/public") + end + def run_dir which_dir("/var/run/puppetlabs", "~/.puppetlabs/var/run") end @@ -92,6 +96,10 @@ def var_dir which_dir(File.join(windows_common_base("puppet/cache")), "~/.puppetlabs/opt/puppet/cache") end + def public_dir + which_dir(File.join(windows_common_base("puppet/public")), "~/.puppetlabs/opt/puppet/public") + end + def run_dir which_dir(File.join(windows_common_base("puppet/var/run")), "~/.puppetlabs/var/run") end diff --git a/spec/lib/puppet_spec/settings.rb b/spec/lib/puppet_spec/settings.rb index 28042a4c3b8..87a1d861cba 100644 --- a/spec/lib/puppet_spec/settings.rb +++ b/spec/lib/puppet_spec/settings.rb @@ -11,6 +11,7 @@ module PuppetSpec::Settings :confdir => { :type => :directory, :default => "test", :desc => "confdir" }, :codedir => { :type => :directory, :default => "test", :desc => "codedir" }, :vardir => { :type => :directory, :default => "test", :desc => "vardir" }, + :publicdir => { :type => :directory, :default => "test", :desc => "publicdir" }, :rundir => { :type => :directory, :default => "test", :desc => "rundir" }, } diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index c3ac6a62d8b..9c083e4fae6 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -148,6 +148,7 @@ module PuppetSpec base = PuppetSpec::Files.tmpdir('tmp_settings') Puppet[:vardir] = File.join(base, 'var') + Puppet[:publicdir] = File.join(base, 'public') Puppet[:confdir] = File.join(base, 'etc') Puppet[:codedir] = File.join(base, 'code') Puppet[:logdir] = "$vardir/log" @@ -155,6 +156,7 @@ module PuppetSpec Puppet[:hiera_config] = File.join(base, 'hiera') FileUtils.mkdir_p Puppet[:statedir] + FileUtils.mkdir_p Puppet[:publicdir] Puppet::Test::TestHelper.before_each_test() end diff --git a/spec/unit/util/run_mode_spec.rb b/spec/unit/util/run_mode_spec.rb index 81855b19e75..961980ee1b3 100644 --- a/spec/unit/util/run_mode_spec.rb +++ b/spec/unit/util/run_mode_spec.rb @@ -90,6 +90,24 @@ def self.gte_ruby_2_4 end end + describe "#public_dir" do + it "has publicdir /opt/puppetlabs/puppet/public when run as root" do + as_root { expect(@run_mode.public_dir).to eq(File.expand_path('/opt/puppetlabs/puppet/public')) } + end + + it "has publicdir ~/.puppetlabs/opt/puppet/public when run as non-root" do + as_non_root { expect(@run_mode.public_dir).to eq(File.expand_path('~/.puppetlabs/opt/puppet/public')) } + end + + it "fails when asking for the public_dir as non-root and there is no $HOME", :unless => gte_ruby_2_4 || Puppet::Util::Platform.windows? do + as_non_root do + without_home do + expect { @run_mode.public_dir }.to raise_error ArgumentError, /couldn't find HOME/ + end + end + end + end + describe "#log_dir" do describe "when run as root" do it "has logdir /var/log/puppetlabs/puppet" do @@ -216,6 +234,28 @@ def self.gte_ruby_2_4 end end + describe "#public_dir" do + it "has publicdir ending in PuppetLabs/puppet/public when run as root" do + as_root { expect(@run_mode.public_dir).to eq(File.expand_path(File.join(Dir::COMMON_APPDATA, "PuppetLabs", "puppet", "public"))) } + end + + it "has publicdir in ~/.puppetlabs/opt/puppet/public when run as non-root" do + as_non_root { expect(@run_mode.public_dir).to eq(File.expand_path("~/.puppetlabs/opt/puppet/public")) } + end + + it "fails when asking for the public_dir as non-root and there is no %HOME%, %HOMEDRIVE%, and %USERPROFILE%", :unless => gte_ruby_2_4 do + as_non_root do + without_env('HOME') do + without_env('HOMEDRIVE') do + without_env('USERPROFILE') do + expect { @run_mode.public_dir }.to raise_error ArgumentError, /couldn't find HOME/ + end + end + end + end + end + end + describe "#log_dir" do describe "when run as root" do it "has logdir ending in PuppetLabs/puppet/var/log" do From 2d7a8e94be6693b13d9527fa93c14eb442c4b457 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Wed, 2 Sep 2020 06:36:20 +0000 Subject: [PATCH 115/731] (packaging) Updating the puppet.pot file --- locales/puppet.pot | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/locales/puppet.pot b/locales/puppet.pot index 3f54bc387d4..fee28f84350 100644 --- a/locales/puppet.pot +++ b/locales/puppet.pot @@ -6,11 +6,11 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Puppet automation framework 6.18.0-173-ga4deba7894\n" +"Project-Id-Version: Puppet automation framework 6.18.0-180-g6829ff0ce6\n" "\n" "Report-Msgid-Bugs-To: https://tickets.puppetlabs.com\n" -"POT-Creation-Date: 2020-09-01 11:51+0000\n" -"PO-Revision-Date: 2020-09-01 11:51+0000\n" +"POT-Creation-Date: 2020-09-02 06:36+0000\n" +"PO-Revision-Date: 2020-09-02 06:36+0000\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -761,7 +761,7 @@ msgstr "" msgid "no matching resources found" msgstr "" -#: ../lib/puppet/face/config.rb:7 ../lib/puppet/face/epp.rb:8 ../lib/puppet/face/facts.rb:6 ../lib/puppet/face/generate.rb:7 ../lib/puppet/face/help.rb:9 ../lib/puppet/face/module.rb:9 ../lib/puppet/face/node.rb:4 ../lib/puppet/face/parser.rb:6 ../lib/puppet/face/plugin.rb:6 ../lib/puppet/face/report.rb:5 ../lib/puppet/face/resource.rb:5 ../lib/puppet/face/status.rb:5 +#: ../lib/puppet/face/config.rb:7 ../lib/puppet/face/epp.rb:8 ../lib/puppet/face/facts.rb:6 ../lib/puppet/face/generate.rb:7 ../lib/puppet/face/help.rb:9 ../lib/puppet/face/module.rb:9 ../lib/puppet/face/node.rb:4 ../lib/puppet/face/parser.rb:6 ../lib/puppet/face/plugin.rb:6 ../lib/puppet/face/report.rb:5 ../lib/puppet/face/resource.rb:5 msgid "Apache 2 license; see COPYING" msgstr "" @@ -1468,21 +1468,6 @@ msgstr "" msgid "The same resource object passed as an argument." msgstr "" -#: ../lib/puppet/face/status.rb:7 -msgid "View puppet server status." -msgstr "" - -#: ../lib/puppet/face/status.rb:15 -msgid "Check status of puppet master server." -msgstr "" - -#. TRANSLATORS the string 'Puppet::Status' is a Puppet language object and should not be translated -#: ../lib/puppet/face/status.rb:17 -msgid "" -" A \"true\" response or a low-level connection error. When used from the Ruby\n" -" API: returns a Puppet::Status object.\n" -msgstr "" - #: ../lib/puppet/feature/base.rb:19 msgid "Cannot determine basic system flavour" msgstr "" @@ -2364,7 +2349,7 @@ msgstr "" msgid "Unable to serialize catalog to json, retrying with pson" msgstr "" -#: ../lib/puppet/indirector/catalog/rest.rb:32 ../lib/puppet/indirector/facts/rest.rb:20 ../lib/puppet/indirector/file_content/rest.rb:29 ../lib/puppet/indirector/file_metadata/rest.rb:26 ../lib/puppet/indirector/node/rest.rb:23 ../lib/puppet/indirector/status/rest.rb:19 +#: ../lib/puppet/indirector/catalog/rest.rb:32 ../lib/puppet/indirector/facts/rest.rb:20 ../lib/puppet/indirector/file_content/rest.rb:29 ../lib/puppet/indirector/file_metadata/rest.rb:26 ../lib/puppet/indirector/node/rest.rb:23 msgid "Find %{uri} resulted in 404 with the message: %{body}" msgstr "" From 1bbfd9b2aaab423e7059a8be051ca021110e7fa3 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Wed, 2 Sep 2020 06:37:47 +0000 Subject: [PATCH 116/731] (packaging) Updating manpage file for main --- man/man8/puppet-status.8 | 108 --------------------------------------- 1 file changed, 108 deletions(-) delete mode 100644 man/man8/puppet-status.8 diff --git a/man/man8/puppet-status.8 b/man/man8/puppet-status.8 deleted file mode 100644 index f3a44947f52..00000000000 --- a/man/man8/puppet-status.8 +++ /dev/null @@ -1,108 +0,0 @@ -.\" generated with Ronn/v0.7.3 -.\" http://github.com/rtomayko/ronn/tree/0.7.3 -. -.TH "PUPPET\-STATUS" "8" "September 2020" "Puppet, Inc." "Puppet manual" -. -.SH "NAME" -\fBpuppet\-status\fR \- View puppet server status\. -. -.SH "SYNOPSIS" -puppet status \fIaction\fR [\-\-terminus _TERMINUS] [\-\-extra HASH] -. -.SH "OPTIONS" -Note that any setting that\'s valid in the configuration file is also a valid long argument, although it may or may not be relevant to the present action\. For example, \fBserver\fR and \fBrun_mode\fR are valid settings, so you can specify \fB\-\-server \fR, or \fB\-\-run_mode \fR as an argument\. -. -.P -See the configuration file documentation at \fIhttps://puppet\.com/docs/puppet/latest/configuration\.html\fR for the full list of acceptable parameters\. A commented list of all configuration options can also be generated by running puppet with \fB\-\-genconfig\fR\. -. -.TP -\-\-render\-as FORMAT -The format in which to render output\. The most common formats are \fBjson\fR, \fBs\fR (string), \fByaml\fR, and \fBconsole\fR, but other options such as \fBdot\fR are sometimes available\. -. -.TP -\-\-verbose -Whether to log verbosely\. -. -.TP -\-\-debug -Whether to log debug information\. -. -.TP -\-\-extra HASH -A terminus can take additional arguments to refine the operation, which are passed as an arbitrary hash to the back\-end\. Anything passed as the extra value is just send direct to the back\-end\. -. -.TP -\-\-terminus _TERMINUS -Indirector faces expose indirected subsystems of Puppet\. These subsystems are each able to retrieve and alter a specific type of data (with the familiar actions of \fBfind\fR, \fBsearch\fR, \fBsave\fR, and \fBdestroy\fR) from an arbitrary number of pluggable backends\. In Puppet parlance, these backends are called terminuses\. -. -.IP -Almost all indirected subsystems have a \fBrest\fR terminus that interacts with the puppet master\'s data\. Most of them have additional terminuses for various local data models, which are in turn used by the indirected subsystem on the puppet master whenever it receives a remote request\. -. -.IP -The terminus for an action is often determined by context, but occasionally needs to be set explicitly\. See the "Notes" section of this face\'s manpage for more details\. -. -.SH "ACTIONS" -. -.TP -\fBfind\fR \- Check status of puppet master server\. -\fBSYNOPSIS\fR -. -.IP -puppet status [\-\-terminus _TERMINUS] [\-\-extra HASH] [\fIkey\fR] -. -.IP -\fBDESCRIPTION\fR -. -.IP -Checks whether a Puppet server is properly receiving and processing HTTP requests\. This action is only useful when used with \'\-\-terminus rest\'; when invoked with the \fBlocal\fR terminus, \fBfind\fR will always return true\. -. -.IP -Over REST, this action will query the configured puppet master by default\. To query other servers, including puppet agent nodes started with the \fI\-\-listen\fR option, you can set the global \fI\-\-server\fR and \fI\-\-masterport\fR options on the command line; note that agent nodes listen on port 8139\. -. -.IP -\fBRETURNS\fR -. -.IP -A "true" response or a low\-level connection error\. When used from the Ruby API: returns a Puppet::Status object\. -. -.IP -\fBNOTES\fR -. -.IP -This action requires that the server\'s \fBauth\.conf\fR file allow find access to the \fBstatus\fR REST terminus\. Puppet agent does not use this facility, and it is turned off by default\. See \fIhttps://puppet\.com/docs/puppet/latest/config_file_auth\.html\fR for more details\. -. -.TP -\fBinfo\fR \- Print the default terminus class for this face\. -\fBSYNOPSIS\fR -. -.IP -puppet status info [\-\-terminus _TERMINUS] [\-\-extra HASH] -. -.IP -\fBDESCRIPTION\fR -. -.IP -Prints the default terminus class for this subcommand\. Note that different run modes may have different default termini; when in doubt, specify the run mode with the \'\-\-run_mode\' option\. -. -.SH "EXAMPLES" -\fBfind\fR -. -.P -Check the status of the configured puppet master: -. -.P -$ puppet status find \-\-terminus rest -. -.SH "NOTES" -This subcommand is an indirector face, which exposes \fBfind\fR, \fBsearch\fR, \fBsave\fR, and \fBdestroy\fR actions for an indirected subsystem of Puppet\. Valid termini for this face include: -. -.IP "\(bu" 4 -\fBlocal\fR -. -.IP "\(bu" 4 -\fBrest\fR -. -.IP "" 0 -. -.SH "COPYRIGHT AND LICENSE" -Copyright 2011 by Puppet Inc\. Apache 2 license; see COPYING From ecfe9d7c68283f58932537155b1eac22bba3f584 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Wed, 2 Sep 2020 10:52:23 +0000 Subject: [PATCH 117/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index 3054f6e7125..0a76677f7de 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -955,7 +955,7 @@ The bit length of keys\. Where puppet agent stores the last run report summary in yaml format\. . .IP "\(bu" 4 -\fIDefault\fR: $statedir/last_run_summary\.yaml +\fIDefault\fR: $publicdir/last_run_summary\.yaml . .IP "" 0 . @@ -1477,6 +1477,14 @@ Whether to enable experimental performance profiling . .IP "" 0 . +.SS "publicdir" +Where Puppet stores public files\. +. +.IP "\(bu" 4 +\fIDefault\fR: Unix/Linux: /opt/puppetlabs/puppet/public \-\- Windows: C:\eProgramData\ePuppetLabs\epuppet\epublic \-\- Non\-root user: ~/\.puppetlabs/opt/puppet/public +. +.IP "" 0 +. .SS "publickeydir" The public key directory\. . From 6bc616e4f7b6cfb279e1c23c1e4f7ba380eac22d Mon Sep 17 00:00:00 2001 From: Luchian Nemes Date: Thu, 3 Sep 2020 10:00:04 +0300 Subject: [PATCH 118/731] (maint) Skip 'last_run_summary_report.rb' test on Japanese Windows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `last_run_summary_report.rb` acceptance test needs to be skipped on Windows machines in Japanese due to malformed output. Error found: `Expected /None:\(R\)/ to match "...PC-NAME\\Ȃ:(R)\n..."` --- acceptance/tests/agent/last_run_summary_report.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/acceptance/tests/agent/last_run_summary_report.rb b/acceptance/tests/agent/last_run_summary_report.rb index c232a007583..9852fac71a9 100644 --- a/acceptance/tests/agent/last_run_summary_report.rb +++ b/acceptance/tests/agent/last_run_summary_report.rb @@ -5,6 +5,8 @@ extend Puppet::Acceptance::TempFileUtils agents.each do |agent| + skip_test('This test does not work on Windows in japanese') if agent['platform'] =~ /windows/ && agent['locale'] == 'ja' + custom_publicdir = agent.tmpdir('custom_public_dir') statedir = on(agent, puppet('config print statedir')).stdout.chomp From ff92285296aa50cf020557fcf93e6cf4c034eb9b Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Thu, 3 Sep 2020 23:45:20 -0700 Subject: [PATCH 119/731] (maint) Handle slow 2019 appveyor workers For tests where the foreground agent tries to acquire the lock and exits with failure, increase the timeout that the background thread waits for the foreground agent to start, as it might take awhile in appveyor. For the test where the background thread acquires the lock and waits for the foreground agent to fail to acquire the lock once, have the foreground agent signal the failure using the log destination. As soon as the failure occurs, the background thread will exit, enabling the foreground agent to acquire the lock and successfully apply the catalog. --- spec/integration/application/agent_spec.rb | 26 +++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/spec/integration/application/agent_spec.rb b/spec/integration/application/agent_spec.rb index 3f4acd0ed4b..cc6878e2d0e 100644 --- a/spec/integration/application/agent_spec.rb +++ b/spec/integration/application/agent_spec.rb @@ -413,7 +413,7 @@ path = Puppet[:agent_catalog_run_lockfile] th = Thread.new { - %x{ruby -e "$0 = 'puppet'; File.write('#{path}', Process.pid); sleep(2)"} + %x{ruby -e "$0 = 'puppet'; File.write('#{path}', Process.pid); sleep(20)"} } until File.exists?(path) && File.size(path) > 0 do @@ -430,12 +430,23 @@ it "waits for other agent run to finish before starting" do server.start_server do |port| + script = tmpfile('wait_for_log_entry') + logdest = tmpfile('agent_log') path = Puppet[:agent_catalog_run_lockfile] Puppet[:masterport] = port Puppet[:waitforlock] = 1 th = Thread.new { - %x{ruby -e "$0 = 'puppet'; File.write('#{path}', Process.pid); sleep(2)"} + File.write(script, <<~SCRIPT) + $0 = 'puppet' + # lock pidfile + File.write('#{path}', Process.pid) + # wait for foreground agent to fail once + until File.exists?("#{logdest}") && File.readlines("#{logdest}").grep(/Will try again/).any? do + sleep 0.1 + end + SCRIPT + %x{ruby '#{script}'} } until File.exists?(path) && File.size(path) > 0 do @@ -443,9 +454,14 @@ end expect { - agent.command_line.args << '--test' + agent.command_line.args << '--test' << '--logdest' << logdest << '--logdest' << 'console' agent.run - }.to exit_with(0).and output(/Info: Will try again in #{Puppet[:waitforlock]} seconds./).to_stdout + }.to exit_with(0) + .and output(a_string_matching( + /Info: Will try again in #{Puppet[:waitforlock]} seconds/ + ).and matching( + /Applied catalog/ + )).to_stdout th.kill # kill thread so we don't wait too much end @@ -457,7 +473,7 @@ Puppet[:maxwaitforlock] = 0 th = Thread.new { - %x{ruby -e "$0 = 'puppet'; File.write('#{path}', Process.pid); sleep(2)"} + %x{ruby -e "$0 = 'puppet'; File.write('#{path}', Process.pid); sleep(20)"} } until File.exists?(path) && File.size(path) > 0 do From e724b7debffe87cc7da2732e6845e444ebbccfdc Mon Sep 17 00:00:00 2001 From: Gabriel Nagy Date: Wed, 2 Sep 2020 17:20:21 +0300 Subject: [PATCH 120/731] (PUP-10509) Remove OpenSSL::PKey::EC monkey patches Remove the monkey patches on `EC#private_key?` and `EC.generate` which were added in 1d1c3f2cc, as we no longer support Ruby versions older than 2.5. --- lib/puppet/util/monkey_patches.rb | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/lib/puppet/util/monkey_patches.rb b/lib/puppet/util/monkey_patches.rb index fd89249f776..b03a5bbb0ae 100644 --- a/lib/puppet/util/monkey_patches.rb +++ b/lib/puppet/util/monkey_patches.rb @@ -103,25 +103,6 @@ def to_utf8 end end -unless Puppet::Util::Platform.jruby_fips? - unless OpenSSL::PKey::EC.instance_methods.include?(:private?) - class OpenSSL::PKey::EC - # Added in ruby 2.4.0 in https://github.com/ruby/ruby/commit/7c971e61f04 - alias :private? :private_key? - end - end - - unless OpenSSL::PKey::EC.singleton_methods.include?(:generate) - class OpenSSL::PKey::EC - # Added in ruby 2.4.0 in https://github.com/ruby/ruby/commit/85500b66342 - def self.generate(string) - ec = OpenSSL::PKey::EC.new(string) - ec.generate_key - end - end - end -end - # The Enumerable#uniq method was added in Ruby 2.4.0 (https://bugs.ruby-lang.org/issues/11090) # This is a backport to earlier Ruby versions. # From 7fe8e2211ce50468972b114cccc6b48311ad71e3 Mon Sep 17 00:00:00 2001 From: Gabriel Nagy Date: Wed, 2 Sep 2020 17:24:04 +0300 Subject: [PATCH 121/731] (PUP-10509) Remove Enumerable#uniq monkey patch Remove the backported `Enumerable#uniq` method as we no longer support Ruby versions older than 2.5, and the method was added in Ruby 2.4. --- lib/puppet/util/monkey_patches.rb | 27 --------------------------- spec/unit/util/monkey_patches_spec.rb | 6 ------ 2 files changed, 33 deletions(-) diff --git a/lib/puppet/util/monkey_patches.rb b/lib/puppet/util/monkey_patches.rb index b03a5bbb0ae..daa987e84fd 100644 --- a/lib/puppet/util/monkey_patches.rb +++ b/lib/puppet/util/monkey_patches.rb @@ -102,30 +102,3 @@ def to_utf8 end end end - -# The Enumerable#uniq method was added in Ruby 2.4.0 (https://bugs.ruby-lang.org/issues/11090) -# This is a backport to earlier Ruby versions. -# -unless Enumerable.instance_methods.include?(:uniq) - module Enumerable - def uniq - result = [] - uniq_map = {} - if block_given? - each do |value| - key = yield value - next if uniq_map.has_key?(key) - uniq_map[key] = true - result << value - end - else - each do |value| - next if uniq_map.has_key?(value) - uniq_map[value] = true - result << value - end - end - result - end - end -end diff --git a/spec/unit/util/monkey_patches_spec.rb b/spec/unit/util/monkey_patches_spec.rb index 6e3d98c9d54..497b8655e50 100644 --- a/spec/unit/util/monkey_patches_spec.rb +++ b/spec/unit/util/monkey_patches_spec.rb @@ -135,9 +135,3 @@ def with_root_certs(certs) expect(SecureRandom.uuid).to match(/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i) end end - -describe 'Enumerable' do - it 'expects uniq to work on an Enumerable' do - expect(['c', 'c', 'C'].reverse_each.uniq).to eql(['C', 'c']) - end -end From 1030c0136bccf81a374ca57d5e425409e0fb74df Mon Sep 17 00:00:00 2001 From: Gabriel Nagy Date: Wed, 2 Sep 2020 17:30:57 +0300 Subject: [PATCH 122/731] (PUP-10509) Remove UTF-8 conditional spec logic Tests related to UTF-8 string up/downcasing were skipped in 60c03d2 due to the functionality not being correctly handled by MRI versions prior to 2.4.0. Remove the constraint since we no longer support Ruby versions older than 2.5. --- spec/unit/functions/camelcase_spec.rb | 2 +- spec/unit/functions/capitalize_spec.rb | 2 +- spec/unit/functions/downcase_spec.rb | 2 +- spec/unit/functions/upcase_spec.rb | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/unit/functions/camelcase_spec.rb b/spec/unit/functions/camelcase_spec.rb index 87411031f5c..c2c2ca13406 100644 --- a/spec/unit/functions/camelcase_spec.rb +++ b/spec/unit/functions/camelcase_spec.rb @@ -15,7 +15,7 @@ expect(compile_to_catalog("notify { String(42.camelcase == 42): }")).to have_resource('Notify[true]') end - it 'performs capitalize of international UTF-8 characters', :if => RUBY_VERSION >= "2.4" do + it 'performs camelcase of international UTF-8 characters' do expect(compile_to_catalog("notify { 'åäö_äö'.camelcase: }")).to have_resource('Notify[ÅäöÄö]') end diff --git a/spec/unit/functions/capitalize_spec.rb b/spec/unit/functions/capitalize_spec.rb index fee12b0971e..c26db05f98a 100644 --- a/spec/unit/functions/capitalize_spec.rb +++ b/spec/unit/functions/capitalize_spec.rb @@ -15,7 +15,7 @@ expect(compile_to_catalog("notify { String(42.capitalize == 42): }")).to have_resource('Notify[true]') end - it 'performs capitalize of international UTF-8 characters', :if => RUBY_VERSION >= "2.4" do + it 'performs capitalize of international UTF-8 characters' do expect(compile_to_catalog("notify { 'åäö'.capitalize: }")).to have_resource('Notify[Åäö]') end diff --git a/spec/unit/functions/downcase_spec.rb b/spec/unit/functions/downcase_spec.rb index f7d53777f2c..4ffb8d40a29 100644 --- a/spec/unit/functions/downcase_spec.rb +++ b/spec/unit/functions/downcase_spec.rb @@ -15,7 +15,7 @@ expect(compile_to_catalog("notify { String(42.downcase == 42): }")).to have_resource('Notify[true]') end - it 'performs capitalize of international UTF-8 characters', :if => RUBY_VERSION >= "2.4" do + it 'performs downcase of international UTF-8 characters' do expect(compile_to_catalog("notify { 'ÅÄÖ'.downcase: }")).to have_resource('Notify[åäö]') end diff --git a/spec/unit/functions/upcase_spec.rb b/spec/unit/functions/upcase_spec.rb index 1d8ad80b809..d8e5e577fa2 100644 --- a/spec/unit/functions/upcase_spec.rb +++ b/spec/unit/functions/upcase_spec.rb @@ -15,7 +15,7 @@ expect(compile_to_catalog("notify { String(42.upcase == 42): }")).to have_resource('Notify[true]') end - it 'performs capitalize of international UTF-8 characters', :if => RUBY_VERSION >= "2.4" do + it 'performs upcase of international UTF-8 characters' do expect(compile_to_catalog("notify { 'åäö'.upcase: }")).to have_resource('Notify[ÅÄÖ]') end From 16456a9cccda48151c81bcdbe700eae3a8bf8302 Mon Sep 17 00:00:00 2001 From: Gabriel Nagy Date: Wed, 2 Sep 2020 17:36:49 +0300 Subject: [PATCH 123/731] (PUP-10509) Remove Net::HTTP#max_retries= check The `Net::HTTP#max_retries=` method was added in Ruby 2.5 which is now the oldest version we support. Remove the logic that guards around it, and update the spec to run regardless of Ruby version. --- lib/puppet/http/factory.rb | 6 ++---- spec/unit/http/factory_spec.rb | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/puppet/http/factory.rb b/lib/puppet/http/factory.rb index c5e5eecfac0..78d94c1d2d7 100644 --- a/lib/puppet/http/factory.rb +++ b/lib/puppet/http/factory.rb @@ -31,10 +31,8 @@ def create_connection(site) http.open_timeout = Puppet[:http_connect_timeout] http.keep_alive_timeout = KEEP_ALIVE_TIMEOUT if http.respond_to?(:keep_alive_timeout=) - if http.respond_to?(:max_retries) - # 0 means make one request and never retry - http.max_retries = 0 - end + # 0 means make one request and never retry + http.max_retries = 0 if Puppet[:sourceaddress] Puppet.debug("Using source IP #{Puppet[:sourceaddress]}") diff --git a/spec/unit/http/factory_spec.rb b/spec/unit/http/factory_spec.rb index ae27f9949ae..23ff552b2d7 100644 --- a/spec/unit/http/factory_spec.rb +++ b/spec/unit/http/factory_spec.rb @@ -118,7 +118,7 @@ def create_connection(site) expect(conn.keep_alive_timeout).to eq(2147483647) end - it "disables ruby's max retry on 2.5 and up", if: RUBY_VERSION.to_f >= 2.5 do + it "disables ruby's max retry" do conn = create_connection(site) expect(conn.max_retries).to eq(0) From e186752698fc9a000937f32d3dccc5ea6562dca0 Mon Sep 17 00:00:00 2001 From: Gabriel Nagy Date: Wed, 2 Sep 2020 18:25:47 +0300 Subject: [PATCH 124/731] (PUP-10509) Change File.expand_path related specs Before Ruby 2.5, `File.expand_path` always raised when attempting to expand a path containing `~` with `HOME` unset. This behavior changed in Ruby after 6b88dd26[1], so expanding still works even if `HOME` is unset in certain cases (e.g. if unsetting from irb). The error can still be triggered if `HOME` is unset prior to starting ruby, like `HOME= ruby -e'File.expand("~")'`. However, we don't have a way to replicate this in our unit tests, so just remove them. [1] https://github.com/ruby/ruby/commit/6b88dd2698760ef2e2306e3e79a0ed9fe159a12c --- spec/unit/util/run_mode_spec.rb | 130 -------------------------------- spec/unit/util_spec.rb | 18 ----- 2 files changed, 148 deletions(-) diff --git a/spec/unit/util/run_mode_spec.rb b/spec/unit/util/run_mode_spec.rb index 961980ee1b3..6abe9145a8f 100644 --- a/spec/unit/util/run_mode_spec.rb +++ b/spec/unit/util/run_mode_spec.rb @@ -1,12 +1,6 @@ require 'spec_helper' describe Puppet::Util::RunMode do - # Discriminator for tests that attempts to unset HOME since that, for reasons currently unknown, - # doesn't work in Ruby >= 2.4.0 - def self.gte_ruby_2_4 - @gte_ruby_2_4 ||= SemanticPuppet::Version.parse(RUBY_VERSION) >= SemanticPuppet::Version.parse('2.4.0') - end - before do @run_mode = Puppet::Util::RunMode.new('fake') end @@ -34,14 +28,6 @@ def self.gte_ruby_2_4 as_non_root { expect(@run_mode.conf_dir).to eq(File.expand_path('~/.puppetlabs/etc/puppet')) } end end - - it "fails when asking for the conf_dir as non-root and there is no $HOME", :unless => gte_ruby_2_4 || Puppet::Util::Platform.windows? do - as_non_root do - without_home do - expect { @run_mode.conf_dir }.to raise_error ArgumentError, /couldn't find HOME/ - end - end - end end describe "#code_dir" do @@ -62,14 +48,6 @@ def self.gte_ruby_2_4 as_non_root { expect(@run_mode.code_dir).to eq(File.expand_path('~/.puppetlabs/etc/code')) } end end - - it "fails when asking for the code_dir as non-root and there is no $HOME", :unless => gte_ruby_2_4 || Puppet::Util::Platform.windows? do - as_non_root do - without_home do - expect { @run_mode.code_dir }.to raise_error ArgumentError, /couldn't find HOME/ - end - end - end end describe "#var_dir" do @@ -80,14 +58,6 @@ def self.gte_ruby_2_4 it "has vardir ~/.puppetlabs/opt/puppet/cache when run as non-root" do as_non_root { expect(@run_mode.var_dir).to eq(File.expand_path('~/.puppetlabs/opt/puppet/cache')) } end - - it "fails when asking for the var_dir as non-root and there is no $HOME", :unless => gte_ruby_2_4 || Puppet::Util::Platform.windows? do - as_non_root do - without_home do - expect { @run_mode.var_dir }.to raise_error ArgumentError, /couldn't find HOME/ - end - end - end end describe "#public_dir" do @@ -98,14 +68,6 @@ def self.gte_ruby_2_4 it "has publicdir ~/.puppetlabs/opt/puppet/public when run as non-root" do as_non_root { expect(@run_mode.public_dir).to eq(File.expand_path('~/.puppetlabs/opt/puppet/public')) } end - - it "fails when asking for the public_dir as non-root and there is no $HOME", :unless => gte_ruby_2_4 || Puppet::Util::Platform.windows? do - as_non_root do - without_home do - expect { @run_mode.public_dir }.to raise_error ArgumentError, /couldn't find HOME/ - end - end - end end describe "#log_dir" do @@ -119,14 +81,6 @@ def self.gte_ruby_2_4 it "has default logdir ~/.puppetlabs/var/log" do as_non_root { expect(@run_mode.log_dir).to eq(File.expand_path('~/.puppetlabs/var/log')) } end - - it "fails when asking for the log_dir and there is no $HOME", :unless => gte_ruby_2_4 || Puppet::Util::Platform.windows? do - as_non_root do - without_home do - expect { @run_mode.log_dir }.to raise_error ArgumentError, /couldn't find HOME/ - end - end - end end end @@ -141,14 +95,6 @@ def self.gte_ruby_2_4 it "has default rundir ~/.puppetlabs/var/run" do as_non_root { expect(@run_mode.run_dir).to eq(File.expand_path('~/.puppetlabs/var/run')) } end - - it "fails when asking for the run_dir and there is no $HOME", :unless => gte_ruby_2_4 || Puppet::Util::Platform.windows? do - as_non_root do - without_home do - expect { @run_mode.run_dir }.to raise_error ArgumentError, /couldn't find HOME/ - end - end - end end end end @@ -176,18 +122,6 @@ def self.gte_ruby_2_4 it "has confdir in ~/.puppetlabs/etc/puppet when run as non-root" do as_non_root { expect(@run_mode.conf_dir).to eq(File.expand_path("~/.puppetlabs/etc/puppet")) } end - - it "fails when asking for the conf_dir as non-root and there is no %HOME%, %HOMEDRIVE%, and %USERPROFILE%", :unless => gte_ruby_2_4 do - as_non_root do - without_env('HOME') do - without_env('HOMEDRIVE') do - without_env('USERPROFILE') do - expect { @run_mode.conf_dir }.to raise_error ArgumentError, /couldn't find HOME/ - end - end - end - end - end end describe "#code_dir" do @@ -198,18 +132,6 @@ def self.gte_ruby_2_4 it "has codedir in ~/.puppetlabs/etc/code when run as non-root" do as_non_root { expect(@run_mode.code_dir).to eq(File.expand_path("~/.puppetlabs/etc/code")) } end - - it "fails when asking for the code_dir as non-root and there is no %HOME%, %HOMEDRIVE%, and %USERPROFILE%", :unless => gte_ruby_2_4 do - as_non_root do - without_env('HOME') do - without_env('HOMEDRIVE') do - without_env('USERPROFILE') do - expect { @run_mode.code_dir }.to raise_error ArgumentError, /couldn't find HOME/ - end - end - end - end - end end describe "#var_dir" do @@ -220,18 +142,6 @@ def self.gte_ruby_2_4 it "has vardir in ~/.puppetlabs/opt/puppet/cache when run as non-root" do as_non_root { expect(@run_mode.var_dir).to eq(File.expand_path("~/.puppetlabs/opt/puppet/cache")) } end - - it "fails when asking for the conf_dir as non-root and there is no %HOME%, %HOMEDRIVE%, and %USERPROFILE%", :unless => gte_ruby_2_4 do - as_non_root do - without_env('HOME') do - without_env('HOMEDRIVE') do - without_env('USERPROFILE') do - expect { @run_mode.var_dir }.to raise_error ArgumentError, /couldn't find HOME/ - end - end - end - end - end end describe "#public_dir" do @@ -242,18 +152,6 @@ def self.gte_ruby_2_4 it "has publicdir in ~/.puppetlabs/opt/puppet/public when run as non-root" do as_non_root { expect(@run_mode.public_dir).to eq(File.expand_path("~/.puppetlabs/opt/puppet/public")) } end - - it "fails when asking for the public_dir as non-root and there is no %HOME%, %HOMEDRIVE%, and %USERPROFILE%", :unless => gte_ruby_2_4 do - as_non_root do - without_env('HOME') do - without_env('HOMEDRIVE') do - without_env('USERPROFILE') do - expect { @run_mode.public_dir }.to raise_error ArgumentError, /couldn't find HOME/ - end - end - end - end - end end describe "#log_dir" do @@ -267,18 +165,6 @@ def self.gte_ruby_2_4 it "has default logdir ~/.puppetlabs/var/log" do as_non_root { expect(@run_mode.log_dir).to eq(File.expand_path('~/.puppetlabs/var/log')) } end - - it "fails when asking for the log_dir and there is no $HOME", :unless => gte_ruby_2_4 do - as_non_root do - without_env('HOME') do - without_env('HOMEDRIVE') do - without_env('USERPROFILE') do - expect { @run_mode.log_dir }.to raise_error ArgumentError, /couldn't find HOME/ - end - end - end - end - end end end @@ -293,18 +179,6 @@ def self.gte_ruby_2_4 it "has default rundir ~/.puppetlabs/var/run" do as_non_root { expect(@run_mode.run_dir).to eq(File.expand_path('~/.puppetlabs/var/run')) } end - - it "fails when asking for the run_dir and there is no $HOME", :unless => gte_ruby_2_4 do - as_non_root do - without_env('HOME') do - without_env('HOMEDRIVE') do - without_env('USERPROFILE') do - expect { @run_mode.run_dir }.to raise_error ArgumentError, /couldn't find HOME/ - end - end - end - end - end end end @@ -350,8 +224,4 @@ def without_env(name, &block) ensure Puppet::Util.set_env(name, saved) end - - def without_home(&block) - without_env('HOME', &block) - end end diff --git a/spec/unit/util_spec.rb b/spec/unit/util_spec.rb index 9d4aa7b4fc0..a40dfea165a 100644 --- a/spec/unit/util_spec.rb +++ b/spec/unit/util_spec.rb @@ -3,12 +3,6 @@ describe Puppet::Util do include PuppetSpec::Files - # Discriminator for tests that attempts to unset HOME since that, for reasons currently unknown, - # doesn't work in Ruby >= 2.4.0 - def self.gte_ruby_2_4 - @gte_ruby_2_4 ||= SemanticPuppet::Version.parse(RUBY_VERSION) >= SemanticPuppet::Version.parse('2.4.0') - end - if Puppet::Util::Platform.windows? def set_mode(mode, file) Puppet::Util::Windows::Security.set_mode(mode, file) @@ -669,18 +663,6 @@ def withenv_utf8(&block) expect(Puppet::Util.which('doesnotexist')).to be_nil end - it "should warn if the user's HOME is not set but their PATH contains a ~", :unless => gte_ruby_2_4 do - env_path = %w[~/bin /usr/bin /bin].join(File::PATH_SEPARATOR) - - env = {:HOME => nil, :PATH => env_path} - env.merge!({:HOMEDRIVE => nil, :USERPROFILE => nil}) if Puppet::Util::Platform.windows? - - expect(Puppet::Util::Warnings).to receive(:warnonce).once - Puppet::Util.withenv(env) do - Puppet::Util.which('foo') - end - end - it "should reject directories" do expect(Puppet::Util.which(base)).to be_nil end From 3039f6e89d23695db8886849fbfd0c142d067309 Mon Sep 17 00:00:00 2001 From: Gabriel Nagy Date: Thu, 3 Sep 2020 11:43:11 +0300 Subject: [PATCH 125/731] (PUP-10509) Remove Fixnum/Bignum references There were still some references to the old ruby Fixnum/Bignum classes. Remove them and change to Integer where applicable. --- .../no_exception_in_reduce_with_bignum.rb | 4 ++-- lib/puppet/pops/model/model_label_provider.rb | 2 -- lib/puppet/util/retry_action.rb | 2 +- lib/puppet/util/windows/eventlog.rb | 4 ++-- spec/unit/file_bucket/file_spec.rb | 2 +- spec/unit/pops/evaluator/evaluating_parser_spec.rb | 11 ++++------- spec/unit/pops/serialization/to_from_hr_spec.rb | 2 +- spec/unit/pops/types/type_calculator_spec.rb | 12 ++++++------ spec/unit/pops/types/type_factory_spec.rb | 2 +- spec/unit/pops/visitor_spec.rb | 2 +- spec/unit/settings/http_extra_headers_spec.rb | 6 ++---- spec/unit/type/file/ensure_spec.rb | 2 +- spec/unit/type/file/mode_spec.rb | 2 +- 13 files changed, 23 insertions(+), 30 deletions(-) diff --git a/acceptance/tests/parser_functions/no_exception_in_reduce_with_bignum.rb b/acceptance/tests/parser_functions/no_exception_in_reduce_with_bignum.rb index 600c07b3d09..cc7479b1df8 100644 --- a/acceptance/tests/parser_functions/no_exception_in_reduce_with_bignum.rb +++ b/acceptance/tests/parser_functions/no_exception_in_reduce_with_bignum.rb @@ -1,4 +1,4 @@ -test_name 'C97760: Bignum in reduce() should not cause exception' do +test_name 'C97760: Integer in reduce() should not cause exception' do require 'puppet/acceptance/environment_utils' extend Puppet::Acceptance::EnvironmentUtils @@ -8,7 +8,7 @@ app_type = File.basename(__FILE__, '.*') tmp_environment = mk_tmp_environment_with_teardown(master, app_type) - step 'On master, create site.pp with bignum' do + step 'On master, create site.pp with integer' do create_sitepp(master, tmp_environment, <<-SITEPP) $data = [ { diff --git a/lib/puppet/pops/model/model_label_provider.rb b/lib/puppet/pops/model/model_label_provider.rb index dbf91bfe2c1..7ba062a1c5e 100644 --- a/lib/puppet/pops/model/model_label_provider.rb +++ b/lib/puppet/pops/model/model_label_provider.rb @@ -85,8 +85,6 @@ def label_ResourceExpression o ; "Resource Statement" en def label_SelectorExpression o ; "Selector Expression" end def label_SelectorEntry o ; "Selector Option" end def label_Integer o ; "Integer" end - def label_Fixnum o ; "Integer" end - def label_Bignum o ; "Integer" end def label_Float o ; "Float" end def label_String o ; "String" end def label_Regexp o ; "Regexp" end diff --git a/lib/puppet/util/retry_action.rb b/lib/puppet/util/retry_action.rb index cf8593c77a8..7991914a397 100644 --- a/lib/puppet/util/retry_action.rb +++ b/lib/puppet/util/retry_action.rb @@ -7,7 +7,7 @@ class RetryException::RetriesExceeded < RetryException; end # Execute the supplied block retrying with exponential backoff. # # @param [Hash] options the retry options - # @option options [FixNum] :retries Maximum number of times to retry. + # @option options [Integer] :retries Maximum number of times to retry. # @option options [Array] :retry_exceptions ([StandardError]) Optional array of exceptions that are allowed to be retried. # @yield The block to be executed. def self.retry_action(options = {}) diff --git a/lib/puppet/util/windows/eventlog.rb b/lib/puppet/util/windows/eventlog.rb index 2ad2332a5a7..6617aa5a2df 100644 --- a/lib/puppet/util/windows/eventlog.rb +++ b/lib/puppet/util/windows/eventlog.rb @@ -46,8 +46,8 @@ def close end # Report an event to this instance's event log handle. Accepts a string to - # report (:data => ) and event type (:event_type => FixNum) and id - # (:event_id => FixNum) as returned by #to_native. The additional arguments to + # report (:data => ) and event type (:event_type => Integer) and id + # (:event_id => Integer) as returned by #to_native. The additional arguments to # ReportEventW seen in this method aren't exposed - though ReportEventW # technically can accept multiple strings as well as raw binary data to log, # we accept a single string from Puppet::Util::Log diff --git a/spec/unit/file_bucket/file_spec.rb b/spec/unit/file_bucket/file_spec.rb index 15a2534f4b3..9c87a116657 100644 --- a/spec/unit/file_bucket/file_spec.rb +++ b/spec/unit/file_bucket/file_spec.rb @@ -26,7 +26,7 @@ end it "should require contents to be a string" do - expect { Puppet::FileBucket::File.new(5) }.to raise_error(ArgumentError, /contents must be a String or Pathname, got a (?:Fixnum|Integer)$/) + expect { Puppet::FileBucket::File.new(5) }.to raise_error(ArgumentError, /contents must be a String or Pathname, got a Integer$/) end it "should complain about options other than :bucket_path" do diff --git a/spec/unit/pops/evaluator/evaluating_parser_spec.rb b/spec/unit/pops/evaluator/evaluating_parser_spec.rb index 38bd7c02ca7..aaaa46e1d35 100644 --- a/spec/unit/pops/evaluator/evaluating_parser_spec.rb +++ b/spec/unit/pops/evaluator/evaluating_parser_spec.rb @@ -818,14 +818,11 @@ end end - # Integer for >= 2.4.0, otherwise Fixnum - int_class_name = 0.class.name - # Errors when wrong number/type of keys are used { - "Array[0]" => "Array-Type[] arguments must be types. Got #{int_class_name}", - "Hash[0]" => "Hash-Type[] arguments must be types. Got #{int_class_name}", - "Hash[Integer, 0]" => "Hash-Type[] arguments must be types. Got #{int_class_name}", + "Array[0]" => "Array-Type[] arguments must be types. Got Integer", + "Hash[0]" => "Hash-Type[] arguments must be types. Got Integer", + "Hash[Integer, 0]" => "Hash-Type[] arguments must be types. Got Integer", "Array[Integer,1,2,3]" => 'Array-Type[] accepts 1 to 3 arguments. Got 4', "Array[Integer,String]" => "A Type's size constraint arguments must be a single Integer type, or 1-2 integers (or default). Got a String-Type", "Hash[Integer,String, 1,2,3]" => 'Hash-Type[] accepts 2 to 4 arguments. Got 5', @@ -833,7 +830,7 @@ "'abc'[1.0]" => "A substring operation does not accept a Float as a character index. Expected an Integer", "'abc'[1, x]" => "A substring operation does not accept a String as a character index. Expected an Integer", "'abc'[1,2,3]" => "String supports [] with one or two arguments. Got 3", - "NotUndef[0]" => "NotUndef-Type[] argument must be a Type or a String. Got #{int_class_name}", + "NotUndef[0]" => "NotUndef-Type[] argument must be a Type or a String. Got Integer", "NotUndef[a,b]" => 'NotUndef-Type[] accepts 0 to 1 arguments. Got 2', "Resource[0]" => 'First argument to Resource[] must be a resource type or a String. Got Integer', "Resource[a, 0]" => 'Error creating type specialization of a Resource-Type, Cannot use Integer where a resource title String is expected', diff --git a/spec/unit/pops/serialization/to_from_hr_spec.rb b/spec/unit/pops/serialization/to_from_hr_spec.rb index bd033db2735..1f803d39944 100644 --- a/spec/unit/pops/serialization/to_from_hr_spec.rb +++ b/spec/unit/pops/serialization/to_from_hr_spec.rb @@ -629,7 +629,7 @@ def _pcore_init_hash it 'the value of a type description is something other than a String or a Hash' do expect do from_converter.convert({ '__ptype' => { '__ptype' => 'Pcore::TimestampType', '__pvalue' => 12345 }}) - end.to raise_error(/Cannot create a Pcore::TimestampType from a (Fixnum|Integer)/) + end.to raise_error(/Cannot create a Pcore::TimestampType from a Integer/) end end end diff --git a/spec/unit/pops/types/type_calculator_spec.rb b/spec/unit/pops/types/type_calculator_spec.rb index 7bf743c4622..4e0cf3b21e7 100644 --- a/spec/unit/pops/types/type_calculator_spec.rb +++ b/spec/unit/pops/types/type_calculator_spec.rb @@ -141,11 +141,11 @@ def types context 'when inferring ruby' do - it 'fixnum translates to PIntegerType' do + it 'integer translates to PIntegerType' do expect(calculator.infer(1).class).to eq(PIntegerType) end - it 'large fixnum (or bignum depending on architecture) translates to PIntegerType' do + it 'large integer translates to PIntegerType' do expect(calculator.infer(2**33).class).to eq(PIntegerType) end @@ -329,7 +329,7 @@ def self._pcore_type expect(object_t('name' => 'DerivedObjectArray')).to be_instance(derived_object) end - it 'with fixnum values translates to PArrayType[PIntegerType]' do + it 'with integer values translates to PArrayType[PIntegerType]' do expect(calculator.infer([1,2]).element_type.class).to eq(PIntegerType) end @@ -407,7 +407,7 @@ def self._pcore_type expect(et.class).to eq(PEnumType) end - it 'with array of string values and array of fixnums translates to PArrayType[PArrayType[PScalarDataType]]' do + it 'with array of string values and array of integers translates to PArrayType[PArrayType[PScalarDataType]]' do et = calculator.infer([['first', 'array'], [1,2]]) expect(et.class).to eq(PArrayType) et = et.element_type @@ -425,7 +425,7 @@ def self._pcore_type expect(et.class).to eq(PEnumType) end - it 'with hash of string values and hash of fixnums translates to PArrayType[PHashType[PScalarDataType]]' do + it 'with hash of string values and hash of integers translates to PArrayType[PHashType[PScalarDataType]]' do et = calculator.infer([{:first => 'first', :second => 'second' }, {:first => 1, :second => 2 }]) expect(et.class).to eq(PArrayType) et = et.element_type @@ -489,7 +489,7 @@ def self._pcore_type expect(calculator.infer({'first' => 1, 'second' => 2}).key_type.class).to eq(PEnumType) end - it 'with fixnum values translates to PHashType[key, PIntegerType]' do + it 'with integer values translates to PHashType[key, PIntegerType]' do expect(calculator.infer({:first => 1, :second => 2}).value_type.class).to eq(PIntegerType) end diff --git a/spec/unit/pops/types/type_factory_spec.rb b/spec/unit/pops/types/type_factory_spec.rb index e3493f3924a..96e59b5f128 100644 --- a/spec/unit/pops/types/type_factory_spec.rb +++ b/spec/unit/pops/types/type_factory_spec.rb @@ -151,7 +151,7 @@ module Types expect(hc.class_name).to eq('x') end - it 'array_of(fixnum) returns PArrayType[PIntegerType]' do + it 'array_of(integer) returns PArrayType[PIntegerType]' do at = TypeFactory.array_of(1) expect(at.class()).to eq(PArrayType) expect(at.element_type.class).to eq(PIntegerType) diff --git a/spec/unit/pops/visitor_spec.rb b/spec/unit/pops/visitor_spec.rb index 1fd119ceadc..0ab0b0e7592 100644 --- a/spec/unit/pops/visitor_spec.rb +++ b/spec/unit/pops/visitor_spec.rb @@ -39,7 +39,7 @@ class Duck it "should select method for superclass" do duck_processor = DuckProcessor.new - expect(duck_processor.hi(42)).to match(/Howdy (?:Fixnum|Integer)/) + expect(duck_processor.hi(42)).to match(/Howdy Integer/) end it "should select method for superclass" do diff --git a/spec/unit/settings/http_extra_headers_spec.rb b/spec/unit/settings/http_extra_headers_spec.rb index c8e5f34be28..66f78ee5ab9 100644 --- a/spec/unit/settings/http_extra_headers_spec.rb +++ b/spec/unit/settings/http_extra_headers_spec.rb @@ -46,18 +46,16 @@ end describe 'raises an error when' do - - # Ruby 2.3 reports the class of these objects as Fixnum, whereas later ruby versions report them as Integer it 'is given an unexpected object type' do expect { subject.munge(65) - }.to raise_error(ArgumentError, /^Expected an Array, String, or Hash, got a (Integer|Fixnum)/) + }.to raise_error(ArgumentError, /^Expected an Array, String, or Hash, got a Integer/) end it 'is given an array of unexpected object types' do expect { subject.munge([65, 82]) - }.to raise_error(ArgumentError, /^Expected an Array or String, got a (Integer|Fixnum)/) + }.to raise_error(ArgumentError, /^Expected an Array or String, got a Integer/) end end end diff --git a/spec/unit/type/file/ensure_spec.rb b/spec/unit/type/file/ensure_spec.rb index 842bd48bcc1..5f476c073c9 100644 --- a/spec/unit/type/file/ensure_spec.rb +++ b/spec/unit/type/file/ensure_spec.rb @@ -85,7 +85,7 @@ }.to raise_error(Puppet::Error, /Cannot create #{newpath}; parent directory #{File.dirname(newpath)} does not exist/) end - it "should accept octal mode as fixnum" do + it "should accept octal mode as integer" do resource[:mode] = '0700' expect(resource).to receive(:property_fix) expect(Dir).to receive(:mkdir).with(path, 0700) diff --git a/spec/unit/type/file/mode_spec.rb b/spec/unit/type/file/mode_spec.rb index a5be380d69e..8c9b5dbef91 100644 --- a/spec/unit/type/file/mode_spec.rb +++ b/spec/unit/type/file/mode_spec.rb @@ -11,7 +11,7 @@ it "should reject non-string values" do expect { mode.value = 0755 - }.to raise_error(Puppet::Error, /The file mode specification must be a string, not '(?:Fixnum|Integer)'/) + }.to raise_error(Puppet::Error, /The file mode specification must be a string, not 'Integer'/) end it "should accept values specified as octal numbers in strings" do From f9ce3532c74fa75878ea8e250d22ec9ec0942981 Mon Sep 17 00:00:00 2001 From: Gabriel Nagy Date: Thu, 3 Sep 2020 16:16:43 +0300 Subject: [PATCH 126/731] (PUP-10583) Change default digest_algorithm to SHA256 Puppet's `digest_algorithm` setting defaults to `md5`, which is outdated. This commit switches it to to `sha256`. Update spec tests accordingly. --- lib/puppet/defaults.rb | 2 +- spec/integration/application/agent_spec.rb | 2 +- spec/integration/application/apply_spec.rb | 2 +- .../application/filebucket_spec.rb | 32 +++++++++---------- spec/integration/type/file_spec.rb | 9 +++--- spec/unit/defaults_spec.rb | 4 +-- spec/unit/http/service/file_server_spec.rb | 6 ++-- .../indirector/file_bucket_file/file_spec.rb | 8 +++-- .../unit/transaction/resource_harness_spec.rb | 4 +-- spec/unit/type/file/checksum_spec.rb | 12 +++---- spec/unit/type/file_spec.rb | 5 +-- 11 files changed, 45 insertions(+), 41 deletions(-) diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb index 8ba34df1340..beeb9ed2ec6 100644 --- a/lib/puppet/defaults.rb +++ b/lib/puppet/defaults.rb @@ -11,7 +11,7 @@ def self.default_diffargs end def self.default_digest_algorithm - Puppet::Util::Platform.fips_enabled? ? 'sha256' : 'md5' + 'sha256' end def self.valid_digest_algorithms diff --git a/spec/integration/application/agent_spec.rb b/spec/integration/application/agent_spec.rb index cc6878e2d0e..5a7d8b0336d 100644 --- a/spec/integration/application/agent_spec.rb +++ b/spec/integration/application/agent_spec.rb @@ -245,7 +245,7 @@ agent.command_line.args << '--test' agent.run }.to exit_with(2) - .and output(/content changed '{md5}d41d8cd98f00b204e9800998ecf8427e' to '{md5}4cf49285ae567157ebfba72bd04ccf32'/).to_stdout + .and output(/content changed '{sha256}e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855' to '{sha256}3bef83ad320b471d8e3a03c9b9f150749eea610fe266560395d3195cfbd8e6b8'/).to_stdout # verify puppet restored binary content expect(File.binread(path)).to eq(binary_content) diff --git a/spec/integration/application/apply_spec.rb b/spec/integration/application/apply_spec.rb index 574caf51a24..ff32e32f9ed 100644 --- a/spec/integration/application/apply_spec.rb +++ b/spec/integration/application/apply_spec.rb @@ -532,7 +532,7 @@ def bogus() ).and matching( /dir1\/dir2\]\/ensure: created/ ).and matching( - /dir1\/dir2\/file\]\/ensure: defined content as '{md5}51f37efb13c3a1e486106f90db6490a5'/ + /dir1\/dir2\/file\]\/ensure: defined content as '{sha256}b37c1d77e09471b3139b2cdfee449fd8ba72ebf7634d52023aff0c0cd088cf1b'/ )).to_stdout dest_file = File.join(base_dir, 'dir1', 'dir2', 'file') diff --git a/spec/integration/application/filebucket_spec.rb b/spec/integration/application/filebucket_spec.rb index c533fcf6dd7..3e93c2a130f 100644 --- a/spec/integration/application/filebucket_spec.rb +++ b/spec/integration/application/filebucket_spec.rb @@ -11,7 +11,7 @@ let(:filebucket) { Puppet::Application[:filebucket] } let(:backup_file) { tmpfile('backup_file') } let(:text) { 'some random text' } - let(:md5) { Digest::MD5.file(backup_file).to_s } + let(:sha256) { Digest::SHA256.file(backup_file).to_s } before :each do Puppet[:log_level] = 'debug' @@ -22,13 +22,13 @@ filebucket.command_line.args = ['backup', backup_file, '--local'] expect { filebucket.run - }.to output(/: #{md5}/).to_stdout + }.to output(/: #{sha256}/).to_stdout dest = tmpfile('file_bucket_restore') - filebucket.command_line.args = ['restore', dest, md5, '--local'] + filebucket.command_line.args = ['restore', dest, sha256, '--local'] expect { filebucket.run - }.to output(/FileBucket read #{md5}/).to_stdout + }.to output(/FileBucket read #{sha256}/).to_stdout expect(FileUtils.compare_file(backup_file, dest)).to eq(true) end @@ -40,11 +40,11 @@ filebucket.command_line.args = ['backup', backup_file] filebucket.run }.to output(a_string_matching( - %r{Debug: HTTP HEAD https:\/\/127.0.0.1:#{port}\/puppet\/v3\/file_bucket_file\/md5\/#{md5}\/#{File.realpath(backup_file)}\?environment\=production returned 404 Not Found} + %r{Debug: HTTP HEAD https:\/\/127.0.0.1:#{port}\/puppet\/v3\/file_bucket_file\/sha256\/#{sha256}\/#{File.realpath(backup_file)}\?environment\=production returned 404 Not Found} ).and matching( - %r{Debug: HTTP PUT https:\/\/127.0.0.1:#{port}\/puppet\/v3\/file_bucket_file\/md5\/#{md5}\/#{File.realpath(backup_file)}\?environment\=production returned 200 OK} + %r{Debug: HTTP PUT https:\/\/127.0.0.1:#{port}\/puppet\/v3\/file_bucket_file\/sha256\/#{sha256}\/#{File.realpath(backup_file)}\?environment\=production returned 200 OK} ).and matching( - %r{#{backup_file}: #{md5}} + %r{#{backup_file}: #{sha256}} )).to_stdout expect(File.binread(File.join(server.upload_directory, 'filebucket'))).to eq(text) @@ -61,9 +61,9 @@ filebucket.command_line.args = ['backup', backup_file] filebucket.run }.to output(a_string_matching( - %r{Debug: HTTP HEAD https:\/\/127.0.0.1:#{port}\/puppet\/v3\/file_bucket_file/md5/b10778ecd8b08dff525e367cf15b2622/} + %r{Debug: HTTP HEAD https:\/\/127.0.0.1:#{port}\/puppet\/v3\/file_bucket_file/sha256/f3aee54d781e413862eb068d89661f930385cc81bbafffc68477ff82eb9bea43/} ).and matching( - %r{Debug: HTTP PUT https:\/\/127.0.0.1:#{port}\/puppet\/v3\/file_bucket_file/md5/b10778ecd8b08dff525e367cf15b2622/} + %r{Debug: HTTP PUT https:\/\/127.0.0.1:#{port}\/puppet\/v3\/file_bucket_file/sha256/f3aee54d781e413862eb068d89661f930385cc81bbafffc68477ff82eb9bea43/} )).to_stdout expect(File.binread(File.join(server.upload_directory, 'filebucket'))).to eq(binary) @@ -80,9 +80,9 @@ filebucket.command_line.args = ['backup', backup_file] filebucket.run }.to output(a_string_matching( - %r{Debug: HTTP HEAD https:\/\/127.0.0.1:#{port}\/puppet\/v3\/file_bucket_file/md5/48856faf4534a876adeadc72aec53cb2/} + %r{Debug: HTTP HEAD https:\/\/127.0.0.1:#{port}\/puppet\/v3\/file_bucket_file/sha256/51643361c79ecaef25a8de802de24f570ba25d9c2df1d22d94fade11b4f466cc/} ).and matching( - %r{Debug: HTTP PUT https:\/\/127.0.0.1:#{port}\/puppet\/v3\/file_bucket_file/md5/48856faf4534a876adeadc72aec53cb2/} + %r{Debug: HTTP PUT https:\/\/127.0.0.1:#{port}\/puppet\/v3\/file_bucket_file/sha256/51643361c79ecaef25a8de802de24f570ba25d9c2df1d22d94fade11b4f466cc/} )).to_stdout expect(File.read(File.join(server.upload_directory, 'filebucket'), encoding: 'utf-8')).to eq(utf8) @@ -100,9 +100,9 @@ filebucket.command_line.args = ['backup', backup_file] filebucket.run }.to output(a_string_matching( - %r{Debug: HTTP HEAD https:\/\/127.0.0.1:#{port}\/puppet\/v3\/file_bucket_file\/md5\/#{md5}\/#{File.realpath(backup_file)}\?environment\=production returned 200 OK} + %r{Debug: HTTP HEAD https:\/\/127.0.0.1:#{port}\/puppet\/v3\/file_bucket_file\/sha256\/#{sha256}\/#{File.realpath(backup_file)}\?environment\=production returned 200 OK} ).and matching( - %r{#{backup_file}: #{md5}} + %r{#{backup_file}: #{sha256}} )).to_stdout end end @@ -119,7 +119,7 @@ filebucket.command_line.args = ['get', 'fac251367c9e083c6b1f0f3181'] filebucket.run }.to output(a_string_matching( - %r{Debug: HTTP GET https:\/\/127.0.0.1:#{port}\/puppet\/v3\/file_bucket_file\/md5\/fac251367c9e083c6b1f0f3181\?environment\=production returned 200 OK} + %r{Debug: HTTP GET https:\/\/127.0.0.1:#{port}\/puppet\/v3\/file_bucket_file\/sha256\/fac251367c9e083c6b1f0f3181\?environment\=production returned 200 OK} ).and matching( %r{something to store} )).to_stdout @@ -191,8 +191,8 @@ File.binwrite(f, "bar\nbaz") f } - let(:checksuma) { Digest::MD5.file(filea).to_s } - let(:checksumb) { Digest::MD5.file(fileb).to_s } + let(:checksuma) { Digest::SHA256.file(filea).to_s } + let(:checksumb) { Digest::SHA256.file(fileb).to_s } it 'compares to files stored in a local bucket' do expect { diff --git a/spec/integration/type/file_spec.rb b/spec/integration/type/file_spec.rb index a67d88bafa9..34f3b1e91a1 100644 --- a/spec/integration/type/file_spec.rb +++ b/spec/integration/type/file_spec.rb @@ -1,3 +1,4 @@ +# coding: utf-8 require 'spec_helper' require 'puppet_spec/files' @@ -657,9 +658,9 @@ def get_aces_for_path_by_sid(path, sid) CHECKSUM_TYPES_TO_TRY.each do |checksum_type, checksum| describe "when checksum_type is #{checksum_type}" do - # FileBucket uses the globally configured default for lookup by digest, which right now is MD5. + # FileBucket uses the globally configured default for lookup by digest, which right now is SHA256. it_should_behave_like "files are backed up", {:checksum => checksum_type} do - let(:filebucket_digest) { Proc.new {|x| Puppet::Util::Checksums.md5(x)} } + let(:filebucket_digest) { Proc.new {|x| Puppet::Util::Checksums.sha256(x)} } end end end @@ -1727,7 +1728,7 @@ def grant_everyone_full_access(path) #{test_cmd} "644" == "$(#{stat_cmd} ^)" })) report = catalog.apply.report - expect(report.resource_statuses["File[#{path}]"].events.first.message).to match(/defined content as '{md5}/) + expect(report.resource_statuses["File[#{path}]"].events.first.message).to match(/defined content as '{sha256}/) expect(report.resource_statuses["File[#{path}]"]).not_to be_failed expect(Puppet::FileSystem.exist?(path)).to be_truthy end @@ -1741,7 +1742,7 @@ def grant_everyone_full_access(path) #{test_cmd} "555" == "$(#{stat_cmd} ^)" })) report = catalog.apply.report - expect(report.resource_statuses["File[#{path}]"].events.first.message).to match(/defined content as '{md5}/) + expect(report.resource_statuses["File[#{path}]"].events.first.message).to match(/defined content as '{sha256}/) expect(report.resource_statuses["File[#{path}]"]).not_to be_failed expect(Puppet::FileSystem.exist?(path)).to be_truthy end diff --git a/spec/unit/defaults_spec.rb b/spec/unit/defaults_spec.rb index 24ece3177a9..aa5fc98a13d 100644 --- a/spec/unit/defaults_spec.rb +++ b/spec/unit/defaults_spec.rb @@ -65,9 +65,9 @@ end describe '.default_digest_algorithm' do - it 'defaults to md5 when FIPS is not enabled' do + it 'defaults to sha256 when FIPS is not enabled' do allow(Puppet::Util::Platform).to receive(:fips_enabled?).and_return(false) - expect(Puppet.default_digest_algorithm).to eq('md5') + expect(Puppet.default_digest_algorithm).to eq('sha256') end it 'defaults to sha256 when FIPS is enabled' do diff --git a/spec/unit/http/service/file_server_spec.rb b/spec/unit/http/service/file_server_spec.rb index 3e763219fac..9b87ce6688b 100644 --- a/spec/unit/http/service/file_server_spec.rb +++ b/spec/unit/http/service/file_server_spec.rb @@ -41,7 +41,7 @@ context 'retrieving file metadata' do let(:path) { tmpfile('get_file_metadata') } - let(:url) { "https://www.example.com/puppet/v3/file_metadata/:mount/#{path}?checksum_type=md5&environment=testing&links=manage&source_permissions=ignore" } + let(:url) { "https://www.example.com/puppet/v3/file_metadata/:mount/#{path}?checksum_type=sha256&environment=testing&links=manage&source_permissions=ignore" } let(:filemetadata) { Puppet::FileServing::Metadata.new(path) } let(:request_path) { "/:mount/#{path}"} @@ -122,7 +122,7 @@ context 'retrieving multiple file metadatas' do let(:path) { tmpfile('get_file_metadatas') } - let(:url) { "https://www.example.com/puppet/v3/file_metadatas/:mount/#{path}?checksum_type=md5&links=manage&recurse=false&source_permissions=ignore&environment=testing" } + let(:url) { "https://www.example.com/puppet/v3/file_metadatas/:mount/#{path}?checksum_type=sha256&links=manage&recurse=false&source_permissions=ignore&environment=testing" } let(:filemetadatas) { [Puppet::FileServing::Metadata.new(path)] } let(:formatter) { Puppet::Network::FormatHandler.format(:json) } let(:request_path) { "/:mount/#{path}"} @@ -158,7 +158,7 @@ end it 'automatically converts an array of parameters to the stringified query' do - url = "https://www.example.com/puppet/v3/file_metadatas/:mount/#{path}?checksum_type=md5&environment=testing&ignore=CVS&ignore=.git&ignore=.hg&links=manage&recurse=false&source_permissions=ignore" + url = "https://www.example.com/puppet/v3/file_metadatas/:mount/#{path}?checksum_type=sha256&environment=testing&ignore=CVS&ignore=.git&ignore=.hg&links=manage&recurse=false&source_permissions=ignore" stub_request(:get, url).with( headers: {'Accept'=>'application/json, application/x-msgpack, text/pson',} ).to_return( diff --git a/spec/unit/indirector/file_bucket_file/file_spec.rb b/spec/unit/indirector/file_bucket_file/file_spec.rb index 4dac6a903ae..c99331cdd1b 100644 --- a/spec/unit/indirector/file_bucket_file/file_spec.rb +++ b/spec/unit/indirector/file_bucket_file/file_spec.rb @@ -18,7 +18,7 @@ def save_bucket_file(contents, path = "/who_cares") describe "when servicing a save request" do it "should return a result whose content is empty" do bucket_file = Puppet::FileBucket::File.new('stuff') - result = Puppet::FileBucket::File.indirection.save(bucket_file, "md5/c13d88cb4cb02003daedb8a84e5d272a") + result = Puppet::FileBucket::File.indirection.save(bucket_file, "sha256/35bafb1ce99aef3ab068afbaabae8f21fd9b9f02d3a9442e364fa92c0b3eeef0") expect(result.contents).to be_empty end @@ -34,12 +34,14 @@ def save_bucket_file(contents, path = "/who_cares") end children.each { |child| Process.wait(child) } - paths = File.read("#{Puppet[:bucketdir]}/9/8/b/f/7/d/8/c/98bf7d8c15784f0a3d63204441e1e2aa/paths").lines.to_a + paths = File.read("#{Puppet[:bucketdir]}/d/1/b/2/a/5/9/f/d1b2a59fbea7e20077af9f91b27e95e865061b270be03ff539ab3b73587882e8/paths").lines.to_a expect(paths.length).to eq(1) expect(Puppet::FileBucket::File.indirection.head("#{bucket_file.checksum_type}/#{bucket_file.checksum_data}/testing")).to be_truthy end it "fails if the contents collide with existing contents" do + Puppet[:digest_algorithm] = 'md5' + # This is the shortest known MD5 collision (little endian). See https://eprint.iacr.org/2010/643.pdf first_contents = [0x6165300e,0x87a79a55,0xf7c60bd0,0x34febd0b, 0x6503cf04,0x854f709e,0xfb0fc034,0x874c9c65, @@ -66,7 +68,7 @@ def save_bucket_file(contents, path = "/who_cares") context "when the contents file exists but is corrupted and does not match the expected checksum" do let(:original_contents) { "a file that will get corrupted" } let(:bucket_file) { Puppet::FileBucket::File.new(original_contents) } - let(:contents_file) { "#{Puppet[:bucketdir]}/8/e/6/4/f/8/5/d/8e64f85dd54a412f65edabcafe44d491/contents" } + let(:contents_file) { "#{Puppet[:bucketdir]}/7/7/4/1/0/2/7/9/77410279bb789b799c2f38bf654b46a509dd27ddad6e47a6684805e9ba390bce/contents" } before(:each) do # Ensure we're starting with a clean slate - no pre-existing backup diff --git a/spec/unit/transaction/resource_harness_spec.rb b/spec/unit/transaction/resource_harness_spec.rb index 59fac6b5fa2..ae35044a3fd 100644 --- a/spec/unit/transaction/resource_harness_spec.rb +++ b/spec/unit/transaction/resource_harness_spec.rb @@ -612,14 +612,14 @@ def self.name allow_any_instance_of(Puppet::Transaction::Event).to receive(:corrective_change).and_return(true) status = @harness.evaluate(resource) sync_event = status.events[0] - expect(sync_event.message).to match(/content changed '{md5}[0-9a-f]+' to '{md5}[0-9a-f]+' \(corrective\)/) + expect(sync_event.message).to match(/content changed '{sha256}[0-9a-f]+' to '{sha256}[0-9a-f]+' \(corrective\)/) end it "contains no modifier when intentional change" do allow_any_instance_of(Puppet::Transaction::Event).to receive(:corrective_change).and_return(false) status = @harness.evaluate(resource) sync_event = status.events[0] - expect(sync_event.message).to match(/content changed '{md5}[0-9a-f]+' to '{md5}[0-9a-f]+'$/) + expect(sync_event.message).to match(/content changed '{sha256}[0-9a-f]+' to '{sha256}[0-9a-f]+'$/) end end end diff --git a/spec/unit/type/file/checksum_spec.rb b/spec/unit/type/file/checksum_spec.rb index 7553c69fff8..142876dfe1d 100644 --- a/spec/unit/type/file/checksum_spec.rb +++ b/spec/unit/type/file/checksum_spec.rb @@ -18,8 +18,8 @@ @checksum.sum("foobar") end - it "should use :md5 to sum when no value is set" do - expect(@checksum).to receive(:md5).with("foobar").and_return("yay") + it "should use :sha256 to sum when no value is set" do + expect(@checksum).to receive(:sha256).with("foobar").and_return("yay") @checksum.sum("foobar") end @@ -47,8 +47,8 @@ expect(@checksum.sum("foobar")).to eq("{sha384}#{sum}") end - it "should use :md5 as its default type" do - expect(@checksum.default).to eq(:md5) + it "should use :sha256 as its default type" do + expect(@checksum.default).to eq(:sha256) end it "should use its current value when asked to sum a file's content" do @@ -57,8 +57,8 @@ @checksum.sum_file(@path) end - it "should use :md5 to sum a file when no value is set" do - expect(@checksum).to receive(:md5_file).with(@path).and_return("yay") + it "should use :sha256 to sum a file when no value is set" do + expect(@checksum).to receive(:sha256_file).with(@path).and_return("yay") @checksum.sum_file(@path) end diff --git a/spec/unit/type/file_spec.rb b/spec/unit/type/file_spec.rb index d3914c3db73..31573b85c8b 100644 --- a/spec/unit/type/file_spec.rb +++ b/spec/unit/type/file_spec.rb @@ -1,3 +1,4 @@ +# coding: utf-8 require 'spec_helper' describe Puppet::Type.type(:file) do @@ -778,7 +779,7 @@ it "should set the checksum parameter based on the metadata" do allow(file).to receive(:perform_recursion).and_return([@first]) allow(@resource).to receive(:[]=) - expect(@resource).to receive(:[]=).with(:checksum, "md5") + expect(@resource).to receive(:[]=).with(:checksum, "sha256") file.recurse_remote("first" => @resource) end @@ -814,7 +815,7 @@ allow(file).to receive(:perform_recursion).and_return([@first]) allow(file).to receive(:[]=) - expect(file). to receive(:[]=).with(:checksum, "md5") + expect(file). to receive(:[]=).with(:checksum, "sha256") file.recurse_remote("first" => @resource) end From 19c2db6dba05051589cd3f5f25843714aa171a6c Mon Sep 17 00:00:00 2001 From: gimmy Date: Fri, 4 Sep 2020 13:50:26 +0300 Subject: [PATCH 127/731] (PUP-10386) remove docs on indirector-based status --- api/docs/http_status.md | 40 ---------------------------------------- api/schemas/status.json | 18 ------------------ conf/auth.conf | 4 ---- 3 files changed, 62 deletions(-) delete mode 100644 api/docs/http_status.md delete mode 100644 api/schemas/status.json diff --git a/api/docs/http_status.md b/api/docs/http_status.md deleted file mode 100644 index 0c656ae4940..00000000000 --- a/api/docs/http_status.md +++ /dev/null @@ -1,40 +0,0 @@ -Status -============= - -The `status` endpoint provides information about a running master. - -Find ----- - -Get status for a master - - GET /puppet/v3/status/:name?environment=:environment - -The `environment` parameter and the `:name` are both required, but have no -effect on the response. The `environment` must be a valid environment. - -### Supported HTTP Methods - -GET - -### Supported Response Formats - -`application/json`, `text/pson` - -### Parameters - -None - -### Example Response - - GET /puppet/v3/status/whatever?environment=env - - HTTP 200 OK - Content-Type: application/json - - {"is_alive":true,"version":"3.3.2"} - -Schema ------- - -A status response body conforms to [the status schema.](../schemas/status.json) diff --git a/api/schemas/status.json b/api/schemas/status.json deleted file mode 100644 index f3fa8abe526..00000000000 --- a/api/schemas/status.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "Master status", - "description": "Information about a running master", - "type": "object", - "properties": { - "is_alive": { - "description": "This will always be true since the master must be running to retrieve the object", - "type": "boolean" - }, - "version": { - "description": "The version of the master", - "type": "string" - } - }, - "required": ["is_alive", "version"], - "additionalProperties": false -} diff --git a/conf/auth.conf b/conf/auth.conf index 9629d3e78f2..3d51383b5fe 100644 --- a/conf/auth.conf +++ b/conf/auth.conf @@ -113,10 +113,6 @@ allow $1 path /puppet/v3/file allow * -path /puppet/v3/status -method find -allow * - # allow all nodes to access the certificates services path /puppet-ca/v1/certificate_revocation_list/ca method find From 2475694c15ad9f1362494cea52cac165f0573fd3 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Tue, 8 Sep 2020 16:55:14 -0700 Subject: [PATCH 128/731] Revert "Merge pull request #8305 from ciprianbadescu/PUP-10598/ignore_plugin_errors" This reverts commit 2ec586ee80466f04273a8d4972387a5cdeaead7d, reversing changes made to 8427686c0fd6c0f994e202a378263a0d5f565e96. --- lib/puppet/defaults.rb | 2 +- spec/unit/configurer/downloader_spec.rb | 8 ++------ spec/unit/configurer_spec.rb | 4 ---- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb index 8ba34df1340..0ffd8df0a00 100644 --- a/lib/puppet/defaults.rb +++ b/lib/puppet/defaults.rb @@ -1893,7 +1893,7 @@ def self.initialize_default_settings!(settings) :desc => "What files to ignore when pulling down plugins.", }, :ignore_plugin_errors => { - :default => false, + :default => true, :type => :boolean, :desc => "Whether the puppet run should ignore errors during pluginsync. If the setting is false and there are errors during pluginsync, then the agent will abort the run and diff --git a/spec/unit/configurer/downloader_spec.rb b/spec/unit/configurer/downloader_spec.rb index cdc2413d816..bcbda27e3cd 100644 --- a/spec/unit/configurer/downloader_spec.rb +++ b/spec/unit/configurer/downloader_spec.rb @@ -189,8 +189,6 @@ def generate_file_resource(options = {}) end it "should return all changed file paths" do - Puppet[:ignore_plugin_errors] = true - trans = double('transaction') catalog = double('catalog') @@ -206,8 +204,6 @@ def generate_file_resource(options = {}) end it "should yield the resources if a block is given" do - Puppet[:ignore_plugin_errors] = true - trans = double('transaction') catalog = double('catalog') @@ -225,8 +221,6 @@ def generate_file_resource(options = {}) end it "should catch and log exceptions" do - Puppet[:ignore_plugin_errors] = true - expect(Puppet).to receive(:log_exception) # The downloader creates a new catalog for each apply, and really the only object # that it is possible to stub for the purpose of generating a puppet error @@ -236,6 +230,8 @@ def generate_file_resource(options = {}) end it "raises an exception if catalog application fails" do + Puppet[:ignore_plugin_errors] = false + expect(@dler.file).to receive(:retrieve).and_raise(Puppet::Error, "testing") expect { diff --git a/spec/unit/configurer_spec.rb b/spec/unit/configurer_spec.rb index e3e716c4cd7..81fa9281a2c 100644 --- a/spec/unit/configurer_spec.rb +++ b/spec/unit/configurer_spec.rb @@ -639,8 +639,6 @@ def expects_neither_new_or_cached_catalog end it "should pluginsync and compile a new catalog if none is found in the cache" do - Puppet[:ignore_plugin_errors] = true - expects_fallback_to_new_catalog(catalog) stub_request(:get, %r{/puppet/v3/file_metadatas?/plugins}).to_return(:status => 404) stub_request(:get, %r{/puppet/v3/file_metadatas?/pluginfacts}).to_return(:status => 404) @@ -652,8 +650,6 @@ def expects_neither_new_or_cached_catalog end it "should not attempt to retrieve a cached catalog again if the first attempt failed" do - Puppet[:ignore_plugin_errors] = true - expect(Puppet::Node.indirection).to receive(:find).and_return(nil) expects_neither_new_or_cached_catalog expects_pluginsync From 9e2241e35dc352931fd11e479e2233d13ad56d1d Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Wed, 9 Sep 2020 05:22:23 +0000 Subject: [PATCH 129/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index 0a76677f7de..67e8fccd9a6 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -915,7 +915,7 @@ The HTTP User\-Agent string to send when making network requests\. Whether the puppet run should ignore errors during pluginsync\. If the setting is false and there are errors during pluginsync, then the agent will abort the run and submit a report containing information about the failed run\. . .IP "\(bu" 4 -\fIDefault\fR: false +\fIDefault\fR: true . .IP "" 0 . From e188052f131c5e7cef403be9118f2f3aa9dd1d43 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Tue, 8 Sep 2020 22:28:44 -0700 Subject: [PATCH 130/731] (PUP-9309) Remove SubLocatedExpression Commit caced6b59 changed how location information within a heredoc string was calculated. As a result, the SubLocatedExpression AST class is no longer used. This commit removes the class. --- lib/puppet/pops/evaluator/evaluator_impl.rb | 5 -- lib/puppet/pops/model/ast.pp | 18 ---- lib/puppet/pops/model/ast.rb | 97 --------------------- lib/puppet/pops/model/factory.rb | 16 ---- lib/puppet/pops/model/model_tree_dumper.rb | 4 - lib/puppet/pops/model/pn_transformer.rb | 4 - lib/puppet/pops/types/type_parser.rb | 4 - 7 files changed, 148 deletions(-) diff --git a/lib/puppet/pops/evaluator/evaluator_impl.rb b/lib/puppet/pops/evaluator/evaluator_impl.rb index 446fc68247e..c3cc990f622 100644 --- a/lib/puppet/pops/evaluator/evaluator_impl.rb +++ b/lib/puppet/pops/evaluator/evaluator_impl.rb @@ -1021,11 +1021,6 @@ def eval_SelectorExpression o, scope end end - # SubLocatable is simply an expression that holds location information - def eval_SubLocatedExpression o, scope - evaluate(o.expr, scope) - end - # Evaluates Puppet DSL Heredoc def eval_HeredocExpression o, scope expr = o.text_expr diff --git a/lib/puppet/pops/model/ast.pp b/lib/puppet/pops/model/ast.pp index a086c8a8dd7..e8bdecd9450 100644 --- a/lib/puppet/pops/model/ast.pp +++ b/lib/puppet/pops/model/ast.pp @@ -343,24 +343,6 @@ } } }], - SubLocatedExpression => Object[{ - parent => Expression, - attributes => { - 'expr' => Expression, - 'line_offsets' => { - type => Array[Integer], - value => [] - }, - 'leading_line_count' => { - type => Optional[Integer], - value => undef - }, - 'leading_line_offset' => { - type => Optional[Integer], - value => undef - } - } - }], HeredocExpression => Object[{ parent => Expression, attributes => { diff --git a/lib/puppet/pops/model/ast.rb b/lib/puppet/pops/model/ast.rb index d4c0b9049cf..a880442acb2 100644 --- a/lib/puppet/pops/model/ast.rb +++ b/lib/puppet/pops/model/ast.rb @@ -2535,102 +2535,6 @@ def eql?(o) alias == eql? end -class SubLocatedExpression < Expression - def self._pcore_type - @_pcore_type ||= Types::PObjectType.new('Puppet::AST::SubLocatedExpression', { - 'parent' => Expression._pcore_type, - 'attributes' => { - 'expr' => Expression._pcore_type, - 'line_offsets' => { - 'type' => Types::PArrayType.new(Types::PIntegerType::DEFAULT), - 'value' => [] - }, - 'leading_line_count' => { - 'type' => Types::POptionalType.new(Types::PIntegerType::DEFAULT), - 'value' => nil - }, - 'leading_line_offset' => { - 'type' => Types::POptionalType.new(Types::PIntegerType::DEFAULT), - 'value' => nil - } - } - }) - end - - def self.from_hash(init_hash) - from_asserted_hash(Types::TypeAsserter.assert_instance_of('Puppet::AST::SubLocatedExpression initializer', _pcore_type.init_hash_type, init_hash)) - end - - def self.from_asserted_hash(init_hash) - new( - init_hash['locator'], - init_hash['offset'], - init_hash['length'], - init_hash['expr'], - init_hash.fetch('line_offsets') { _pcore_type['line_offsets'].value }, - init_hash['leading_line_count'], - init_hash['leading_line_offset']) - end - - def self.create(locator, offset, length, expr, line_offsets = _pcore_type['line_offsets'].value, leading_line_count = nil, leading_line_offset = nil) - ta = Types::TypeAsserter - attrs = _pcore_type.attributes(true) - ta.assert_instance_of('Puppet::AST::Positioned[locator]', attrs['locator'].type, locator) - ta.assert_instance_of('Puppet::AST::Positioned[offset]', attrs['offset'].type, offset) - ta.assert_instance_of('Puppet::AST::Positioned[length]', attrs['length'].type, length) - ta.assert_instance_of('Puppet::AST::SubLocatedExpression[expr]', attrs['expr'].type, expr) - ta.assert_instance_of('Puppet::AST::SubLocatedExpression[line_offsets]', attrs['line_offsets'].type, line_offsets) - ta.assert_instance_of('Puppet::AST::SubLocatedExpression[leading_line_count]', attrs['leading_line_count'].type, leading_line_count) - ta.assert_instance_of('Puppet::AST::SubLocatedExpression[leading_line_offset]', attrs['leading_line_offset'].type, leading_line_offset) - new(locator, offset, length, expr, line_offsets, leading_line_count, leading_line_offset) - end - - attr_reader :expr - attr_reader :line_offsets - attr_reader :leading_line_count - attr_reader :leading_line_offset - - def initialize(locator, offset, length, expr, line_offsets = _pcore_type['line_offsets'].value, leading_line_count = nil, leading_line_offset = nil) - super(locator, offset, length) - @hash = @hash ^ expr.hash ^ line_offsets.hash ^ leading_line_count.hash ^ leading_line_offset.hash - @expr = expr - @line_offsets = line_offsets - @leading_line_count = leading_line_count - @leading_line_offset = leading_line_offset - end - - def _pcore_init_hash - result = super - result['expr'] = @expr - result['line_offsets'] = @line_offsets unless _pcore_type['line_offsets'].default_value?(@line_offsets) - result['leading_line_count'] = @leading_line_count unless @leading_line_count == nil - result['leading_line_offset'] = @leading_line_offset unless @leading_line_offset == nil - result - end - - def _pcore_contents - yield(@expr) unless @expr.nil? - end - - def _pcore_all_contents(path, &block) - path << self - unless @expr.nil? - block.call(@expr, path) - @expr._pcore_all_contents(path, &block) - end - path.pop - end - - def eql?(o) - super && - @expr.eql?(o.expr) && - @line_offsets.eql?(o.line_offsets) && - @leading_line_count.eql?(o.leading_line_count) && - @leading_line_offset.eql?(o.leading_line_offset) - end - alias == eql? -end - class HeredocExpression < Expression def self._pcore_type @_pcore_type ||= Types::PObjectType.new('Puppet::AST::HeredocExpression', { @@ -4902,7 +4806,6 @@ def self.register_pcore_types Model::TypeDefinition, Model::NodeDefinition, Model::SiteDefinition, - Model::SubLocatedExpression, Model::HeredocExpression, Model::HostClassDefinition, Model::PlanDefinition, diff --git a/lib/puppet/pops/model/factory.rb b/lib/puppet/pops/model/factory.rb index 921bddfa6d4..a75eec945b2 100644 --- a/lib/puppet/pops/model/factory.rb +++ b/lib/puppet/pops/model/factory.rb @@ -444,22 +444,6 @@ def build_SelectorExpression(o, left, *selectors) @init_hash['selectors'] = selectors end - # Builds a SubLocatedExpression - this wraps the expression in a sublocation configured - # from the given token - # A SubLocated holds its own locator that is used for subexpressions holding positions relative - # to what it describes. - # - def build_SubLocatedExpression(o, token, expression) - @init_hash[KEY_EXPR] = expression - @init_hash[KEY_OFFSET] = token.offset - @init_hash[KEY_LENGTH] = token.length - locator = token.locator - @init_hash[KEY_LOCATOR] = locator - @init_hash['leading_line_count'] = locator.leading_line_count - @init_hash['leading_line_offset'] = locator.leading_line_offset - @init_hash['line_offsets'] = locator.line_index # index of lines in sublocated - end - def build_SelectorEntry(o, matching, value) @init_hash['matching_expr'] = matching @init_hash['value_expr'] = value diff --git a/lib/puppet/pops/model/model_tree_dumper.rb b/lib/puppet/pops/model/model_tree_dumper.rb index 8af7ab6fea3..58a45fb2b63 100644 --- a/lib/puppet/pops/model/model_tree_dumper.rb +++ b/lib/puppet/pops/model/model_tree_dumper.rb @@ -441,10 +441,6 @@ def dump_SelectorEntry o [do_dump(o.matching_expr), "=>", do_dump(o.value_expr)] end - def dump_SubLocatedExpression o - ["sublocated", do_dump(o.expr)] - end - def dump_TypeAlias(o) ['type-alias', o.name, do_dump(o.type_expr)] end diff --git a/lib/puppet/pops/model/pn_transformer.rb b/lib/puppet/pops/model/pn_transformer.rb index 5eed3990016..ad50653b35f 100644 --- a/lib/puppet/pops/model/pn_transformer.rb +++ b/lib/puppet/pops/model/pn_transformer.rb @@ -297,10 +297,6 @@ def transform_SiteDefinition(e) transform(e.body).as_call('site') end - def transform_SubLocatedExpression(e) - transform(e.expr) - end - def transform_TextExpression(e) PN::Call.new('str', transform(e.expr)) end diff --git a/lib/puppet/pops/types/type_parser.rb b/lib/puppet/pops/types/type_parser.rb index d60b8163cf6..903769add94 100644 --- a/lib/puppet/pops/types/type_parser.rb +++ b/lib/puppet/pops/types/type_parser.rb @@ -94,10 +94,6 @@ def interpret_HeredocExpression(o, context) interpret_any(o.text_expr, context) end - def interpret_SubLocatedExpression(o, context) - interpret_any(o.expr, context) - end - # @api private def interpret_QualifiedName(o, context) o.value From 9e19488442589fd70ca501d6c31bd39df3c860df Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Wed, 2 Sep 2020 16:05:27 -0700 Subject: [PATCH 131/731] (PUP-10446) Move resource alias test out of capability specs This test was added due to a regression caused by the introduction of app orchestration, see commit 0dbd5465ef. Move the test to `type_spec.rb` in preparation for deleting `capability_spec.rb`. --- spec/unit/capability_spec.rb | 18 ------------------ spec/unit/type_spec.rb | 20 ++++++++++++++++++++ 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/spec/unit/capability_spec.rb b/spec/unit/capability_spec.rb index 975f5ca685f..607a84f8caa 100644 --- a/spec/unit/capability_spec.rb +++ b/spec/unit/capability_spec.rb @@ -392,23 +392,5 @@ class { consumer: consume => Cap[one]} end end - context 'and aliased resources' do - let(:drive) { Puppet::Util::Platform.windows? ? 'C:' : '' } - let(:code) { <<-PUPPET } - $dir='#{drive}/tmp/test' - $same_dir='#{drive}/tmp/test/' - - file {$dir: - ensure => directory - } - - file { $same_dir: - ensure => directory - } - PUPPET - it 'fails if a resource is defined and then redefined using name that results in the same alias' do - expect { compile_to_ral(code) }.to raise_error(/resource \["File", "#{drive}\/tmp\/test"\] already declared/) - end - end end diff --git a/spec/unit/type_spec.rb b/spec/unit/type_spec.rb index 29e0b2fcb49..6bd2acaf52e 100644 --- a/spec/unit/type_spec.rb +++ b/spec/unit/type_spec.rb @@ -195,6 +195,26 @@ class something { end end + context 'aliased resource' do + it 'fails if a resource is defined and then redefined using name that results in the same alias' do + drive = Puppet::Util::Platform.windows? ? 'C:' : '' + code = <<~PUPPET + $dir='#{drive}/tmp/test' + $same_dir='#{drive}/tmp/test/' + + file {$dir: + ensure => directory + } + + file { $same_dir: + ensure => directory + } + PUPPET + + expect { compile_to_ral(code) }.to raise_error(/resource \["File", "#{drive}\/tmp\/test"\] already declared/) + end + end + context "resource attributes" do let(:resource) { resource = klass.new(:name => "foo") From 982cba03b161648531dca048866afde0dcb8f1a9 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Wed, 26 Aug 2020 15:32:03 -0700 Subject: [PATCH 132/731] (PUP-10446) Remove /puppet/v3/environment REST API Remove the 'environment' catalog REST API. The 'environments' REST API is unchanged. --- api/docs/http_api_index.md | 10 +- api/docs/http_environment.md | 80 -------- lib/puppet/network/http/api/master/v3.rb | 8 +- .../network/http/api/master/v3/environment.rb | 88 --------- .../http/api/master/v3/environment_spec.rb | 185 ------------------ spec/unit/network/http/api/master/v3_spec.rb | 7 - 6 files changed, 4 insertions(+), 374 deletions(-) delete mode 100644 api/docs/http_environment.md delete mode 100644 lib/puppet/network/http/api/master/v3/environment.rb delete mode 100644 spec/unit/network/http/api/master/v3/environment_spec.rb diff --git a/api/docs/http_api_index.md b/api/docs/http_api_index.md index d6bfe8650d4..ce137062586 100644 --- a/api/docs/http_api_index.md +++ b/api/docs/http_api_index.md @@ -91,16 +91,12 @@ tools. * [Status](./http_status.md) -### Environment Endpoints +### Environments Endpoint -The endpoints with a different format are the `/puppet/v3/environments` and -the `/puppet/v3/environment/:environment` endpoints. - -These endpoints will only accept payloads formatted as JSON and respond -with JSON (MIME type of `application/json`). +The `/puppet/v3/environments` endpoint is different as it will only accept payloads +formatted as JSON and respond with JSON (MIME type of `application/json`). * [Environments](./http_environments.md) -* [Environment Catalog](./http_environment.md) ### Puppet Server-specific endpoints diff --git a/api/docs/http_environment.md b/api/docs/http_environment.md deleted file mode 100644 index f0ab207debd..00000000000 --- a/api/docs/http_environment.md +++ /dev/null @@ -1,80 +0,0 @@ -Environment Catalog -=================== - -**Warning: the format of the response for this endpoint will change in a -future version in an incompatible way. It should be considered private for -the time being** - -Issuing a `GET` request against this endpoint causes the compiler to -compile an _environment catalog_ and return it. - -Get ---- - -Get the catalog for an environment - - GET /puppet/v3/environment/:environment - -### Supported Response Formats - -`application/json` - -### Parameters - -None - -### Example Request & Response - - GET /puppet/v3/environment/production - - HTTP 200 OK - Content-Type: application/json - - { - "environment": "production", - "applications": { - "Webapp[pao]": { - "Db[pao_db]": { - "produces": [ "Sql[pao_db]" ], - "consumes": [], - "node": "agent1" }, - "Web[pao_w1]": { - "produces": [ "Http[pao_w1]" ], - "consumes": [ "Sql[pao_db]" ], - "node": "agent2" }, - "Web[pao_w2]": { - "produces": [ "Http[pao_w2]" ], - "consumes": [ "Sql[pao_db]" ], - "node": "agent2" }, - "Web[pao_w3]": { - "produces": [ "Http[pao_w3]" ], - "consumes": [ "Sql[pao_db]" ], - "node": "agent2" }, - "Lb[pao_lb]": { - "produces": [], - "consumes": [ "Http[pao_w1]", "Http[pao_w2]", "Http[pao_w3]" ], - "node": "agent3" } - } - } - } - -The response contains the name of the environment in the `environment` key, -and a list of applications in that environment in the `applications` -hash. The type/title of each application is used as the key in that hash, -and the entry for that application consists of a hash of the components, -again keyed by the type and title of the component. - -For each component, the catalog indicates what service resources the -component `produces` and `consumes`, as well as the `node` to which that -component is mapped. - -#### Planned response change - -The response format is likely to change in the following way: - -* the `applications` hash will become an array of hashes, where each hash - represents an application with separate keys for type and title, and for - the components of the application -* the components of an application will similarly be represented as an - array of hashes, similar to the format used today, but with the addition - of the component's type and title inside the hash diff --git a/lib/puppet/network/http/api/master/v3.rb b/lib/puppet/network/http/api/master/v3.rb index 202362d29a5..87afc38f514 100644 --- a/lib/puppet/network/http/api/master/v3.rb +++ b/lib/puppet/network/http/api/master/v3.rb @@ -1,7 +1,6 @@ class Puppet::Network::HTTP::API::Master::V3 require 'puppet/network/http/api/master/v3/authorization' require 'puppet/network/http/api/master/v3/environments' - require 'puppet/network/http/api/master/v3/environment' require 'puppet/network/http/api/indirected_routes' AUTHZ = Authorization.new @@ -15,14 +14,9 @@ class Puppet::Network::HTTP::API::Master::V3 Environments.new(Puppet.lookup(:environments)) end) - ENVIRONMENT = Puppet::Network::HTTP::Route. - path(%r{^/environment/[^/]+$}).get(AUTHZ.wrap do - Environment.new - end) - def self.routes Puppet::Network::HTTP::Route.path(%r{v3}). any. - chain(ENVIRONMENTS, ENVIRONMENT, INDIRECTED) + chain(ENVIRONMENTS, INDIRECTED) end end diff --git a/lib/puppet/network/http/api/master/v3/environment.rb b/lib/puppet/network/http/api/master/v3/environment.rb deleted file mode 100644 index dc41ad12138..00000000000 --- a/lib/puppet/network/http/api/master/v3/environment.rb +++ /dev/null @@ -1,88 +0,0 @@ -require 'puppet/util/json' -require 'puppet/parser/environment_compiler' - -# @deprecated application orchestration will be removed in puppet 7 -class Puppet::Network::HTTP::API::Master::V3::Environment - def call(request, response) - Puppet.deprecation_warning("Application orchestration is deprecated. See https://puppet.com/docs/puppet/5.5/deprecated_language.html") - - env_name = request.routing_path.split('/').last - env = Puppet.lookup(:environments).get(env_name) - code_id = request.params[:code_id] - - if env.nil? - raise Puppet::Network::HTTP::Error::HTTPNotFoundError.new(_("%{env_name} is not a known environment") % { env_name: env_name }, Puppet::Network::HTTP::Issues::RESOURCE_NOT_FOUND) - end - - catalog = Puppet::Parser::EnvironmentCompiler.compile(env, code_id).to_resource - - env_graph = build_environment_graph(catalog) - - response.respond_with(200, "application/json", Puppet::Util::Json.dump(env_graph)) - end - - def build_environment_graph(catalog) - # This reads catalog and code_id off the catalog rather than using the one - # from the request. There shouldn't really be a case where the two differ, - # but if they do, the one from the catalog itself is authoritative. - env_graph = {:environment => catalog.environment, :applications => {}, :code_id => catalog.code_id} - applications = catalog.resources.select do |res| - type = res.resource_type - type.is_a?(Puppet::Resource::Type) && type.application? - end - applications.each do |app| - file, line = app.file, app.line - nodes = app['nodes'] - - required_components = catalog.direct_dependents_of(app).map {|comp| comp.ref} - mapped_components = nodes.values.flatten.map {|comp| comp.ref} - - nonexistent_components = mapped_components - required_components - if nonexistent_components.any? - raise Puppet::ParseError.new( - _("Application %{application} assigns nodes to non-existent components: %{component_list}") % - { application: app, component_list: nonexistent_components.join(', ') }, file, line) - end - - missing_components = required_components - mapped_components - if missing_components.any? - raise Puppet::ParseError.new(_("Application %{application} has components without assigned nodes: %{component_list}") % - { application: app, component_list: missing_components.join(', ') }, file, line) - end - - # Turn the 'nodes' hash into a map component ref => node name - node_mapping = {} - nodes.each do |node, comps| - comps = [comps] unless comps.is_a?(Array) - comps.each do |comp| - raise Puppet::ParseError.new(_("Application %{app} assigns multiple nodes to component %{comp}") % { app: app, comp: comp }, file, line) if node_mapping.include?(comp.ref) - node_mapping[comp.ref] = node.title - end - end - - app_components = {} - catalog.direct_dependents_of(app).each do |comp| - app_components[comp.ref] = { - :produces => comp.export.map(&:ref), - :consumes => prerequisites(comp).map(&:ref), - :node => node_mapping[comp.ref] - } - end - env_graph[:applications][app.ref] = app_components - end - - env_graph - end - - private - - # Finds all the prerequisites of component +comp+. They are all the - # capability resources that +comp+ depends on; this includes resources - # that +comp+ consumes but also resources it merely requires - def prerequisites(comp) - params = Puppet::Type.relationship_params.select { |p| p.direction == :in }.map(&:name) - params.map { |rel| comp[rel] }.flatten.compact.select do |rel| - rel.resource_type && rel.resource_type.is_capability? - end - end -end diff --git a/spec/unit/network/http/api/master/v3/environment_spec.rb b/spec/unit/network/http/api/master/v3/environment_spec.rb deleted file mode 100644 index 1c591a7376a..00000000000 --- a/spec/unit/network/http/api/master/v3/environment_spec.rb +++ /dev/null @@ -1,185 +0,0 @@ -require 'spec_helper' - -require 'puppet/network/http' - -describe Puppet::Network::HTTP::API::Master::V3::Environment do - let(:response) { Puppet::Network::HTTP::MemoryResponse.new } - - let(:environment) { Puppet::Node::Environment.create(:production, [], '/manifests') } - let(:loader) { Puppet::Environments::Static.new(environment) } - - around :each do |example| - Puppet.override(:environments => loader) do - Puppet::Type.newtype :sql, :is_capability => true do - newparam :name, :namevar => true - end - Puppet::Type.newtype :http, :is_capability => true do - newparam :name, :namevar => true - end - example.run - end - end - - it "returns the environment catalog" do - request = Puppet::Network::HTTP::Request.from_hash(:headers => { 'accept' => 'application/json' }, :routing_path => "environment/production") - - subject.call(request, response) - - expect(response.code).to eq(200) - - catalog = JSON.parse(response.body) - expect(catalog['environment']).to eq('production') - expect(catalog['applications']).to eq({}) - end - - describe "processing the environment catalog" do - def compile_site_to_catalog(site, code_id=nil) - Puppet[:code] = <<-MANIFEST - define db() { } - Db produces Sql { } - - define web() { } - Web consumes Sql { } - Web produces Http { } - - application myapp() { - db { $name: - export => Sql[$name], - } - web { $name: - consume => Sql[$name], - export => Http[$name], - } - } - site { - #{site} - } - MANIFEST - Puppet::Parser::EnvironmentCompiler.compile(environment, code_id).filter { |r| r.virtual? } - end - - - it "includes specified applications" do - catalog = compile_site_to_catalog <<-MANIFEST - myapp { 'test': - nodes => { - Node['foo.example.com'] => Db['test'], - Node['bar.example.com'] => Web['test'], - }, - } - MANIFEST - - result = subject.build_environment_graph(catalog) - - expect(result[:applications]).to eq({'Myapp[test]' => - {'Db[test]' => {:produces => ['Sql[test]'], :consumes => [], :node => 'foo.example.com'}, - 'Web[test]' => {:produces => ['Http[test]'], :consumes => ['Sql[test]'], :node => 'bar.example.com'}}}) - end - - it "fails if a component isn't mapped to a node" do - catalog = compile_site_to_catalog <<-MANIFEST - myapp { 'test': - nodes => { - Node['foo.example.com'] => Db['test'], - } - } - MANIFEST - - expect { subject.build_environment_graph(catalog) }.to raise_error(Puppet::ParseError, /has components without assigned nodes/) - end - - it "fails if a non-existent component is mapped to a node" do - catalog = compile_site_to_catalog <<-MANIFEST - myapp { 'test': - nodes => { - Node['foo.example.com'] => [ Db['test'], Web['test'], Web['foobar'] ], - } - } - MANIFEST - - expect { subject.build_environment_graph(catalog) }.to raise_error(Puppet::ParseError, /assigns nodes to non-existent components/) - end - - it "fails if a component is mapped twice" do - catalog = compile_site_to_catalog <<-MANIFEST - myapp { 'test': - nodes => { - Node['foo.example.com'] => [ Db['test'], Web['test'] ], - Node['bar.example.com'] => [ Web['test'] ], - } - } - MANIFEST - - expect { subject.build_environment_graph(catalog) }.to raise_error(Puppet::ParseError, /assigns multiple nodes to component/) - end - - it "fails if an application maps components from other applications" do - catalog = compile_site_to_catalog <<-MANIFEST - myapp { 'test': - nodes => { - Node['foo.example.com'] => [ Db['test'], Web['test'] ], - } - } - myapp { 'other': - nodes => { - Node['foo.example.com'] => [ Db['other'], Web['other'], Web['test'] ], - } - } - MANIFEST - - expect { subject.build_environment_graph(catalog) }.to raise_error(Puppet::ParseError, /assigns nodes to non-existent components/) - end - - it "doesn't fail if the catalog contains a node cycle" do - catalog = compile_site_to_catalog <<-MANIFEST - myapp { 'test': - nodes => { - Node['foo.example.com'] => [ Db['test'] ], - Node['bar.example.com'] => [ Web['test'] ], - } - } - myapp { 'other': - nodes => { - Node['foo.example.com'] => [ Web['other'] ], - Node['bar.example.com'] => [ Db['other'] ], - } - } - MANIFEST - - expect { subject.build_environment_graph(catalog) }.not_to raise_error - end - end - - it "returns 404 if the environment doesn't exist" do - request = Puppet::Network::HTTP::Request.from_hash(:routing_path => "environment/development") - - expect { subject.call(request, response) }.to raise_error(Puppet::Network::HTTP::Error::HTTPNotFoundError, /development is not a known environment/) - end - - it "omits code_id if unspecified" do - request = Puppet::Network::HTTP::Request.from_hash(:routing_path => "environment/production") - - subject.call(request, response) - - expect(JSON.parse(response.body)['code_id']).to be_nil - end - - it "includes code_id if specified" do - request = Puppet::Network::HTTP::Request.from_hash(:params => {:code_id => '12345'}, :routing_path => "environment/production") - - subject.call(request, response) - - expect(JSON.parse(response.body)['code_id']).to eq('12345') - end - - it "uses code_id from the catalog if it differs from the request" do - request = Puppet::Network::HTTP::Request.from_hash(:params => {:code_id => '12345'}, :routing_path => "environment/production") - - allow_any_instance_of(Puppet::Resource::Catalog).to receive(:code_id).and_return('67890') - - subject.call(request, response) - - expect(JSON.parse(response.body)['code_id']).to eq('67890') - end -end - diff --git a/spec/unit/network/http/api/master/v3_spec.rb b/spec/unit/network/http/api/master/v3_spec.rb index e3971bfb793..ca2e6b05c9c 100644 --- a/spec/unit/network/http/api/master/v3_spec.rb +++ b/spec/unit/network/http/api/master/v3_spec.rb @@ -22,13 +22,6 @@ expect(response.code).to eq(200) end - it "mounts the environment endpoint" do - request = Puppet::Network::HTTP::Request.from_hash(:path => "#{master_url_prefix}/environment/production") - master_routes.process(request, response) - - expect(response.code).to eq(200) - end - it "matches only complete routes" do request = Puppet::Network::HTTP::Request.from_hash(:path => "#{master_url_prefix}/foo/environments") expect { master_routes.process(request, response) }.to raise_error(Puppet::Network::HTTP::Error::HTTPNotFoundError) From 0f1c4fdfc41e2cb0fa85ab664a7fdc404343d3fa Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Wed, 26 Aug 2020 15:38:47 -0700 Subject: [PATCH 133/731] (PUP-10446) Remove environment catalog compiler Remove the environment catalog compiler which is only accessible via the already removed environment catalog REST API. --- lib/puppet/parser/environment_compiler.rb | 202 ----- spec/unit/parser/environment_compiler_spec.rb | 730 ------------------ 2 files changed, 932 deletions(-) delete mode 100644 lib/puppet/parser/environment_compiler.rb delete mode 100644 spec/unit/parser/environment_compiler_spec.rb diff --git a/lib/puppet/parser/environment_compiler.rb b/lib/puppet/parser/environment_compiler.rb deleted file mode 100644 index 146fa0b96bd..00000000000 --- a/lib/puppet/parser/environment_compiler.rb +++ /dev/null @@ -1,202 +0,0 @@ -require 'puppet/parser/compiler' - -# @deprecated application orchestration will be removed in puppet 7 -class Puppet::Parser::EnvironmentCompiler < Puppet::Parser::Compiler - def self.compile(env, code_id=nil) - begin - env.check_for_reparse - - node = Puppet::Node.new(env) - node.environment = env - new(node, :code_id => code_id).compile - rescue => detail - message = _("%{detail} in environment %{env}") % { detail: detail, env: env.name } - Puppet.log_exception(detail, message) - raise Puppet::Error, message, detail.backtrace - end - end - - def initialize(node, options = {}) - super(node, **options) - @overridden_functions = {} - end - - def add_function_overrides - add_function_override('hiera_include', proc { Puppet.debug "Ignoring hiera_include() during environment catalog compilation" }) - end - - def add_function_override(func_name, override) - typed_name = Puppet::Pops::Loader::TypedName.new(:function, func_name) - loader = loaders.puppet_system_loader - - # Remove and preserve existing entry. A `nil` is also preserved to indicate - # an override that didn't replace a loaded function. - entry = loader.get_entry(typed_name) - existing = entry.nil? ? nil : entry.value - loader.remove_entry(typed_name) unless existing.nil? - @overridden_functions[typed_name] = existing - - # Add the override to the loader - loader.set_entry(typed_name, override) - end - - def remove_function_overrides - loader = loaders.puppet_system_loader - @overridden_functions.each_pair do |typed_name, overridden| - loader.remove_entry(typed_name) - loader.set_entry(typed_name, overridden) unless overridden.nil? - end - end - - def add_catalog_validators - super - add_catalog_validator(CatalogValidator::SiteValidator) - add_catalog_validator(CatalogValidator::EnvironmentRelationshipValidator) - end - - def compile - Puppet.deprecation_warning("Application orchestration is deprecated. See https://puppet.com/docs/puppet/5.5/deprecated_language.html") - - add_function_overrides - begin - Puppet.override(@context_overrides, _("For compiling environment catalog %{env}") % { env: environment.name }) do - @catalog.environment_instance = environment - - Puppet::Util::Profiler.profile(_("Env Compile: Created settings scope"), [:compiler, :create_settings_scope]) { create_settings_scope } - - Puppet::Util::Profiler.profile(_("Env Compile: Evaluated main"), [:compiler, :evaluate_main]) { evaluate_main } - - Puppet::Util::Profiler.profile(_("Env Compile: Evaluated site"), [:compiler, :evaluate_site]) { evaluate_site } - - Puppet::Util::Profiler.profile(_("Env Compile: Evaluated application instances"), [:compiler, :evaluate_applications]) { evaluate_applications } - - Puppet::Util::Profiler.profile(_("Env Compile: Prune"), [:compiler, :prune_catalog]) { prune_catalog } - - Puppet::Util::Profiler.profile(_("Env Compile: Validate Catalog pre-finish"), [:compiler, :validate_pre_finish]) do - validate_catalog(CatalogValidator::PRE_FINISH) - end - - Puppet::Util::Profiler.profile(_("Env Compile: Finished catalog"), [:compiler, :finish_catalog]) { finish } - - fail_on_unevaluated - - Puppet::Util::Profiler.profile(_("Env Compile: Validate Catalog final"), [:compiler, :validate_final]) do - validate_catalog(CatalogValidator::FINAL) - end - - if block_given? - yield @catalog - else - @catalog - end - end - ensure - remove_function_overrides - end - end - - # @api private - def prune_catalog - prune_env_catalog - end - - # Prunes the catalog by dropping all resources that are not contained under the Site (if a site expression is used). - # As a consequence all edges to/from dropped resources are also dropped. - # Once the pruning is performed, this compiler returns the pruned list when calling the #resources method. - # The pruning does not alter the order of resources in the resources list. - # - def prune_env_catalog - # Everything under Class[main], that is not under (inclusive of) Site[site] should be pruned as those resources - # are intended for nodes in a node catalog. - # - the_main_class_resource = @catalog.resource('Class', '') - the_site_resource = @catalog.resource('Site', 'site') - - # Get downstream vertexes returns a hash where the keys are the resources and values nesting level - rooted_in_main = @catalog.downstream_from_vertex(the_main_class_resource).keys - - to_be_removed = - if the_site_resource - keep_from_site = @catalog.downstream_from_vertex(the_site_resource).keys - keep_from_site << the_site_resource - rooted_in_main - keep_from_site - else - rooted_in_main - end - - @catalog.remove_resource(*to_be_removed) - # The compiler keeps a list of added resources, this shadows that list with the now pruned result - @pruned_resources = @catalog.resources - end - - def add_resource(scope, resource) - @resources << resource - @catalog.add_resource(resource) - - if !resource.class? && resource[:stage] - raise ArgumentError, _("Only classes can set 'stage'; normal resources like %{resource} cannot change run stage") % { resource: resource } - end - - # Stages should not be inside of classes. They are always a - # top-level container, regardless of where they appear in the - # manifest. - return if resource.stage? - - # This adds a resource to the class it lexically appears in in the - # manifest. - unless resource.class? - @catalog.add_edge(scope.resource, resource) - end - resource.mark_unevaluated_consumer if is_capability_consumer?(resource) - assert_app_in_site(scope, resource) - end - - def evaluate_ast_node() - # Do nothing, the environment catalog is not built for a particular node. - end - - def on_empty_site - Puppet.warning(_("Environment Compiler: Could not find a site definition to evaluate")) - end - - def evaluate_applications - exceptwrap do - resources.select { |resource| type = resource.resource_type; type.is_a?(Puppet::Resource::Type) && type.application? }.each do |resource| - Puppet::Util::Profiler.profile(_("Evaluated application %{resource}") % { resource: resource }, [:compiler, :evaluate_resource, resource]) do - resource.evaluate - end - end - end - end - - def evaluate_classes(titles, scope, lazy) - # Always lazy in an Environment compilation - super(titles, scope, true) - end - - # Overrides the regular compiler to be able to return the list of resources after a prune - # has taken place in the graph representation. Before a prune, the list is the same as in the regular - # compiler - # - def resources - @pruned_resources || super - end - - def is_capability?(value) - if value.is_a?(Array) - value.find { |ev| is_capability?(ev) } - elsif value.is_a?(Puppet::Resource) - rstype = value.resource_type - rstype.nil? ? false : rstype.is_capability? - else - false - end - end - private :is_capability? - - def is_capability_consumer?(resource) - resource.eachparam { |param| return true if (param.name == :consume || param.name == :require) && is_capability?(param.value) } - false - end - private :is_capability_consumer? -end diff --git a/spec/unit/parser/environment_compiler_spec.rb b/spec/unit/parser/environment_compiler_spec.rb deleted file mode 100644 index 9890c971fb2..00000000000 --- a/spec/unit/parser/environment_compiler_spec.rb +++ /dev/null @@ -1,730 +0,0 @@ -require 'spec_helper' -require 'puppet_spec/compiler' -require 'puppet/parser/environment_compiler' - -describe "Application instantiation" do - include PuppetSpec::Compiler - - let(:env) { Puppet::Node::Environment.create(:testing, []) } - let(:node) { Puppet::Node.new('test', :environment => env) } - let(:loaders) { Puppet::Pops::Loaders.new(env) } - let(:logs) { [] } - let(:notices) { logs.select { |log| log.level == :notice }.map { |log| log.message } } - let(:warnings) { logs.select { |log| log.level == :warning }.map { |log| log.message } } - - def compile_collect_log(string) - Puppet::Util::Log.with_destination(Puppet::Test::LogCollector.new(logs)) do - compile_to_catalog(string, Puppet::Node.new('other', :environment => env)) - end - end - - def compile_to_env_catalog(string, code_id=nil) - Puppet[:code] = string - Puppet::Parser::EnvironmentCompiler.compile(env, code_id).filter { |r| r.virtual? } - end - - before(:each) do - allow_any_instance_of(Puppet::Parser::Compiler).to receive(:loaders).and_return(loaders) - allow_any_instance_of(Puppet::Parser::EnvironmentCompiler).to receive(:loaders).and_return(loaders) - Puppet.push_context({:loaders => loaders, :current_environment => env}) - Puppet::Type.newtype :cap, :is_capability => true do - newparam :name - newparam :host - end - end - - after(:each) do - Puppet::Type.rmtype(:cap) - Puppet.pop_context() - end - - MANIFEST = <<-EOS - define prod($host) { - notify { "host ${host}":} - } - - Prod produces Cap { } - - define cons($host) { - notify { "host ${host}": } - } - - Cons consumes Cap { } - - application app { - prod { one: host => ahost, export => Cap[cap] } - cons { two: host => ahost, consume => Cap[cap] } - cons { three: consume => Cap[cap] } - } - - site { - app { anapp: - nodes => { - Node[first] => Prod[one], - Node[second] => Cons[two] - } - } - } -EOS - -MANIFEST_WO_EXPORT = <<-EOS - define prod($host) { - notify { "host ${host}":} - } - - Prod produces Cap { } - - define cons($host) { - notify { "host ${host}": } - } - - Cons consumes Cap { } - - application app { - cons { two: host => ahost, consume => Cap[cap] } - } - - site { - app { anapp: - nodes => { - Node[first] => Prod[one], - Node[second] => Cons[two] - } - } - } -EOS - -MANIFEST_WO_NODE = <<-EOS - define prod($host) { - notify { "host ${host}":} - } - - Prod produces Cap { } - - define cons($host) { - notify { "host ${host}": } - } - - Cons consumes Cap { } - - application app { - prod { one: host => ahost, export => Cap[cap] } - cons { two: host => ahost, consume => Cap[cap] } - } - - site { - app { anapp: - } - } -EOS - -MANIFEST_WITH_STRING_NODES = <<-EOS - application app { - } - - site { - app { anapp: - nodes => "foobar", - } - } -EOS - -MANIFEST_WITH_FALSE_NODES = <<-EOS - application app { - } - - site { - app { anapp: - nodes => false, - } - } -EOS - -MANIFEST_REQ_WO_EXPORT = <<-EOS - define prod($host) { - notify { "host ${host}":} - } - - Prod produces Cap { } - - define cons($host) { - notify { "host ${host}": } - } - - Cons consumes Cap { } - - application app { - cons { two: host => ahost, require => Cap[cap] } - } - - site { - app { anapp: - nodes => { - Node[first] => Prod[one], - Node[second] => Cons[two] - } - } - } -EOS - -MANIFEST_WITH_DOUBLE_EXPORT = <<-EOS - define prod($host) { - notify { "host ${host}":} - } - - Prod produces Cap { } - - define cons($host) { - notify { "host ${host}": } - } - - Cons consumes Cap { } - - application app { - prod { one: host => ahost, export => Cap[cap] } - prod { two: host => anotherhost, export => Cap[cap] } - cons { two: host => ahost, consume => Cap[cap] } - } - - site { - app { anapp: - nodes => { - Node[first] => Prod[one], - Node[second] => Cons[two] - } - } - } -EOS - -FAULTY_MANIFEST = <<-EOS - define prod($host) { - notify { "host ${host}":} - } - - Prod produces Cap { } - - define cons($host) { - notify { "host ${host}": } - } - - Cons consumes Cap { } - - application app { - prod { one: host => ahost, export => Cap[cap] } - cons { two: host => ahost, consume => Cap[cap] } - } - - # app is not in site => error - app { anapp: - nodes => { - Node[first] => Prod[one], - Node[second] => Cons[two] - } - } -EOS - -MANIFEST_WITH_SITE = <<-EOS - define prod($host) { - notify { "host ${host}":} - } - - Prod produces Cap { } - - define cons($host) { - notify { "host ${host}": } - } - - Cons consumes Cap { } - - application app { - prod { one: host => ahost, export => Cap[cap] } - cons { two: host => ahost, consume => Cap[cap] } - } - - $one = not_the_value_one - $two = two - - node default { - notify { "on a node": } - } - - notify { 'ignore me': } - - site { - $one = one - app { anapp: - nodes => { - Node[first] => Prod[$one], - Node[second] => Cons[$two] - } - } - } -EOS - -MANIFEST_WITH_ILLEGAL_RESOURCE = <<-EOS - define prod($host) { - notify { "host ${host}":} - } - - Prod produces Cap { } - - define cons($host) { - notify { "host ${host}": } - } - - Cons consumes Cap { } - - application app { - prod { one: host => ahost, export => Cap[cap] } - cons { two: consume => Cap[cap] } - } - - site { - # The rouge expression is here - notify { 'fail me': } - $one = one - app { anapp: - nodes => { - Node[first] => Prod[one], - Node[second] => Cons[two] - } - } - } -EOS - -MANIFEST_WITH_CLASS = <<-EOS - define test($host) { - notify { "c $host": } - } - - class prod($host) { - notify { "p $host": } - } - - class cons($host) { - test { c: host => $host } - } - - Class[prod] produces Cap {} - - Class[cons] consumes Cap {} - - application app { - class { prod: host => 'ahost', export => Cap[cap]} - class { cons: consume => Cap[cap]} - } - - site { - app { anapp: - nodes => { - Node[first] => Class[prod], - Node[second] => Class[cons] - } - } - } -EOS - - - context 'a node catalog' do - it "is unaffected for a non-participating node" do - catalog = compile_to_catalog(MANIFEST, Puppet::Node.new('other', :environment => env)) - types = catalog.resource_keys.map { |type, _| type }.uniq.sort - expect(types).to eq(["Class", "Stage"]) - end - - it "an application instance must be contained in a site" do - expect { compile_to_catalog(FAULTY_MANIFEST, Puppet::Node.new('first', :environment => env)) - }.to raise_error(/Application instances .* can only be contained within a Site/) - end - - it "does not raise an error when node mappings are not provided" do - expect { compile_to_catalog(MANIFEST_WO_NODE, node) }.to_not raise_error - end - - it "raises an error if node mapping is a string" do - expect { compile_to_catalog(MANIFEST_WITH_STRING_NODES, node) - }.to raise_error(/Invalid node mapping in .*: Mapping must be a hash/) - end - - it "raises an error if node mapping is false" do - expect { compile_to_catalog(MANIFEST_WITH_FALSE_NODES, node) - }.to raise_error(/Invalid node mapping in .*: Mapping must be a hash/) - end - - it "detects that consumed capability is never exported" do - expect { compile_to_env_catalog(MANIFEST_WO_EXPORT) - }.to raise_error(/Capability 'Cap\[cap\]' referenced by 'consume' is never exported/) - end - - it "detects that required capability is never exported" do - expect { compile_to_env_catalog(MANIFEST_REQ_WO_EXPORT) - }.to raise_error(/Capability 'Cap\[cap\]' referenced by 'require' is never exported/) - end - - it "detects that a capability is exported more than once" do - expect { compile_to_env_catalog(MANIFEST_WITH_DOUBLE_EXPORT) - }.to raise_error(/'Cap\[cap\]' is exported by both 'Prod\[one\]' and 'Prod\[two\]'/) - end - - it "issues deprecation warnings" do - expect {compile_collect_log(MANIFEST_WO_NODE)}.not_to raise_error - expect(warnings).to include(/Capability Mapping is deprecated/) # there are two of these - expect(warnings).to include(/Application is deprecated/) - expect(warnings).to include(/Site Definition is deprecated/) - end - - context "for producing node" do - let(:compiled_node) { Puppet::Node.new('first', :environment => env) } - let(:compiled_catalog) { compile_to_catalog(MANIFEST, compiled_node)} - - { "App[anapp]" => 'application instance', - "Cap[cap]" => 'capability resource', - "Prod[one]" => 'component', - "Notify[host ahost]" => 'node resource' - }.each do |k,v| - it "contains the #{v} (#{k})" do - expect(compiled_catalog.resource(k)).not_to be_nil - end - end - - it "does not contain the consumed resource (Cons[two])" do - expect(compiled_catalog.resource("Cons[two]")).to be_nil - end - end - - context "for consuming node" do - let(:compiled_node) { Puppet::Node.new('second', :environment => env) } - let(:compiled_catalog) { compile_to_catalog(MANIFEST, compiled_node)} - let(:cap) { - the_cap = Puppet::Resource.new("Cap", "cap") - the_cap["host"] = "ahost" - the_cap - } - - { "App[anapp]" => 'application instance', - "Cap[cap]" => 'capability resource', - "Cons[two]" => 'component', - "Notify[host ahost]" => 'node resource' - }.each do |k,v| - it "contains the #{v} (#{k})" do - # Mock the connection to Puppet DB - expect(Puppet::Resource::CapabilityFinder).to receive(:find).and_return(cap) - expect(compiled_catalog.resource(k)).not_to be_nil - end - end - - it "does not contain the produced resource (Prod[one])" do - # Mock the connection to Puppet DB - expect(Puppet::Resource::CapabilityFinder).to receive(:find).and_return(cap) - expect(compiled_catalog.resource("Prod[one]")).to be_nil - end - end - - context "for node with class producer" do - let(:compiled_node) { Puppet::Node.new('first', :environment => env) } - let(:compiled_catalog) { compile_to_catalog(MANIFEST_WITH_CLASS, compiled_node)} - - { "App[anapp]" => 'application instance', - "Cap[cap]" => 'capability resource', - "Class[prod]" => 'class', - "Notify[p ahost]" => 'node resource' - }.each do |k,v| - it "contains the #{v} (#{k})" do - cat = compiled_catalog - expect(cat.resource(k)).not_to be_nil - end - end - - it "does not contain the consumed resource (Class[cons])" do - expect(compiled_catalog.resource("Class[cons]")).to be_nil - end - end - - context "for node with class consumer" do - let(:compiled_node) { Puppet::Node.new('second', :environment => env) } - let(:compiled_catalog) { compile_to_catalog(MANIFEST_WITH_CLASS, compiled_node)} - let(:cap) { - the_cap = Puppet::Resource.new("Cap", "cap") - the_cap["host"] = "ahost" - the_cap - } - - { "App[anapp]" => 'application instance', - "Cap[cap]" => 'capability resource', - "Class[cons]" => 'class', - "Notify[c ahost]" => 'node resource' - }.each do |k,v| - it "contains the #{v} (#{k})" do - # Mock the connection to Puppet DB - expect(Puppet::Resource::CapabilityFinder).to receive(:find).and_return(cap) - expect(compiled_catalog.resource(k)).not_to be_nil - end - end - - it "does not contain the produced resource (Class[prod])" do - # Mock the connection to Puppet DB - expect(Puppet::Resource::CapabilityFinder).to receive(:find).and_return(cap) - expect(compiled_catalog.resource("Class[prod]")).to be_nil - end - end - - context "when using a site expression" do - # The site expression must be evaluated in a node catalog compilation because - # the application instantiations inside it may contain other logic (local variables) - # that are used to instantiate an application. The application instances are needed. - # - it "the node expressions is evaluated" do - catalog = compile_to_catalog(MANIFEST_WITH_SITE, Puppet::Node.new('other', :environment => env)) - types = catalog.resource_keys.map { |type, _| type }.uniq.sort - expect(types).to eq(["Class", "Node", "Notify", "Stage"]) - expect(catalog.resource("Notify[on a node]")).to_not be_nil - expect(catalog.resource("Notify[on the site]")).to be_nil - end - - end - - context "when using a site expression" do - it "the site expression is not evaluated in a node compilation" do - catalog = compile_to_catalog(MANIFEST_WITH_SITE, Puppet::Node.new('other', :environment => env)) - types = catalog.resource_keys.map { |type, _| type }.uniq.sort - expect(types).to eq(["Class", "Node", "Notify", "Stage"]) - expect(catalog.resource("Notify[on a node]")).to_not be_nil - expect(catalog.resource("Notify[on the site]")).to be_nil - end - - end - end - - describe "in the environment catalog" do - it "does not fail if there is no site expression" do - expect { - compile_to_env_catalog(<<-EOC).to_resource - notify { 'ignore me':} - EOC - }.to_not raise_error() - end - - it "ignores usage of hiera_include() at topscope for classification" do - expect(Puppet).to receive(:debug).with(/Ignoring hiera_include/) - - expect { - compile_to_env_catalog(<<-EOC).to_resource - hiera_include('classes') - site { } - EOC - }.to_not raise_error() - - end - - it 'removes overriden functions after compile' do - expect { - compile_to_env_catalog(<<-EOC) - hiera_include('classes') - site { } - EOC - }.to_not raise_error() - func = Puppet::Pops::Loaders.loaders.puppet_system_loader.load(:function, 'hiera_include') - expect(func).to be_a(Puppet::Functions::Function) - end - - it "includes components and capability resources" do - catalog = compile_to_env_catalog(MANIFEST).to_resource - apps = catalog.resources.select do |res| - res.resource_type && res.resource_type.application? - end - expect(apps.size).to eq(1) - app = apps.first - expect(app["nodes"]).not_to be_nil - comps = catalog.direct_dependents_of(app).map(&:ref).sort - expect(comps).to eq(["Cons[three]", "Cons[two]", "Prod[one]"]) - - prod = catalog.resource("Prod[one]") - expect(prod).not_to be_nil - expect(prod.export.map(&:ref)).to eq(["Cap[cap]"]) - - cons = catalog.resource("Cons[two]") - expect(cons).not_to be_nil - expect(cons[:consume].ref).to eq("Cap[cap]") - end - - it "includes class components" do - catalog = compile_to_env_catalog(MANIFEST_WITH_CLASS).to_resource - classes = catalog.resources.select do |res| - res.type == 'Class' && (res.title == 'Prod' || res.title == 'Cons') - end - expect(classes.size).to eq(2) - expect(classes.map(&:ref).sort).to eq(["Class[Cons]", "Class[Prod]"]) - - prod = catalog.resource("Class[prod]") - expect(prod).not_to be_nil - expect(prod.export.map(&:ref)).to eq(["Cap[cap]"]) - - cons = catalog.resource("Class[cons]") - expect(cons).not_to be_nil - expect(cons[:consume].ref).to eq("Cap[cap]") - end - - it "an application instance must be contained in a site" do - expect { compile_to_env_catalog(FAULTY_MANIFEST) - }.to raise_error(/Application instances .* can only be contained within a Site/) - end - - context "when using a site expression" do - it "includes components and capability resources" do - catalog = compile_to_env_catalog(MANIFEST_WITH_SITE).to_resource - apps = catalog.resources.select do |res| - res.resource_type && res.resource_type.application? - end - expect(apps.size).to eq(1) - app = apps.first - expect(app["nodes"]).not_to be_nil - comps = catalog.direct_dependents_of(app).map(&:ref).sort - expect(comps).to eq(["Cons[two]", "Prod[one]"]) - - prod = catalog.resource("Prod[one]") - expect(prod).not_to be_nil - expect(prod.export.map(&:ref)).to eq(["Cap[cap]"]) - - cons = catalog.resource("Cons[two]") - expect(cons).not_to be_nil - expect(cons[:consume].ref).to eq("Cap[cap]") - end - - it "the site expression is evaluated in an environment compilation" do - catalog = compile_to_env_catalog(MANIFEST_WITH_SITE).to_resource - types = catalog.resource_keys.map { |type, _| type }.uniq.sort - expect(types).to eq(["App", "Class", "Cons", "Prod", "Site", "Stage"]) - expect(catalog.resource("Notify[on a node]")).to be_nil - apps = catalog.resources.select do |res| - res.resource_type && res.resource_type.application? - end - expect(apps.size).to eq(1) - app = apps.first - comps = catalog.direct_dependents_of(app).map(&:ref).sort - expect(comps).to eq(["Cons[two]", "Prod[one]"]) - end - - it "fails if there are non component resources in the site" do - expect { - compile_to_env_catalog(MANIFEST_WITH_ILLEGAL_RESOURCE).to_resource - }.to raise_error(/Only application components can appear inside a site - Notify\[fail me\] is not allowed \(line: 20\)/) - end - end - - it "includes code_id if specified" do - catalog = compile_to_env_catalog(MANIFEST_WITH_SITE, "12345") - expect(catalog.code_id).to eq("12345") - end - - it "omits code_id if unspecified" do - catalog = compile_to_env_catalog(MANIFEST_WITH_SITE) - expect(catalog.code_id).to be_nil - end - end - - - describe "when validation of nodes" do - it 'validates that the key of a node mapping is a Node' do - expect { compile_to_catalog(<<-EOS, Puppet::Node.new('other', :environment => env)) - application app { - } - - site { - app { anapp: - nodes => { - 'hello' => Node[other], - } - } - } - EOS - }.to raise_error(Puppet::Error, /hello is not a Node/) - end - - it 'validates that the value of a node mapping is a resource' do - expect { compile_to_catalog(<<-EOS, Puppet::Node.new('other', :environment => env)) - application app { - } - - site { - app { anapp: - nodes => { - Node[other] => 'hello' - } - } - } - EOS - }.to raise_error(Puppet::Error, /hello is not a resource/) - end - - it 'validates that the value can be an array or resources' do - expect { compile_to_catalog(<<-EOS, Puppet::Node.new('other', :environment => env)) - define p { - notify {$title:} - } - - application app { - p{one:} - p{two:} - } - - site { - app { anapp: - nodes => { - Node[other] => [P[one],P[two]] - } - } - } - EOS - }.not_to raise_error - end - - it 'validates that the is bound to exactly one node' do - expect { compile_to_catalog(<<-EOS, Puppet::Node.new('first', :environment => env)) - define p { - notify {$title:} - } - - application app { - p{one:} - } - - site { - app { anapp: - nodes => { - Node[first] => P[one], - Node[second] => P[one], - } - } - } - EOS - }.to raise_error(Puppet::Error, /maps component P\[one\] to multiple nodes/) - end - end - - describe "site containing a resource named 'plan'" do - it 'finds an application named plan' do - expect {compile_collect_log(<<-PUPPET)}.not_to raise_error - define plan::node_file() { - file { "/tmp/plans/${name}.txt": - content => "this is ${name}.txt", - } - } - Plan::Node_file produces Node_file {} - application plan() { - plan::node_file { "node_file_${name}": - export => Node_file["node_file_${name}"] - } - } - site { - plan { "test": - nodes => { - Node["test.example.com"] => Plan::Node_file["node_file_plan_test"], - } - } - } - PUPPET - - expect(warnings).to include(/Use of future reserved word: 'plan'/) - end - end -end From 370c31e1353360ba2bd564f442275c146f247010 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Thu, 3 Sep 2020 15:04:02 -0700 Subject: [PATCH 134/731] (PUP-10446) Remove environment catalog validators Remove unused site and environment relationship validators. --- .../env_relationship_validator.rb | 66 ------------------- .../catalog_validator/site_validator.rb | 22 ------- 2 files changed, 88 deletions(-) delete mode 100644 lib/puppet/parser/compiler/catalog_validator/env_relationship_validator.rb delete mode 100644 lib/puppet/parser/compiler/catalog_validator/site_validator.rb diff --git a/lib/puppet/parser/compiler/catalog_validator/env_relationship_validator.rb b/lib/puppet/parser/compiler/catalog_validator/env_relationship_validator.rb deleted file mode 100644 index 01548a70a0e..00000000000 --- a/lib/puppet/parser/compiler/catalog_validator/env_relationship_validator.rb +++ /dev/null @@ -1,66 +0,0 @@ -class Puppet::Parser::Compiler - # Validator that asserts that all capability resources that are referenced by 'consume' or 'require' has - # been exported by some other resource in the environment - # - # @deprecated application orchestration will be removed in puppet 7 - class CatalogValidator::EnvironmentRelationshipValidator < CatalogValidator - - def validate - assumed_exports = {} - exported = {} - catalog.resources.each do |resource| - next unless resource.is_a?(Puppet::Parser::Resource) - resource.eachparam do |param| - pclass = Puppet::Type.metaparamclass(param.name) - validate_relationship(resource, param, assumed_exports, exported) if !pclass.nil? && pclass < Puppet::Type::RelationshipMetaparam - end - end - assumed_exports.each_pair do |key, (param, cap)| - raise CatalogValidationError.new(_("Capability '%{cap}' referenced by '%{param}' is never exported") % { cap: cap, param: param.name }, param.file, param.line) unless exported.include?(key) - end - nil - end - - private - - def validate_relationship(resource, param, assumed_exports, exported) - case param.name - when :require, :consume - add_capability_ref(param, param.value, assumed_exports) - when :export - add_exported(resource, param, param.value, exported) - end - end - - def add_capability_ref(param, value, assumed_exports) - case value - when Array - value.each { |v| add_capability_ref(param, v, assumed_exports) } - when Puppet::Resource - rt = value.resource_type - unless rt.nil? || !rt.is_capability? - title_key = catalog.title_key_for_ref(value.ref) - assumed_exports[title_key] = [param, value] - end - nil - end - end - - def add_exported(resource, param, value, hash) - case value - when Array - value.each { |v| add_exported(resource, param, v, hash) } - when Puppet::Resource - rt = value.resource_type - unless rt.nil? || !rt.is_capability? - title_key = catalog.title_key_for_ref(value.ref) - if hash.include?(title_key) - raise CatalogValidationError.new(_("'%{value}' is exported by both '%{hash}' and '%{resource}'") % { value: value, hash: hash[title_key], resource: resource }, param.file, param.line) - else - hash[title_key] = resource - end - end - end - end - end -end diff --git a/lib/puppet/parser/compiler/catalog_validator/site_validator.rb b/lib/puppet/parser/compiler/catalog_validator/site_validator.rb deleted file mode 100644 index 37151299c32..00000000000 --- a/lib/puppet/parser/compiler/catalog_validator/site_validator.rb +++ /dev/null @@ -1,22 +0,0 @@ -class Puppet::Parser::Compiler - # Validator that asserts that only application components can appear inside a site. - # - # @deprecated application orchestration will be removed in puppet 7 - class CatalogValidator::SiteValidator < CatalogValidator - def self.validation_stage?(stage) - PRE_FINISH.equal?(stage) - end - - def validate - the_site_resource = catalog.resource('Site', 'site') - return unless the_site_resource - - catalog.downstream_from_vertex(the_site_resource).keys.each do |r| - unless r.is_application_component? || r.resource_type.application? - raise CatalogValidationError.new(_("Only application components can appear inside a site - %{res} is not allowed") % { res: r }, r.file, r.line) - end - end - end - end -end - From 3846329543072e0f007373adebad7161dd987024 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Wed, 2 Sep 2020 14:49:12 -0700 Subject: [PATCH 135/731] (maint) Generate eparser based on current egrammar.ra Generated using `bundle exec rake gen_eparser`. --- lib/puppet/pops/parser/eparser.rb | 1306 ++++++++++++++--------------- 1 file changed, 653 insertions(+), 653 deletions(-) diff --git a/lib/puppet/pops/parser/eparser.rb b/lib/puppet/pops/parser/eparser.rb index 8633d209b18..54e28a7c910 100644 --- a/lib/puppet/pops/parser/eparser.rb +++ b/lib/puppet/pops/parser/eparser.rb @@ -30,111 +30,116 @@ class Parser < Racc::Parser ##### State transition tables begin ### clist = [ -'67,79,304,-148,65,73,304,74,89,90,91,73,116,74,-281,307,426,179,74,-290', -'85,352,-295,305,21,20,118,305,121,-293,88,54,117,57,96,69,12,297,63', -'46,49,292,56,47,10,11,-148,160,66,19,180,161,48,120,307,17,18,-281,92', -'94,93,95,-290,84,353,-295,131,270,170,55,128,293,-293,45,80,97,82,83', -'81,-190,-190,64,51,70,71,58,171,116,62,60,61,67,79,72,184,65,73,116', -'74,72,154,118,130,121,200,403,127,117,131,271,202,118,128,121,129,21', -'20,117,-280,154,404,205,54,157,57,88,69,12,120,63,46,49,86,56,47,10', -'11,116,120,66,19,272,157,48,130,304,17,18,127,330,97,118,331,121,84', -'131,129,117,307,128,55,-280,124,96,45,80,305,82,83,154,133,134,64,51', -'70,71,58,304,120,62,60,61,67,79,72,96,65,73,116,74,307,130,157,98,99', -'127,475,471,305,470,97,285,118,129,121,476,21,20,117,459,286,526,342', -'54,458,57,458,69,12,116,63,46,49,-235,56,47,10,11,116,120,66,19,384', -'118,48,121,287,17,18,117,160,304,118,171,121,84,131,471,117,470,128', -'55,290,131,307,45,80,128,82,83,120,291,305,64,51,70,71,58,295,120,62', -'60,61,67,79,72,321,65,73,322,74,328,130,-236,98,99,127,-190,-190,130', -'328,97,88,127,129,181,79,21,20,182,96,129,133,134,54,96,57,96,69,12', -'116,63,46,49,96,56,47,10,11,116,350,66,19,386,118,48,121,171,17,18,117', -'358,304,118,376,121,84,131,377,117,379,128,55,383,131,307,45,80,128', -'82,83,120,388,305,64,51,70,71,58,390,120,62,60,61,67,79,72,394,65,73', -'396,74,307,130,131,98,99,127,128,399,130,400,97,304,127,129,-191,-191', -'21,20,-192,-192,129,413,131,54,414,57,128,69,136,415,63,46,49,416,56', -'47,-194,-194,130,287,66,19,127,418,48,283,282,17,18,421,129,283,282', -'131,295,84,131,128,130,427,128,55,127,131,429,45,80,128,82,83,129,283', -'282,64,51,70,71,58,283,282,62,60,61,67,79,72,399,65,73,130,74,-235,130', -'127,131,434,127,436,128,130,443,129,444,127,129,131,350,21,20,128,351', -'129,283,282,54,447,57,450,69,136,399,63,46,49,399,56,47,333,332,160', -'130,66,19,460,127,48,344,345,17,18,461,130,129,464,131,127,84,465,128', -'468,472,474,55,129,485,486,45,80,488,82,83,490,350,494,64,51,70,71,58', -'496,350,62,60,61,67,79,72,499,65,73,130,74,500,350,127,503,507,453,474', -'509,511,512,129,513,350,515,516,358,21,20,521,522,523,524,525,54,534', -'57,537,69,136,538,63,46,49,539,56,47,541,542,543,544,66,19,379,,48,', -',17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61', -'67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,12,,63,46', -'49,,56,47,10,11,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83', -',,,64,51,70,71,58,,,62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21', -'20,,,,,,54,,57,,69,12,,63,46,49,,56,47,10,11,,,66,19,,,48,,,17,18,,', -',,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72', +'67,79,304,-148,65,73,304,74,89,90,91,73,116,74,-290,307,426,179,74,-281', +'418,352,-293,305,21,20,118,305,121,-295,131,54,117,57,128,69,12,342', +'63,46,49,292,56,47,10,11,-148,287,66,19,180,416,48,120,307,17,18,-290', +'92,94,93,95,-281,84,353,-293,130,270,295,55,127,293,-295,45,80,97,82', +'83,129,-190,-190,64,51,70,71,58,415,116,62,60,61,67,79,72,427,65,73', +'116,74,72,154,118,154,121,471,403,470,117,131,271,414,118,128,121,429', +'21,20,117,-280,154,404,413,54,157,57,157,69,12,120,63,46,49,475,56,47', +'10,11,116,120,66,19,476,157,48,130,304,17,18,127,330,97,118,331,121', +'84,131,129,117,526,128,55,-280,131,458,45,80,128,82,83,471,399,470,64', +'51,70,71,58,-235,120,62,60,61,67,79,72,116,65,73,434,74,400,130,459', +'98,99,127,436,458,130,118,97,121,127,129,131,117,21,20,128,399,129,124', +'307,54,396,57,394,69,136,116,63,46,49,390,56,47,120,443,181,79,66,19', +'182,118,48,121,444,17,18,117,130,98,99,131,127,84,131,128,97,388,128', +'55,129,131,350,45,80,128,82,83,120,333,332,64,51,70,71,58,133,134,62', +'60,61,67,79,72,116,65,73,130,74,351,130,127,-190,-190,127,133,134,130', +'118,129,121,127,129,131,117,21,20,128,447,129,-191,-191,54,383,57,379', +'69,136,116,63,46,49,450,56,47,120,-192,-192,377,66,19,399,118,48,121', +'399,17,18,117,130,98,99,131,127,84,376,128,97,-194,-194,55,129,131,160', +'45,80,128,82,83,120,283,282,64,51,70,71,58,283,282,62,60,61,67,79,72', +'358,65,73,130,74,283,282,127,131,460,453,461,128,130,131,129,171,127', +'128,131,464,21,20,128,465,129,283,282,54,350,57,96,69,12,96,63,46,49', +'468,56,47,10,11,96,130,66,19,472,127,48,130,304,17,18,127,130,129,283', +'282,127,84,131,129,474,307,128,55,129,344,345,45,80,305,82,83,96,88', +'328,64,51,70,71,58,-236,116,62,60,61,67,79,72,328,65,73,304,74,322,130', +'118,321,121,127,485,486,117,295,488,307,291,129,490,379,21,20,350,305', +'290,171,160,54,287,57,494,69,12,120,63,46,49,297,56,47,10,11,-235,496', +'66,19,384,350,48,286,499,17,18,386,500,304,350,285,96,84,503,96,304', +'272,88,55,205,507,307,45,80,474,82,83,509,307,305,64,51,70,71,58,202', +'305,62,60,61,67,79,72,511,65,73,512,74,513,350,515,516,200,184,358,521', +'522,523,524,525,171,170,161,160,21,20,96,534,88,537,538,54,539,57,85', +'69,12,541,63,46,49,86,56,47,10,11,542,543,66,19,544,421,48,,,17,18,', +',,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72', ',65,73,,74,,,,,,,,,,,,,,,,,21,20,145,,,,,54,,57,,69,12,,63,46,49,,56', '47,10,11,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,149', -'146,70,71,147,153,152,148,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,', -'21,20,,,,,,54,,57,,69,136,,63,46,49,,56,47,,,,,66,19,,,48,,,17,18,,', -',,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72', -',65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,136,,63,46,49,,56,47', -',,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70', -'71,58,,,62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,', -'57,,69,136,,63,46,49,,56,47,,,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55', -',,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72,,65,73,186,74', -',,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,12,,63,46,49,,56,47,10,11,,,66', -'19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,149,146,70,71,147', -'153,152,148,60,61,67,79,72,,65,73,191,74,,,,,,,,,,,,,,,,,21,20,,,,,', -'54,,57,,69,12,,63,46,49,,56,47,10,11,,,66,19,,,48,,,17,18,,,,,,,84,', -',,,,55,,,,45,80,,82,83,,,,149,146,70,71,147,153,152,148,60,61,67,79', -'72,,65,73,,74,193,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,12,,63,46,49', -',56,47,10,11,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,', -',,149,146,70,71,147,153,152,148,60,61,67,79,72,,65,73,,74,,,,,,,,,,', -',,,,,,21,20,,,,,,54,,57,,69,12,,63,46,49,,56,47,10,11,,,66,19,,,48,', -',17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61', -'67,79,72,,65,73,,204,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,136,,63,46', -'49,,56,47,,,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,', -',64,51,70,71,58,,,62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20', -',,,,,54,,57,,69,12,,63,46,49,,56,47,10,11,,,66,19,,,48,,,17,18,,,,,', -',84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72,,65', -'73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,12,,63,46,49,,56,47,10', -'11,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70', -'71,58,,,62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,', -'57,,69,12,,63,46,49,,56,47,10,11,,,66,19,,,48,,,17,18,,,,,,,84,,,,,', -'55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72,,65,73,,74', -',,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,12,,63,46,49,,56,47,10,11,,,66', +'146,70,71,147,153,152,148,60,61,67,79,72,,65,73,,74,530,,,,,,,,,,,,', +',,,21,20,,,,,,54,,57,,69,12,,63,46,49,,56,47,10,11,,,66,19,,,48,,,17', +'18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67', +'79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,136,,63,46,49', +',56,47,,,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64', +'51,70,71,58,,,62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,', +',,54,,57,,69,136,,63,46,49,,56,47,,,,,66,19,,,48,,,17,18,,,,,,,84,,', +',,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72,,65,73,', +'74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,136,,63,46,49,,56,47,,,,,66', +'19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,', +',62,60,61,67,79,72,,65,73,,74,536,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,', +'69,12,,63,46,49,,56,47,10,11,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,', +',,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72,,65,73,,74,528', +',,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,12,,63,46,49,,56,47,10,11,,,66', '19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,', ',62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69', '12,,63,46,49,,56,47,10,11,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45', '80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72,,65,73,,74,,,,,,,,,', ',,,,,,,21,20,,,,,,54,,57,,69,12,,63,46,49,,56,47,10,11,,,66,19,,,48', ',,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61', -'67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,12,,63,46', -'49,,56,47,10,11,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83', -',,,64,51,70,71,58,,,62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21', -'20,,,,,,54,,57,,69,12,,63,46,49,,56,47,10,11,,,66,19,,,48,,,17,18,,', -',,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72', -',65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,12,,63,46,49,,56,47', +'67,79,72,,65,73,186,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,12,,63', +'46,49,,56,47,10,11,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82', +'83,,,,149,146,70,71,147,153,152,148,60,61,67,79,72,,65,73,191,74,,,', +',,,,,,,,,,,,,21,20,,,,,,54,,57,,69,12,,63,46,49,,56,47,10,11,,,66,19', +',,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,149,146,70,71,147,153', +'152,148,60,61,67,79,72,,65,73,,74,193,,,,,,,,,,,,,,,,21,20,,,,,,54,', +'57,,69,12,,63,46,49,,56,47,10,11,,,66,19,,,48,,,17,18,,,,,,,84,,,,,', +'55,,,,45,80,,82,83,,,,149,146,70,71,147,153,152,148,60,61,67,79,72,', +'65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,12,,63,46,49,,56,47', '10,11,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51', -'70,71,58,,,62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,222', -'237,228,238,69,230,240,232,46,220,,224,218,,,,,66,19,241,236,219,,,17', -'217,,,,,,,84,,,,,239,223,,,,45,80,,82,83,,,,233,221,234,235,229,243', -'242,231,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57', -',69,136,,63,46,49,,56,47,,,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,', -'45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72,,65,73,,74,,,,,,', -',,,,,,,,,,21,20,,,,,,54,,57,,69,136,,63,46,49,,56,47,,,,,66,19,,,48', -',,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61', -'67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,136,,63,46', -'49,,56,47,,,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,', -',64,51,70,71,58,,,62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20', -',,,,,54,,57,,69,136,,63,46,49,,56,47,,,,,66,19,,,48,,,17,18,,,,,,,84', +'70,71,58,,,62,60,61,67,79,72,,65,73,,74,518,,,,,,,,,,,,,,,,21,20,,,', +',,54,,57,,69,12,,63,46,49,,56,47,10,11,,,66,19,,,48,,,17,18,,,,,,,84', ',,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72,,65,73', ',74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,136,,63,46,49,,56,47,,,,,66', '19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,', -',62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69', +',62,60,61,67,79,72,,65,73,,204,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69', '136,,63,46,49,,56,47,,,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80', ',82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,', ',,,,21,20,,,,,,54,,57,,69,136,,63,46,49,,56,47,,,,,66,19,,,48,,,17,18', ',,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79', -'72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,136,,63,46,49,,56', -'47,,,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51', -'70,71,58,,,62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54', -',57,,69,136,,63,46,49,,56,47,,,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55', +'72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,12,,63,46,49,,56', +'47,10,11,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64', +'51,70,71,58,,,62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,', +',,54,,57,,69,12,,63,46,49,,56,47,10,11,,,66,19,,,48,,,17,18,,,,,,,84', +',,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72,,65,73', +',74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,12,,63,46,49,,56,47,10,11', +',,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71', +'58,,,62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57', +',69,12,,63,46,49,,56,47,10,11,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55', +',,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72,,65,73,,74,,,', +',,,,,,,,,,,,,21,20,,,,,,54,,57,,69,12,,63,46,49,,56,47,10,11,,,66,19', +',,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62', +'60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,12,', +'63,46,49,,56,47,10,11,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80', +',82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,', +',,,,21,20,,,,,,54,,57,,69,12,,63,46,49,,56,47,10,11,,,66,19,,,48,,,17', +'18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67', +'79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,12,,63,46,49', +',56,47,10,11,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,', +',,64,51,70,71,58,,,62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20', +',,,,,222,237,228,238,69,230,240,232,46,220,,224,218,,,,,66,19,241,236', +'219,,,17,217,,,,,,,84,,,,,239,223,,,,45,80,,82,83,,,,233,221,234,235', +'229,243,242,231,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,', +',54,,57,,69,136,,63,46,49,,56,47,,,,,66,19,,,48,,,17,18,,,,,,,84,,,', +',,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72,,65,73,,74', +',,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,136,,63,46,49,,56,47,,,,,66,19', +',,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62', +'60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,136', +',63,46,49,,56,47,,,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82', +'83,,,,64,51,70,71,58,,,62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,', +'21,20,,,,,,54,,57,,69,136,,63,46,49,,56,47,,,,,66,19,,,48,,,17,18,,', +',,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72', +',65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,136,,63,46,49,,56,47', +',,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70', +'71,58,,,62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,', +'57,,69,136,,63,46,49,,56,47,,,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55', ',,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72,,65,73,,74,,,', ',,,,,,,,,,,,,21,20,,,,,,54,,57,,69,136,,63,46,49,,56,47,,,,,66,19,,', '48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60', @@ -158,182 +163,179 @@ class Parser < Racc::Parser ',74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,136,,63,46,49,,56,47,,,,,66', '19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,', ',62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69', -'136,,63,46,49,,56,47,,,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,265,45', -'80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72,,65,73,,74,,,,,,,,,', -',,,,,,,21,20,,,,,,54,,57,,69,12,,63,46,49,,56,47,10,11,,,66,19,,,48', -',,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,149,146,70,71,147,153,152', -'148,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69', '136,,63,46,49,,56,47,,,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80', ',82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,', ',,,,21,20,,,,,,54,,57,,69,136,,63,46,49,,56,47,,,,,66,19,,,48,,,17,18', ',,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79', '72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,136,,63,46,49,,56', '47,,,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51', -'70,71,58,,,62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,309,,', -',,54,,57,,69,12,,63,46,49,,56,47,10,11,,,66,19,,,48,,,17,18,,,,,,,84', -',,,,,55,,,,45,80,,82,83,,,,149,146,70,71,147,153,152,148,60,61,67,79', -'72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,12,,63,46,49,,56', -'47,10,11,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,149', -'146,70,71,147,153,152,148,60,61,67,79,72,,65,73,,74,319,,,,,,,,,,,,', -',,,21,20,,,,,,54,,57,,69,12,,63,46,49,,56,47,10,11,,,66,19,,,48,,,17', -'18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67', -'79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,12,,63,46,49', -',56,47,10,11,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,', -',,64,51,70,71,58,,,62,60,61,67,79,72,,65,73,,74,193,,,,,,,,,,,,,,,,21', -'20,,,,,,54,,57,,69,12,,63,46,49,,56,47,10,11,,,66,19,,,48,,,17,18,,', -',,,,84,,,,,,55,,,,45,80,,82,83,,,,149,146,70,71,147,153,152,148,60,61', -'67,79,72,,65,73,,74,,,351,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,136,,63', +'70,71,58,,,62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54', +',57,,69,136,,63,46,49,,56,47,,,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55', +',,265,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72,,65,73,,74', +',,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,12,,63,46,49,,56,47,10,11,,,66', +'19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,149,146,70,71,147', +'153,152,148,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54', +',57,,69,136,,63,46,49,,56,47,,,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55', +',,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72,,65,73,,74,,,', +',,,,,,,,,,,,,21,20,,,,,,54,,57,,69,136,,63,46,49,,56,47,,,,,66,19,,', +'48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60', +'61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,12,,63', +'46,49,,56,47,10,11,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82', +'83,,,,149,146,70,71,147,153,152,148,60,61,67,79,72,,65,73,,74,,,,,,', +',,,,,,,,,,21,20,,,,,,54,,57,,69,12,,63,46,49,,56,47,10,11,,,66,19,,', +'48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60', +'61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,136,,63', '46,49,,56,47,,,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83', ',,,64,51,70,71,58,,,62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21', -'20,,,,,,54,,57,,69,136,,63,46,49,,56,47,,,,,66,19,,,48,,,17,18,,,,,', +'20,,,,,,54,,57,,69,12,,63,46,49,,56,47,10,11,,,66,19,,,48,,,17,18,,', +',,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72', +',65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,12,,63,46,49,,56,47', +'10,11,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,149,146', +'70,71,147,153,152,148,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20', +',,,,,54,,57,,69,12,,63,46,49,,56,47,10,11,,,66,19,,,48,,,17,18,,,,,', ',84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72,,65', '73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,136,,63,46,49,,56,47,,', ',,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71', '58,,,62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57', -',69,136,,63,46,49,,56,47,,,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,', -'45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72,,65,73,,74,,,,,,', -',,,,,,,,,,21,20,,,,,,54,,57,,69,136,,63,46,49,,56,47,,,,,66,19,,,48', -',,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61', -'67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,12,,63,46', -'49,,56,47,10,11,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83', -',,,149,146,70,71,147,153,152,148,60,61,67,79,72,,65,73,,74,,,,,,,,,', -',,,,,,,21,20,,,,,,54,,57,,69,12,,63,46,49,,56,47,10,11,,,66,19,,,48', -',,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,149,146,70,71,147,153,152', -'148,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69', -'12,,63,46,49,,56,47,10,11,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45', -'80,,82,83,,,,149,146,70,71,147,153,152,148,60,61,67,79,72,,65,73,,74', -',,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,12,,63,46,49,,56,47,10,11,,,66', -'19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,', -',62,60,61,67,79,72,,65,73,,74,406,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,', -'69,12,,63,46,49,,56,47,10,11,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,', -',,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72,,65,73,,74,408', -',,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,12,,63,46,49,,56,47,10,11,,,66', -'19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,', -',62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69', -'136,,63,46,49,,56,47,,,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80', +',69,12,,63,46,49,,56,47,10,11,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55', +',,,45,80,,82,83,,,,149,146,70,71,147,153,152,148,60,61,67,79,72,,65', +'73,,74,,,,,,,,,,,,,,,,,21,20,309,,,,,54,,57,,69,12,,63,46,49,,56,47', +'10,11,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,149,146', +'70,71,147,153,152,148,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20', +',,,,,54,,57,,69,12,,63,46,49,,56,47,10,11,,,66,19,,,48,,,17,18,,,,,', +',84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72,,65', +'73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,136,,63,46,49,,56,47,,', +',,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71', +'58,,,62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57', +',69,12,,63,46,49,,56,47,10,11,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55', +',,,45,80,,82,83,,,,149,146,70,71,147,153,152,148,60,61,67,79,72,,65', +'73,,74,319,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,12,,63,46,49,,56,47', +'10,11,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51', +'70,71,58,,,62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54', +',57,,69,12,,63,46,49,,56,47,10,11,,,66,19,,,48,,,17,18,,,,,,,84,,,,', +',55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72,,65,73,,74', +',,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,136,,63,46,49,,56,47,,,,,66,19', +',,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62', +'60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,12,', +'63,46,49,,56,47,10,11,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80', ',82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,', ',,,,21,20,,,,,,54,,57,,69,12,,63,46,49,,56,47,10,11,,,66,19,,,48,,,17', -'18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,149,146,70,71,147,153,152,148', -'60,61,67,79,72,,65,73,,74,430,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,12', -',63,46,49,,56,47,10,11,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80', -',82,83,,,,149,146,70,71,147,153,152,148,60,61,67,79,72,,65,73,,74,,', -',,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,12,,63,46,49,,56,47,10,11,,,66,19', -',,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62', -'60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,136', -',63,46,49,,56,47,,,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82', -'83,,,,64,51,70,71,58,,,62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,', +'18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67', +'79,72,,65,73,,74,477,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,136,,63,46', +'49,,56,47,,,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,', +',64,51,70,71,58,,,62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20', +',,,,,54,,57,,69,12,,63,46,49,,56,47,10,11,,,66,19,,,48,,,17,18,,,,,', +',84,,,,,,55,,,,45,80,,82,83,81,,,64,51,70,71,58,,,62,60,61,67,79,72', +',65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,12,,63,46,49,,56,47', +'10,11,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51', +'70,71,58,,,62,60,61,67,79,72,,65,73,,74,193,,,,,,,,,,,,,,,,21,20,,,', +',,54,,57,,69,12,,63,46,49,,56,47,10,11,,,66,19,,,48,,,17,18,,,,,,,84', +',,,,,55,,,,45,80,,82,83,,,,149,146,70,71,147,153,152,148,60,61,67,79', +'72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,12,,63,46,49,,56', +'47,10,11,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,149', +'146,70,71,147,153,152,148,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,', '21,20,,,,,,54,,57,,69,136,,63,46,49,,56,47,,,,,66,19,,,48,,,17,18,,', ',,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72', -',65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,136,,63,46,49,,56,47', -',,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70', -'71,58,,,62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,', -'57,,69,136,,63,46,49,,56,47,,,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55', +',65,73,,74,,,351,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,136,,63,46,49,,56', +'47,,,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51', +'70,71,58,,,62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54', +',57,,69,136,,63,46,49,,56,47,,,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55', +',,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72,,65,73,,74,,,', +',,,,,,,,,,,,,21,20,,,,,,54,,57,,69,136,,63,46,49,,56,47,,,,,66,19,,', +'48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60', +'61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,136,,63', +'46,49,,56,47,,,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83', +',,,64,51,70,71,58,,,62,60,61,67,79,72,,65,73,,74,463,,,,,,,,,,,,,,,', +'21,20,,,,,,54,,57,,69,12,,63,46,49,,56,47,10,11,,,66,19,,,48,,,17,18', +',,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79', +'72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,136,,63,46,49,,56', +'47,,,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51', +'70,71,58,,,62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54', +',57,,69,136,,63,46,49,,56,47,,,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55', ',,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72,,65,73,,74,,,', ',,,,,,,,,,,,,21,20,,,,,,54,,57,,69,12,,63,46,49,,56,47,10,11,,,66,19', ',,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,149,146,70,71,147,153', '152,148,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57', -',69,136,,63,46,49,,56,47,,,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,', -'45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72,,65,73,,74,463,,', -',,,,,,,,,,,,,21,20,,,,,,54,,57,,69,12,,63,46,49,,56,47,10,11,,,66,19', -',,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62', -'60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,136', -',63,46,49,,56,47,,,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82', -'83,,,,64,51,70,71,58,,,62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,', -'21,20,,,,,,54,,57,,69,12,,63,46,49,,56,47,10,11,,,66,19,,,48,,,17,18', -',,,,,,84,,,,,,55,,,,45,80,,82,83,,,,149,146,70,71,147,153,152,148,60', -'61,67,79,72,,65,73,,74,477,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,136', -',63,46,49,,56,47,,,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82', -'83,,,,64,51,70,71,58,,,62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,', -'21,20,,,,,,54,,57,,69,12,,63,46,49,,56,47,10,11,,,66,19,,,48,,,17,18', -',,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79', -'72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,12,,63,46,49,,56', -'47,10,11,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64', -'51,70,71,58,,,62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,', -',,54,,57,,69,12,,63,46,49,,56,47,10,11,,,66,19,,,48,,,17,18,,,,,,,84', -',,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72,,65,73', -',74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,12,,63,46,49,,56,47,10,11', -',,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,149,146,70', -'71,147,153,152,148,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,', -',,,,54,,57,,69,136,,63,46,49,,56,47,,,,,66,19,,,48,,,17,18,,,,,,,84', -',,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72,,65,73', -',74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,12,,63,46,49,,56,47,10,11', +',69,12,,63,46,49,,56,47,10,11,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55', +',,,45,80,,82,83,,,,149,146,70,71,147,153,152,148,60,61,67,79,72,,65', +'73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,136,,63,46,49,,56,47,,', ',,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71', '58,,,62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57', ',69,12,,63,46,49,,56,47,10,11,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55', ',,,45,80,,82,83,,,,149,146,70,71,147,153,152,148,60,61,67,79,72,,65', '73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,12,,63,46,49,,56,47,10', -'11,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70', -'71,58,,,62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,', -'57,,69,12,,63,46,49,,56,47,10,11,,,66,19,,,48,,,17,18,,,,,,,84,,,,,', -'55,,,,45,80,,82,83,,,,149,146,70,71,147,153,152,148,60,61,67,79,72,', -'65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,136,,63,46,49,,56,47', -',,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70', -'71,58,,,62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,', -'57,,69,136,,63,46,49,,56,47,,,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55', -',,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72,,65,73,,74,518', -',,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,12,,63,46,49,,56,47,10,11,,,66', -'19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,', -',62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69', -'12,,63,46,49,,56,47,10,11,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45', -'80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72,,65,73,,74,528,,,,,', -',,,,,,,,,,21,20,,,,,,54,,57,,69,12,,63,46,49,,56,47,10,11,,,66,19,,', -'48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60', -'61,67,79,72,,65,73,,74,530,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,12,', -'63,46,49,,56,47,10,11,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80', -',82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,', -',,,,21,20,,,,,,54,,57,,69,12,,63,46,49,,56,47,10,11,,,66,19,,,48,,,17', +'11,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,149,146', +'70,71,147,153,152,148,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20', +',,,,,54,,57,,69,12,,63,46,49,,56,47,10,11,,,66,19,,,48,,,17,18,,,,,', +',84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72,,65', +'73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,136,,63,46,49,,56,47,,', +',,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71', +'58,,,62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57', +',69,136,,63,46,49,,56,47,,,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,', +'45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72,,65,73,,74,,,,,,', +',,,,,,,,,,21,20,,,,,,54,,57,,69,136,,63,46,49,,56,47,,,,,66,19,,,48', +',,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61', +'67,79,72,,65,73,,74,406,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,12,,63', +'46,49,,56,47,10,11,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82', +'83,,,,64,51,70,71,58,,,62,60,61,67,79,72,,65,73,,74,408,,,,,,,,,,,,', +',,,21,20,,,,,,54,,57,,69,12,,63,46,49,,56,47,10,11,,,66,19,,,48,,,17', '18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67', -'79,72,,65,73,,74,536,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,12,,63,46', -'49,,56,47,10,11,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83', -',,,64,51,70,71,58,,,62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21', -'20,,,,,,54,,57,,69,136,,63,46,49,,56,47,,,,,66,19,,,48,,,17,18,,,,,', -',84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,116,,62,60,61,,,72,,,', -',112,107,118,,121,,115,,117,,108,110,109,111,,,,,,,,,,,,,,,,120,,,,114', -'113,,,100,101,103,102,105,106,,98,99,116,,310,,,97,,,,,,,112,107,118', -',121,,115,,117,,108,110,109,111,,,,,,,104,,,,,,,,,120,,,,114,113,,,100', -'101,103,102,105,106,,98,99,116,,311,,,97,,,,,,,112,107,118,,121,,115', -',117,,108,110,109,111,,,,,,,104,,,,,,,,,120,,,,114,113,,,100,101,103', -'102,105,106,,98,99,116,,312,,,97,,,,,,,112,107,118,,121,,115,,117,,108', -'110,109,111,,,,,,,104,,,,,,,,,120,,181,79,114,113,182,116,100,101,103', -'102,105,106,,98,99,,,112,107,118,97,121,,115,,117,,108,110,109,111,', -',,,181,79,,,182,179,,,176,,,120,104,,,114,113,,,100,101,103,102,105', -'106,,98,99,84,,,,,97,116,,,,180,80,179,,,176,344,345,112,107,118,348', -'121,116,115,,117,,108,110,109,111,104,,,84,,118,,121,,,,117,,180,80', -'120,,,,114,113,,,100,101,103,102,105,106,,98,99,120,,,116,,97,,,,,103', -'102,,,,98,99,118,,121,116,,97,117,,,,,,,,,104,,118,,121,,,,117,,,,120', -',,,116,104,,,,,103,102,,,,98,99,120,118,,121,116,97,,117,100,101,103', -'102,,,,98,99,,118,,121,,97,,117,,,,120,,,,104,,,,100,101,103,102,,,', -'98,99,120,,,116,104,97,,,100,101,103,102,105,106,,98,99,118,,121,116', -',97,117,,,,,,,,,104,107,118,,121,,,,117,,108,,120,,,,,104,,,100,101', -'103,102,105,106,,98,99,120,,,,116,97,,,100,101,103,102,105,106,,98,99', -'107,118,,121,116,97,,117,,108,,,,,,104,,107,118,,121,,,,117,,108,,120', -',,,104,,,,100,101,103,102,105,106,,98,99,120,,,,116,97,,,100,101,103', -'102,105,106,,98,99,107,118,,121,,97,,117,,108,,,,,,104,,,,,,,,,,,,,120', -',,,104,116,,,100,101,103,102,105,106,,98,99,112,107,118,,121,97,115', -',117,,108,110,109,111,,,,,,,,,,,,,,,,120,,,104,,116,,,100,101,103,102', +'79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,136,,63,46,49', +',56,47,,,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64', +'51,70,71,58,,,62,60,61,67,79,72,,65,73,,74,430,,,,,,,,,,,,,,,,21,20', +',,,,,54,,57,,69,12,,63,46,49,,56,47,10,11,,,66,19,,,48,,,17,18,,,,,', +',84,,,,,,55,,,,45,80,,82,83,,,,149,146,70,71,147,153,152,148,60,61,67', +'79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,12,,63,46,49', +',56,47,10,11,,,66,19,,,48,,,17,18,181,79,,,182,,84,,,,,,55,,,,45,80', +',82,83,,,,149,146,70,71,147,153,152,148,60,61,116,,72,,,,179,,,176,', +',112,107,118,,121,,115,,117,,108,110,109,111,,,,84,181,79,,,182,,,,', +'180,80,120,,,,114,113,,,100,101,103,102,105,106,,98,99,,,,,,97,116,', +',,181,79,179,,182,176,344,345,112,107,118,380,121,,115,,117,,108,110', +'109,111,104,,,84,,,,,,,,,,180,80,120,,,179,114,113,176,116,100,101,103', +'102,105,106,,98,99,,,112,107,118,97,121,,115,84,117,,108,110,109,111', +',,,180,80,,,,,,,,,,,120,104,,,114,113,,,100,101,103,102,105,106,,98', +'99,116,,312,,,97,,,,,,,112,107,118,,121,116,115,,117,,108,110,109,111', +',,,,,118,104,121,,,,117,181,79,,120,182,,,114,113,,,100,101,103,102', +'105,106,,98,99,120,,,,,97,,,100,101,103,102,105,106,,98,99,116,,,179', +',97,176,,,,,,112,107,118,104,121,,115,,117,,108,110,109,111,84,,,,,', +'104,,,,180,80,,,,120,,,,114,113,,116,100,101,103,102,105,106,,98,99', +',,112,107,118,97,121,116,115,,117,,108,110,109,111,,,,,,118,,121,,,', +'117,,,,120,104,,,114,113,,,100,101,103,102,105,106,,98,99,120,,,,,97', +',,,,103,102,,116,,98,99,,,,,,97,,,112,107,118,,121,116,115,104,117,', +'108,110,109,111,,,,,107,118,,121,,,104,117,,108,,120,,,,114,113,,,100', +'101,103,102,105,106,,98,99,120,,,116,,97,,,100,101,103,102,105,106,', +'98,99,118,,121,116,,97,117,,,,,,,,,104,107,118,,121,,,,117,,108,,120', +',,,116,104,,,100,101,103,102,,,,98,99,120,118,,121,,97,,117,100,101', +'103,102,105,106,,98,99,,,,,,97,,,,,,120,,,,104,,,,,,103,102,116,,,98', +'99,,,,,104,97,,112,107,118,,121,,115,,117,,108,110,109,111,,,,,,,,,', +',,104,,,,120,,,,114,113,,116,100,101,103,102,105,106,,98,99,,,,107,118', +'97,121,,,,117,,108,,,,,,,,,,,,,,,,,,,120,104,,,,116,,,100,101,103,102', '105,106,,98,99,112,107,118,,121,97,115,,117,,108,110,109,111,,,,,,,', -',,,,,,,,120,,,104,,113,,,100,101,103,102,105,106,116,98,99,,,354,,,97', -',,,112,107,118,,121,,115,,117,,108,110,109,111,,,,,,,,,,104,,,,,,120', -',,,114,113,,,100,101,103,102,105,106,,98,99,116,-66,,,,97,-66,,,,,,112', -'107,118,,121,,115,,117,,108,110,109,111,,,,,,,104,,,,,,,,,120,,,,114', -'113,,116,100,101,103,102,105,106,,98,99,,,112,107,118,97,121,,115,,117', -',108,110,109,111,,,,,,,,,,,,,,,,120,104,,,114,113,,,100,101,103,102', -'105,106,116,98,99,,,,,,97,,,,112,107,118,380,121,,115,,117,,108,110', -'109,111,,,,,,,,,,104,,,,,,120,,,,114,113,,116,100,101,103,102,105,106', -',98,99,,,112,107,118,97,121,,115,,117,,108,110,109,111,,,,,,,,,,,,,', -',,120,104,,,114,113,,116,100,101,103,102,105,106,,98,99,,,112,107,118', -'97,121,,115,,117,,108,110,109,111,,,,,,,,,,,,,,,,120,104,,,114,113,', -'116,100,101,103,102,105,106,,98,99,,,112,107,118,97,121,,115,,117,,108', -'110,109,111,,,,,,,,,,,,,,,,120,104,,,114,113,,116,100,101,103,102,105', -'106,,98,99,,,112,107,118,97,121,,115,,117,,108,110,109,111,,,,,,,,,', -',,,,,,120,104,,,114,113,,116,100,101,103,102,105,106,,98,99,,,112,107', -'118,97,121,,115,,117,,108,110,109,111,,,,,,,,,,,,,,,,120,104,,,114,113', -',116,100,101,103,102,105,106,,98,99,,,112,107,118,97,121,,115,,117,', -'108,110,109,111,,,,,,,,,,,,,,,,120,104,181,79,114,113,182,116,100,101', +',,,,,,,,120,,,104,114,113,,116,100,101,103,102,105,106,,98,99,,,,107', +'118,97,121,,,,117,,108,,,,,,,,,,,,,,,,,,,120,104,,,,116,,,100,101,103', +'102,105,106,,98,99,112,107,118,,121,97,115,,117,,108,110,109,111,,,', +',,,,,,,,,,,,120,,,104,,116,,,100,101,103,102,105,106,,98,99,112,107', +'118,,121,97,115,,117,,108,110,109,111,,,,,,,,,,,,,,,,120,,,104,,113', +',,100,101,103,102,105,106,116,98,99,,,354,,,97,,,,112,107,118,,121,', +'115,,117,,108,110,109,111,,,,,,,,,,104,,,,,,120,,,,114,113,,,100,101', +'103,102,105,106,,98,99,116,-66,,,,97,-66,,,,,,112,107,118,,121,,115', +',117,,108,110,109,111,,,,,,,104,,,,,,,,,120,,,,114,113,,116,100,101', '103,102,105,106,,98,99,,,112,107,118,97,121,,115,,117,,108,110,109,111', -',,,,181,79,,,182,179,,,176,,,120,104,,,114,113,,,100,101,103,102,105', -'106,,98,99,84,,,,,97,,,,,180,80,179,,,176,,366,237,365,238,,363,240', -'367,,360,,362,364,,,104,,,84,241,236,368,,,,361,,,180,80,,,,,,,,239', +',,,,,,,,,,,,,,,120,104,,,114,113,,116,100,101,103,102,105,106,,98,99', +',,112,107,118,97,121,,115,,117,,108,110,109,111,,,,,,,,,,,,,,,,120,104', +',,114,113,,,100,101,103,102,105,106,116,98,99,,,,,,97,,,,112,107,118', +'348,121,116,115,,117,,108,110,109,111,,,,,,118,,121,,104,,117,,,,120', +',,,114,113,,,100,101,103,102,105,106,,98,99,120,,,116,,97,,,100,101', +'103,102,,,,98,99,118,,121,,,97,117,,,,,,,,,104,,,,,,,,,,,,120,,,,,104', +',,100,101,103,102,105,106,,98,99,116,,310,,,97,,,,,,,112,107,118,,121', +',115,,117,,108,110,109,111,,,,,,,104,,,,,,,,,120,,,,114,113,,,100,101', +'103,102,105,106,,98,99,116,,311,,,97,,,,,,,112,107,118,,121,,115,,117', +',108,110,109,111,,,,,,,104,,,,,,,,,120,,,,114,113,,116,100,101,103,102', +'105,106,,98,99,,,112,107,118,97,121,,115,,117,,108,110,109,111,,,,,', +',,,,,,,,,,120,104,,,114,113,,,100,101,103,102,105,106,,98,99,,366,237', +'365,238,97,363,240,367,,360,,362,364,,,,,,,241,236,368,,,,361,,,,,,104', +',,,,,239,369,,,,,,,,,,,,372,370,373,371,374,243,242,375,366,237,365', +'238,,363,240,367,,360,,362,364,,,,,,,241,236,368,,,,361,,,,,,,,,,,,239', '369,,,,,,,,,,,,372,370,373,371,374,243,242,375,366,237,365,238,,363', '240,367,,360,,362,364,,,,,,,241,236,368,,,,361,,,,,,,,,,,,239,369,,', ',,,,,,,,,372,370,373,371,374,243,242,375,366,237,365,238,,363,240,367', @@ -342,10 +344,8 @@ class Parser < Racc::Parser '362,364,,,,,,,241,236,368,,,,361,,,,,,,,,,,,239,369,,,,,,,,,,,,372,370', '373,371,374,243,242,375,366,237,365,238,,363,240,367,,360,,362,364,', ',,,,,241,236,368,,,,361,,,,,,,,,,,,239,369,,,,,,,,,,,,372,370,373,371', -'374,243,242,375,366,237,365,238,,363,240,367,,360,,362,364,,,,,,,241', -'236,368,,,,361,,,,,,,,,,,,239,369,,,,,,,,,,,,372,370,373,371,374,243', -'242,375' ] - racc_action_table = arr = ::Array.new(10648, nil) +'374,243,242,375' ] + racc_action_table = arr = ::Array.new(10662, nil) idx = 0 clist.each do |str| str.split(',', -1).each do |i| @@ -355,353 +355,353 @@ class Parser < Racc::Parser end clist = [ -'0,0,160,220,0,0,306,0,7,7,7,184,245,184,218,160,324,322,324,219,1,227', -'234,160,0,0,245,306,245,235,5,0,245,0,8,0,0,160,0,0,0,157,0,0,0,0,220', -'52,0,0,322,53,0,245,184,0,0,218,7,7,7,7,219,0,227,234,57,118,61,0,57', -'157,235,0,0,245,0,0,0,220,220,0,0,0,0,0,62,246,0,0,0,4,4,0,68,4,4,135', -'4,184,51,246,57,246,80,308,57,246,230,118,81,135,230,135,57,4,4,135', -'230,146,308,85,4,51,4,87,4,4,246,4,4,4,4,4,4,4,4,249,135,4,4,119,146', -'4,230,399,4,4,230,192,246,249,192,249,4,12,230,249,399,12,4,230,12,122', -'4,4,399,4,4,221,16,16,4,4,4,4,4,202,249,4,4,4,10,10,4,123,10,10,137', -'10,202,12,221,249,249,12,410,406,202,406,249,139,137,12,137,410,10,10', -'137,392,140,504,202,10,392,10,504,10,10,138,10,10,10,141,10,10,10,10', -'250,137,10,10,282,138,10,138,144,10,10,138,145,282,250,148,250,10,58', -'468,250,468,58,10,150,60,282,10,10,60,10,10,138,155,282,10,10,10,10', -'10,159,250,10,10,10,11,11,10,172,11,11,174,11,185,58,188,250,250,58', -'49,49,60,190,250,206,60,58,200,200,11,11,200,211,60,59,59,11,212,11', -'213,11,11,244,11,11,11,214,11,11,11,11,251,216,11,11,283,244,11,244', -'231,11,11,244,267,283,251,274,251,11,64,276,251,277,64,11,280,132,283', -'11,11,132,11,11,244,284,283,11,11,11,11,11,288,251,11,11,11,17,17,11', -'293,17,17,294,17,295,64,136,251,251,64,136,298,132,304,251,305,132,64', -'65,65,17,17,66,66,132,313,147,17,314,17,147,17,17,315,17,17,17,316,17', -'17,67,67,136,317,17,17,136,318,17,125,125,17,17,320,136,166,166,149', -'323,17,168,149,147,327,168,17,147,228,329,17,17,228,17,17,147,167,167', -'17,17,17,17,17,169,169,17,17,17,18,18,17,341,18,18,149,18,346,168,149', -'229,347,168,349,229,228,355,149,357,228,168,233,359,18,18,233,361,228', -'183,183,18,378,18,381,18,18,385,18,18,18,387,18,18,197,197,390,229,18', -'18,393,229,18,434,434,18,18,394,233,229,397,383,233,18,398,383,405,407', -'408,18,233,417,419,18,18,424,18,18,433,435,442,18,18,18,18,18,446,449', -'18,18,18,19,19,18,454,19,19,383,19,455,456,383,462,471,383,472,474,476', -'479,383,482,483,484,485,489,19,19,492,493,498,501,502,19,514,19,517', -'19,19,519,19,19,19,520,19,19,527,529,531,535,19,19,540,,19,,,19,19,', -',,,,,19,,,,,,19,,,,19,19,,19,19,,,,19,19,19,19,19,,,19,19,19,20,20,19', -',20,20,,20,,,,,,,,,,,,,,,,,20,20,,,,,,20,,20,,20,20,,20,20,20,,20,20', -'20,20,,,20,20,,,20,,,20,20,,,,,,,20,,,,,,20,,,,20,20,,20,20,,,,20,20', -'20,20,20,,,20,20,20,21,21,20,,21,21,,21,,,,,,,,,,,,,,,,,21,21,,,,,,21', -',21,,21,21,,21,21,21,,21,21,21,21,,,21,21,,,21,,,21,21,,,,,,,21,,,,', -',21,,,,21,21,,21,21,,,,21,21,21,21,21,,,21,21,21,50,50,21,,50,50,,50', -',,,,,,,,,,,,,,,,50,50,50,,,,,50,,50,,50,50,,50,50,50,,50,50,50,50,,', -'50,50,,,50,,,50,50,,,,,,,50,,,,,,50,,,,50,50,,50,50,,,,50,50,50,50,50', -'50,50,50,50,50,54,54,50,,54,54,,54,,,,,,,,,,,,,,,,,54,54,,,,,,54,,54', -',54,54,,54,54,54,,54,54,,,,,54,54,,,54,,,54,54,,,,,,,54,,,,,,54,,,,54', -'54,,54,54,,,,54,54,54,54,54,,,54,54,54,55,55,54,,55,55,,55,,,,,,,,,', -',,,,,,,55,55,,,,,,55,,55,,55,55,,55,55,55,,55,55,,,,,55,55,,,55,,,55', -'55,,,,,,,55,,,,,,55,,,,55,55,,55,55,,,,55,55,55,55,55,,,55,55,55,56', -'56,55,,56,56,,56,,,,,,,,,,,,,,,,,56,56,,,,,,56,,56,,56,56,,56,56,56', -',56,56,,,,,56,56,,,56,,,56,56,,,,,,,56,,,,,,56,,,,56,56,,56,56,,,,56', -'56,56,56,56,,,56,56,56,72,72,56,,72,72,72,72,,,,,,,,,,,,,,,,,72,72,', -',,,,72,,72,,72,72,,72,72,72,,72,72,72,72,,,72,72,,,72,,,72,72,,,,,,', -'72,,,,,,72,,,,72,72,,72,72,,,,72,72,72,72,72,72,72,72,72,72,73,73,72', -',73,73,73,73,,,,,,,,,,,,,,,,,73,73,,,,,,73,,73,,73,73,,73,73,73,,73', -'73,73,73,,,73,73,,,73,,,73,73,,,,,,,73,,,,,,73,,,,73,73,,73,73,,,,73', -'73,73,73,73,73,73,73,73,73,74,74,73,,74,74,,74,74,,,,,,,,,,,,,,,,74', -'74,,,,,,74,,74,,74,74,,74,74,74,,74,74,74,74,,,74,74,,,74,,,74,74,,', -',,,,74,,,,,,74,,,,74,74,,74,74,,,,74,74,74,74,74,74,74,74,74,74,78,78', -'74,,78,78,,78,,,,,,,,,,,,,,,,,78,78,,,,,,78,,78,,78,78,,78,78,78,,78', -'78,78,78,,,78,78,,,78,,,78,78,,,,,,,78,,,,,,78,,,,78,78,,78,78,,,,78', -'78,78,78,78,,,78,78,78,83,83,78,,83,83,,83,,,,,,,,,,,,,,,,,83,83,,,', -',,83,,83,,83,83,,83,83,83,,83,83,,,,,83,83,,,83,,,83,83,,,,,,,83,,,', -',,83,,,,83,83,,83,83,,,,83,83,83,83,83,,,83,83,83,86,86,83,,86,86,,86', -',,,,,,,,,,,,,,,,86,86,,,,,,86,,86,,86,86,,86,86,86,,86,86,86,86,,,86', -'86,,,86,,,86,86,,,,,,,86,,,,,,86,,,,86,86,,86,86,,,,86,86,86,86,86,', -',86,86,86,88,88,86,,88,88,,88,,,,,,,,,,,,,,,,,88,88,,,,,,88,,88,,88', -'88,,88,88,88,,88,88,88,88,,,88,88,,,88,,,88,88,,,,,,,88,,,,,,88,,,,88', -'88,,88,88,,,,88,88,88,88,88,,,88,88,88,89,89,88,,89,89,,89,,,,,,,,,', -',,,,,,,89,89,,,,,,89,,89,,89,89,,89,89,89,,89,89,89,89,,,89,89,,,89', -',,89,89,,,,,,,89,,,,,,89,,,,89,89,,89,89,,,,89,89,89,89,89,,,89,89,89', -'90,90,89,,90,90,,90,,,,,,,,,,,,,,,,,90,90,,,,,,90,,90,,90,90,,90,90', -'90,,90,90,90,90,,,90,90,,,90,,,90,90,,,,,,,90,,,,,,90,,,,90,90,,90,90', -',,,90,90,90,90,90,,,90,90,90,91,91,90,,91,91,,91,,,,,,,,,,,,,,,,,91', -'91,,,,,,91,,91,,91,91,,91,91,91,,91,91,91,91,,,91,91,,,91,,,91,91,,', -',,,,91,,,,,,91,,,,91,91,,91,91,,,,91,91,91,91,91,,,91,91,91,92,92,91', -',92,92,,92,,,,,,,,,,,,,,,,,92,92,,,,,,92,,92,,92,92,,92,92,92,,92,92', -'92,92,,,92,92,,,92,,,92,92,,,,,,,92,,,,,,92,,,,92,92,,92,92,,,,92,92', -'92,92,92,,,92,92,92,93,93,92,,93,93,,93,,,,,,,,,,,,,,,,,93,93,,,,,,93', -',93,,93,93,,93,93,93,,93,93,93,93,,,93,93,,,93,,,93,93,,,,,,,93,,,,', -',93,,,,93,93,,93,93,,,,93,93,93,93,93,,,93,93,93,94,94,93,,94,94,,94', -',,,,,,,,,,,,,,,,94,94,,,,,,94,,94,,94,94,,94,94,94,,94,94,94,94,,,94', -'94,,,94,,,94,94,,,,,,,94,,,,,,94,,,,94,94,,94,94,,,,94,94,94,94,94,', -',94,94,94,95,95,94,,95,95,,95,,,,,,,,,,,,,,,,,95,95,,,,,,95,,95,,95', -'95,,95,95,95,,95,95,95,95,,,95,95,,,95,,,95,95,,,,,,,95,,,,,,95,,,,95', -'95,,95,95,,,,95,95,95,95,95,,,95,95,95,96,96,95,,96,96,,96,,,,,,,,,', -',,,,,,,96,96,,,,,,96,96,96,96,96,96,96,96,96,96,,96,96,,,,,96,96,96', -'96,96,,,96,96,,,,,,,96,,,,,96,96,,,,96,96,,96,96,,,,96,96,96,96,96,96', -'96,96,96,96,97,97,96,,97,97,,97,,,,,,,,,,,,,,,,,97,97,,,,,,97,,97,,97', -'97,,97,97,97,,97,97,,,,,97,97,,,97,,,97,97,,,,,,,97,,,,,,97,,,,97,97', -',97,97,,,,97,97,97,97,97,,,97,97,97,98,98,97,,98,98,,98,,,,,,,,,,,,', -',,,,98,98,,,,,,98,,98,,98,98,,98,98,98,,98,98,,,,,98,98,,,98,,,98,98', -',,,,,,98,,,,,,98,,,,98,98,,98,98,,,,98,98,98,98,98,,,98,98,98,99,99', -'98,,99,99,,99,,,,,,,,,,,,,,,,,99,99,,,,,,99,,99,,99,99,,99,99,99,,99', -'99,,,,,99,99,,,99,,,99,99,,,,,,,99,,,,,,99,,,,99,99,,99,99,,,,99,99', -'99,99,99,,,99,99,99,100,100,99,,100,100,,100,,,,,,,,,,,,,,,,,100,100', -',,,,,100,,100,,100,100,,100,100,100,,100,100,,,,,100,100,,,100,,,100', -'100,,,,,,,100,,,,,,100,,,,100,100,,100,100,,,,100,100,100,100,100,,', -'100,100,100,101,101,100,,101,101,,101,,,,,,,,,,,,,,,,,101,101,,,,,,101', -',101,,101,101,,101,101,101,,101,101,,,,,101,101,,,101,,,101,101,,,,', -',,101,,,,,,101,,,,101,101,,101,101,,,,101,101,101,101,101,,,101,101', -'101,102,102,101,,102,102,,102,,,,,,,,,,,,,,,,,102,102,,,,,,102,,102', -',102,102,,102,102,102,,102,102,,,,,102,102,,,102,,,102,102,,,,,,,102', -',,,,,102,,,,102,102,,102,102,,,,102,102,102,102,102,,,102,102,102,103', -'103,102,,103,103,,103,,,,,,,,,,,,,,,,,103,103,,,,,,103,,103,,103,103', -',103,103,103,,103,103,,,,,103,103,,,103,,,103,103,,,,,,,103,,,,,,103', -',,,103,103,,103,103,,,,103,103,103,103,103,,,103,103,103,104,104,103', -',104,104,,104,,,,,,,,,,,,,,,,,104,104,,,,,,104,,104,,104,104,,104,104', -'104,,104,104,,,,,104,104,,,104,,,104,104,,,,,,,104,,,,,,104,,,,104,104', -',104,104,,,,104,104,104,104,104,,,104,104,104,105,105,104,,105,105,', -'105,,,,,,,,,,,,,,,,,105,105,,,,,,105,,105,,105,105,,105,105,105,,105', -'105,,,,,105,105,,,105,,,105,105,,,,,,,105,,,,,,105,,,,105,105,,105,105', -',,,105,105,105,105,105,,,105,105,105,106,106,105,,106,106,,106,,,,,', -',,,,,,,,,,,106,106,,,,,,106,,106,,106,106,,106,106,106,,106,106,,,,', -'106,106,,,106,,,106,106,,,,,,,106,,,,,,106,,,,106,106,,106,106,,,,106', -'106,106,106,106,,,106,106,106,107,107,106,,107,107,,107,,,,,,,,,,,,', -',,,,107,107,,,,,,107,,107,,107,107,,107,107,107,,107,107,,,,,107,107', -',,107,,,107,107,,,,,,,107,,,,,,107,,,,107,107,,107,107,,,,107,107,107', -'107,107,,,107,107,107,108,108,107,,108,108,,108,,,,,,,,,,,,,,,,,108', -'108,,,,,,108,,108,,108,108,,108,108,108,,108,108,,,,,108,108,,,108,', -',108,108,,,,,,,108,,,,,,108,,,,108,108,,108,108,,,,108,108,108,108,108', -',,108,108,108,109,109,108,,109,109,,109,,,,,,,,,,,,,,,,,109,109,,,,', -',109,,109,,109,109,,109,109,109,,109,109,,,,,109,109,,,109,,,109,109', -',,,,,,109,,,,,,109,,,,109,109,,109,109,,,,109,109,109,109,109,,,109', -'109,109,110,110,109,,110,110,,110,,,,,,,,,,,,,,,,,110,110,,,,,,110,', -'110,,110,110,,110,110,110,,110,110,,,,,110,110,,,110,,,110,110,,,,,', -',110,,,,,,110,,,,110,110,,110,110,,,,110,110,110,110,110,,,110,110,110', -'111,111,110,,111,111,,111,,,,,,,,,,,,,,,,,111,111,,,,,,111,,111,,111', -'111,,111,111,111,,111,111,,,,,111,111,,,111,,,111,111,,,,,,,111,,,,', -',111,,,,111,111,,111,111,,,,111,111,111,111,111,,,111,111,111,112,112', -'111,,112,112,,112,,,,,,,,,,,,,,,,,112,112,,,,,,112,,112,,112,112,,112', -'112,112,,112,112,,,,,112,112,,,112,,,112,112,,,,,,,112,,,,,,112,,,,112', -'112,,112,112,,,,112,112,112,112,112,,,112,112,112,113,113,112,,113,113', -',113,,,,,,,,,,,,,,,,,113,113,,,,,,113,,113,,113,113,,113,113,113,,113', -'113,,,,,113,113,,,113,,,113,113,,,,,,,113,,,,,,113,,,,113,113,,113,113', -',,,113,113,113,113,113,,,113,113,113,114,114,113,,114,114,,114,,,,,', -',,,,,,,,,,,114,114,,,,,,114,,114,,114,114,,114,114,114,,114,114,,,,', -'114,114,,,114,,,114,114,,,,,,,114,,,,,,114,,,,114,114,,114,114,,,,114', -'114,114,114,114,,,114,114,114,115,115,114,,115,115,,115,,,,,,,,,,,,', -',,,,115,115,,,,,,115,,115,,115,115,,115,115,115,,115,115,,,,,115,115', -',,115,,,115,115,,,,,,,115,,,,,,115,,,115,115,115,,115,115,,,,115,115', -'115,115,115,,,115,115,115,116,116,115,,116,116,,116,,,,,,,,,,,,,,,,', -'116,116,,,,,,116,,116,,116,116,,116,116,116,,116,116,116,116,,,116,116', -',,116,,,116,116,,,,,,,116,,,,,,116,,,,116,116,,116,116,,,,116,116,116', -'116,116,116,116,116,116,116,120,120,116,,120,120,,120,,,,,,,,,,,,,,', -',,120,120,,,,,,120,,120,,120,120,,120,120,120,,120,120,,,,,120,120,', -',120,,,120,120,,,,,,,120,,,,,,120,,,,120,120,,120,120,,,,120,120,120', -'120,120,,,120,120,120,121,121,120,,121,121,,121,,,,,,,,,,,,,,,,,121', -'121,,,,,,121,,121,,121,121,,121,121,121,,121,121,,,,,121,121,,,121,', -',121,121,,,,,,,121,,,,,,121,,,,121,121,,121,121,,,,121,121,121,121,121', -',,121,121,121,124,124,121,,124,124,,124,,,,,,,,,,,,,,,,,124,124,,,,', -',124,,124,,124,124,,124,124,124,,124,124,,,,,124,124,,,124,,,124,124', -',,,,,,124,,,,,,124,,,,124,124,,124,124,,,,124,124,124,124,124,,,124', -'124,124,161,161,124,,161,161,,161,,,,,,,,,,,,,,,,,161,161,161,,,,,161', -',161,,161,161,,161,161,161,,161,161,161,161,,,161,161,,,161,,,161,161', -',,,,,,161,,,,,,161,,,,161,161,,161,161,,,,161,161,161,161,161,161,161', -'161,161,161,170,170,161,,170,170,,170,,,,,,,,,,,,,,,,,170,170,,,,,,170', -',170,,170,170,,170,170,170,,170,170,170,170,,,170,170,,,170,,,170,170', -',,,,,,170,,,,,,170,,,,170,170,,170,170,,,,170,170,170,170,170,170,170', -'170,170,170,171,171,170,,171,171,,171,171,,,,,,,,,,,,,,,,171,171,,,', -',,171,,171,,171,171,,171,171,171,,171,171,171,171,,,171,171,,,171,,', -'171,171,,,,,,,171,,,,,,171,,,,171,171,,171,171,,,,171,171,171,171,171', -',,171,171,171,201,201,171,,201,201,,201,,,,,,,,,,,,,,,,,201,201,,,,', -',201,,201,,201,201,,201,201,201,,201,201,201,201,,,201,201,,,201,,,201', -'201,,,,,,,201,,,,,,201,,,,201,201,,201,201,,,,201,201,201,201,201,,', -'201,201,201,204,204,201,,204,204,,204,204,,,,,,,,,,,,,,,,204,204,,,', -',,204,,204,,204,204,,204,204,204,,204,204,204,204,,,204,204,,,204,,', -'204,204,,,,,,,204,,,,,,204,,,,204,204,,204,204,,,,204,204,204,204,204', -'204,204,204,204,204,217,217,204,,217,217,,217,,,217,,,,,,,,,,,,,,217', -'217,,,,,,217,,217,,217,217,,217,217,217,,217,217,,,,,217,217,,,217,', -',217,217,,,,,,,217,,,,,,217,,,,217,217,,217,217,,,,217,217,217,217,217', -',,217,217,217,222,222,217,,222,222,,222,,,,,,,,,,,,,,,,,222,222,,,,', -',222,,222,,222,222,,222,222,222,,222,222,,,,,222,222,,,222,,,222,222', -',,,,,,222,,,,,,222,,,,222,222,,222,222,,,,222,222,222,222,222,,,222', -'222,222,223,223,222,,223,223,,223,,,,,,,,,,,,,,,,,223,223,,,,,,223,', -'223,,223,223,,223,223,223,,223,223,,,,,223,223,,,223,,,223,223,,,,,', -',223,,,,,,223,,,,223,223,,223,223,,,,223,223,223,223,223,,,223,223,223', -'224,224,223,,224,224,,224,,,,,,,,,,,,,,,,,224,224,,,,,,224,,224,,224', -'224,,224,224,224,,224,224,,,,,224,224,,,224,,,224,224,,,,,,,224,,,,', -',224,,,,224,224,,224,224,,,,224,224,224,224,224,,,224,224,224,265,265', -'224,,265,265,,265,,,,,,,,,,,,,,,,,265,265,,,,,,265,,265,,265,265,,265', -'265,265,,265,265,,,,,265,265,,,265,,,265,265,,,,,,,265,,,,,,265,,,,265', -'265,,265,265,,,,265,265,265,265,265,,,265,265,265,287,287,265,,287,287', -',287,,,,,,,,,,,,,,,,,287,287,,,,,,287,,287,,287,287,,287,287,287,,287', -'287,287,287,,,287,287,,,287,,,287,287,,,,,,,287,,,,,,287,,,,287,287', -',287,287,,,,287,287,287,287,287,287,287,287,287,287,290,290,287,,290', -'290,,290,,,,,,,,,,,,,,,,,290,290,,,,,,290,,290,,290,290,,290,290,290', -',290,290,290,290,,,290,290,,,290,,,290,290,,,,,,,290,,,,,,290,,,,290', -'290,,290,290,,,,290,290,290,290,290,290,290,290,290,290,291,291,290', -',291,291,,291,,,,,,,,,,,,,,,,,291,291,,,,,,291,,291,,291,291,,291,291', -'291,,291,291,291,291,,,291,291,,,291,,,291,291,,,,,,,291,,,,,,291,,', -',291,291,,291,291,,,,291,291,291,291,291,291,291,291,291,291,292,292', -'291,,292,292,,292,,,,,,,,,,,,,,,,,292,292,,,,,,292,,292,,292,292,,292', -'292,292,,292,292,292,292,,,292,292,,,292,,,292,292,,,,,,,292,,,,,,292', -',,,292,292,,292,292,,,,292,292,292,292,292,,,292,292,292,310,310,292', -',310,310,,310,310,,,,,,,,,,,,,,,,310,310,,,,,,310,,310,,310,310,,310', -'310,310,,310,310,310,310,,,310,310,,,310,,,310,310,,,,,,,310,,,,,,310', -',,,310,310,,310,310,,,,310,310,310,310,310,,,310,310,310,311,311,310', -',311,311,,311,311,,,,,,,,,,,,,,,,311,311,,,,,,311,,311,,311,311,,311', -'311,311,,311,311,311,311,,,311,311,,,311,,,311,311,,,,,,,311,,,,,,311', -',,,311,311,,311,311,,,,311,311,311,311,311,,,311,311,311,312,312,311', -',312,312,,312,,,,,,,,,,,,,,,,,312,312,,,,,,312,,312,,312,312,,312,312', -'312,,312,312,,,,,312,312,,,312,,,312,312,,,,,,,312,,,,,,312,,,,312,312', -',312,312,,,,312,312,312,312,312,,,312,312,312,328,328,312,,328,328,', -'328,,,,,,,,,,,,,,,,,328,328,,,,,,328,,328,,328,328,,328,328,328,,328', -'328,328,328,,,328,328,,,328,,,328,328,,,,,,,328,,,,,,328,,,,328,328', -',328,328,,,,328,328,328,328,328,328,328,328,328,328,331,331,328,,331', -'331,,331,331,,,,,,,,,,,,,,,,331,331,,,,,,331,,331,,331,331,,331,331', -'331,,331,331,331,331,,,331,331,,,331,,,331,331,,,,,,,331,,,,,,331,,', -',331,331,,331,331,,,,331,331,331,331,331,331,331,331,331,331,336,336', -'331,,336,336,,336,,,,,,,,,,,,,,,,,336,336,,,,,,336,,336,,336,336,,336', -'336,336,,336,336,336,336,,,336,336,,,336,,,336,336,,,,,,,336,,,,,,336', -',,,336,336,,336,336,,,,336,336,336,336,336,,,336,336,336,351,351,336', -',351,351,,351,,,,,,,,,,,,,,,,,351,351,,,,,,351,,351,,351,351,,351,351', -'351,,351,351,,,,,351,351,,,351,,,351,351,,,,,,,351,,,,,,351,,,,351,351', -',351,351,,,,351,351,351,351,351,,,351,351,351,352,352,351,,352,352,', -'352,,,,,,,,,,,,,,,,,352,352,,,,,,352,,352,,352,352,,352,352,352,,352', -'352,,,,,352,352,,,352,,,352,352,,,,,,,352,,,,,,352,,,,352,352,,352,352', -',,,352,352,352,352,352,,,352,352,352,353,353,352,,353,353,,353,,,,,', -',,,,,,,,,,,353,353,,,,,,353,,353,,353,353,,353,353,353,,353,353,,,,', -'353,353,,,353,,,353,353,,,,,,,353,,,,,,353,,,,353,353,,353,353,,,,353', -'353,353,353,353,,,353,353,353,354,354,353,,354,354,,354,,,,,,,,,,,,', -',,,,354,354,,,,,,354,,354,,354,354,,354,354,354,,354,354,,,,,354,354', -',,354,,,354,354,,,,,,,354,,,,,,354,,,,354,354,,354,354,,,,354,354,354', -'354,354,,,354,354,354,358,358,354,,358,358,,358,,,,,,,,,,,,,,,,,358', -'358,,,,,,358,,358,,358,358,,358,358,358,,358,358,358,358,,,358,358,', -',358,,,358,358,,,,,,,358,,,,,,358,,,,358,358,,358,358,,,,358,358,358', -'358,358,358,358,358,358,358,379,379,358,,379,379,,379,,,,,,,,,,,,,,', -',,379,379,,,,,,379,,379,,379,379,,379,379,379,,379,379,,,,,379,379,', -',379,,,379,379,,,,,,,379,,,,,,379,,,,379,379,,379,379,,,,379,379,379', -'379,379,,,379,379,379,396,396,379,,396,396,,396,396,,,,,,,,,,,,,,,,396', -'396,,,,,,396,,396,,396,396,,396,396,396,,396,396,396,396,,,396,396,', -',396,,,396,396,,,,,,,396,,,,,,396,,,,396,396,,396,396,,,,396,396,396', -'396,396,,,396,396,396,400,400,396,,400,400,,400,,,,,,,,,,,,,,,,,400', -'400,,,,,,400,,400,,400,400,,400,400,400,,400,400,,,,,400,400,,,400,', -',400,400,,,,,,,400,,,,,,400,,,,400,400,,400,400,,,,400,400,400,400,400', -',,400,400,400,403,403,400,,403,403,,403,,,,,,,,,,,,,,,,,403,403,,,,', -',403,,403,,403,403,,403,403,403,,403,403,403,403,,,403,403,,,403,,,403', -'403,,,,,,,403,,,,,,403,,,,403,403,,403,403,,,,403,403,403,403,403,403', -'403,403,403,403,411,411,403,,411,411,,411,411,,,,,,,,,,,,,,,,411,411', -',,,,,411,,411,,411,411,,411,411,411,,411,411,,,,,411,411,,,411,,,411', -'411,,,,,,,411,,,,,,411,,,,411,411,,411,411,,,,411,411,411,411,411,,', -'411,411,411,413,413,411,,413,413,,413,,,,,,,,,,,,,,,,,413,413,,,,,,413', -',413,,413,413,,413,413,413,,413,413,413,413,,,413,413,,,413,,,413,413', -',,,,,,413,,,,,,413,,,,413,413,,413,413,,,,413,413,413,413,413,,,413', -'413,413,414,414,413,,414,414,,414,,,,,,,,,,,,,,,,,414,414,,,,,,414,', -'414,,414,414,,414,414,414,,414,414,414,414,,,414,414,,,414,,,414,414', -',,,,,,414,,,,,,414,,,,414,414,,414,414,,,,414,414,414,414,414,,,414', -'414,414,416,416,414,,416,416,,416,,,,,,,,,,,,,,,,,416,416,,,,,,416,', -'416,,416,416,,416,416,416,,416,416,416,416,,,416,416,,,416,,,416,416', -',,,,,,416,,,,,,416,,,,416,416,,416,416,,,,416,416,416,416,416,,,416', -'416,416,426,426,416,,426,426,,426,,,,,,,,,,,,,,,,,426,426,,,,,,426,', -'426,,426,426,,426,426,426,,426,426,426,426,,,426,426,,,426,,,426,426', -',,,,,,426,,,,,,426,,,,426,426,,426,426,,,,426,426,426,426,426,426,426', -'426,426,426,443,443,426,,443,443,,443,,,,,,,,,,,,,,,,,443,443,,,,,,443', -',443,,443,443,,443,443,443,,443,443,,,,,443,443,,,443,,,443,443,,,,', -',,443,,,,,,443,,,,443,443,,443,443,,,,443,443,443,443,443,,,443,443', -'443,450,450,443,,450,450,,450,,,,,,,,,,,,,,,,,450,450,,,,,,450,,450', -',450,450,,450,450,450,,450,450,450,450,,,450,450,,,450,,,450,450,,,', -',,,450,,,,,,450,,,,450,450,,450,450,,,,450,450,450,450,450,,,450,450', -'450,458,458,450,,458,458,,458,,,,,,,,,,,,,,,,,458,458,,,,,,458,,458', -',458,458,,458,458,458,,458,458,458,458,,,458,458,,,458,,,458,458,,,', -',,,458,,,,,,458,,,,458,458,,458,458,,,,458,458,458,458,458,458,458,458', -'458,458,461,461,458,,461,461,,461,,,,,,,,,,,,,,,,,461,461,,,,,,461,', -'461,,461,461,,461,461,461,,461,461,461,461,,,461,461,,,461,,,461,461', -',,,,,,461,,,,,,461,,,,461,461,,461,461,,,,461,461,461,461,461,,,461', -'461,461,464,464,461,,464,464,,464,,,,,,,,,,,,,,,,,464,464,,,,,,464,', -'464,,464,464,,464,464,464,,464,464,464,464,,,464,464,,,464,,,464,464', -',,,,,,464,,,,,,464,,,,464,464,,464,464,,,,464,464,464,464,464,464,464', -'464,464,464,470,470,464,,470,470,,470,,,,,,,,,,,,,,,,,470,470,,,,,,470', -',470,,470,470,,470,470,470,,470,470,,,,,470,470,,,470,,,470,470,,,,', -',,470,,,,,,470,,,,470,470,,470,470,,,,470,470,470,470,470,,,470,470', -'470,475,475,470,,475,475,,475,,,,,,,,,,,,,,,,,475,475,,,,,,475,,475', -',475,475,,475,475,475,,475,475,,,,,475,475,,,475,,,475,475,,,,,,,475', -',,,,,475,,,,475,475,,475,475,,,,475,475,475,475,475,,,475,475,475,486', -'486,475,,486,486,,486,486,,,,,,,,,,,,,,,,486,486,,,,,,486,,486,,486', -'486,,486,486,486,,486,486,486,486,,,486,486,,,486,,,486,486,,,,,,,486', -',,,,,486,,,,486,486,,486,486,,,,486,486,486,486,486,,,486,486,486,488', -'488,486,,488,488,,488,,,,,,,,,,,,,,,,,488,488,,,,,,488,,488,,488,488', -',488,488,488,,488,488,488,488,,,488,488,,,488,,,488,488,,,,,,,488,,', -',,,488,,,,488,488,,488,488,,,,488,488,488,488,488,,,488,488,488,507', -'507,488,,507,507,,507,507,,,,,,,,,,,,,,,,507,507,,,,,,507,,507,,507', -'507,,507,507,507,,507,507,507,507,,,507,507,,,507,,,507,507,,,,,,,507', -',,,,,507,,,,507,507,,507,507,,,,507,507,507,507,507,,,507,507,507,509', -'509,507,,509,509,,509,509,,,,,,,,,,,,,,,,509,509,,,,,,509,,509,,509', -'509,,509,509,509,,509,509,509,509,,,509,509,,,509,,,509,509,,,,,,,509', -',,,,,509,,,,509,509,,509,509,,,,509,509,509,509,509,,,509,509,509,511', -'511,509,,511,511,,511,,,,,,,,,,,,,,,,,511,511,,,,,,511,,511,,511,511', -',511,511,511,,511,511,511,511,,,511,511,,,511,,,511,511,,,,,,,511,,', -',,,511,,,,511,511,,511,511,,,,511,511,511,511,511,,,511,511,511,516', -'516,511,,516,516,,516,516,,,,,,,,,,,,,,,,516,516,,,,,,516,,516,,516', -'516,,516,516,516,,516,516,516,516,,,516,516,,,516,,,516,516,,,,,,,516', -',,,,,516,,,,516,516,,516,516,,,,516,516,516,516,516,,,516,516,516,522', -'522,516,,522,522,,522,,,,,,,,,,,,,,,,,522,522,,,,,,522,,522,,522,522', -',522,522,522,,522,522,,,,,522,522,,,522,,,522,522,,,,,,,522,,,,,,522', -',,,522,522,,522,522,,,,522,522,522,522,522,9,,522,522,522,,,522,,,,', -'9,9,9,,9,,9,,9,,9,9,9,9,,,,,,,,,,,,,,,,9,,,,9,9,,,9,9,9,9,9,9,,9,9,162', -',162,,,9,,,,,,,162,162,162,,162,,162,,162,,162,162,162,162,,,,,,,9,', -',,,,,,,162,,,,162,162,,,162,162,162,162,162,162,,162,162,164,,164,,', -'162,,,,,,,164,164,164,,164,,164,,164,,164,164,164,164,,,,,,,162,,,,', -',,,,164,,,,164,164,,,164,164,164,164,164,164,,164,164,165,,165,,,164', -',,,,,,165,165,165,,165,,165,,165,,165,165,165,165,,,,,,,164,,,,,,,,', -'165,,63,63,165,165,63,203,165,165,165,165,165,165,,165,165,,,203,203', -'203,165,203,,203,,203,,203,203,203,203,,,,,232,232,,,232,63,,,63,,,203', -'165,,,203,203,,,203,203,203,203,203,203,,203,203,63,,,,,203,215,,,,63', -'63,232,,,232,203,203,215,215,215,215,215,247,215,,215,,215,215,215,215', -'203,,,232,,247,,247,,,,247,,232,232,215,,,,215,215,,,215,215,215,215', -'215,215,,215,215,247,,,248,,215,,,,,247,247,,,,247,247,248,,248,252', -',247,248,,,,,,,,,215,,252,,252,,,,252,,,,248,,,,253,247,,,,,248,248', -',,,248,248,252,253,,253,254,248,,253,252,252,252,252,,,,252,252,,254', -',254,,252,,254,,,,253,,,,248,,,,253,253,253,253,,,,253,253,254,,,255', -'252,253,,,254,254,254,254,254,254,,254,254,255,,255,256,,254,255,,,', -',,,,,253,256,256,,256,,,,256,,256,,255,,,,,254,,,255,255,255,255,255', -'255,,255,255,256,,,,257,255,,,256,256,256,256,256,256,,256,256,257,257', -',257,258,256,,257,,257,,,,,,255,,258,258,,258,,,,258,,258,,257,,,,256', -',,,257,257,257,257,257,257,,257,257,258,,,,259,257,,,258,258,258,258', -'258,258,,258,258,259,259,,259,,258,,259,,259,,,,,,257,,,,,,,,,,,,,259', -',,,258,260,,,259,259,259,259,259,259,,259,259,260,260,260,,260,259,260', -',260,,260,260,260,260,,,,,,,,,,,,,,,,260,,,259,,261,,,260,260,260,260', -'260,260,,260,260,261,261,261,,261,260,261,,261,,261,261,261,261,,,,', -',,,,,,,,,,,261,,,260,,261,,,261,261,261,261,261,261,262,261,261,,,262', -',,261,,,,262,262,262,,262,,262,,262,,262,262,262,262,,,,,,,,,,261,,', -',,,262,,,,262,262,,,262,262,262,262,262,262,,262,262,266,266,,,,262', -'266,,,,,,266,266,266,,266,,266,,266,,266,266,266,266,,,,,,,262,,,,,', -',,,266,,,,266,266,,273,266,266,266,266,266,266,,266,266,,,273,273,273', -'266,273,,273,,273,,273,273,273,273,,,,,,,,,,,,,,,,273,266,,,273,273', -',,273,273,273,273,273,273,278,273,273,,,,,,273,,,,278,278,278,278,278', -',278,,278,,278,278,278,278,,,,,,,,,,273,,,,,,278,,,,278,278,,409,278', -'278,278,278,278,278,,278,278,,,409,409,409,278,409,,409,,409,,409,409', -'409,409,,,,,,,,,,,,,,,,409,278,,,409,409,,438,409,409,409,409,409,409', -',409,409,,,438,438,438,409,438,,438,,438,,438,438,438,438,,,,,,,,,,', -',,,,,438,409,,,438,438,,439,438,438,438,438,438,438,,438,438,,,439,439', -'439,438,439,,439,,439,,439,439,439,439,,,,,,,,,,,,,,,,439,438,,,439', -'439,,440,439,439,439,439,439,439,,439,439,,,440,440,440,439,440,,440', -',440,,440,440,440,440,,,,,,,,,,,,,,,,440,439,,,440,440,,441,440,440', -'440,440,440,440,,440,440,,,441,441,441,440,441,,441,,441,,441,441,441', -'441,,,,,,,,,,,,,,,,441,440,,,441,441,,467,441,441,441,441,441,441,,441', -'441,,,467,467,467,441,467,,467,,467,,467,467,467,467,,,,,,,,,,,,,,,', -'467,441,321,321,467,467,321,510,467,467,467,467,467,467,,467,467,,,510', -'510,510,467,510,,510,,510,,510,510,510,510,,,,,421,421,,,421,321,,,321', -',,510,467,,,510,510,,,510,510,510,510,510,510,,510,510,321,,,,,510,', -',,,321,321,421,,,421,,272,272,272,272,,272,272,272,,272,,272,272,,,510', -',,421,272,272,272,,,,272,,,421,421,,,,,,,,272,272,,,,,,,,,,,,272,272', -'272,272,272,272,272,272,348,348,348,348,,348,348,348,,348,,348,348,', -',,,,,348,348,348,,,,348,,,,,,,,,,,,348,348,,,,,,,,,,,,348,348,348,348', -'348,348,348,348,350,350,350,350,,350,350,350,,350,,350,350,,,,,,,350', -'350,350,,,,350,,,,,,,,,,,,350,350,,,,,,,,,,,,350,350,350,350,350,350', -'350,350,380,380,380,380,,380,380,380,,380,,380,380,,,,,,,380,380,380', -',,,380,,,,,,,,,,,,380,380,,,,,,,,,,,,380,380,380,380,380,380,380,380', -'388,388,388,388,,388,388,388,,388,,388,388,,,,,,,388,388,388,,,,388', -',,,,,,,,,,,388,388,,,,,,,,,,,,388,388,388,388,388,388,388,388,415,415', -'415,415,,415,415,415,,415,,415,415,,,,,,,415,415,415,,,,415,,,,,,,,', -',,,415,415,,,,,,,,,,,,415,415,415,415,415,415,415,415' ] - racc_action_check = arr = ::Array.new(10648, nil) +'88,88,202,220,88,88,306,88,7,7,7,184,245,184,219,202,324,322,324,218', +'318,227,235,202,88,88,245,306,245,234,57,88,245,88,57,88,88,202,88,88', +'88,157,88,88,88,88,220,317,88,88,322,316,88,245,184,88,88,219,7,7,7', +'7,218,88,227,235,57,118,323,88,57,157,234,88,88,245,88,88,57,220,220', +'88,88,88,88,88,315,246,88,88,88,336,336,88,327,336,336,137,336,184,221', +'246,146,246,468,308,468,246,230,118,314,137,230,137,329,336,336,137', +'230,51,308,313,336,221,336,146,336,336,246,336,336,336,410,336,336,336', +'336,249,137,336,336,410,51,336,230,305,336,336,230,192,246,249,192,249', +'336,147,230,249,504,147,336,230,149,504,336,336,149,336,336,406,341', +'406,336,336,336,336,336,346,249,336,336,336,18,18,336,251,18,18,347', +'18,304,147,392,249,249,147,349,392,149,251,249,251,149,147,12,251,18', +'18,12,298,149,12,295,18,294,18,293,18,18,244,18,18,18,288,18,18,251', +'355,200,200,18,18,200,244,18,244,357,18,18,244,12,251,251,168,12,18', +'58,168,251,284,58,18,12,60,359,18,18,60,18,18,244,197,197,18,18,18,18', +'18,16,16,18,18,18,19,19,18,250,19,19,168,19,361,58,168,49,49,58,59,59', +'60,250,168,250,60,58,64,250,19,19,64,378,60,65,65,19,280,19,277,19,19', +'138,19,19,19,381,19,19,250,66,66,276,19,19,385,138,19,138,387,19,19', +'138,64,250,250,383,64,19,274,383,250,67,67,19,64,228,390,19,19,228,19', +'19,138,125,125,19,19,19,19,19,166,166,19,19,19,20,20,19,267,20,20,383', +'20,167,167,383,229,393,383,394,229,228,233,383,231,228,233,132,397,20', +'20,132,398,228,169,169,20,216,20,214,20,20,213,20,20,20,405,20,20,20', +'20,212,229,20,20,407,229,20,233,399,20,20,233,132,229,183,183,132,20', +'136,233,408,399,136,20,132,434,434,20,20,399,20,20,211,206,190,20,20', +'20,20,20,188,135,20,20,20,21,21,20,185,21,21,160,21,174,136,135,172', +'135,136,417,419,135,159,424,160,155,136,433,540,21,21,435,160,150,148', +'145,21,144,21,442,21,21,135,21,21,21,160,21,21,21,21,141,446,21,21,282', +'449,21,140,454,21,21,283,455,282,456,139,123,21,462,122,283,119,87,21', +'85,471,282,21,21,472,21,21,474,283,282,21,21,21,21,21,81,283,21,21,21', +'4,4,21,476,4,4,479,4,482,483,484,485,80,68,489,492,493,498,501,502,62', +'61,53,52,4,4,8,514,5,517,519,4,520,4,1,4,4,527,4,4,4,4,4,4,4,4,529,531', +'4,4,535,320,4,,,4,4,,,,,,,4,,,,,,4,,,,4,4,,4,4,,,,4,4,4,4,4,,,4,4,4', +'50,50,4,,50,50,,50,,,,,,,,,,,,,,,,,50,50,50,,,,,50,,50,,50,50,,50,50', +'50,,50,50,50,50,,,50,50,,,50,,,50,50,,,,,,,50,,,,,,50,,,,50,50,,50,50', +',,,50,50,50,50,50,50,50,50,50,50,509,509,50,,509,509,,509,509,,,,,,', +',,,,,,,,,509,509,,,,,,509,,509,,509,509,,509,509,509,,509,509,509,509', +',,509,509,,,509,,,509,509,,,,,,,509,,,,,,509,,,,509,509,,509,509,,,', +'509,509,509,509,509,,,509,509,509,54,54,509,,54,54,,54,,,,,,,,,,,,,', +',,,54,54,,,,,,54,,54,,54,54,,54,54,54,,54,54,,,,,54,54,,,54,,,54,54', +',,,,,,54,,,,,,54,,,,54,54,,54,54,,,,54,54,54,54,54,,,54,54,54,55,55', +'54,,55,55,,55,,,,,,,,,,,,,,,,,55,55,,,,,,55,,55,,55,55,,55,55,55,,55', +'55,,,,,55,55,,,55,,,55,55,,,,,,,55,,,,,,55,,,,55,55,,55,55,,,,55,55', +'55,55,55,,,55,55,55,56,56,55,,56,56,,56,,,,,,,,,,,,,,,,,56,56,,,,,,56', +',56,,56,56,,56,56,56,,56,56,,,,,56,56,,,56,,,56,56,,,,,,,56,,,,,,56', +',,,56,56,,56,56,,,,56,56,56,56,56,,,56,56,56,516,516,56,,516,516,,516', +'516,,,,,,,,,,,,,,,,516,516,,,,,,516,,516,,516,516,,516,516,516,,516', +'516,516,516,,,516,516,,,516,,,516,516,,,,,,,516,,,,,,516,,,,516,516', +',516,516,,,,516,516,516,516,516,,,516,516,516,507,507,516,,507,507,', +'507,507,,,,,,,,,,,,,,,,507,507,,,,,,507,,507,,507,507,,507,507,507,', +'507,507,507,507,,,507,507,,,507,,,507,507,,,,,,,507,,,,,,507,,,,507', +'507,,507,507,,,,507,507,507,507,507,,,507,507,507,511,511,507,,511,511', +',511,,,,,,,,,,,,,,,,,511,511,,,,,,511,,511,,511,511,,511,511,511,,511', +'511,511,511,,,511,511,,,511,,,511,511,,,,,,,511,,,,,,511,,,,511,511', +',511,511,,,,511,511,511,511,511,,,511,511,511,488,488,511,,488,488,', +'488,,,,,,,,,,,,,,,,,488,488,,,,,,488,,488,,488,488,,488,488,488,,488', +'488,488,488,,,488,488,,,488,,,488,488,,,,,,,488,,,,,,488,,,,488,488', +',488,488,,,,488,488,488,488,488,,,488,488,488,72,72,488,,72,72,72,72', +',,,,,,,,,,,,,,,,72,72,,,,,,72,,72,,72,72,,72,72,72,,72,72,72,72,,,72', +'72,,,72,,,72,72,,,,,,,72,,,,,,72,,,,72,72,,72,72,,,,72,72,72,72,72,72', +'72,72,72,72,73,73,72,,73,73,73,73,,,,,,,,,,,,,,,,,73,73,,,,,,73,,73', +',73,73,,73,73,73,,73,73,73,73,,,73,73,,,73,,,73,73,,,,,,,73,,,,,,73', +',,,73,73,,73,73,,,,73,73,73,73,73,73,73,73,73,73,74,74,73,,74,74,,74', +'74,,,,,,,,,,,,,,,,74,74,,,,,,74,,74,,74,74,,74,74,74,,74,74,74,74,,', +'74,74,,,74,,,74,74,,,,,,,74,,,,,,74,,,,74,74,,74,74,,,,74,74,74,74,74', +'74,74,74,74,74,78,78,74,,78,78,,78,,,,,,,,,,,,,,,,,78,78,,,,,,78,,78', +',78,78,,78,78,78,,78,78,78,78,,,78,78,,,78,,,78,78,,,,,,,78,,,,,,78', +',,,78,78,,78,78,,,,78,78,78,78,78,,,78,78,78,486,486,78,,486,486,,486', +'486,,,,,,,,,,,,,,,,486,486,,,,,,486,,486,,486,486,,486,486,486,,486', +'486,486,486,,,486,486,,,486,,,486,486,,,,,,,486,,,,,,486,,,,486,486', +',486,486,,,,486,486,486,486,486,,,486,486,486,475,475,486,,475,475,', +'475,,,,,,,,,,,,,,,,,475,475,,,,,,475,,475,,475,475,,475,475,475,,475', +'475,,,,,475,475,,,475,,,475,475,,,,,,,475,,,,,,475,,,,475,475,,475,475', +',,,475,475,475,475,475,,,475,475,475,83,83,475,,83,83,,83,,,,,,,,,,', +',,,,,,83,83,,,,,,83,,83,,83,83,,83,83,83,,83,83,,,,,83,83,,,83,,,83', +'83,,,,,,,83,,,,,,83,,,,83,83,,83,83,,,,83,83,83,83,83,,,83,83,83,470', +'470,83,,470,470,,470,,,,,,,,,,,,,,,,,470,470,,,,,,470,,470,,470,470', +',470,470,470,,470,470,,,,,470,470,,,470,,,470,470,,,,,,,470,,,,,,470', +',,,470,470,,470,470,,,,470,470,470,470,470,,,470,470,470,86,86,470,', +'86,86,,86,,,,,,,,,,,,,,,,,86,86,,,,,,86,,86,,86,86,,86,86,86,,86,86', +'86,86,,,86,86,,,86,,,86,86,,,,,,,86,,,,,,86,,,,86,86,,86,86,,,,86,86', +'86,86,86,,,86,86,86,89,89,86,,89,89,,89,,,,,,,,,,,,,,,,,89,89,,,,,,89', +',89,,89,89,,89,89,89,,89,89,89,89,,,89,89,,,89,,,89,89,,,,,,,89,,,,', +',89,,,,89,89,,89,89,,,,89,89,89,89,89,,,89,89,89,90,90,89,,90,90,,90', +',,,,,,,,,,,,,,,,90,90,,,,,,90,,90,,90,90,,90,90,90,,90,90,90,90,,,90', +'90,,,90,,,90,90,,,,,,,90,,,,,,90,,,,90,90,,90,90,,,,90,90,90,90,90,', +',90,90,90,91,91,90,,91,91,,91,,,,,,,,,,,,,,,,,91,91,,,,,,91,,91,,91', +'91,,91,91,91,,91,91,91,91,,,91,91,,,91,,,91,91,,,,,,,91,,,,,,91,,,,91', +'91,,91,91,,,,91,91,91,91,91,,,91,91,91,92,92,91,,92,92,,92,,,,,,,,,', +',,,,,,,92,92,,,,,,92,,92,,92,92,,92,92,92,,92,92,92,92,,,92,92,,,92', +',,92,92,,,,,,,92,,,,,,92,,,,92,92,,92,92,,,,92,92,92,92,92,,,92,92,92', +'93,93,92,,93,93,,93,,,,,,,,,,,,,,,,,93,93,,,,,,93,,93,,93,93,,93,93', +'93,,93,93,93,93,,,93,93,,,93,,,93,93,,,,,,,93,,,,,,93,,,,93,93,,93,93', +',,,93,93,93,93,93,,,93,93,93,94,94,93,,94,94,,94,,,,,,,,,,,,,,,,,94', +'94,,,,,,94,,94,,94,94,,94,94,94,,94,94,94,94,,,94,94,,,94,,,94,94,,', +',,,,94,,,,,,94,,,,94,94,,94,94,,,,94,94,94,94,94,,,94,94,94,95,95,94', +',95,95,,95,,,,,,,,,,,,,,,,,95,95,,,,,,95,,95,,95,95,,95,95,95,,95,95', +'95,95,,,95,95,,,95,,,95,95,,,,,,,95,,,,,,95,,,,95,95,,95,95,,,,95,95', +'95,95,95,,,95,95,95,96,96,95,,96,96,,96,,,,,,,,,,,,,,,,,96,96,,,,,,96', +'96,96,96,96,96,96,96,96,96,,96,96,,,,,96,96,96,96,96,,,96,96,,,,,,,96', +',,,,96,96,,,,96,96,,96,96,,,,96,96,96,96,96,96,96,96,96,96,97,97,96', +',97,97,,97,,,,,,,,,,,,,,,,,97,97,,,,,,97,,97,,97,97,,97,97,97,,97,97', +',,,,97,97,,,97,,,97,97,,,,,,,97,,,,,,97,,,,97,97,,97,97,,,,97,97,97', +'97,97,,,97,97,97,98,98,97,,98,98,,98,,,,,,,,,,,,,,,,,98,98,,,,,,98,', +'98,,98,98,,98,98,98,,98,98,,,,,98,98,,,98,,,98,98,,,,,,,98,,,,,,98,', +',,98,98,,98,98,,,,98,98,98,98,98,,,98,98,98,99,99,98,,99,99,,99,,,,', +',,,,,,,,,,,,99,99,,,,,,99,,99,,99,99,,99,99,99,,99,99,,,,,99,99,,,99', +',,99,99,,,,,,,99,,,,,,99,,,,99,99,,99,99,,,,99,99,99,99,99,,,99,99,99', +'100,100,99,,100,100,,100,,,,,,,,,,,,,,,,,100,100,,,,,,100,,100,,100', +'100,,100,100,100,,100,100,,,,,100,100,,,100,,,100,100,,,,,,,100,,,,', +',100,,,,100,100,,100,100,,,,100,100,100,100,100,,,100,100,100,101,101', +'100,,101,101,,101,,,,,,,,,,,,,,,,,101,101,,,,,,101,,101,,101,101,,101', +'101,101,,101,101,,,,,101,101,,,101,,,101,101,,,,,,,101,,,,,,101,,,,101', +'101,,101,101,,,,101,101,101,101,101,,,101,101,101,102,102,101,,102,102', +',102,,,,,,,,,,,,,,,,,102,102,,,,,,102,,102,,102,102,,102,102,102,,102', +'102,,,,,102,102,,,102,,,102,102,,,,,,,102,,,,,,102,,,,102,102,,102,102', +',,,102,102,102,102,102,,,102,102,102,103,103,102,,103,103,,103,,,,,', +',,,,,,,,,,,103,103,,,,,,103,,103,,103,103,,103,103,103,,103,103,,,,', +'103,103,,,103,,,103,103,,,,,,,103,,,,,,103,,,,103,103,,103,103,,,,103', +'103,103,103,103,,,103,103,103,104,104,103,,104,104,,104,,,,,,,,,,,,', +',,,,104,104,,,,,,104,,104,,104,104,,104,104,104,,104,104,,,,,104,104', +',,104,,,104,104,,,,,,,104,,,,,,104,,,,104,104,,104,104,,,,104,104,104', +'104,104,,,104,104,104,105,105,104,,105,105,,105,,,,,,,,,,,,,,,,,105', +'105,,,,,,105,,105,,105,105,,105,105,105,,105,105,,,,,105,105,,,105,', +',105,105,,,,,,,105,,,,,,105,,,,105,105,,105,105,,,,105,105,105,105,105', +',,105,105,105,106,106,105,,106,106,,106,,,,,,,,,,,,,,,,,106,106,,,,', +',106,,106,,106,106,,106,106,106,,106,106,,,,,106,106,,,106,,,106,106', +',,,,,,106,,,,,,106,,,,106,106,,106,106,,,,106,106,106,106,106,,,106', +'106,106,107,107,106,,107,107,,107,,,,,,,,,,,,,,,,,107,107,,,,,,107,', +'107,,107,107,,107,107,107,,107,107,,,,,107,107,,,107,,,107,107,,,,,', +',107,,,,,,107,,,,107,107,,107,107,,,,107,107,107,107,107,,,107,107,107', +'108,108,107,,108,108,,108,,,,,,,,,,,,,,,,,108,108,,,,,,108,,108,,108', +'108,,108,108,108,,108,108,,,,,108,108,,,108,,,108,108,,,,,,,108,,,,', +',108,,,,108,108,,108,108,,,,108,108,108,108,108,,,108,108,108,109,109', +'108,,109,109,,109,,,,,,,,,,,,,,,,,109,109,,,,,,109,,109,,109,109,,109', +'109,109,,109,109,,,,,109,109,,,109,,,109,109,,,,,,,109,,,,,,109,,,,109', +'109,,109,109,,,,109,109,109,109,109,,,109,109,109,110,110,109,,110,110', +',110,,,,,,,,,,,,,,,,,110,110,,,,,,110,,110,,110,110,,110,110,110,,110', +'110,,,,,110,110,,,110,,,110,110,,,,,,,110,,,,,,110,,,,110,110,,110,110', +',,,110,110,110,110,110,,,110,110,110,111,111,110,,111,111,,111,,,,,', +',,,,,,,,,,,111,111,,,,,,111,,111,,111,111,,111,111,111,,111,111,,,,', +'111,111,,,111,,,111,111,,,,,,,111,,,,,,111,,,,111,111,,111,111,,,,111', +'111,111,111,111,,,111,111,111,112,112,111,,112,112,,112,,,,,,,,,,,,', +',,,,112,112,,,,,,112,,112,,112,112,,112,112,112,,112,112,,,,,112,112', +',,112,,,112,112,,,,,,,112,,,,,,112,,,,112,112,,112,112,,,,112,112,112', +'112,112,,,112,112,112,113,113,112,,113,113,,113,,,,,,,,,,,,,,,,,113', +'113,,,,,,113,,113,,113,113,,113,113,113,,113,113,,,,,113,113,,,113,', +',113,113,,,,,,,113,,,,,,113,,,,113,113,,113,113,,,,113,113,113,113,113', +',,113,113,113,114,114,113,,114,114,,114,,,,,,,,,,,,,,,,,114,114,,,,', +',114,,114,,114,114,,114,114,114,,114,114,,,,,114,114,,,114,,,114,114', +',,,,,,114,,,,,,114,,,,114,114,,114,114,,,,114,114,114,114,114,,,114', +'114,114,115,115,114,,115,115,,115,,,,,,,,,,,,,,,,,115,115,,,,,,115,', +'115,,115,115,,115,115,115,,115,115,,,,,115,115,,,115,,,115,115,,,,,', +',115,,,,,,115,,,115,115,115,,115,115,,,,115,115,115,115,115,,,115,115', +'115,116,116,115,,116,116,,116,,,,,,,,,,,,,,,,,116,116,,,,,,116,,116', +',116,116,,116,116,116,,116,116,116,116,,,116,116,,,116,,,116,116,,,', +',,,116,,,,,,116,,,,116,116,,116,116,,,,116,116,116,116,116,116,116,116', +'116,116,120,120,116,,120,120,,120,,,,,,,,,,,,,,,,,120,120,,,,,,120,', +'120,,120,120,,120,120,120,,120,120,,,,,120,120,,,120,,,120,120,,,,,', +',120,,,,,,120,,,,120,120,,120,120,,,,120,120,120,120,120,,,120,120,120', +'121,121,120,,121,121,,121,,,,,,,,,,,,,,,,,121,121,,,,,,121,,121,,121', +'121,,121,121,121,,121,121,,,,,121,121,,,121,,,121,121,,,,,,,121,,,,', +',121,,,,121,121,,121,121,,,,121,121,121,121,121,,,121,121,121,464,464', +'121,,464,464,,464,,,,,,,,,,,,,,,,,464,464,,,,,,464,,464,,464,464,,464', +'464,464,,464,464,464,464,,,464,464,,,464,,,464,464,,,,,,,464,,,,,,464', +',,,464,464,,464,464,,,,464,464,464,464,464,464,464,464,464,464,461,461', +'464,,461,461,,461,,,,,,,,,,,,,,,,,461,461,,,,,,461,,461,,461,461,,461', +'461,461,,461,461,461,461,,,461,461,,,461,,,461,461,,,,,,,461,,,,,,461', +',,,461,461,,461,461,,,,461,461,461,461,461,,,461,461,461,124,124,461', +',124,124,,124,,,,,,,,,,,,,,,,,124,124,,,,,,124,,124,,124,124,,124,124', +'124,,124,124,,,,,124,124,,,124,,,124,124,,,,,,,124,,,,,,124,,,,124,124', +',124,124,,,,124,124,124,124,124,,,124,124,124,10,10,124,,10,10,,10,', +',,,,,,,,,,,,,,,10,10,,,,,,10,,10,,10,10,,10,10,10,,10,10,10,10,,,10', +'10,,,10,,,10,10,,,,,,,10,,,,,,10,,,,10,10,,10,10,,,,10,10,10,10,10,', +',10,10,10,458,458,10,,458,458,,458,,,,,,,,,,,,,,,,,458,458,,,,,,458', +',458,,458,458,,458,458,458,,458,458,458,458,,,458,458,,,458,,,458,458', +',,,,,,458,,,,,,458,,,,458,458,,458,458,,,,458,458,458,458,458,458,458', +'458,458,458,450,450,458,,450,450,,450,,,,,,,,,,,,,,,,,450,450,,,,,,450', +',450,,450,450,,450,450,450,,450,450,450,450,,,450,450,,,450,,,450,450', +',,,,,,450,,,,,,450,,,,450,450,,450,450,,,,450,450,450,450,450,,,450', +'450,450,443,443,450,,443,443,,443,,,,,,,,,,,,,,,,,443,443,,,,,,443,', +'443,,443,443,,443,443,443,,443,443,,,,,443,443,,,443,,,443,443,,,,,', +',443,,,,,,443,,,,443,443,,443,443,,,,443,443,443,443,443,,,443,443,443', +'426,426,443,,426,426,,426,,,,,,,,,,,,,,,,,426,426,,,,,,426,,426,,426', +'426,,426,426,426,,426,426,426,426,,,426,426,,,426,,,426,426,,,,,,,426', +',,,,,426,,,,426,426,,426,426,,,,426,426,426,426,426,426,426,426,426', +'426,161,161,426,,161,161,,161,,,,,,,,,,,,,,,,,161,161,161,,,,,161,,161', +',161,161,,161,161,161,,161,161,161,161,,,161,161,,,161,,,161,161,,,', +',,,161,,,,,,161,,,,161,161,,161,161,,,,161,161,161,161,161,161,161,161', +'161,161,11,11,161,,11,11,,11,,,,,,,,,,,,,,,,,11,11,,,,,,11,,11,,11,11', +',11,11,11,,11,11,11,11,,,11,11,,,11,,,11,11,,,,,,,11,,,,,,11,,,,11,11', +',11,11,,,,11,11,11,11,11,,,11,11,11,522,522,11,,522,522,,522,,,,,,,', +',,,,,,,,,522,522,,,,,,522,,522,,522,522,,522,522,522,,522,522,,,,,522', +'522,,,522,,,522,522,,,,,,,522,,,,,,522,,,,522,522,,522,522,,,,522,522', +'522,522,522,,,522,522,522,170,170,522,,170,170,,170,,,,,,,,,,,,,,,,', +'170,170,,,,,,170,,170,,170,170,,170,170,170,,170,170,170,170,,,170,170', +',,170,,,170,170,,,,,,,170,,,,,,170,,,,170,170,,170,170,,,,170,170,170', +'170,170,170,170,170,170,170,171,171,170,,171,171,,171,171,,,,,,,,,,', +',,,,,171,171,,,,,,171,,171,,171,171,,171,171,171,,171,171,171,171,,', +'171,171,,,171,,,171,171,,,,,,,171,,,,,,171,,,,171,171,,171,171,,,,171', +'171,171,171,171,,,171,171,171,416,416,171,,416,416,,416,,,,,,,,,,,,', +',,,,416,416,,,,,,416,,416,,416,416,,416,416,416,,416,416,416,416,,,416', +'416,,,416,,,416,416,,,,,,,416,,,,,,416,,,,416,416,,416,416,,,,416,416', +'416,416,416,,,416,416,416,17,17,416,,17,17,,17,,,,,,,,,,,,,,,,,17,17', +',,,,,17,,17,,17,17,,17,17,17,,17,17,,,,,17,17,,,17,,,17,17,,,,,,,17', +',,,,,17,,,,17,17,,17,17,,,,17,17,17,17,17,,,17,17,17,414,414,17,,414', +'414,,414,,,,,,,,,,,,,,,,,414,414,,,,,,414,,414,,414,414,,414,414,414', +',414,414,414,414,,,414,414,,,414,,,414,414,,,,,,,414,,,,,,414,,,,414', +'414,,414,414,,,,414,414,414,414,414,,,414,414,414,413,413,414,,413,413', +',413,,,,,,,,,,,,,,,,,413,413,,,,,,413,,413,,413,413,,413,413,413,,413', +'413,413,413,,,413,413,,,413,,,413,413,,,,,,,413,,,,,,413,,,,413,413', +',413,413,,,,413,413,413,413,413,,,413,413,413,411,411,413,,411,411,', +'411,411,,,,,,,,,,,,,,,,411,411,,,,,,411,,411,,411,411,,411,411,411,', +'411,411,,,,,411,411,,,411,,,411,411,,,,,,,411,,,,,,411,,,,411,411,,411', +'411,,,,411,411,411,411,411,,,411,411,411,0,0,411,,0,0,,0,,,,,,,,,,,', +',,,,,0,0,,,,,,0,,0,,0,0,,0,0,0,,0,0,0,0,,,0,0,,,0,,,0,0,,,,,,,0,,,,', +',0,,,,0,0,,0,0,0,,,0,0,0,0,0,,,0,0,0,201,201,0,,201,201,,201,,,,,,,', +',,,,,,,,,201,201,,,,,,201,,201,,201,201,,201,201,201,,201,201,201,201', +',,201,201,,,201,,,201,201,,,,,,,201,,,,,,201,,,,201,201,,201,201,,,', +'201,201,201,201,201,,,201,201,201,204,204,201,,204,204,,204,204,,,,', +',,,,,,,,,,,204,204,,,,,,204,,204,,204,204,,204,204,204,,204,204,204', +'204,,,204,204,,,204,,,204,204,,,,,,,204,,,,,,204,,,,204,204,,204,204', +',,,204,204,204,204,204,204,204,204,204,204,403,403,204,,403,403,,403', +',,,,,,,,,,,,,,,,403,403,,,,,,403,,403,,403,403,,403,403,403,,403,403', +'403,403,,,403,403,,,403,,,403,403,,,,,,,403,,,,,,403,,,,403,403,,403', +'403,,,,403,403,403,403,403,403,403,403,403,403,400,400,403,,400,400', +',400,,,,,,,,,,,,,,,,,400,400,,,,,,400,,400,,400,400,,400,400,400,,400', +'400,,,,,400,400,,,400,,,400,400,,,,,,,400,,,,,,400,,,,400,400,,400,400', +',,,400,400,400,400,400,,,400,400,400,217,217,400,,217,217,,217,,,217', +',,,,,,,,,,,,,217,217,,,,,,217,,217,,217,217,,217,217,217,,217,217,,', +',,217,217,,,217,,,217,217,,,,,,,217,,,,,,217,,,,217,217,,217,217,,,', +'217,217,217,217,217,,,217,217,217,222,222,217,,222,222,,222,,,,,,,,', +',,,,,,,,222,222,,,,,,222,,222,,222,222,,222,222,222,,222,222,,,,,222', +'222,,,222,,,222,222,,,,,,,222,,,,,,222,,,,222,222,,222,222,,,,222,222', +'222,222,222,,,222,222,222,223,223,222,,223,223,,223,,,,,,,,,,,,,,,,', +'223,223,,,,,,223,,223,,223,223,,223,223,223,,223,223,,,,,223,223,,,223', +',,223,223,,,,,,,223,,,,,,223,,,,223,223,,223,223,,,,223,223,223,223', +'223,,,223,223,223,224,224,223,,224,224,,224,,,,,,,,,,,,,,,,,224,224', +',,,,,224,,224,,224,224,,224,224,224,,224,224,,,,,224,224,,,224,,,224', +'224,,,,,,,224,,,,,,224,,,,224,224,,224,224,,,,224,224,224,224,224,,', +'224,224,224,396,396,224,,396,396,,396,396,,,,,,,,,,,,,,,,396,396,,,', +',,396,,396,,396,396,,396,396,396,,396,396,396,396,,,396,396,,,396,,', +'396,396,,,,,,,396,,,,,,396,,,,396,396,,396,396,,,,396,396,396,396,396', +',,396,396,396,265,265,396,,265,265,,265,,,,,,,,,,,,,,,,,265,265,,,,', +',265,,265,,265,265,,265,265,265,,265,265,,,,,265,265,,,265,,,265,265', +',,,,,,265,,,,,,265,,,,265,265,,265,265,,,,265,265,265,265,265,,,265', +'265,265,379,379,265,,379,379,,379,,,,,,,,,,,,,,,,,379,379,,,,,,379,', +'379,,379,379,,379,379,379,,379,379,,,,,379,379,,,379,,,379,379,,,,,', +',379,,,,,,379,,,,379,379,,379,379,,,,379,379,379,379,379,,,379,379,379', +'358,358,379,,358,358,,358,,,,,,,,,,,,,,,,,358,358,,,,,,358,,358,,358', +'358,,358,358,358,,358,358,358,358,,,358,358,,,358,,,358,358,,,,,,,358', +',,,,,358,,,,358,358,,358,358,,,,358,358,358,358,358,358,358,358,358', +'358,287,287,358,,287,287,,287,,,,,,,,,,,,,,,,,287,287,,,,,,287,,287', +',287,287,,287,287,287,,287,287,287,287,,,287,287,,,287,,,287,287,,,', +',,,287,,,,,,287,,,,287,287,,287,287,,,,287,287,287,287,287,287,287,287', +'287,287,354,354,287,,354,354,,354,,,,,,,,,,,,,,,,,354,354,,,,,,354,', +'354,,354,354,,354,354,354,,354,354,,,,,354,354,,,354,,,354,354,,,,,', +',354,,,,,,354,,,,354,354,,354,354,,,,354,354,354,354,354,,,354,354,354', +'290,290,354,,290,290,,290,,,,,,,,,,,,,,,,,290,290,,,,,,290,,290,,290', +'290,,290,290,290,,290,290,290,290,,,290,290,,,290,,,290,290,,,,,,,290', +',,,,,290,,,,290,290,,290,290,,,,290,290,290,290,290,290,290,290,290', +'290,291,291,290,,291,291,,291,,,,,,,,,,,,,,,,,291,291,,,,,,291,,291', +',291,291,,291,291,291,,291,291,291,291,,,291,291,,,291,,,291,291,,,', +',,,291,,,,,,291,,,,291,291,,291,291,,,,291,291,291,291,291,291,291,291', +'291,291,292,292,291,,292,292,,292,,,,,,,,,,,,,,,,,292,292,,,,,,292,', +'292,,292,292,,292,292,292,,292,292,292,292,,,292,292,,,292,,,292,292', +',,,,,,292,,,,,,292,,,,292,292,,292,292,,,,292,292,292,292,292,,,292', +'292,292,353,353,292,,353,353,,353,,,,,,,,,,,,,,,,,353,353,,,,,,353,', +'353,,353,353,,353,353,353,,353,353,,,,,353,353,,,353,,,353,353,,,,,', +',353,,,,,,353,,,,353,353,,353,353,,,,353,353,353,353,353,,,353,353,353', +'352,352,353,,352,352,,352,,,,,,,,,,,,,,,,,352,352,,,,,,352,,352,,352', +'352,,352,352,352,,352,352,,,,,352,352,,,352,,,352,352,,,,,,,352,,,,', +',352,,,,352,352,,352,352,,,,352,352,352,352,352,,,352,352,352,351,351', +'352,,351,351,,351,,,,,,,,,,,,,,,,,351,351,,,,,,351,,351,,351,351,,351', +'351,351,,351,351,,,,,351,351,,,351,,,351,351,,,,,,,351,,,,,,351,,,,351', +'351,,351,351,,,,351,351,351,351,351,,,351,351,351,310,310,351,,310,310', +',310,310,,,,,,,,,,,,,,,,310,310,,,,,,310,,310,,310,310,,310,310,310', +',310,310,310,310,,,310,310,,,310,,,310,310,,,,,,,310,,,,,,310,,,,310', +'310,,310,310,,,,310,310,310,310,310,,,310,310,310,311,311,310,,311,311', +',311,311,,,,,,,,,,,,,,,,311,311,,,,,,311,,311,,311,311,,311,311,311', +',311,311,311,311,,,311,311,,,311,,,311,311,,,,,,,311,,,,,,311,,,,311', +'311,,311,311,,,,311,311,311,311,311,,,311,311,311,312,312,311,,312,312', +',312,,,,,,,,,,,,,,,,,312,312,,,,,,312,,312,,312,312,,312,312,312,,312', +'312,,,,,312,312,,,312,,,312,312,,,,,,,312,,,,,,312,,,,312,312,,312,312', +',,,312,312,312,312,312,,,312,312,312,331,331,312,,331,331,,331,331,', +',,,,,,,,,,,,,,331,331,,,,,,331,,331,,331,331,,331,331,331,,331,331,331', +'331,,,331,331,,,331,,,331,331,,,,,,,331,,,,,,331,,,,331,331,,331,331', +',,,331,331,331,331,331,331,331,331,331,331,328,328,331,,328,328,,328', +',,,,,,,,,,,,,,,,328,328,,,,,,328,,328,,328,328,,328,328,328,,328,328', +'328,328,,,328,328,,,328,,,328,328,63,63,,,63,,328,,,,,,328,,,,328,328', +',328,328,,,,328,328,328,328,328,328,328,328,328,328,203,,328,,,,63,', +',63,,,203,203,203,,203,,203,,203,,203,203,203,203,,,,63,421,421,,,421', +',,,,63,63,203,,,,203,203,,,203,203,203,203,203,203,,203,203,,,,,,203', +'278,,,,232,232,421,,232,421,203,203,278,278,278,278,278,,278,,278,,278', +'278,278,278,203,,,421,,,,,,,,,,421,421,278,,,232,278,278,232,409,278', +'278,278,278,278,278,,278,278,,,409,409,409,278,409,,409,232,409,,409', +'409,409,409,,,,232,232,,,,,,,,,,,409,278,,,409,409,,,409,409,409,409', +'409,409,,409,409,165,,165,,,409,,,,,,,165,165,165,,165,255,165,,165', +',165,165,165,165,,,,,,255,409,255,,,,255,321,321,,165,321,,,165,165', +',,165,165,165,165,165,165,,165,165,255,,,,,165,,,255,255,255,255,255', +'255,,255,255,439,,,321,,255,321,,,,,,439,439,439,165,439,,439,,439,', +'439,439,439,439,321,,,,,,255,,,,321,321,,,,439,,,,439,439,,440,439,439', +'439,439,439,439,,439,439,,,440,440,440,439,440,248,440,,440,,440,440', +'440,440,,,,,,248,,248,,,,248,,,,440,439,,,440,440,,,440,440,440,440', +'440,440,,440,440,248,,,,,440,,,,,248,248,,438,,248,248,,,,,,248,,,438', +'438,438,,438,256,438,440,438,,438,438,438,438,,,,,256,256,,256,,,248', +'256,,256,,438,,,,438,438,,,438,438,438,438,438,438,,438,438,256,,,253', +',438,,,256,256,256,256,256,256,,256,256,253,,253,257,,256,253,,,,,,', +',,438,257,257,,257,,,,257,,257,,253,,,,247,256,,,253,253,253,253,,,', +'253,253,257,247,,247,,253,,247,257,257,257,257,257,257,,257,257,,,,', +',257,,,,,,247,,,,253,,,,,,247,247,441,,,247,247,,,,,257,247,,441,441', +'441,,441,,441,,441,,441,441,441,441,,,,,,,,,,,,247,,,,441,,,,441,441', +',258,441,441,441,441,441,441,,441,441,,,,258,258,441,258,,,,258,,258', +',,,,,,,,,,,,,,,,,,258,441,,,,9,,,258,258,258,258,258,258,,258,258,9', +'9,9,,9,258,9,,9,,9,9,9,9,,,,,,,,,,,,,,,,9,,,258,9,9,,259,9,9,9,9,9,9', +',9,9,,,,259,259,9,259,,,,259,,259,,,,,,,,,,,,,,,,,,,259,9,,,,260,,,259', +'259,259,259,259,259,,259,259,260,260,260,,260,259,260,,260,,260,260', +'260,260,,,,,,,,,,,,,,,,260,,,259,,261,,,260,260,260,260,260,260,,260', +'260,261,261,261,,261,260,261,,261,,261,261,261,261,,,,,,,,,,,,,,,,261', +',,260,,261,,,261,261,261,261,261,261,262,261,261,,,262,,,261,,,,262', +'262,262,,262,,262,,262,,262,262,262,262,,,,,,,,,,261,,,,,,262,,,,262', +'262,,,262,262,262,262,262,262,,262,262,266,266,,,,262,266,,,,,,266,266', +'266,,266,,266,,266,,266,266,266,266,,,,,,,262,,,,,,,,,266,,,,266,266', +',467,266,266,266,266,266,266,,266,266,,,467,467,467,266,467,,467,,467', +',467,467,467,467,,,,,,,,,,,,,,,,467,266,,,467,467,,273,467,467,467,467', +'467,467,,467,467,,,273,273,273,467,273,,273,,273,,273,273,273,273,,', +',,,,,,,,,,,,,273,467,,,273,273,,,273,273,273,273,273,273,215,273,273', +',,,,,273,,,,215,215,215,215,215,252,215,,215,,215,215,215,215,,,,,,252', +',252,,273,,252,,,,215,,,,215,215,,,215,215,215,215,215,215,,215,215', +'252,,,254,,215,,,252,252,252,252,,,,252,252,254,,254,,,252,254,,,,,', +',,,215,,,,,,,,,,,,254,,,,,252,,,254,254,254,254,254,254,,254,254,162', +',162,,,254,,,,,,,162,162,162,,162,,162,,162,,162,162,162,162,,,,,,,254', +',,,,,,,,162,,,,162,162,,,162,162,162,162,162,162,,162,162,164,,164,', +',162,,,,,,,164,164,164,,164,,164,,164,,164,164,164,164,,,,,,,162,,,', +',,,,,164,,,,164,164,,510,164,164,164,164,164,164,,164,164,,,510,510', +'510,164,510,,510,,510,,510,510,510,510,,,,,,,,,,,,,,,,510,164,,,510', +'510,,,510,510,510,510,510,510,,510,510,,350,350,350,350,510,350,350', +'350,,350,,350,350,,,,,,,350,350,350,,,,350,,,,,,510,,,,,,350,350,,,', +',,,,,,,,350,350,350,350,350,350,350,350,272,272,272,272,,272,272,272', +',272,,272,272,,,,,,,272,272,272,,,,272,,,,,,,,,,,,272,272,,,,,,,,,,', +',272,272,272,272,272,272,272,272,388,388,388,388,,388,388,388,,388,', +'388,388,,,,,,,388,388,388,,,,388,,,,,,,,,,,,388,388,,,,,,,,,,,,388,388', +'388,388,388,388,388,388,415,415,415,415,,415,415,415,,415,,415,415,', +',,,,,415,415,415,,,,415,,,,,,,,,,,,415,415,,,,,,,,,,,,415,415,415,415', +'415,415,415,415,348,348,348,348,,348,348,348,,348,,348,348,,,,,,,348', +'348,348,,,,348,,,,,,,,,,,,348,348,,,,,,,,,,,,348,348,348,348,348,348', +'348,348,380,380,380,380,,380,380,380,,380,,380,380,,,,,,,380,380,380', +',,,380,,,,,,,,,,,,380,380,,,,,,,,,,,,380,380,380,380,380,380,380,380' ] + racc_action_check = arr = ::Array.new(10662, nil) idx = 0 clist.each do |str| str.split(',', -1).each do |i| @@ -711,61 +711,61 @@ class Parser < Racc::Parser end racc_action_pointer = [ - -2, 20, nil, nil, 89, 17, nil, -8, 25, 8997, - 180, 271, 153, nil, nil, nil, 82, 362, 453, 544, - 635, 726, nil, nil, nil, nil, nil, nil, nil, nil, + 6641, 580, nil, nil, 544, 561, nil, -8, 563, 9619, + 5276, 5822, 202, nil, nil, nil, 180, 6277, 180, 271, + 362, 453, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - nil, nil, nil, nil, nil, nil, nil, nil, nil, 199, - 817, 73, -25, 24, 908, 999, 1090, 64, 244, 214, - 251, 41, 77, 9219, 335, 298, 302, 320, 78, nil, - nil, nil, 1181, 1272, 1363, nil, nil, nil, 1454, nil, - 27, 38, nil, 1545, nil, 121, 1636, 112, 1727, 1818, - 1909, 2000, 2091, 2182, 2273, 2364, 2455, 2546, 2637, 2728, - 2819, 2910, 3001, 3092, 3183, 3274, 3365, 3456, 3547, 3638, - 3729, 3820, 3911, 4002, 4093, 4184, 4275, nil, 25, 132, - 4366, 4457, 154, 176, 4548, 391, nil, nil, nil, nil, - nil, nil, 342, nil, nil, 90, 372, 181, 212, 173, - 182, 211, nil, nil, 223, 168, 92, 392, 234, 423, - 240, nil, nil, nil, nil, 254, nil, 32, nil, 207, - -35, 4639, 9055, nil, 9113, 9171, 397, 417, 426, 424, - 4730, 4821, 263, nil, 258, nil, nil, nil, nil, nil, - nil, nil, nil, 458, 4, 268, nil, nil, 271, nil, - 277, nil, 139, nil, nil, nil, nil, 495, nil, nil, - 293, 4912, 140, 9219, 5003, nil, 279, nil, nil, nil, - nil, 291, 296, 298, 305, 9283, 307, 5094, 2, 7, - -9, 142, 5185, 5276, 5367, nil, nil, 9, 433, 464, - 106, 318, 9254, 475, 10, 17, nil, nil, nil, nil, - nil, nil, nil, nil, 303, 5, 80, 9300, 9344, 130, - 221, 312, 9361, 9389, 9406, 9450, 9467, 9512, 9529, 9574, - 9620, 9666, 9721, nil, nil, 5458, 9779, 318, nil, nil, - nil, nil, 10267, 9827, 285, nil, 314, 297, 9882, nil, - 304, nil, 204, 295, 343, nil, nil, 5549, 331, nil, - 5640, 5731, 5822, 317, 361, 322, nil, nil, 366, nil, - nil, nil, nil, nil, 365, 346, -31, nil, 92, nil, - 5913, 6004, 6095, 384, 387, 392, 396, 398, 405, nil, - 382, 10218, -25, 365, 9, nil, nil, 423, 6186, 428, - nil, 6277, nil, nil, nil, nil, 6368, nil, nil, nil, - nil, 445, nil, nil, nil, nil, 451, 457, 10325, 459, - 10383, 6459, 6550, 6641, 6732, 459, nil, 466, 6823, 465, - nil, 470, nil, nil, nil, nil, nil, nil, nil, nil, - nil, nil, nil, nil, nil, nil, nil, nil, 477, 6914, - 10441, 480, nil, 514, nil, 479, nil, 483, 10499, nil, - 429, nil, 201, 495, 503, nil, 7005, 508, 447, 108, - 7096, nil, nil, 7187, nil, 511, 163, 512, 489, 9930, - 183, 7278, nil, 7369, 7460, 10557, 7551, 498, nil, 518, - nil, 10253, nil, nil, 521, nil, 7642, nil, nil, nil, - nil, nil, nil, 461, 427, 521, nil, nil, 9978, 10026, - 10074, 10122, 525, 7733, nil, nil, 531, nil, nil, 529, - 7824, nil, nil, nil, 521, 526, 542, nil, 7915, nil, - nil, 8006, 547, nil, 8097, nil, nil, 10170, 213, nil, - 8188, 549, 526, nil, 552, 8279, 553, nil, nil, 553, - nil, nil, 555, 553, 557, 559, 8370, nil, 8461, 556, - nil, nil, 562, 530, nil, nil, nil, nil, 564, nil, - nil, 565, 566, nil, 203, nil, nil, 8552, nil, 8643, - 10218, 8734, nil, nil, 568, nil, 8825, 570, nil, 573, - 579, nil, 8916, nil, nil, nil, nil, 580, nil, 581, - nil, 582, nil, nil, nil, 583, nil, nil, nil, nil, - 553, nil, nil, nil, nil, nil ] + nil, nil, nil, nil, nil, nil, nil, nil, nil, 196, + 635, 92, 497, 541, 817, 908, 999, 28, 244, 199, + 251, 540, 557, 8973, 293, 214, 230, 252, 543, nil, + nil, nil, 1454, 1545, 1636, nil, nil, nil, 1727, nil, + 481, 469, nil, 2000, nil, 525, 2182, 510, -2, 2273, + 2364, 2455, 2546, 2637, 2728, 2819, 2910, 3001, 3092, 3183, + 3274, 3365, 3456, 3547, 3638, 3729, 3820, 3911, 4002, 4093, + 4184, 4275, 4366, 4457, 4548, 4639, 4730, nil, 25, 513, + 4821, 4912, 511, 508, 5185, 326, nil, nil, nil, nil, + nil, nil, 384, nil, nil, 444, 426, 90, 303, 488, + 480, 489, nil, nil, 474, 413, 75, 153, 475, 160, + 471, nil, nil, nil, nil, 468, nil, 32, nil, 411, + 424, 5731, 10142, nil, 10200, 9172, 333, 346, 241, 367, + 6004, 6095, 453, nil, 442, nil, nil, nil, nil, nil, + nil, nil, nil, 398, 4, 445, nil, nil, 438, nil, + 431, nil, 139, nil, nil, nil, nil, 257, nil, nil, + 226, 6732, -35, 9002, 6823, nil, 430, nil, nil, nil, + nil, 433, 401, 392, 389, 10023, 383, 7096, 7, 2, + -9, 73, 7187, 7278, 7369, nil, nil, 9, 342, 373, + 106, 374, 9075, 379, 17, 10, nil, nil, nil, nil, + nil, nil, nil, nil, 212, 5, 80, 9472, 9312, 130, + 269, 178, 10040, 9427, 10084, 9189, 9383, 9444, 9573, 9667, + 9713, 9759, 9814, nil, nil, 7551, 9872, 354, nil, nil, + nil, nil, 10339, 9968, 288, nil, 296, 264, 9066, nil, + 266, nil, 477, 484, 240, nil, nil, 7824, 195, nil, + 8006, 8097, 8188, 166, 205, 162, nil, nil, 196, nil, + nil, nil, nil, nil, 174, 108, -31, nil, 92, nil, + 8552, 8643, 8734, 112, 101, 77, 42, 34, 10, nil, + 558, 9215, -25, 7, 9, nil, nil, 86, 8916, 106, + nil, 8825, nil, nil, nil, nil, 89, nil, nil, nil, + nil, 157, nil, nil, nil, nil, 165, 178, 10513, 186, + 10281, 8461, 8370, 8279, 7915, 214, nil, 228, 7733, 241, + nil, 269, nil, nil, nil, nil, nil, nil, nil, nil, + nil, nil, nil, nil, nil, nil, nil, nil, 290, 7642, + 10571, 305, nil, 332, nil, 310, nil, 314, 10397, nil, + 273, nil, 184, 366, 369, nil, 7460, 380, 319, 381, + 7005, nil, nil, 6914, nil, 395, 135, 404, 396, 9114, + 119, 6550, nil, 6459, 6368, 10455, 6186, 441, nil, 461, + nil, 9037, nil, nil, 464, nil, 5640, nil, nil, nil, + nil, nil, nil, 405, 354, 468, nil, nil, 9366, 9247, + 9295, 9525, 479, 5549, nil, nil, 492, nil, nil, 493, + 5458, nil, nil, nil, 481, 485, 502, nil, 5367, nil, + nil, 5094, 509, nil, 5003, nil, nil, 9920, 70, nil, + 2091, 517, 496, nil, 524, 1909, 540, nil, nil, 542, + nil, nil, 544, 542, 546, 548, 1818, nil, 1363, 547, + nil, nil, 551, 519, nil, nil, nil, nil, 553, nil, + nil, 554, 555, nil, 150, nil, nil, 1181, nil, 726, + 10248, 1272, nil, nil, 563, nil, 1090, 565, nil, 566, + 570, nil, 5913, nil, nil, nil, nil, 573, nil, 582, + nil, 583, nil, nil, nil, 586, nil, nil, nil, nil, + 435, nil, nil, nil, nil, nil ] racc_action_default = [ -3, -301, -1, -2, -4, -5, -8, -10, -18, -23, @@ -828,16 +828,16 @@ class Parser < Racc::Parser 2, 126, 277, 177, 267, 135, 137, 138, 175, 264, 139, 140, 158, 275, 275, 155, 156, 194, 343, 378, 187, 187, 325, 339, 294, 87, 196, 298, 445, 188, - 188, 422, 144, 412, 122, 123, 274, 276, 216, 132, - 141, 1, 162, 164, 165, 3, 166, 167, 492, 126, - 448, 473, 296, 183, 185, 190, 263, 326, 469, 269, + 188, 422, 144, 412, 122, 123, 185, 190, 216, 132, + 141, 337, 162, 164, 165, 3, 166, 167, 492, 126, + 448, 473, 296, 183, 274, 276, 263, 326, 469, 269, 395, 506, 141, 141, 195, 411, 531, 355, 198, 341, 437, 203, 169, 381, 451, 419, 423, 466, 207, 208, 209, 210, 168, 402, 215, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 266, 289, 195, 206, 273, 273, 155, 156, 278, 401, 393, 508, 211, 212, 213, 214, - 505, 284, 391, 280, 155, 126, 428, 337, 445, 338, + 505, 284, 391, 280, 155, 126, 428, 1, 445, 338, 335, 487, 478, 336, 334, 199, 167, 201, 183, nil, nil, nil, nil, 308, nil, nil, nil, 194, 324, 385, 387, 141, 317, 479, 482, nil, 484, 315, nil, 356, @@ -883,16 +883,16 @@ class Parser < Racc::Parser 2, 72, 15, 47, 24, 12, 12, 12, 48, 65, 6, 6, 51, 64, 64, 49, 89, 9, 108, 16, 8, 8, 46, 91, 55, 5, 101, 57, 25, 96, - 96, 81, 10, 62, 11, 11, 68, 68, 13, 75, - 6, 1, 12, 12, 12, 3, 72, 72, 14, 72, - 18, 60, 64, 72, 92, 92, 23, 45, 59, 9, + 96, 81, 10, 62, 11, 11, 92, 92, 13, 75, + 6, 97, 12, 12, 12, 3, 72, 72, 14, 72, + 18, 60, 64, 72, 68, 68, 23, 45, 59, 9, 56, 58, 6, 6, 6, 61, 63, 66, 6, 57, 69, 12, 76, 77, 78, 80, 83, 84, 6, 6, 6, 6, 75, 85, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 51, 6, 5, 12, 12, 49, 89, 12, 87, 91, 60, 11, 11, 11, 11, - 59, 72, 94, 73, 49, 72, 95, 97, 25, 98, + 59, 72, 94, 73, 49, 72, 95, 1, 25, 98, 102, 81, 62, 103, 105, 106, 72, 107, 72, nil, nil, nil, nil, 10, nil, nil, nil, 9, 49, 57, 57, 6, 10, 74, 74, nil, 74, 72, nil, 65, @@ -935,16 +935,16 @@ class Parser < Racc::Parser nil, nil, nil, nil, nil, 17 ] racc_goto_pointer = [ - nil, 41, 0, 45, nil, 21, -10, nil, -52, -57, + nil, 127, 0, 45, nil, 21, -10, nil, -52, -57, -18, 24, -12, -58, -387, -122, -258, 36, -329, nil, nil, nil, nil, -59, -112, -330, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, -127, -162, -60, -55, -36, nil, -40, nil, nil, nil, -135, -234, -133, -409, -348, - -357, -247, -279, -445, -107, -106, -198, nil, -84, -280, + -357, -247, -279, -445, -107, -106, -198, nil, -66, -280, nil, nil, -11, -2, -260, 23, 12, -207, -309, nil, -245, -290, nil, -246, -322, -223, nil, -192, nil, -35, - nil, -178, -18, nil, -168, -202, -43, -73, -71, nil, + nil, -178, -36, nil, -168, -202, -43, -159, -71, nil, nil, -52, -67, -64, nil, -63, 55, 56, -185 ] racc_goto_default = [ From af9b8e0894c2d606e81671fb133d4ef73d9ed7ef Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Wed, 2 Sep 2020 14:34:26 -0700 Subject: [PATCH 136/731] (PUP-10446) Remove app orchestration from grammar Remove application, site, export and produces keywords from the grammar. No tests needed changing since the parser hasn't been regenerated. --- lib/puppet/pops/parser/egrammar.ra | 56 ------------------------------ 1 file changed, 56 deletions(-) diff --git a/lib/puppet/pops/parser/egrammar.ra b/lib/puppet/pops/parser/egrammar.ra index 784a920b81a..ecc69431c13 100644 --- a/lib/puppet/pops/parser/egrammar.ra +++ b/lib/puppet/pops/parser/egrammar.ra @@ -22,7 +22,6 @@ token RENDER_STRING RENDER_EXPR EPP_START EPP_END EPP_END_TRIM token FUNCTION token TYPE token PRIVATE ATTR -token APPLICATION PRODUCES CONSUMES SITE token PLAN APPLY token LOW @@ -200,7 +199,6 @@ resource # expression : primary_expression - | capability_mapping | call_function_expression | bracketed_expression | expression IN expression { result = val[0].in val[2] ; loc result, val[1] } @@ -257,12 +255,10 @@ primary_expression | if_expression | unless_expression | definition_expression - | application_expression | hostclass_expression | plan_expression | apply_expression | node_definition_expression - | site_definition_expression | epp_render_expression | function_definition | type_alias @@ -520,34 +516,6 @@ definition_expression end } -#---APPLICATION -application_expression - : APPLICATION classname parameter_list LBRACE opt_statements RBRACE { - definition = Factory.APPLICATION(classname(val[1][:value]), val[2], val[4]) - loc(definition, val[0], val[5]) - result = add_definition(definition) - } - -capability_mapping - : classname capability_kw classname LBRACE attribute_operations endcomma RBRACE { - result = Factory.CAPABILITY_MAPPING(val[1][:value], - Factory.QREF(classname(val[0][:value])), - classname(val[2][:value]), val[4]) - loc result, val[0], val[6] - add_mapping(result) - } - | bracketed_expression capability_kw classname LBRACE attribute_operations endcomma RBRACE { - result = Factory.CAPABILITY_MAPPING(val[1][:value], - val[0], - classname(val[2][:value]), val[4]) - loc result, val[0], val[6] - add_mapping(result) - } - -capability_kw - : PRODUCES - | CONSUMES - #--PLAN plan_expression : PLAN stacked_classname parameter_list LBRACE opt_statements RBRACE { @@ -605,22 +573,6 @@ hostclass_expression : classname | DEFAULT -#---SITE -# -# Produces Model::SiteDefinition -# -site_definition_expression - : SITE LBRACE statements RBRACE { - definition = Factory.SITE(val[2]) - loc(definition, val[0], val[3]) - result = add_definition(definition) - } - | SITE LBRACE RBRACE { - definition = Factory.SITE(nil) - loc(definition, val[0], val[2]) - result = add_definition(definition) - } - #---NODE # # Produces Model::NodeDefinition @@ -828,10 +780,6 @@ collection_entries collection_entry_keyword : TYPE | FUNCTION - | APPLICATION - | CONSUMES - | PRODUCES - | SITE quotedtext : string @@ -915,10 +863,6 @@ keyword | ATTR | FUNCTION | PRIVATE - | APPLICATION - | CONSUMES - | PRODUCES - | SITE nil : { result = nil} From 2242d659668ad4e12f1d483ae689026f4c60e306 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Thu, 3 Sep 2020 15:57:59 -0700 Subject: [PATCH 137/731] (PUP-10446) Skip app orchestration evaluation Remove evaluation of site, applications, capability mappings in the catalog. Remove pruning of app orchestration resources when compiling a node catalog. --- lib/puppet/parser/compiler.rb | 198 ---------------------------------- 1 file changed, 198 deletions(-) diff --git a/lib/puppet/parser/compiler.rb b/lib/puppet/parser/compiler.rb index 5291e89877c..37948c5fdca 100644 --- a/lib/puppet/parser/compiler.rb +++ b/lib/puppet/parser/compiler.rb @@ -72,22 +72,6 @@ def add_override(override) end def add_resource(scope, resource) - type = resource.resource_type - if type.is_a?(Puppet::Resource::Type) && type.application? - @applications << resource - assert_app_in_site(scope, resource) - return - end - - if @current_app - # We are in the process of pulling application components out that - # apply to this node - Puppet.notice "Check #{resource}" - return unless @current_components.any? do |comp| - comp.type == resource.type && comp.title == resource.title - end - end - @resources << resource # Note that this will fail if the resource is not unique. @@ -110,22 +94,6 @@ def add_resource(scope, resource) end end - def assert_app_in_site(scope, resource) - if resource.type == 'App' - if scope.resource - # directly contained in a Site - return if scope.resource.type == 'Site' - # contained in something that may be contained in Site - upstream = @catalog.upstream_from_vertex(scope.resource) - if upstream - return if upstream.keys.map(&:type).include?('Site') - end - end - #TRANSLATORS "Site" is a puppet keyword and should not be translated - raise ArgumentError, _("Application instances like '%{resource}' can only be contained within a Site") % { resource: resource } - end - end - # Store the fact that we've evaluated a class def add_class(name) @catalog.add_class(name) unless name == "" @@ -160,22 +128,13 @@ def compile Puppet::Util::Profiler.profile(_("Compile: Created settings scope"), [:compiler, :create_settings_scope]) { create_settings_scope } - Puppet::Util::Profiler.profile(_("Compile: Evaluated capability mappings"), [:compiler, :evaluate_capability_mappings]) { evaluate_capability_mappings } - #TRANSLATORS "main" is a function name and should not be translated Puppet::Util::Profiler.profile(_("Compile: Evaluated main"), [:compiler, :evaluate_main]) { evaluate_main } - Puppet::Util::Profiler.profile(_("Compile: Evaluated site"), [:compiler, :evaluate_site]) { evaluate_site } - Puppet::Util::Profiler.profile(_("Compile: Evaluated AST node"), [:compiler, :evaluate_ast_node]) { evaluate_ast_node } Puppet::Util::Profiler.profile(_("Compile: Evaluated node classes"), [:compiler, :evaluate_node_classes]) { evaluate_node_classes } - Puppet::Util::Profiler.profile(_("Compile: Evaluated application instances"), [:compiler, :evaluate_applications]) { evaluate_applications } - - # New capability mappings may have been defined when the site was evaluated - Puppet::Util::Profiler.profile(_("Compile: Evaluated site capability mappings"), [:compiler, :evaluate_capability_mappings]) { evaluate_capability_mappings } - Puppet::Util::Profiler.profile(_("Compile: Evaluated generators"), [:compiler, :evaluate_generators]) { evaluate_generators } Puppet::Util::Profiler.profile(_("Compile: Validate Catalog pre-finish"), [:compiler, :validate_pre_finish]) do @@ -184,8 +143,6 @@ def compile Puppet::Util::Profiler.profile(_("Compile: Finished catalog"), [:compiler, :finish_catalog]) { finish } - Puppet::Util::Profiler.profile(_("Compile: Prune"), [:compiler, :prune_catalog]) { prune_catalog } - fail_on_unevaluated Puppet::Util::Profiler.profile(_("Compile: Validate Catalog final"), [:compiler, :validate_final]) do @@ -243,112 +200,6 @@ def evaluate_node_classes evaluate_classes(classes_without_params, @node_scope || topscope) end - # Evaluates the site - the top container for an environment catalog - # The site contain behaves analogous to a node - for the environment catalog, node expressions are ignored - # as the result is cross node. The site expression serves as a container for everything that is across - # all nodes. - # - # @api private - # - def evaluate_site - # Has a site been defined? If not, do nothing but issue a warning. - # - site = environment.known_resource_types.find_site() - unless site - on_empty_site() - return - end - - # Create a resource to model this site and add it to catalog - resource = site.ensure_in_catalog(topscope) - - # The site sets node scope to be able to shadow what is in top scope - @node_scope = topscope.class_scope(site) - - # Evaluates the logic contain in the site expression - resource.evaluate - end - - # @api private - def on_empty_site - # do nothing - end - - # Prunes the catalog by dropping all resources are contained under the Site (if a site expression is used). - # As a consequence all edges to/from dropped resources are also dropped. - # Once the pruning is performed, this compiler returns the pruned list when calling the #resources method. - # The pruning does not alter the order of resources in the resources list. - # - # @api private - def prune_catalog - prune_node_catalog - end - - def prune_node_catalog - # Everything under Site[site] should be pruned as that is for the environment catalog, not a node - # - the_site_resource = @catalog.resource('Site', 'site') - - if the_site_resource - # Get downstream vertexes returns a hash where the keys are the resources and values nesting level - to_be_removed = @catalog.downstream_from_vertex(the_site_resource).keys - - # Drop the Site[site] resource if it has no content - if to_be_removed.empty? - to_be_removed << the_site_resource - end - else - to_be_removed = [] - end - - # keep_from_site is populated with any App resources. - application_resources = @resources.select {|r| r.type == 'App' } - # keep all applications plus what is directly referenced from applications - keep_from_site = application_resources - keep_from_site += application_resources.map {|app| @catalog.direct_dependents_of(app) }.flatten - - to_be_removed -= keep_from_site - @catalog.remove_resource(*to_be_removed) - # set the pruned result - @resources = @catalog.resources - end - - # @api private - def evaluate_applications - @applications.each do |app| - components = [] - mapping = app.parameters[:nodes] ? app.parameters[:nodes].value : {} - raise Puppet::Error, _("Invalid node mapping in %{app}: Mapping must be a hash") % { app: app.ref } unless mapping.is_a?(Hash) - all_mapped = Set.new - mapping.each do |k,v| - raise Puppet::Error, _("Invalid node mapping in %{app}: Key %{k} is not a Node") % { app: app.ref, k: k } unless k.is_a?(Puppet::Resource) && k.type == 'Node' - v = [v] unless v.is_a?(Array) - v.each do |res| - raise Puppet::Error, _("Invalid node mapping in %{app}: Value %{res} is not a resource") % { app: app.ref, res: res } unless res.is_a?(Puppet::Resource) - raise Puppet::Error, _("Application %{app} maps component %{res} to multiple nodes") % { app: app.ref, res: res } if all_mapped.add?(res.ref).nil? - components << res if k.title == node.name - end - end - begin - @current_app = app - @current_components = components - unless @current_components.empty? - Puppet.notice "EVAL APP #{app} #{components.inspect}" - # Add the app itself since components mapped to the current node - # will have a containment edge for it - # @todo lutter 2015-01-28: the node mapping winds up in the - # catalog, but probably shouldn't - @catalog.add_resource(@current_app) - @current_app.evaluate - end - ensure - @current_app = nil - @current_components = nil - end - end - end - - # If ast nodes are enabled, then see if we can find and evaluate one. # # @api private @@ -391,12 +242,6 @@ def evaluate_classes(classes, scope, lazy_evaluate = true) classes = classes.keys end - unless @current_components.nil? - classes = classes.select do |title| - @current_components.any? { |comp| comp.class? && comp.title == title } - end - end - hostclasses = classes.collect do |name| environment.known_resource_types.find_hostclass(name) or raise Puppet::Error, _("Could not find class %{name} for %{node}") % { name: name, node: node.name } end @@ -427,16 +272,6 @@ def evaluate_relationships def initialize(node, code_id: nil) @node = sanitize_node(node) - # Array of resources representing all application instances we've found - @applications = [] - # We use @current_app and @current_components to signal to the - # evaluator that we are in the middle of evaluating an - # application. They are set in evaluate_applications to the application - # instance, resp. to an array of the components of that application - # that is mapped to the current node. They are only non-nil when we are - # in the middle of executing evaluate_applications - @current_app = nil - @current_components = nil @code_id = code_id initvars add_catalog_validators @@ -481,39 +316,6 @@ def ensure_classes_without_parameters(scope, hostclasses) [already_included, newly_included] end - def evaluate_capability_mappings - krt = environment.known_resource_types - krt.capability_mappings.each_value do |capability_mapping| - args = capability_mapping.arguments - component_ref = args['component'] - kind = args['kind'] - - # That component_ref is either a QREF or a Class['literal'|QREF] is asserted during validation so no - # need to check that here - if component_ref.is_a?(Puppet::Pops::Model::QualifiedReference) - component_name = component_ref.cased_value - component_type = 'type' - component = krt.find_definition(component_name) - else - component_name = component_ref.keys[0].value - component_type = 'class' - component = krt.find_hostclass(component_name) - end - if component.nil? - raise Puppet::ParseError, _("Capability mapping error: %{kind} clause references nonexistent %{component_type} %{component_name}") % - { kind: kind, component_type: component_type, component_name: component_name } - end - - blueprint = args['blueprint'] - if kind == 'produces' - component.add_produces(blueprint) - else - component.add_consumes(blueprint) - end - end - krt.capability_mappings.clear # No longer needed - end - # Evaluate our collections and return true if anything returned an object. # The 'true' is used to continue a loop, so it's important. def evaluate_collections From de9c2b3b01ae7202ef441da0dbc41108b8ca013a Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Wed, 2 Sep 2020 14:50:31 -0700 Subject: [PATCH 138/731] (PUP-10446) Generate eparser after removing application/site/capability Generated using `bundle exec rake gen_eparser`. Update tests due to the parser raising syntax errors. --- lib/puppet/pops/parser/eparser.rb | 3226 ++++++++--------- spec/unit/capability_spec.rb | 344 +- .../pops/parser/parse_application_spec.rb | 26 +- .../parser/parse_basic_expressions_spec.rb | 1 - .../pops/parser/parse_capabilities_spec.rb | 29 +- spec/unit/pops/parser/parse_site_spec.rb | 44 +- .../pops/resource/resource_type_impl_spec.rb | 71 - spec/unit/pops/validator/validator_spec.rb | 61 +- 8 files changed, 1588 insertions(+), 2214 deletions(-) diff --git a/lib/puppet/pops/parser/eparser.rb b/lib/puppet/pops/parser/eparser.rb index 54e28a7c910..0cf19da1ef3 100644 --- a/lib/puppet/pops/parser/eparser.rb +++ b/lib/puppet/pops/parser/eparser.rb @@ -20,7 +20,7 @@ module Pops module Parser class Parser < Racc::Parser -module_eval(<<'...end egrammar.ra/module_eval...', 'egrammar.ra', 939) +module_eval(<<'...end egrammar.ra/module_eval...', 'egrammar.ra', 883) # Make emacs happy # Local Variables: @@ -30,322 +30,291 @@ class Parser < Racc::Parser ##### State transition tables begin ### clist = [ -'67,79,304,-148,65,73,304,74,89,90,91,73,116,74,-290,307,426,179,74,-281', -'418,352,-293,305,21,20,118,305,121,-295,131,54,117,57,128,69,12,342', -'63,46,49,292,56,47,10,11,-148,287,66,19,180,416,48,120,307,17,18,-290', -'92,94,93,95,-281,84,353,-293,130,270,295,55,127,293,-295,45,80,97,82', -'83,129,-190,-190,64,51,70,71,58,415,116,62,60,61,67,79,72,427,65,73', -'116,74,72,154,118,154,121,471,403,470,117,131,271,414,118,128,121,429', -'21,20,117,-280,154,404,413,54,157,57,157,69,12,120,63,46,49,475,56,47', -'10,11,116,120,66,19,476,157,48,130,304,17,18,127,330,97,118,331,121', -'84,131,129,117,526,128,55,-280,131,458,45,80,128,82,83,471,399,470,64', -'51,70,71,58,-235,120,62,60,61,67,79,72,116,65,73,434,74,400,130,459', -'98,99,127,436,458,130,118,97,121,127,129,131,117,21,20,128,399,129,124', -'307,54,396,57,394,69,136,116,63,46,49,390,56,47,120,443,181,79,66,19', -'182,118,48,121,444,17,18,117,130,98,99,131,127,84,131,128,97,388,128', -'55,129,131,350,45,80,128,82,83,120,333,332,64,51,70,71,58,133,134,62', -'60,61,67,79,72,116,65,73,130,74,351,130,127,-190,-190,127,133,134,130', -'118,129,121,127,129,131,117,21,20,128,447,129,-191,-191,54,383,57,379', -'69,136,116,63,46,49,450,56,47,120,-192,-192,377,66,19,399,118,48,121', -'399,17,18,117,130,98,99,131,127,84,376,128,97,-194,-194,55,129,131,160', -'45,80,128,82,83,120,283,282,64,51,70,71,58,283,282,62,60,61,67,79,72', -'358,65,73,130,74,283,282,127,131,460,453,461,128,130,131,129,171,127', -'128,131,464,21,20,128,465,129,283,282,54,350,57,96,69,12,96,63,46,49', -'468,56,47,10,11,96,130,66,19,472,127,48,130,304,17,18,127,130,129,283', -'282,127,84,131,129,474,307,128,55,129,344,345,45,80,305,82,83,96,88', -'328,64,51,70,71,58,-236,116,62,60,61,67,79,72,328,65,73,304,74,322,130', -'118,321,121,127,485,486,117,295,488,307,291,129,490,379,21,20,350,305', -'290,171,160,54,287,57,494,69,12,120,63,46,49,297,56,47,10,11,-235,496', -'66,19,384,350,48,286,499,17,18,386,500,304,350,285,96,84,503,96,304', -'272,88,55,205,507,307,45,80,474,82,83,509,307,305,64,51,70,71,58,202', -'305,62,60,61,67,79,72,511,65,73,512,74,513,350,515,516,200,184,358,521', -'522,523,524,525,171,170,161,160,21,20,96,534,88,537,538,54,539,57,85', -'69,12,541,63,46,49,86,56,47,10,11,542,543,66,19,544,421,48,,,17,18,', -',,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72', -',65,73,,74,,,,,,,,,,,,,,,,,21,20,145,,,,,54,,57,,69,12,,63,46,49,,56', -'47,10,11,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,149', -'146,70,71,147,153,152,148,60,61,67,79,72,,65,73,,74,530,,,,,,,,,,,,', -',,,21,20,,,,,,54,,57,,69,12,,63,46,49,,56,47,10,11,,,66,19,,,48,,,17', -'18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67', -'79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,136,,63,46,49', -',56,47,,,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64', -'51,70,71,58,,,62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,', -',,54,,57,,69,136,,63,46,49,,56,47,,,,,66,19,,,48,,,17,18,,,,,,,84,,', -',,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72,,65,73,', -'74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,136,,63,46,49,,56,47,,,,,66', -'19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,', -',62,60,61,67,79,72,,65,73,,74,536,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,', -'69,12,,63,46,49,,56,47,10,11,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,', -',,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72,,65,73,,74,528', -',,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,12,,63,46,49,,56,47,10,11,,,66', -'19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,', -',62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69', -'12,,63,46,49,,56,47,10,11,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45', -'80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72,,65,73,,74,,,,,,,,,', -',,,,,,,21,20,,,,,,54,,57,,69,12,,63,46,49,,56,47,10,11,,,66,19,,,48', -',,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61', -'67,79,72,,65,73,186,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,12,,63', -'46,49,,56,47,10,11,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82', -'83,,,,149,146,70,71,147,153,152,148,60,61,67,79,72,,65,73,191,74,,,', -',,,,,,,,,,,,,21,20,,,,,,54,,57,,69,12,,63,46,49,,56,47,10,11,,,66,19', -',,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,149,146,70,71,147,153', -'152,148,60,61,67,79,72,,65,73,,74,193,,,,,,,,,,,,,,,,21,20,,,,,,54,', -'57,,69,12,,63,46,49,,56,47,10,11,,,66,19,,,48,,,17,18,,,,,,,84,,,,,', -'55,,,,45,80,,82,83,,,,149,146,70,71,147,153,152,148,60,61,67,79,72,', -'65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,12,,63,46,49,,56,47', -'10,11,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51', -'70,71,58,,,62,60,61,67,79,72,,65,73,,74,518,,,,,,,,,,,,,,,,21,20,,,', -',,54,,57,,69,12,,63,46,49,,56,47,10,11,,,66,19,,,48,,,17,18,,,,,,,84', -',,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72,,65,73', -',74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,136,,63,46,49,,56,47,,,,,66', -'19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,', -',62,60,61,67,79,72,,65,73,,204,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69', -'136,,63,46,49,,56,47,,,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80', -',82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,', -',,,,21,20,,,,,,54,,57,,69,136,,63,46,49,,56,47,,,,,66,19,,,48,,,17,18', -',,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79', -'72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,12,,63,46,49,,56', -'47,10,11,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64', -'51,70,71,58,,,62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,', -',,54,,57,,69,12,,63,46,49,,56,47,10,11,,,66,19,,,48,,,17,18,,,,,,,84', -',,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72,,65,73', -',74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,12,,63,46,49,,56,47,10,11', -',,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71', -'58,,,62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57', -',69,12,,63,46,49,,56,47,10,11,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55', -',,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72,,65,73,,74,,,', -',,,,,,,,,,,,,21,20,,,,,,54,,57,,69,12,,63,46,49,,56,47,10,11,,,66,19', -',,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62', -'60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,12,', -'63,46,49,,56,47,10,11,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80', -',82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,', -',,,,21,20,,,,,,54,,57,,69,12,,63,46,49,,56,47,10,11,,,66,19,,,48,,,17', -'18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67', -'79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,12,,63,46,49', -',56,47,10,11,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,', -',,64,51,70,71,58,,,62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20', -',,,,,222,237,228,238,69,230,240,232,46,220,,224,218,,,,,66,19,241,236', -'219,,,17,217,,,,,,,84,,,,,239,223,,,,45,80,,82,83,,,,233,221,234,235', -'229,243,242,231,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,', -',54,,57,,69,136,,63,46,49,,56,47,,,,,66,19,,,48,,,17,18,,,,,,,84,,,', -',,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72,,65,73,,74', -',,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,136,,63,46,49,,56,47,,,,,66,19', -',,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62', -'60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,136', -',63,46,49,,56,47,,,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82', -'83,,,,64,51,70,71,58,,,62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,', -'21,20,,,,,,54,,57,,69,136,,63,46,49,,56,47,,,,,66,19,,,48,,,17,18,,', -',,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72', -',65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,136,,63,46,49,,56,47', -',,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70', -'71,58,,,62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,', -'57,,69,136,,63,46,49,,56,47,,,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55', -',,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72,,65,73,,74,,,', -',,,,,,,,,,,,,21,20,,,,,,54,,57,,69,136,,63,46,49,,56,47,,,,,66,19,,', -'48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60', -'61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,136,,63', -'46,49,,56,47,,,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83', -',,,64,51,70,71,58,,,62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21', -'20,,,,,,54,,57,,69,136,,63,46,49,,56,47,,,,,66,19,,,48,,,17,18,,,,,', -',84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72,,65', -'73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,136,,63,46,49,,56,47,,', -',,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71', -'58,,,62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57', -',69,136,,63,46,49,,56,47,,,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,', -'45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72,,65,73,,74,,,,,,', -',,,,,,,,,,21,20,,,,,,54,,57,,69,136,,63,46,49,,56,47,,,,,66,19,,,48', -',,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61', -'67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,136,,63,46', -'49,,56,47,,,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,', -',64,51,70,71,58,,,62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20', -',,,,,54,,57,,69,136,,63,46,49,,56,47,,,,,66,19,,,48,,,17,18,,,,,,,84', -',,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72,,65,73', -',74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,136,,63,46,49,,56,47,,,,,66', -'19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,', -',62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69', -'136,,63,46,49,,56,47,,,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80', -',82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,', -',,,,21,20,,,,,,54,,57,,69,136,,63,46,49,,56,47,,,,,66,19,,,48,,,17,18', -',,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79', -'72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,136,,63,46,49,,56', -'47,,,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51', -'70,71,58,,,62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54', -',57,,69,136,,63,46,49,,56,47,,,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55', -',,265,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72,,65,73,,74', -',,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,12,,63,46,49,,56,47,10,11,,,66', -'19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,149,146,70,71,147', -'153,152,148,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54', -',57,,69,136,,63,46,49,,56,47,,,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55', -',,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72,,65,73,,74,,,', -',,,,,,,,,,,,,21,20,,,,,,54,,57,,69,136,,63,46,49,,56,47,,,,,66,19,,', -'48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60', -'61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,12,,63', -'46,49,,56,47,10,11,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82', -'83,,,,149,146,70,71,147,153,152,148,60,61,67,79,72,,65,73,,74,,,,,,', -',,,,,,,,,,21,20,,,,,,54,,57,,69,12,,63,46,49,,56,47,10,11,,,66,19,,', -'48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60', -'61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,136,,63', -'46,49,,56,47,,,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83', -',,,64,51,70,71,58,,,62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21', -'20,,,,,,54,,57,,69,12,,63,46,49,,56,47,10,11,,,66,19,,,48,,,17,18,,', -',,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72', -',65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,12,,63,46,49,,56,47', -'10,11,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,149,146', -'70,71,147,153,152,148,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20', -',,,,,54,,57,,69,12,,63,46,49,,56,47,10,11,,,66,19,,,48,,,17,18,,,,,', -',84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72,,65', -'73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,136,,63,46,49,,56,47,,', -',,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71', -'58,,,62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57', -',69,12,,63,46,49,,56,47,10,11,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55', -',,,45,80,,82,83,,,,149,146,70,71,147,153,152,148,60,61,67,79,72,,65', -'73,,74,,,,,,,,,,,,,,,,,21,20,309,,,,,54,,57,,69,12,,63,46,49,,56,47', -'10,11,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,149,146', -'70,71,147,153,152,148,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20', -',,,,,54,,57,,69,12,,63,46,49,,56,47,10,11,,,66,19,,,48,,,17,18,,,,,', -',84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72,,65', -'73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,136,,63,46,49,,56,47,,', -',,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71', -'58,,,62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57', -',69,12,,63,46,49,,56,47,10,11,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55', -',,,45,80,,82,83,,,,149,146,70,71,147,153,152,148,60,61,67,79,72,,65', -'73,,74,319,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,12,,63,46,49,,56,47', -'10,11,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51', -'70,71,58,,,62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54', -',57,,69,12,,63,46,49,,56,47,10,11,,,66,19,,,48,,,17,18,,,,,,,84,,,,', -',55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72,,65,73,,74', -',,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,136,,63,46,49,,56,47,,,,,66,19', -',,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62', -'60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,12,', -'63,46,49,,56,47,10,11,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80', -',82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,', -',,,,21,20,,,,,,54,,57,,69,12,,63,46,49,,56,47,10,11,,,66,19,,,48,,,17', -'18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67', -'79,72,,65,73,,74,477,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,136,,63,46', -'49,,56,47,,,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,', -',64,51,70,71,58,,,62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20', -',,,,,54,,57,,69,12,,63,46,49,,56,47,10,11,,,66,19,,,48,,,17,18,,,,,', -',84,,,,,,55,,,,45,80,,82,83,81,,,64,51,70,71,58,,,62,60,61,67,79,72', -',65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,12,,63,46,49,,56,47', -'10,11,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51', -'70,71,58,,,62,60,61,67,79,72,,65,73,,74,193,,,,,,,,,,,,,,,,21,20,,,', -',,54,,57,,69,12,,63,46,49,,56,47,10,11,,,66,19,,,48,,,17,18,,,,,,,84', -',,,,,55,,,,45,80,,82,83,,,,149,146,70,71,147,153,152,148,60,61,67,79', -'72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,12,,63,46,49,,56', -'47,10,11,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,149', -'146,70,71,147,153,152,148,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,', -'21,20,,,,,,54,,57,,69,136,,63,46,49,,56,47,,,,,66,19,,,48,,,17,18,,', -',,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72', -',65,73,,74,,,351,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,136,,63,46,49,,56', -'47,,,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51', -'70,71,58,,,62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54', -',57,,69,136,,63,46,49,,56,47,,,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55', -',,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72,,65,73,,74,,,', -',,,,,,,,,,,,,21,20,,,,,,54,,57,,69,136,,63,46,49,,56,47,,,,,66,19,,', -'48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60', -'61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,136,,63', -'46,49,,56,47,,,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83', -',,,64,51,70,71,58,,,62,60,61,67,79,72,,65,73,,74,463,,,,,,,,,,,,,,,', -'21,20,,,,,,54,,57,,69,12,,63,46,49,,56,47,10,11,,,66,19,,,48,,,17,18', -',,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79', -'72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,136,,63,46,49,,56', -'47,,,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51', -'70,71,58,,,62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54', -',57,,69,136,,63,46,49,,56,47,,,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55', -',,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72,,65,73,,74,,,', -',,,,,,,,,,,,,21,20,,,,,,54,,57,,69,12,,63,46,49,,56,47,10,11,,,66,19', -',,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,149,146,70,71,147,153', -'152,148,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57', -',69,12,,63,46,49,,56,47,10,11,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55', -',,,45,80,,82,83,,,,149,146,70,71,147,153,152,148,60,61,67,79,72,,65', -'73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,136,,63,46,49,,56,47,,', -',,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71', -'58,,,62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57', -',69,12,,63,46,49,,56,47,10,11,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55', -',,,45,80,,82,83,,,,149,146,70,71,147,153,152,148,60,61,67,79,72,,65', -'73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,12,,63,46,49,,56,47,10', -'11,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,149,146', -'70,71,147,153,152,148,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20', -',,,,,54,,57,,69,12,,63,46,49,,56,47,10,11,,,66,19,,,48,,,17,18,,,,,', -',84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72,,65', -'73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,136,,63,46,49,,56,47,,', -',,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71', -'58,,,62,60,61,67,79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57', -',69,136,,63,46,49,,56,47,,,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,', -'45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67,79,72,,65,73,,74,,,,,,', -',,,,,,,,,,21,20,,,,,,54,,57,,69,136,,63,46,49,,56,47,,,,,66,19,,,48', -',,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61', -'67,79,72,,65,73,,74,406,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,12,,63', -'46,49,,56,47,10,11,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82', -'83,,,,64,51,70,71,58,,,62,60,61,67,79,72,,65,73,,74,408,,,,,,,,,,,,', -',,,21,20,,,,,,54,,57,,69,12,,63,46,49,,56,47,10,11,,,66,19,,,48,,,17', -'18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64,51,70,71,58,,,62,60,61,67', -'79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,136,,63,46,49', -',56,47,,,,,66,19,,,48,,,17,18,,,,,,,84,,,,,,55,,,,45,80,,82,83,,,,64', -'51,70,71,58,,,62,60,61,67,79,72,,65,73,,74,430,,,,,,,,,,,,,,,,21,20', -',,,,,54,,57,,69,12,,63,46,49,,56,47,10,11,,,66,19,,,48,,,17,18,,,,,', -',84,,,,,,55,,,,45,80,,82,83,,,,149,146,70,71,147,153,152,148,60,61,67', -'79,72,,65,73,,74,,,,,,,,,,,,,,,,,21,20,,,,,,54,,57,,69,12,,63,46,49', -',56,47,10,11,,,66,19,,,48,,,17,18,181,79,,,182,,84,,,,,,55,,,,45,80', -',82,83,,,,149,146,70,71,147,153,152,148,60,61,116,,72,,,,179,,,176,', -',112,107,118,,121,,115,,117,,108,110,109,111,,,,84,181,79,,,182,,,,', -'180,80,120,,,,114,113,,,100,101,103,102,105,106,,98,99,,,,,,97,116,', -',,181,79,179,,182,176,344,345,112,107,118,380,121,,115,,117,,108,110', -'109,111,104,,,84,,,,,,,,,,180,80,120,,,179,114,113,176,116,100,101,103', -'102,105,106,,98,99,,,112,107,118,97,121,,115,84,117,,108,110,109,111', -',,,180,80,,,,,,,,,,,120,104,,,114,113,,,100,101,103,102,105,106,,98', -'99,116,,312,,,97,,,,,,,112,107,118,,121,116,115,,117,,108,110,109,111', -',,,,,118,104,121,,,,117,181,79,,120,182,,,114,113,,,100,101,103,102', -'105,106,,98,99,120,,,,,97,,,100,101,103,102,105,106,,98,99,116,,,179', -',97,176,,,,,,112,107,118,104,121,,115,,117,,108,110,109,111,84,,,,,', -'104,,,,180,80,,,,120,,,,114,113,,116,100,101,103,102,105,106,,98,99', -',,112,107,118,97,121,116,115,,117,,108,110,109,111,,,,,,118,,121,,,', -'117,,,,120,104,,,114,113,,,100,101,103,102,105,106,,98,99,120,,,,,97', -',,,,103,102,,116,,98,99,,,,,,97,,,112,107,118,,121,116,115,104,117,', -'108,110,109,111,,,,,107,118,,121,,,104,117,,108,,120,,,,114,113,,,100', -'101,103,102,105,106,,98,99,120,,,116,,97,,,100,101,103,102,105,106,', -'98,99,118,,121,116,,97,117,,,,,,,,,104,107,118,,121,,,,117,,108,,120', -',,,116,104,,,100,101,103,102,,,,98,99,120,118,,121,,97,,117,100,101', -'103,102,105,106,,98,99,,,,,,97,,,,,,120,,,,104,,,,,,103,102,116,,,98', -'99,,,,,104,97,,112,107,118,,121,,115,,117,,108,110,109,111,,,,,,,,,', -',,104,,,,120,,,,114,113,,116,100,101,103,102,105,106,,98,99,,,,107,118', -'97,121,,,,117,,108,,,,,,,,,,,,,,,,,,,120,104,,,,116,,,100,101,103,102', -'105,106,,98,99,112,107,118,,121,97,115,,117,,108,110,109,111,,,,,,,', -',,,,,,,,120,,,104,114,113,,116,100,101,103,102,105,106,,98,99,,,,107', -'118,97,121,,,,117,,108,,,,,,,,,,,,,,,,,,,120,104,,,,116,,,100,101,103', -'102,105,106,,98,99,112,107,118,,121,97,115,,117,,108,110,109,111,,,', -',,,,,,,,,,,,120,,,104,,116,,,100,101,103,102,105,106,,98,99,112,107', -'118,,121,97,115,,117,,108,110,109,111,,,,,,,,,,,,,,,,120,,,104,,113', -',,100,101,103,102,105,106,116,98,99,,,354,,,97,,,,112,107,118,,121,', -'115,,117,,108,110,109,111,,,,,,,,,,104,,,,,,120,,,,114,113,,,100,101', -'103,102,105,106,,98,99,116,-66,,,,97,-66,,,,,,112,107,118,,121,,115', -',117,,108,110,109,111,,,,,,,104,,,,,,,,,120,,,,114,113,,116,100,101', -'103,102,105,106,,98,99,,,112,107,118,97,121,,115,,117,,108,110,109,111', -',,,,,,,,,,,,,,,120,104,,,114,113,,116,100,101,103,102,105,106,,98,99', -',,112,107,118,97,121,,115,,117,,108,110,109,111,,,,,,,,,,,,,,,,120,104', -',,114,113,,,100,101,103,102,105,106,116,98,99,,,,,,97,,,,112,107,118', -'348,121,116,115,,117,,108,110,109,111,,,,,,118,,121,,104,,117,,,,120', -',,,114,113,,,100,101,103,102,105,106,,98,99,120,,,116,,97,,,100,101', -'103,102,,,,98,99,118,,121,,,97,117,,,,,,,,,104,,,,,,,,,,,,120,,,,,104', -',,100,101,103,102,105,106,,98,99,116,,310,,,97,,,,,,,112,107,118,,121', -',115,,117,,108,110,109,111,,,,,,,104,,,,,,,,,120,,,,114,113,,,100,101', -'103,102,105,106,,98,99,116,,311,,,97,,,,,,,112,107,118,,121,,115,,117', -',108,110,109,111,,,,,,,104,,,,,,,,,120,,,,114,113,,116,100,101,103,102', -'105,106,,98,99,,,112,107,118,97,121,,115,,117,,108,110,109,111,,,,,', -',,,,,,,,,,120,104,,,114,113,,,100,101,103,102,105,106,,98,99,,366,237', -'365,238,97,363,240,367,,360,,362,364,,,,,,,241,236,368,,,,361,,,,,,104', -',,,,,239,369,,,,,,,,,,,,372,370,373,371,374,243,242,375,366,237,365', -'238,,363,240,367,,360,,362,364,,,,,,,241,236,368,,,,361,,,,,,,,,,,,239', -'369,,,,,,,,,,,,372,370,373,371,374,243,242,375,366,237,365,238,,363', -'240,367,,360,,362,364,,,,,,,241,236,368,,,,361,,,,,,,,,,,,239,369,,', -',,,,,,,,,372,370,373,371,374,243,242,375,366,237,365,238,,363,240,367', -',360,,362,364,,,,,,,241,236,368,,,,361,,,,,,,,,,,,239,369,,,,,,,,,,', -',372,370,373,371,374,243,242,375,366,237,365,238,,363,240,367,,360,', -'362,364,,,,,,,241,236,368,,,,361,,,,,,,,,,,,239,369,,,,,,,,,,,,372,370', -'373,371,374,243,242,375,366,237,365,238,,363,240,367,,360,,362,364,', -',,,,,241,236,368,,,,361,,,,,,,,,,,,239,369,,,,,,,,,,,,372,370,373,371', -'374,243,242,375' ] - racc_action_table = arr = ::Array.new(10662, nil) +'69,72,-279,110,70,64,141,65,-281,281,368,324,110,163,64,-267,65,112', +'-276,115,248,-145,-225,111,20,19,112,141,115,144,282,51,111,54,400,60', +'127,269,57,43,46,90,53,44,114,-279,164,141,77,18,144,-281,45,114,325', +'16,17,77,-267,92,93,-276,249,78,-145,372,91,270,125,52,144,402,122,42', +'73,91,75,76,261,260,373,58,48,61,62,55,56,69,72,63,82,70,64,281,65,428', +'281,300,63,110,485,83,84,85,124,423,77,302,121,77,303,20,19,112,282', +'115,123,282,51,111,54,409,60,12,281,57,43,46,314,53,44,10,11,305,304', +'77,18,77,440,45,114,424,16,17,410,282,423,441,261,260,78,86,88,87,89', +'436,52,435,-226,274,42,73,91,75,76,436,322,435,58,48,61,62,55,56,69', +'72,63,323,70,64,413,65,175,338,217,337,218,300,335,220,339,392,332,65', +'334,336,69,72,20,19,70,416,221,216,340,51,294,54,333,60,12,110,57,43', +'46,368,53,44,10,11,219,341,77,18,368,112,45,115,147,16,17,111,425,344', +'342,345,343,78,316,317,261,260,426,52,261,260,293,42,73,429,75,76,114', +'430,433,138,137,61,62,55,56,69,72,63,437,70,64,439,65,272,338,217,337', +'218,268,335,220,339,267,332,448,334,336,449,451,20,19,147,453,221,216', +'340,51,322,54,333,60,12,264,57,43,46,-225,53,44,10,11,219,341,77,18', +'263,262,45,457,459,16,17,322,90,344,342,345,343,78,462,463,125,125,125', +'52,122,122,122,42,73,90,75,76,74,250,465,58,48,61,62,55,56,69,72,63', +'82,70,64,187,65,184,469,439,471,182,473,474,124,124,124,475,121,121', +'121,476,166,20,19,155,123,123,123,125,51,330,54,122,60,12,481,57,43', +'46,482,53,44,10,11,483,484,77,18,148,147,45,90,82,16,17,125,69,72,495', +'122,70,78,118,496,124,125,497,52,121,122,79,42,73,499,75,76,123,500', +'501,58,48,61,62,55,56,69,72,63,502,70,64,124,65,349,359,121,163,353', +'349,160,347,124,125,123,363,121,122,125,365,20,19,122,77,123,368,369', +'51,281,54,78,60,127,346,57,43,46,330,53,44,164,73,382,383,77,18,356', +'264,45,124,387,16,17,121,124,281,419,322,121,78,272,123,393,125,90,52', +'123,122,77,42,73,395,75,76,90,90,282,58,48,61,62,55,56,69,72,63,,70', +'64,,65,,,,,,,,,124,,,,121,,,,20,19,,,123,,,51,,54,,60,12,110,57,43,46', +',53,44,10,11,,,77,18,,112,45,115,,16,17,111,69,72,,,70,78,,,,,,52,,', +',42,73,,75,76,114,,,138,137,61,62,55,56,69,72,63,,70,64,110,65,,,,163', +',,160,,,,,,112,,115,,20,19,111,,,,,51,,54,78,60,127,110,57,43,46,,53', +'44,164,73,,114,77,18,,112,45,115,,16,17,111,69,72,,,70,78,,,,,,52,,', +',42,73,,75,76,114,,,58,48,61,62,55,56,69,72,63,,70,64,,65,,,,163,,,160', +',,,,,,,,,20,19,,,,,,51,,54,78,60,127,,57,43,46,,53,44,164,73,,,77,18', +',,45,,,16,17,,69,72,,,70,78,,,,,,52,,,,42,73,,75,76,,,,58,48,61,62,55', +'56,69,72,63,,70,64,,65,,,,163,,,160,,,,,,,,,,20,19,,,354,,,51,,54,78', +'60,127,281,57,43,46,,53,44,164,73,,,77,18,77,,45,,,16,17,,282,,,,,78', +',,,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69,72,63,110,70,64,,65', +',,,,,,,,,112,,115,,,,111,20,19,,,,,,51,,54,,60,127,,57,43,46,,53,44', +'114,,,,77,18,,,45,,,16,17,,,92,93,,,78,,,91,,,52,,,,42,73,,75,76,,,', +'58,48,61,62,55,56,69,72,63,110,70,64,,65,,,,,,,,,,112,,115,,,,111,20', +'19,,,,,,51,,54,,60,127,,57,43,46,,53,44,114,,,,77,18,,,45,,,16,17,,', +'92,93,,,78,,,91,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69,72,63,', +'70,64,,65,,338,217,337,218,,335,220,339,,332,,334,336,,,20,19,,,221', +'216,340,51,,54,333,60,127,,57,43,46,,53,44,,,219,341,77,18,,,45,,,16', +'17,,,344,342,345,343,78,,,,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56', +'69,72,63,,70,64,,65,,338,217,337,218,,335,220,339,,332,,334,336,,,20', +'19,,,221,216,340,51,,54,333,60,12,,57,43,46,,53,44,10,11,219,341,77', +'18,,,45,,,16,17,,,344,342,345,343,78,,,,,,52,,,,42,73,,75,76,,,,58,48', +'61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60', +'12,,57,43,46,,53,44,10,11,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42', +'73,,75,76,,,,58,48,61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20', +'19,136,,,,,51,,54,,60,12,,57,43,46,,53,44,10,11,,,77,18,,,45,,,16,17', +',,,,,,78,,,,,,52,,,,42,73,,75,76,,,,138,137,61,62,55,56,69,72,63,,70', +'64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,12,,57,43,46,80,53,44,10', +'11,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58,48,61', +'62,55,56,69,72,63,,70,64,,65,489,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60', +'12,,57,43,46,,53,44,10,11,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42', +'73,,75,76,,,,58,48,61,62,55,56,69,72,63,,70,64,,65,487,,,,,,,,,,,,,', +',,20,19,,,,,,51,,54,,60,12,,57,43,46,,53,44,10,11,,,77,18,,,45,,,16', +'17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69,72,63,,70', +'64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,127,,57,43,46,,53,44,,', +',,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58,48,61,62', +'55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,127', +',57,43,46,,53,44,,,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75', +'76,,,,58,48,61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,', +',,,51,,54,,60,127,,57,43,46,,53,44,,,,,77,18,,,45,,,16,17,,,,,,,78,', +',,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69,72,63,,70,64,,65,375', +',,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,12,,57,43,46,,53,44,10,11,,,77', +'18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56', +'69,72,63,,70,64,,65,377,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,12,,57', +'43,46,,53,44,10,11,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75', +'76,,,,58,48,61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,', +',,,51,,54,,60,12,,57,43,46,,53,44,10,11,,,77,18,,,45,,,16,17,,,,,,,78', +',,,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69,72,63,,70,64,,65,,,', +',,,,,,,,,,,,,20,19,,,,,,51,,54,,60,127,,57,43,46,,53,44,,,,,77,18,,', +'45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69', +'72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,127,,57,43,46', +',53,44,,,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58', +'48,61,62,55,56,69,72,63,,70,64,,65,478,,,,,,,,,,,,,,,,20,19,,,,,,51', +',54,,60,12,,57,43,46,,53,44,10,11,,,77,18,,,45,,,16,17,,,,,,,78,,,,', +',52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69,72,63,,70,64,168,65,,,,', +',,,,,,,,,,,,20,19,,,,,,51,,54,,60,12,,57,43,46,,53,44,10,11,,,77,18', +',,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,138,137,61,62,55,56', +'69,72,63,,70,64,173,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,12,,57', +'43,46,,53,44,10,11,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75', +'76,,,,138,137,61,62,55,56,69,72,63,,70,64,,65,175,,,,,,,,,,,,,,,,20', +'19,,,,,,51,,54,,60,12,,57,43,46,,53,44,10,11,,,77,18,,,45,,,16,17,,', +',,,,78,,,,,,52,,,,42,73,,75,76,,,,138,137,61,62,55,56,69,72,63,,70,64', +',65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,12,,57,43,46,,53,44,10,11', +',,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58,48,61,62', +'55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,127', +',57,43,46,,53,44,,,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75', +'76,,,,58,48,61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,', +',,,51,,54,,60,127,,57,43,46,,53,44,,,,,77,18,,,45,,,16,17,,,,,,,78,', +',,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69,72,63,,70,64,,186,,,', +',,,,,,,,,,,,,20,19,,,,,,51,,54,,60,127,,57,43,46,,53,44,,,,,77,18,,', +'45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69', +'72,63,,70,64,,65,494,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,12,,57,43', +'46,,53,44,10,11,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76', +',,,58,48,61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,', +'51,,54,,60,12,,57,43,46,,53,44,10,11,,,77,18,,,45,,,16,17,,,,,,,78,', +',,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69,72,63,,70,64,,65,,,,', +',,,,,,,,,,,,20,19,,,,,,51,,54,,60,12,,57,43,46,,53,44,10,11,,,77,18', +',,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,138,137,61,62,55,56', +'69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,12,,57,43', +'46,,53,44,10,11,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76', +',,,58,48,61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,', +'51,,54,,60,12,,57,43,46,,53,44,10,11,,,77,18,,,45,,,16,17,,,,,,,78,', +',,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69,72,63,,70,64,,65,,,,', +',,,,,,,,,,,,20,19,,,,,,51,,54,,60,12,,57,43,46,,53,44,10,11,,,77,18', +',,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69', +'72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,12,,57,43,46', +',53,44,10,11,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,', +',,58,48,61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51', +',54,,60,12,,57,43,46,,53,44,10,11,,,77,18,,,45,,,16,17,,,,,,,78,,,,', +',52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69,72,63,,70,64,,65,,,,,,,', +',,,,,,,,,20,19,,,,,,51,,54,,60,12,,57,43,46,,53,44,10,11,,,77,18,,,45', +',,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69,72', +'63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,12,,57,43,46,,53', +'44,10,11,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58', +'48,61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54', +',60,12,,57,43,46,,53,44,10,11,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52', +',,,42,73,,75,76,,,,58,48,61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,', +',,,,,20,19,,,,,,204,217,210,218,60,211,220,212,43,202,,206,200,,,,,77', +'18,221,216,201,,,16,199,,,,,,,78,,,,,219,205,,,,42,73,,75,76,,,,213', +'203,214,215,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51', +',54,,60,127,,57,43,46,,53,44,,,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52', +',,,42,73,,75,76,,,,58,48,61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,', +',,,,,20,19,,,,,,51,,54,,60,127,,57,43,46,,53,44,,,,,77,18,,,45,,,16', +'17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69,72,63,,70', +'64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,127,,57,43,46,,53,44,,', +',,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58,48,61,62', +'55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,127', +',57,43,46,,53,44,,,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75', +'76,,,,58,48,61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,', +',,,51,,54,,60,127,,57,43,46,,53,44,,,,,77,18,,,45,,,16,17,,,,,,,78,', +',,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69,72,63,,70,64,,65,,,,', +',,,,,,,,,,,,20,19,,,,,,51,,54,,60,127,,57,43,46,,53,44,,,,,77,18,,,45', +',,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69,72', +'63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,127,,57,43,46,,53', +'44,,,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58,48', +'61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60', +'127,,57,43,46,,53,44,,,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73', +',75,76,,,,58,48,61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19', +',,,,,51,,54,,60,127,,57,43,46,,53,44,,,,,77,18,,,45,,,16,17,,,,,,,78', +',,,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69,72,63,,70,64,,65,,,', +',,,,,,,,,,,,,20,19,,,,,,51,,54,,60,127,,57,43,46,,53,44,,,,,77,18,,', +'45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69', +'72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,127,,57,43,46', +',53,44,,,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58', +'48,61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54', +',60,127,,57,43,46,,53,44,,,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,', +'42,73,,75,76,,,,58,48,61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,', +',,20,19,,,,,,51,,54,,60,127,,57,43,46,,53,44,,,,,77,18,,,45,,,16,17', +',,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69,72,63,,70,64', +',65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,127,,57,43,46,,53,44,,,,,77', +'18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56', +'69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,127,,57,43', +'46,,53,44,,,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,', +',58,48,61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51', +',54,,60,127,,57,43,46,,53,44,,,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52', +',,,42,73,,75,76,,,,58,48,61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,', +',,,,,20,19,,,,,,51,,54,,60,127,,57,43,46,,53,44,,,,,77,18,,,45,,,16', +'17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69,72,63,,70', +'64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,127,,57,43,46,,53,44,,', +',,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58,48,61,62', +'55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,127', +',57,43,46,,53,44,,,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,243,42,73', +',75,76,,,,58,48,61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19', +',,,,,51,,54,,60,12,,57,43,46,,53,44,10,11,,,77,18,,,45,,,16,17,,,,,', +',78,,,,,,52,,,,42,73,,75,76,,,,138,137,61,62,55,56,69,72,63,,70,64,', +'65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,127,,57,43,46,,53,44,,,,,77', +'18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56', +'69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,12,,57,43', +'46,,53,44,10,11,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76', +',,,58,48,61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,', +'51,,54,,60,127,,57,43,46,,53,44,,,,,77,18,,,45,,,16,17,,,,,,,78,,,,', +',52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69,72,63,,70,64,,65,,,,,,,', +',,,,,,,,,20,19,,,,,,51,,54,,60,127,,57,43,46,,53,44,,,,,77,18,,,45,', +',16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69,72,63', +',70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,12,,57,43,46,,53,44', +'10,11,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,138,137', +'61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60', +'12,,57,43,46,,53,44,10,11,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42', +'73,,75,76,,,,58,48,61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20', +'19,,,,,,51,,54,,60,127,,57,43,46,,53,44,,,,,77,18,,,45,,,16,17,,,,,', +',78,,,,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69,72,63,,70,64,,65', +',,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,127,,57,43,46,,53,44,,,,,77,18', +',,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69', +'72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,127,,57,43,46', +',53,44,,,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58', +'48,61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54', +',60,127,,57,43,46,,53,44,,,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,', +'42,73,,75,76,,,,58,48,61,62,55,56,69,72,63,,70,64,,65,,,323,,,,,,,,', +',,,,,20,19,,,,,,51,,54,,60,127,,57,43,46,,53,44,,,,,77,18,,,45,,,16', +'17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69,72,63,,70', +'64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,12,,57,43,46,,53,44,10', +'11,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,138,137', +'61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60', +'12,,57,43,46,,53,44,10,11,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42', +'73,,75,76,,,,138,137,61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,', +',20,19,,,,,,51,,54,,60,12,,57,43,46,,53,44,10,11,,,77,18,,,45,,,16,17', +',,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69,72,63,,70,64', +',65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,12,,57,43,46,,53,44,10,11', +',,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,138,137,61', +'62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,12', +',57,43,46,,53,44,10,11,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73', +',75,76,,,,138,137,61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20', +'19,,,,,,51,,54,,60,12,,57,43,46,,53,44,10,11,,,77,18,,,45,,,16,17,,', +',,,,78,,,,,,52,,,,42,73,,75,76,,,,138,137,61,62,55,56,69,72,63,,70,64', +',65,396,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,12,,57,43,46,,53,44,10', +'11,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,138,137', +'61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60', +'12,,57,43,46,,53,44,10,11,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42', +'73,,75,76,,,,58,48,61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20', +'19,,,,,,51,,54,,60,12,,57,43,46,,53,44,10,11,,,77,18,,,45,,,16,17,,', +',,,,78,,,,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69,72,63,,70,64', +',65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,12,,57,43,46,,53,44,10,11', +',,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58,48,61,62', +'55,56,69,72,63,,70,64,,65,442,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,127', +',57,43,46,,53,44,,,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75', +'76,,,,58,48,61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,', +',,,51,,54,,60,12,,57,43,46,,53,44,10,11,,,77,18,,,45,,,16,17,,,,,,,78', +',,,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69,72,63,,70,64,,65,,,', +',,,,,,,,,,,,,20,19,,,,,,51,,54,,60,127,,57,43,46,,53,44,,,,,77,18,,', +'45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69', +'72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,285,,,,,51,,54,,60,12,,57,43', +'46,,53,44,10,11,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76', +',,,138,137,61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,', +',,51,,54,,60,12,,57,43,46,,53,44,10,11,,,77,18,,,45,,,16,17,,,,,,,78', +',,,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69,72,63,,70,64,,65,,,', +',,,,,,,,,,,,,20,19,,,,,,51,,54,,60,12,,57,43,46,,53,44,10,11,,,77,18', +',,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69', +'72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,127,,57,43,46', +',53,44,,,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58', +'48,61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54', +',60,12,,57,43,46,,53,44,10,11,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52', +',,,42,73,,75,76,,,,138,137,61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,', +',,,,,,,20,19,,,,,,51,,54,,60,12,,57,43,46,,53,44,10,11,,,77,18,,,45', +',,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,110,,,138,137,61,62,55,56,', +',63,106,101,112,,115,,109,,111,,102,104,103,105,,,,,,,,,,,,,,,,114,', +',,108,107,,110,94,95,97,96,99,100,,92,93,,,106,101,112,91,115,,109,', +'111,,102,104,103,105,,,,,,,,,,,,,98,,,114,,,,108,107,,110,94,95,97,96', +'99,100,,92,93,,,106,101,112,91,115,,109,,111,,102,104,103,105,,,,,,', +',,,,,,98,,,114,,,,108,107,,110,94,95,97,96,99,100,,92,93,,,106,101,112', +'91,115,,109,,111,,102,104,103,105,,,,,,,,,,,,,98,,,114,,,,108,107,,110', +'94,95,97,96,99,100,,92,93,,,106,101,112,91,115,,109,,111,,102,104,103', +'105,,,,,,,,,,,,,98,,,114,,,,108,107,,110,94,95,97,96,99,100,,92,93,', +',106,101,112,91,115,,109,,111,,102,104,103,105,,,,,,,,,,,,,98,,,114', +',,,108,107,,110,94,95,97,96,99,100,,92,93,,,106,101,112,91,115,,109', +',111,,102,104,103,105,,,,,,,,,,,,,98,,,114,,,,108,107,,110,94,95,97', +'96,99,100,,92,93,,,106,101,112,91,115,,109,,111,,102,104,103,105,,,', +',,,,,,,,,98,,,114,,,,108,107,,,94,95,97,96,99,100,,92,93,110,,286,,', +'91,,,,,,,106,101,112,,115,,109,,111,,102,104,103,105,,,98,,,,,,,,,,', +',,114,,,,108,107,,,94,95,97,96,99,100,,92,93,110,,287,,,91,,,,,,,106', +'101,112,,115,,109,,111,,102,104,103,105,,,98,,,,,,,,,,,,,114,,,,108', +'107,,,94,95,97,96,99,100,,92,93,110,,288,,,91,,,,,,,106,101,112,,115', +',109,,111,,102,104,103,105,,,98,,,,,,,,,,,,,114,,,,108,107,,110,94,95', +'97,96,99,100,,92,93,,,106,101,112,91,115,,109,,111,,102,104,103,105', +',,,,,,,,,,,,98,,,114,,,,108,107,,,94,95,97,96,99,100,,92,93,,,,,,91', +',110,,,,,,,,,316,317,,106,101,112,320,115,110,109,,111,98,102,104,103', +'105,,,,,,112,,115,,,,111,,,,114,,,,108,107,,,94,95,97,96,99,100,,92', +'93,114,,,110,,91,,,,,97,96,,,,92,93,112,,115,110,,91,111,,,,,98,,,,', +',112,,115,,,,111,,,,114,98,,,,,,,,,97,96,,,,92,93,114,,,110,,91,,,94', +'95,97,96,,,,92,93,112,,115,110,,91,111,,,,,98,,,,,,112,,115,,,,111,', +',,114,98,,,,,,,94,95,97,96,,,,92,93,114,,,110,,91,,,94,95,97,96,99,100', +',92,93,112,,115,110,,91,111,,,,,98,,,,,101,112,,115,,,,111,,102,,114', +'98,,,,,,,94,95,97,96,99,100,,92,93,114,,,,,91,,110,94,95,97,96,99,100', +',92,93,,,,101,112,91,115,110,,,111,98,102,,,,,,,,101,112,,115,,,,111', +'98,102,,114,,,,,,,,94,95,97,96,99,100,,92,93,114,,,,,91,,110,94,95,97', +'96,99,100,,92,93,,,,101,112,91,115,,,,111,98,102,,,,,,,,,,,,,,,,98,', +',114,,,,,110,,,94,95,97,96,99,100,,92,93,106,101,112,,115,91,109,,111', +',102,104,103,105,,,,,,,,,,,,,,,98,114,,,,,110,,,94,95,97,96,99,100,', +'92,93,106,101,112,,115,91,109,,111,,102,104,103,105,,,,,,,,,,,,,,,98', +'114,,,,,107,,,94,95,97,96,99,100,110,92,93,,,326,,,91,,,,106,101,112', +',115,,109,,111,,102,104,103,105,,,,,,98,,,,,,,,,,114,,,,108,107,,,94', +'95,97,96,99,100,,92,93,110,-65,,,,91,-65,,,,,,106,101,112,,115,,109', +',111,,102,104,103,105,,,98,,,,,,,,,,,,,114,,,,108,107,,110,94,95,97', +'96,99,100,,92,93,,,106,101,112,91,115,,109,,111,,102,104,103,105,,,', +',,,,,,,,,98,,,114,,,,108,107,,,94,95,97,96,99,100,110,92,93,,,,,,91', +',,,106,101,112,350,115,,109,,111,,102,104,103,105,,,,,,98,,,,,,,,,,114', +',,,108,107,,,94,95,97,96,99,100,,92,93,,,,,,91,,,,,,,,,,,,,,,,,,,,,', +',98' ] + racc_action_table = arr = ::Array.new(9761, nil) idx = 0 clist.each do |str| str.split(',', -1).each do |i| @@ -355,353 +324,320 @@ class Parser < Racc::Parser end clist = [ -'88,88,202,220,88,88,306,88,7,7,7,184,245,184,219,202,324,322,324,218', -'318,227,235,202,88,88,245,306,245,234,57,88,245,88,57,88,88,202,88,88', -'88,157,88,88,88,88,220,317,88,88,322,316,88,245,184,88,88,219,7,7,7', -'7,218,88,227,235,57,118,323,88,57,157,234,88,88,245,88,88,57,220,220', -'88,88,88,88,88,315,246,88,88,88,336,336,88,327,336,336,137,336,184,221', -'246,146,246,468,308,468,246,230,118,314,137,230,137,329,336,336,137', -'230,51,308,313,336,221,336,146,336,336,246,336,336,336,410,336,336,336', -'336,249,137,336,336,410,51,336,230,305,336,336,230,192,246,249,192,249', -'336,147,230,249,504,147,336,230,149,504,336,336,149,336,336,406,341', -'406,336,336,336,336,336,346,249,336,336,336,18,18,336,251,18,18,347', -'18,304,147,392,249,249,147,349,392,149,251,249,251,149,147,12,251,18', -'18,12,298,149,12,295,18,294,18,293,18,18,244,18,18,18,288,18,18,251', -'355,200,200,18,18,200,244,18,244,357,18,18,244,12,251,251,168,12,18', -'58,168,251,284,58,18,12,60,359,18,18,60,18,18,244,197,197,18,18,18,18', -'18,16,16,18,18,18,19,19,18,250,19,19,168,19,361,58,168,49,49,58,59,59', -'60,250,168,250,60,58,64,250,19,19,64,378,60,65,65,19,280,19,277,19,19', -'138,19,19,19,381,19,19,250,66,66,276,19,19,385,138,19,138,387,19,19', -'138,64,250,250,383,64,19,274,383,250,67,67,19,64,228,390,19,19,228,19', -'19,138,125,125,19,19,19,19,19,166,166,19,19,19,20,20,19,267,20,20,383', -'20,167,167,383,229,393,383,394,229,228,233,383,231,228,233,132,397,20', -'20,132,398,228,169,169,20,216,20,214,20,20,213,20,20,20,405,20,20,20', -'20,212,229,20,20,407,229,20,233,399,20,20,233,132,229,183,183,132,20', -'136,233,408,399,136,20,132,434,434,20,20,399,20,20,211,206,190,20,20', -'20,20,20,188,135,20,20,20,21,21,20,185,21,21,160,21,174,136,135,172', -'135,136,417,419,135,159,424,160,155,136,433,540,21,21,435,160,150,148', -'145,21,144,21,442,21,21,135,21,21,21,160,21,21,21,21,141,446,21,21,282', -'449,21,140,454,21,21,283,455,282,456,139,123,21,462,122,283,119,87,21', -'85,471,282,21,21,472,21,21,474,283,282,21,21,21,21,21,81,283,21,21,21', -'4,4,21,476,4,4,479,4,482,483,484,485,80,68,489,492,493,498,501,502,62', -'61,53,52,4,4,8,514,5,517,519,4,520,4,1,4,4,527,4,4,4,4,4,4,4,4,529,531', -'4,4,535,320,4,,,4,4,,,,,,,4,,,,,,4,,,,4,4,,4,4,,,,4,4,4,4,4,,,4,4,4', -'50,50,4,,50,50,,50,,,,,,,,,,,,,,,,,50,50,50,,,,,50,,50,,50,50,,50,50', -'50,,50,50,50,50,,,50,50,,,50,,,50,50,,,,,,,50,,,,,,50,,,,50,50,,50,50', -',,,50,50,50,50,50,50,50,50,50,50,509,509,50,,509,509,,509,509,,,,,,', -',,,,,,,,,509,509,,,,,,509,,509,,509,509,,509,509,509,,509,509,509,509', -',,509,509,,,509,,,509,509,,,,,,,509,,,,,,509,,,,509,509,,509,509,,,', -'509,509,509,509,509,,,509,509,509,54,54,509,,54,54,,54,,,,,,,,,,,,,', -',,,54,54,,,,,,54,,54,,54,54,,54,54,54,,54,54,,,,,54,54,,,54,,,54,54', -',,,,,,54,,,,,,54,,,,54,54,,54,54,,,,54,54,54,54,54,,,54,54,54,55,55', -'54,,55,55,,55,,,,,,,,,,,,,,,,,55,55,,,,,,55,,55,,55,55,,55,55,55,,55', -'55,,,,,55,55,,,55,,,55,55,,,,,,,55,,,,,,55,,,,55,55,,55,55,,,,55,55', -'55,55,55,,,55,55,55,56,56,55,,56,56,,56,,,,,,,,,,,,,,,,,56,56,,,,,,56', -',56,,56,56,,56,56,56,,56,56,,,,,56,56,,,56,,,56,56,,,,,,,56,,,,,,56', -',,,56,56,,56,56,,,,56,56,56,56,56,,,56,56,56,516,516,56,,516,516,,516', -'516,,,,,,,,,,,,,,,,516,516,,,,,,516,,516,,516,516,,516,516,516,,516', -'516,516,516,,,516,516,,,516,,,516,516,,,,,,,516,,,,,,516,,,,516,516', -',516,516,,,,516,516,516,516,516,,,516,516,516,507,507,516,,507,507,', -'507,507,,,,,,,,,,,,,,,,507,507,,,,,,507,,507,,507,507,,507,507,507,', -'507,507,507,507,,,507,507,,,507,,,507,507,,,,,,,507,,,,,,507,,,,507', -'507,,507,507,,,,507,507,507,507,507,,,507,507,507,511,511,507,,511,511', -',511,,,,,,,,,,,,,,,,,511,511,,,,,,511,,511,,511,511,,511,511,511,,511', -'511,511,511,,,511,511,,,511,,,511,511,,,,,,,511,,,,,,511,,,,511,511', -',511,511,,,,511,511,511,511,511,,,511,511,511,488,488,511,,488,488,', -'488,,,,,,,,,,,,,,,,,488,488,,,,,,488,,488,,488,488,,488,488,488,,488', -'488,488,488,,,488,488,,,488,,,488,488,,,,,,,488,,,,,,488,,,,488,488', -',488,488,,,,488,488,488,488,488,,,488,488,488,72,72,488,,72,72,72,72', -',,,,,,,,,,,,,,,,72,72,,,,,,72,,72,,72,72,,72,72,72,,72,72,72,72,,,72', -'72,,,72,,,72,72,,,,,,,72,,,,,,72,,,,72,72,,72,72,,,,72,72,72,72,72,72', -'72,72,72,72,73,73,72,,73,73,73,73,,,,,,,,,,,,,,,,,73,73,,,,,,73,,73', -',73,73,,73,73,73,,73,73,73,73,,,73,73,,,73,,,73,73,,,,,,,73,,,,,,73', -',,,73,73,,73,73,,,,73,73,73,73,73,73,73,73,73,73,74,74,73,,74,74,,74', -'74,,,,,,,,,,,,,,,,74,74,,,,,,74,,74,,74,74,,74,74,74,,74,74,74,74,,', -'74,74,,,74,,,74,74,,,,,,,74,,,,,,74,,,,74,74,,74,74,,,,74,74,74,74,74', -'74,74,74,74,74,78,78,74,,78,78,,78,,,,,,,,,,,,,,,,,78,78,,,,,,78,,78', -',78,78,,78,78,78,,78,78,78,78,,,78,78,,,78,,,78,78,,,,,,,78,,,,,,78', -',,,78,78,,78,78,,,,78,78,78,78,78,,,78,78,78,486,486,78,,486,486,,486', -'486,,,,,,,,,,,,,,,,486,486,,,,,,486,,486,,486,486,,486,486,486,,486', -'486,486,486,,,486,486,,,486,,,486,486,,,,,,,486,,,,,,486,,,,486,486', -',486,486,,,,486,486,486,486,486,,,486,486,486,475,475,486,,475,475,', -'475,,,,,,,,,,,,,,,,,475,475,,,,,,475,,475,,475,475,,475,475,475,,475', -'475,,,,,475,475,,,475,,,475,475,,,,,,,475,,,,,,475,,,,475,475,,475,475', -',,,475,475,475,475,475,,,475,475,475,83,83,475,,83,83,,83,,,,,,,,,,', -',,,,,,83,83,,,,,,83,,83,,83,83,,83,83,83,,83,83,,,,,83,83,,,83,,,83', -'83,,,,,,,83,,,,,,83,,,,83,83,,83,83,,,,83,83,83,83,83,,,83,83,83,470', -'470,83,,470,470,,470,,,,,,,,,,,,,,,,,470,470,,,,,,470,,470,,470,470', -',470,470,470,,470,470,,,,,470,470,,,470,,,470,470,,,,,,,470,,,,,,470', -',,,470,470,,470,470,,,,470,470,470,470,470,,,470,470,470,86,86,470,', -'86,86,,86,,,,,,,,,,,,,,,,,86,86,,,,,,86,,86,,86,86,,86,86,86,,86,86', -'86,86,,,86,86,,,86,,,86,86,,,,,,,86,,,,,,86,,,,86,86,,86,86,,,,86,86', -'86,86,86,,,86,86,86,89,89,86,,89,89,,89,,,,,,,,,,,,,,,,,89,89,,,,,,89', -',89,,89,89,,89,89,89,,89,89,89,89,,,89,89,,,89,,,89,89,,,,,,,89,,,,', -',89,,,,89,89,,89,89,,,,89,89,89,89,89,,,89,89,89,90,90,89,,90,90,,90', -',,,,,,,,,,,,,,,,90,90,,,,,,90,,90,,90,90,,90,90,90,,90,90,90,90,,,90', -'90,,,90,,,90,90,,,,,,,90,,,,,,90,,,,90,90,,90,90,,,,90,90,90,90,90,', -',90,90,90,91,91,90,,91,91,,91,,,,,,,,,,,,,,,,,91,91,,,,,,91,,91,,91', -'91,,91,91,91,,91,91,91,91,,,91,91,,,91,,,91,91,,,,,,,91,,,,,,91,,,,91', -'91,,91,91,,,,91,91,91,91,91,,,91,91,91,92,92,91,,92,92,,92,,,,,,,,,', -',,,,,,,92,92,,,,,,92,,92,,92,92,,92,92,92,,92,92,92,92,,,92,92,,,92', -',,92,92,,,,,,,92,,,,,,92,,,,92,92,,92,92,,,,92,92,92,92,92,,,92,92,92', -'93,93,92,,93,93,,93,,,,,,,,,,,,,,,,,93,93,,,,,,93,,93,,93,93,,93,93', -'93,,93,93,93,93,,,93,93,,,93,,,93,93,,,,,,,93,,,,,,93,,,,93,93,,93,93', -',,,93,93,93,93,93,,,93,93,93,94,94,93,,94,94,,94,,,,,,,,,,,,,,,,,94', -'94,,,,,,94,,94,,94,94,,94,94,94,,94,94,94,94,,,94,94,,,94,,,94,94,,', -',,,,94,,,,,,94,,,,94,94,,94,94,,,,94,94,94,94,94,,,94,94,94,95,95,94', -',95,95,,95,,,,,,,,,,,,,,,,,95,95,,,,,,95,,95,,95,95,,95,95,95,,95,95', -'95,95,,,95,95,,,95,,,95,95,,,,,,,95,,,,,,95,,,,95,95,,95,95,,,,95,95', -'95,95,95,,,95,95,95,96,96,95,,96,96,,96,,,,,,,,,,,,,,,,,96,96,,,,,,96', -'96,96,96,96,96,96,96,96,96,,96,96,,,,,96,96,96,96,96,,,96,96,,,,,,,96', -',,,,96,96,,,,96,96,,96,96,,,,96,96,96,96,96,96,96,96,96,96,97,97,96', -',97,97,,97,,,,,,,,,,,,,,,,,97,97,,,,,,97,,97,,97,97,,97,97,97,,97,97', -',,,,97,97,,,97,,,97,97,,,,,,,97,,,,,,97,,,,97,97,,97,97,,,,97,97,97', -'97,97,,,97,97,97,98,98,97,,98,98,,98,,,,,,,,,,,,,,,,,98,98,,,,,,98,', -'98,,98,98,,98,98,98,,98,98,,,,,98,98,,,98,,,98,98,,,,,,,98,,,,,,98,', -',,98,98,,98,98,,,,98,98,98,98,98,,,98,98,98,99,99,98,,99,99,,99,,,,', -',,,,,,,,,,,,99,99,,,,,,99,,99,,99,99,,99,99,99,,99,99,,,,,99,99,,,99', -',,99,99,,,,,,,99,,,,,,99,,,,99,99,,99,99,,,,99,99,99,99,99,,,99,99,99', -'100,100,99,,100,100,,100,,,,,,,,,,,,,,,,,100,100,,,,,,100,,100,,100', -'100,,100,100,100,,100,100,,,,,100,100,,,100,,,100,100,,,,,,,100,,,,', -',100,,,,100,100,,100,100,,,,100,100,100,100,100,,,100,100,100,101,101', -'100,,101,101,,101,,,,,,,,,,,,,,,,,101,101,,,,,,101,,101,,101,101,,101', -'101,101,,101,101,,,,,101,101,,,101,,,101,101,,,,,,,101,,,,,,101,,,,101', -'101,,101,101,,,,101,101,101,101,101,,,101,101,101,102,102,101,,102,102', -',102,,,,,,,,,,,,,,,,,102,102,,,,,,102,,102,,102,102,,102,102,102,,102', -'102,,,,,102,102,,,102,,,102,102,,,,,,,102,,,,,,102,,,,102,102,,102,102', -',,,102,102,102,102,102,,,102,102,102,103,103,102,,103,103,,103,,,,,', -',,,,,,,,,,,103,103,,,,,,103,,103,,103,103,,103,103,103,,103,103,,,,', -'103,103,,,103,,,103,103,,,,,,,103,,,,,,103,,,,103,103,,103,103,,,,103', -'103,103,103,103,,,103,103,103,104,104,103,,104,104,,104,,,,,,,,,,,,', -',,,,104,104,,,,,,104,,104,,104,104,,104,104,104,,104,104,,,,,104,104', -',,104,,,104,104,,,,,,,104,,,,,,104,,,,104,104,,104,104,,,,104,104,104', -'104,104,,,104,104,104,105,105,104,,105,105,,105,,,,,,,,,,,,,,,,,105', +'369,369,215,229,369,369,48,369,214,283,313,209,223,294,166,200,166,229', +'201,229,112,202,318,229,369,369,223,203,223,48,283,369,223,369,319,369', +'369,144,369,369,369,193,369,369,229,215,294,137,369,369,203,214,369', +'223,209,369,369,166,200,229,229,201,112,369,202,284,229,144,58,369,137', +'321,58,369,369,223,369,369,165,165,284,369,369,369,369,369,369,365,365', +'369,188,365,365,184,365,365,368,172,166,224,466,7,7,7,58,466,184,174', +'58,368,174,365,365,224,184,224,58,368,365,224,365,327,365,365,147,365', +'365,365,184,365,365,365,365,179,179,365,365,147,379,365,224,361,365', +'365,329,147,361,379,119,119,365,7,7,7,7,433,365,433,170,147,365,365', +'224,365,365,375,331,375,365,365,365,365,365,365,186,186,365,333,186', +'186,348,186,186,250,250,250,250,167,250,250,250,296,250,296,250,250', +'182,182,186,186,182,351,250,250,250,186,158,186,250,186,186,129,186', +'186,186,355,186,186,186,186,250,250,186,186,357,129,186,129,359,186', +'186,129,362,250,250,250,250,186,400,400,154,154,363,186,153,153,156', +'186,186,366,186,186,129,367,374,186,186,186,186,186,186,0,0,186,376', +'0,0,377,0,146,322,322,322,322,142,322,322,322,139,322,384,322,322,385', +'390,0,0,136,399,322,322,322,0,401,0,322,0,0,135,0,0,0,132,0,0,0,0,322', +'322,0,0,131,130,0,408,412,0,0,415,117,322,322,322,322,0,420,421,210', +'211,213,0,210,211,213,0,0,116,0,0,0,113,427,0,0,0,0,0,0,183,183,0,81', +'183,183,79,183,74,436,437,439,73,441,444,210,211,213,447,210,211,213', +'448,59,183,183,56,210,211,213,54,183,452,183,54,183,183,455,183,183', +'183,456,183,183,183,183,461,464,183,183,50,49,183,8,5,183,183,12,387', +'387,477,12,387,183,12,479,54,55,480,183,54,55,1,183,183,486,183,183', +'54,488,490,183,183,183,183,183,183,349,349,183,493,349,349,12,349,498', +'265,12,387,258,255,387,254,55,353,12,270,55,353,138,271,349,349,138', +'272,55,275,281,349,282,349,387,349,349,252,349,349,349,245,349,349,387', +'387,289,290,349,349,261,291,349,353,292,349,349,353,138,261,353,198', +'138,349,295,353,299,127,196,349,138,127,261,349,349,301,349,349,195', +'194,261,349,349,349,349,349,349,330,330,349,,330,330,,330,,,,,,,,,127', +',,,127,,,,330,330,,,127,,,330,,330,,330,330,222,330,330,330,,330,330', +'330,330,,,330,330,,222,330,222,,330,330,222,293,293,,,293,330,,,,,,330', +',,,330,330,,330,330,222,,,330,330,330,330,330,330,326,326,330,,326,326', +'126,326,,,,293,,,293,,,,,,126,,126,,326,326,126,,,,,326,,326,293,326', +'326,128,326,326,326,,326,326,293,293,,126,326,326,,128,326,128,,326', +'326,128,57,57,,,57,326,,,,,,326,,,,326,326,,326,326,128,,,326,326,326', +'326,326,326,325,325,326,,325,325,,325,,,,57,,,57,,,,,,,,,,325,325,,', +',,,325,,325,57,325,325,,325,325,325,,325,325,57,57,,,325,325,,,325,', +',325,325,,212,212,,,212,325,,,,,,325,,,,325,325,,325,325,,,,325,325', +'325,325,325,325,324,324,325,,324,324,,324,,,,212,,,212,,,,,,,,,,324', +'324,,,260,,,324,,324,212,324,324,260,324,324,324,,324,324,212,212,,', +'324,324,260,,324,,,324,324,,260,,,,,324,,,,,,324,,,,324,324,,324,324', +',,,324,324,324,324,324,324,323,323,324,227,323,323,,323,,,,,,,,,,227', +',227,,,,227,323,323,,,,,,323,,323,,323,323,,323,323,323,,323,323,227', +',,,323,323,,,323,,,323,323,,,227,227,,,323,,,227,,,323,,,,323,323,,323', +'323,,,,323,323,323,323,323,323,17,17,323,228,17,17,,17,,,,,,,,,,228', +',228,,,,228,17,17,,,,,,17,,17,,17,17,,17,17,17,,17,17,228,,,,17,17,', +',17,,,17,17,,,228,228,,,17,,,228,,,17,,,,17,17,,17,17,,,,17,17,17,17', +'17,17,18,18,17,,18,18,,18,,320,320,320,320,,320,320,320,,320,,320,320', +',,18,18,,,320,320,320,18,,18,320,18,18,,18,18,18,,18,18,,,320,320,18', +'18,,,18,,,18,18,,,320,320,320,320,18,,,,,,18,,,,18,18,,18,18,,,,18,18', +'18,18,18,18,19,19,18,,19,19,,19,,350,350,350,350,,350,350,350,,350,', +'350,350,,,19,19,,,350,350,350,19,,19,350,19,19,,19,19,19,,19,19,19,19', +'350,350,19,19,,,19,,,19,19,,,350,350,350,350,19,,,,,,19,,,,19,19,,19', +'19,,,,19,19,19,19,19,19,20,20,19,,20,20,,20,,,,,,,,,,,,,,,,,20,20,,', +',,,20,,20,,20,20,,20,20,20,,20,20,20,20,,,20,20,,,20,,,20,20,,,,,,,20', +',,,,,20,,,,20,20,,20,20,,,,20,20,20,20,20,20,47,47,20,,47,47,,47,,,', +',,,,,,,,,,,,,47,47,47,,,,,47,,47,,47,47,,47,47,47,,47,47,47,47,,,47', +'47,,,47,,,47,47,,,,,,,47,,,,,,47,,,,47,47,,47,47,,,,47,47,47,47,47,47', +'4,4,47,,4,4,,4,,,,,,,,,,,,,,,,,4,4,,,,,,4,,4,,4,4,,4,4,4,4,4,4,4,4,', +',4,4,,,4,,,4,4,,,,,,,4,,,,,,4,,,,4,4,,4,4,,,,4,4,4,4,4,4,471,471,4,', +'471,471,,471,471,,,,,,,,,,,,,,,,471,471,,,,,,471,,471,,471,471,,471', +'471,471,,471,471,471,471,,,471,471,,,471,,,471,471,,,,,,,471,,,,,,471', +',,,471,471,,471,471,,,,471,471,471,471,471,471,469,469,471,,469,469', +',469,469,,,,,,,,,,,,,,,,469,469,,,,,,469,,469,,469,469,,469,469,469', +',469,469,469,469,,,469,469,,,469,,,469,469,,,,,,,469,,,,,,469,,,,469', +'469,,469,469,,,,469,469,469,469,469,469,51,51,469,,51,51,,51,,,,,,,', +',,,,,,,,,51,51,,,,,,51,,51,,51,51,,51,51,51,,51,51,,,,,51,51,,,51,,', +'51,51,,,,,,,51,,,,,,51,,,,51,51,,51,51,,,,51,51,51,51,51,51,52,52,51', +',52,52,,52,,,,,,,,,,,,,,,,,52,52,,,,,,52,,52,,52,52,,52,52,52,,52,52', +',,,,52,52,,,52,,,52,52,,,,,,,52,,,,,,52,,,,52,52,,52,52,,,,52,52,52', +'52,52,52,53,53,52,,53,53,,53,,,,,,,,,,,,,,,,,53,53,,,,,,53,,53,,53,53', +',53,53,53,,53,53,,,,,53,53,,,53,,,53,53,,,,,,,53,,,,,,53,,,,53,53,,53', +'53,,,,53,53,53,53,53,53,286,286,53,,286,286,,286,286,,,,,,,,,,,,,,,', +'286,286,,,,,,286,,286,,286,286,,286,286,286,,286,286,286,286,,,286,286', +',,286,,,286,286,,,,,,,286,,,,,,286,,,,286,286,,286,286,,,,286,286,286', +'286,286,286,287,287,286,,287,287,,287,287,,,,,,,,,,,,,,,,287,287,,,', +',,287,,287,,287,287,,287,287,287,,287,287,287,287,,,287,287,,,287,,', +'287,287,,,,,,,287,,,,,,287,,,,287,287,,287,287,,,,287,287,287,287,287', +'287,451,451,287,,451,451,,451,,,,,,,,,,,,,,,,,451,451,,,,,,451,,451', +',451,451,,451,451,451,,451,451,451,451,,,451,451,,,451,,,451,451,,,', +',,,451,,,,,,451,,,,451,451,,451,451,,,,451,451,451,451,451,451,243,243', +'451,,243,243,,243,,,,,,,,,,,,,,,,,243,243,,,,,,243,,243,,243,243,,243', +'243,243,,243,243,,,,,243,243,,,243,,,243,243,,,,,,,243,,,,,,243,,,,243', +'243,,243,243,,,,243,243,243,243,243,243,206,206,243,,206,206,,206,,', +',,,,,,,,,,,,,,206,206,,,,,,206,,206,,206,206,,206,206,206,,206,206,', +',,,206,206,,,206,,,206,206,,,,,,,206,,,,,,206,,,,206,206,,206,206,,', +',206,206,206,206,206,206,449,449,206,,449,449,,449,449,,,,,,,,,,,,,', +',,449,449,,,,,,449,,449,,449,449,,449,449,449,,449,449,449,449,,,449', +'449,,,449,,,449,449,,,,,,,449,,,,,,449,,,,449,449,,449,449,,,,449,449', +'449,449,449,449,63,63,449,,63,63,63,63,,,,,,,,,,,,,,,,,63,63,,,,,,63', +',63,,63,63,,63,63,63,,63,63,63,63,,,63,63,,,63,,,63,63,,,,,,,63,,,,', +',63,,,,63,63,,63,63,,,,63,63,63,63,63,63,64,64,63,,64,64,64,64,,,,,', +',,,,,,,,,,,64,64,,,,,,64,,64,,64,64,,64,64,64,,64,64,64,64,,,64,64,', +',64,,,64,64,,,,,,,64,,,,,,64,,,,64,64,,64,64,,,,64,64,64,64,64,64,65', +'65,64,,65,65,,65,65,,,,,,,,,,,,,,,,65,65,,,,,,65,,65,,65,65,,65,65,65', +',65,65,65,65,,,65,65,,,65,,,65,65,,,,,,,65,,,,,,65,,,,65,65,,65,65,', +',,65,65,65,65,65,65,71,71,65,,71,71,,71,,,,,,,,,,,,,,,,,71,71,,,,,,71', +',71,,71,71,,71,71,71,,71,71,71,71,,,71,71,,,71,,,71,71,,,,,,,71,,,,', +',71,,,,71,71,,71,71,,,,71,71,71,71,71,71,440,440,71,,440,440,,440,,', +',,,,,,,,,,,,,,440,440,,,,,,440,,440,,440,440,,440,440,440,,440,440,', +',,,440,440,,,440,,,440,440,,,,,,,440,,,,,,440,,,,440,440,,440,440,,', +',440,440,440,440,440,440,435,435,440,,435,435,,435,,,,,,,,,,,,,,,,,435', +'435,,,,,,435,,435,,435,435,,435,435,435,,435,435,,,,,435,435,,,435,', +',435,435,,,,,,,435,,,,,,435,,,,435,435,,435,435,,,,435,435,435,435,435', +'435,76,76,435,,76,76,,76,,,,,,,,,,,,,,,,,76,76,,,,,,76,,76,,76,76,,76', +'76,76,,76,76,,,,,76,76,,,76,,,76,76,,,,,,,76,,,,,,76,,,,76,76,,76,76', +',,,76,76,76,76,76,76,476,476,76,,476,476,,476,476,,,,,,,,,,,,,,,,476', +'476,,,,,,476,,476,,476,476,,476,476,476,,476,476,476,476,,,476,476,', +',476,,,476,476,,,,,,,476,,,,,,476,,,,476,476,,476,476,,,,476,476,476', +'476,476,476,80,80,476,,80,80,,80,,,,,,,,,,,,,,,,,80,80,,,,,,80,,80,', +'80,80,,80,80,80,,80,80,80,80,,,80,80,,,80,,,80,80,,,,,,,80,,,,,,80,', +',,80,80,,80,80,,,,80,80,80,80,80,80,429,429,80,,429,429,,429,,,,,,,', +',,,,,,,,,429,429,,,,,,429,,429,,429,429,,429,429,429,,429,429,429,429', +',,429,429,,,429,,,429,429,,,,,,,429,,,,,,429,,,,429,429,,429,429,,,', +'429,429,429,429,429,429,82,82,429,,82,82,,82,,,,,,,,,,,,,,,,,82,82,', +',,,,82,,82,,82,82,,82,82,82,,82,82,82,82,,,82,82,,,82,,,82,82,,,,,,', +'82,,,,,,82,,,,82,82,,82,82,,,,82,82,82,82,82,82,83,83,82,,83,83,,83', +',,,,,,,,,,,,,,,,83,83,,,,,,83,,83,,83,83,,83,83,83,,83,83,83,83,,,83', +'83,,,83,,,83,83,,,,,,,83,,,,,,83,,,,83,83,,83,83,,,,83,83,83,83,83,83', +'84,84,83,,84,84,,84,,,,,,,,,,,,,,,,,84,84,,,,,,84,,84,,84,84,,84,84', +'84,,84,84,84,84,,,84,84,,,84,,,84,84,,,,,,,84,,,,,,84,,,,84,84,,84,84', +',,,84,84,84,84,84,84,85,85,84,,85,85,,85,,,,,,,,,,,,,,,,,85,85,,,,,', +'85,,85,,85,85,,85,85,85,,85,85,85,85,,,85,85,,,85,,,85,85,,,,,,,85,', +',,,,85,,,,85,85,,85,85,,,,85,85,85,85,85,85,86,86,85,,86,86,,86,,,,', +',,,,,,,,,,,,86,86,,,,,,86,,86,,86,86,,86,86,86,,86,86,86,86,,,86,86', +',,86,,,86,86,,,,,,,86,,,,,,86,,,,86,86,,86,86,,,,86,86,86,86,86,86,87', +'87,86,,87,87,,87,,,,,,,,,,,,,,,,,87,87,,,,,,87,,87,,87,87,,87,87,87', +',87,87,87,87,,,87,87,,,87,,,87,87,,,,,,,87,,,,,,87,,,,87,87,,87,87,', +',,87,87,87,87,87,87,88,88,87,,88,88,,88,,,,,,,,,,,,,,,,,88,88,,,,,,88', +',88,,88,88,,88,88,88,,88,88,88,88,,,88,88,,,88,,,88,88,,,,,,,88,,,,', +',88,,,,88,88,,88,88,,,,88,88,88,88,88,88,89,89,88,,89,89,,89,,,,,,,', +',,,,,,,,,89,89,,,,,,89,,89,,89,89,,89,89,89,,89,89,89,89,,,89,89,,,89', +',,89,89,,,,,,,89,,,,,,89,,,,89,89,,89,89,,,,89,89,89,89,89,89,90,90', +'89,,90,90,,90,,,,,,,,,,,,,,,,,90,90,,,,,,90,90,90,90,90,90,90,90,90', +'90,,90,90,,,,,90,90,90,90,90,,,90,90,,,,,,,90,,,,,90,90,,,,90,90,,90', +'90,,,,90,90,90,90,90,90,91,91,90,,91,91,,91,,,,,,,,,,,,,,,,,91,91,,', +',,,91,,91,,91,91,,91,91,91,,91,91,,,,,91,91,,,91,,,91,91,,,,,,,91,,', +',,,91,,,,91,91,,91,91,,,,91,91,91,91,91,91,92,92,91,,92,92,,92,,,,,', +',,,,,,,,,,,92,92,,,,,,92,,92,,92,92,,92,92,92,,92,92,,,,,92,92,,,92', +',,92,92,,,,,,,92,,,,,,92,,,,92,92,,92,92,,,,92,92,92,92,92,92,93,93', +'92,,93,93,,93,,,,,,,,,,,,,,,,,93,93,,,,,,93,,93,,93,93,,93,93,93,,93', +'93,,,,,93,93,,,93,,,93,93,,,,,,,93,,,,,,93,,,,93,93,,93,93,,,,93,93', +'93,93,93,93,94,94,93,,94,94,,94,,,,,,,,,,,,,,,,,94,94,,,,,,94,,94,,94', +'94,,94,94,94,,94,94,,,,,94,94,,,94,,,94,94,,,,,,,94,,,,,,94,,,,94,94', +',94,94,,,,94,94,94,94,94,94,95,95,94,,95,95,,95,,,,,,,,,,,,,,,,,95,95', +',,,,,95,,95,,95,95,,95,95,95,,95,95,,,,,95,95,,,95,,,95,95,,,,,,,95', +',,,,,95,,,,95,95,,95,95,,,,95,95,95,95,95,95,96,96,95,,96,96,,96,,,', +',,,,,,,,,,,,,96,96,,,,,,96,,96,,96,96,,96,96,96,,96,96,,,,,96,96,,,96', +',,96,96,,,,,,,96,,,,,,96,,,,96,96,,96,96,,,,96,96,96,96,96,96,97,97', +'96,,97,97,,97,,,,,,,,,,,,,,,,,97,97,,,,,,97,,97,,97,97,,97,97,97,,97', +'97,,,,,97,97,,,97,,,97,97,,,,,,,97,,,,,,97,,,,97,97,,97,97,,,,97,97', +'97,97,97,97,98,98,97,,98,98,,98,,,,,,,,,,,,,,,,,98,98,,,,,,98,,98,,98', +'98,,98,98,98,,98,98,,,,,98,98,,,98,,,98,98,,,,,,,98,,,,,,98,,,,98,98', +',98,98,,,,98,98,98,98,98,98,99,99,98,,99,99,,99,,,,,,,,,,,,,,,,,99,99', +',,,,,99,,99,,99,99,,99,99,99,,99,99,,,,,99,99,,,99,,,99,99,,,,,,,99', +',,,,,99,,,,99,99,,99,99,,,,99,99,99,99,99,99,100,100,99,,100,100,,100', +',,,,,,,,,,,,,,,,100,100,,,,,,100,,100,,100,100,,100,100,100,,100,100', +',,,,100,100,,,100,,,100,100,,,,,,,100,,,,,,100,,,,100,100,,100,100,', +',,100,100,100,100,100,100,101,101,100,,101,101,,101,,,,,,,,,,,,,,,,', +'101,101,,,,,,101,,101,,101,101,,101,101,101,,101,101,,,,,101,101,,,101', +',,101,101,,,,,,,101,,,,,,101,,,,101,101,,101,101,,,,101,101,101,101', +'101,101,102,102,101,,102,102,,102,,,,,,,,,,,,,,,,,102,102,,,,,,102,', +'102,,102,102,,102,102,102,,102,102,,,,,102,102,,,102,,,102,102,,,,,', +',102,,,,,,102,,,,102,102,,102,102,,,,102,102,102,102,102,102,103,103', +'102,,103,103,,103,,,,,,,,,,,,,,,,,103,103,,,,,,103,,103,,103,103,,103', +'103,103,,103,103,,,,,103,103,,,103,,,103,103,,,,,,,103,,,,,,103,,,,103', +'103,,103,103,,,,103,103,103,103,103,103,104,104,103,,104,104,,104,,', +',,,,,,,,,,,,,,104,104,,,,,,104,,104,,104,104,,104,104,104,,104,104,', +',,,104,104,,,104,,,104,104,,,,,,,104,,,,,,104,,,,104,104,,104,104,,', +',104,104,104,104,104,104,105,105,104,,105,105,,105,,,,,,,,,,,,,,,,,105', '105,,,,,,105,,105,,105,105,,105,105,105,,105,105,,,,,105,105,,,105,', ',105,105,,,,,,,105,,,,,,105,,,,105,105,,105,105,,,,105,105,105,105,105', -',,105,105,105,106,106,105,,106,106,,106,,,,,,,,,,,,,,,,,106,106,,,,', -',106,,106,,106,106,,106,106,106,,106,106,,,,,106,106,,,106,,,106,106', -',,,,,,106,,,,,,106,,,,106,106,,106,106,,,,106,106,106,106,106,,,106', -'106,106,107,107,106,,107,107,,107,,,,,,,,,,,,,,,,,107,107,,,,,,107,', -'107,,107,107,,107,107,107,,107,107,,,,,107,107,,,107,,,107,107,,,,,', -',107,,,,,,107,,,,107,107,,107,107,,,,107,107,107,107,107,,,107,107,107', -'108,108,107,,108,108,,108,,,,,,,,,,,,,,,,,108,108,,,,,,108,,108,,108', -'108,,108,108,108,,108,108,,,,,108,108,,,108,,,108,108,,,,,,,108,,,,', -',108,,,,108,108,,108,108,,,,108,108,108,108,108,,,108,108,108,109,109', -'108,,109,109,,109,,,,,,,,,,,,,,,,,109,109,,,,,,109,,109,,109,109,,109', -'109,109,,109,109,,,,,109,109,,,109,,,109,109,,,,,,,109,,,,,,109,,,,109', -'109,,109,109,,,,109,109,109,109,109,,,109,109,109,110,110,109,,110,110', -',110,,,,,,,,,,,,,,,,,110,110,,,,,,110,,110,,110,110,,110,110,110,,110', -'110,,,,,110,110,,,110,,,110,110,,,,,,,110,,,,,,110,,,,110,110,,110,110', -',,,110,110,110,110,110,,,110,110,110,111,111,110,,111,111,,111,,,,,', -',,,,,,,,,,,111,111,,,,,,111,,111,,111,111,,111,111,111,,111,111,,,,', -'111,111,,,111,,,111,111,,,,,,,111,,,,,,111,,,,111,111,,111,111,,,,111', -'111,111,111,111,,,111,111,111,112,112,111,,112,112,,112,,,,,,,,,,,,', -',,,,112,112,,,,,,112,,112,,112,112,,112,112,112,,112,112,,,,,112,112', -',,112,,,112,112,,,,,,,112,,,,,,112,,,,112,112,,112,112,,,,112,112,112', -'112,112,,,112,112,112,113,113,112,,113,113,,113,,,,,,,,,,,,,,,,,113', -'113,,,,,,113,,113,,113,113,,113,113,113,,113,113,,,,,113,113,,,113,', -',113,113,,,,,,,113,,,,,,113,,,,113,113,,113,113,,,,113,113,113,113,113', -',,113,113,113,114,114,113,,114,114,,114,,,,,,,,,,,,,,,,,114,114,,,,', -',114,,114,,114,114,,114,114,114,,114,114,,,,,114,114,,,114,,,114,114', -',,,,,,114,,,,,,114,,,,114,114,,114,114,,,,114,114,114,114,114,,,114', -'114,114,115,115,114,,115,115,,115,,,,,,,,,,,,,,,,,115,115,,,,,,115,', -'115,,115,115,,115,115,115,,115,115,,,,,115,115,,,115,,,115,115,,,,,', -',115,,,,,,115,,,115,115,115,,115,115,,,,115,115,115,115,115,,,115,115', -'115,116,116,115,,116,116,,116,,,,,,,,,,,,,,,,,116,116,,,,,,116,,116', -',116,116,,116,116,116,,116,116,116,116,,,116,116,,,116,,,116,116,,,', -',,,116,,,,,,116,,,,116,116,,116,116,,,,116,116,116,116,116,116,116,116', -'116,116,120,120,116,,120,120,,120,,,,,,,,,,,,,,,,,120,120,,,,,,120,', -'120,,120,120,,120,120,120,,120,120,,,,,120,120,,,120,,,120,120,,,,,', -',120,,,,,,120,,,,120,120,,120,120,,,,120,120,120,120,120,,,120,120,120', -'121,121,120,,121,121,,121,,,,,,,,,,,,,,,,,121,121,,,,,,121,,121,,121', -'121,,121,121,121,,121,121,,,,,121,121,,,121,,,121,121,,,,,,,121,,,,', -',121,,,,121,121,,121,121,,,,121,121,121,121,121,,,121,121,121,464,464', -'121,,464,464,,464,,,,,,,,,,,,,,,,,464,464,,,,,,464,,464,,464,464,,464', -'464,464,,464,464,464,464,,,464,464,,,464,,,464,464,,,,,,,464,,,,,,464', -',,,464,464,,464,464,,,,464,464,464,464,464,464,464,464,464,464,461,461', -'464,,461,461,,461,,,,,,,,,,,,,,,,,461,461,,,,,,461,,461,,461,461,,461', -'461,461,,461,461,461,461,,,461,461,,,461,,,461,461,,,,,,,461,,,,,,461', -',,,461,461,,461,461,,,,461,461,461,461,461,,,461,461,461,124,124,461', -',124,124,,124,,,,,,,,,,,,,,,,,124,124,,,,,,124,,124,,124,124,,124,124', -'124,,124,124,,,,,124,124,,,124,,,124,124,,,,,,,124,,,,,,124,,,,124,124', -',124,124,,,,124,124,124,124,124,,,124,124,124,10,10,124,,10,10,,10,', -',,,,,,,,,,,,,,,10,10,,,,,,10,,10,,10,10,,10,10,10,,10,10,10,10,,,10', -'10,,,10,,,10,10,,,,,,,10,,,,,,10,,,,10,10,,10,10,,,,10,10,10,10,10,', -',10,10,10,458,458,10,,458,458,,458,,,,,,,,,,,,,,,,,458,458,,,,,,458', -',458,,458,458,,458,458,458,,458,458,458,458,,,458,458,,,458,,,458,458', -',,,,,,458,,,,,,458,,,,458,458,,458,458,,,,458,458,458,458,458,458,458', -'458,458,458,450,450,458,,450,450,,450,,,,,,,,,,,,,,,,,450,450,,,,,,450', -',450,,450,450,,450,450,450,,450,450,450,450,,,450,450,,,450,,,450,450', -',,,,,,450,,,,,,450,,,,450,450,,450,450,,,,450,450,450,450,450,,,450', -'450,450,443,443,450,,443,443,,443,,,,,,,,,,,,,,,,,443,443,,,,,,443,', -'443,,443,443,,443,443,443,,443,443,,,,,443,443,,,443,,,443,443,,,,,', -',443,,,,,,443,,,,443,443,,443,443,,,,443,443,443,443,443,,,443,443,443', -'426,426,443,,426,426,,426,,,,,,,,,,,,,,,,,426,426,,,,,,426,,426,,426', -'426,,426,426,426,,426,426,426,426,,,426,426,,,426,,,426,426,,,,,,,426', -',,,,,426,,,,426,426,,426,426,,,,426,426,426,426,426,426,426,426,426', -'426,161,161,426,,161,161,,161,,,,,,,,,,,,,,,,,161,161,161,,,,,161,,161', -',161,161,,161,161,161,,161,161,161,161,,,161,161,,,161,,,161,161,,,', -',,,161,,,,,,161,,,,161,161,,161,161,,,,161,161,161,161,161,161,161,161', -'161,161,11,11,161,,11,11,,11,,,,,,,,,,,,,,,,,11,11,,,,,,11,,11,,11,11', +'105,106,106,105,,106,106,,106,,,,,,,,,,,,,,,,,106,106,,,,,,106,,106', +',106,106,,106,106,106,,106,106,,,,,106,106,,,106,,,106,106,,,,,,,106', +',,,,,106,,,,106,106,,106,106,,,,106,106,106,106,106,106,107,107,106', +',107,107,,107,,,,,,,,,,,,,,,,,107,107,,,,,,107,,107,,107,107,,107,107', +'107,,107,107,,,,,107,107,,,107,,,107,107,,,,,,,107,,,,,,107,,,,107,107', +',107,107,,,,107,107,107,107,107,107,108,108,107,,108,108,,108,,,,,,', +',,,,,,,,,,108,108,,,,,,108,,108,,108,108,,108,108,108,,108,108,,,,,108', +'108,,,108,,,108,108,,,,,,,108,,,,,,108,,,,108,108,,108,108,,,,108,108', +'108,108,108,108,109,109,108,,109,109,,109,,,,,,,,,,,,,,,,,109,109,,', +',,,109,,109,,109,109,,109,109,109,,109,109,,,,,109,109,,,109,,,109,109', +',,,,,,109,,,,,,109,,,109,109,109,,109,109,,,,109,109,109,109,109,109', +'110,110,109,,110,110,,110,,,,,,,,,,,,,,,,,110,110,,,,,,110,,110,,110', +'110,,110,110,110,,110,110,110,110,,,110,110,,,110,,,110,110,,,,,,,110', +',,,,,110,,,,110,110,,110,110,,,,110,110,110,110,110,110,205,205,110', +',205,205,,205,,,,,,,,,,,,,,,,,205,205,,,,,,205,,205,,205,205,,205,205', +'205,,205,205,,,,,205,205,,,205,,,205,205,,,,,,,205,,,,,,205,,,,205,205', +',205,205,,,,205,205,205,205,205,205,426,426,205,,426,426,,426,,,,,,', +',,,,,,,,,,426,426,,,,,,426,,426,,426,426,,426,426,426,,426,426,426,426', +',,426,426,,,426,,,426,426,,,,,,,426,,,,,,426,,,,426,426,,426,426,,,', +'426,426,426,426,426,426,114,114,426,,114,114,,114,,,,,,,,,,,,,,,,,114', +'114,,,,,,114,,114,,114,114,,114,114,114,,114,114,,,,,114,114,,,114,', +',114,114,,,,,,,114,,,,,,114,,,,114,114,,114,114,,,,114,114,114,114,114', +'114,115,115,114,,115,115,,115,,,,,,,,,,,,,,,,,115,115,,,,,,115,,115', +',115,115,,115,115,115,,115,115,,,,,115,115,,,115,,,115,115,,,,,,,115', +',,,,,115,,,,115,115,,115,115,,,,115,115,115,115,115,115,423,423,115', +',423,423,,423,,,,,,,,,,,,,,,,,423,423,,,,,,423,,423,,423,423,,423,423', +'423,,423,423,423,423,,,423,423,,,423,,,423,423,,,,,,,423,,,,,,423,,', +',423,423,,423,423,,,,423,423,423,423,423,423,416,416,423,,416,416,,416', +',,,,,,,,,,,,,,,,416,416,,,,,,416,,416,,416,416,,416,416,416,,416,416', +'416,416,,,416,416,,,416,,,416,416,,,,,,,416,,,,,,416,,,,416,416,,416', +'416,,,,416,416,416,416,416,416,118,118,416,,118,118,,118,,,,,,,,,,,', +',,,,,118,118,,,,,,118,,118,,118,118,,118,118,118,,118,118,,,,,118,118', +',,118,,,118,118,,,,,,,118,,,,,,118,,,,118,118,,118,118,,,,118,118,118', +'118,118,118,409,409,118,,409,409,,409,,,,,,,,,,,,,,,,,409,409,,,,,,409', +',409,,409,409,,409,409,409,,409,409,,,,,409,409,,,409,,,409,409,,,,', +',,409,,,,,,409,,,,409,409,,409,409,,,,409,409,409,409,409,409,204,204', +'409,,204,204,,204,,,,,,,,,,,,,,,,,204,204,,,,,,204,,204,,204,204,,204', +'204,204,,204,204,,,,,204,204,,,204,,,204,204,,,,,,,204,,,,,,204,,,,204', +'204,,204,204,,,,204,204,204,204,204,204,288,288,204,,288,288,,288,,', +',,,,,,,,,,,,,,288,288,,,,,,288,,288,,288,288,,288,288,288,,288,288,', +',,,288,288,,,288,,,288,288,,,,,,,288,,,,,,288,,,,288,288,,288,288,,', +',288,288,288,288,288,288,199,199,288,,199,199,,199,,,199,,,,,,,,,,,', +',,199,199,,,,,,199,,199,,199,199,,199,199,199,,199,199,,,,,199,199,', +',199,,,199,199,,,,,,,199,,,,,,199,,,,199,199,,199,199,,,,199,199,199', +'199,199,199,300,300,199,,300,300,,300,,,,,,,,,,,,,,,,,300,300,,,,,,300', +',300,,300,300,,300,300,300,,300,300,300,300,,,300,300,,,300,,,300,300', +',,,,,,300,,,,,,300,,,,300,300,,300,300,,,,300,300,300,300,300,300,268', +'268,300,,268,268,,268,,,,,,,,,,,,,,,,,268,268,,,,,,268,,268,,268,268', +',268,268,268,,268,268,268,268,,,268,268,,,268,,,268,268,,,,,,,268,,', +',,,268,,,,268,268,,268,268,,,,268,268,268,268,268,268,473,473,268,,473', +'473,,473,,,,,,,,,,,,,,,,,473,473,,,,,,473,,473,,473,473,,473,473,473', +',473,473,473,473,,,473,473,,,473,,,473,473,,,,,,,473,,,,,,473,,,,473', +'473,,473,473,,,,473,473,473,473,473,473,267,267,473,,267,267,,267,,', +',,,,,,,,,,,,,,267,267,,,,,,267,,267,,267,267,,267,267,267,,267,267,267', +'267,,,267,267,,,267,,,267,267,,,,,,,267,,,,,,267,,,,267,267,,267,267', +',,,267,267,267,267,267,267,264,264,267,,264,264,,264,,,,,,,,,,,,,,,', +',264,264,,,,,,264,,264,,264,264,,264,264,264,,264,264,264,264,,,264', +'264,,,264,,,264,264,,,,,,,264,,,,,,264,,,,264,264,,264,264,,,,264,264', +'264,264,264,264,392,392,264,,392,392,,392,,,,,,,,,,,,,,,,,392,392,,', +',,,392,,392,,392,392,,392,392,392,,392,392,392,392,,,392,392,,,392,', +',392,392,,,,,,,392,,,,,,392,,,,392,392,,392,392,,,,392,392,392,392,392', +'392,303,303,392,,303,303,,303,303,,,,,,,,,,,,,,,,303,303,,,,,,303,,303', +',303,303,,303,303,303,,303,303,303,303,,,303,303,,,303,,,303,303,,,', +',,,303,,,,,,303,,,,303,303,,303,303,,,,303,303,303,303,303,303,308,308', +'303,,308,308,,308,,,,,,,,,,,,,,,,,308,308,,,,,,308,,308,,308,308,,308', +'308,308,,308,308,308,308,,,308,308,,,308,,,308,308,,,,,,,308,,,,,,308', +',,,308,308,,308,308,,,,308,308,308,308,308,308,383,383,308,,383,383', +',383,,,,,,,,,,,,,,,,,383,383,,,,,,383,,383,,383,383,,383,383,383,,383', +'383,383,383,,,383,383,,,383,,,383,383,,,,,,,383,,,,,,383,,,,383,383', +',383,383,,,,383,383,383,383,383,383,382,382,383,,382,382,,382,,,,,,', +',,,,,,,,,,382,382,,,,,,382,,382,,382,382,,382,382,382,,382,382,382,382', +',,382,382,,,382,,,382,382,,,,,,,382,,,,,,382,,,,382,382,,382,382,,,', +'382,382,382,382,382,382,380,380,382,,380,380,,380,380,,,,,,,,,,,,,,', +',380,380,,,,,,380,,380,,380,380,,380,380,380,,380,380,,,,,380,380,,', +'380,,,380,380,,,,,,,380,,,,,,380,,,,380,380,,380,380,,,,380,380,380', +'380,380,380,10,10,380,,10,10,,10,,,,,,,,,,,,,,,,,10,10,,,,,,10,,10,', +'10,10,,10,10,10,,10,10,10,10,,,10,10,,,10,,,10,10,,,,,,,10,,,,,,10,', +',,10,10,,10,10,,,,10,10,10,10,10,10,482,482,10,,482,482,,482,,,,,,,', +',,,,,,,,,482,482,,,,,,482,,482,,482,482,,482,482,482,,482,482,,,,,482', +'482,,,482,,,482,482,,,,,,,482,,,,,,482,,,,482,482,,482,482,,,,482,482', +'482,482,482,482,148,148,482,,148,148,,148,,,,,,,,,,,,,,,,,148,148,148', +',,,,148,,148,,148,148,,148,148,148,,148,148,148,148,,,148,148,,,148', +',,148,148,,,,,,,148,,,,,,148,,,,148,148,,148,148,,,,148,148,148,148', +'148,148,11,11,148,,11,11,,11,,,,,,,,,,,,,,,,,11,11,,,,,,11,,11,,11,11', ',11,11,11,,11,11,11,11,,,11,11,,,11,,,11,11,,,,,,,11,,,,,,11,,,,11,11', -',11,11,,,,11,11,11,11,11,,,11,11,11,522,522,11,,522,522,,522,,,,,,,', -',,,,,,,,,522,522,,,,,,522,,522,,522,522,,522,522,522,,522,522,,,,,522', -'522,,,522,,,522,522,,,,,,,522,,,,,,522,,,,522,522,,522,522,,,,522,522', -'522,522,522,,,522,522,522,170,170,522,,170,170,,170,,,,,,,,,,,,,,,,', -'170,170,,,,,,170,,170,,170,170,,170,170,170,,170,170,170,170,,,170,170', -',,170,,,170,170,,,,,,,170,,,,,,170,,,,170,170,,170,170,,,,170,170,170', -'170,170,170,170,170,170,170,171,171,170,,171,171,,171,171,,,,,,,,,,', -',,,,,171,171,,,,,,171,,171,,171,171,,171,171,171,,171,171,171,171,,', -'171,171,,,171,,,171,171,,,,,,,171,,,,,,171,,,,171,171,,171,171,,,,171', -'171,171,171,171,,,171,171,171,416,416,171,,416,416,,416,,,,,,,,,,,,', -',,,,416,416,,,,,,416,,416,,416,416,,416,416,416,,416,416,416,416,,,416', -'416,,,416,,,416,416,,,,,,,416,,,,,,416,,,,416,416,,416,416,,,,416,416', -'416,416,416,,,416,416,416,17,17,416,,17,17,,17,,,,,,,,,,,,,,,,,17,17', -',,,,,17,,17,,17,17,,17,17,17,,17,17,,,,,17,17,,,17,,,17,17,,,,,,,17', -',,,,,17,,,,17,17,,17,17,,,,17,17,17,17,17,,,17,17,17,414,414,17,,414', -'414,,414,,,,,,,,,,,,,,,,,414,414,,,,,,414,,414,,414,414,,414,414,414', -',414,414,414,414,,,414,414,,,414,,,414,414,,,,,,,414,,,,,,414,,,,414', -'414,,414,414,,,,414,414,414,414,414,,,414,414,414,413,413,414,,413,413', -',413,,,,,,,,,,,,,,,,,413,413,,,,,,413,,413,,413,413,,413,413,413,,413', -'413,413,413,,,413,413,,,413,,,413,413,,,,,,,413,,,,,,413,,,,413,413', -',413,413,,,,413,413,413,413,413,,,413,413,413,411,411,413,,411,411,', -'411,411,,,,,,,,,,,,,,,,411,411,,,,,,411,,411,,411,411,,411,411,411,', -'411,411,,,,,411,411,,,411,,,411,411,,,,,,,411,,,,,,411,,,,411,411,,411', -'411,,,,411,411,411,411,411,,,411,411,411,0,0,411,,0,0,,0,,,,,,,,,,,', -',,,,,0,0,,,,,,0,,0,,0,0,,0,0,0,,0,0,0,0,,,0,0,,,0,,,0,0,,,,,,,0,,,,', -',0,,,,0,0,,0,0,0,,,0,0,0,0,0,,,0,0,0,201,201,0,,201,201,,201,,,,,,,', -',,,,,,,,,201,201,,,,,,201,,201,,201,201,,201,201,201,,201,201,201,201', -',,201,201,,,201,,,201,201,,,,,,,201,,,,,,201,,,,201,201,,201,201,,,', -'201,201,201,201,201,,,201,201,201,204,204,201,,204,204,,204,204,,,,', -',,,,,,,,,,,204,204,,,,,,204,,204,,204,204,,204,204,204,,204,204,204', -'204,,,204,204,,,204,,,204,204,,,,,,,204,,,,,,204,,,,204,204,,204,204', -',,,204,204,204,204,204,204,204,204,204,204,403,403,204,,403,403,,403', -',,,,,,,,,,,,,,,,403,403,,,,,,403,,403,,403,403,,403,403,403,,403,403', -'403,403,,,403,403,,,403,,,403,403,,,,,,,403,,,,,,403,,,,403,403,,403', -'403,,,,403,403,403,403,403,403,403,403,403,403,400,400,403,,400,400', -',400,,,,,,,,,,,,,,,,,400,400,,,,,,400,,400,,400,400,,400,400,400,,400', -'400,,,,,400,400,,,400,,,400,400,,,,,,,400,,,,,,400,,,,400,400,,400,400', -',,,400,400,400,400,400,,,400,400,400,217,217,400,,217,217,,217,,,217', -',,,,,,,,,,,,,217,217,,,,,,217,,217,,217,217,,217,217,217,,217,217,,', -',,217,217,,,217,,,217,217,,,,,,,217,,,,,,217,,,,217,217,,217,217,,,', -'217,217,217,217,217,,,217,217,217,222,222,217,,222,222,,222,,,,,,,,', -',,,,,,,,222,222,,,,,,222,,222,,222,222,,222,222,222,,222,222,,,,,222', -'222,,,222,,,222,222,,,,,,,222,,,,,,222,,,,222,222,,222,222,,,,222,222', -'222,222,222,,,222,222,222,223,223,222,,223,223,,223,,,,,,,,,,,,,,,,', -'223,223,,,,,,223,,223,,223,223,,223,223,223,,223,223,,,,,223,223,,,223', -',,223,223,,,,,,,223,,,,,,223,,,,223,223,,223,223,,,,223,223,223,223', -'223,,,223,223,223,224,224,223,,224,224,,224,,,,,,,,,,,,,,,,,224,224', -',,,,,224,,224,,224,224,,224,224,224,,224,224,,,,,224,224,,,224,,,224', -'224,,,,,,,224,,,,,,224,,,,224,224,,224,224,,,,224,224,224,224,224,,', -'224,224,224,396,396,224,,396,396,,396,396,,,,,,,,,,,,,,,,396,396,,,', -',,396,,396,,396,396,,396,396,396,,396,396,396,396,,,396,396,,,396,,', -'396,396,,,,,,,396,,,,,,396,,,,396,396,,396,396,,,,396,396,396,396,396', -',,396,396,396,265,265,396,,265,265,,265,,,,,,,,,,,,,,,,,265,265,,,,', -',265,,265,,265,265,,265,265,265,,265,265,,,,,265,265,,,265,,,265,265', -',,,,,,265,,,,,,265,,,,265,265,,265,265,,,,265,265,265,265,265,,,265', -'265,265,379,379,265,,379,379,,379,,,,,,,,,,,,,,,,,379,379,,,,,,379,', -'379,,379,379,,379,379,379,,379,379,,,,,379,379,,,379,,,379,379,,,,,', -',379,,,,,,379,,,,379,379,,379,379,,,,379,379,379,379,379,,,379,379,379', -'358,358,379,,358,358,,358,,,,,,,,,,,,,,,,,358,358,,,,,,358,,358,,358', -'358,,358,358,358,,358,358,358,358,,,358,358,,,358,,,358,358,,,,,,,358', -',,,,,358,,,,358,358,,358,358,,,,358,358,358,358,358,358,358,358,358', -'358,287,287,358,,287,287,,287,,,,,,,,,,,,,,,,,287,287,,,,,,287,,287', -',287,287,,287,287,287,,287,287,287,287,,,287,287,,,287,,,287,287,,,', -',,,287,,,,,,287,,,,287,287,,287,287,,,,287,287,287,287,287,287,287,287', -'287,287,354,354,287,,354,354,,354,,,,,,,,,,,,,,,,,354,354,,,,,,354,', -'354,,354,354,,354,354,354,,354,354,,,,,354,354,,,354,,,354,354,,,,,', -',354,,,,,,354,,,,354,354,,354,354,,,,354,354,354,354,354,,,354,354,354', -'290,290,354,,290,290,,290,,,,,,,,,,,,,,,,,290,290,,,,,,290,,290,,290', -'290,,290,290,290,,290,290,290,290,,,290,290,,,290,,,290,290,,,,,,,290', -',,,,,290,,,,290,290,,290,290,,,,290,290,290,290,290,290,290,290,290', -'290,291,291,290,,291,291,,291,,,,,,,,,,,,,,,,,291,291,,,,,,291,,291', -',291,291,,291,291,291,,291,291,291,291,,,291,291,,,291,,,291,291,,,', -',,,291,,,,,,291,,,,291,291,,291,291,,,,291,291,291,291,291,291,291,291', -'291,291,292,292,291,,292,292,,292,,,,,,,,,,,,,,,,,292,292,,,,,,292,', -'292,,292,292,,292,292,292,,292,292,292,292,,,292,292,,,292,,,292,292', -',,,,,,292,,,,,,292,,,,292,292,,292,292,,,,292,292,292,292,292,,,292', -'292,292,353,353,292,,353,353,,353,,,,,,,,,,,,,,,,,353,353,,,,,,353,', -'353,,353,353,,353,353,353,,353,353,,,,,353,353,,,353,,,353,353,,,,,', -',353,,,,,,353,,,,353,353,,353,353,,,,353,353,353,353,353,,,353,353,353', -'352,352,353,,352,352,,352,,,,,,,,,,,,,,,,,352,352,,,,,,352,,352,,352', -'352,,352,352,352,,352,352,,,,,352,352,,,352,,,352,352,,,,,,,352,,,,', -',352,,,,352,352,,352,352,,,,352,352,352,352,352,,,352,352,352,351,351', -'352,,351,351,,351,,,,,,,,,,,,,,,,,351,351,,,,,,351,,351,,351,351,,351', -'351,351,,351,351,,,,,351,351,,,351,,,351,351,,,,,,,351,,,,,,351,,,,351', -'351,,351,351,,,,351,351,351,351,351,,,351,351,351,310,310,351,,310,310', -',310,310,,,,,,,,,,,,,,,,310,310,,,,,,310,,310,,310,310,,310,310,310', -',310,310,310,310,,,310,310,,,310,,,310,310,,,,,,,310,,,,,,310,,,,310', -'310,,310,310,,,,310,310,310,310,310,,,310,310,310,311,311,310,,311,311', -',311,311,,,,,,,,,,,,,,,,311,311,,,,,,311,,311,,311,311,,311,311,311', -',311,311,311,311,,,311,311,,,311,,,311,311,,,,,,,311,,,,,,311,,,,311', -'311,,311,311,,,,311,311,311,311,311,,,311,311,311,312,312,311,,312,312', -',312,,,,,,,,,,,,,,,,,312,312,,,,,,312,,312,,312,312,,312,312,312,,312', -'312,,,,,312,312,,,312,,,312,312,,,,,,,312,,,,,,312,,,,312,312,,312,312', -',,,312,312,312,312,312,,,312,312,312,331,331,312,,331,331,,331,331,', -',,,,,,,,,,,,,,331,331,,,,,,331,,331,,331,331,,331,331,331,,331,331,331', -'331,,,331,331,,,331,,,331,331,,,,,,,331,,,,,,331,,,,331,331,,331,331', -',,,331,331,331,331,331,331,331,331,331,331,328,328,331,,328,328,,328', -',,,,,,,,,,,,,,,,328,328,,,,,,328,,328,,328,328,,328,328,328,,328,328', -'328,328,,,328,328,,,328,,,328,328,63,63,,,63,,328,,,,,,328,,,,328,328', -',328,328,,,,328,328,328,328,328,328,328,328,328,328,203,,328,,,,63,', -',63,,,203,203,203,,203,,203,,203,,203,203,203,203,,,,63,421,421,,,421', -',,,,63,63,203,,,,203,203,,,203,203,203,203,203,203,,203,203,,,,,,203', -'278,,,,232,232,421,,232,421,203,203,278,278,278,278,278,,278,,278,,278', -'278,278,278,203,,,421,,,,,,,,,,421,421,278,,,232,278,278,232,409,278', -'278,278,278,278,278,,278,278,,,409,409,409,278,409,,409,232,409,,409', -'409,409,409,,,,232,232,,,,,,,,,,,409,278,,,409,409,,,409,409,409,409', -'409,409,,409,409,165,,165,,,409,,,,,,,165,165,165,,165,255,165,,165', -',165,165,165,165,,,,,,255,409,255,,,,255,321,321,,165,321,,,165,165', -',,165,165,165,165,165,165,,165,165,255,,,,,165,,,255,255,255,255,255', -'255,,255,255,439,,,321,,255,321,,,,,,439,439,439,165,439,,439,,439,', -'439,439,439,439,321,,,,,,255,,,,321,321,,,,439,,,,439,439,,440,439,439', -'439,439,439,439,,439,439,,,440,440,440,439,440,248,440,,440,,440,440', -'440,440,,,,,,248,,248,,,,248,,,,440,439,,,440,440,,,440,440,440,440', -'440,440,,440,440,248,,,,,440,,,,,248,248,,438,,248,248,,,,,,248,,,438', -'438,438,,438,256,438,440,438,,438,438,438,438,,,,,256,256,,256,,,248', -'256,,256,,438,,,,438,438,,,438,438,438,438,438,438,,438,438,256,,,253', -',438,,,256,256,256,256,256,256,,256,256,253,,253,257,,256,253,,,,,,', -',,438,257,257,,257,,,,257,,257,,253,,,,247,256,,,253,253,253,253,,,', -'253,253,257,247,,247,,253,,247,257,257,257,257,257,257,,257,257,,,,', -',257,,,,,,247,,,,253,,,,,,247,247,441,,,247,247,,,,,257,247,,441,441', -'441,,441,,441,,441,,441,441,441,441,,,,,,,,,,,,247,,,,441,,,,441,441', -',258,441,441,441,441,441,441,,441,441,,,,258,258,441,258,,,,258,,258', -',,,,,,,,,,,,,,,,,,258,441,,,,9,,,258,258,258,258,258,258,,258,258,9', -'9,9,,9,258,9,,9,,9,9,9,9,,,,,,,,,,,,,,,,9,,,258,9,9,,259,9,9,9,9,9,9', -',9,9,,,,259,259,9,259,,,,259,,259,,,,,,,,,,,,,,,,,,,259,9,,,,260,,,259', -'259,259,259,259,259,,259,259,260,260,260,,260,259,260,,260,,260,260', -'260,260,,,,,,,,,,,,,,,,260,,,259,,261,,,260,260,260,260,260,260,,260', -'260,261,261,261,,261,260,261,,261,,261,261,261,261,,,,,,,,,,,,,,,,261', -',,260,,261,,,261,261,261,261,261,261,262,261,261,,,262,,,261,,,,262', -'262,262,,262,,262,,262,,262,262,262,262,,,,,,,,,,261,,,,,,262,,,,262', -'262,,,262,262,262,262,262,262,,262,262,266,266,,,,262,266,,,,,,266,266', -'266,,266,,266,,266,,266,266,266,266,,,,,,,262,,,,,,,,,266,,,,266,266', -',467,266,266,266,266,266,266,,266,266,,,467,467,467,266,467,,467,,467', -',467,467,467,467,,,,,,,,,,,,,,,,467,266,,,467,467,,273,467,467,467,467', -'467,467,,467,467,,,273,273,273,467,273,,273,,273,,273,273,273,273,,', -',,,,,,,,,,,,,273,467,,,273,273,,,273,273,273,273,273,273,215,273,273', -',,,,,273,,,,215,215,215,215,215,252,215,,215,,215,215,215,215,,,,,,252', -',252,,273,,252,,,,215,,,,215,215,,,215,215,215,215,215,215,,215,215', -'252,,,254,,215,,,252,252,252,252,,,,252,252,254,,254,,,252,254,,,,,', -',,,215,,,,,,,,,,,,254,,,,,252,,,254,254,254,254,254,254,,254,254,162', -',162,,,254,,,,,,,162,162,162,,162,,162,,162,,162,162,162,162,,,,,,,254', -',,,,,,,,162,,,,162,162,,,162,162,162,162,162,162,,162,162,164,,164,', -',162,,,,,,,164,164,164,,164,,164,,164,,164,164,164,164,,,,,,,162,,,', -',,,,,164,,,,164,164,,510,164,164,164,164,164,164,,164,164,,,510,510', -'510,164,510,,510,,510,,510,510,510,510,,,,,,,,,,,,,,,,510,164,,,510', -'510,,,510,510,510,510,510,510,,510,510,,350,350,350,350,510,350,350', -'350,,350,,350,350,,,,,,,350,350,350,,,,350,,,,,,510,,,,,,350,350,,,', -',,,,,,,,350,350,350,350,350,350,350,350,272,272,272,272,,272,272,272', -',272,,272,272,,,,,,,272,272,272,,,,272,,,,,,,,,,,,272,272,,,,,,,,,,', -',272,272,272,272,272,272,272,272,388,388,388,388,,388,388,388,,388,', -'388,388,,,,,,,388,388,388,,,,388,,,,,,,,,,,,388,388,,,,,,,,,,,,388,388', -'388,388,388,388,388,388,415,415,415,415,,415,415,415,,415,,415,415,', -',,,,,415,415,415,,,,415,,,,,,,,,,,,415,415,,,,,,,,,,,,415,415,415,415', -'415,415,415,415,348,348,348,348,,348,348,348,,348,,348,348,,,,,,,348', -'348,348,,,,348,,,,,,,,,,,,348,348,,,,,,,,,,,,348,348,348,348,348,348', -'348,348,380,380,380,380,,380,380,380,,380,,380,380,,,,,,,380,380,380', -',,,380,,,,,,,,,,,,380,380,,,,,,,,,,,,380,380,380,380,380,380,380,380' ] - racc_action_check = arr = ::Array.new(10662, nil) +',11,11,,,,11,11,11,11,11,11,269,269,11,,269,269,,269,,,,,,,,,,,,,,,', +',269,269,,,,,,269,,269,,269,269,,269,269,269,,269,269,269,269,,,269', +'269,,,269,,,269,269,,,,,,,269,,,,,,269,,,,269,269,,269,269,,,,269,269', +'269,269,269,269,16,16,269,,16,16,,16,,,,,,,,,,,,,,,,,16,16,,,,,,16,', +'16,,16,16,,16,16,16,,16,16,,,,,16,16,,,16,,,16,16,,,,,,,16,,,,,,16,', +',,16,16,,16,16,,,,16,16,16,16,16,16,372,372,16,,372,372,,372,,,,,,,', +',,,,,,,,,372,372,,,,,,372,,372,,372,372,,372,372,372,,372,372,372,372', +',,372,372,,,372,,,372,372,,,,,,,372,,,,,,372,,,,372,372,,372,372,,,', +'372,372,372,372,372,372,155,155,372,,155,155,,155,,,,,,,,,,,,,,,,,155', +'155,,,,,,155,,155,,155,155,,155,155,155,,155,155,155,155,,,155,155,', +',155,,,155,155,,,,,,,155,,,,,,155,,,,155,155,,155,155,405,,,155,155', +'155,155,155,155,,,155,405,405,405,,405,,405,,405,,405,405,405,405,,', +',,,,,,,,,,,,,405,,,,405,405,,9,405,405,405,405,405,405,,405,405,,,9', +'9,9,405,9,,9,,9,,9,9,9,9,,,,,,,,,,,,,405,,,9,,,,9,9,,472,9,9,9,9,9,9', +',9,9,,,472,472,472,9,472,,472,,472,,472,472,472,472,,,,,,,,,,,,,9,,', +'472,,,,472,472,,432,472,472,472,472,472,472,,472,472,,,432,432,432,472', +'432,,432,,432,,432,432,432,432,,,,,,,,,,,,,472,,,432,,,,432,432,,407', +'432,432,432,432,432,432,,432,432,,,407,407,407,432,407,,407,,407,,407', +'407,407,407,,,,,,,,,,,,,432,,,407,,,,407,407,,406,407,407,407,407,407', +'407,,407,407,,,406,406,406,407,406,,406,,406,,406,406,406,406,,,,,,', +',,,,,,407,,,406,,,,406,406,,404,406,406,406,406,406,406,,406,406,,,404', +'404,404,406,404,,404,,404,,404,404,404,404,,,,,,,,,,,,,406,,,404,,,', +'404,404,,378,404,404,404,404,404,404,,404,404,,,378,378,378,404,378', +',378,,378,,378,378,378,378,,,,,,,,,,,,,404,,,378,,,,378,378,,,378,378', +'378,378,378,378,,378,378,149,,149,,,378,,,,,,,149,149,149,,149,,149', +',149,,149,149,149,149,,,378,,,,,,,,,,,,,149,,,,149,149,,,149,149,149', +'149,149,149,,149,149,151,,151,,,149,,,,,,,151,151,151,,151,,151,,151', +',151,151,151,151,,,149,,,,,,,,,,,,,151,,,,151,151,,,151,151,151,151', +'151,151,,151,151,152,,152,,,151,,,,,,,152,152,152,,152,,152,,152,,152', +'152,152,152,,,151,,,,,,,,,,,,,152,,,,152,152,,185,152,152,152,152,152', +'152,,152,152,,,185,185,185,152,185,,185,,185,,185,185,185,185,,,,,,', +',,,,,,152,,,185,,,,185,185,,,185,185,185,185,185,185,,185,185,,,,,,185', +',197,,,,,,,,,185,185,,197,197,197,197,197,225,197,,197,185,197,197,197', +'197,,,,,,225,,225,,,,225,,,,197,,,,197,197,,,197,197,197,197,197,197', +',197,197,225,,,226,,197,,,,,225,225,,,,225,225,226,,226,230,,225,226', +',,,,197,,,,,,230,,230,,,,230,,,,226,225,,,,,,,,,226,226,,,,226,226,230', +',,231,,226,,,230,230,230,230,,,,230,230,231,,231,232,,230,231,,,,,226', +',,,,,232,,232,,,,232,,,,231,230,,,,,,,231,231,231,231,,,,231,231,232', +',,233,,231,,,232,232,232,232,232,232,,232,232,233,,233,234,,232,233', +',,,,231,,,,,234,234,,234,,,,234,,234,,233,232,,,,,,,233,233,233,233', +'233,233,,233,233,234,,,,,233,,235,234,234,234,234,234,234,,234,234,', +',,235,235,234,235,236,,,235,233,235,,,,,,,,236,236,,236,,,,236,234,236', +',235,,,,,,,,235,235,235,235,235,235,,235,235,236,,,,,235,,237,236,236', +'236,236,236,236,,236,236,,,,237,237,236,237,,,,237,235,237,,,,,,,,,', +',,,,,,236,,,237,,,,,238,,,237,237,237,237,237,237,,237,237,238,238,238', +',238,237,238,,238,,238,238,238,238,,,,,,,,,,,,,,,237,238,,,,,239,,,238', +'238,238,238,238,238,,238,238,239,239,239,,239,238,239,,239,,239,239', +'239,239,,,,,,,,,,,,,,,238,239,,,,,239,,,239,239,239,239,239,239,240', +'239,239,,,240,,,239,,,,240,240,240,,240,,240,,240,,240,240,240,240,', +',,,,239,,,,,,,,,,240,,,,240,240,,,240,240,240,240,240,240,,240,240,244', +'244,,,,240,244,,,,,,244,244,244,,244,,244,,244,,244,244,244,244,,,240', +',,,,,,,,,,,,244,,,,244,244,,251,244,244,244,244,244,244,,244,244,,,251', +'251,251,244,251,,251,,251,,251,251,251,251,,,,,,,,,,,,,244,,,251,,,', +'251,251,,,251,251,251,251,251,251,256,251,251,,,,,,251,,,,256,256,256', +'256,256,,256,,256,,256,256,256,256,,,,,,251,,,,,,,,,,256,,,,256,256', +',,256,256,256,256,256,256,,256,256,,,,,,256,,,,,,,,,,,,,,,,,,,,,,,256' ] + racc_action_check = arr = ::Array.new(9761, nil) idx = 0 clist.each do |str| str.split(',', -1).each do |i| @@ -711,561 +647,525 @@ class Parser < Racc::Parser end racc_action_pointer = [ - 6641, 580, nil, nil, 544, 561, nil, -8, 563, 9619, - 5276, 5822, 202, nil, nil, nil, 180, 6277, 180, 271, - 362, 453, nil, nil, nil, nil, nil, nil, nil, nil, + 259, 420, nil, nil, 1390, 389, nil, 85, 392, 8471, + 7741, 8002, 403, nil, nil, nil, 8176, 955, 1042, 1129, + 1216, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - nil, nil, nil, nil, nil, nil, nil, nil, nil, 196, - 635, 92, 497, 541, 817, 908, 999, 28, 244, 199, - 251, 540, 557, 8973, 293, 214, 230, 252, 543, nil, - nil, nil, 1454, 1545, 1636, nil, nil, nil, 1727, nil, - 481, 469, nil, 2000, nil, 525, 2182, 510, -2, 2273, - 2364, 2455, 2546, 2637, 2728, 2819, 2910, 3001, 3092, 3183, - 3274, 3365, 3456, 3547, 3638, 3729, 3820, 3911, 4002, 4093, - 4184, 4275, 4366, 4457, 4548, 4639, 4730, nil, 25, 513, - 4821, 4912, 511, 508, 5185, 326, nil, nil, nil, nil, - nil, nil, 384, nil, nil, 444, 426, 90, 303, 488, - 480, 489, nil, nil, 474, 413, 75, 153, 475, 160, - 471, nil, nil, nil, nil, 468, nil, 32, nil, 411, - 424, 5731, 10142, nil, 10200, 9172, 333, 346, 241, 367, - 6004, 6095, 453, nil, 442, nil, nil, nil, nil, nil, - nil, nil, nil, 398, 4, 445, nil, nil, 438, nil, - 431, nil, 139, nil, nil, nil, nil, 257, nil, nil, - 226, 6732, -35, 9002, 6823, nil, 430, nil, nil, nil, - nil, 433, 401, 392, 389, 10023, 383, 7096, 7, 2, - -9, 73, 7187, 7278, 7369, nil, nil, 9, 342, 373, - 106, 374, 9075, 379, 17, 10, nil, nil, nil, nil, - nil, nil, nil, nil, 212, 5, 80, 9472, 9312, 130, - 269, 178, 10040, 9427, 10084, 9189, 9383, 9444, 9573, 9667, - 9713, 9759, 9814, nil, nil, 7551, 9872, 354, nil, nil, - nil, nil, 10339, 9968, 288, nil, 296, 264, 9066, nil, - 266, nil, 477, 484, 240, nil, nil, 7824, 195, nil, - 8006, 8097, 8188, 166, 205, 162, nil, nil, 196, nil, - nil, nil, nil, nil, 174, 108, -31, nil, 92, nil, - 8552, 8643, 8734, 112, 101, 77, 42, 34, 10, nil, - 558, 9215, -25, 7, 9, nil, nil, 86, 8916, 106, - nil, 8825, nil, nil, nil, nil, 89, nil, nil, nil, - nil, 157, nil, nil, nil, nil, 165, 178, 10513, 186, - 10281, 8461, 8370, 8279, 7915, 214, nil, 228, 7733, 241, - nil, 269, nil, nil, nil, nil, nil, nil, nil, nil, - nil, nil, nil, nil, nil, nil, nil, nil, 290, 7642, - 10571, 305, nil, 332, nil, 310, nil, 314, 10397, nil, - 273, nil, 184, 366, 369, nil, 7460, 380, 319, 381, - 7005, nil, nil, 6914, nil, 395, 135, 404, 396, 9114, - 119, 6550, nil, 6459, 6368, 10455, 6186, 441, nil, 461, - nil, 9037, nil, nil, 464, nil, 5640, nil, nil, nil, - nil, nil, nil, 405, 354, 468, nil, nil, 9366, 9247, - 9295, 9525, 479, 5549, nil, nil, 492, nil, nil, 493, - 5458, nil, nil, nil, 481, 485, 502, nil, 5367, nil, - nil, 5094, 509, nil, 5003, nil, nil, 9920, 70, nil, - 2091, 517, 496, nil, 524, 1909, 540, nil, nil, 542, - nil, nil, 544, 542, 546, 548, 1818, nil, 1363, 547, - nil, nil, 551, 519, nil, nil, nil, nil, 553, nil, - nil, 554, 555, nil, 150, nil, nil, 1181, nil, 726, - 10248, 1272, nil, nil, 563, nil, 1090, 565, nil, 566, - 570, nil, 5913, nil, nil, nil, nil, 573, nil, 582, - nil, 583, nil, nil, nil, 586, nil, nil, nil, nil, - 435, nil, nil, nil, nil, nil ] + nil, nil, nil, nil, nil, nil, nil, 1303, -21, 327, + 371, 1651, 1738, 1825, 376, 413, 347, 665, 66, 355, + nil, nil, nil, 2434, 2521, 2608, nil, nil, nil, nil, + nil, 2695, nil, 283, 284, nil, 2956, nil, nil, 354, + 3130, 338, 3304, 3391, 3478, 3565, 3652, 3739, 3826, 3913, + 4000, 4087, 4174, 4261, 4348, 4435, 4522, 4609, 4696, 4783, + 4870, 4957, 5044, 5131, 5218, 5305, 5392, 5479, 5566, 5653, + 5740, nil, -22, 331, 6001, 6088, 327, 310, 6349, 122, + nil, nil, nil, nil, nil, nil, 608, 500, 639, 204, + 284, 283, 290, nil, nil, 285, 215, 20, 455, 266, + nil, nil, 267, nil, 28, nil, 208, 87, 7915, 8817, + nil, 8875, 8933, 218, 214, 8350, 233, nil, 185, nil, + nil, nil, nil, nil, nil, 52, 7, 174, nil, nil, + 146, nil, 84, nil, 97, nil, nil, nil, nil, 129, + nil, nil, 194, 346, 56, 8981, 172, nil, 77, nil, + nil, nil, nil, 32, 505, 504, 494, 9046, 483, 6697, + 3, 6, 9, 0, 6523, 5827, 2260, nil, nil, -1, + 325, 326, 752, 327, -4, -10, nil, nil, nil, nil, + nil, nil, 552, 5, 92, 9063, 9107, 866, 953, -4, + 9124, 9168, 9185, 9229, 9246, 9294, 9311, 9359, 9405, 9451, + 9506, nil, nil, 2173, 9564, 463, nil, nil, nil, nil, + 150, 9612, 423, nil, 426, 405, 9667, nil, 408, nil, + 783, 457, nil, nil, 7132, 416, nil, 7045, 6871, 8089, + 404, 449, 412, nil, nil, 451, nil, nil, nil, nil, + nil, 449, 430, -28, 52, nil, 1912, 1999, 6610, 472, + 473, 473, 450, 578, -29, 438, 184, nil, nil, 493, + 6784, 502, nil, 7306, nil, nil, nil, nil, 7393, nil, + nil, nil, nil, -3, nil, nil, nil, nil, 10, 24, + 1020, 61, 237, 868, 781, 694, 607, 108, nil, 136, + 520, 153, nil, 165, nil, nil, nil, nil, nil, nil, + nil, nil, nil, nil, nil, nil, nil, nil, 170, 433, + 1107, 192, nil, 450, nil, 202, nil, 211, nil, 156, + nil, 133, 222, 233, nil, 85, 242, 181, 59, -2, + nil, nil, 8263, nil, 244, 131, 254, 233, 8759, 125, + 7654, nil, 7567, 7480, 252, 274, nil, 404, nil, nil, + 275, nil, 7219, nil, nil, nil, nil, nil, nil, 216, + 157, 280, nil, nil, 8711, 8423, 8663, 8615, 304, 6436, + nil, nil, 305, nil, nil, 305, 6262, nil, nil, nil, + 297, 298, nil, 6175, nil, nil, 5914, 331, nil, 3217, + nil, nil, 8567, 121, nil, 2869, 348, 324, nil, 350, + 2782, 352, nil, nil, 352, nil, nil, 356, 361, 2347, + nil, 2086, 367, nil, nil, 375, 346, nil, nil, nil, + nil, 384, nil, nil, 385, nil, 92, nil, nil, 1564, + nil, 1477, 8519, 6958, nil, nil, 3043, 398, nil, 403, + 408, nil, 7828, nil, nil, nil, 413, nil, 417, nil, + 418, nil, nil, 428, nil, nil, nil, nil, 400, nil, + nil, nil, nil, nil ] racc_action_default = [ - -3, -301, -1, -2, -4, -5, -8, -10, -18, -23, - -301, -301, -193, -35, -36, -37, -38, -301, -301, -301, - -301, -301, -70, -71, -72, -73, -74, -75, -76, -77, + -3, -283, -1, -2, -4, -5, -8, -10, -18, -23, + -283, -283, -283, -35, -36, -37, -283, -283, -283, -283, + -283, -69, -70, -71, -72, -73, -74, -75, -76, -77, -78, -79, -80, -81, -82, -83, -84, -85, -86, -87, - -88, -89, -90, -91, -92, -93, -94, -95, -96, -97, - -301, -301, -104, -108, -301, -301, -301, -301, -301, -301, - -301, -301, -301, -301, -301, -249, -272, -248, -301, -220, - -221, -222, -301, -301, -301, -245, -246, -247, -301, -251, - -301, -264, -267, -301, -273, -301, -301, -7, -301, -301, - -301, -301, -301, -301, -301, -301, -145, -301, -301, -301, - -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, - -301, -301, -301, -301, -301, -301, -301, -102, -301, -140, - -300, -300, -24, -25, -301, -300, -163, -190, -191, -192, - -193, -194, -301, -157, -158, -49, -193, -50, -57, -301, - -301, -14, -15, -16, -274, -99, -239, -241, -244, -240, - -301, -236, -242, -243, -103, -210, -217, -272, -105, -300, - -301, -301, -301, -116, -301, -301, -300, -300, -301, -300, - -301, -301, -274, -174, -176, -177, -178, -179, -180, -182, - -183, -248, -249, -300, -301, -274, -224, -233, -234, -237, - -274, -226, -301, -229, -230, -235, -250, -301, -255, -258, - -301, -262, -301, -301, -301, 546, -6, -9, -11, -12, - -13, -19, -20, -21, -22, -301, -274, -301, -95, -96, - -97, -292, -285, -291, -279, -146, -149, -301, -282, -296, - -193, -299, -288, -294, -221, -222, -278, -283, -284, -286, - -287, -289, -297, -298, -39, -40, -41, -42, -43, -44, - -45, -46, -47, -48, -51, -52, -53, -54, -55, -56, - -58, -59, -301, -60, -134, -301, -23, -274, -64, -67, - -109, -110, -145, -144, -301, -143, -301, -276, -301, -30, - -300, -195, -301, -301, -301, -61, -62, -275, -301, -101, - -301, -301, -262, -301, -301, -301, -189, -114, -274, -200, - -202, -203, -204, -205, -207, -301, -301, -272, -301, -107, - -301, -301, -301, -301, -301, -301, -301, -274, -301, -171, - -300, -275, -301, -300, -214, -215, -216, -301, -275, -301, - -227, -301, -252, -253, -254, -256, -301, -259, -260, -261, - -263, -274, -265, -268, -270, -271, -8, -301, -145, -301, - -275, -301, -301, -301, -301, -274, -136, -301, -275, -274, - -148, -301, -279, -280, -281, -282, -285, -288, -290, -291, - -292, -293, -294, -295, -296, -299, -141, -142, -301, -277, - -145, -301, -166, -301, -196, -274, -197, -274, -145, -17, - -98, -232, -301, -301, -301, -111, -301, -187, -301, -275, - -301, -208, -209, -301, -106, -301, -119, -301, -125, -68, - -301, -301, -129, -300, -300, -145, -300, -301, -170, -301, - -184, -301, -175, -181, -301, -212, -301, -223, -238, -225, - -228, -231, -257, -301, -301, -274, -28, -147, -152, -150, - -151, -138, -301, -275, -63, -65, -301, -27, -31, -274, - -300, -167, -168, -169, -301, -301, -274, -100, -301, -211, - -218, -262, -301, -113, -301, -115, -201, -206, -119, -118, - -301, -301, -125, -124, -301, -301, -301, -128, -130, -301, - -164, -165, -301, -274, -301, -301, -301, -185, -300, -274, - -266, -269, -301, -32, -135, -137, -139, -29, -301, -198, - -199, -301, -301, -112, -301, -117, -120, -301, -123, -301, - -69, -300, -153, -154, -301, -159, -301, -301, -173, -301, - -301, -26, -33, -162, -156, -219, -188, -301, -122, -301, - -127, -301, -132, -133, -155, -301, -161, -172, -186, -213, - -276, -121, -126, -131, -160, -34 ] + -88, -89, -90, -91, -92, -93, -94, -283, -283, -101, + -105, -283, -283, -283, -283, -283, -283, -283, -283, -283, + -210, -211, -212, -283, -283, -283, -231, -232, -233, -234, + -235, -283, -237, -283, -250, -253, -283, -258, -259, -283, + -283, -7, -283, -283, -283, -283, -283, -283, -283, -283, + -142, -283, -283, -283, -283, -283, -283, -283, -283, -283, + -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, + -283, -99, -283, -137, -282, -282, -24, -25, -283, -282, + -155, -180, -181, -182, -183, -184, -48, -283, -49, -56, + -283, -283, -14, -15, -16, -260, -96, -229, -230, -283, + -226, -100, -200, -207, -258, -102, -282, -283, -283, -283, + -113, -283, -283, -282, -282, -283, -260, -164, -166, -167, + -168, -169, -170, -172, -173, -282, -283, -260, -214, -223, + -224, -227, -260, -216, -283, -219, -220, -225, -236, -283, + -241, -244, -283, -248, -283, -283, -283, 504, -6, -9, + -11, -12, -13, -19, -20, -21, -22, -283, -260, -283, + -92, -93, -94, -278, -271, -277, -265, -143, -146, -283, + -268, -266, -274, -280, -211, -212, -264, -269, -270, -272, + -273, -275, -38, -39, -40, -41, -42, -43, -44, -45, + -46, -47, -50, -51, -52, -53, -54, -55, -57, -58, + -283, -59, -131, -283, -23, -260, -63, -66, -106, -107, + -142, -141, -283, -140, -283, -262, -283, -30, -282, -185, + -283, -283, -60, -61, -261, -283, -98, -283, -283, -248, + -283, -283, -283, -179, -111, -260, -190, -192, -193, -194, + -195, -197, -283, -283, -283, -104, -283, -283, -283, -283, + -283, -260, -282, -261, -283, -282, -204, -205, -206, -283, + -261, -283, -217, -283, -238, -239, -240, -242, -283, -245, + -246, -247, -249, -260, -251, -254, -256, -257, -8, -283, + -142, -283, -261, -283, -283, -283, -283, -260, -133, -283, + -261, -260, -145, -283, -265, -266, -267, -268, -271, -274, + -276, -277, -278, -279, -280, -281, -138, -139, -283, -263, + -142, -283, -158, -283, -186, -260, -187, -260, -17, -95, + -222, -283, -283, -283, -108, -283, -177, -283, -261, -283, + -198, -199, -283, -103, -283, -116, -283, -122, -67, -283, + -283, -126, -282, -282, -283, -283, -174, -283, -165, -171, + -283, -202, -283, -213, -228, -215, -218, -221, -243, -283, + -283, -260, -28, -144, -149, -147, -148, -135, -283, -261, + -62, -64, -283, -27, -31, -260, -282, -159, -160, -161, + -283, -283, -97, -283, -201, -208, -248, -283, -110, -283, + -112, -191, -196, -116, -115, -283, -283, -122, -121, -283, + -283, -283, -125, -127, -283, -156, -157, -283, -283, -283, + -175, -282, -260, -252, -255, -283, -32, -132, -134, -136, + -29, -283, -188, -189, -283, -109, -283, -114, -117, -283, + -120, -283, -68, -282, -150, -151, -283, -283, -163, -283, + -283, -26, -33, -154, -209, -178, -283, -119, -283, -124, + -283, -129, -130, -283, -153, -162, -176, -203, -262, -118, + -123, -128, -152, -34 ] racc_goto_table = [ - 2, 126, 277, 177, 267, 135, 137, 138, 175, 264, - 139, 140, 158, 275, 275, 155, 156, 194, 343, 378, - 187, 187, 325, 339, 294, 87, 196, 298, 445, 188, - 188, 422, 144, 412, 122, 123, 185, 190, 216, 132, - 141, 337, 162, 164, 165, 3, 166, 167, 492, 126, - 448, 473, 296, 183, 274, 276, 263, 326, 469, 269, - 395, 506, 141, 141, 195, 411, 531, 355, 198, 341, - 437, 203, 169, 381, 451, 419, 423, 466, 207, 208, - 209, 210, 168, 402, 215, 244, 245, 246, 247, 248, - 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, - 259, 260, 261, 262, 266, 289, 195, 206, 273, 273, - 155, 156, 278, 401, 393, 508, 211, 212, 213, 214, - 505, 284, 391, 280, 155, 126, 428, 1, 445, 338, - 335, 487, 478, 336, 334, 199, 167, 201, 183, nil, - nil, nil, nil, 308, nil, nil, nil, 194, 324, 385, - 387, 141, 317, 479, 482, nil, 484, 315, nil, 356, - 141, nil, 425, nil, 313, 314, 155, 316, nil, nil, - nil, 318, 177, 382, nil, nil, nil, 175, nil, 392, - 288, 323, nil, nil, nil, 155, 156, nil, 424, nil, - 498, nil, nil, nil, 346, nil, nil, nil, nil, nil, - nil, 340, nil, nil, 347, 137, nil, nil, 320, nil, - 162, 164, 165, 420, 359, nil, 296, 166, 167, 126, - nil, 327, 183, nil, nil, nil, 329, nil, 519, nil, - nil, nil, nil, nil, 269, 389, nil, nil, nil, nil, - nil, nil, nil, nil, nil, nil, 155, 155, nil, 491, - nil, nil, 349, 262, nil, nil, nil, nil, nil, 397, - nil, 177, nil, nil, nil, nil, 175, nil, nil, nil, - nil, nil, nil, nil, 431, nil, 187, 141, nil, 266, - 195, 195, 545, 502, 432, 188, nil, nil, nil, nil, - 435, nil, 340, nil, nil, nil, nil, nil, nil, nil, - 409, 269, nil, 357, nil, nil, 481, 481, nil, 481, - 405, 407, nil, nil, 489, nil, nil, nil, 141, nil, - nil, 195, 449, nil, nil, nil, 198, nil, nil, nil, - 456, nil, nil, nil, 398, nil, nil, 495, nil, 438, - 439, 440, 441, 481, nil, nil, 266, nil, 195, nil, - 457, 389, 504, 417, nil, nil, nil, 483, nil, nil, - nil, 177, nil, 155, nil, nil, 175, 278, nil, 269, - nil, nil, 452, nil, nil, nil, nil, 433, nil, nil, - nil, 481, nil, nil, nil, nil, nil, nil, 467, nil, - nil, 442, nil, 141, nil, 446, 462, nil, nil, 409, - 540, 269, nil, nil, 532, nil, nil, 269, nil, nil, - nil, nil, nil, nil, 266, nil, 195, nil, nil, nil, - nil, 454, nil, 455, nil, nil, nil, nil, nil, nil, - nil, 262, nil, nil, nil, nil, nil, nil, nil, nil, - nil, nil, nil, nil, nil, nil, 266, nil, 195, nil, - nil, nil, 266, nil, 195, nil, nil, nil, 162, nil, - nil, 340, nil, 510, nil, nil, nil, nil, nil, nil, - nil, 493, nil, nil, nil, nil, nil, nil, nil, nil, - nil, nil, nil, nil, nil, 497, 517, nil, nil, nil, - nil, nil, 501, nil, nil, nil, nil, nil, nil, nil, - nil, nil, nil, nil, nil, nil, nil, 527, nil, 529, - 278, 533, nil, nil, nil, nil, 535, nil, nil, 514, - nil, nil, nil, nil, nil, 520 ] + 2, 161, 176, 255, 126, 128, 129, 245, 159, 130, + 131, 198, 142, 169, 169, 242, 348, 145, 178, 311, + 271, 297, 275, 170, 170, 153, 253, 253, 315, 165, + 143, 135, 388, 309, 411, 3, 381, 132, 81, 149, + 151, 152, 455, 444, 447, 252, 254, 247, 438, 434, + 167, 172, 414, 132, 132, 177, 241, 298, 273, 313, + 364, 180, 468, 380, 185, 116, 117, 490, 327, 403, + 154, 351, 189, 190, 191, 192, 417, 461, 197, 222, + 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, + 233, 234, 235, 236, 237, 238, 239, 240, 244, 385, + 177, 142, 251, 251, 266, 362, 256, 467, 470, 165, + 389, 142, 479, 431, 188, 371, 370, 360, 258, 143, + 394, 1, 310, 176, 307, 265, 450, 411, 443, 308, + 296, 306, 284, 181, 183, 355, 357, nil, 132, 291, + nil, 193, 194, 195, 196, 132, 292, nil, 142, 328, + nil, 391, 289, 290, nil, nil, 161, 299, nil, nil, + nil, nil, 301, 159, 295, 361, nil, 142, nil, 390, + 352, 331, nil, nil, nil, nil, 318, nil, nil, nil, + nil, 153, nil, 312, 165, 143, 319, 128, 321, nil, + nil, nil, 149, 151, 152, nil, nil, nil, nil, nil, + nil, nil, nil, nil, 386, 247, nil, 273, nil, nil, + nil, nil, nil, nil, 358, nil, nil, nil, nil, nil, + nil, nil, nil, nil, 142, 142, nil, nil, nil, nil, + nil, 240, nil, nil, nil, 329, 366, 161, nil, nil, + 397, 401, nil, 454, 159, nil, nil, nil, nil, nil, + 169, nil, nil, nil, 132, 398, 244, 177, 177, 503, + 170, nil, 464, nil, nil, 367, nil, 247, nil, 312, + nil, 415, nil, nil, nil, nil, 378, nil, nil, nil, + nil, 384, nil, nil, nil, nil, 374, 376, nil, 452, + 132, nil, nil, 177, 446, 446, nil, nil, 180, nil, + nil, nil, nil, 399, nil, nil, nil, nil, nil, nil, + nil, 404, 405, 406, 407, 458, nil, 408, 244, nil, + 177, 412, 358, nil, 418, nil, 466, 422, 446, 247, + nil, 161, 142, nil, nil, nil, nil, 256, 159, nil, + nil, nil, nil, nil, nil, 420, nil, 421, nil, nil, + nil, nil, nil, nil, nil, nil, nil, 432, nil, nil, + 247, nil, 132, 446, nil, 427, 247, 498, 378, nil, + nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, + 244, nil, 177, nil, nil, 491, nil, nil, nil, nil, + nil, 456, nil, nil, nil, nil, nil, 240, nil, nil, + nil, nil, nil, nil, nil, 460, nil, nil, nil, nil, + nil, 244, nil, 177, nil, nil, nil, 244, nil, 177, + nil, nil, nil, 149, nil, nil, 312, nil, 472, nil, + nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, + nil, nil, 480, nil, nil, nil, nil, nil, nil, 477, + nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, + nil, nil, nil, nil, nil, nil, nil, nil, nil, 486, + 256, 488, nil, 492, nil, nil, 493 ] racc_goto_check = [ - 2, 72, 15, 47, 24, 12, 12, 12, 48, 65, - 6, 6, 51, 64, 64, 49, 89, 9, 108, 16, - 8, 8, 46, 91, 55, 5, 101, 57, 25, 96, - 96, 81, 10, 62, 11, 11, 92, 92, 13, 75, - 6, 97, 12, 12, 12, 3, 72, 72, 14, 72, - 18, 60, 64, 72, 68, 68, 23, 45, 59, 9, - 56, 58, 6, 6, 6, 61, 63, 66, 6, 57, - 69, 12, 76, 77, 78, 80, 83, 84, 6, 6, - 6, 6, 75, 85, 12, 12, 12, 12, 12, 12, + 2, 44, 9, 15, 12, 12, 12, 23, 45, 6, + 6, 13, 46, 8, 8, 62, 16, 48, 97, 87, + 52, 43, 54, 92, 92, 69, 61, 61, 104, 69, + 85, 10, 77, 93, 24, 3, 59, 6, 5, 12, + 12, 12, 14, 71, 71, 65, 65, 9, 57, 56, + 88, 88, 18, 6, 6, 6, 22, 42, 61, 54, + 53, 6, 55, 58, 12, 11, 11, 60, 63, 66, + 72, 73, 6, 6, 6, 6, 74, 71, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, - 12, 12, 12, 12, 12, 51, 6, 5, 12, 12, - 49, 89, 12, 87, 91, 60, 11, 11, 11, 11, - 59, 72, 94, 73, 49, 72, 95, 1, 25, 98, - 102, 81, 62, 103, 105, 106, 72, 107, 72, nil, - nil, nil, nil, 10, nil, nil, nil, 9, 49, 57, - 57, 6, 10, 74, 74, nil, 74, 72, nil, 65, - 6, nil, 46, nil, 73, 73, 49, 73, nil, nil, - nil, 2, 47, 64, nil, nil, nil, 48, nil, 24, - 17, 73, nil, nil, nil, 49, 89, nil, 55, nil, - 74, nil, nil, nil, 6, nil, nil, nil, nil, nil, - nil, 2, nil, nil, 2, 12, nil, nil, 17, nil, - 12, 12, 12, 64, 13, nil, 64, 72, 72, 72, - nil, 17, 72, nil, nil, nil, 17, nil, 74, nil, - nil, nil, nil, nil, 9, 8, nil, nil, nil, nil, - nil, nil, nil, nil, nil, nil, 49, 49, nil, 108, - nil, nil, 17, 12, nil, nil, nil, nil, nil, 49, - nil, 47, nil, nil, nil, nil, 48, nil, nil, nil, - nil, nil, nil, nil, 9, nil, 8, 6, nil, 12, - 6, 6, 16, 91, 101, 96, nil, nil, nil, nil, - 13, nil, 2, nil, nil, nil, nil, nil, nil, nil, - 12, 9, nil, 17, nil, nil, 64, 64, nil, 64, - 2, 2, nil, nil, 24, nil, nil, nil, 6, nil, - nil, 6, 13, nil, nil, nil, 6, nil, nil, nil, - 13, nil, nil, nil, 17, nil, nil, 65, nil, 12, - 12, 12, 12, 64, nil, nil, 12, nil, 6, nil, - 51, 8, 24, 17, nil, nil, nil, 13, nil, nil, - nil, 47, nil, 49, nil, nil, 48, 12, nil, 9, - nil, nil, 72, nil, nil, nil, nil, 17, nil, nil, - nil, 64, nil, nil, nil, nil, nil, nil, 12, nil, - nil, 17, nil, 6, nil, 17, 2, nil, nil, 12, - 15, 9, nil, nil, 64, nil, nil, 9, nil, nil, - nil, nil, nil, nil, 12, nil, 6, nil, nil, nil, - nil, 17, nil, 17, nil, nil, nil, nil, nil, nil, - nil, 12, nil, nil, nil, nil, nil, nil, nil, nil, - nil, nil, nil, nil, nil, nil, 12, nil, 6, nil, - nil, nil, 12, nil, 6, nil, nil, nil, 12, nil, - nil, 2, nil, 12, nil, nil, nil, nil, nil, nil, - nil, 17, nil, nil, nil, nil, nil, nil, nil, nil, - nil, nil, nil, nil, nil, 17, 2, nil, nil, nil, - nil, nil, 17, nil, nil, nil, nil, nil, nil, nil, - nil, nil, nil, nil, nil, nil, nil, 2, nil, 2, - 12, 2, nil, nil, nil, nil, 2, nil, nil, 17, - nil, nil, nil, nil, nil, 17 ] + 12, 12, 12, 12, 12, 12, 12, 12, 12, 76, + 6, 46, 12, 12, 48, 87, 12, 56, 57, 69, + 79, 46, 71, 80, 5, 81, 83, 90, 70, 85, + 91, 1, 94, 9, 98, 17, 77, 24, 59, 99, + 46, 101, 10, 102, 103, 54, 54, nil, 6, 10, + nil, 11, 11, 11, 11, 6, 17, nil, 46, 62, + nil, 43, 70, 70, nil, nil, 44, 17, nil, nil, + nil, nil, 17, 45, 70, 23, nil, 46, nil, 52, + 61, 13, nil, nil, nil, nil, 6, nil, nil, nil, + nil, 69, nil, 2, 69, 85, 2, 12, 17, nil, + nil, nil, 12, 12, 12, nil, nil, nil, nil, nil, + nil, nil, nil, nil, 61, 9, nil, 61, nil, nil, + nil, nil, nil, nil, 8, nil, nil, nil, nil, nil, + nil, nil, nil, nil, 46, 46, nil, nil, nil, nil, + nil, 12, nil, nil, nil, 17, 46, 44, nil, nil, + 9, 13, nil, 104, 45, nil, nil, nil, nil, nil, + 8, nil, nil, nil, 6, 97, 12, 6, 6, 16, + 92, nil, 87, nil, nil, 17, nil, 9, nil, 2, + nil, 13, nil, nil, nil, nil, 12, nil, nil, nil, + nil, 17, nil, nil, nil, nil, 2, 2, nil, 23, + 6, nil, nil, 6, 61, 61, nil, nil, 6, nil, + nil, nil, nil, 17, nil, nil, nil, nil, nil, nil, + nil, 12, 12, 12, 12, 62, nil, 17, 12, nil, + 6, 17, 8, nil, 69, nil, 23, 48, 61, 9, + nil, 44, 46, nil, nil, nil, nil, 12, 45, nil, + nil, nil, nil, nil, nil, 17, nil, 17, nil, nil, + nil, nil, nil, nil, nil, nil, nil, 12, nil, nil, + 9, nil, 6, 61, nil, 2, 9, 15, 12, nil, + nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, + 12, nil, 6, nil, nil, 61, nil, nil, nil, nil, + nil, 17, nil, nil, nil, nil, nil, 12, nil, nil, + nil, nil, nil, nil, nil, 17, nil, nil, nil, nil, + nil, 12, nil, 6, nil, nil, nil, 12, nil, 6, + nil, nil, nil, 12, nil, nil, 2, nil, 12, nil, + nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, + nil, nil, 17, nil, nil, nil, nil, nil, nil, 2, + nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, + nil, nil, nil, nil, nil, nil, nil, nil, nil, 2, + 12, 2, nil, 2, nil, nil, 2 ] racc_goto_pointer = [ - nil, 127, 0, 45, nil, 21, -10, nil, -52, -57, - -18, 24, -12, -58, -387, -122, -258, 36, -329, nil, - nil, nil, nil, -59, -112, -330, nil, nil, nil, nil, + nil, 121, 0, 35, nil, 34, -10, nil, -50, -63, + -16, 55, -12, -79, -359, -115, -239, -10, -297, nil, + nil, nil, -53, -103, -296, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - nil, nil, nil, nil, nil, -127, -162, -60, -55, -36, - nil, -40, nil, nil, nil, -135, -234, -133, -409, -348, - -357, -247, -279, -445, -107, -106, -198, nil, -66, -280, - nil, nil, -11, -2, -260, 23, 12, -207, -309, nil, - -245, -290, nil, -246, -322, -223, nil, -192, nil, -35, - nil, -178, -36, nil, -168, -202, -43, -159, -71, nil, - nil, -52, -67, -64, nil, -63, 55, 56, -185 ] + nil, nil, -109, -145, -56, -49, -36, nil, -32, nil, + nil, nil, -126, -211, -125, -373, -326, -329, -225, -252, + -406, -88, -94, -175, nil, -69, -253, nil, nil, -29, + -1, -339, 15, -187, -277, nil, -193, -261, nil, -184, + -255, -168, nil, -166, nil, -18, nil, -164, -13, nil, + -150, -180, -40, -149, -60, nil, nil, -53, -55, -50, + nil, -48, 60, 60, -157 ] racc_goto_default = [ - nil, nil, 480, nil, 4, 5, 6, 7, 143, 142, - nil, 8, 9, nil, nil, nil, nil, nil, 279, 13, - 14, 15, 16, nil, nil, 268, 410, 22, 23, 24, + nil, nil, 445, nil, 4, 5, 6, 7, 134, 133, + nil, 8, 9, nil, nil, nil, nil, nil, 257, 13, + 14, 15, nil, nil, 246, 379, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 50, nil, 52, 53, 159, nil, nil, nil, 163, nil, - nil, nil, nil, nil, 281, nil, nil, 119, nil, 225, - 227, 226, 59, nil, nil, nil, 125, nil, nil, 172, - nil, 173, 174, 178, 299, 300, 301, 302, 303, 306, - 68, nil, nil, 192, 150, 189, 151, 75, 76, 77, - 78, nil, nil, nil, 197, nil, nil, nil, nil ] + 35, 36, 37, 38, 39, 40, 41, 47, nil, 49, + 50, 146, nil, nil, nil, 150, nil, nil, nil, nil, + nil, 259, nil, nil, 113, nil, 207, 209, 208, 120, + nil, nil, 119, nil, nil, 156, nil, 157, 158, 162, + 276, 277, 278, 279, 280, 283, 59, nil, nil, 174, + 139, 171, 140, 66, 67, 68, 71, nil, nil, nil, + 179, nil, nil, nil, nil ] racc_reduce_table = [ 0, 0, :racc_error, - 1, 99, :_reduce_1, - 1, 99, :_reduce_2, - 0, 99, :_reduce_3, - 1, 100, :_reduce_4, - 1, 102, :_reduce_5, - 3, 102, :_reduce_6, - 2, 102, :_reduce_7, - 1, 103, :_reduce_8, - 3, 103, :_reduce_9, - 1, 104, :_reduce_none, - 3, 104, :_reduce_11, - 3, 104, :_reduce_12, - 3, 104, :_reduce_13, - 1, 106, :_reduce_none, - 1, 106, :_reduce_15, - 1, 108, :_reduce_16, - 3, 108, :_reduce_17, + 1, 95, :_reduce_1, + 1, 95, :_reduce_2, + 0, 95, :_reduce_3, + 1, 96, :_reduce_4, + 1, 98, :_reduce_5, + 3, 98, :_reduce_6, + 2, 98, :_reduce_7, + 1, 99, :_reduce_8, + 3, 99, :_reduce_9, + 1, 100, :_reduce_none, + 3, 100, :_reduce_11, + 3, 100, :_reduce_12, + 3, 100, :_reduce_13, + 1, 102, :_reduce_none, + 1, 102, :_reduce_15, + 1, 104, :_reduce_16, + 3, 104, :_reduce_17, + 1, 101, :_reduce_none, + 3, 101, :_reduce_19, + 3, 101, :_reduce_20, + 3, 101, :_reduce_21, + 3, 101, :_reduce_22, 1, 105, :_reduce_none, - 3, 105, :_reduce_19, - 3, 105, :_reduce_20, - 3, 105, :_reduce_21, - 3, 105, :_reduce_22, - 1, 109, :_reduce_none, - 2, 109, :_reduce_24, - 2, 109, :_reduce_25, - 7, 109, :_reduce_26, - 5, 109, :_reduce_27, - 5, 109, :_reduce_28, - 4, 116, :_reduce_29, - 1, 113, :_reduce_30, - 3, 113, :_reduce_31, - 1, 112, :_reduce_32, - 2, 112, :_reduce_33, - 4, 112, :_reduce_34, - 1, 110, :_reduce_none, - 1, 110, :_reduce_none, - 1, 110, :_reduce_none, - 1, 110, :_reduce_none, - 3, 110, :_reduce_39, - 3, 110, :_reduce_40, - 3, 110, :_reduce_41, - 3, 110, :_reduce_42, - 3, 110, :_reduce_43, - 3, 110, :_reduce_44, - 3, 110, :_reduce_45, - 3, 110, :_reduce_46, - 3, 110, :_reduce_47, - 3, 110, :_reduce_48, - 2, 110, :_reduce_49, - 2, 110, :_reduce_50, - 3, 110, :_reduce_51, - 3, 110, :_reduce_52, - 3, 110, :_reduce_53, - 3, 110, :_reduce_54, - 3, 110, :_reduce_55, - 3, 110, :_reduce_56, - 2, 110, :_reduce_57, - 3, 110, :_reduce_58, - 3, 110, :_reduce_59, - 3, 110, :_reduce_60, - 3, 110, :_reduce_61, - 3, 110, :_reduce_62, - 5, 120, :_reduce_63, - 1, 122, :_reduce_64, - 3, 122, :_reduce_65, - 1, 123, :_reduce_none, - 1, 123, :_reduce_67, - 1, 124, :_reduce_68, - 3, 124, :_reduce_69, - 1, 117, :_reduce_none, - 1, 117, :_reduce_none, - 1, 117, :_reduce_none, - 1, 117, :_reduce_none, - 1, 117, :_reduce_none, - 1, 117, :_reduce_none, - 1, 117, :_reduce_none, - 1, 117, :_reduce_none, - 1, 117, :_reduce_none, - 1, 117, :_reduce_none, - 1, 117, :_reduce_none, - 1, 117, :_reduce_none, - 1, 117, :_reduce_none, - 1, 117, :_reduce_none, - 1, 117, :_reduce_none, - 1, 117, :_reduce_none, - 1, 117, :_reduce_none, - 1, 117, :_reduce_none, - 1, 117, :_reduce_none, - 1, 117, :_reduce_none, - 1, 117, :_reduce_none, - 1, 117, :_reduce_none, - 1, 117, :_reduce_none, - 1, 117, :_reduce_93, - 1, 117, :_reduce_94, - 1, 117, :_reduce_95, - 1, 117, :_reduce_96, - 1, 117, :_reduce_97, - 4, 119, :_reduce_98, - 2, 119, :_reduce_99, - 5, 119, :_reduce_100, - 3, 119, :_reduce_101, - 2, 148, :_reduce_102, - 2, 148, :_reduce_103, - 1, 126, :_reduce_104, - 2, 126, :_reduce_105, - 4, 150, :_reduce_106, - 3, 150, :_reduce_107, - 1, 150, :_reduce_108, - 3, 151, :_reduce_109, - 3, 151, :_reduce_110, - 3, 149, :_reduce_111, - 3, 154, :_reduce_112, - 2, 154, :_reduce_113, - 2, 152, :_reduce_114, - 4, 152, :_reduce_115, - 2, 129, :_reduce_116, - 5, 156, :_reduce_117, - 4, 156, :_reduce_118, - 0, 157, :_reduce_none, - 2, 157, :_reduce_120, - 4, 157, :_reduce_121, - 3, 157, :_reduce_122, - 6, 130, :_reduce_123, - 5, 130, :_reduce_124, - 0, 158, :_reduce_none, - 4, 158, :_reduce_126, - 3, 158, :_reduce_127, - 5, 128, :_reduce_128, - 1, 159, :_reduce_129, - 2, 159, :_reduce_130, - 5, 160, :_reduce_131, + 2, 105, :_reduce_24, + 2, 105, :_reduce_25, + 7, 105, :_reduce_26, + 5, 105, :_reduce_27, + 5, 105, :_reduce_28, + 4, 112, :_reduce_29, + 1, 109, :_reduce_30, + 3, 109, :_reduce_31, + 1, 108, :_reduce_32, + 2, 108, :_reduce_33, + 4, 108, :_reduce_34, + 1, 106, :_reduce_none, + 1, 106, :_reduce_none, + 1, 106, :_reduce_none, + 3, 106, :_reduce_38, + 3, 106, :_reduce_39, + 3, 106, :_reduce_40, + 3, 106, :_reduce_41, + 3, 106, :_reduce_42, + 3, 106, :_reduce_43, + 3, 106, :_reduce_44, + 3, 106, :_reduce_45, + 3, 106, :_reduce_46, + 3, 106, :_reduce_47, + 2, 106, :_reduce_48, + 2, 106, :_reduce_49, + 3, 106, :_reduce_50, + 3, 106, :_reduce_51, + 3, 106, :_reduce_52, + 3, 106, :_reduce_53, + 3, 106, :_reduce_54, + 3, 106, :_reduce_55, + 2, 106, :_reduce_56, + 3, 106, :_reduce_57, + 3, 106, :_reduce_58, + 3, 106, :_reduce_59, + 3, 106, :_reduce_60, + 3, 106, :_reduce_61, + 5, 115, :_reduce_62, + 1, 117, :_reduce_63, + 3, 117, :_reduce_64, + 1, 118, :_reduce_none, + 1, 118, :_reduce_66, + 1, 119, :_reduce_67, + 3, 119, :_reduce_68, + 1, 113, :_reduce_none, + 1, 113, :_reduce_none, + 1, 113, :_reduce_none, + 1, 113, :_reduce_none, + 1, 113, :_reduce_none, + 1, 113, :_reduce_none, + 1, 113, :_reduce_none, + 1, 113, :_reduce_none, + 1, 113, :_reduce_none, + 1, 113, :_reduce_none, + 1, 113, :_reduce_none, + 1, 113, :_reduce_none, + 1, 113, :_reduce_none, + 1, 113, :_reduce_none, + 1, 113, :_reduce_none, + 1, 113, :_reduce_none, + 1, 113, :_reduce_none, + 1, 113, :_reduce_none, + 1, 113, :_reduce_none, + 1, 113, :_reduce_none, + 1, 113, :_reduce_none, + 1, 113, :_reduce_90, + 1, 113, :_reduce_91, + 1, 113, :_reduce_92, + 1, 113, :_reduce_93, + 1, 113, :_reduce_94, + 4, 114, :_reduce_95, + 2, 114, :_reduce_96, + 5, 114, :_reduce_97, + 3, 114, :_reduce_98, + 2, 141, :_reduce_99, + 2, 141, :_reduce_100, + 1, 121, :_reduce_101, + 2, 121, :_reduce_102, + 4, 143, :_reduce_103, + 3, 143, :_reduce_104, + 1, 143, :_reduce_105, + 3, 144, :_reduce_106, + 3, 144, :_reduce_107, + 3, 142, :_reduce_108, + 3, 147, :_reduce_109, + 2, 147, :_reduce_110, + 2, 145, :_reduce_111, + 4, 145, :_reduce_112, + 2, 124, :_reduce_113, + 5, 149, :_reduce_114, + 4, 149, :_reduce_115, + 0, 150, :_reduce_none, + 2, 150, :_reduce_117, + 4, 150, :_reduce_118, + 3, 150, :_reduce_119, + 6, 125, :_reduce_120, + 5, 125, :_reduce_121, + 0, 151, :_reduce_none, + 4, 151, :_reduce_123, + 3, 151, :_reduce_124, + 5, 123, :_reduce_125, + 1, 152, :_reduce_126, + 2, 152, :_reduce_127, + 5, 153, :_reduce_128, + 1, 154, :_reduce_none, + 1, 154, :_reduce_none, + 1, 116, :_reduce_none, + 4, 116, :_reduce_132, + 1, 157, :_reduce_133, + 3, 157, :_reduce_134, + 3, 156, :_reduce_135, + 6, 122, :_reduce_136, + 2, 122, :_reduce_137, + 3, 158, :_reduce_138, + 3, 158, :_reduce_139, + 1, 159, :_reduce_none, + 1, 159, :_reduce_none, + 0, 107, :_reduce_142, + 1, 107, :_reduce_143, + 3, 107, :_reduce_144, 1, 161, :_reduce_none, 1, 161, :_reduce_none, - 1, 121, :_reduce_none, - 4, 121, :_reduce_135, - 1, 164, :_reduce_136, - 3, 164, :_reduce_137, - 3, 163, :_reduce_138, - 6, 127, :_reduce_139, - 2, 127, :_reduce_140, - 3, 165, :_reduce_141, - 3, 165, :_reduce_142, - 1, 166, :_reduce_none, - 1, 166, :_reduce_none, - 0, 111, :_reduce_145, - 1, 111, :_reduce_146, - 3, 111, :_reduce_147, + 3, 160, :_reduce_147, + 3, 160, :_reduce_148, + 3, 160, :_reduce_149, + 6, 126, :_reduce_150, + 6, 128, :_reduce_151, + 8, 129, :_reduce_152, + 7, 129, :_reduce_153, + 7, 127, :_reduce_154, + 1, 166, :_reduce_155, + 1, 165, :_reduce_none, + 1, 165, :_reduce_none, + 1, 167, :_reduce_none, + 2, 167, :_reduce_159, 1, 168, :_reduce_none, 1, 168, :_reduce_none, - 3, 167, :_reduce_150, - 3, 167, :_reduce_151, - 3, 167, :_reduce_152, - 6, 131, :_reduce_153, - 6, 132, :_reduce_154, - 7, 118, :_reduce_155, - 7, 118, :_reduce_156, + 7, 130, :_reduce_162, + 6, 130, :_reduce_163, + 1, 169, :_reduce_164, + 3, 169, :_reduce_165, + 1, 171, :_reduce_none, + 1, 171, :_reduce_none, + 1, 171, :_reduce_168, + 1, 171, :_reduce_none, + 1, 172, :_reduce_170, + 3, 172, :_reduce_171, 1, 173, :_reduce_none, 1, 173, :_reduce_none, - 6, 134, :_reduce_159, - 8, 135, :_reduce_160, - 7, 135, :_reduce_161, - 7, 133, :_reduce_162, - 1, 174, :_reduce_163, - 1, 172, :_reduce_none, - 1, 172, :_reduce_none, - 1, 175, :_reduce_none, - 2, 175, :_reduce_167, - 1, 176, :_reduce_none, - 1, 176, :_reduce_none, - 4, 137, :_reduce_170, - 3, 137, :_reduce_171, - 7, 136, :_reduce_172, - 6, 136, :_reduce_173, - 1, 177, :_reduce_174, - 3, 177, :_reduce_175, - 1, 179, :_reduce_none, - 1, 179, :_reduce_none, - 1, 179, :_reduce_178, - 1, 179, :_reduce_none, - 1, 180, :_reduce_180, - 3, 180, :_reduce_181, - 1, 181, :_reduce_none, - 1, 181, :_reduce_none, - 1, 178, :_reduce_none, - 2, 178, :_reduce_185, - 7, 139, :_reduce_186, - 2, 153, :_reduce_187, - 5, 153, :_reduce_188, - 1, 153, :_reduce_none, - 1, 170, :_reduce_none, 1, 170, :_reduce_none, - 1, 170, :_reduce_none, - 1, 170, :_reduce_193, - 1, 170, :_reduce_194, - 1, 171, :_reduce_195, - 2, 171, :_reduce_196, - 2, 171, :_reduce_197, - 4, 171, :_reduce_198, - 4, 171, :_reduce_199, - 1, 155, :_reduce_200, - 3, 155, :_reduce_201, - 1, 182, :_reduce_none, - 1, 182, :_reduce_none, - 1, 183, :_reduce_none, - 1, 183, :_reduce_none, - 3, 185, :_reduce_206, - 1, 185, :_reduce_207, - 2, 186, :_reduce_208, - 2, 184, :_reduce_209, - 1, 187, :_reduce_210, - 4, 187, :_reduce_211, - 4, 140, :_reduce_212, - 7, 140, :_reduce_213, - 3, 140, :_reduce_214, - 3, 140, :_reduce_215, - 3, 140, :_reduce_216, - 2, 188, :_reduce_217, - 5, 141, :_reduce_218, - 7, 141, :_reduce_219, - 1, 125, :_reduce_220, - 1, 142, :_reduce_221, - 1, 142, :_reduce_222, - 4, 143, :_reduce_223, - 2, 143, :_reduce_224, - 4, 143, :_reduce_225, - 2, 143, :_reduce_226, - 3, 144, :_reduce_227, - 4, 144, :_reduce_228, - 2, 144, :_reduce_229, - 1, 191, :_reduce_230, - 3, 191, :_reduce_231, - 3, 107, :_reduce_232, - 1, 193, :_reduce_none, - 1, 193, :_reduce_234, - 1, 192, :_reduce_none, - 1, 192, :_reduce_236, - 1, 190, :_reduce_237, - 3, 190, :_reduce_238, - 1, 194, :_reduce_none, - 1, 194, :_reduce_none, - 1, 194, :_reduce_none, - 1, 194, :_reduce_none, - 1, 194, :_reduce_none, - 1, 194, :_reduce_none, + 2, 170, :_reduce_175, + 7, 132, :_reduce_176, + 2, 146, :_reduce_177, + 5, 146, :_reduce_178, 1, 146, :_reduce_none, - 1, 146, :_reduce_none, - 1, 146, :_reduce_none, - 1, 195, :_reduce_248, - 1, 195, :_reduce_249, - 2, 196, :_reduce_250, - 1, 198, :_reduce_251, - 1, 200, :_reduce_252, - 1, 201, :_reduce_253, - 2, 199, :_reduce_254, - 1, 202, :_reduce_255, - 1, 203, :_reduce_256, - 2, 203, :_reduce_257, - 2, 197, :_reduce_258, - 2, 204, :_reduce_259, - 2, 204, :_reduce_260, - 3, 101, :_reduce_261, - 0, 189, :_reduce_none, - 1, 189, :_reduce_none, - 0, 205, :_reduce_264, - 2, 205, :_reduce_265, - 4, 205, :_reduce_266, - 1, 138, :_reduce_267, - 3, 138, :_reduce_268, - 5, 138, :_reduce_269, - 1, 206, :_reduce_none, - 1, 206, :_reduce_none, - 1, 147, :_reduce_272, - 1, 145, :_reduce_273, - 0, 115, :_reduce_none, - 1, 115, :_reduce_275, - 0, 114, :_reduce_none, - 1, 114, :_reduce_none, - 1, 169, :_reduce_none, - 1, 169, :_reduce_none, - 1, 169, :_reduce_none, - 1, 169, :_reduce_none, - 1, 169, :_reduce_none, - 1, 169, :_reduce_none, - 1, 169, :_reduce_none, - 1, 169, :_reduce_none, - 1, 169, :_reduce_none, - 1, 169, :_reduce_none, - 1, 169, :_reduce_none, - 1, 169, :_reduce_none, - 1, 169, :_reduce_none, - 1, 169, :_reduce_none, - 1, 169, :_reduce_none, - 1, 169, :_reduce_none, - 1, 169, :_reduce_none, - 1, 169, :_reduce_none, - 1, 169, :_reduce_none, - 1, 169, :_reduce_none, - 1, 169, :_reduce_none, - 1, 169, :_reduce_none, - 0, 162, :_reduce_300 ] - -racc_reduce_n = 301 - -racc_shift_n = 546 + 1, 163, :_reduce_none, + 1, 163, :_reduce_none, + 1, 163, :_reduce_none, + 1, 163, :_reduce_183, + 1, 163, :_reduce_184, + 1, 164, :_reduce_185, + 2, 164, :_reduce_186, + 2, 164, :_reduce_187, + 4, 164, :_reduce_188, + 4, 164, :_reduce_189, + 1, 148, :_reduce_190, + 3, 148, :_reduce_191, + 1, 174, :_reduce_none, + 1, 174, :_reduce_none, + 1, 175, :_reduce_none, + 1, 175, :_reduce_none, + 3, 177, :_reduce_196, + 1, 177, :_reduce_197, + 2, 178, :_reduce_198, + 2, 176, :_reduce_199, + 1, 179, :_reduce_200, + 4, 179, :_reduce_201, + 4, 133, :_reduce_202, + 7, 133, :_reduce_203, + 3, 133, :_reduce_204, + 3, 133, :_reduce_205, + 3, 133, :_reduce_206, + 2, 180, :_reduce_207, + 5, 134, :_reduce_208, + 7, 134, :_reduce_209, + 1, 120, :_reduce_210, + 1, 135, :_reduce_211, + 1, 135, :_reduce_212, + 4, 136, :_reduce_213, + 2, 136, :_reduce_214, + 4, 136, :_reduce_215, + 2, 136, :_reduce_216, + 3, 137, :_reduce_217, + 4, 137, :_reduce_218, + 2, 137, :_reduce_219, + 1, 183, :_reduce_220, + 3, 183, :_reduce_221, + 3, 103, :_reduce_222, + 1, 185, :_reduce_none, + 1, 185, :_reduce_224, + 1, 184, :_reduce_none, + 1, 184, :_reduce_226, + 1, 182, :_reduce_227, + 3, 182, :_reduce_228, + 1, 186, :_reduce_none, + 1, 186, :_reduce_none, + 1, 139, :_reduce_none, + 1, 139, :_reduce_none, + 1, 139, :_reduce_none, + 1, 187, :_reduce_234, + 1, 187, :_reduce_235, + 2, 188, :_reduce_236, + 1, 190, :_reduce_237, + 1, 192, :_reduce_238, + 1, 193, :_reduce_239, + 2, 191, :_reduce_240, + 1, 194, :_reduce_241, + 1, 195, :_reduce_242, + 2, 195, :_reduce_243, + 2, 189, :_reduce_244, + 2, 196, :_reduce_245, + 2, 196, :_reduce_246, + 3, 97, :_reduce_247, + 0, 181, :_reduce_none, + 1, 181, :_reduce_none, + 0, 197, :_reduce_250, + 2, 197, :_reduce_251, + 4, 197, :_reduce_252, + 1, 131, :_reduce_253, + 3, 131, :_reduce_254, + 5, 131, :_reduce_255, + 1, 198, :_reduce_none, + 1, 198, :_reduce_none, + 1, 140, :_reduce_258, + 1, 138, :_reduce_259, + 0, 111, :_reduce_none, + 1, 111, :_reduce_261, + 0, 110, :_reduce_none, + 1, 110, :_reduce_none, + 1, 162, :_reduce_none, + 1, 162, :_reduce_none, + 1, 162, :_reduce_none, + 1, 162, :_reduce_none, + 1, 162, :_reduce_none, + 1, 162, :_reduce_none, + 1, 162, :_reduce_none, + 1, 162, :_reduce_none, + 1, 162, :_reduce_none, + 1, 162, :_reduce_none, + 1, 162, :_reduce_none, + 1, 162, :_reduce_none, + 1, 162, :_reduce_none, + 1, 162, :_reduce_none, + 1, 162, :_reduce_none, + 1, 162, :_reduce_none, + 1, 162, :_reduce_none, + 1, 162, :_reduce_none, + 0, 155, :_reduce_282 ] + +racc_reduce_n = 283 + +racc_shift_n = 504 racc_token_table = { false => 0, @@ -1355,19 +1255,15 @@ class Parser < Racc::Parser :TYPE => 84, :PRIVATE => 85, :ATTR => 86, - :APPLICATION => 87, - :PRODUCES => 88, - :CONSUMES => 89, - :SITE => 90, - :PLAN => 91, - :APPLY => 92, - :LOW => 93, - :HIGH => 94, - :LISTSTART => 95, - :SPLAT => 96, - :MODULO => 97 } - -racc_nt_base = 98 + :PLAN => 87, + :APPLY => 88, + :LOW => 89, + :HIGH => 90, + :LISTSTART => 91, + :SPLAT => 92, + :MODULO => 93 } + +racc_nt_base = 94 racc_use_result_var = true @@ -1475,10 +1371,6 @@ class Parser < Racc::Parser "TYPE", "PRIVATE", "ATTR", - "APPLICATION", - "PRODUCES", - "CONSUMES", - "SITE", "PLAN", "APPLY", "LOW", @@ -1506,7 +1398,6 @@ class Parser < Racc::Parser "endcomma", "resource_body", "primary_expression", - "capability_mapping", "call_function_expression", "bracketed_expression", "selector_entries", @@ -1520,12 +1411,10 @@ class Parser < Racc::Parser "if_expression", "unless_expression", "definition_expression", - "application_expression", "hostclass_expression", "plan_expression", "apply_expression", "node_definition_expression", - "site_definition_expression", "epp_render_expression", "function_definition", "type_alias", @@ -1561,7 +1450,6 @@ class Parser < Racc::Parser "classname", "parameter_list", "opt_statements", - "capability_kw", "stacked_classname", "classparent", "classnameordefault", @@ -1602,63 +1490,63 @@ class Parser < Racc::Parser # reduce 0 omitted -module_eval(<<'.,.,', 'egrammar.ra', 68) +module_eval(<<'.,.,', 'egrammar.ra', 67) def _reduce_1(val, _values, result) result = create_program(Factory.block_or_expression(val[0])) result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 69) +module_eval(<<'.,.,', 'egrammar.ra', 68) def _reduce_2(val, _values, result) result = create_program(val[0]) result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 70) +module_eval(<<'.,.,', 'egrammar.ra', 69) def _reduce_3(val, _values, result) result = create_empty_program result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 74) +module_eval(<<'.,.,', 'egrammar.ra', 73) def _reduce_4(val, _values, result) result = transform_calls(val[0]) result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 81) +module_eval(<<'.,.,', 'egrammar.ra', 80) def _reduce_5(val, _values, result) result = [val[0]] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 82) +module_eval(<<'.,.,', 'egrammar.ra', 81) def _reduce_6(val, _values, result) result = val[0].push val[2] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 83) +module_eval(<<'.,.,', 'egrammar.ra', 82) def _reduce_7(val, _values, result) result = val[0].push val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 90) +module_eval(<<'.,.,', 'egrammar.ra', 89) def _reduce_8(val, _values, result) result = val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 91) +module_eval(<<'.,.,', 'egrammar.ra', 90) def _reduce_9(val, _values, result) result = aryfy(val[0]).push(val[1]).push(val[2]) result @@ -1667,21 +1555,21 @@ def _reduce_9(val, _values, result) # reduce 10 omitted -module_eval(<<'.,.,', 'egrammar.ra', 96) +module_eval(<<'.,.,', 'egrammar.ra', 95) def _reduce_11(val, _values, result) result = val[0].set(val[2]) ; loc result, val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 97) +module_eval(<<'.,.,', 'egrammar.ra', 96) def _reduce_12(val, _values, result) result = val[0].plus_set(val[2]) ; loc result, val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 98) +module_eval(<<'.,.,', 'egrammar.ra', 97) def _reduce_13(val, _values, result) result = val[0].minus_set(val[2]); loc result, val[1] result @@ -1690,21 +1578,21 @@ def _reduce_13(val, _values, result) # reduce 14 omitted -module_eval(<<'.,.,', 'egrammar.ra', 103) +module_eval(<<'.,.,', 'egrammar.ra', 102) def _reduce_15(val, _values, result) result = Factory.HASH_UNFOLDED([val[0]]); loc result, val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 107) +module_eval(<<'.,.,', 'egrammar.ra', 106) def _reduce_16(val, _values, result) result = [val[0]] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 108) +module_eval(<<'.,.,', 'egrammar.ra', 107) def _reduce_17(val, _values, result) result = Factory.ARGUMENTS(val[0], val[2]) result @@ -1713,28 +1601,28 @@ def _reduce_17(val, _values, result) # reduce 18 omitted -module_eval(<<'.,.,', 'egrammar.ra', 112) +module_eval(<<'.,.,', 'egrammar.ra', 111) def _reduce_19(val, _values, result) result = val[0].relop(val[1][:value], val[2]); loc result, val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 113) +module_eval(<<'.,.,', 'egrammar.ra', 112) def _reduce_20(val, _values, result) result = val[0].relop(val[1][:value], val[2]); loc result, val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 114) +module_eval(<<'.,.,', 'egrammar.ra', 113) def _reduce_21(val, _values, result) result = val[0].relop(val[1][:value], val[2]); loc result, val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 115) +module_eval(<<'.,.,', 'egrammar.ra', 114) def _reduce_22(val, _values, result) result = val[0].relop(val[1][:value], val[2]); loc result, val[1] result @@ -1743,7 +1631,7 @@ def _reduce_22(val, _values, result) # reduce 23 omitted -module_eval(<<'.,.,', 'egrammar.ra', 124) +module_eval(<<'.,.,', 'egrammar.ra', 123) def _reduce_24(val, _values, result) result = val[1] unless Factory.set_resource_form(result, 'virtual') @@ -1757,7 +1645,7 @@ def _reduce_24(val, _values, result) end .,., -module_eval(<<'.,.,', 'egrammar.ra', 135) +module_eval(<<'.,.,', 'egrammar.ra', 134) def _reduce_25(val, _values, result) result = val[1] unless Factory.set_resource_form(result, 'exported') @@ -1771,7 +1659,7 @@ def _reduce_25(val, _values, result) end .,., -module_eval(<<'.,.,', 'egrammar.ra', 146) +module_eval(<<'.,.,', 'egrammar.ra', 145) def _reduce_26(val, _values, result) bodies = [Factory.RESOURCE_BODY(val[2], val[4])] + val[5] result = Factory.RESOURCE(val[0], bodies) @@ -1781,7 +1669,7 @@ def _reduce_26(val, _values, result) end .,., -module_eval(<<'.,.,', 'egrammar.ra', 153) +module_eval(<<'.,.,', 'egrammar.ra', 152) def _reduce_27(val, _values, result) result = Factory.RESOURCE(Factory.fqn(token_text(val[0])), val[2]) loc result, val[0], val[4] @@ -1790,7 +1678,7 @@ def _reduce_27(val, _values, result) end .,., -module_eval(<<'.,.,', 'egrammar.ra', 162) +module_eval(<<'.,.,', 'egrammar.ra', 161) def _reduce_28(val, _values, result) result = case Factory.resource_shape(val[0]) when :resource, :class @@ -1816,42 +1704,42 @@ def _reduce_28(val, _values, result) end .,., -module_eval(<<'.,.,', 'egrammar.ra', 184) +module_eval(<<'.,.,', 'egrammar.ra', 183) def _reduce_29(val, _values, result) result = Factory.RESOURCE_BODY(val[0], val[2]) result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 187) +module_eval(<<'.,.,', 'egrammar.ra', 186) def _reduce_30(val, _values, result) result = [val[0]] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 188) +module_eval(<<'.,.,', 'egrammar.ra', 187) def _reduce_31(val, _values, result) result = val[0].push val[2] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 194) +module_eval(<<'.,.,', 'egrammar.ra', 193) def _reduce_32(val, _values, result) result = [] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 195) +module_eval(<<'.,.,', 'egrammar.ra', 194) def _reduce_33(val, _values, result) result = [] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 196) +module_eval(<<'.,.,', 'egrammar.ra', 195) def _reduce_34(val, _values, result) result = val[2] result @@ -1864,220 +1752,220 @@ def _reduce_34(val, _values, result) # reduce 37 omitted -# reduce 38 omitted - -module_eval(<<'.,.,', 'egrammar.ra', 205) - def _reduce_39(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 203) + def _reduce_38(val, _values, result) result = val[0].in val[2] ; loc result, val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 206) - def _reduce_40(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 204) + def _reduce_39(val, _values, result) result = val[0] =~ val[2] ; loc result, val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 207) - def _reduce_41(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 205) + def _reduce_40(val, _values, result) result = val[0].mne val[2] ; loc result, val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 208) - def _reduce_42(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 206) + def _reduce_41(val, _values, result) result = val[0] + val[2] ; loc result, val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 209) - def _reduce_43(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 207) + def _reduce_42(val, _values, result) result = val[0] - val[2] ; loc result, val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 210) - def _reduce_44(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 208) + def _reduce_43(val, _values, result) result = val[0] / val[2] ; loc result, val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 211) - def _reduce_45(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 209) + def _reduce_44(val, _values, result) result = val[0] * val[2] ; loc result, val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 212) - def _reduce_46(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 210) + def _reduce_45(val, _values, result) result = val[0] % val[2] ; loc result, val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 213) - def _reduce_47(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 211) + def _reduce_46(val, _values, result) result = val[0] << val[2] ; loc result, val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 214) - def _reduce_48(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 212) + def _reduce_47(val, _values, result) result = val[0] >> val[2] ; loc result, val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 215) - def _reduce_49(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 213) + def _reduce_48(val, _values, result) result = val[1].minus ; loc result, val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 216) - def _reduce_50(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 214) + def _reduce_49(val, _values, result) result = val[1].unfold ; loc result, val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 217) - def _reduce_51(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 215) + def _reduce_50(val, _values, result) result = val[0].ne val[2] ; loc result, val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 218) - def _reduce_52(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 216) + def _reduce_51(val, _values, result) result = val[0].eq val[2] ; loc result, val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 219) - def _reduce_53(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 217) + def _reduce_52(val, _values, result) result = val[0] > val[2] ; loc result, val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 220) - def _reduce_54(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 218) + def _reduce_53(val, _values, result) result = val[0] >= val[2] ; loc result, val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 221) - def _reduce_55(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 219) + def _reduce_54(val, _values, result) result = val[0] < val[2] ; loc result, val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 222) - def _reduce_56(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 220) + def _reduce_55(val, _values, result) result = val[0] <= val[2] ; loc result, val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 223) - def _reduce_57(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 221) + def _reduce_56(val, _values, result) result = val[1].not ; loc result, val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 224) - def _reduce_58(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 222) + def _reduce_57(val, _values, result) result = val[0].and val[2] ; loc result, val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 225) - def _reduce_59(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 223) + def _reduce_58(val, _values, result) result = val[0].or val[2] ; loc result, val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 226) - def _reduce_60(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 224) + def _reduce_59(val, _values, result) result = val[0].select(*val[2]) ; loc result, val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 227) - def _reduce_61(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 225) + def _reduce_60(val, _values, result) result = val[1].paren ; loc result, val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 228) - def _reduce_62(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 226) + def _reduce_61(val, _values, result) result = val[1].paren ; loc result, val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 231) - def _reduce_63(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 229) + def _reduce_62(val, _values, result) result = val[0].access(val[2]); loc result, val[0], val[4] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 234) - def _reduce_64(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 232) + def _reduce_63(val, _values, result) result = [val[0]] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 235) - def _reduce_65(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 233) + def _reduce_64(val, _values, result) result = Factory.ARGUMENTS(val[0], val[2]) result end .,., -# reduce 66 omitted +# reduce 65 omitted -module_eval(<<'.,.,', 'egrammar.ra', 239) - def _reduce_67(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 237) + def _reduce_66(val, _values, result) result = Factory.HASH_UNFOLDED([val[0]]); loc result, val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 248) - def _reduce_68(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 246) + def _reduce_67(val, _values, result) result = [val[0]] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 249) - def _reduce_69(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 247) + def _reduce_68(val, _values, result) result = val[0].push(val[2]) result end .,., +# reduce 69 omitted + # reduce 70 omitted # reduce 71 omitted @@ -2118,49 +2006,43 @@ def _reduce_69(val, _values, result) # reduce 89 omitted -# reduce 90 omitted - -# reduce 91 omitted - -# reduce 92 omitted - -module_eval(<<'.,.,', 'egrammar.ra', 275) - def _reduce_93(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 271) + def _reduce_90(val, _values, result) result = Factory.NUMBER(val[0][:value]) ; loc result, val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 276) - def _reduce_94(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 272) + def _reduce_91(val, _values, result) result = Factory.literal(val[0][:value]) ; loc result, val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 277) - def _reduce_95(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 273) + def _reduce_92(val, _values, result) result = Factory.literal(:default) ; loc result, val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 278) - def _reduce_96(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 274) + def _reduce_93(val, _values, result) result = Factory.literal(:undef) ; loc result, val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 279) - def _reduce_97(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 275) + def _reduce_94(val, _values, result) result = Factory.QNAME_OR_NUMBER(val[0][:value]) ; loc result, val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 288) - def _reduce_98(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 284) + def _reduce_95(val, _values, result) result = Factory.CALL_NAMED(val[0], true, val[1]) loc result, val[0], val[3] @@ -2168,8 +2050,8 @@ def _reduce_98(val, _values, result) end .,., -module_eval(<<'.,.,', 'egrammar.ra', 292) - def _reduce_99(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 288) + def _reduce_96(val, _values, result) result = Factory.CALL_NAMED(val[0], true, []) loc result, val[0], val[1] @@ -2177,8 +2059,8 @@ def _reduce_99(val, _values, result) end .,., -module_eval(<<'.,.,', 'egrammar.ra', 296) - def _reduce_100(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 292) + def _reduce_97(val, _values, result) result = Factory.CALL_NAMED(val[0], true, val[1]) loc result, val[0], val[4] result.lambda = val[4] @@ -2187,8 +2069,8 @@ def _reduce_100(val, _values, result) end .,., -module_eval(<<'.,.,', 'egrammar.ra', 301) - def _reduce_101(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 297) + def _reduce_98(val, _values, result) result = Factory.CALL_NAMED(val[0], true, []) loc result, val[0], val[2] result.lambda = val[2] @@ -2197,57 +2079,57 @@ def _reduce_101(val, _values, result) end .,., -module_eval(<<'.,.,', 'egrammar.ra', 307) - def _reduce_102(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 303) + def _reduce_99(val, _values, result) result = val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 308) - def _reduce_103(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 304) + def _reduce_100(val, _values, result) result = Factory.QNAME(val[0][:value]); loc result, val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 313) - def _reduce_104(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 309) + def _reduce_101(val, _values, result) result = val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 314) - def _reduce_105(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 310) + def _reduce_102(val, _values, result) result = val[0]; val[0].lambda = val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 317) - def _reduce_106(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 313) + def _reduce_103(val, _values, result) result = Factory.CALL_METHOD(val[0], val[2]); loc result, val[1], val[3] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 318) - def _reduce_107(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 314) + def _reduce_104(val, _values, result) result = Factory.CALL_METHOD(val[0], []); loc result, val[1], val[3] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 319) - def _reduce_108(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 315) + def _reduce_105(val, _values, result) result = Factory.CALL_METHOD(val[0], []); loc result, val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 323) - def _reduce_109(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 319) + def _reduce_106(val, _values, result) result = val[0].dot(Factory.fqn(val[2][:value])) loc result, val[1], val[2] @@ -2255,8 +2137,8 @@ def _reduce_109(val, _values, result) end .,., -module_eval(<<'.,.,', 'egrammar.ra', 327) - def _reduce_110(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 323) + def _reduce_107(val, _values, result) result = val[0].dot(Factory.fqn(val[2][:value])) loc result, val[1], val[2] @@ -2264,8 +2146,8 @@ def _reduce_110(val, _values, result) end .,., -module_eval(<<'.,.,', 'egrammar.ra', 335) - def _reduce_111(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 331) + def _reduce_108(val, _values, result) result = Factory.LAMBDA(val[0][:value], val[2][:value], val[1]) loc result, val[0][:start], val[2][:end] @@ -2273,36 +2155,36 @@ def _reduce_111(val, _values, result) end .,., -module_eval(<<'.,.,', 'egrammar.ra', 340) - def _reduce_112(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 336) + def _reduce_109(val, _values, result) result = {:end => val[2], :value =>val[1] } result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 341) - def _reduce_113(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 337) + def _reduce_110(val, _values, result) result = {:end => val[1], :value => nil } result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 345) - def _reduce_114(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 341) + def _reduce_111(val, _values, result) result = {:start => val[0], :value => [] } result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 346) - def _reduce_115(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 342) + def _reduce_112(val, _values, result) result = {:start => val[0], :value => val[1] } result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 354) - def _reduce_116(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 350) + def _reduce_113(val, _values, result) result = val[1] loc(result, val[0], val[1]) @@ -2310,8 +2192,8 @@ def _reduce_116(val, _values, result) end .,., -module_eval(<<'.,.,', 'egrammar.ra', 361) - def _reduce_117(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 357) + def _reduce_114(val, _values, result) result = Factory.IF(val[0], Factory.block_or_expression(val[2], val[1], val[3]), val[4]) loc(result, val[0], (val[4] ? val[4] : val[3])) @@ -2319,8 +2201,8 @@ def _reduce_117(val, _values, result) end .,., -module_eval(<<'.,.,', 'egrammar.ra', 365) - def _reduce_118(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 361) + def _reduce_115(val, _values, result) result = Factory.IF(val[0], nil, val[3]) loc(result, val[0], (val[3] ? val[3] : val[2])) @@ -2328,10 +2210,10 @@ def _reduce_118(val, _values, result) end .,., -# reduce 119 omitted +# reduce 116 omitted -module_eval(<<'.,.,', 'egrammar.ra', 373) - def _reduce_120(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 369) + def _reduce_117(val, _values, result) result = val[1] loc(result, val[0], val[1]) @@ -2339,24 +2221,24 @@ def _reduce_120(val, _values, result) end .,., -module_eval(<<'.,.,', 'egrammar.ra', 377) - def _reduce_121(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 373) + def _reduce_118(val, _values, result) result = Factory.block_or_expression(val[2], val[1], val[3]) result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 380) - def _reduce_122(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 376) + def _reduce_119(val, _values, result) result = nil # don't think a nop is needed here either result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 387) - def _reduce_123(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 383) + def _reduce_120(val, _values, result) result = Factory.UNLESS(val[1], Factory.block_or_expression(val[3], val[2], val[4]), val[5]) loc result, val[0], val[4] @@ -2364,8 +2246,8 @@ def _reduce_123(val, _values, result) end .,., -module_eval(<<'.,.,', 'egrammar.ra', 391) - def _reduce_124(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 387) + def _reduce_121(val, _values, result) result = Factory.UNLESS(val[1], nil, val[4]) loc result, val[0], val[4] @@ -2373,26 +2255,26 @@ def _reduce_124(val, _values, result) end .,., -# reduce 125 omitted +# reduce 122 omitted -module_eval(<<'.,.,', 'egrammar.ra', 401) - def _reduce_126(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 397) + def _reduce_123(val, _values, result) result = Factory.block_or_expression(val[2], val[1], val[3]) result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 404) - def _reduce_127(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 400) + def _reduce_124(val, _values, result) result = nil # don't think a nop is needed here either result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 411) - def _reduce_128(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 407) + def _reduce_125(val, _values, result) result = Factory.CASE(val[1], *val[3]) loc result, val[0], val[4] @@ -2400,65 +2282,65 @@ def _reduce_128(val, _values, result) end .,., -module_eval(<<'.,.,', 'egrammar.ra', 417) - def _reduce_129(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 413) + def _reduce_126(val, _values, result) result = [val[0]] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 418) - def _reduce_130(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 414) + def _reduce_127(val, _values, result) result = val[0].push val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 423) - def _reduce_131(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 419) + def _reduce_128(val, _values, result) result = Factory.WHEN(val[0], val[3]); loc result, val[1], val[4] result end .,., -# reduce 132 omitted +# reduce 129 omitted -# reduce 133 omitted +# reduce 130 omitted -# reduce 134 omitted +# reduce 131 omitted -module_eval(<<'.,.,', 'egrammar.ra', 439) - def _reduce_135(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 435) + def _reduce_132(val, _values, result) result = val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 444) - def _reduce_136(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 440) + def _reduce_133(val, _values, result) result = [val[0]] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 445) - def _reduce_137(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 441) + def _reduce_134(val, _values, result) result = val[0].push val[2] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 450) - def _reduce_138(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 446) + def _reduce_135(val, _values, result) result = Factory.MAP(val[0], val[2]) ; loc result, val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 460) - def _reduce_139(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 456) + def _reduce_136(val, _values, result) result = Factory.COLLECT(val[0], val[1], val[3]) loc result, val[0], val[5] @@ -2466,8 +2348,8 @@ def _reduce_139(val, _values, result) end .,., -module_eval(<<'.,.,', 'egrammar.ra', 464) - def _reduce_140(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 460) + def _reduce_137(val, _values, result) result = Factory.COLLECT(val[0], val[1], []) loc result, val[0], val[1] @@ -2475,51 +2357,51 @@ def _reduce_140(val, _values, result) end .,., -module_eval(<<'.,.,', 'egrammar.ra', 469) - def _reduce_141(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 465) + def _reduce_138(val, _values, result) result = Factory.VIRTUAL_QUERY(val[1]) ; loc result, val[0], val[2] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 470) - def _reduce_142(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 466) + def _reduce_139(val, _values, result) result = Factory.EXPORTED_QUERY(val[1]) ; loc result, val[0], val[2] result end .,., -# reduce 143 omitted +# reduce 140 omitted -# reduce 144 omitted +# reduce 141 omitted -module_eval(<<'.,.,', 'egrammar.ra', 479) - def _reduce_145(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 475) + def _reduce_142(val, _values, result) result = [] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 480) - def _reduce_146(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 476) + def _reduce_143(val, _values, result) result = [val[0]] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 481) - def _reduce_147(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 477) + def _reduce_144(val, _values, result) result = val[0].push(val[2]) result end .,., -# reduce 148 omitted +# reduce 145 omitted -# reduce 149 omitted +# reduce 146 omitted -module_eval(<<'.,.,', 'egrammar.ra', 496) - def _reduce_150(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 492) + def _reduce_147(val, _values, result) result = Factory.ATTRIBUTE_OP(val[0][:value], '=>', val[2]) loc result, val[0], val[2] @@ -2527,8 +2409,8 @@ def _reduce_150(val, _values, result) end .,., -module_eval(<<'.,.,', 'egrammar.ra', 500) - def _reduce_151(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 496) + def _reduce_148(val, _values, result) result = Factory.ATTRIBUTE_OP(val[0][:value], '+>', val[2]) loc result, val[0], val[2] @@ -2536,16 +2418,16 @@ def _reduce_151(val, _values, result) end .,., -module_eval(<<'.,.,', 'egrammar.ra', 504) - def _reduce_152(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 500) + def _reduce_149(val, _values, result) result = Factory.ATTRIBUTES_OP(val[2]) ; loc result, val[0], val[2] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 513) - def _reduce_153(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 509) + def _reduce_150(val, _values, result) definition = Factory.DEFINITION(classname(val[1][:value]), val[2], val[4]) loc(definition, val[0], val[5]) result = add_definition(definition) @@ -2558,46 +2440,8 @@ def _reduce_153(val, _values, result) end .,., -module_eval(<<'.,.,', 'egrammar.ra', 525) - def _reduce_154(val, _values, result) - definition = Factory.APPLICATION(classname(val[1][:value]), val[2], val[4]) - loc(definition, val[0], val[5]) - result = add_definition(definition) - - result - end -.,., - -module_eval(<<'.,.,', 'egrammar.ra', 532) - def _reduce_155(val, _values, result) - result = Factory.CAPABILITY_MAPPING(val[1][:value], - Factory.QREF(classname(val[0][:value])), - classname(val[2][:value]), val[4]) - loc result, val[0], val[6] - add_mapping(result) - - result - end -.,., - -module_eval(<<'.,.,', 'egrammar.ra', 539) - def _reduce_156(val, _values, result) - result = Factory.CAPABILITY_MAPPING(val[1][:value], - val[0], - classname(val[2][:value]), val[4]) - loc result, val[0], val[6] - add_mapping(result) - - result - end -.,., - -# reduce 157 omitted - -# reduce 158 omitted - -module_eval(<<'.,.,', 'egrammar.ra', 553) - def _reduce_159(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 521) + def _reduce_151(val, _values, result) # Remove this plan's name from the namestack as all nested plans have been parsed namepop definition = Factory.PLAN(classname(val[1][:value]), val[2], val[4]) @@ -2608,8 +2452,8 @@ def _reduce_159(val, _values, result) end .,., -module_eval(<<'.,.,', 'egrammar.ra', 562) - def _reduce_160(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 530) + def _reduce_152(val, _values, result) result = Factory.APPLY(val[2], Factory.APPLY_BLOCK(val[6])) loc result, val[0], val[7] @@ -2617,8 +2461,8 @@ def _reduce_160(val, _values, result) end .,., -module_eval(<<'.,.,', 'egrammar.ra', 566) - def _reduce_161(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 534) + def _reduce_153(val, _values, result) result = Factory.APPLY(val[2], Factory.APPLY_BLOCK([])) loc result, val[0], val[6] @@ -2626,8 +2470,8 @@ def _reduce_161(val, _values, result) end .,., -module_eval(<<'.,.,', 'egrammar.ra', 576) - def _reduce_162(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 544) + def _reduce_154(val, _values, result) # Remove this class' name from the namestack as all nested classes have been parsed namepop definition = Factory.HOSTCLASS(classname(val[1][:value]), val[2], token_text(val[3]), val[5]) @@ -2638,52 +2482,32 @@ def _reduce_162(val, _values, result) end .,., -module_eval(<<'.,.,', 'egrammar.ra', 587) - def _reduce_163(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 555) + def _reduce_155(val, _values, result) namestack(val[0][:value]) ; result = val[0] result end .,., -# reduce 164 omitted +# reduce 156 omitted -# reduce 165 omitted +# reduce 157 omitted -# reduce 166 omitted +# reduce 158 omitted -module_eval(<<'.,.,', 'egrammar.ra', 596) - def _reduce_167(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 564) + def _reduce_159(val, _values, result) result = val[1] result end .,., -# reduce 168 omitted - -# reduce 169 omitted - -module_eval(<<'.,.,', 'egrammar.ra', 613) - def _reduce_170(val, _values, result) - definition = Factory.SITE(val[2]) - loc(definition, val[0], val[3]) - result = add_definition(definition) - - result - end -.,., +# reduce 160 omitted -module_eval(<<'.,.,', 'egrammar.ra', 618) - def _reduce_171(val, _values, result) - definition = Factory.SITE(nil) - loc(definition, val[0], val[2]) - result = add_definition(definition) - - result - end -.,., +# reduce 161 omitted -module_eval(<<'.,.,', 'egrammar.ra', 629) - def _reduce_172(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 581) + def _reduce_162(val, _values, result) definition = Factory.NODE(val[1], val[3], val[5]) loc(definition, val[0], val[6]) result = add_definition(definition) @@ -2692,8 +2516,8 @@ def _reduce_172(val, _values, result) end .,., -module_eval(<<'.,.,', 'egrammar.ra', 634) - def _reduce_173(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 586) + def _reduce_163(val, _values, result) definition = Factory.NODE(val[1], val[3], nil) loc(definition, val[0], val[5]) result = add_definition(definition) @@ -2702,62 +2526,62 @@ def _reduce_173(val, _values, result) end .,., -module_eval(<<'.,.,', 'egrammar.ra', 645) - def _reduce_174(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 597) + def _reduce_164(val, _values, result) result = [result] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 646) - def _reduce_175(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 598) + def _reduce_165(val, _values, result) result = val[0].push(val[2]) result end .,., -# reduce 176 omitted +# reduce 166 omitted -# reduce 177 omitted +# reduce 167 omitted -module_eval(<<'.,.,', 'egrammar.ra', 653) - def _reduce_178(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 605) + def _reduce_168(val, _values, result) result = Factory.literal(:default); loc result, val[0] result end .,., -# reduce 179 omitted +# reduce 169 omitted -module_eval(<<'.,.,', 'egrammar.ra', 657) - def _reduce_180(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 609) + def _reduce_170(val, _values, result) result = Factory.literal(val[0][:value]); loc result, val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 658) - def _reduce_181(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 610) + def _reduce_171(val, _values, result) result = Factory.concat(val[0], '.', val[2][:value]); loc result, val[0], val[2] result end .,., -# reduce 182 omitted +# reduce 172 omitted -# reduce 183 omitted +# reduce 173 omitted -# reduce 184 omitted +# reduce 174 omitted -module_eval(<<'.,.,', 'egrammar.ra', 667) - def _reduce_185(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 619) + def _reduce_175(val, _values, result) result = val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 673) - def _reduce_186(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 625) + def _reduce_176(val, _values, result) definition = Factory.FUNCTION(val[1][:value], val[2], val[5], val[3]) loc(definition, val[0], val[6]) result = add_definition(definition) @@ -2766,143 +2590,143 @@ def _reduce_186(val, _values, result) end .,., -module_eval(<<'.,.,', 'egrammar.ra', 679) - def _reduce_187(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 631) + def _reduce_177(val, _values, result) result = val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 680) - def _reduce_188(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 632) + def _reduce_178(val, _values, result) result = val[1].access(val[3]) ; loc result, val[1], val[4] result end .,., -# reduce 189 omitted +# reduce 179 omitted -# reduce 190 omitted +# reduce 180 omitted -# reduce 191 omitted +# reduce 181 omitted -# reduce 192 omitted +# reduce 182 omitted -module_eval(<<'.,.,', 'egrammar.ra', 690) - def _reduce_193(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 642) + def _reduce_183(val, _values, result) error val[0], "'class' keyword not allowed at this location" result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 691) - def _reduce_194(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 643) + def _reduce_184(val, _values, result) error val[0], "A quoted string is not valid as a name here" result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 695) - def _reduce_195(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 647) + def _reduce_185(val, _values, result) result = [] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 696) - def _reduce_196(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 648) + def _reduce_186(val, _values, result) result = [] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 697) - def _reduce_197(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 649) + def _reduce_187(val, _values, result) result = [] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 698) - def _reduce_198(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 650) + def _reduce_188(val, _values, result) result = val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 699) - def _reduce_199(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 651) + def _reduce_189(val, _values, result) result = val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 703) - def _reduce_200(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 655) + def _reduce_190(val, _values, result) result = [val[0]] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 704) - def _reduce_201(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 656) + def _reduce_191(val, _values, result) result = val[0].push(val[2]) result end .,., -# reduce 202 omitted +# reduce 192 omitted -# reduce 203 omitted +# reduce 193 omitted -# reduce 204 omitted +# reduce 194 omitted -# reduce 205 omitted +# reduce 195 omitted -module_eval(<<'.,.,', 'egrammar.ra', 716) - def _reduce_206(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 668) + def _reduce_196(val, _values, result) result = Factory.PARAM(val[0][:value], val[2]) ; loc result, val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 717) - def _reduce_207(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 669) + def _reduce_197(val, _values, result) result = Factory.PARAM(val[0][:value]); loc result, val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 720) - def _reduce_208(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 672) + def _reduce_198(val, _values, result) result = val[1]; val[1].captures_rest result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 723) - def _reduce_209(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 675) + def _reduce_199(val, _values, result) val[1].type_expr(val[0]) ; result = val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 726) - def _reduce_210(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 678) + def _reduce_200(val, _values, result) result = val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 727) - def _reduce_211(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 679) + def _reduce_201(val, _values, result) result = val[0].access(val[2]) ; loc result, val[0], val[3] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 732) - def _reduce_212(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 684) + def _reduce_202(val, _values, result) definition = Factory.TYPE_ASSIGNMENT(val[0], Factory.KEY_ENTRY(val[2], val[3])) loc(definition, val[0], val[3]) result = add_definition(definition) @@ -2911,8 +2735,8 @@ def _reduce_212(val, _values, result) end .,., -module_eval(<<'.,.,', 'egrammar.ra', 737) - def _reduce_213(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 689) + def _reduce_203(val, _values, result) definition = Factory.TYPE_ASSIGNMENT(val[0], val[2].access(val[4])) loc(definition, val[0], val[5]) result = add_definition(definition) @@ -2921,8 +2745,8 @@ def _reduce_213(val, _values, result) end .,., -module_eval(<<'.,.,', 'egrammar.ra', 742) - def _reduce_214(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 694) + def _reduce_204(val, _values, result) definition = Factory.TYPE_ASSIGNMENT(val[0], val[2]) loc(definition, val[0], val[2]) result = add_definition(definition) @@ -2931,8 +2755,8 @@ def _reduce_214(val, _values, result) end .,., -module_eval(<<'.,.,', 'egrammar.ra', 747) - def _reduce_215(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 699) + def _reduce_205(val, _values, result) definition = Factory.TYPE_ASSIGNMENT(val[0], val[2]) loc(definition, val[0], val[2]) result = add_definition(definition) @@ -2941,8 +2765,8 @@ def _reduce_215(val, _values, result) end .,., -module_eval(<<'.,.,', 'egrammar.ra', 752) - def _reduce_216(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 704) + def _reduce_206(val, _values, result) definition = Factory.TYPE_ASSIGNMENT(val[0], val[2]) loc(definition, val[0], val[4]) result = add_definition(definition) @@ -2951,15 +2775,15 @@ def _reduce_216(val, _values, result) end .,., -module_eval(<<'.,.,', 'egrammar.ra', 758) - def _reduce_217(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 710) + def _reduce_207(val, _values, result) result = val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 764) - def _reduce_218(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 716) + def _reduce_208(val, _values, result) definition = Factory.TYPE_DEFINITION(val[1][:value], nil, val[3]) loc(definition, val[0], val[4]) result = add_definition(definition) @@ -2968,8 +2792,8 @@ def _reduce_218(val, _values, result) end .,., -module_eval(<<'.,.,', 'egrammar.ra', 769) - def _reduce_219(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 721) + def _reduce_209(val, _values, result) definition = Factory.TYPE_DEFINITION(val[1][:value], val[3][:value], val[5]) loc(definition, val[0], val[6]) result = add_definition(definition) @@ -2978,8 +2802,8 @@ def _reduce_219(val, _values, result) end .,., -module_eval(<<'.,.,', 'egrammar.ra', 778) - def _reduce_220(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 730) + def _reduce_210(val, _values, result) fqn = Factory.fqn(val[0][:value]) loc(fqn, val[0]) fqn['offset'] += 1 @@ -2991,361 +2815,345 @@ def _reduce_220(val, _values, result) end .,., -module_eval(<<'.,.,', 'egrammar.ra', 789) - def _reduce_221(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 741) + def _reduce_211(val, _values, result) result = Factory.RESERVED(val[0][:value]) ; loc result, val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 790) - def _reduce_222(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 742) + def _reduce_212(val, _values, result) result = Factory.RESERVED(val[0][:value]) ; loc result, val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 796) - def _reduce_223(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 748) + def _reduce_213(val, _values, result) result = Factory.LIST(val[1]); loc result, val[0], val[3] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 797) - def _reduce_224(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 749) + def _reduce_214(val, _values, result) result = Factory.literal([]) ; loc result, val[0], val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 798) - def _reduce_225(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 750) + def _reduce_215(val, _values, result) result = Factory.LIST(val[1]); loc result, val[0], val[3] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 799) - def _reduce_226(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 751) + def _reduce_216(val, _values, result) result = Factory.literal([]) ; loc result, val[0], val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 802) - def _reduce_227(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 754) + def _reduce_217(val, _values, result) result = Factory.HASH(val[1]); loc result, val[0], val[2] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 803) - def _reduce_228(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 755) + def _reduce_218(val, _values, result) result = Factory.HASH(val[1]); loc result, val[0], val[3] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 804) - def _reduce_229(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 756) + def _reduce_219(val, _values, result) result = Factory.literal({}) ; loc result, val[0], val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 807) - def _reduce_230(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 759) + def _reduce_220(val, _values, result) result = [val[0]] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 808) - def _reduce_231(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 760) + def _reduce_221(val, _values, result) result = val[0].push val[2] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 811) - def _reduce_232(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 763) + def _reduce_222(val, _values, result) result = Factory.KEY_ENTRY(val[0], val[2]); loc result, val[1] result end .,., -# reduce 233 omitted +# reduce 223 omitted -module_eval(<<'.,.,', 'egrammar.ra', 815) - def _reduce_234(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 767) + def _reduce_224(val, _values, result) result = Factory.literal(val[0][:value]) ; loc result, val[0] result end .,., -# reduce 235 omitted +# reduce 225 omitted -module_eval(<<'.,.,', 'egrammar.ra', 820) - def _reduce_236(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 772) + def _reduce_226(val, _values, result) result = Factory.literal(val[0][:value]) ; loc result, val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 823) - def _reduce_237(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 775) + def _reduce_227(val, _values, result) result = [val[0]] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 824) - def _reduce_238(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 776) + def _reduce_228(val, _values, result) result = Factory.ARGUMENTS(val[0], val[2]) result end .,., -# reduce 239 omitted - -# reduce 240 omitted - -# reduce 241 omitted - -# reduce 242 omitted - -# reduce 243 omitted +# reduce 229 omitted -# reduce 244 omitted +# reduce 230 omitted -# reduce 245 omitted +# reduce 231 omitted -# reduce 246 omitted +# reduce 232 omitted -# reduce 247 omitted +# reduce 233 omitted -module_eval(<<'.,.,', 'egrammar.ra', 841) - def _reduce_248(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 789) + def _reduce_234(val, _values, result) result = Factory.literal(val[0][:value]) ; loc result, val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 842) - def _reduce_249(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 790) + def _reduce_235(val, _values, result) result = Factory.literal(val[0][:value]) ; loc result, val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 844) - def _reduce_250(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 792) + def _reduce_236(val, _values, result) result = Factory.STRING(val[0], *val[1]) ; loc result, val[0], val[1][-1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 845) - def _reduce_251(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 793) + def _reduce_237(val, _values, result) result = Factory.literal(val[0][:value]); loc result, val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 846) - def _reduce_252(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 794) + def _reduce_238(val, _values, result) result = Factory.literal(val[0][:value]); loc result, val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 847) - def _reduce_253(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 795) + def _reduce_239(val, _values, result) result = Factory.literal(val[0][:value]); loc result, val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 848) - def _reduce_254(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 796) + def _reduce_240(val, _values, result) result = [val[0]] + val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 849) - def _reduce_255(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 797) + def _reduce_241(val, _values, result) result = Factory.TEXT(val[0]) result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 852) - def _reduce_256(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 800) + def _reduce_242(val, _values, result) result = [val[0]] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 853) - def _reduce_257(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 801) + def _reduce_243(val, _values, result) result = [val[0]] + val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 856) - def _reduce_258(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 804) + def _reduce_244(val, _values, result) result = Factory.HEREDOC(val[0][:value], val[1]); loc result, val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 859) - def _reduce_259(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 807) + def _reduce_245(val, _values, result) result = Factory.SUBLOCATE(val[0], val[1]); result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 860) - def _reduce_260(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 808) + def _reduce_246(val, _values, result) result = Factory.SUBLOCATE(val[0], val[1]); result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 863) - def _reduce_261(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 811) + def _reduce_247(val, _values, result) result = Factory.EPP(val[1], val[2]); loc result, val[0] result end .,., -# reduce 262 omitted +# reduce 248 omitted -# reduce 263 omitted +# reduce 249 omitted -module_eval(<<'.,.,', 'egrammar.ra', 870) - def _reduce_264(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 818) + def _reduce_250(val, _values, result) result = nil result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 871) - def _reduce_265(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 819) + def _reduce_251(val, _values, result) result = [] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 872) - def _reduce_266(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 820) + def _reduce_252(val, _values, result) result = val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 875) - def _reduce_267(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 823) + def _reduce_253(val, _values, result) result = Factory.RENDER_STRING(val[0][:value]); loc result, val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 876) - def _reduce_268(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 824) + def _reduce_254(val, _values, result) result = Factory.RENDER_EXPR(val[1]); loc result, val[0], val[2] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 877) - def _reduce_269(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 825) + def _reduce_255(val, _values, result) result = Factory.RENDER_EXPR(Factory.block_or_expression(val[2], val[1], val[3])); loc result, val[0], val[4] result end .,., -# reduce 270 omitted +# reduce 256 omitted -# reduce 271 omitted +# reduce 257 omitted -module_eval(<<'.,.,', 'egrammar.ra', 883) - def _reduce_272(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 831) + def _reduce_258(val, _values, result) result = Factory.QREF(val[0][:value]) ; loc result, val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 886) - def _reduce_273(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 834) + def _reduce_259(val, _values, result) result = Factory.literal(val[0][:value]); loc result, val[0] result end .,., -# reduce 274 omitted +# reduce 260 omitted -module_eval(<<'.,.,', 'egrammar.ra', 892) - def _reduce_275(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 840) + def _reduce_261(val, _values, result) result = nil result end .,., -# reduce 276 omitted - -# reduce 277 omitted - -# reduce 278 omitted - -# reduce 279 omitted - -# reduce 280 omitted +# reduce 262 omitted -# reduce 281 omitted +# reduce 263 omitted -# reduce 282 omitted +# reduce 264 omitted -# reduce 283 omitted +# reduce 265 omitted -# reduce 284 omitted +# reduce 266 omitted -# reduce 285 omitted +# reduce 267 omitted -# reduce 286 omitted +# reduce 268 omitted -# reduce 287 omitted +# reduce 269 omitted -# reduce 288 omitted +# reduce 270 omitted -# reduce 289 omitted +# reduce 271 omitted -# reduce 290 omitted +# reduce 272 omitted -# reduce 291 omitted +# reduce 273 omitted -# reduce 292 omitted +# reduce 274 omitted -# reduce 293 omitted +# reduce 275 omitted -# reduce 294 omitted +# reduce 276 omitted -# reduce 295 omitted +# reduce 277 omitted -# reduce 296 omitted +# reduce 278 omitted -# reduce 297 omitted +# reduce 279 omitted -# reduce 298 omitted +# reduce 280 omitted -# reduce 299 omitted +# reduce 281 omitted -module_eval(<<'.,.,', 'egrammar.ra', 923) - def _reduce_300(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 867) + def _reduce_282(val, _values, result) result = nil result end diff --git a/spec/unit/capability_spec.rb b/spec/unit/capability_spec.rb index 607a84f8caa..a5c921298ff 100644 --- a/spec/unit/capability_spec.rb +++ b/spec/unit/capability_spec.rb @@ -22,273 +22,44 @@ end context 'annotations' do - it "adds a blueprint for a produced resource" do - catalog = compile_to_catalog(<<-MANIFEST, node) - define test($hostname) { - notify { "hostname ${hostname}":} - } - - Test produces Cap { - host => $hostname - } - MANIFEST - - krt = catalog.environment_instance.known_resource_types - type = krt.definition(:test) - expect(type.produces).to be_instance_of(Array) - prd = type.produces.first - - expect(prd).to be_instance_of(Hash) - expect(prd[:capability]).to eq("Cap") - expect(prd[:mappings]).to be_instance_of(Hash) - expect(prd[:mappings]["host"]).to be_instance_of(Puppet::Parser::AST::PopsBridge::Expression) - end - - it "adds a blueprint for a consumed resource" do - catalog = compile_to_catalog(<<-MANIFEST, node) - define test($hostname) { - notify { "hostname ${hostname}":} - } - - Test consumes Cap { - host => $hostname - } - MANIFEST - - krt = catalog.environment_instance.known_resource_types - type = krt.definition(:test) - expect(type.produces).to be_instance_of(Array) - cns = type.consumes.first - - expect(cns).to be_instance_of(Hash) - expect(cns[:capability]).to eq("Cap") - expect(cns[:mappings]).to be_instance_of(Hash) - expect(cns[:mappings]["host"]).to be_instance_of(Puppet::Parser::AST::PopsBridge::Expression) - end - - it 'can place define and consumes/produces in separate manifests' do - parse_results = [] - parser = Puppet::Parser::ParserFactory.parser - - parser.string = <<-MANIFEST + it "raises a syntax error on 'produces'" do + expect { + compile_to_catalog(<<-MANIFEST, node) define test($hostname) { notify { "hostname ${hostname}":} } - MANIFEST - parse_results << parser.parse - - parser.string = <<-MANIFEST - Test consumes Cap { - host => $hostname - } - MANIFEST - parse_results << parser.parse - main = Puppet::Parser::AST::Hostclass.new('', :code => Puppet::Parser::ParserFactory.code_merger.concatenate(parse_results)) - allow_any_instance_of(Puppet::Node::Environment).to receive(:perform_initial_import).and_return(main) - - type = compile_to_catalog(nil).environment_instance.known_resource_types.definition(:test) - expect(type.produces).to be_instance_of(Array) - cns = type.consumes.first - - expect(cns).to be_instance_of(Hash) - expect(cns[:capability]).to eq('Cap') - expect(cns[:mappings]).to be_instance_of(Hash) - expect(cns[:mappings]['host']).to be_instance_of(Puppet::Parser::AST::PopsBridge::Expression) - end - - it 'can place use a qualified name for defines that produces capabilities' do - parse_results = [] - parser = Puppet::Parser::ParserFactory.parser - - parser.string = <<-MANIFEST - class mod { - define test($hostname) { - notify { "hostname ${hostname}":} - } - } - include mod - MANIFEST - parse_results << parser.parse - - parser.string = <<-MANIFEST - Mod::Test consumes Cap { + Test produces Cap { host => $hostname } - MANIFEST - parse_results << parser.parse - - main = Puppet::Parser::AST::Hostclass.new('', :code => Puppet::Parser::ParserFactory.code_merger.concatenate(parse_results)) - allow_any_instance_of(Puppet::Node::Environment).to receive(:perform_initial_import).and_return(main) - - type = compile_to_catalog(nil).environment_instance.known_resource_types.definition('Mod::Test') - expect(type.produces).to be_instance_of(Array) - cns = type.consumes.first - - expect(cns).to be_instance_of(Hash) - expect(cns[:capability]).to eq('Cap') - expect(cns[:mappings]).to be_instance_of(Hash) - expect(cns[:mappings]['host']).to be_instance_of(Puppet::Parser::AST::PopsBridge::Expression) - end - - it "does not allow operator '+>' in a mapping" do - expect do - compile_to_catalog(<<-MANIFEST, node) - define test($hostname) { - notify { "hostname ${hostname}":} - } - - Test consumes Cap { - host +> $hostname - } - MANIFEST - end.to raise_error(Puppet::ParseErrorWithIssue, /Illegal \+> operation.*This operator can not be used in a Capability Mapping/) + MANIFEST + }.to raise_error(Puppet::ParseErrorWithIssue, /Syntax error at 'produces'/) end - it "does not allow operator '*=>' in a mapping" do - expect do + it "raises a syntax error on 'consumes'" do + expect { compile_to_catalog(<<-MANIFEST, node) define test($hostname) { notify { "hostname ${hostname}":} } Test consumes Cap { - *=> { host => $hostname } - } - MANIFEST - end.to raise_error(Puppet::ParseError, /The operator '\* =>' in a Capability Mapping is not supported/) - end - - it "does not allow 'before' relationship to capability mapping" do - expect do - compile_to_catalog(<<-MANIFEST, node) - define test() { - notify { "hello":} - } - - Test consumes Cap {} - - test { one: before => Cap[cap] } - MANIFEST - end.to raise_error(Puppet::Error, /'before' is not a valid relationship to a capability/) - end - - ["produces", "consumes"].each do |kw| - it "creates an error when #{kw} references nonexistent type" do - manifest = <<-MANIFEST - Test #{kw} Cap { host => $hostname } - MANIFEST - - expect { - compile_to_catalog(manifest, node) - }.to raise_error(Puppet::Error, - /#{kw} clause references nonexistent type Test/) - end - end - end - - context 'exporting a capability' do - it "does not add produced resources that are not exported" do - manifest = <<-MANIFEST -define test($hostname) { - notify { "hostname ${hostname}":} -} - -Test produces Cap { - host => $hostname -} - -test { one: hostname => "ahost" } - MANIFEST - catalog = compile_to_catalog(manifest, node) - expect(catalog.resource("Test[one]")).to be_instance_of(Puppet::Resource) - expect(catalog.resource_keys.find { |type, _| type == "Cap" }).to be_nil - end - - it "adds produced resources that are exported" do - manifest = <<-MANIFEST -define test($hostname) { - notify { "hostname ${hostname}":} -} - -# The $hostname in the produces clause does not refer to this variable, -# instead, it referes to the hostname property of the Test resource -# that is producing the Cap -$hostname = "other_host" - -Test produces Cap { - host => $hostname -} - -test { one: hostname => "ahost", export => Cap[two] } - MANIFEST - catalog = compile_to_catalog(manifest, node) - expect(catalog.resource("Test[one]")).to be_instance_of(Puppet::Resource) - - caps = catalog.resource_keys.select { |type, _| type == "Cap" } - expect(caps.size).to eq(1) - - cap = catalog.resource("Cap[two]") - expect(cap).to be_instance_of(Puppet::Resource) - expect(cap["require"]).to eq("Test[one]") - expect(cap["host"]).to eq("ahost") - expect(cap.resource_type).to eq(Puppet::Type::Cap) - expect(cap.tags.any? { |t| t == 'producer:testing' }).to eq(true) + MANIFEST + }.to raise_error(Puppet::ParseErrorWithIssue, /Syntax error at 'consumes'/) end end - context 'consuming a capability' do + context 'capability metaparameters' do def make_catalog(instance) manifest = <<-MANIFEST define test($hostname = nohost) { notify { "hostname ${hostname}":} } - - Test consumes Cap { - hostname => $host - } MANIFEST - compile_to_catalog(manifest + instance, node) - end - - def mock_cap_finding - cap = Puppet::Resource.new("Cap", "two") - cap["host"] = "ahost" - expect(Puppet::Resource::CapabilityFinder).to receive(:find).and_return(cap) - cap - end - it "does not fetch a consumed resource when consume metaparam not set" do - expect(Puppet::Resource::CapabilityFinder).not_to receive(:find) - catalog = make_catalog("test { one: }") - expect(catalog.resource_keys.find { |type, _| type == "Cap" }).to be_nil - expect(catalog.resource("Test", "one")["hostname"]).to eq("nohost") - end - - it "sets hostname from consumed capability" do - cap = mock_cap_finding - catalog = make_catalog("test { one: consume => Cap[two] }") - expect(catalog.resource("Cap[two]")).to eq(cap) - expect(catalog.resource("Cap[two]")["host"]).to eq("ahost") - expect(catalog.resource("Test", "one")["hostname"]).to eq("ahost") - end - - it "does not override explicit hostname property when consuming" do - cap = mock_cap_finding - catalog = make_catalog("test { one: hostname => other_host, consume => Cap[two] }") - expect(catalog.resource("Cap[two]")).to eq(cap) - expect(catalog.resource("Cap[two]")["host"]).to eq("ahost") - expect(catalog.resource("Test", "one")["hostname"]).to eq("other_host") - end - - it "fetches required capability" do - cap = mock_cap_finding - catalog = make_catalog("test { one: require => Cap[two] }") - expect(catalog.resource("Cap[two]")).to eq(cap) - expect(catalog.resource("Cap[two]")["host"]).to eq("ahost") - expect(catalog.resource("Test", "one")["hostname"]).to eq("nohost") + compile_to_catalog(manifest + instance, node) end ['export', 'consume'].each do |metaparam| @@ -301,96 +72,5 @@ def mock_cap_finding expect { make_catalog("notify{hello:} test { one: #{metaparam} => Notify[hello] }") }.to raise_error(Puppet::Error, /not a capability resource/) end end - - context 'producing/consuming resources' do - - let(:ral) do - compile_to_ral(<<-MANIFEST, node) - define producer() { - notify { "producer":} - } - - define consumer() { - notify { $title:} - } - - Producer produces Cap {} - - Consumer consumes Cap {} - - producer {x: export => Cap[cap]} - consumer {x: consume => Cap[cap]} - consumer {y: require => Cap[cap]} - MANIFEST - end - - let(:graph) do - graph = Puppet::Graph::RelationshipGraph.new(Puppet::Graph::SequentialPrioritizer.new) - graph.populate_from(ral) - graph - end - - let(:capability) { ral.resource('Cap[cap]') } - - it 'the produced resource depends on the producer' do - expect(graph.dependencies(capability).map {|d| d.to_s }).to include('Producer[x]') - end - - it 'the consumer depends on the consumed resource' do - expect(graph.dependents(capability).map {|d| d.to_s }).to include('Consumer[x]') - end - - it 'the consumer depends on the required resource' do - expect(graph.dependents(capability).map {|d| d.to_s }).to include('Consumer[y]') - end - end - - context 'producing/consuming resources to/from classes' do - - let(:ral) do - compile_to_ral(<<-MANIFEST, node) - define test($hostname) { - notify { $hostname:} - } - - class producer($host) { - notify { p: } - } - - class consumer($host) { - test { c: hostname => $host } - } - - Class[producer] produces Cap {} - - Class[consumer] consumes Cap {} - - class { producer: host => 'produced.host', export => Cap[one]} - class { consumer: consume => Cap[one]} - MANIFEST - end - - let(:graph) do - graph = Puppet::Graph::RelationshipGraph.new(Puppet::Graph::SequentialPrioritizer.new) - graph.populate_from(ral) - graph - end - - let(:capability) { ral.resource('Cap[one]') } - - it 'the produced resource depends on the producer' do - expect(graph.dependencies(capability).map {|d| d.to_s }).to include('Class[Producer]') - end - - it 'the consumer depends on the consumed resource' do - expect(graph.dependents(capability).map {|d| d.to_s }).to include('Class[Consumer]') - end - - it 'resource in the consumer class gets values from producer via the capability resource' do - expect(graph.dependents(capability).map {|d| d.to_s }).to include('Notify[produced.host]') - end - end end - - end diff --git a/spec/unit/pops/parser/parse_application_spec.rb b/spec/unit/pops/parser/parse_application_spec.rb index 1529161b1fd..f17e20f063d 100644 --- a/spec/unit/pops/parser/parse_application_spec.rb +++ b/spec/unit/pops/parser/parse_application_spec.rb @@ -5,27 +5,9 @@ describe "egrammar parsing of 'application'" do include ParserRspecHelper - it "an empty body" do - expect(dump(parse("application foo { }"))).to eq("(application foo () ())") - end - - it "an empty body" do - prog = <<-EPROG -application foo { - db { one: - password => 'secret' - } -} -EPROG - expect(dump(parse(prog))).to eq( [ -"(application foo () (block", -" (resource db", -" (one", -" (password => 'secret')))", "))" ].join("\n")) - end - - it "accepts parameters" do - s = "application foo($p1 = 'yo', $p2) { }" - expect(dump(parse(s))).to eq("(application foo ((= p1 'yo') p2) ())") + it "raises a syntax error" do + expect { + parse("application foo { }") + }.to raise_error(Puppet::ParseErrorWithIssue, /Syntax error at 'application' \(line: 1, column: 1\)/) end end diff --git a/spec/unit/pops/parser/parse_basic_expressions_spec.rb b/spec/unit/pops/parser/parse_basic_expressions_spec.rb index 45358679e2d..7cb7fc5a211 100644 --- a/spec/unit/pops/parser/parse_basic_expressions_spec.rb +++ b/spec/unit/pops/parser/parse_basic_expressions_spec.rb @@ -191,7 +191,6 @@ { 'keyword' => %w(type function), - 'reserved word' => %w(application site produces consumes) }.each_pair do |word_type, words| words.each do |word| it "allows the #{word_type} '#{word}' in a list" do diff --git a/spec/unit/pops/parser/parse_capabilities_spec.rb b/spec/unit/pops/parser/parse_capabilities_spec.rb index f8f7eeb1f4d..4d6b45793f0 100644 --- a/spec/unit/pops/parser/parse_capabilities_spec.rb +++ b/spec/unit/pops/parser/parse_capabilities_spec.rb @@ -6,31 +6,18 @@ include ParserRspecHelper context "when parsing 'produces'" do - it "the ast contains produces and attributes" do - prog = "Foo produces Sql { name => value }" - ast = "(produces Foo Sql ((name => value)))" - expect(dump(parse(prog))).to eq(ast) - end - - it "optional end comma is allowed" do - prog = "Foo produces Sql { name => value, }" - ast = "(produces Foo Sql ((name => value)))" - expect(dump(parse(prog))).to eq(ast) + it "raises syntax error" do + expect { + parse("Foo produces Sql { name => value }") + }.to raise_error(Puppet::ParseErrorWithIssue, /Syntax error at 'produces' \(line: 1, column: 5\)/) end end context "when parsing 'consumes'" do - it "the ast contains consumes and attributes" do - prog = "Foo consumes Sql { name => value }" - ast = "(consumes Foo Sql ((name => value)))" - expect(dump(parse(prog))).to eq(ast) + it "raises syntax error" do + expect { + parse("Foo consumes Sql { name => value }") + }.to raise_error(Puppet::ParseErrorWithIssue, /Syntax error at 'consumes' \(line: 1, column: 5\)/) end - - it "optional end comma is allowed" do - prog = "Foo consumes Sql { name => value, }" - ast = "(consumes Foo Sql ((name => value)))" - expect(dump(parse(prog))).to eq(ast) - end - end end diff --git a/spec/unit/pops/parser/parse_site_spec.rb b/spec/unit/pops/parser/parse_site_spec.rb index 0f21dee12cf..c062576d01e 100644 --- a/spec/unit/pops/parser/parse_site_spec.rb +++ b/spec/unit/pops/parser/parse_site_spec.rb @@ -6,41 +6,37 @@ include ParserRspecHelper context "when parsing 'site'" do - it "an empty body is allowed" do - prog = "site { }" - ast = "(site ())" - expect(dump(parse(prog))).to eq(ast) - end - - it "a body with one expression is allowed" do - prog = "site { $x = 1 }" - ast = "(site (block\n (= $x 1)\n))" - expect(dump(parse(prog))).to eq(ast) - end - - it "a body with more than one expression is allowed" do - prog = "site { $x = 1 $y = 2}" - ast = "(site (block\n (= $x 1)\n (= $y 2)\n))" - expect(dump(parse(prog))).to eq(ast) + it "raises a syntax error" do + expect { + parse("site { }") + }.to raise_error(Puppet::ParseErrorWithIssue, /Syntax error at 'site' \(line: 1, column: 1\)/) end end context 'When parsing collections containing application management specific keywords' do %w(application site produces consumes).each do |keyword| - it "allows the keyword '#{keyword}' in a list" do - expect(dump(parse("$a = [#{keyword}]"))).to(eq("(= $a ([] '#{keyword}'))")) + it "disallows the keyword '#{keyword}' in a list" do + expect { + parse("$a = [#{keyword}]") + }.to raise_error(Puppet::ParseErrorWithIssue, /Syntax error at '#{keyword}' \(line: 1, column: 7\)/) end - it "allows the keyword '#{keyword}' as a key in a hash" do - expect(dump(parse("$a = {#{keyword}=>'x'}"))).to(eq("(= $a ({} ('#{keyword}' 'x')))")) + it "disallows the keyword '#{keyword}' as a key in a hash" do + expect { + parse("$a = {#{keyword}=>'x'}") + }.to raise_error(Puppet::ParseErrorWithIssue, /Syntax error at '#{keyword}' \(line: 1, column: 7\)/) end - it "allows the keyword '#{keyword}' as a value in a hash" do - expect(dump(parse("$a = {'x'=>#{keyword}}"))).to(eq("(= $a ({} ('x' '#{keyword}')))")) + it "disallows the keyword '#{keyword}' as a value in a hash" do + expect { + parse("$a = {'x'=>#{keyword}}") + }.to raise_error(Puppet::ParseErrorWithIssue, /Syntax error at '#{keyword}' \(line: 1, column: 12\)/) end - it "allows the keyword '#{keyword}' as an attribute name" do - expect(dump(parse("foo { 'x': #{keyword} => 'value' } "))).to eql("(resource foo\n ('x'\n (#{keyword} => 'value')))") + it "disallows the keyword '#{keyword}' as an attribute name" do + expect { + parse("foo { 'x': #{keyword} => 'value' } ") + }.to raise_error(Puppet::ParseErrorWithIssue, /Syntax error at '#{keyword}' \(line: 1, column: 12\)/) end end end diff --git a/spec/unit/pops/resource/resource_type_impl_spec.rb b/spec/unit/pops/resource/resource_type_impl_spec.rb index b670d047975..457e76c8d8a 100644 --- a/spec/unit/pops/resource/resource_type_impl_spec.rb +++ b/spec/unit/pops/resource/resource_type_impl_spec.rb @@ -32,77 +32,6 @@ module Resource expect(rt.valid_parameter?(:loglevel)).to be_truthy end end - - - context 'when used with capability resource with producers/consumers' do - include PuppetSpec::Files - - let!(:env_name) { 'spec' } - let!(:env_dir) { tmpdir('environments') } - let!(:populated_env_dir) do - dir_contained_in(env_dir, env_name => { - '.resource_types' => { - 'capability.pp' => <<-PUPPET - Puppet::Resource::ResourceType3.new( - 'capability', - [], - [Puppet::Resource::Param(Any, 'name', true)], - { /(.*)/ => ['name'] }, - true, - true) - PUPPET - }, - 'modules' => { - 'test' => { - 'lib' => { - 'puppet' => { - 'type' => { 'capability.rb' => <<-RUBY - Puppet::Type.newtype(:capability, :is_capability => true) do - newparam :name, :namevar => true - raise Puppet::Error, 'Ruby resource was loaded' - end - RUBY - } - } - } - } - } - }) - end - - let!(:code) { <<-PUPPET } - define producer() { - notify { "producer":} - } - - define consumer() { - notify { $title:} - } - - Producer produces Capability {} - - Consumer consumes Capability {} - - producer {x: export => Capability[cap]} - consumer {x: consume => Capability[cap]} - consumer {y: require => Capability[cap]} - PUPPET - - let(:environments) { Puppet::Environments::Directories.new(populated_env_dir, []) } - let(:env) { Puppet::Node::Environment.create(:'spec', [File.join(env_dir, 'spec', 'modules')]) } - let(:node) { Puppet::Node.new('test', :environment => env) } - around(:each) do |example| - Puppet[:environment] = env_name - Puppet.override(:environments => environments, :current_environment => env) do - example.run - end - Puppet::Type.rmtype(:capability) - end - - it 'does not load the Ruby resource' do - expect { compile_to_catalog(code, node) }.not_to raise_error - end - end end end end diff --git a/spec/unit/pops/validator/validator_spec.rb b/spec/unit/pops/validator/validator_spec.rb index 7b9765d8e97..6a5379a8c84 100644 --- a/spec/unit/pops/validator/validator_spec.rb +++ b/spec/unit/pops/validator/validator_spec.rb @@ -344,16 +344,16 @@ def with_environment(environment, env_params = {}) end end - it 'produces an error for application' do - acceptor = validate(parse('application test {}')) - expect(acceptor.error_count).to eql(1) - expect(acceptor).to have_issue(Puppet::Pops::Issues::EXPRESSION_NOT_SUPPORTED_WHEN_SCRIPTING) + it 'produces a syntax error for application' do + expect { + parse('application test {}') + }.to raise_error(Puppet::ParseErrorWithIssue, /Syntax error at 'application'/) end - it 'produces an error for capability mapping' do - acceptor = validate(parse('Foo produces Sql {}')) - expect(acceptor.error_count).to eql(1) - expect(acceptor).to have_issue(Puppet::Pops::Issues::EXPRESSION_NOT_SUPPORTED_WHEN_SCRIPTING) + it 'produces a syntax error for capability mapping' do + expect { + parse('Foo produces Sql {}') + }.to raise_error(Puppet::ParseErrorWithIssue, /Syntax error at 'produces'/) end it 'produces an error for collect expressions with virtual query' do @@ -410,10 +410,10 @@ def with_environment(environment, env_params = {}) expect(acceptor).to have_issue(Puppet::Pops::Issues::EXPRESSION_NOT_SUPPORTED_WHEN_SCRIPTING) end - it 'produces an error for site definitions' do - acceptor = validate(parse('site {}')) - expect(acceptor.error_count).to eql(1) - expect(acceptor).to have_issue(Puppet::Pops::Issues::EXPRESSION_NOT_SUPPORTED_WHEN_SCRIPTING) + it 'produces a syntax error for site definitions' do + expect { + parse('site {}') + }.to raise_error(Puppet::ParseErrorWithIssue, /Syntax error at 'site'/) end context 'validating apply() blocks' do @@ -468,16 +468,16 @@ def with_environment(environment, env_params = {}) expect(acceptor.error_count).to eql(0) end - it 'produces an error for application' do - acceptor = validate(parse('apply("foo.example.com") { application test {} }')) - expect(acceptor.error_count).to eql(1) - expect(acceptor).to have_issue(Puppet::Pops::Issues::EXPRESSION_NOT_SUPPORTED_WHEN_SCRIPTING) + it 'produces a syntax error for application' do + expect { + parse('apply("foo.example.com") { application test {} }') + }.to raise_error(Puppet::ParseErrorWithIssue, /Syntax error at 'application'/) end - it 'produces an error for capability mapping' do - acceptor = validate(parse('apply("foo.example.com") { Foo produces Sql {} }')) - expect(acceptor.error_count).to eql(1) - expect(acceptor).to have_issue(Puppet::Pops::Issues::EXPRESSION_NOT_SUPPORTED_WHEN_SCRIPTING) + it 'produces a syntax error for capability mapping' do + expect { + parse('apply("foo.example.com") { Foo produces Sql {} }') + }.to raise_error(Puppet::ParseErrorWithIssue, /Syntax error at 'produces'/) end it 'produces an error for class expressions' do @@ -504,9 +504,9 @@ def with_environment(environment, env_params = {}) end it 'produces an error for site definitions' do - acceptor = validate(parse('apply("foo.example.com") { site {} }')) - expect(acceptor.error_count).to eql(1) - expect(acceptor).to have_issue(Puppet::Pops::Issues::EXPRESSION_NOT_SUPPORTED_WHEN_SCRIPTING) + expect { + parse('apply("foo.example.com") { site {} }') + }.to raise_error(Puppet::ParseErrorWithIssue, /Syntax error at 'site'/) end it 'produces an error for apply() inside apply()' do @@ -992,17 +992,10 @@ class foo {} context "capability annotations" do ['produces', 'consumes'].each do |word| - it "rejects illegal resource types in #{word} clauses" do - expect(validate(parse("foo produces Bar {}"))).to have_issue(Puppet::Pops::Issues::ILLEGAL_CLASSREF) - end - - it "accepts legal resource and capability types in #{word} clauses" do - expect(validate(parse("Foo produces Bar {}"))).to_not have_issue(Puppet::Pops::Issues::ILLEGAL_CLASSREF) - expect(validate(parse("Mod::Foo produces ::Mod2::Bar {}"))).to_not have_issue(Puppet::Pops::Issues::ILLEGAL_CLASSREF) - end - - it "rejects illegal capability types in #{word} clauses" do - expect(validate(parse("Foo produces bar {}"))).to have_issue(Puppet::Pops::Issues::ILLEGAL_CLASSREF) + it "raises a syntax error in #{word} clauses" do + expect { + parse("foo #{word} Bar {}") + }.to raise_error(Puppet::ParseErrorWithIssue, /Syntax error at '#{word}'/) end end end From 0bc675ef7a1a53db9e86d4d7fe47307764be3867 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Thu, 3 Sep 2020 16:11:21 -0700 Subject: [PATCH 139/731] (PUP-10446) Remove instantiation of app orch model objects The eparser no longer calls factory.SITE, APPLICATION, etc so delete those methods and the pops bridge case statements that convert pops model objects to Puppet::Resource::Type instances. --- lib/puppet/parser/ast/pops_bridge.rb | 38 ---------------------------- lib/puppet/pops/model/factory.rb | 10 -------- lib/puppet/pops/parser/lexer2.rb | 8 +++--- 3 files changed, 4 insertions(+), 52 deletions(-) diff --git a/lib/puppet/parser/ast/pops_bridge.rb b/lib/puppet/parser/ast/pops_bridge.rb index a9b29afcbe7..2d9301f6d93 100644 --- a/lib/puppet/parser/ast/pops_bridge.rb +++ b/lib/puppet/parser/ast/pops_bridge.rb @@ -92,14 +92,8 @@ def instantiate(modname) instantiate_HostClassDefinition(d, modname) when Puppet::Pops::Model::ResourceTypeDefinition instantiate_ResourceTypeDefinition(d, modname) - when Puppet::Pops::Model::CapabilityMapping - instantiate_CapabilityMapping(d, modname) when Puppet::Pops::Model::NodeDefinition instantiate_NodeDefinition(d, modname) - when Puppet::Pops::Model::SiteDefinition - instantiate_SiteDefinition(d, modname) - when Puppet::Pops::Model::Application - instantiate_ApplicationDefinition(d, modname) else loaders = Puppet::Pops::Loaders.loaders loaders.instantiate_definition(d, loaders.find_loader(modname)) @@ -214,27 +208,6 @@ def instantiate_ResourceTypeDefinition(o, modname) instance end - def instantiate_CapabilityMapping(o, modname) - # Use an intermediate 'capability_mapping' type to pass this info to the compiler where the - # actual mapping takes place - Puppet::Resource::Type.new(:capability_mapping, "#{o.component} #{o.kind} #{o.capability}", { :arguments => { - 'component' => o.component, - 'kind' => o.kind, - 'blueprint' => { - :capability => o.capability, - :mappings => o.mappings.reduce({}) do |memo, mapping| - memo[mapping.attribute_name] = - Expression.new(:value => mapping.value_expr) - memo - end - }}}) - end - - def instantiate_ApplicationDefinition(o, modname) - args = args_from_definition(o, modname) - Puppet::Resource::Type.new(:application, o.name, @context.merge(args)) - end - def instantiate_NodeDefinition(o, modname) args = { :module_name => modname } @@ -253,17 +226,6 @@ def instantiate_NodeDefinition(o, modname) end end - def instantiate_SiteDefinition(o, modname) - args = { :module_name => modname } - - unless is_nop?(o.body) - args[:code] = Expression.new(:value => o.body) - end - - args = @ast_transformer.merge_location(args, o) - Puppet::Resource::Type.new(:site, 'site', @context.merge(args)) - end - def code() Expression.new(:value => @value) end diff --git a/lib/puppet/pops/model/factory.rb b/lib/puppet/pops/model/factory.rb index a75eec945b2..3d65418d0fc 100644 --- a/lib/puppet/pops/model/factory.rb +++ b/lib/puppet/pops/model/factory.rb @@ -742,8 +742,6 @@ def self.PARAM(name, expr=nil); new(Parameter, name, expr); def self.NODE(hosts, parent, body); new(NodeDefinition, hosts, parent, body); end - def self.SITE(body); new(SiteDefinition, body); end - # Parameters # Mark parameter as capturing the rest of arguments @@ -950,14 +948,6 @@ def self.DEFINITION(name, parameters, body) new(ResourceTypeDefinition, name, parameters, body) end - def self.CAPABILITY_MAPPING(kind, component, cap_name, mappings) - new(CapabilityMapping, kind, component, cap_name, mappings) - end - - def self.APPLICATION(name, parameters, body) - new(Application, name, parameters, body) - end - def self.PLAN(name, parameters, body) new(PlanDefinition, name, parameters, body, nil) end diff --git a/lib/puppet/pops/parser/lexer2.rb b/lib/puppet/pops/parser/lexer2.rb index 0a41fc34d00..c80ad123a76 100644 --- a/lib/puppet/pops/parser/lexer2.rb +++ b/lib/puppet/pops/parser/lexer2.rb @@ -134,10 +134,10 @@ class Lexer2 'type' => [:TYPE, 'type', 4], 'attr' => [:ATTR, 'attr', 4], 'private' => [:PRIVATE, 'private', 7], - 'application' => [:APPLICATION, 'application', 11], - 'consumes' => [:CONSUMES, 'consumes', 8], - 'produces' => [:PRODUCES, 'produces', 8], - 'site' => [:SITE, 'site', 4], + 'application' => [:APPLICATION, 'application', 11], # reserved + 'consumes' => [:CONSUMES, 'consumes', 8], # reserved + 'produces' => [:PRODUCES, 'produces', 8], # reserved + 'site' => [:SITE, 'site', 4], # reserved } KEYWORDS.each {|k,v| v[1].freeze; v.freeze } From cb8e58ab9433cc8ce4a6884aa871ff3d6c25c40b Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Thu, 3 Sep 2020 16:35:18 -0700 Subject: [PATCH 140/731] (PUP-10446) Remove application/site/capability resource kinds Remove the app orchestration related resource kinds: site, etc. Ignore export/consume metaparameters. Remove validation of app orchestration resources and relationships. Remove calls to CapabilityFinder. Running `puppet generate types` will continue to generate a `capability` attribute for the pcore model, but it will always be false. It will still support reading in pcore resource type models generated from older puppet versions, but will ignore the `capability` attribute. This way there are no compatibility issues between pcore models and puppet versions. --- lib/puppet/generate/models/type/type.rb | 5 +- .../relationship_validator.rb | 53 +++------ lib/puppet/parser/resource.rb | 69 ----------- .../evaluator/runtime3_resource_support.rb | 6 +- .../pops/resource/resource_type_impl.rb | 22 +--- lib/puppet/resource.rb | 27 +---- lib/puppet/resource/catalog.rb | 13 +-- lib/puppet/resource/type.rb | 107 +----------------- lib/puppet/resource/type_collection.rb | 51 +-------- lib/puppet/type.rb | 23 ---- .../integration/parser/pcore_resource_spec.rb | 37 ------ spec/unit/capability_spec.rb | 76 ------------- spec/unit/resource/type_collection_spec.rb | 24 +--- 13 files changed, 32 insertions(+), 481 deletions(-) delete mode 100644 spec/unit/capability_spec.rb diff --git a/lib/puppet/generate/models/type/type.rb b/lib/puppet/generate/models/type/type.rb index ce8a45930ff..245b9b13a06 100644 --- a/lib/puppet/generate/models/type/type.rb +++ b/lib/puppet/generate/models/type/type.rb @@ -49,7 +49,10 @@ def initialize(type) ] end] @isomorphic = type.isomorphic? - @capability = type.is_capability? + # continue to emit capability as false when rendering the ERB + # template, so that pcore modules generated prior to puppet7 can be + # read by puppet7 and vice-versa. + @capability = false end def render(template) diff --git a/lib/puppet/parser/compiler/catalog_validator/relationship_validator.rb b/lib/puppet/parser/compiler/catalog_validator/relationship_validator.rb index cac53698f7e..14109c179ad 100644 --- a/lib/puppet/parser/compiler/catalog_validator/relationship_validator.rb +++ b/lib/puppet/parser/compiler/catalog_validator/relationship_validator.rb @@ -1,6 +1,5 @@ class Puppet::Parser::Compiler - # Validator that asserts that only 'require', 'consume', and 'export' is used when declaring relationships - # to capability resources. + # Validator that asserts relationship metaparameters refer to valid resources class CatalogValidator::RelationshipValidator < CatalogValidator def validate catalog.resources.each do |resource| @@ -16,48 +15,24 @@ def validate private - # A hash lookup is 6x avg times faster than find among 3 values. - CAPABILITY_ACCEPTED_METAPARAMS = {:require => true, :consume => true, :export => true}.freeze - def validate_relationship(param) - # when relationship is to a capability - if has_capability?(param.value) - unless CAPABILITY_ACCEPTED_METAPARAMS[param.name] - raise CatalogValidationError.new( - _("'%{param}' is not a valid relationship to a capability") % { param: param.name }, - param.file, param.line) + # the referenced resource must exist + refs = param.value.is_a?(Array) ? param.value.flatten : [param.value] + refs.each do |r| + next if r.nil? || r == :undef + res = r.to_s + begin + found = catalog.resource(res) + rescue ArgumentError => e + # Raise again but with file and line information + raise CatalogValidationError.new(e.message, param.file, param.line) end - else - # all other relationships requires the referenced resource to exist - refs = param.value.is_a?(Array) ? param.value.flatten : [param.value] - refs.each do |r| - next if r.nil? || r == :undef - res = r.to_s - begin - found = catalog.resource(res) - rescue ArgumentError => e - # Raise again but with file and line information - raise CatalogValidationError.new(e.message, param.file, param.line) - end - unless found - msg = _("Could not find resource '%{res}' in parameter '%{param}'") % { res: res, param: param.name.to_s } - raise CatalogValidationError.new(msg, param.file, param.line) - end + unless found + msg = _("Could not find resource '%{res}' in parameter '%{param}'") % { res: res, param: param.name.to_s } + raise CatalogValidationError.new(msg, param.file, param.line) end end end - - def has_capability?(value) - case value - when Array - value.find { |v| has_capability?(v) } - when Puppet::Resource - rt = value.resource_type - !rt.nil? && rt.is_capability? - else - false - end - end end end diff --git a/lib/puppet/parser/resource.rb b/lib/puppet/parser/resource.rb index b50366b1a98..d4bb2156c9f 100644 --- a/lib/puppet/parser/resource.rb +++ b/lib/puppet/parser/resource.rb @@ -150,15 +150,6 @@ def isomorphic? end end - def is_unevaluated_consumer? - # We don't declare a new variable here just to test. Saves memory - instance_variable_defined?(:@unevaluated_consumer) - end - - def mark_unevaluated_consumer - @unevaluated_consumer = true - end - # Merge an override resource in. This will throw exceptions if # any overrides aren't allowed. def merge(resource) @@ -260,66 +251,6 @@ def raw_tagged?(tag_array) super || ((scope_resource = scope.resource) && !scope_resource.equal?(self) && scope_resource.raw_tagged?(tag_array)) end - # Fills resource params from a capability - # - # This backs 'consumes => Sql[one]' - # @api private - def add_parameters_from_consume - return if self[:consume].nil? - - map = {} - [ self[:consume] ].flatten.map do |ref| - # Assert that the ref really is a resource reference - raise Puppet::Error, _("Invalid consume in %{value0}: %{ref} is not a resource") % { value0: self.ref, ref: ref } unless ref.is_a?(Puppet::Resource) - - # Resolve references - t = ref.type - t = Puppet::Pops::Evaluator::Runtime3ResourceSupport.find_resource_type(scope, t) unless t == 'class' || t == 'node' - cap = catalog.resource(t, ref.title) - if cap.nil? - raise Puppet::Error, _("Resource %{ref} could not be found; it might not have been produced yet") % { ref: ref } - end - - # Ensure that the found resource is a capability resource - raise Puppet::Error, _("Invalid consume in %{ref}: %{cap} is not a capability resource") % { ref: ref, cap: cap } unless cap.resource_type.is_capability? - cap - end.each do |cns| - # Establish mappings - blueprint = resource_type.consumes.find do |bp| - bp[:capability] == cns.type - end - # @todo lutter 2015-08-03: catch this earlier, can we do this during - # static analysis ? - raise _("Resource %{res} tries to consume %{cns} but no 'consumes' mapping exists for %{resource_type} and %{cns_type}") % { res: self, cns: cns, resource_type: self.resource_type, cns_type: cns.type } unless blueprint - - # setup scope that has, for each attr of cns, a binding to cns[attr] - scope.with_global_scope do |global_scope| - cns_scope = global_scope.newscope(:source => self, :resource => self) - cns.to_hash.each { |name, value| cns_scope[name.to_s] = value } - - # evaluate mappings in that scope - resource_type.arguments.keys.each do |name| - expr = blueprint[:mappings][name] - if expr - # Explicit mapping - value = expr.safeevaluate(cns_scope) - else - value = cns[name] - end - unless value.nil? - # @todo lutter 2015-07-01: this should be caught by the checker - # much earlier. We consume several capres, at least two of which - # want to map to the same parameter (PUP-5080) - raise _("Attempt to reassign attribute '%{name}' in '%{resource}' caused by multiple consumed mappings to the same attribute") % { name: name, resource: self } if map[name] - map[name] = value - end - end - end - end - - map.each { |name, value| self[name] = value if self[name].nil? } - end - def offset nil end diff --git a/lib/puppet/pops/evaluator/runtime3_resource_support.rb b/lib/puppet/pops/evaluator/runtime3_resource_support.rb index 7220cf833b1..08dfb871777 100644 --- a/lib/puppet/pops/evaluator/runtime3_resource_support.rb +++ b/lib/puppet/pops/evaluator/runtime3_resource_support.rb @@ -19,7 +19,7 @@ def self.create_resources(file, line, scope, virtual, exported, type_name, resou # resolved type is just the string CLASS resolved_type = CLASS_STRING else - # resolve a resource type - pcore based, ruby impl, user defined, or application + # resolve a resource type - pcore based, ruby impl or user defined resolved_type = find_resource_type(scope, type_name) end @@ -109,10 +109,10 @@ def self.find_builtin_resource_type(scope, type_name) def self.find_defined_resource_type(scope, type_name) krt = scope.environment.known_resource_types - krt.find_definition(type_name) || krt.application(type_name) + krt.find_definition(type_name) end private_class_method :find_defined_resource_type end end -end \ No newline at end of file +end diff --git a/lib/puppet/pops/resource/resource_type_impl.rb b/lib/puppet/pops/resource/resource_type_impl.rb index bd04ba918d7..9ef2055467c 100644 --- a/lib/puppet/pops/resource/resource_type_impl.rb +++ b/lib/puppet/pops/resource/resource_type_impl.rb @@ -107,7 +107,7 @@ def initialize(name, properties = EMPTY_ARRAY, parameters = EMPTY_ARRAY, title_p @parameters = parameters @title_patterns_hash = title_patterns_hash @isomorphic = isomorphic - @capability = capability + # ignore capability parameter # Compute attributes hash # Compute key_names (possibly compound key if there are multiple name vars). @@ -175,10 +175,6 @@ def is_3x_ruby_plugin? false end - def is_capability? - @capability - end - # Answers if the parameter name is a parameter/attribute of this type # This is part of the Puppet::Type API # Check if used when compiling (it is triggered in an apply) @@ -243,22 +239,6 @@ def deprecate_params(title, attributes) # Param. end - ####################### - # UNSUPPORTED STUFF - ####################### - - # Applications are not supported - # - # @deprecated application orchestration will be removed in puppet 7 - def application? - false - end - - ############################ - # DON'T KNOW YET - ############################ - - ################################################## # NEVER CALLED COMPILE SIDE FOR A COMPILATION ################################################## diff --git a/lib/puppet/resource.rb b/lib/puppet/resource.rb index cff329c1531..a7de0a6d7ce 100644 --- a/lib/puppet/resource.rb +++ b/lib/puppet/resource.rb @@ -32,7 +32,6 @@ class Puppet::Resource ATTRIBUTES = [:file, :line, :exported].freeze TYPE_CLASS = 'Class'.freeze TYPE_NODE = 'Node'.freeze - TYPE_SITE = 'Site'.freeze PCORE_TYPE_KEY = '__ptype'.freeze VALUE_KEY = 'value'.freeze @@ -340,29 +339,6 @@ def resolve catalog ? catalog.resource(to_s) : nil end - # A resource is an application component if it exports or consumes - # one or more capabilities, or if it requires a capability resource - def is_application_component? - return true if ! export.empty? || self[:consume] - # Array(self[:require]) does not work for Puppet::Resource instances - req = self[:require] || [] - req = [ req ] unless req.is_a?(Array) - req.any? { |r| r.is_capability? } - end - - # A resource is a capability (instance) if its underlying type is a - # capability type - def is_capability? - !resource_type.nil? && resource_type.is_capability? - end - - # Returns the value of the 'export' metaparam as an Array - # @api private - def export - v = self[:export] || [] - v.is_a?(Array) ? v : [ v ] - end - # The resource's type implementation # @return [Puppet::Type, Puppet::Resource::Type] # @api private @@ -377,12 +353,11 @@ def self.resource_type(type, title, environment) case type when TYPE_CLASS; environment.known_resource_types.hostclass(title == :main ? "" : title) when TYPE_NODE; environment.known_resource_types.node(title) - when TYPE_SITE; environment.known_resource_types.site(nil) else result = Puppet::Type.type(type) if !result krt = environment.known_resource_types - result = krt.definition(type) || krt.application(type) + result = krt.definition(type) end result end diff --git a/lib/puppet/resource/catalog.rb b/lib/puppet/resource/catalog.rb index d4bde7cc786..ffbb52957a4 100644 --- a/lib/puppet/resource/catalog.rb +++ b/lib/puppet/resource/catalog.rb @@ -382,23 +382,12 @@ def resource(type, title = nil) result = @resource_table[title_key] if result.nil? # an instance has to be created in order to construct the unique key used when - # searching for aliases, or nothing is found as it is needed by the CapabilityFinder. + # searching for aliases res = Puppet::Resource.new(type, title, { :environment => @environment_instance }) # Must check with uniqueness key because of aliases or if resource transforms title in title # to attribute mappings. result = @resource_table[[type_name, res.uniqueness_key].flatten] - - if result.nil? - resource_type = res.resource_type - if resource_type && resource_type.is_capability? - # @todo lutter 2015-03-10: this assumes that it is legal to just - # mention a capability resource in code and have it automatically - # made available, even if the current component does not require it - result = Puppet::Resource::CapabilityFinder.find(environment, code_id, res) - add_resource(result) if result - end - end end result end diff --git a/lib/puppet/resource/type.rb b/lib/puppet/resource/type.rb index 2ce2e577a4d..93bde847f4b 100644 --- a/lib/puppet/resource/type.rb +++ b/lib/puppet/resource/type.rb @@ -11,16 +11,13 @@ class Puppet::Resource::Type include Puppet::Util::Warnings include Puppet::Util::Errors - # @deprecated application orchestration will be removed in puppet 7 (capability_mapping, application, site) - RESOURCE_KINDS = [:hostclass, :node, :definition, :capability_mapping, :application, :site] + RESOURCE_KINDS = [:hostclass, :node, :definition] # Map the names used in our documentation to the names used internally RESOURCE_KINDS_TO_EXTERNAL_NAMES = { :hostclass => "class", :node => "node", - :definition => "defined_type", - :application => "application", - :site => 'site' + :definition => "defined_type" } RESOURCE_EXTERNAL_NAMES_TO_KINDS = RESOURCE_KINDS_TO_EXTERNAL_NAMES.invert @@ -37,15 +34,6 @@ class Puppet::Resource::Type attr_accessor :file, :line, :doc, :code, :parent, :resource_type_collection attr_reader :namespace, :arguments, :behaves_like, :module_name - # The attributes 'produces' and 'consumes' are arrays of the blueprints - # of capabilities this type can produce/consume. The entries in the array - # are a fairly direct representation of what goes into produces/consumes - # clauses. Each entry is a hash with attributes - # :capability - the type name of the capres produced/consumed - # :mappings - a hash of attribute_name => Expression - # These two attributes are populated in - # PopsBridge::instantiate_CapabilityMapping - # Map from argument (aka parameter) names to Puppet Type # @return [Hash scope, :source => self) - - produced_resource.resource_type.parameters.each do |name| - next if name == :name - - expr = blueprint[:mappings][name.to_s] - if expr - produced_resource[name] = expr.safeevaluate(scope) - else - produced_resource[name] = scope[name.to_s] - end - end - # Tag the produced resource so we can later distinguish it from - # copies of the resource that wind up in the catalogs of nodes that - # use this resource. We tag the resource with producer:, - # meaning produced resources need to be unique within their - # environment - # @todo lutter 2014-11-13: we would really like to use a dedicated - # metadata field to indicate the producer of a resource, but that - # requires changes to PuppetDB and its API; so for now, we just use - # tagging - produced_resource.tag("producer:#{scope.catalog.environment}") - scope.catalog.add_resource(produced_resource) - produced_resource[:require] = resource.ref - produced_resource - end - end - # Now evaluate the code associated with this class or definition. def evaluate_code(resource) @@ -128,8 +69,6 @@ def evaluate_code(resource) resource.add_edge_to_stage - evaluate_produces(resource, scope) - if code if @match # Only bother setting up the ephemeral scope if there are match variables to add into it scope.with_guarded_scope do @@ -164,28 +103,6 @@ def initialize(type, name, options = {}) @module_name = options[:module_name] end - # @deprecated application orchestration will be removed in puppet 7 - def produces - @produces || EMPTY_ARRAY - end - - # @deprecated application orchestration will be removed in puppet 7 - def consumes - @consumes || EMPTY_ARRAY - end - - # @deprecated application orchestration will be removed in puppet 7 - def add_produces(blueprint) - @produces ||= [] - @produces << blueprint - end - - # @deprecated application orchestration will be removed in puppet 7 - def add_consumes(blueprint) - @consumes ||= [] - @consumes << blueprint - end - # This is only used for node names, and really only when the node name # is a regexp. def match(string) @@ -241,9 +158,6 @@ def ensure_in_catalog(scope, parameters=nil) :class when :node :node - when :site - # @deprecated application orchestration will be removed in puppet 7 - :site end # Do nothing if the resource already exists; this makes sure we don't @@ -310,7 +224,6 @@ def set_resource_parameters(resource, scope) caller_name = resource[:caller_module_name] || scope.parent_module_name scope[CALLER_MODULE_NAME] = caller_name unless caller_name.nil? - resource.add_parameters_from_consume inject_external_parameters(resource, scope) if @type == :hostclass @@ -373,7 +286,7 @@ def assign_defaults(resource, param_scope, scope) private :assign_defaults def validate_resource_hash(resource, resource_hash) - Puppet::Pops::Types::TypeMismatchDescriber.validate_parameters(resource.to_s, parameter_struct, resource_hash, resource.is_unevaluated_consumer?) + Puppet::Pops::Types::TypeMismatchDescriber.validate_parameters(resource.to_s, parameter_struct, resource_hash, false) end private :validate_resource_hash @@ -428,14 +341,6 @@ def set_argument_types(name_to_type_hash) end end - # Returns boolean true if an instance of this type is a capability. This - # implementation always returns false. This "duck-typing" interface is - # shared among other classes and makes it easier to detect capabilities - # when they are intermixed with non capability instances. - def is_capability? - false - end - private def convert_from_ast(name) @@ -500,12 +405,6 @@ def create_params_struct type_factory = Puppet::Pops::Types::TypeFactory members = { type_factory.optional(type_factory.string(NAME)) => type_factory.any } - if application? - resource_type = type_factory.type_type(type_factory.resource) - members[type_factory.string(NODES)] = type_factory.hash_of(type_factory.variant( - resource_type, type_factory.array_of(resource_type)), type_factory.type_type(type_factory.resource('node'))) - end - Puppet::Type.eachmetaparam do |name| # TODO: Once meta parameters are typed, this should change to reflect that type members[name.to_s] = type_factory.any diff --git a/lib/puppet/resource/type_collection.rb b/lib/puppet/resource/type_collection.rb index 001a9d79278..8d635596280 100644 --- a/lib/puppet/resource/type_collection.rb +++ b/lib/puppet/resource/type_collection.rb @@ -13,22 +13,16 @@ class Puppet::Resource::TypeCollection def clear @hostclasses.clear @definitions.clear - @applications.clear @nodes.clear @notfound.clear - @capability_mappings.clear - @sites.clear end def initialize(env) @environment = env @hostclasses = {} @definitions = {} - @capability_mappings = {} - @applications = {} @nodes = {} @notfound = {} - @sites = [] @lock = Puppet::Concurrent::Lock.new # So we can keep a list and match the first-defined regex @@ -45,10 +39,7 @@ def inspect "TypeCollection" + { :hostclasses => @hostclasses.keys, :definitions => @definitions.keys, - :nodes => @nodes.keys, - :capability_mappings => @capability_mappings.keys, - :applications => @applications.keys, - :site => @sites[0] # todo, could be just a binary, this dumps the entire body (good while developing) + :nodes => @nodes.keys }.inspect end @@ -71,7 +62,6 @@ def add_hostclass(instance) handle_hostclass_merge(instance) dupe_check(instance, @hostclasses) { |dupe| _("Class '%{klass}' is already defined%{error}; cannot redefine") % { klass: instance.name, error: dupe.error_context } } dupe_check(instance, @definitions) { |dupe| _("Definition '%{klass}' is already defined%{error}; cannot be redefined as a class") % { klass: instance.name, error: dupe.error_context } } - dupe_check(instance, @applications) { |dupe| _("Application '%{klass}' is already defined%{error}; cannot be redefined as a class") % { klass: instance.name, error: dupe.error_context } } @hostclasses[instance.name] = instance instance @@ -109,16 +99,6 @@ def add_node(instance) instance end - def add_site(instance) - dupe_check_singleton(instance, @sites) { |dupe| _("Site is already defined%{error}; cannot redefine") % { error: dupe.error_context } } - @sites << instance - instance - end - - def site(_) - @sites[0] - end - def loader @loader ||= Puppet::Parser::TypeLoader.new(environment) end @@ -149,38 +129,18 @@ def nodes? def add_definition(instance) dupe_check(instance, @hostclasses) { |dupe| _("'%{name}' is already defined%{error} as a class; cannot redefine as a definition") % { name: instance.name, error: dupe.error_context } } dupe_check(instance, @definitions) { |dupe| _("Definition '%{name}' is already defined%{error}; cannot be redefined") % { name: instance.name, error: dupe.error_context } } - dupe_check(instance, @applications) { |dupe| _("'%{name}' is already defined%{error} as an application; cannot be redefined") % { name: instance.name, error: dupe.error_context } } - @definitions[instance.name] = instance - end - def add_capability_mapping(instance) - dupe_check(instance, @capability_mappings) { |dupe| _("'%{name}' is already defined%{error} as a class; cannot redefine as a mapping") % { name: instance.name, error: dupe.error_context } } - @capability_mappings[instance.name] = instance + @definitions[instance.name] = instance end def definition(name) @definitions[munge_name(name)] end - def add_application(instance) - dupe_check(instance, @hostclasses) { |dupe| _("'%{name}' is already defined%{error} as a class; cannot redefine as an application") % { name: instance.name, error: dupe.error_context } } - dupe_check(instance, @definitions) { |dupe| _("'%{name}' is already defined%{error} as a definition; cannot redefine as an application") % { name: instance.name, error: dupe.error_context } } - dupe_check(instance, @applications) { |dupe| _("'%{name}' is already defined%{error} as an application; cannot be redefined") % { name: instance.name, error: dupe.error_context } } - @applications[instance.name] = instance - end - - def application(name) - @applications[munge_name(name)] - end - def find_node(name) @nodes[munge_name(name)] end - def find_site() - @sites[0] - end - def find_hostclass(name) find_or_load(name, :hostclass) end @@ -189,14 +149,9 @@ def find_definition(name) find_or_load(name, :definition) end - def find_application(name) - find_or_load(name, :application) - end - # TODO: This implementation is wasteful as it creates a copy on each request # - [:hostclasses, :nodes, :definitions, :capability_mappings, - :applications].each do |m| + [:hostclasses, :nodes, :definitions].each do |m| define_method(m) do instance_variable_get("@#{m}").dup end diff --git a/lib/puppet/type.rb b/lib/puppet/type.rb index 516b19fb570..a5b2c7a643f 100644 --- a/lib/puppet/type.rb +++ b/lib/puppet/type.rb @@ -114,29 +114,6 @@ class << self attr_reader :properties end - # Allow declaring that a type is actually a capability - class << self - # @deprecated application orchestration will be removed in puppet 7 - attr_accessor :is_capability - - # @deprecated application orchestration will be removed in puppet 7 - def is_capability? - c = is_capability - c.nil? ? false : c - end - end - - # Returns whether this type represents an application instance; since - # only defined types, i.e., instances of Puppet::Resource::Type can - # represent application instances, this implementation always returns - # +false+. Having this method though makes code checking whether a - # resource is an application instance simpler - # - # @deprecated application orchestration will be removed in puppet 7 - def self.application? - false - end - # Returns all the attribute names of the type in the appropriate order. # The {key_attributes} come first, then the {provider}, then the {properties}, and finally # the {parameters} and {metaparams}, diff --git a/spec/integration/parser/pcore_resource_spec.rb b/spec/integration/parser/pcore_resource_spec.rb index 1baa3e64981..c86b6e2b7b9 100644 --- a/spec/integration/parser/pcore_resource_spec.rb +++ b/spec/integration/parser/pcore_resource_spec.rb @@ -68,16 +68,6 @@ def self.title_patterns end end RUBY - 'cap.rb' => <<-EOF - module Puppet - Type.newtype(:cap, :is_capability => true) do - @doc = "Docs for capability" - @isomorphic = false - newproperty(:message) do - desc "Docs for 'message' property" - end - end;end - EOF } } }, } }}}) @@ -126,14 +116,10 @@ module Puppet test3 { 'x/y': message => 'x/y works' } - cap { 'c': - message => 'c works' - } MANIFEST expect(catalog.resource(:test1, "a")['message']).to eq('a works') expect(catalog.resource(:test2, "b")['message']).to eq('b works') expect(catalog.resource(:test3, "x/y")['message']).to eq('x/y works') - expect(catalog.resource(:cap, "c")['message']).to eq('c works') end it 'the validity of attribute names are checked' do @@ -158,20 +144,6 @@ module Puppet expect(catalog.resource(:test1, "a")['noop']).to eq(true) end - it 'capability is propagated to the catalog' do - genface.types - catalog = compile_to_catalog(<<-MANIFEST) - test2 { 'r': - message => 'a resource' - } - cap { 'c': - message => 'a cap' - } - MANIFEST - expect(catalog.resource(:test2, "r").is_capability?).to eq(false) - expect(catalog.resource(:cap, "c").is_capability?).to eq(true) - end - it 'a generated type describes if it is isomorphic' do generate_and_in_a_compilers_context do |compiler| t1 = find_resource_type(compiler.topscope, 'test1') @@ -181,15 +153,6 @@ module Puppet end end - it 'a generated type describes if it is a capability' do - generate_and_in_a_compilers_context do |compiler| - t1 = find_resource_type(compiler.topscope, 'test1') - expect(t1.is_capability?).to be(false) - t2 = find_resource_type(compiler.topscope, 'cap') - expect(t2.is_capability?).to be(true) - end - end - it 'a generated type returns parameters defined in pcore' do generate_and_in_a_compilers_context do |compiler| t1 = find_resource_type(compiler.topscope, 'test1') diff --git a/spec/unit/capability_spec.rb b/spec/unit/capability_spec.rb deleted file mode 100644 index a5c921298ff..00000000000 --- a/spec/unit/capability_spec.rb +++ /dev/null @@ -1,76 +0,0 @@ -require 'spec_helper' -require 'puppet_spec/compiler' - -describe 'Capability types' do - include PuppetSpec::Compiler - let(:env) { Puppet::Node::Environment.create(:testing, []) } - let(:node) { Puppet::Node.new('test', :environment => env) } - let(:loaders) { Puppet::Pops::Loaders.new(env) } - - before(:each) do - allow_any_instance_of(Puppet::Parser::Compiler).to receive(:loaders).and_return(loaders) - Puppet.push_context({:loaders => loaders, :current_environment => env}) - Puppet::Type.newtype :cap, :is_capability => true do - newparam :name - newparam :host - end - end - - after(:each) do - Puppet::Type.rmtype(:cap) - Puppet.pop_context() - end - - context 'annotations' do - it "raises a syntax error on 'produces'" do - expect { - compile_to_catalog(<<-MANIFEST, node) - define test($hostname) { - notify { "hostname ${hostname}":} - } - - Test produces Cap { - host => $hostname - } - MANIFEST - }.to raise_error(Puppet::ParseErrorWithIssue, /Syntax error at 'produces'/) - end - - it "raises a syntax error on 'consumes'" do - expect { - compile_to_catalog(<<-MANIFEST, node) - define test($hostname) { - notify { "hostname ${hostname}":} - } - - Test consumes Cap { - host => $hostname - } - MANIFEST - }.to raise_error(Puppet::ParseErrorWithIssue, /Syntax error at 'consumes'/) - end - end - - context 'capability metaparameters' do - def make_catalog(instance) - manifest = <<-MANIFEST - define test($hostname = nohost) { - notify { "hostname ${hostname}":} - } - MANIFEST - - compile_to_catalog(manifest + instance, node) - end - - ['export', 'consume'].each do |metaparam| - - it "validates that #{metaparam} metaparameter rejects values that are not resources" do - expect { make_catalog("test { one: #{metaparam} => 'hello' }") }.to raise_error(Puppet::Error, /not a resource/) - end - - it "validates that #{metaparam} metaparameter rejects resources that are not capability resources" do - expect { make_catalog("notify{hello:} test { one: #{metaparam} => Notify[hello] }") }.to raise_error(Puppet::Error, /not a capability resource/) - end - end - end -end diff --git a/spec/unit/resource/type_collection_spec.rb b/spec/unit/resource/type_collection_spec.rb index 4a858569742..d18f7461664 100644 --- a/spec/unit/resource/type_collection_spec.rb +++ b/spec/unit/resource/type_collection_spec.rb @@ -75,18 +75,16 @@ end.to raise_error(Puppet::ParseError, /cannot be redefined/) end - it "should remove all nodes, classes, definitions, and applications when cleared" do + it "should remove all nodes, classes and definitions when cleared" do loader = Puppet::Resource::TypeCollection.new(environment) loader.add Puppet::Resource::Type.new(:hostclass, "class") loader.add Puppet::Resource::Type.new(:definition, "define") loader.add Puppet::Resource::Type.new(:node, "node") - loader.add Puppet::Resource::Type.new(:application, "application") loader.clear expect(loader.hostclass("class")).to be_nil expect(loader.definition("define")).to be_nil expect(loader.node("node")).to be_nil - expect(loader.node("application")).to be_nil end describe "when looking up names" do @@ -155,7 +153,7 @@ end end - KINDS = %w{hostclass node definition application} + KINDS = %w{hostclass node definition} KINDS.each do |data| describe "behavior of add for #{data}" do @@ -178,24 +176,6 @@ it "should return nil when asked for a #{data} that has not been added" do expect(Puppet::Resource::TypeCollection.new(environment).send(data, "foo")).to be_nil end - - if data != "node" - it "should fail if an application with the same name is added" do - loader = Puppet::Resource::TypeCollection.new(environment) - instance = Puppet::Resource::Type.new(data, "foo") - application = Puppet::Resource::Type.new(:application, "foo") - loader.add(instance) - expect { loader.add(application) }.to raise_error(Puppet::ParseError, /redefine/) - end - - it "should fail if there is an application with the same name" do - loader = Puppet::Resource::TypeCollection.new(environment) - application = Puppet::Resource::Type.new(:application, "foo") - instance = Puppet::Resource::Type.new(data, "foo") - loader.add(instance) - expect { loader.add(application) }.to raise_error(Puppet::ParseError, /redefine/) - end - end end end From f60097cb15b4ec82f80ef6edee67ee9b424f8470 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Thu, 3 Sep 2020 16:40:34 -0700 Subject: [PATCH 141/731] (PUP-10446) Remove CapabilityFinder Remove the capability finder that calls out to puppetdb. --- lib/puppet/resource/capability_finder.rb | 154 ------------------- lib/puppet/resource/catalog.rb | 2 - spec/unit/resource/capability_finder_spec.rb | 143 ----------------- 3 files changed, 299 deletions(-) delete mode 100644 lib/puppet/resource/capability_finder.rb delete mode 100644 spec/unit/resource/capability_finder_spec.rb diff --git a/lib/puppet/resource/capability_finder.rb b/lib/puppet/resource/capability_finder.rb deleted file mode 100644 index d1a4307a112..00000000000 --- a/lib/puppet/resource/capability_finder.rb +++ /dev/null @@ -1,154 +0,0 @@ -# -# A helper module to look a capability up from PuppetDB -# -# @todo lutter 2015-03-10: determine whether this should be based on -# Puppet::Pops::Evaluator::Collectors, or at least use -# Puppet::Util::Puppetdb::Http - -require 'net/http' -require 'cgi' -require 'puppet/util/json' - -# @api private -module Puppet::Resource::CapabilityFinder - - # Looks up a capability resource from PuppetDB. Capability resources are - # required to be unique per environment and code id. If multiple copies of a - # capability resource are found, the one matching the current code id is - # used. - # - # @param environment [String] environment name - # @param code_id [String,nil] code_id of the catalog - # @param cap [Puppet::Resource] the capability resource type instance - # @return [Puppet::Resource,nil] The found capability resource or `nil` if it could not be found - def self.find(environment, code_id, cap) - unless Puppet::Util.const_defined?('Puppetdb') - #TRANSLATOR PuppetDB is a product name and should not be translated - raise Puppet::DevError, _('PuppetDB is not available') - end - - resources = search(nil, nil, cap) - - if resources.size > 1 - Puppet.debug "Found multiple resources when looking up capability #{cap}, filtering by environment #{environment}" - resources = resources.select { |r| r['tags'].any? { |t| t == "producer:#{environment}" } } - end - - if resources.empty? - Puppet.debug "Could not find capability resource #{cap} in PuppetDB" - elsif resources.size == 1 - resource_hash = resources.first - else - code_id_resource = disambiguate_by_code_id(environment, code_id, cap) - if code_id_resource - resource_hash = code_id_resource - else - #TRANSLATOR PuppetDB is a product name and should not be translated - message = _("Unexpected response from PuppetDB when looking up %{capability}:") % { capability: cap } - message += "\n" + _("expected exactly one resource but got %{count};") % { count: resources.size } - message += "\n" + _("returned data is:\n%{resources}") % { resources: resources.inspect } - raise Puppet::DevError, message - end - end - - if resource_hash - resource_hash['type'] = cap.resource_type - instantiate_resource(resource_hash) - end - end - - def self.search(environment, code_id, cap) - query_terms = [ - 'and', - ['=', 'type', cap.type.capitalize], - ['=', 'title', cap.title.to_s], - ] - - if environment.nil? - query_terms << ['~', 'tag', "^producer:"] - else - query_terms << ['=', 'tag', "producer:#{environment}"] - end - - unless code_id.nil? - query_terms << ['in', 'certname', - ['extract', 'certname', - ['select_catalogs', - ['=', 'code_id', code_id]]]] - end - - #TRANSLATOR PuppetDB is a product name and should not be translated - Puppet.notice _("Looking up capability %{capability} in PuppetDB: %{query_terms}") % { capability: cap, query_terms: query_terms } - - query_puppetdb(query_terms) - end - - def self.query_puppetdb(query) - begin - # If using PuppetDB >= 4, use the API method query_puppetdb() - result = if Puppet::Util::Puppetdb.respond_to?(:query_puppetdb) - # PuppetDB 4 uses a unified query endpoint, so we have to specify what we're querying - Puppet::Util::Puppetdb.query_puppetdb(["from", "resources", query]) - # For PuppetDB < 4, use the old internal method action() - else - url = "/pdb/query/v4/resource?query=#{Puppet::Util.uri_query_encode(query.to_json)}" - response = Puppet::Util::Puppetdb::Http.action(url) do |conn, uri| - conn.get(uri, { 'Accept' => 'application/json'}) - end - Puppet::Util::Json.load(response.body) - end - - # The format of the response body is documented at - # https://puppet.com/docs/puppetdb/3.0/api/query/v4/resources.html#response-format - unless result.is_a?(Array) - #TRANSLATOR PuppetDB is a product name and should not be translated - raise Puppet::DevError, _("Unexpected response from PuppetDB when looking up %{capability}: expected an Array but got %{result}") % - { capability: cap, result: result.inspect } - end - - result - rescue Puppet::Util::Json::ParseError => e - #TRANSLATOR PuppetDB is a product name and should not be translated - raise Puppet::DevError, _("Invalid JSON from PuppetDB when looking up %{capability}\n%{detail}") % { capability: cap, detail: e } - end - end - - # Find a distinct copy of the given capability resource by searching for only - # resources matching the given code_id. Returns `nil` if no code_id is - # supplied or if there isn't exactly one matching resource. - # - # @param environment [String] environment name - # @param code_id [String,nil] code_id of the catalog - # @param cap [Puppet::Resource] the capability resource type instance - def self.disambiguate_by_code_id(environment, code_id, cap) - if code_id - Puppet.debug "Found multiple resources when looking up capability #{cap}, filtering by code id #{code_id}" - resources = search(environment, code_id, cap) - - if resources.size > 1 - Puppet.debug "Found multiple resources matching code id #{code_id} when looking up #{cap}" - nil - else - resources.first - end - end - end - private_class_method :disambiguate_by_code_id - - def self.instantiate_resource(resource_hash) - real_type = resource_hash['type'] - resource = Puppet::Resource.new(real_type, resource_hash['title']) - real_type.parameters.each do |param| - param = param.to_s - next if param == 'name' - value = resource_hash['parameters'][param] - if value - resource[param] = value - else - Puppet.debug "No capability value for #{resource}->#{param}" - end - end - return resource - end - private_class_method :instantiate_resource -end diff --git a/lib/puppet/resource/catalog.rb b/lib/puppet/resource/catalog.rb index ffbb52957a4..8823f535927 100644 --- a/lib/puppet/resource/catalog.rb +++ b/lib/puppet/resource/catalog.rb @@ -5,8 +5,6 @@ require 'puppet/graph' require 'securerandom' -require 'puppet/resource/capability_finder' - # This class models a node catalog. It is the thing meant to be passed # from server to client, and it contains all of the information in the # catalog, including the resources and the relationships between them. diff --git a/spec/unit/resource/capability_finder_spec.rb b/spec/unit/resource/capability_finder_spec.rb deleted file mode 100644 index 4fcdc10718f..00000000000 --- a/spec/unit/resource/capability_finder_spec.rb +++ /dev/null @@ -1,143 +0,0 @@ -require 'spec_helper' -require_relative '../pops/parser/parser_rspec_helper' -require 'puppet/resource/capability_finder' - -describe Puppet::Resource::CapabilityFinder do - context 'when PuppetDB is not configured' do - it 'should error' do - expect(Puppet::Util).to receive(:const_defined?).with('Puppetdb').and_return(false) - expect { Puppet::Resource::CapabilityFinder.find('production', nil, nil) }.to raise_error(/PuppetDB is not available/) - end - end - - context 'when PuppetDB is configured' do - before(:each) do - allow_any_instance_of(Puppet::Parser::Compiler).to receive(:loaders).and_return(loaders) - Puppet.push_context({:loaders => loaders, :current_environment => env}) - if mock_pdb - module Puppet::Util::Puppetdb - class Http; end - end - end - make_cap_type - end - - after(:each) do - Puppet::Util.send(:remove_const, 'Puppetdb') if mock_pdb - Puppet::Type.rmtype(:cap) - Puppet.pop_context() - end - - let(:mock_pdb) { !Puppet::Util.const_defined?('Puppetdb') } - let(:env) { Puppet::Node::Environment.create(:testing, []) } - let(:loaders) { Puppet::Pops::Loaders.new(env) } - - let(:response_body) { [{"type"=>"Cap", "title"=>"cap", "parameters"=>{"host"=>"ahost"}}] } - let(:response) { double('response', :body => response_body.to_json) } - - def make_cap_type - Puppet::Type.newtype :cap, :is_capability => true do - newparam :name - newparam :host - end - end - - describe "when query_puppetdb method is available" do - it 'should call use the query_puppetdb method if available' do - expect(Puppet::Util::Puppetdb).to receive(:query_puppetdb).and_return(response_body) - expect(Puppet::Util::Puppetdb::Http).not_to receive(:action) - - result = Puppet::Resource::CapabilityFinder.find('production', nil, Puppet::Resource.new('Cap', 'cap')) - expect(result['host']).to eq('ahost') - end - end - - describe "when query_puppetdb method is unavailable" do - before :each do - allow(Puppet::Util::Puppetdb).to receive(:respond_to?).with(:query_puppetdb).and_return(false) - end - - it 'should call Puppet::Util::PuppetDB::Http.action' do - expect(Puppet::Util::Puppetdb::Http).to receive(:action).and_return(response) - result = Puppet::Resource::CapabilityFinder.find('production', nil, Puppet::Resource.new('Cap', 'cap')) - expect(result['host']).to eq('ahost') - end - end - - describe '#find' do - let(:capability) { Puppet::Resource.new('Cap', 'cap') } - let(:code_id) { 'b59e5df0578ef411f773ee6c33d8073c50e7b8fe' } - - it 'should search for the resource without including code_id or environment' do - resources = [{"type"=>"Cap", "title"=>"cap", "parameters"=>{"host"=>"ahost"}}] - allow(Puppet::Resource::CapabilityFinder).to receive(:search).with(nil, nil, capability).and_return(resources) - - result = Puppet::Resource::CapabilityFinder.find('production', code_id, Puppet::Resource.new('Cap', 'cap')) - expect(result['host']).to eq('ahost') - end - - it 'should return nil if no resource is found' do - allow(Puppet::Resource::CapabilityFinder).to receive(:search).with(nil, nil, capability).and_return([]) - - result = Puppet::Resource::CapabilityFinder.find('production', code_id, capability) - expect(result).to be_nil - end - - describe 'when multiple results are returned for different environments' do - let(:resources) do - [{"type"=>"Cap", "title"=>"cap", "parameters"=>{"host"=>"ahost"}, "tags"=>["producer:production"]}, - {"type"=>"Cap", "title"=>"cap", "parameters"=>{"host"=>"bhost"}, "tags"=>["producer:other_env"]}] - end - - before :each do - allow(Puppet::Resource::CapabilityFinder).to receive(:search).with(nil, nil, capability).and_return(resources) - end - - it 'should return the resource matching environment' do - result = Puppet::Resource::CapabilityFinder.find('production', code_id, capability) - expect(result['host']).to eq('ahost') - end - - it 'should return nil if no resource matches environment' do - result = Puppet::Resource::CapabilityFinder.find('bad_env', code_id, capability) - expect(result).to be_nil - end - end - - describe 'when multiple results are returned for the same environment' do - let(:resources) do - [{"type"=>"Cap", "title"=>"cap", "parameters"=>{"host"=>"ahost"}, "tags"=>["producer:production"]}, - {"type"=>"Cap", "title"=>"cap", "parameters"=>{"host"=>"bhost"}, "tags"=>["producer:production"]}] - end - - before :each do - allow(Puppet::Resource::CapabilityFinder).to receive(:search).with(nil, nil, capability).and_return(resources) - end - - it 'should return the resource matching code_id' do - allow(Puppet::Resource::CapabilityFinder).to receive(:search).with('production', code_id, capability).and_return([{"type"=>"Cap", "title"=>"cap", "parameters"=>{"host"=>"chost"}}]) - - result = Puppet::Resource::CapabilityFinder.find('production', code_id, capability) - expect(result['host']).to eq('chost') - end - - it 'should fail if no resource matches code_id' do - allow(Puppet::Resource::CapabilityFinder).to receive(:search).with('production', code_id, capability).and_return([]) - - expect { Puppet::Resource::CapabilityFinder.find('production', code_id, capability) }.to raise_error(Puppet::Error, /expected exactly one resource but got 2/) - end - - it 'should fail if multiple resources match code_id' do - allow(Puppet::Resource::CapabilityFinder).to receive(:search).with('production', code_id, capability).and_return(resources) - - expect { Puppet::Resource::CapabilityFinder.find('production', code_id, capability) }.to raise_error(Puppet::DevError, /expected exactly one resource but got 2/) - end - - it 'should fail if no code_id was specified' do - allow(Puppet::Resource::CapabilityFinder).to receive(:search).with('production', nil, capability).and_return(resources) - expect { Puppet::Resource::CapabilityFinder.find('production', nil, capability) }.to raise_error(Puppet::DevError, /expected exactly one resource but got 2/) - end - end - end - end -end From 7ef08112c9e2fc29480c6d97446bb9df25bd9c30 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Thu, 3 Sep 2020 16:42:58 -0700 Subject: [PATCH 142/731] (PUP-10446) Remove export & consume metaparameters --- .../pops/resource/resource_type_impl.rb | 4 +- lib/puppet/type.rb | 53 ------------------- 2 files changed, 1 insertion(+), 56 deletions(-) diff --git a/lib/puppet/pops/resource/resource_type_impl.rb b/lib/puppet/pops/resource/resource_type_impl.rb index 9ef2055467c..a32cf9d626f 100644 --- a/lib/puppet/pops/resource/resource_type_impl.rb +++ b/lib/puppet/pops/resource/resource_type_impl.rb @@ -87,9 +87,7 @@ def <=>(other) :subscribe, :before, :notify, - :stage, - :export, - :consume + :stage ].freeze # Speed up lookup diff --git a/lib/puppet/type.rb b/lib/puppet/type.rb index a5b2c7a643f..4e8253ab1dd 100644 --- a/lib/puppet/type.rb +++ b/lib/puppet/type.rb @@ -1697,59 +1697,6 @@ class { 'apt-updates': } end - # @deprecated application orchestration will be removed in puppet 7 - newmetaparam(:export, :parent => RelationshipMetaparam, :attributes => {:direction => :out, :events => :NONE}) do - desc < Http[main_server] -} -EOS - end - - # @deprecated application orchestration will be removed in puppet 7 - newmetaparam(:consume, :parent => RelationshipMetaparam, :attributes => {:direction => :in, :events => :NONE}) do - desc < Sql[my_db] -} -EOS -end - ############################### # All of the provider plumbing for the resource types. require 'puppet/provider' From 8bdaaecdce07c943e9ee0fc3ef3deb717450003f Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Thu, 3 Sep 2020 17:05:16 -0700 Subject: [PATCH 143/731] (PUP-10446) Remove usages of Site, Application, CapabilityMapping models --- lib/puppet/pops/model/factory.rb | 19 ---------- lib/puppet/pops/model/model_label_provider.rb | 3 -- lib/puppet/pops/model/model_tree_dumper.rb | 18 --------- lib/puppet/pops/model/pn_transformer.rb | 12 ------ lib/puppet/pops/validation/checker4_0.rb | 37 ------------------- lib/puppet/pops/validation/tasks_checker.rb | 12 ------ 6 files changed, 101 deletions(-) diff --git a/lib/puppet/pops/model/factory.rb b/lib/puppet/pops/model/factory.rb index 3d65418d0fc..26a35d04303 100644 --- a/lib/puppet/pops/model/factory.rb +++ b/lib/puppet/pops/model/factory.rb @@ -120,13 +120,6 @@ def interpolate() # Building of Model classes - def build_Application(o, n, ps, body) - @init_hash[KEY_NAME] = n - @init_hash[KEY_PARAMETERS] = ps - b = f_build_body(body) - @init_hash[KEY_BODY] = b unless b.nil? - end - def build_ArithmeticExpression(o, op, a, b) @init_hash[KEY_OPERATOR] = op build_BinaryExpression(o, a, b) @@ -387,13 +380,6 @@ def build_PlanDefinition(o, name, parameters, body, return_type=nil) @init_hash['return_type'] = return_type unless return_type.nil? end - def build_CapabilityMapping(o, kind, component, capability, mappings) - @init_hash['kind'] = kind - @init_hash['component'] = component - @init_hash['capability'] = capability - @init_hash['mappings'] = mappings - end - def build_NodeDefinition(o, hosts, parent, body) @init_hash['host_matches'] = hosts @init_hash['parent'] = parent unless parent.nil? # no nop here @@ -401,11 +387,6 @@ def build_NodeDefinition(o, hosts, parent, body) @init_hash[KEY_BODY] = b unless b.nil? end - def build_SiteDefinition(o, body) - b = f_build_body(body) - @init_hash[KEY_BODY] = b unless b.nil? - end - def build_Parameter(o, name, expr) @init_hash[KEY_NAME] = name @init_hash[KEY_VALUE] = expr diff --git a/lib/puppet/pops/model/model_label_provider.rb b/lib/puppet/pops/model/model_label_provider.rb index 7ba062a1c5e..8cff6736bc6 100644 --- a/lib/puppet/pops/model/model_label_provider.rb +++ b/lib/puppet/pops/model/model_label_provider.rb @@ -63,7 +63,6 @@ def label_HostClassDefinition o ; "Host Class Definition" en def label_FunctionDefinition o ; "Function Definition" end def label_PlanDefinition o ; "Plan Definition" end def label_NodeDefinition o ; "Node Definition" end - def label_SiteDefinition o ; "Site Definition" end def label_ResourceTypeDefinition o ; "'define' expression" end def label_ResourceOverrideExpression o ; "Resource Override" end def label_Parameter o ; "Parameter Definition" end @@ -73,7 +72,6 @@ def label_UnlessExpression o ; "'unless' Statement" en def label_CallNamedFunctionExpression o ; "Function Call" end def label_CallMethodExpression o ; "Method call" end def label_ApplyExpression o ; "'apply' expression" end - def label_CapabilityMapping o ; "Capability Mapping" end def label_CaseExpression o ; "'case' statement" end def label_CaseOption o ; "Case Option" end def label_RenderStringExpression o ; "Epp Text" end @@ -100,7 +98,6 @@ def label_TypeAlias o ; "Type Alias" en def label_TypeMapping o ; "Type Mapping" end def label_TypeDefinition o ; "Type Definition" end def label_Binary o ; "Binary" end - def label_Application o ; "Application" end def label_Sensitive o ; "Sensitive" end def label_Timestamp o ; "Timestamp" end def label_Timespan o ; "Timespan" end diff --git a/lib/puppet/pops/model/model_tree_dumper.rb b/lib/puppet/pops/model/model_tree_dumper.rb index 58a45fb2b63..f1c59453477 100644 --- a/lib/puppet/pops/model/model_tree_dumper.rb +++ b/lib/puppet/pops/model/model_tree_dumper.rb @@ -37,10 +37,6 @@ def dump_Factory o do_dump(o.model) end - def dump_Application o - ["application", o.name, do_dump(o.parameters), do_dump(o.body)] - end - def dump_ArithmeticExpression o [o.operator.to_s, do_dump(o.left_expr), do_dump(o.right_expr)] end @@ -251,16 +247,6 @@ def dump_NodeDefinition o result end - def dump_SiteDefinition o - result = ["site"] - if o.body - result << do_dump(o.body) - else - result << [] - end - result - end - def dump_NamedDefinition o # the nil must be replaced with a string result = [nil, o.name] @@ -291,10 +277,6 @@ def dump_ResourceTypeDefinition o result end - def dump_CapabilityMapping o - [o.kind, do_dump(o.component), o.capability, do_dump(o.mappings)] - end - def dump_ResourceOverrideExpression o form = o.form == 'regular' ? '' : o.form + '-' result = [form+'override', do_dump(o.resources), :indent] diff --git a/lib/puppet/pops/model/pn_transformer.rb b/lib/puppet/pops/model/pn_transformer.rb index ad50653b35f..6d46efdaa88 100644 --- a/lib/puppet/pops/model/pn_transformer.rb +++ b/lib/puppet/pops/model/pn_transformer.rb @@ -27,10 +27,6 @@ def transform_AndExpression(e) binary_op(e, 'and') end - def transform_Application(e) - definition_to_pn(e, 'application') - end - def transform_ArithmeticExpression(e) binary_op(e, e.operator) end @@ -67,10 +63,6 @@ def transform_CallNamedFunctionExpression(e) call_to_pn(e, 'call', 'invoke') end - def transform_CapabilityMapping(e) - PN::Call.new(e.kind, transform(e.component), PN::List.new([PN::Literal.new(e.capability)] + pn_array(e.mappings))) - end - def transform_CaseExpression(e) PN::Call.new('case', transform(e.test), transform(e.options)) end @@ -293,10 +285,6 @@ def transform_SelectorExpression(e) PN::Call.new('?', transform(e.left_expr), transform(e.selectors)) end - def transform_SiteDefinition(e) - transform(e.body).as_call('site') - end - def transform_TextExpression(e) PN::Call.new('str', transform(e.expr)) end diff --git a/lib/puppet/pops/validation/checker4_0.rb b/lib/puppet/pops/validation/checker4_0.rb index 79c7479227b..791e480d4b0 100644 --- a/lib/puppet/pops/validation/checker4_0.rb +++ b/lib/puppet/pops/validation/checker4_0.rb @@ -199,11 +199,6 @@ def check_AccessExpression(o) end end - def check_Application(o) - check_NamedDefinition(o) - acceptor.accept(Issues::DEPRECATED_APP_ORCHESTRATION, o, {:klass => o}) - end - def check_AssignmentExpression(o) case o.operator when '=' @@ -241,7 +236,6 @@ def check_AttributesOperation(o) case p when Model::AbstractResource when Model::CollectExpression - when Model::CapabilityMapping acceptor.accept(Issues::UNSUPPORTED_OPERATOR_IN_CONTEXT, p, :operator=>'* =>') else # protect against just testing a snippet that has no parent, error message will be a bit strange @@ -300,33 +294,6 @@ def check_CallNamedFunctionExpression(o) end end - def check_CapabilityMapping(o) - acceptor.accept(Issues::DEPRECATED_APP_ORCHESTRATION, o, {:klass => o}) - ok = - case o.component - when Model::QualifiedReference - name = o.component.cased_value - acceptor.accept(Issues::ILLEGAL_CLASSREF, o.component, {:name=>name}) unless name =~ Patterns::CLASSREF_EXT - true - when Model::AccessExpression - keys = o.component.keys - expr = o.component.left_expr - if expr.is_a?(Model::QualifiedReference) && keys.size == 1 - key = keys[0] - key.is_a?(Model::LiteralString) || key.is_a?(Model::QualifiedName) || key.is_a?(Model::QualifiedReference) - else - false - end - else - false - end - acceptor.accept(Issues::ILLEGAL_EXPRESSION, o.component, :feature=>'capability mapping', :container => o) unless ok - - if o.capability !~ Patterns::CLASSREF_EXT - acceptor.accept(Issues::ILLEGAL_CLASSREF, o, {:name=>o.capability}) - end - end - def check_EppExpression(o) p = container if p.is_a?(Model::LambdaExpression) @@ -875,10 +842,6 @@ def check_SelectorEntry(o) rvalue(o.matching_expr) end - def check_SiteDefinition(o) - acceptor.accept(Issues::DEPRECATED_APP_ORCHESTRATION, o, {:klass => o}) - end - def check_UnaryExpression(o) rvalue(o.expr) end diff --git a/lib/puppet/pops/validation/tasks_checker.rb b/lib/puppet/pops/validation/tasks_checker.rb index 1de2ed564c9..a1e93924e8f 100644 --- a/lib/puppet/pops/validation/tasks_checker.rb +++ b/lib/puppet/pops/validation/tasks_checker.rb @@ -13,14 +13,6 @@ def in_ApplyExpression? end end - def check_Application(o) - illegalTasksExpression(o) - end - - def check_CapabilityMapping(o) - illegalTasksExpression(o) - end - def check_CollectExpression(o) # Only virtual resource queries are allowed in apply blocks, not exported # resource queries @@ -83,10 +75,6 @@ def check_ResourceTypeDefinition(o) illegalTasksExpression(o) end - def check_SiteDefinition(o) - illegalTasksExpression(o) - end - def check_ApplyExpression(o) if in_ApplyExpression? acceptor.accept(Issues::EXPRESSION_NOT_SUPPORTED_WHEN_COMPILING, o, {:klass => o}) From 20fcd0d5d3d347c1dfb17deab39d326eebed1b76 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Thu, 3 Sep 2020 17:08:16 -0700 Subject: [PATCH 144/731] (PUP-10446) Remove Site, Application, CapabilityMapping models --- lib/puppet/pops/model/ast.pp | 24 ----- lib/puppet/pops/model/ast.rb | 193 ----------------------------------- 2 files changed, 217 deletions(-) diff --git a/lib/puppet/pops/model/ast.pp b/lib/puppet/pops/model/ast.pp index e8bdecd9450..ad0dfcd0808 100644 --- a/lib/puppet/pops/model/ast.pp +++ b/lib/puppet/pops/model/ast.pp @@ -276,9 +276,6 @@ ResourceTypeDefinition => Object[{ parent => NamedDefinition }], - Application => Object[{ - parent => NamedDefinition - }], QRefDefinition => Object[{ parent => Definition, attributes => { @@ -334,15 +331,6 @@ } } }], - SiteDefinition => Object[{ - parent => Definition, - attributes => { - 'body' => { - type => Optional[Expression], - value => undef - } - } - }], HeredocExpression => Object[{ parent => Expression, attributes => { @@ -598,18 +586,6 @@ } } }], - CapabilityMapping => Object[{ - parent => Definition, - attributes => { - 'kind' => String, - 'capability' => String, - 'component' => Expression, - 'mappings' => { - type => Array[AbstractAttributeOperation], - value => [] - } - } - }], ResourceDefaultsExpression => Object[{ parent => AbstractResource, attributes => { diff --git a/lib/puppet/pops/model/ast.rb b/lib/puppet/pops/model/ast.rb index a880442acb2..75da1240d90 100644 --- a/lib/puppet/pops/model/ast.rb +++ b/lib/puppet/pops/model/ast.rb @@ -2055,32 +2055,6 @@ def _pcore_all_contents(path, &block) end end -class Application < NamedDefinition - def self._pcore_type - @_pcore_type ||= Types::PObjectType.new('Puppet::AST::Application', { - 'parent' => NamedDefinition._pcore_type - }) - end - - def _pcore_contents - @parameters.each { |value| yield(value) } - yield(@body) unless @body.nil? - end - - def _pcore_all_contents(path, &block) - path << self - @parameters.each do |value| - block.call(value, path) - value._pcore_all_contents(path, &block) - end - unless @body.nil? - block.call(@body, path) - @body._pcore_all_contents(path, &block) - end - path.pop - end -end - class QRefDefinition < Definition def self._pcore_type @_pcore_type ||= Types::PObjectType.new('Puppet::AST::QRefDefinition', { @@ -2466,75 +2440,6 @@ def eql?(o) alias == eql? end -class SiteDefinition < Definition - def self._pcore_type - @_pcore_type ||= Types::PObjectType.new('Puppet::AST::SiteDefinition', { - 'parent' => Definition._pcore_type, - 'attributes' => { - 'body' => { - 'type' => Types::POptionalType.new(Expression._pcore_type), - 'value' => nil - } - } - }) - end - - def self.from_hash(init_hash) - from_asserted_hash(Types::TypeAsserter.assert_instance_of('Puppet::AST::SiteDefinition initializer', _pcore_type.init_hash_type, init_hash)) - end - - def self.from_asserted_hash(init_hash) - new( - init_hash['locator'], - init_hash['offset'], - init_hash['length'], - init_hash['body']) - end - - def self.create(locator, offset, length, body = nil) - ta = Types::TypeAsserter - attrs = _pcore_type.attributes(true) - ta.assert_instance_of('Puppet::AST::Positioned[locator]', attrs['locator'].type, locator) - ta.assert_instance_of('Puppet::AST::Positioned[offset]', attrs['offset'].type, offset) - ta.assert_instance_of('Puppet::AST::Positioned[length]', attrs['length'].type, length) - ta.assert_instance_of('Puppet::AST::SiteDefinition[body]', attrs['body'].type, body) - new(locator, offset, length, body) - end - - attr_reader :body - - def initialize(locator, offset, length, body = nil) - super(locator, offset, length) - @hash = @hash ^ body.hash - @body = body - end - - def _pcore_init_hash - result = super - result['body'] = @body unless @body == nil - result - end - - def _pcore_contents - yield(@body) unless @body.nil? - end - - def _pcore_all_contents(path, &block) - path << self - unless @body.nil? - block.call(@body, path) - @body._pcore_all_contents(path, &block) - end - path.pop - end - - def eql?(o) - super && - @body.eql?(o.body) - end - alias == eql? -end - class HeredocExpression < Expression def self._pcore_type @_pcore_type ||= Types::PObjectType.new('Puppet::AST::HeredocExpression', { @@ -4188,101 +4093,6 @@ def eql?(o) alias == eql? end -class CapabilityMapping < Definition - def self._pcore_type - @_pcore_type ||= Types::PObjectType.new('Puppet::AST::CapabilityMapping', { - 'parent' => Definition._pcore_type, - 'attributes' => { - 'kind' => Types::PStringType::DEFAULT, - 'capability' => Types::PStringType::DEFAULT, - 'component' => Expression._pcore_type, - 'mappings' => { - 'type' => Types::PArrayType.new(AbstractAttributeOperation._pcore_type), - 'value' => [] - } - } - }) - end - - def self.from_hash(init_hash) - from_asserted_hash(Types::TypeAsserter.assert_instance_of('Puppet::AST::CapabilityMapping initializer', _pcore_type.init_hash_type, init_hash)) - end - - def self.from_asserted_hash(init_hash) - new( - init_hash['locator'], - init_hash['offset'], - init_hash['length'], - init_hash['kind'], - init_hash['capability'], - init_hash['component'], - init_hash.fetch('mappings') { _pcore_type['mappings'].value }) - end - - def self.create(locator, offset, length, kind, capability, component, mappings = _pcore_type['mappings'].value) - ta = Types::TypeAsserter - attrs = _pcore_type.attributes(true) - ta.assert_instance_of('Puppet::AST::Positioned[locator]', attrs['locator'].type, locator) - ta.assert_instance_of('Puppet::AST::Positioned[offset]', attrs['offset'].type, offset) - ta.assert_instance_of('Puppet::AST::Positioned[length]', attrs['length'].type, length) - ta.assert_instance_of('Puppet::AST::CapabilityMapping[kind]', attrs['kind'].type, kind) - ta.assert_instance_of('Puppet::AST::CapabilityMapping[capability]', attrs['capability'].type, capability) - ta.assert_instance_of('Puppet::AST::CapabilityMapping[component]', attrs['component'].type, component) - ta.assert_instance_of('Puppet::AST::CapabilityMapping[mappings]', attrs['mappings'].type, mappings) - new(locator, offset, length, kind, capability, component, mappings) - end - - attr_reader :kind - attr_reader :capability - attr_reader :component - attr_reader :mappings - - def initialize(locator, offset, length, kind, capability, component, mappings = _pcore_type['mappings'].value) - super(locator, offset, length) - @hash = @hash ^ kind.hash ^ capability.hash ^ component.hash ^ mappings.hash - @kind = kind - @capability = capability - @component = component - @mappings = mappings - end - - def _pcore_init_hash - result = super - result['kind'] = @kind - result['capability'] = @capability - result['component'] = @component - result['mappings'] = @mappings unless _pcore_type['mappings'].default_value?(@mappings) - result - end - - def _pcore_contents - yield(@component) unless @component.nil? - @mappings.each { |value| yield(value) } - end - - def _pcore_all_contents(path, &block) - path << self - unless @component.nil? - block.call(@component, path) - @component._pcore_all_contents(path, &block) - end - @mappings.each do |value| - block.call(value, path) - value._pcore_all_contents(path, &block) - end - path.pop - end - - def eql?(o) - super && - @kind.eql?(o.kind) && - @capability.eql?(o.capability) && - @component.eql?(o.component) && - @mappings.eql?(o.mappings) - end - alias == eql? -end - class ResourceDefaultsExpression < AbstractResource def self._pcore_type @_pcore_type ||= Types::PObjectType.new('Puppet::AST::ResourceDefaultsExpression', { @@ -4799,13 +4609,11 @@ def self.register_pcore_types Model::NamedDefinition, Model::FunctionDefinition, Model::ResourceTypeDefinition, - Model::Application, Model::QRefDefinition, Model::TypeAlias, Model::TypeMapping, Model::TypeDefinition, Model::NodeDefinition, - Model::SiteDefinition, Model::HeredocExpression, Model::HostClassDefinition, Model::PlanDefinition, @@ -4839,7 +4647,6 @@ def self.register_pcore_types Model::ResourceBody, Model::AbstractResource, Model::ResourceExpression, - Model::CapabilityMapping, Model::ResourceDefaultsExpression, Model::ResourceOverrideExpression, Model::SelectorEntry, From 1c2358db20cdd5c8bc648af2abbdc98a9aad22c5 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Fri, 4 Sep 2020 12:41:54 -0700 Subject: [PATCH 145/731] (PUP-10446) Remove unused app orchestration issue --- lib/puppet/pops/issues.rb | 5 ----- lib/puppet/pops/validation/validator_factory_4_0.rb | 1 - 2 files changed, 6 deletions(-) diff --git a/lib/puppet/pops/issues.rb b/lib/puppet/pops/issues.rb index 8da3f74d56f..27a81a84372 100644 --- a/lib/puppet/pops/issues.rb +++ b/lib/puppet/pops/issues.rb @@ -920,10 +920,5 @@ def self.hard_issue(issue_code, *args, &block) LOADER_FAILURE = issue :LOADER_FAILURE, :type do _('Failed to load: %{type_name}') % { type: type } end - - DEPRECATED_APP_ORCHESTRATION = issue :DEPRECATED_APP_ORCHESTRATION, :klass do - _("Use of the application-orchestration %{expr} is deprecated. See https://puppet.com/docs/puppet/5.5/deprecated_language.html" % { expr: label(klass) }) - end - end end diff --git a/lib/puppet/pops/validation/validator_factory_4_0.rb b/lib/puppet/pops/validation/validator_factory_4_0.rb index 1e585c4dba5..82c90b25247 100644 --- a/lib/puppet/pops/validation/validator_factory_4_0.rb +++ b/lib/puppet/pops/validation/validator_factory_4_0.rb @@ -31,7 +31,6 @@ def severity_producer p[Issues::RT_NO_STORECONFIGS] = Puppet[:storeconfigs] ? :ignore : :warning p[Issues::FUTURE_RESERVED_WORD] = :deprecation - p[Issues::DEPRECATED_APP_ORCHESTRATION] = :deprecation p[Issues::DUPLICATE_KEY] = Puppet[:strict] == :off ? :ignore : Puppet[:strict] p[Issues::NAME_WITH_HYPHEN] = :error From 61dcb391faf3c82c36fd06d846b948611188581e Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Tue, 8 Sep 2020 23:05:27 -0700 Subject: [PATCH 146/731] (PUP-10446) Remove unused add_mapping method Remove the unused `add_mapping` parser method. Calls to the method were removed when the grammar was updated, though it didn't take effect until the parser was regenerated in the commit after. --- lib/puppet/pops/parser/parser_support.rb | 5 ----- 1 file changed, 5 deletions(-) diff --git a/lib/puppet/pops/parser/parser_support.rb b/lib/puppet/pops/parser/parser_support.rb index 8da76f98efa..75b1ee0fadb 100644 --- a/lib/puppet/pops/parser/parser_support.rb +++ b/lib/puppet/pops/parser/parser_support.rb @@ -178,11 +178,6 @@ def add_definition(definition) definition end - def add_mapping(produces) - # The actual handling of mappings happens in PopsBridge - add_definition(produces) - end - # Transforms an array of expressions containing literal name expressions to calls if followed by an # expression, or expression list # From a87d581372a2c4103a0f6aed8434ba67925092c9 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Mon, 31 Aug 2020 21:16:03 -0700 Subject: [PATCH 147/731] (PUP-10473) Remove authorization check for indirected routes We now assume authorization is performed by the caller prior to the call to the indirected route's `call` method. --- .../network/http/api/indirected_routes.rb | 11 ++---- .../http/api/indirected_routes_spec.rb | 36 ------------------- 2 files changed, 2 insertions(+), 45 deletions(-) diff --git a/lib/puppet/network/http/api/indirected_routes.rb b/lib/puppet/network/http/api/indirected_routes.rb index 25eff90dd14..aa04e206968 100644 --- a/lib/puppet/network/http/api/indirected_routes.rb +++ b/lib/puppet/network/http/api/indirected_routes.rb @@ -1,8 +1,6 @@ -require 'puppet/network/authorization' require 'puppet/network/http/api/indirection_type' class Puppet::Network::HTTP::API::IndirectedRoutes - include Puppet::Network::Authorization # How we map http methods and the indirection name in the URI # to an indirection method. @@ -31,7 +29,8 @@ def self.routes Puppet::Network::HTTP::Route.path(/.*/).any(new) end - # handle an HTTP request + # Handle an HTTP request. The request has already been authenticated prior + # to calling this method. def call(request, response) indirection, method, key, params = uri2indirection(request.method, request.path, request.params) certificate = request.client_cert @@ -99,12 +98,6 @@ def uri2indirection(http_method, uri, params) params[:environment] = configured_environment end - begin - check_authorization(method, "#{url_prefix}/#{indirection_name}/#{key}", params) - rescue Puppet::Network::AuthorizationError => e - raise Puppet::Network::HTTP::Error::HTTPNotAuthorizedError.new(e.message) - end - if configured_environment.nil? raise Puppet::Network::HTTP::Error::HTTPNotFoundError.new( _("Could not find environment '%{environment}'") % { environment: environment }) diff --git a/spec/unit/network/http/api/indirected_routes_spec.rb b/spec/unit/network/http/api/indirected_routes_spec.rb index 6249b493fe8..225e23fc627 100644 --- a/spec/unit/network/http/api/indirected_routes_spec.rb +++ b/spec/unit/network/http/api/indirected_routes_spec.rb @@ -146,45 +146,9 @@ _, _, key, _ = handler.uri2indirection("GET", "#{master_url_prefix}/node/#{escaped}", params) expect(key).to eq(escaped) end - - it "should not unescape the URI passed through in a call to check_authorization" do - key_escaped = Puppet::Util.uri_encode("foo bar") - uri_escaped = "#{master_url_prefix}/node/#{key_escaped}" - expect(handler).to receive(:check_authorization).with(anything, uri_escaped, anything) - handler.uri2indirection("GET", uri_escaped, params) - end - - it "when the environment is unknown should remove :environment from params passed to check_authorization and therefore fail" do - expect(handler).to receive(:check_authorization).with(anything, - anything, - excluding(:environment)) - expect { handler.uri2indirection("GET", - "#{master_url_prefix}/node/bar", - {:environment => 'bogus'}) - }.to raise_error(not_found_error) - end - - it "should not URI unescape the indirection key as passed through to a call to check_authorization" do - expect(handler).to receive(:check_authorization).with(anything, anything, hash_including(environment: be_a(Puppet::Node::Environment).and(have_attributes(name: :env)))) - - handler.uri2indirection("GET", "#{master_url_prefix}/node/bar", params) - end - end describe "when processing a request" do - it "should raise not_authorized_error when authorization fails" do - data = Puppet::IndirectorTesting.new("my data") - indirection.save(data, "my data") - request = a_request_that_heads(data) - - expect(handler).to receive(:check_authorization).and_raise(Puppet::Network::AuthorizationError.new("forbidden")) - - expect { - handler.call(request, response) - }.to raise_error(not_authorized_error) - end - it "should raise not_found_error if the indirection does not support remote requests" do request = a_request_that_heads(Puppet::IndirectorTesting.new("my data")) From 61191d11c2578569e07f82f4fff9303d6cfd39ab Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Mon, 31 Aug 2020 21:23:44 -0700 Subject: [PATCH 148/731] (PUP-10473) Remove authorization check for environment routes We now assume authorization is performed prior to the call to the `call` method of the `environments` route. This commit preserves the `wrap` behavior using a lambda so the block is lazily evaluated when the request is made. --- lib/puppet/network/http/api/master/v3.rb | 9 ++- .../http/api/master/v3/authorization.rb | 18 ------ .../http/api/master/v3/authorization_spec.rb | 57 ------------------- 3 files changed, 6 insertions(+), 78 deletions(-) delete mode 100644 lib/puppet/network/http/api/master/v3/authorization.rb delete mode 100644 spec/unit/network/http/api/master/v3/authorization_spec.rb diff --git a/lib/puppet/network/http/api/master/v3.rb b/lib/puppet/network/http/api/master/v3.rb index 87afc38f514..b0df5604d87 100644 --- a/lib/puppet/network/http/api/master/v3.rb +++ b/lib/puppet/network/http/api/master/v3.rb @@ -1,16 +1,19 @@ class Puppet::Network::HTTP::API::Master::V3 - require 'puppet/network/http/api/master/v3/authorization' require 'puppet/network/http/api/master/v3/environments' require 'puppet/network/http/api/indirected_routes' - AUTHZ = Authorization.new + def self.wrap(&block) + lambda do |request, response| + block.call.call(request, response) + end + end INDIRECTED = Puppet::Network::HTTP::Route. path(/.*/). any(Puppet::Network::HTTP::API::IndirectedRoutes.new) ENVIRONMENTS = Puppet::Network::HTTP::Route. - path(%r{^/environments$}).get(AUTHZ.wrap do + path(%r{^/environments$}).get(wrap do Environments.new(Puppet.lookup(:environments)) end) diff --git a/lib/puppet/network/http/api/master/v3/authorization.rb b/lib/puppet/network/http/api/master/v3/authorization.rb deleted file mode 100644 index b9f5cf518d8..00000000000 --- a/lib/puppet/network/http/api/master/v3/authorization.rb +++ /dev/null @@ -1,18 +0,0 @@ -require 'puppet/network/authorization' - -class Puppet::Network::HTTP::API::Master::V3::Authorization - include Puppet::Network::Authorization - - def wrap(&block) - lambda do |request, response| - begin - authconfig.check_authorization(:find, request.path, request.params) - rescue Puppet::Network::AuthorizationError => e - raise Puppet::Network::HTTP::Error::HTTPNotAuthorizedError.new(e.message, Puppet::Network::HTTP::Issues::FAILED_AUTHORIZATION) - end - - block.call.call(request, response) - end - end - -end diff --git a/spec/unit/network/http/api/master/v3/authorization_spec.rb b/spec/unit/network/http/api/master/v3/authorization_spec.rb deleted file mode 100644 index ce3e78105b3..00000000000 --- a/spec/unit/network/http/api/master/v3/authorization_spec.rb +++ /dev/null @@ -1,57 +0,0 @@ -require 'spec_helper' - -require 'puppet/network/http' - -describe Puppet::Network::HTTP::API::Master::V3::Authorization do - let(:response) { Puppet::Network::HTTP::MemoryResponse.new } - let(:authz) { Puppet::Network::HTTP::API::Master::V3::Authorization.new } - let(:noop_handler) { - lambda do |request, response| - end - } - - it "accepts v3 api requests that match allowed authconfig entries" do - request = Puppet::Network::HTTP::Request.from_hash({ - :path => "/v3/environments", - :method => "GET", - :params => { :authenticated => true, :node => "testing", :ip => "127.0.0.1" } - }) - - allow(authz).to receive(:authconfig).and_return(Puppet::Network::AuthConfigParser.new(<<-AUTH).parse) -path /v3/environments -method find -allow * - AUTH - - handler = authz.wrap do - noop_handler - end - - expect do - handler.call(request, response) - end.to_not raise_error - end - - it "rejects v3 api requests that are disallowed by authconfig entries" do - request = Puppet::Network::HTTP::Request.from_hash({ - :path => "/v3/environments", - :method => "GET", - :params => { :authenticated => true, :node => "testing", :ip => "127.0.0.1" } - }) - - allow(authz).to receive(:authconfig).and_return(Puppet::Network::AuthConfigParser.new(<<-AUTH).parse) -path /v3/environments -method find -auth any -deny testing - AUTH - - handler = authz.wrap do - noop_handler - end - - expect do - handler.call(request, response) - end.to raise_error(Puppet::Network::HTTP::Error::HTTPNotAuthorizedError, /Forbidden request/) - end -end From 5ffd9f37a20ab6a7f760bb46f469a20aa11e0215 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Fri, 4 Sep 2020 14:33:00 -0700 Subject: [PATCH 149/731] (PUP-10473) Ignore authorization rules in custom fileserver mounts Previously, puppet parsed `allow` and `deny` rules in legacy auth.conf, but did not support trying to restrict access to something other than "allow all". Doing so would log an error and deny access. So for example, `allow *.example.com` would always be denied. This commit removes the error case. It is assumed authorization is performed outside of puppet. This commit preserves denying access if the requested fileserver mount does not exist. --- lib/puppet/file_serving/configuration.rb | 5 --- .../file_serving/configuration/parser.rb | 35 ++----------------- lib/puppet/file_serving/mount.rb | 3 +- lib/puppet/indirector/file_server.rb | 9 +---- .../file_serving/configuration/parser_spec.rb | 30 +++++++--------- spec/unit/file_serving/configuration_spec.rb | 18 ++++------ spec/unit/indirector/file_server_spec.rb | 16 +-------- 7 files changed, 25 insertions(+), 91 deletions(-) diff --git a/lib/puppet/file_serving/configuration.rb b/lib/puppet/file_serving/configuration.rb index 7b1d3501a57..fd26057f8f8 100644 --- a/lib/puppet/file_serving/configuration.rb +++ b/lib/puppet/file_serving/configuration.rb @@ -80,15 +80,10 @@ def umount(name) def mk_default_mounts @mounts["modules"] ||= Mount::Modules.new("modules") - @mounts["modules"].allow('*') if @mounts["modules"].empty? @mounts["plugins"] ||= Mount::Plugins.new("plugins") - @mounts["plugins"].allow('*') if @mounts["plugins"].empty? @mounts["locales"] ||= Mount::Locales.new("locales") - @mounts["locales"].allow('*') if @mounts["locales"].empty? @mounts["pluginfacts"] ||= Mount::PluginFacts.new("pluginfacts") - @mounts["pluginfacts"].allow('*') if @mounts["pluginfacts"].empty? @mounts["tasks"] ||= Mount::Tasks.new("tasks") - @mounts["tasks"].allow('*') if @mounts["tasks"].empty? end # Read the configuration file. diff --git a/lib/puppet/file_serving/configuration/parser.rb b/lib/puppet/file_serving/configuration/parser.rb index d84726fd09f..5559a7c50df 100644 --- a/lib/puppet/file_serving/configuration/parser.rb +++ b/lib/puppet/file_serving/configuration/parser.rb @@ -32,10 +32,9 @@ def parse case var when "path" path(mount, value) - when "allow" - allow(mount, value) - when "deny" - deny(mount, value) + when "allow", "deny" + error_location_str = Puppet::Util::Errors.error_location(@file.filename, @count) + Puppet.err("Entry '#{line.chomp}' is unsupported and will be ignored at #{error_location_str}") else error_location_str = Puppet::Util::Errors.error_location(@file.filename, @count) raise ArgumentError.new(_("Invalid argument '%{var}' at %{error_location}") % @@ -64,34 +63,6 @@ def changed? private - # Allow a given pattern access to a mount. - def allow(mount, value) - value.split(/\s*,\s*/).each { |val| - begin - mount.info _("allowing %{val} access") % { val: val } - mount.allow(val) - rescue Puppet::AuthStoreError => detail - error_location_str = Puppet::Util::Errors.error_location(@file, @count) - raise ArgumentError.new("%{detail} %{error_location}" % - { detail: detail.to_s, error_location: error_location_str }) - end - } - end - - # Deny a given pattern access to a mount. - def deny(mount, value) - value.split(/\s*,\s*/).each { |val| - begin - mount.info _("denying %{val} access") % { val: val } - mount.deny(val) - rescue Puppet::AuthStoreError => detail - error_location_str = Puppet::Util::Errors.error_location(@file, @count) - raise ArgumentError.new("%{detail} %{error_location}" % - { detail: detail.to_s, error_location: error_location_str }) - end - } - end - # Create a new mount. def newmount(name) if @mounts.include?(name) diff --git a/lib/puppet/file_serving/mount.rb b/lib/puppet/file_serving/mount.rb index 8cc63a3a316..74a145e5e72 100644 --- a/lib/puppet/file_serving/mount.rb +++ b/lib/puppet/file_serving/mount.rb @@ -1,4 +1,3 @@ -require 'puppet/network/authstore' require 'puppet/util/logging' require 'puppet/file_serving' require 'puppet/file_serving/metadata' @@ -6,7 +5,7 @@ # Broker access to the filesystem, converting local URIs into metadata # or content objects. -class Puppet::FileServing::Mount < Puppet::Network::AuthStore +class Puppet::FileServing::Mount include Puppet::Util::Logging attr_reader :name diff --git a/lib/puppet/indirector/file_server.rb b/lib/puppet/indirector/file_server.rb index 9ecbf5ad0d9..0ad490531c8 100644 --- a/lib/puppet/indirector/file_server.rb +++ b/lib/puppet/indirector/file_server.rb @@ -16,14 +16,7 @@ def authorized?(request) # If we're not serving this mount, then access is denied. return false unless mount - # If there are no auth directives or there is an 'allow *' directive, then - # access is allowed. - if mount.empty? || mount.globalallow? - return true - end - - Puppet.err _("Denying %{method} request for %{desc} on fileserver mount '%{mount_name}'. Use of auth directives for 'fileserver.conf' mount points is no longer supported. Remove these directives and use the 'auth.conf' file instead for access control.") % { method: request.method, desc: request.description, mount_name: mount.name } - return false + true end # Find our key using the fileserver. diff --git a/spec/unit/file_serving/configuration/parser_spec.rb b/spec/unit/file_serving/configuration/parser_spec.rb index 287d1cb9669..72116de7a50 100644 --- a/spec/unit/file_serving/configuration/parser_spec.rb +++ b/spec/unit/file_serving/configuration/parser_spec.rb @@ -49,7 +49,7 @@ def write_config_file(content) expect { @parser.parse }.to raise_error(ArgumentError) end - it "should fail if the value for path/allow/deny starts with an equals sign" do + it "should fail if the value for path starts with an equals sign" do write_config_file "[one]\npath = /testing" expect { @parser.parse }.to raise_error(ArgumentError) end @@ -98,32 +98,28 @@ def write_config_file(content) end [:allow,:deny].each { |acl_type| - it "should support inline comments in #{acl_type}" do + it "should ignore inline comments in #{acl_type}" do write_config_file "[one]\n#{acl_type} something \# will it work?\n" - expect(@mount).to receive(:info) - expect(@mount).to receive(acl_type).with("something") - @parser.parse + @parser.parse end - it "should tell the mount to #{acl_type} from ACLs with varying spacing around commas" do + it "should ignore #{acl_type} from ACLs with varying spacing around commas" do write_config_file "[one]\n#{acl_type} someone,sometwo, somethree , somefour ,somefive\n" - expect(@mount).to receive(:info).exactly(5).times - expect(@mount).to receive(acl_type).exactly(5).times.with(eq('someone').or eq('sometwo').or eq('somethree').or eq('somefour').or eq('somefive')) @parser.parse end - # each ip, with glob in the various octet positions - ['100','4','42','*'].permutation.map {|permutes| permutes.join('.') }.each { |ip_pattern| - it "should tell the mount to #{acl_type} from ACLs with glob at #{ip_pattern}" do - write_config_file "[one]\n#{acl_type} #{ip_pattern}\n" + it "should log an error and print the location of the #{acl_type} rule" do + write_config_file(<<~CONFIG) + [one] + #{acl_type} one + CONFIG + + expect(Puppet).to receive(:err).with(/Entry '#{acl_type} one' is unsupported and will be ignored at \(file: .*, line: 2\)/) - expect(@mount).to receive(:info) - expect(@mount).to receive(acl_type).with(ip_pattern) - @parser.parse - end - } + @parser.parse + end } it "should return comprehensible error message, if failed on invalid attribute" do diff --git a/spec/unit/file_serving/configuration_spec.rb b/spec/unit/file_serving/configuration_spec.rb index 0aac060e92e..ff4e0bcd471 100644 --- a/spec/unit/file_serving/configuration_spec.rb +++ b/spec/unit/file_serving/configuration_spec.rb @@ -90,17 +90,14 @@ it "should allow all access to modules, plugins, and tasks if no fileserver.conf exists" do expect(Puppet::FileSystem).to receive(:exist?).and_return(false) # the file doesn't exist - modules = double('modules', :empty? => true) + modules = double('modules') allow(Puppet::FileServing::Mount::Modules).to receive(:new).and_return(modules) - expect(modules).to receive(:allow).with('*') - plugins = double('plugins', :empty? => true) + plugins = double('plugins') allow(Puppet::FileServing::Mount::Plugins).to receive(:new).and_return(plugins) - expect(plugins).to receive(:allow).with('*') - tasks = double('tasks', :empty? => true) + tasks = double('tasks') allow(Puppet::FileServing::Mount::Tasks).to receive(:new).and_return(tasks) - expect(tasks).to receive(:allow).with('*') Puppet::FileServing::Configuration.configuration end @@ -108,17 +105,14 @@ it "should not allow access from all to modules, plugins, and tasks if the fileserver.conf provided some rules" do expect(Puppet::FileSystem).to receive(:exist?).and_return(false) # the file doesn't exist - modules = double('modules', :empty? => false) + modules = double('modules') allow(Puppet::FileServing::Mount::Modules).to receive(:new).and_return(modules) - expect(modules).not_to receive(:allow).with('*') - plugins = double('plugins', :empty? => false) + plugins = double('plugins') allow(Puppet::FileServing::Mount::Plugins).to receive(:new).and_return(plugins) - expect(plugins).not_to receive(:allow).with('*') - tasks = double('tasks', :empty? => false) + tasks = double('tasks') allow(Puppet::FileServing::Mount::Tasks).to receive(:new).and_return(tasks) - expect(tasks).not_to receive(:allow).with('*') Puppet::FileServing::Configuration.configuration end diff --git a/spec/unit/indirector/file_server_spec.rb b/spec/unit/indirector/file_server_spec.rb index f39c4a8d224..083f058898a 100644 --- a/spec/unit/indirector/file_server_spec.rb +++ b/spec/unit/indirector/file_server_spec.rb @@ -246,7 +246,7 @@ class Puppet::FileTestModel::FileServer < Puppet::Indirector::FileServer end describe "when checking authorization" do - let(:mount) { double('mount', :empty? => nil, :globalallow? => nil) } + let(:mount) { double('mount') } let(:request) { Puppet::Indirector::Request.new(:myind, :mymethod, uri, :environment => "myenv") } before(:each) do @@ -282,21 +282,7 @@ class Puppet::FileTestModel::FileServer < Puppet::Indirector::FileServer end it "should return true when no auth directives are defined for the mount point" do - allow(mount).to receive(:empty?).and_return(true) - allow(mount).to receive(:globalallow?).and_return(nil) expect(terminus).to be_authorized(request) end - - it "should return true when a global allow directive is defined for the mount point" do - allow(mount).to receive(:empty?).and_return(false) - allow(mount).to receive(:globalallow?).and_return(true) - expect(terminus).to be_authorized(request) - end - - it "should return false when a non-global allow directive is defined for the mount point" do - allow(mount).to receive(:empty?).and_return(false) - allow(mount).to receive(:globalallow?).and_return(false) - expect(terminus).not_to be_authorized(request) - end end end From c403763bbbd789024b1faf03cb537b379582bb42 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Thu, 10 Sep 2020 03:21:55 +0000 Subject: [PATCH 150/731] (packaging) Updating the puppet.pot file --- locales/puppet.pot | 555 ++++++++++++++------------------------------- 1 file changed, 169 insertions(+), 386 deletions(-) diff --git a/locales/puppet.pot b/locales/puppet.pot index fee28f84350..ae5646fa521 100644 --- a/locales/puppet.pot +++ b/locales/puppet.pot @@ -6,11 +6,11 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Puppet automation framework 6.18.0-180-g6829ff0ce6\n" +"Project-Id-Version: Puppet automation framework 6.18.0-246-g156d26d66e\n" "\n" "Report-Msgid-Bugs-To: https://tickets.puppetlabs.com\n" -"POT-Creation-Date: 2020-09-02 06:36+0000\n" -"PO-Revision-Date: 2020-09-02 06:36+0000\n" +"POT-Creation-Date: 2020-09-10 03:21+0000\n" +"PO-Revision-Date: 2020-09-10 03:21+0000\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -715,7 +715,7 @@ msgid "Invalid value '%{value}' for parameter %{name}. Allowed values are '%{all msgstr "" #. TRANSLATORS 'pluginsync' is a setting and should not be translated -#: ../lib/puppet/defaults.rb:1882 +#: ../lib/puppet/defaults.rb:1888 msgid "Setting 'pluginsync' is deprecated." msgstr "" @@ -1472,6 +1472,14 @@ msgstr "" msgid "Cannot determine basic system flavour" msgstr "" +#: ../lib/puppet/ffi/windows/api_types.rb:86 +msgid "Unable to read wide strings with %{null_terminator} terminal nulls" +msgstr "" + +#: ../lib/puppet/ffi/windows/api_types.rb:231 +msgid "Bad GUID format." +msgstr "" + #: ../lib/puppet/file_bucket/dipper.rb:39 msgid "File %{file} does not exist" msgstr "" @@ -3759,22 +3767,6 @@ msgstr "" msgid "Not a valid indirection type" msgstr "" -#: ../lib/puppet/network/http/api/master/v3/environment.rb:14 -msgid "%{env_name} is not a known environment" -msgstr "" - -#: ../lib/puppet/network/http/api/master/v3/environment.rb:43 -msgid "Application %{application} assigns nodes to non-existent components: %{component_list}" -msgstr "" - -#: ../lib/puppet/network/http/api/master/v3/environment.rb:49 -msgid "Application %{application} has components without assigned nodes: %{component_list}" -msgstr "" - -#: ../lib/puppet/network/http/api/master/v3/environment.rb:58 -msgid "Application %{app} assigns multiple nodes to component %{comp}" -msgstr "" - #: ../lib/puppet/network/http/connection.rb:43 msgid "Unrecognized option(s): %{opts}" msgstr "" @@ -4045,7 +4037,7 @@ msgstr "" msgid "Node inheritance is removed in Puppet 4.0.0. See http://links.puppet.com/puppet-node-inheritance-deprecation" msgstr "" -#: ../lib/puppet/parser/ast/pops_bridge.rb:186 +#: ../lib/puppet/parser/ast/pops_bridge.rb:180 msgid "Instantiating Resource with type checked parameters - scope is missing, skipping type checking." msgstr "" @@ -4070,209 +4062,100 @@ msgid "For more information, see https://puppet.com/docs/puppet/latest/environme msgstr "" #. TRANSLATORS "stage" is a keyword in Puppet and should not be translated -#: ../lib/puppet/parser/compiler.rb:98 ../lib/puppet/parser/environment_compiler.rb:137 +#: ../lib/puppet/parser/compiler.rb:82 msgid "Only classes can set 'stage'; normal resources like %{resource} cannot change run stage" msgstr "" -#. TRANSLATORS "Site" is a puppet keyword and should not be translated -#: ../lib/puppet/parser/compiler.rb:125 -msgid "Application instances like '%{resource}' can only be contained within a Site" -msgstr "" - -#: ../lib/puppet/parser/compiler.rb:155 +#: ../lib/puppet/parser/compiler.rb:123 msgid "For compiling %{node}" msgstr "" -#: ../lib/puppet/parser/compiler.rb:159 +#: ../lib/puppet/parser/compiler.rb:127 msgid "Compile: Set node parameters" msgstr "" -#: ../lib/puppet/parser/compiler.rb:161 +#: ../lib/puppet/parser/compiler.rb:129 msgid "Compile: Created settings scope" msgstr "" -#: ../lib/puppet/parser/compiler.rb:163 -msgid "Compile: Evaluated capability mappings" -msgstr "" - #. TRANSLATORS "main" is a function name and should not be translated -#: ../lib/puppet/parser/compiler.rb:166 +#: ../lib/puppet/parser/compiler.rb:132 msgid "Compile: Evaluated main" msgstr "" -#: ../lib/puppet/parser/compiler.rb:168 -msgid "Compile: Evaluated site" -msgstr "" - -#: ../lib/puppet/parser/compiler.rb:170 +#: ../lib/puppet/parser/compiler.rb:134 msgid "Compile: Evaluated AST node" msgstr "" -#: ../lib/puppet/parser/compiler.rb:172 +#: ../lib/puppet/parser/compiler.rb:136 msgid "Compile: Evaluated node classes" msgstr "" -#: ../lib/puppet/parser/compiler.rb:174 -msgid "Compile: Evaluated application instances" -msgstr "" - -#: ../lib/puppet/parser/compiler.rb:177 -msgid "Compile: Evaluated site capability mappings" -msgstr "" - -#: ../lib/puppet/parser/compiler.rb:179 +#: ../lib/puppet/parser/compiler.rb:138 msgid "Compile: Evaluated generators" msgstr "" -#: ../lib/puppet/parser/compiler.rb:181 +#: ../lib/puppet/parser/compiler.rb:140 msgid "Compile: Validate Catalog pre-finish" msgstr "" -#: ../lib/puppet/parser/compiler.rb:185 +#: ../lib/puppet/parser/compiler.rb:144 msgid "Compile: Finished catalog" msgstr "" -#: ../lib/puppet/parser/compiler.rb:187 -msgid "Compile: Prune" -msgstr "" - -#: ../lib/puppet/parser/compiler.rb:191 +#: ../lib/puppet/parser/compiler.rb:148 msgid "Compile: Validate Catalog final" msgstr "" -#: ../lib/puppet/parser/compiler.rb:321 -msgid "Invalid node mapping in %{app}: Mapping must be a hash" -msgstr "" - -#: ../lib/puppet/parser/compiler.rb:324 -msgid "Invalid node mapping in %{app}: Key %{k} is not a Node" -msgstr "" - -#: ../lib/puppet/parser/compiler.rb:327 -msgid "Invalid node mapping in %{app}: Value %{res} is not a resource" -msgstr "" - -#: ../lib/puppet/parser/compiler.rb:328 -msgid "Application %{app} maps component %{res} to multiple nodes" -msgstr "" - -#: ../lib/puppet/parser/compiler.rb:367 +#: ../lib/puppet/parser/compiler.rb:218 msgid "Could not find node statement with name 'default' or '%{names}'" msgstr "" -#: ../lib/puppet/parser/compiler.rb:385 +#: ../lib/puppet/parser/compiler.rb:236 msgid "No source for scope passed to evaluate_classes" msgstr "" -#: ../lib/puppet/parser/compiler.rb:401 +#: ../lib/puppet/parser/compiler.rb:246 msgid "Could not find class %{name} for %{node}" msgstr "" -#: ../lib/puppet/parser/compiler.rb:503 -msgid "Capability mapping error: %{kind} clause references nonexistent %{component_type} %{component_name}" -msgstr "" - -#: ../lib/puppet/parser/compiler.rb:526 +#: ../lib/puppet/parser/compiler.rb:328 msgid "Evaluated collections" msgstr "" -#: ../lib/puppet/parser/compiler.rb:541 +#: ../lib/puppet/parser/compiler.rb:343 msgid "Evaluated definitions" msgstr "" -#: ../lib/puppet/parser/compiler.rb:570 +#: ../lib/puppet/parser/compiler.rb:372 msgid "Iterated (%{count}) on generators" msgstr "" -#: ../lib/puppet/parser/compiler.rb:581 +#: ../lib/puppet/parser/compiler.rb:383 msgid "Somehow looped more than 1000 times while evaluating host catalog" msgstr "" -#: ../lib/puppet/parser/compiler.rb:613 +#: ../lib/puppet/parser/compiler.rb:415 msgid "Could not find resource(s) %{resources} for overriding" msgstr "" -#: ../lib/puppet/parser/compiler.rb:624 +#: ../lib/puppet/parser/compiler.rb:426 msgid "Failed to realize virtual resources %{resources}" msgstr "" #. TRANSLATORS "main" is a function name and should not be translated -#: ../lib/puppet/parser/compiler.rb:657 +#: ../lib/puppet/parser/compiler.rb:459 msgid "Couldn't find main" msgstr "" -#: ../lib/puppet/parser/compiler.rb:730 +#: ../lib/puppet/parser/compiler.rb:532 msgid "For initializing compiler" msgstr "" -#: ../lib/puppet/parser/compiler/catalog_validator/env_relationship_validator.rb:19 -msgid "Capability '%{cap}' referenced by '%{param}' is never exported" -msgstr "" - -#: ../lib/puppet/parser/compiler/catalog_validator/env_relationship_validator.rb:58 -msgid "'%{value}' is exported by both '%{hash}' and '%{resource}'" -msgstr "" - -#: ../lib/puppet/parser/compiler/catalog_validator/relationship_validator.rb:27 -msgid "'%{param}' is not a valid relationship to a capability" -msgstr "" - -#: ../lib/puppet/parser/compiler/catalog_validator/relationship_validator.rb:43 +#: ../lib/puppet/parser/compiler/catalog_validator/relationship_validator.rb:31 msgid "Could not find resource '%{res}' in parameter '%{param}'" msgstr "" -#: ../lib/puppet/parser/compiler/catalog_validator/site_validator.rb:16 -msgid "Only application components can appear inside a site - %{res} is not allowed" -msgstr "" - -#: ../lib/puppet/parser/environment_compiler.rb:13 -msgid "%{detail} in environment %{env}" -msgstr "" - -#: ../lib/puppet/parser/environment_compiler.rb:62 -msgid "For compiling environment catalog %{env}" -msgstr "" - -#: ../lib/puppet/parser/environment_compiler.rb:65 -msgid "Env Compile: Created settings scope" -msgstr "" - -#: ../lib/puppet/parser/environment_compiler.rb:67 -msgid "Env Compile: Evaluated main" -msgstr "" - -#: ../lib/puppet/parser/environment_compiler.rb:69 -msgid "Env Compile: Evaluated site" -msgstr "" - -#: ../lib/puppet/parser/environment_compiler.rb:71 -msgid "Env Compile: Evaluated application instances" -msgstr "" - -#: ../lib/puppet/parser/environment_compiler.rb:73 -msgid "Env Compile: Prune" -msgstr "" - -#: ../lib/puppet/parser/environment_compiler.rb:75 -msgid "Env Compile: Validate Catalog pre-finish" -msgstr "" - -#: ../lib/puppet/parser/environment_compiler.rb:79 -msgid "Env Compile: Finished catalog" -msgstr "" - -#: ../lib/puppet/parser/environment_compiler.rb:83 -msgid "Env Compile: Validate Catalog final" -msgstr "" - -#: ../lib/puppet/parser/environment_compiler.rb:159 -msgid "Environment Compiler: Could not find a site definition to evaluate" -msgstr "" - -#: ../lib/puppet/parser/environment_compiler.rb:165 -msgid "Evaluated application %{resource}" -msgstr "" - #: ../lib/puppet/parser/functions.rb:43 msgid "The method 'Puppet::Parser::Functions.autoloader#loadall' is deprecated in favor of using 'Scope#call_function'." msgstr "" @@ -4407,55 +4290,35 @@ msgstr "" msgid "Resources require a scope" msgstr "" -#: ../lib/puppet/parser/resource.rb:168 +#: ../lib/puppet/parser/resource.rb:159 msgid "Only subclasses can override parameters" msgstr "" -#: ../lib/puppet/parser/resource.rb:174 +#: ../lib/puppet/parser/resource.rb:165 msgid "Attempt to override an already evaluated resource with new values" msgstr "" -#: ../lib/puppet/parser/resource.rb:176 +#: ../lib/puppet/parser/resource.rb:167 msgid "Attempt to override an already evaluated resource, defined at %{error_location}, with new values" msgstr "" -#: ../lib/puppet/parser/resource.rb:273 -msgid "Invalid consume in %{value0}: %{ref} is not a resource" -msgstr "" - -#: ../lib/puppet/parser/resource.rb:280 -msgid "Resource %{ref} could not be found; it might not have been produced yet" -msgstr "" - -#: ../lib/puppet/parser/resource.rb:284 -msgid "Invalid consume in %{ref}: %{cap} is not a capability resource" -msgstr "" - -#: ../lib/puppet/parser/resource.rb:293 -msgid "Resource %{res} tries to consume %{cns} but no 'consumes' mapping exists for %{resource_type} and %{cns_type}" -msgstr "" - -#: ../lib/puppet/parser/resource.rb:313 -msgid "Attempt to reassign attribute '%{name}' in '%{resource}' caused by multiple consumed mappings to the same attribute" -msgstr "" - -#: ../lib/puppet/parser/resource.rb:365 +#: ../lib/puppet/parser/resource.rb:296 msgid "Parameter '%{name}' is already set on %{resource}; cannot redefine" msgstr "" -#: ../lib/puppet/parser/resource.rb:368 +#: ../lib/puppet/parser/resource.rb:299 msgid "Parameter '%{name}' is already set on %{resource} at %{error_location}; cannot redefine" msgstr "" -#: ../lib/puppet/parser/resource.rb:373 +#: ../lib/puppet/parser/resource.rb:304 msgid "Parameter '%{name}' is already set on %{resource} by %{source}; cannot redefine" msgstr "" -#: ../lib/puppet/parser/resource.rb:376 +#: ../lib/puppet/parser/resource.rb:307 msgid "Parameter '%{name}' is already set on %{resource} by %{source} at %{error_location}; cannot redefine" msgstr "" -#: ../lib/puppet/parser/resource.rb:415 +#: ../lib/puppet/parser/resource.rb:346 msgid "Duplicate parameter '%{param}' for on %{resource}" msgstr "" @@ -4697,19 +4560,19 @@ msgstr "" msgid "break() from context where this is illegal" msgstr "" -#: ../lib/puppet/pops/evaluator/evaluator_impl.rb:1222 +#: ../lib/puppet/pops/evaluator/evaluator_impl.rb:1217 msgid "Can only append Array or Hash to a Hash" msgstr "" -#: ../lib/puppet/pops/evaluator/evaluator_impl.rb:1226 +#: ../lib/puppet/pops/evaluator/evaluator_impl.rb:1221 msgid "An URI can only be merged with an URI or String" msgstr "" -#: ../lib/puppet/pops/evaluator/evaluator_impl.rb:1229 +#: ../lib/puppet/pops/evaluator/evaluator_impl.rb:1224 msgid "Can only append Binary to a Binary" msgstr "" -#: ../lib/puppet/pops/evaluator/evaluator_impl.rb:1262 +#: ../lib/puppet/pops/evaluator/evaluator_impl.rb:1257 msgid "Can only delete from an Array or Hash." msgstr "" @@ -5481,10 +5344,6 @@ msgstr "" msgid "Failed to load: %{type_name}" msgstr "" -#: ../lib/puppet/pops/issues.rb:925 -msgid "Use of the application-orchestration %{expr} is deprecated. See https://puppet.com/docs/puppet/5.5/deprecated_language.html" -msgstr "" - #: ../lib/puppet/pops/label_provider.rb:76 msgid "<%{string}> does not appear to contain a word" msgstr "" @@ -5823,19 +5682,19 @@ msgid "Unacceptable transform - found an Object without a rule: %{klass}" msgstr "" #. TRANSLATORS 'NUMBER' refers to a method name and the 'name_or_numeric' was the passed in value and should not be translated -#: ../lib/puppet/pops/model/factory.rb:849 +#: ../lib/puppet/pops/model/factory.rb:812 msgid "Internal Error, NUMBER token does not contain a valid number, %{name_or_numeric}" msgstr "" -#: ../lib/puppet/pops/model/factory.rb:1166 +#: ../lib/puppet/pops/model/factory.rb:1121 msgid "can only concatenate strings, got %{class_name}" msgstr "" -#: ../lib/puppet/pops/parser/parser_support.rb:204 +#: ../lib/puppet/pops/parser/parser_support.rb:199 msgid "attempt to pass argument list to the function '%{name}' which cannot be called without parentheses" msgstr "" -#: ../lib/puppet/pops/parser/parser_support.rb:206 +#: ../lib/puppet/pops/parser/parser_support.rb:201 msgid "illegal comma separated argument list" msgstr "" @@ -5875,7 +5734,7 @@ msgstr "" msgid "digit expected" msgstr "" -#: ../lib/puppet/pops/resource/resource_type_impl.rb:167 ../lib/puppet/type.rb:444 +#: ../lib/puppet/pops/resource/resource_type_impl.rb:165 ../lib/puppet/type.rb:421 msgid "you must specify title patterns when there are two or more key attributes" msgstr "" @@ -6127,23 +5986,23 @@ msgstr "" msgid "Everything is now reported using present tense" msgstr "" -#: ../lib/puppet/pops/types/type_parser.rb:429 +#: ../lib/puppet/pops/types/type_parser.rb:425 msgid "Enum parameters must be identifiers or strings" msgstr "" -#: ../lib/puppet/pops/types/type_parser.rb:665 +#: ../lib/puppet/pops/types/type_parser.rb:661 msgid "The expression <%{expression}> is not a valid type specification." msgstr "" -#: ../lib/puppet/pops/types/type_parser.rb:670 +#: ../lib/puppet/pops/types/type_parser.rb:666 msgid "Invalid number of type parameters specified: %{type} requires %{required}, %{given} provided" msgstr "" -#: ../lib/puppet/pops/types/type_parser.rb:675 +#: ../lib/puppet/pops/types/type_parser.rb:671 msgid "Not a parameterized type <%{type}>" msgstr "" -#: ../lib/puppet/pops/types/type_parser.rb:679 +#: ../lib/puppet/pops/types/type_parser.rb:675 msgid "Unknown type <%{type}>" msgstr "" @@ -6584,7 +6443,7 @@ msgstr "" msgid "source is defined but does not have trailing slash, ignoring %{source}" msgstr "" -#: ../lib/puppet/provider/package/gem.rb:102 +#: ../lib/puppet/provider/package/gem.rb:102 ../lib/puppet/provider/package/puppetserver_gem.rb:61 msgid "Could not list gems: %{detail}" msgstr "" @@ -6592,19 +6451,19 @@ msgstr "" msgid "Could not match %{desc}" msgstr "" -#: ../lib/puppet/provider/package/gem.rb:206 +#: ../lib/puppet/provider/package/gem.rb:206 ../lib/puppet/provider/package/puppetserver_gem.rb:93 msgid "Invalid source '%{uri}': %{detail}" msgstr "" -#: ../lib/puppet/provider/package/gem.rb:217 +#: ../lib/puppet/provider/package/gem.rb:217 ../lib/puppet/provider/package/puppetserver_gem.rb:104 msgid "puppet:// URLs are not supported as gem sources" msgstr "" -#: ../lib/puppet/provider/package/gem.rb:233 +#: ../lib/puppet/provider/package/gem.rb:233 ../lib/puppet/provider/package/puppetserver_gem.rb:115 msgid "Could not install: %{output}" msgstr "" -#: ../lib/puppet/provider/package/gem.rb:259 +#: ../lib/puppet/provider/package/gem.rb:259 ../lib/puppet/provider/package/puppetserver_gem.rb:125 msgid "Could not uninstall: %{output}" msgstr "" @@ -7070,122 +6929,90 @@ msgstr "" msgid "Invalid node name %{host}" msgstr "" -#: ../lib/puppet/resource.rb:48 +#: ../lib/puppet/resource.rb:47 msgid "No resource type provided in serialized data" msgstr "" -#: ../lib/puppet/resource.rb:50 +#: ../lib/puppet/resource.rb:49 msgid "No resource title provided in serialized data" msgstr "" #. TRANSLATORS 'Puppet::Resource.new' should not be translated -#: ../lib/puppet/resource.rb:277 +#: ../lib/puppet/resource.rb:276 msgid "Puppet::Resource.new does not take a hash as the first argument." msgstr "" -#: ../lib/puppet/resource.rb:278 +#: ../lib/puppet/resource.rb:277 msgid "Did you mean (%{type}, %{title}) ?" msgstr "" -#: ../lib/puppet/resource.rb:315 +#: ../lib/puppet/resource.rb:314 msgid "Could not find declared class %{title}" msgstr "" -#: ../lib/puppet/resource.rb:317 +#: ../lib/puppet/resource.rb:316 msgid "Invalid resource type %{type}" msgstr "" -#: ../lib/puppet/resource.rb:527 +#: ../lib/puppet/resource.rb:502 msgid "no parameter named '%{name}'" msgstr "" -#: ../lib/puppet/resource.rb:572 +#: ../lib/puppet/resource.rb:547 msgid "No title provided and %{type} is not a valid resource reference" msgstr "" -#: ../lib/puppet/resource.rb:646 +#: ../lib/puppet/resource.rb:621 msgid "No set of title patterns matched the title \"%{title}\"." msgstr "" -#: ../lib/puppet/resource/capability_finder.rb:27 -msgid "PuppetDB is not available" -msgstr "" - -#: ../lib/puppet/resource/capability_finder.rb:47 -msgid "Unexpected response from PuppetDB when looking up %{capability}:" -msgstr "" - -#: ../lib/puppet/resource/capability_finder.rb:48 -msgid "expected exactly one resource but got %{count};" -msgstr "" - -#: ../lib/puppet/resource/capability_finder.rb:49 -msgid "" -"returned data is:\n" -"%{resources}" -msgstr "" - -#: ../lib/puppet/resource/capability_finder.rb:81 -msgid "Looking up capability %{capability} in PuppetDB: %{query_terms}" -msgstr "" - -#: ../lib/puppet/resource/capability_finder.rb:105 -msgid "Unexpected response from PuppetDB when looking up %{capability}: expected an Array but got %{result}" -msgstr "" - -#: ../lib/puppet/resource/capability_finder.rb:112 -msgid "" -"Invalid JSON from PuppetDB when looking up %{capability}\n" -"%{detail}" -msgstr "" - -#: ../lib/puppet/resource/catalog.rb:104 +#: ../lib/puppet/resource/catalog.rb:102 msgid "Cannot add resource %{resource_1} before %{resource_2} because %{resource_2} is not yet in the catalog" msgstr "" -#: ../lib/puppet/resource/catalog.rb:119 +#: ../lib/puppet/resource/catalog.rb:117 msgid "Cannot add resource %{resource_1} after %{resource_2} because %{resource_2} is not yet in the catalog" msgstr "" #. TRANSLATORS 'alias' should not be translated -#: ../lib/puppet/resource/catalog.rb:206 +#: ../lib/puppet/resource/catalog.rb:204 msgid "Cannot alias %{resource} to %{key}; resource %{newref} already declared" msgstr "" #. TRANSLATORS 'alias' should not be translated -#: ../lib/puppet/resource/catalog.rb:210 +#: ../lib/puppet/resource/catalog.rb:208 msgid "Cannot alias %{resource} to %{key} at %{resource_declaration}; resource %{newref} already declared" msgstr "" -#: ../lib/puppet/resource/catalog.rb:292 +#: ../lib/puppet/resource/catalog.rb:290 msgid "Unknown resource type %{type}" msgstr "" -#: ../lib/puppet/resource/catalog.rb:446 +#: ../lib/puppet/resource/catalog.rb:433 msgid "Could not intern from data: Could not find relationship source %{source} for %{target}" msgstr "" -#: ../lib/puppet/resource/catalog.rb:453 +#: ../lib/puppet/resource/catalog.rb:440 msgid "Could not intern from data: Could not find relationship target %{target} for %{source}" msgstr "" -#: ../lib/puppet/resource/catalog.rb:543 +#: ../lib/puppet/resource/catalog.rb:530 msgid "Could not create class file %{file}: %{detail}" msgstr "" -#: ../lib/puppet/resource/catalog.rb:559 +#: ../lib/puppet/resource/catalog.rb:546 msgid "Could not create resource file %{file}: %{detail}" msgstr "" -#: ../lib/puppet/resource/catalog.rb:594 +#: ../lib/puppet/resource/catalog.rb:581 msgid "Duplicate declaration: %{resource} is already declared; cannot redeclare" msgstr "" -#: ../lib/puppet/resource/catalog.rb:596 +#: ../lib/puppet/resource/catalog.rb:583 msgid "Duplicate declaration: %{resource} is already declared at %{error_location}; cannot redeclare" msgstr "" -#: ../lib/puppet/resource/catalog.rb:645 ../lib/puppet/resource/catalog.rb:650 +#: ../lib/puppet/resource/catalog.rb:632 ../lib/puppet/resource/catalog.rb:637 msgid "Could not find resource %{resource} when converting %{message} resources" msgstr "" @@ -7193,181 +7020,145 @@ msgstr "" msgid "Could not evaluate: %{detail}" msgstr "" -#: ../lib/puppet/resource/type.rb:81 -msgid "Invalid export in %{reference}: %{ex} is not a resource" -msgstr "" - -#: ../lib/puppet/resource/type.rb:82 -msgid "Invalid export in %{reference}: %{ex} is not a capability resource" -msgstr "" - #: ../lib/puppet/resource/type.rb:86 -msgid "Resource type %{res_type} does not produce %{ex_type}" -msgstr "" - -#: ../lib/puppet/resource/type.rb:147 msgid "Invalid resource supertype '%{type}'" msgstr "" -#: ../lib/puppet/resource/type.rb:199 +#: ../lib/puppet/resource/type.rb:116 msgid "%{name} is not a class; cannot add code to it" msgstr "" -#: ../lib/puppet/resource/type.rb:200 +#: ../lib/puppet/resource/type.rb:117 msgid "%{name} is not a class; cannot add code from it" msgstr "" -#: ../lib/puppet/resource/type.rb:204 +#: ../lib/puppet/resource/type.rb:121 msgid "Cannot have code outside of a class/node/define because 'freeze_main' is enabled" msgstr "" -#: ../lib/puppet/resource/type.rb:208 +#: ../lib/puppet/resource/type.rb:125 msgid "Cannot merge classes with different parent classes (%{name} => %{parent} vs. %{other_name} => %{other_parent})" msgstr "" -#: ../lib/puppet/resource/type.rb:239 +#: ../lib/puppet/resource/type.rb:156 msgid "Cannot create resources for defined resource types" msgstr "" -#: ../lib/puppet/resource/type.rb:295 +#: ../lib/puppet/resource/type.rb:209 msgid "Could not find parent resource type '%{parent}' of type %{parent_type} in %{env}" msgstr "" -#: ../lib/puppet/resource/type.rb:422 +#: ../lib/puppet/resource/type.rb:335 msgid "Parameter '%{name}' is given a type, but is not a valid parameter." msgstr "" -#: ../lib/puppet/resource/type.rb:425 +#: ../lib/puppet/resource/type.rb:338 msgid "Parameter '%{name}' is given a type that is not a Puppet Type, got %{class_name}" msgstr "" -#: ../lib/puppet/resource/type.rb:467 +#: ../lib/puppet/resource/type.rb:372 msgid "Could not find scope for %{class_name}" msgstr "" -#: ../lib/puppet/resource/type.rb:488 +#: ../lib/puppet/resource/type.rb:393 msgid "%{param} is a metaparam; this value will inherit to all contained resources in the %{name} definition" msgstr "" -#: ../lib/puppet/resource/type.rb:490 +#: ../lib/puppet/resource/type.rb:395 msgid "%{param} is a metaparameter; please choose another parameter name in the %{name} definition" msgstr "" -#: ../lib/puppet/resource/type_collection.rb:72 +#: ../lib/puppet/resource/type_collection.rb:63 msgid "Class '%{klass}' is already defined%{error}; cannot redefine" msgstr "" -#: ../lib/puppet/resource/type_collection.rb:73 +#: ../lib/puppet/resource/type_collection.rb:64 msgid "Definition '%{klass}' is already defined%{error}; cannot be redefined as a class" msgstr "" -#: ../lib/puppet/resource/type_collection.rb:74 -msgid "Application '%{klass}' is already defined%{error}; cannot be redefined as a class" -msgstr "" - -#: ../lib/puppet/resource/type_collection.rb:105 +#: ../lib/puppet/resource/type_collection.rb:95 msgid "Node '%{name}' is already defined%{error}; cannot redefine" msgstr "" -#: ../lib/puppet/resource/type_collection.rb:113 -msgid "Site is already defined%{error}; cannot redefine" -msgstr "" - -#: ../lib/puppet/resource/type_collection.rb:150 +#: ../lib/puppet/resource/type_collection.rb:130 msgid "'%{name}' is already defined%{error} as a class; cannot redefine as a definition" msgstr "" -#: ../lib/puppet/resource/type_collection.rb:151 +#: ../lib/puppet/resource/type_collection.rb:131 msgid "Definition '%{name}' is already defined%{error}; cannot be redefined" msgstr "" -#: ../lib/puppet/resource/type_collection.rb:152 ../lib/puppet/resource/type_collection.rb:168 -msgid "'%{name}' is already defined%{error} as an application; cannot be redefined" -msgstr "" - -#: ../lib/puppet/resource/type_collection.rb:157 -msgid "'%{name}' is already defined%{error} as a class; cannot redefine as a mapping" -msgstr "" - -#: ../lib/puppet/resource/type_collection.rb:166 -msgid "'%{name}' is already defined%{error} as a class; cannot redefine as an application" -msgstr "" - -#: ../lib/puppet/resource/type_collection.rb:167 -msgid "'%{name}' is already defined%{error} as a definition; cannot redefine as an application" -msgstr "" - -#: ../lib/puppet/resource/type_collection.rb:220 +#: ../lib/puppet/resource/type_collection.rb:175 msgid "Execution of config_version command `%{cmd}` failed: %{message}" msgstr "" -#: ../lib/puppet/resource/type_collection.rb:241 +#: ../lib/puppet/resource/type_collection.rb:196 msgid "Not attempting to load %{type} %{fqname} as this object was missing during a prior compilation" msgstr "" -#: ../lib/puppet/settings.rb:98 +#: ../lib/puppet/settings.rb:99 msgid "New environment loaders generated from the requested section." msgstr "" -#: ../lib/puppet/settings.rb:300 +#: ../lib/puppet/settings.rb:301 msgid "Attempting to initialize global default settings more than once!" msgstr "" -#: ../lib/puppet/settings.rb:500 +#: ../lib/puppet/settings.rb:501 msgid "Using --configprint is deprecated. Use 'puppet config ' instead." msgstr "" -#: ../lib/puppet/settings.rb:642 +#: ../lib/puppet/settings.rb:643 msgid "Could not load %{file}: %{detail}" msgstr "" -#: ../lib/puppet/settings.rb:748 +#: ../lib/puppet/settings.rb:749 msgid "Invalid setting type '%{type}'" msgstr "" -#: ../lib/puppet/settings.rb:894 +#: ../lib/puppet/settings.rb:895 msgid "Unknown searchpath case: %{source_type} for the %{source} settings path element." msgstr "" -#: ../lib/puppet/settings.rb:957 +#: ../lib/puppet/settings.rb:958 msgid "setting definition for '%{name}' is not a hash!" msgstr "" -#: ../lib/puppet/settings.rb:962 +#: ../lib/puppet/settings.rb:963 msgid "Setting %{name} is already defined" msgstr "" -#: ../lib/puppet/settings.rb:968 +#: ../lib/puppet/settings.rb:969 msgid "Setting %{name} is already using short name '%{short}'" msgstr "" -#: ../lib/puppet/settings.rb:1227 +#: ../lib/puppet/settings.rb:1228 msgid "Setting %{name} is deprecated." msgstr "" #. TRANSLATORS 'puppet.conf' is a file name and should not be translated -#: ../lib/puppet/settings.rb:1232 +#: ../lib/puppet/settings.rb:1233 msgid "Setting %{name} is deprecated in puppet.conf." msgstr "" -#: ../lib/puppet/settings.rb:1403 +#: ../lib/puppet/settings.rb:1404 msgid "Error converting value for param '%{name}': %{detail}" msgstr "" -#: ../lib/puppet/settings.rb:1427 +#: ../lib/puppet/settings.rb:1428 msgid "Could not find value for %{expression}" msgstr "" #. TRANSLATORS '$environment' is a Puppet specific variable and should not be translated -#: ../lib/puppet/settings.rb:1437 +#: ../lib/puppet/settings.rb:1438 msgid "You cannot interpolate $environment within '%{setting_name}' when using directory environments." msgstr "" -#: ../lib/puppet/settings.rb:1438 +#: ../lib/puppet/settings.rb:1439 msgid "Its value will remain %{value}." msgstr "" -#: ../lib/puppet/settings.rb:1469 +#: ../lib/puppet/settings.rb:1470 msgid "Attempt to assign a value to unknown setting %{name}" msgstr "" @@ -7489,7 +7280,7 @@ msgstr "" msgid "Expected an Array, String, or Hash, got a %{klass}" msgstr "" -#: ../lib/puppet/settings/priority_setting.rb:39 +#: ../lib/puppet/settings/priority_setting.rb:40 msgid "Invalid priority format '%{value}' for parameter: %{name}" msgstr "" @@ -8080,77 +7871,77 @@ msgstr "" msgid "There is more than one '%{basename}' script in %{dir}" msgstr "" -#: ../lib/puppet/type.rb:519 +#: ../lib/puppet/type.rb:496 msgid "Options must be a hash, not %{type}" msgstr "" -#: ../lib/puppet/type.rb:522 +#: ../lib/puppet/type.rb:499 msgid "Class %{class_name} already has a property named %{property}" msgstr "" -#: ../lib/puppet/type.rb:609 +#: ../lib/puppet/type.rb:586 msgid "Class %{class_name} has not defined parameters" msgstr "" -#: ../lib/puppet/type.rb:696 +#: ../lib/puppet/type.rb:673 msgid "Parameter %{name} failed on %{ref}: %{detail}" msgstr "" -#: ../lib/puppet/type.rb:719 +#: ../lib/puppet/type.rb:696 msgid "Undefined attribute '%{attribute}' in %{name}" msgstr "" #. TRANSLATORS 'is' is a variable name and should not be translated #. TRANSLATORS 'is' is a variable name and should not be translated -#: ../lib/puppet/type.rb:1062 ../lib/puppet/type.rb:1073 +#: ../lib/puppet/type.rb:1039 ../lib/puppet/type.rb:1050 msgid "The 'is' value is not in the 'is' array for '%{name}'" msgstr "" -#: ../lib/puppet/type.rb:1204 +#: ../lib/puppet/type.rb:1181 msgid "%{name} has no providers and has not overridden 'instances'" msgstr "" -#: ../lib/puppet/type.rb:1468 +#: ../lib/puppet/type.rb:1445 msgid "Cannot add aliases without a catalog" msgstr "" -#: ../lib/puppet/type.rb:1548 +#: ../lib/puppet/type.rb:1525 msgid "Could not find %{description} %{ref} for %{resource}" msgstr "" -#: ../lib/puppet/type.rb:1825 +#: ../lib/puppet/type.rb:1749 msgid "Found multiple default providers for %{name}: %{provider_list}; using %{selected_provider}" msgstr "" -#: ../lib/puppet/type.rb:1912 +#: ../lib/puppet/type.rb:1836 msgid "Could not find parent provider %{parent} of %{name}" msgstr "" -#: ../lib/puppet/type.rb:1986 +#: ../lib/puppet/type.rb:1910 msgid "Invalid %{resource} provider '%{provider_class}'" msgstr "" -#: ../lib/puppet/type.rb:2071 +#: ../lib/puppet/type.rb:1995 msgid "Could not find %{name} provider of %{provider}" msgstr "" -#: ../lib/puppet/type.rb:2189 +#: ../lib/puppet/type.rb:2113 msgid "You cannot add relationships without a catalog" msgstr "" -#: ../lib/puppet/type.rb:2492 +#: ../lib/puppet/type.rb:2416 msgid "Unable to mark '%{name}' as sensitive: %{name} is a parameter and not a property, and cannot be automatically redacted." msgstr "" -#: ../lib/puppet/type.rb:2495 +#: ../lib/puppet/type.rb:2419 msgid "Unable to mark '%{name}' as sensitive: the property itself was not assigned a value." msgstr "" -#: ../lib/puppet/type.rb:2497 +#: ../lib/puppet/type.rb:2421 msgid "Unable to mark '%{name}' as sensitive: the property itself is not defined on %{type}." msgstr "" -#: ../lib/puppet/type.rb:2555 +#: ../lib/puppet/type.rb:2479 msgid "Could not set %{attribute} on %{class_name}: %{detail}" msgstr "" @@ -9461,14 +9252,6 @@ msgstr "" msgid "Cannot create group if user '%{name}' exists." msgstr "" -#: ../lib/puppet/util/windows/api_types.rb:85 -msgid "Unable to read wide strings with %{null_terminator} terminal nulls" -msgstr "" - -#: ../lib/puppet/util/windows/api_types.rb:230 -msgid "Bad GUID format." -msgstr "" - #: ../lib/puppet/util/windows/com.rb:17 msgid "%{name} failed (hresult %{result})." msgstr "" @@ -9508,15 +9291,15 @@ msgstr "" msgid "(Win32 error: %{detail})" msgstr "" -#: ../lib/puppet/util/windows/file.rb:181 +#: ../lib/puppet/util/windows/file.rb:117 msgid "Failed to set file attributes" msgstr "" -#: ../lib/puppet/util/windows/file.rb:256 +#: ../lib/puppet/util/windows/file.rb:180 msgid "out_buffer is required" msgstr "" -#: ../lib/puppet/util/windows/file.rb:348 +#: ../lib/puppet/util/windows/file.rb:253 msgid "Failed to call GetLongPathName" msgstr "" @@ -9683,119 +9466,119 @@ msgstr "" msgid "Failed to set security information" msgstr "" -#: ../lib/puppet/util/windows/service.rb:349 +#: ../lib/puppet/util/windows/service.rb:44 msgid "Starting the %{service_name} service. Timeout set to: %{timeout} seconds" msgstr "" -#: ../lib/puppet/util/windows/service.rb:359 +#: ../lib/puppet/util/windows/service.rb:54 msgid "Failed to start the service" msgstr "" -#: ../lib/puppet/util/windows/service.rb:363 +#: ../lib/puppet/util/windows/service.rb:58 msgid "Successfully started the %{service_name} service" msgstr "" -#: ../lib/puppet/util/windows/service.rb:372 +#: ../lib/puppet/util/windows/service.rb:67 msgid "Stopping the %{service_name} service. Timeout set to: %{timeout} seconds" msgstr "" -#: ../lib/puppet/util/windows/service.rb:380 +#: ../lib/puppet/util/windows/service.rb:75 msgid "Successfully stopped the %{service_name} service" msgstr "" -#: ../lib/puppet/util/windows/service.rb:389 +#: ../lib/puppet/util/windows/service.rb:84 msgid "Resuming the %{service_name} service. Timeout set to: %{timeout} seconds" msgstr "" -#: ../lib/puppet/util/windows/service.rb:405 +#: ../lib/puppet/util/windows/service.rb:100 msgid "Successfully resumed the %{service_name} service" msgstr "" -#: ../lib/puppet/util/windows/service.rb:421 +#: ../lib/puppet/util/windows/service.rb:116 msgid "Unknown Service state '%{current_state}' for '%{service_name}'" msgstr "" -#: ../lib/puppet/util/windows/service.rb:448 +#: ../lib/puppet/util/windows/service.rb:143 msgid "Unknown start type '%{start_type}' for '%{service_name}'" msgstr "" -#: ../lib/puppet/util/windows/service.rb:498 +#: ../lib/puppet/util/windows/service.rb:193 msgid "Failed to update service configuration" msgstr "" -#: ../lib/puppet/util/windows/service.rb:563 +#: ../lib/puppet/util/windows/service.rb:258 msgid "Failed to fetch services" msgstr "" -#: ../lib/puppet/util/windows/service.rb:612 +#: ../lib/puppet/util/windows/service.rb:307 msgid "Failed to open a handle to the service" msgstr "" -#: ../lib/puppet/util/windows/service.rb:629 +#: ../lib/puppet/util/windows/service.rb:324 msgid "Failed to open a handle to the service control manager" msgstr "" -#: ../lib/puppet/util/windows/service.rb:652 +#: ../lib/puppet/util/windows/service.rb:347 msgid "The service is already in the %{final_state} state. No further work needs to be done." msgstr "" -#: ../lib/puppet/util/windows/service.rb:664 +#: ../lib/puppet/util/windows/service.rb:359 msgid "The service must be in one of the %{valid_initial_states} states to perform this transition. It is currently in the %{current_state} state." msgstr "" -#: ../lib/puppet/util/windows/service.rb:675 +#: ../lib/puppet/util/windows/service.rb:370 msgid "There is already a pending transition to the %{final_state} state for the %{service_name} service." msgstr "" -#: ../lib/puppet/util/windows/service.rb:691 +#: ../lib/puppet/util/windows/service.rb:386 msgid "The service is in the %{pending_state} state, which is an unsafe pending state." msgstr "" -#: ../lib/puppet/util/windows/service.rb:696 +#: ../lib/puppet/util/windows/service.rb:391 msgid "Transitioning the %{service_name} service from %{initial_state} to %{final_state}" msgstr "" -#: ../lib/puppet/util/windows/service.rb:700 +#: ../lib/puppet/util/windows/service.rb:395 msgid "Waiting for the transition to finish" msgstr "" -#: ../lib/puppet/util/windows/service.rb:705 +#: ../lib/puppet/util/windows/service.rb:400 msgid "Failed to transition the %{service_name} service to the %{final_state} state. Detail: %{detail}" msgstr "" -#: ../lib/puppet/util/windows/service.rb:744 ../lib/puppet/util/windows/service.rb:780 +#: ../lib/puppet/util/windows/service.rb:439 ../lib/puppet/util/windows/service.rb:475 msgid "Service query failed" msgstr "" -#: ../lib/puppet/util/windows/service.rb:823 +#: ../lib/puppet/util/windows/service.rb:518 msgid "Service query for %{parameter_name} failed" msgstr "" -#: ../lib/puppet/util/windows/service.rb:846 +#: ../lib/puppet/util/windows/service.rb:541 msgid "Failed to update service %{change} configuration" msgstr "" -#: ../lib/puppet/util/windows/service.rb:873 +#: ../lib/puppet/util/windows/service.rb:568 msgid "Failed to send the %{control_signal} signal to the service. Its current state is %{current_state}. Reason for failure:" msgstr "" -#: ../lib/puppet/util/windows/service.rb:908 +#: ../lib/puppet/util/windows/service.rb:603 msgid "The service transitioned to the %{pending_state} state." msgstr "" -#: ../lib/puppet/util/windows/service.rb:922 +#: ../lib/puppet/util/windows/service.rb:617 msgid "Timed out while waiting for the service to transition from %{initial_state} to %{final_state} OR from %{initial_state} to %{pending_state} to %{final_state}. The service's current state is %{current_state}." msgstr "" -#: ../lib/puppet/util/windows/service.rb:937 +#: ../lib/puppet/util/windows/service.rb:632 msgid "Waiting for the pending transition to the %{final_state} state to finish." msgstr "" -#: ../lib/puppet/util/windows/service.rb:951 +#: ../lib/puppet/util/windows/service.rb:646 msgid "Unexpected transition to the %{current_state} state while waiting for the pending transition from %{pending_state} to %{final_state} to finish." msgstr "" -#: ../lib/puppet/util/windows/service.rb:965 +#: ../lib/puppet/util/windows/service.rb:660 msgid "Timed out while waiting for the pending transition from %{pending_state} to %{final_state} to finish. The current state is %{current_state}." msgstr "" From 801c4334a10b6bd3dbe3b461bdb767b5349c4173 Mon Sep 17 00:00:00 2001 From: Gabriel Nagy Date: Thu, 3 Sep 2020 14:57:39 +0300 Subject: [PATCH 151/731] (PUP-10653) Remove usage of Dir constants Remove usage of CSIDL Dir constants and replace them with environment variables. Dir::PROFILE -> ENV['USERPROFILE'] Dir::COMMON_APPDATA -> ENV['ALLUSERSPROFILE'] Dir::WINDOWS -> ENV['SystemRoot'] Remove requires to the Dir monkey patch. --- .../lib/puppet/acceptance/windows_utils.rb | 3 +-- ext/windows/service/daemon.rb | 5 +---- lib/puppet/util/run_mode.rb | 2 +- lib/puppet/util/windows.rb | 1 - .../integration/util/windows/security_spec.rb | 2 +- spec/unit/util/run_mode_spec.rb | 22 +++++-------------- 6 files changed, 10 insertions(+), 25 deletions(-) diff --git a/acceptance/lib/puppet/acceptance/windows_utils.rb b/acceptance/lib/puppet/acceptance/windows_utils.rb index b48a0816b5d..bb37105d572 100644 --- a/acceptance/lib/puppet/acceptance/windows_utils.rb +++ b/acceptance/lib/puppet/acceptance/windows_utils.rb @@ -9,8 +9,7 @@ module WindowsUtils def profile_base(agent) ruby = Puppet::Acceptance::CommandUtils.ruby_command(agent) getbasedir = <<'END' -require 'puppet/util/windows/monkey_patches/dir' -puts Dir::PROFILE.match(/(.*)\\\\[^\\\\]*/)[1] +puts ENV['USERPROFILE'].match(/(.*)\\\\[^\\\\]*/)[1] END on(agent, "#{ruby} -e \"#{getbasedir}\"").stdout.chomp end diff --git a/ext/windows/service/daemon.rb b/ext/windows/service/daemon.rb index 1a01d658113..0eb8b65f21d 100755 --- a/ext/windows/service/daemon.rb +++ b/ext/windows/service/daemon.rb @@ -11,16 +11,13 @@ # monkey patches ruby Process to add .create method require 'puppet/util/windows/monkey_patches/process' -# monkey patch Dir to add constants -require 'puppet/util/windows/monkey_patches/dir' - class WindowsDaemon < Puppet::Util::Windows::Daemon CREATE_NEW_CONSOLE = 0x00000010 @run_thread = nil @LOG_TO_FILE = false @loglevel = 0 - LOG_FILE = File.expand_path(File.join(Dir::COMMON_APPDATA, 'PuppetLabs', 'puppet', 'var', 'log', 'windows.log')) + LOG_FILE = File.expand_path(File.join(ENV['ALLUSERSPROFILE'], 'PuppetLabs', 'puppet', 'var', 'log', 'windows.log')) LEVELS = [:debug, :info, :notice, :warning, :err, :alert, :emerg, :crit] LEVELS.each do |level| define_method("log_#{level}") do |msg| diff --git a/lib/puppet/util/run_mode.rb b/lib/puppet/util/run_mode.rb index c21a20366d1..23172d41057 100644 --- a/lib/puppet/util/run_mode.rb +++ b/lib/puppet/util/run_mode.rb @@ -111,7 +111,7 @@ def log_dir private def windows_common_base(*extra) - [Dir::COMMON_APPDATA, "PuppetLabs"] + extra + [ENV['ALLUSERSPROFILE'], "PuppetLabs"] + extra end end end diff --git a/lib/puppet/util/windows.rb b/lib/puppet/util/windows.rb index d8898bfec79..ad6f3b71964 100644 --- a/lib/puppet/util/windows.rb +++ b/lib/puppet/util/windows.rb @@ -43,7 +43,6 @@ class EventLog; end require 'puppet/util/windows/registry' require 'puppet/util/windows/eventlog' require 'puppet/util/windows/service' - require 'puppet/util/windows/monkey_patches/dir' require 'puppet/util/windows/monkey_patches/process' end end diff --git a/spec/integration/util/windows/security_spec.rb b/spec/integration/util/windows/security_spec.rb index b12cb9f7fc6..0ed6fe42efc 100644 --- a/spec/integration/util/windows/security_spec.rb +++ b/spec/integration/util/windows/security_spec.rb @@ -822,7 +822,7 @@ def check_delete(path) end describe "locked files" do - let (:explorer) { File.join(Dir::WINDOWS, "explorer.exe") } + let (:explorer) { File.join(ENV['SystemRoot'], "explorer.exe") } it "should get the owner" do expect(winsec.get_owner(explorer)).to match(/^S-1-5-/) diff --git a/spec/unit/util/run_mode_spec.rb b/spec/unit/util/run_mode_spec.rb index 6abe9145a8f..e442fce9010 100644 --- a/spec/unit/util/run_mode_spec.rb +++ b/spec/unit/util/run_mode_spec.rb @@ -101,22 +101,12 @@ describe Puppet::Util::WindowsRunMode, :if => Puppet::Util::Platform.windows? do before do - if not Dir.const_defined? :COMMON_APPDATA - Dir.const_set :COMMON_APPDATA, "/CommonFakeBase" - @remove_const = true - end @run_mode = Puppet::Util::WindowsRunMode.new('fake') end - after do - if @remove_const - Dir.send :remove_const, :COMMON_APPDATA - end - end - describe "#conf_dir" do it "has confdir ending in Puppetlabs/puppet/etc when run as root" do - as_root { expect(@run_mode.conf_dir).to eq(File.expand_path(File.join(Dir::COMMON_APPDATA, "PuppetLabs", "puppet", "etc"))) } + as_root { expect(@run_mode.conf_dir).to eq(File.expand_path(File.join(ENV['ALLUSERSPROFILE'], "PuppetLabs", "puppet", "etc"))) } end it "has confdir in ~/.puppetlabs/etc/puppet when run as non-root" do @@ -126,7 +116,7 @@ describe "#code_dir" do it "has codedir ending in PuppetLabs/code when run as root" do - as_root { expect(@run_mode.code_dir).to eq(File.expand_path(File.join(Dir::COMMON_APPDATA, "PuppetLabs", "code"))) } + as_root { expect(@run_mode.code_dir).to eq(File.expand_path(File.join(ENV['ALLUSERSPROFILE'], "PuppetLabs", "code"))) } end it "has codedir in ~/.puppetlabs/etc/code when run as non-root" do @@ -136,7 +126,7 @@ describe "#var_dir" do it "has vardir ending in PuppetLabs/puppet/cache when run as root" do - as_root { expect(@run_mode.var_dir).to eq(File.expand_path(File.join(Dir::COMMON_APPDATA, "PuppetLabs", "puppet", "cache"))) } + as_root { expect(@run_mode.var_dir).to eq(File.expand_path(File.join(ENV['ALLUSERSPROFILE'], "PuppetLabs", "puppet", "cache"))) } end it "has vardir in ~/.puppetlabs/opt/puppet/cache when run as non-root" do @@ -146,7 +136,7 @@ describe "#public_dir" do it "has publicdir ending in PuppetLabs/puppet/public when run as root" do - as_root { expect(@run_mode.public_dir).to eq(File.expand_path(File.join(Dir::COMMON_APPDATA, "PuppetLabs", "puppet", "public"))) } + as_root { expect(@run_mode.public_dir).to eq(File.expand_path(File.join(ENV['ALLUSERSPROFILE'], "PuppetLabs", "puppet", "public"))) } end it "has publicdir in ~/.puppetlabs/opt/puppet/public when run as non-root" do @@ -157,7 +147,7 @@ describe "#log_dir" do describe "when run as root" do it "has logdir ending in PuppetLabs/puppet/var/log" do - as_root { expect(@run_mode.log_dir).to eq(File.expand_path(File.join(Dir::COMMON_APPDATA, "PuppetLabs", "puppet", "var", "log"))) } + as_root { expect(@run_mode.log_dir).to eq(File.expand_path(File.join(ENV['ALLUSERSPROFILE'], "PuppetLabs", "puppet", "var", "log"))) } end end @@ -171,7 +161,7 @@ describe "#run_dir" do describe "when run as root" do it "has rundir ending in PuppetLabs/puppet/var/run" do - as_root { expect(@run_mode.run_dir).to eq(File.expand_path(File.join(Dir::COMMON_APPDATA, "PuppetLabs", "puppet", "var", "run"))) } + as_root { expect(@run_mode.run_dir).to eq(File.expand_path(File.join(ENV['ALLUSERSPROFILE'], "PuppetLabs", "puppet", "var", "run"))) } end end From 28f69b260bdf0d05b2944f94b193b77357338ff6 Mon Sep 17 00:00:00 2001 From: Gabriel Nagy Date: Thu, 3 Sep 2020 15:10:45 +0300 Subject: [PATCH 152/731] (PUP-10653) Remove Dir monkey patch --- lib/puppet/util/windows/monkey_patches/dir.rb | 419 ------------------ .../util/windows/monkey_patches/dir_spec.rb | 231 ---------- 2 files changed, 650 deletions(-) delete mode 100644 lib/puppet/util/windows/monkey_patches/dir.rb delete mode 100644 spec/integration/util/windows/monkey_patches/dir_spec.rb diff --git a/lib/puppet/util/windows/monkey_patches/dir.rb b/lib/puppet/util/windows/monkey_patches/dir.rb deleted file mode 100644 index 386ca854648..00000000000 --- a/lib/puppet/util/windows/monkey_patches/dir.rb +++ /dev/null @@ -1,419 +0,0 @@ -require 'puppet/ffi/windows' -require 'puppet/util/windows/string' - -class Dir - extend Puppet::FFI::Windows::Functions - extend Puppet::FFI::Windows::Structs - - include Puppet::FFI::Windows::Constants - include Puppet::FFI::Windows::Structs - - # CSIDL constants - csidl = Hash[ - "DESKTOP", 0x0000, - "INTERNET", 0x0001, - "PROGRAMS", 0x0002, - "CONTROLS", 0x0003, - "PRINTERS", 0x0004, - "PERSONAL", 0x0005, - "FAVORITES", 0x0006, - "STARTUP", 0x0007, - "RECENT", 0x0008, - "SENDTO", 0x0009, - "BITBUCKET", 0x000a, - "STARTMENU", 0x000b, - "MYDOCUMENTS", 0x000c, - "MYMUSIC", 0x000d, - "MYVIDEO", 0x000e, - "DESKTOPDIRECTORY", 0x0010, - "DRIVES", 0x0011, - "NETWORK", 0x0012, - "NETHOOD", 0x0013, - "FONTS", 0x0014, - "TEMPLATES", 0x0015, - "COMMON_STARTMENU", 0x0016, - "COMMON_PROGRAMS", 0X0017, - "COMMON_STARTUP", 0x0018, - "COMMON_FAVORITES", 0x001f, - "COMMON_DESKTOPDIRECTORY", 0x0019, - "APPDATA", 0x001a, - "PRINTHOOD", 0x001b, - "LOCAL_APPDATA", 0x001c, - "ALTSTARTUP", 0x001d, - "COMMON_ALTSTARTUP", 0x001e, - "INTERNET_CACHE", 0x0020, - "COOKIES", 0x0021, - "HISTORY", 0x0022, - "COMMON_APPDATA", 0x0023, - "WINDOWS", 0x0024, - "SYSTEM", 0x0025, - "PROGRAM_FILES", 0x0026, - "MYPICTURES", 0x0027, - "PROFILE", 0x0028, - "SYSTEMX86", 0x0029, - "PROGRAM_FILESX86", 0x002a, - "PROGRAM_FILES_COMMON", 0x002b, - "PROGRAM_FILES_COMMONX86", 0x002c, - "COMMON_TEMPLATES", 0x002d, - "COMMON_DOCUMENTS", 0x002e, - "CONNECTIONS", 0x0031, - "COMMON_MUSIC", 0x0035, - "COMMON_PICTURES", 0x0036, - "COMMON_VIDEO", 0x0037, - "RESOURCES", 0x0038, - "RESOURCES_LOCALIZED", 0x0039, - "COMMON_OEM_LINKS", 0x003a, - "CDBURN_AREA", 0x003b, - "COMMON_ADMINTOOLS", 0x002f, - "ADMINTOOLS", 0x0030 - ] - - # Dynamically set each of the CSIDL constants - csidl.each do |key, value| - buf = 0.chr * 1024 - path = nil - buf.encode!(Encoding::UTF_16LE) - - if SHGetFolderPathW(0, value, 0, 0, buf) == 0 # Current path - path = buf.strip - elsif SHGetFolderPathW(0, value, 0, 1, buf) == 0 # Default path - path = buf.strip - else - ptr = FFI::MemoryPointer.new(:long) - info = SHFILEINFO.new - flags = SHGFI_DISPLAYNAME | SHGFI_PIDL - - if SHGetFolderLocation(0, value, 0, 0, ptr) == 0 - if SHGetFileInfo(ptr.read_long, 0, info, info.size, flags) != 0 - path = info[:szDisplayName].to_s - path.force_encoding(Encoding.default_external) - end - end - end - - begin - Dir.const_set(key, path.encode(Encoding.default_external)) if path - rescue Encoding::UndefinedConversionError - Dir.const_set(key, path.encode(Encoding::UTF_8)) if path - end - end - - # Set Dir::MYDOCUMENTS to the same as Dir::PERSONAL if undefined - unless defined? MYDOCUMENTS - MYDOCUMENTS = PERSONAL if defined? PERSONAL - end - - class << self - # Creates the symlink +to+, linked to the existing directory +from+. If the - # +to+ directory already exists, it must be empty or an error is raised. - # - # Example: - # - # Dir.mkdir('C:/from') - # Dir.create_junction('C:/to', 'C:/from') - # - def create_junction(to, from) - to = Puppet::Util::Windows::String.wide_string(string_check(to)) - from = Puppet::Util::Windows::String.wide_string(string_check(from)) - - from_path = (0.chr * 1024).encode(Encoding::UTF_16LE) - - length = GetFullPathNameW(from, from_path.size, from_path, nil) - - if length == 0 || length > from_path.size - raise SystemCallError.new("GetFullPathNameW", FFI.errno) - else - from_path.strip! - end - - to_path = (0.chr * 1024).encode(Encoding::UTF_16LE) - - length = GetFullPathNameW(to, to_path.size, to_path, nil) - - if length == 0 || length > to_path.size - raise SystemCallError.new("GetFullPathNameW", FFI.errno) - else - to_path.strip! - end - - # You can create a junction to a directory that already exists, so - # long as it's empty. - unless CreateDirectoryW(to_path, nil) - if FFI.errno != ERROR_ALREADY_EXISTS - raise SystemCallError.new("CreateDirectoryW", FFI.errno) - end - end - - begin - # Generic read & write + open existing + reparse point & backup semantics - handle = CreateFileW( - to_path, - GENERIC_READ | GENERIC_WRITE, - 0, - nil, - OPEN_EXISTING, - FILE_FLAG_OPEN_REPARSE_POINT | FILE_FLAG_BACKUP_SEMANTICS, - 0 - ) - - if handle == INVALID_HANDLE_VALUE - raise SystemCallError.new("CreateFileW", FFI.errno) - end - - target = "\\??\\".encode(Encoding::UTF_16LE) + from_path - - rdb = REPARSE_JDATA_BUFFER.new - rdb[:ReparseTag] = 2684354563 # IO_REPARSE_TAG_MOUNT_POINT - rdb[:ReparseDataLength] = target.bytesize + 12 - rdb[:Reserved] = 0 - rdb[:SubstituteNameOffset] = 0 - rdb[:SubstituteNameLength] = target.bytesize - rdb[:PrintNameOffset] = target.bytesize + 2 - rdb[:PrintNameLength] = 0 - rdb[:PathBuffer] = target - - bytes = FFI::MemoryPointer.new(:ulong) - - begin - bool = DeviceIoControl( - handle, - CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 41, METHOD_BUFFERED, 0), - rdb, - rdb[:ReparseDataLength] + rdb.header_size, - nil, - 0, - bytes, - nil - ) - - error = FFI.errno - - unless bool - RemoveDirectoryW(to_path) - raise SystemCallError.new("DeviceIoControl", error) - end - ensure - FFI::WIN32.CloseHandle(handle) - end - end - - self - end - - # Returns the path that a given junction points to. Raises an - # Errno::ENOENT error if the given path does not exist. Returns false - # if it is not a junction. - # - # Example: - # - # Dir.mkdir('C:/from') - # Dir.create_junction('C:/to', 'C:/from') - # Dir.read_junction("c:/to") # => "c:/from" - # - def read_junction(junction) - return false unless Dir.junction?(junction) - - junction = Puppet::Util::Windows::String.wide_string(string_check(junction)) - - junction_path = (0.chr * 1024).encode(Encoding::UTF_16LE) - - length = GetFullPathNameW(junction, junction_path.size, junction_path, nil) - - if length == 0 || length > junction_path.size - raise SystemCallError.new("GetFullPathNameW", FFI.errno) - else - junction_path.strip! - end - - begin - # Generic read & write + open existing + reparse point & backup semantics - handle = CreateFileW( - junction_path, - GENERIC_READ | GENERIC_WRITE, - 0, - nil, - OPEN_EXISTING, - FILE_FLAG_OPEN_REPARSE_POINT | FILE_FLAG_BACKUP_SEMANTICS, - 0 - ) - - if handle == INVALID_HANDLE_VALUE - raise SystemCallError.new("CreateFileW", FFI.errno) - end - - rdb = REPARSE_JDATA_BUFFER.new - rdb[:ReparseTag] = 0 - rdb[:ReparseDataLength] = 0 - rdb[:Reserved] = 0 - rdb[:SubstituteNameOffset] = 0 - rdb[:SubstituteNameLength] = 0 - rdb[:PrintNameOffset] = 0 - rdb[:PrintNameLength] = 0 - rdb[:PathBuffer] = "" - - bytes = FFI::MemoryPointer.new(:ulong) - - begin - bool = DeviceIoControl( - handle, - CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 42, METHOD_BUFFERED, 0), - nil, - 0, - rdb, - 1024, - bytes, - nil - ) - - error = FFI.errno - - unless bool - raise SystemCallError.new("DeviceIoControl", error) - end - ensure - FFI::WIN32.CloseHandle(handle) - end - end - - # MSDN says print and substitute names can be in any order - jname = (rdb[:PathBuffer].to_ptr + rdb[:SubstituteNameOffset]).read_string(rdb[:SubstituteNameLength]) - jname = jname.bytes.to_a.pack("C*") - jname = jname.force_encoding(Encoding::UTF_16LE) - raise "Invalid junction name: #{jname.encode(Encoding::UTF_8)}" unless jname[0..3] == "\\??\\".encode(Encoding::UTF_16LE) - begin - File.expand_path(jname[4..-1].encode(Encoding.default_external)) - rescue Encoding::UndefinedConversionError - File.expand_path(jname[4..-1].encode(Encoding::UTF_8)) - end - end - - # Returns whether or not +path+ is empty. Returns false if +path+ is not - # a directory, or contains any files other than '.' or '..'. - # - def empty?(path) - path = string_check(path) - PathIsDirectoryEmptyW(Puppet::Util::Windows::String.wide_string(path)) != 0 - end - - # Returns whether or not +path+ is a junction. - # - def junction?(path) - path = string_check(path) - bool = true - - attrib = GetFileAttributesW(Puppet::Util::Windows::String.wide_string(path)) - - # Only directories with a reparse point attribute can be junctions - if attrib == INVALID_FILE_ATTRIBUTES || - attrib & FILE_ATTRIBUTE_DIRECTORY == 0 || - attrib & FILE_ATTRIBUTE_REPARSE_POINT == 0 - bool = false - end - - bool - end - - alias :old_glob :glob - - # Same as the standard MRI Dir.glob method except that it handles - # backslashes in path names. - # - def glob(glob_pattern, flags = 0, &block) - if glob_pattern.is_a?(Array) - temp = glob_pattern.map! { |pattern| string_check(pattern).tr("\\", "/") } - else - temp = string_check(glob_pattern).tr("\\", "/") - end - - if flags.is_a?(Hash) - old_glob(temp, **flags, &block) - else - old_glob(temp, flags, &block) - end - end - - alias old_ref [] - - # Same as the standard MRI Dir[] method except that it handles - # backslashes in path names. - # - def [](*glob_patterns) - temp = glob_patterns.map! { |pattern| "#{pattern}".tr("\\", "/") } - old_ref(*temp) - end - - # JRuby normalizes the path by default. - unless RUBY_PLATFORM == "java" - alias oldgetwd getwd - alias oldpwd pwd - - # Returns the present working directory. Unlike MRI, this method always - # normalizes the path. - # - # Examples: - # - # Dir.chdir("C:/Progra~1") - # Dir.getwd # => C:\Program Files - # - # Dir.chdir("C:/PROGRAM FILES") - # Dir.getwd # => C:\Program Files - # - def getwd - path1 = FFI::Buffer.new(:wint_t, 1024, true) - path2 = FFI::Buffer.new(:wint_t, 1024, true) - path3 = FFI::Buffer.new(:wint_t, 1024, true) - - length = GetCurrentDirectoryW(path1.size, path1) - - if length == 0 || length > path1.size - raise SystemCallError.new("GetCurrentDirectoryW", FFI.errno) - end - - length = GetShortPathNameW(path1, path2, path2.size) - - if length == 0 || length > path2.size - raise SystemCallError.new("GetShortPathNameW", FFI.errno) - end - - length = GetLongPathNameW(path2, path3, path3.size) - - if length == 0 || length > path3.size - raise SystemCallError.new("GetLongPathNameW", FFI.errno) - end - - path = wstrip(path3.read_bytes(length * 2)) - - begin - path.encode(Encoding.default_external) - rescue Encoding::UndefinedConversionError - path.encode(Encoding::UTF_8) - end - end - - alias :pwd :getwd - alias :reparse_dir? :junction? - - private - - # Simulate MRI's contortions for a stringiness check. - def string_check(arg) - return arg if arg.is_a?(String) - return arg.send(:to_str) if arg.respond_to?(:to_str, true) # MRI honors it, even if private - return arg.to_path if arg.respond_to?(:to_path) - raise TypeError - end - - # Macro from Windows header file, used by the create_junction method. - def CTL_CODE(device, function, method, access) - ((device) << 16) | ((access) << 14) | ((function) << 2) | (method) - end - - # Read a wide character string up until the first double null, and delete - # any remaining null characters. - def wstrip(str) - str.force_encoding(Encoding::UTF_16LE).encode(Encoding::UTF_8, invalid: :replace, undef: :replace). - split("\x00")[0].encode(Encoding.default_external) - end - end - end -end diff --git a/spec/integration/util/windows/monkey_patches/dir_spec.rb b/spec/integration/util/windows/monkey_patches/dir_spec.rb deleted file mode 100644 index b15b0f94e30..00000000000 --- a/spec/integration/util/windows/monkey_patches/dir_spec.rb +++ /dev/null @@ -1,231 +0,0 @@ -# coding: utf-8 -# frozen_string_literal: true - -require 'spec_helper' - -describe 'Dir', if: Puppet::Util::Platform.windows? do - - before(:all) do - @temp = Dir.tmpdir - @from = File.join(@temp, 'test_from_directory') - @ascii_to = File.join(@temp, 'test_to_directory') - @unicode_to = File.join(@temp, 'Ελλάσ') - @test_file = File.join(@from, 'test.txt') - - Dir.mkdir(@from) - end - - after(:all) do - FileUtils.rm_rf(@ascii_to) - FileUtils.rm_rf(@unicode_to) - FileUtils.rm_rf(@from) - end - - let(:pattern1) { "C:\\Program Files\\Common Files\\System\\*.dll" } - let(:pattern2) { "C:\\Windows\\*.exe" } - let(:pathname1) { Pathname.new(pattern1) } - let(:pathname2) { Pathname.new(pattern2) } - - let(:from) { @from } - let(:ascii_to) { @ascii_to } - let(:unicode_to) { @unicode_to } - let(:test_file) { @test_file } - - describe '.glob' do - it 'handles backslashes' do - expect { Dir.glob(pattern1) }.not_to raise_error - expect(Dir.glob(pattern1)).not_to be_empty - end - - it 'handles multiple strings' do - expect { Dir.glob([pattern1, pattern2]) }.not_to raise_error - expect(Dir.glob([pattern1, pattern2])).not_to be_empty - end - - it 'still observes flags' do - expect { Dir.glob('*', File::FNM_DOTMATCH) }.not_to raise_error - expect(Dir.glob('*', File::FNM_DOTMATCH)).to include('.') - end - - it 'still honors block' do - array = [] - expect do - Dir.glob('*', File::FNM_DOTMATCH) { |m| array << m } - end.not_to raise_error - expect(array).to include('.') - end - - it 'handles Pathname objects' do - expect { Dir.glob([pathname1, pathname2]) }.not_to raise_error - expect(Dir.glob([pathname1, pathname2])).not_to be_empty - end - - it 'requires a stringy argument' do - expect { Dir.glob(nil) }.to raise_error(TypeError) - end - end - - describe '.[]' do - it 'handles backslashes' do - expect { Dir[pattern1] }.not_to raise_error - expect(Dir[pattern1]).not_to be_empty - end - - it 'handles multiple arguments' do - expect { Dir[pattern1, pattern2] }.not_to raise_error - expect(Dir[pattern1, pattern2]).not_to be_empty - end - - it 'handles Pathname arguments' do - expect { Dir[pathname1, pathname2] }.not_to raise_error - expect(Dir[pathname1, pathname2]).not_to be_empty - end - end - - describe '.create_junction' do - after(:all) { FileUtils.rm_f(@test_file) } - - it 'is callable' do - expect(Dir).to respond_to(:create_junction) - end - - it 'works as expected with ASCII characters' do - expect { Dir.create_junction(ascii_to, from) }.not_to raise_error - expect(File).to exist(ascii_to) - File.open(test_file, 'w') { |fh| fh.puts 'Hello World' } - expect(Dir.entries(from)).to eq(Dir.entries(ascii_to)) - end - - it 'works as expected with unicode characters' do - expect { Dir.create_junction(unicode_to, from) }.not_to raise_error - expect(File).to exist(unicode_to) - File.open(test_file, 'w') { |fh| fh.puts 'Hello World' } - expect(Dir.entries(from)).to eq(Dir.entries(unicode_to)) - end - - it 'works as expected with Pathname objects' do - expect { Dir.create_junction(Pathname.new(ascii_to), Pathname.new(from)) }.not_to raise_error - expect(File).to exist(ascii_to) - File.open(test_file, 'w') { |fh| fh.puts 'Hello World' } - expect(Dir.entries(from)).to eq(Dir.entries(ascii_to)) - end - - it 'requires stringy arguments' do - expect { Dir.create_junction(nil, from) }.to raise_error(TypeError) - expect { Dir.create_junction(ascii_to, nil) }.to raise_error(TypeError) - end - end - - describe '.read_junction' do - it 'works as expected with ASCII characters' do - expect { Dir.create_junction(ascii_to, from) }.not_to raise_error - expect(File).to exist(ascii_to) - expect(Dir.read_junction(ascii_to)).to eq(from) - end - - it 'works as expected with unicode characters' do - expect { Dir.create_junction(unicode_to, from) }.not_to raise_error - expect(File).to exist(unicode_to) - expect(Dir.read_junction(unicode_to)).to eq(from) - end - - it 'is joinable with unicode characters' do - expect { Dir.create_junction(unicode_to, from) }.not_to raise_error - expect(File).to exist(unicode_to) - expect { File.join(Dir.read_junction(unicode_to), 'foo') }.not_to raise_error - end - - it 'works as expected with Pathname objects' do - expect { Dir.create_junction(Pathname.new(ascii_to), Pathname.new(from)) }.not_to raise_error - expect(File).to exist(ascii_to) - expect(Dir.read_junction(ascii_to)).to eq(from) - end - - it 'requires a stringy argument' do - expect { Dir.read_junction(nil) }.to raise_error(TypeError) - expect { Dir.read_junction([]) }.to raise_error(TypeError) - end - end - - describe '.junction?' do - it 'returns a boolean value' do - expect(Dir).to respond_to(:junction?) - expect { Dir.create_junction(ascii_to, from) }.not_to raise_error - expect(Dir.junction?(from)).to be false - expect(Dir.junction?(ascii_to)).to be true - expect(Dir.junction?(Pathname.new(ascii_to))).to be true - end - end - - describe '.reparse_dir?' do - it 'aliases junction' do - expect(Dir).to respond_to(:reparse_dir?) - expect(Dir.method(:reparse_dir?)).to eq(Dir.method(:junction?)) - end - end - - describe '.empty?' do - it 'returns expected result' do - expect(Dir).to respond_to(:empty?) - expect(Dir.empty?("C:\\")).to be false - expect(Dir.empty?(from)).to be true - expect(Dir.empty?(Pathname.new(from))).to be true - end - end - - describe '.pwd' do - it 'has basic functionality' do - expect(Dir).to respond_to(:pwd) - expect { Dir.pwd }.not_to raise_error - expect(Dir.pwd).to be_a_kind_of(String) - end - - it 'aliases getwd' do - expect(Dir.method(:pwd)).to eq(Dir.method(:getwd)) - end - - it 'returns full path even if short path was just used' do - Dir.chdir("C:\\Progra~1") - expect(Dir.pwd).to eq("C:\\Program Files") - end - - it 'returns full path even if long path was just used' do - Dir.chdir("C:\\Program Files") - expect(Dir.pwd).to eq("C:\\Program Files") - end - - it 'uses standard case conventions' do - Dir.chdir("C:\\PROGRAM FILES") - expect(Dir.pwd).to eq("C:\\Program Files") - end - - it 'converts forward slashes to backslashes' do - Dir.chdir("C:/Program Files") - expect(Dir.pwd).to eq("C:\\Program Files") - end - end - - describe 'constants' do - ["DESKTOP", "INTERNET", "PROGRAMS", "CONTROLS", - "PRINTERS", "PERSONAL", "FAVORITES", "STARTUP", "RECENT", "SENDTO", - "BITBUCKET", "STARTMENU", "MYDOCUMENTS", "MYMUSIC", "MYVIDEO", - "DESKTOPDIRECTORY", "DRIVES", "NETWORK", "NETHOOD", "FONTS", - "TEMPLATES", "COMMON_STARTMENU", "COMMON_PROGRAMS", - "COMMON_STARTUP", "COMMON_FAVORITES", "COMMON_DESKTOPDIRECTORY", - "APPDATA", "PRINTHOOD", "LOCAL_APPDATA", "ALTSTARTUP", - "COMMON_ALTSTARTUP", "INTERNET_CACHE", "COOKIES", "HISTORY", - "COMMON_APPDATA", "WINDOWS", "SYSTEM", "PROGRAM_FILES", - "MYPICTURES", "PROFILE", "SYSTEMX86", "PROGRAM_FILESX86", - "PROGRAM_FILES_COMMON", "PROGRAM_FILES_COMMONX86", - "COMMON_TEMPLATES", "COMMON_DOCUMENTS", "CONNECTIONS", - "COMMON_MUSIC", "COMMON_PICTURES", "COMMON_VIDEO", "RESOURCES", - "RESOURCES_LOCALIZED", "COMMON_OEM_LINKS", "CDBURN_AREA", - "COMMON_ADMINTOOLS", "ADMINTOOLS"].each do |constant| - it "#{constant} is set" do - expect { Dir.const_get(constant) }.not_to raise_error - expect(Dir.const_get(constant)).to be_a_kind_of(String) - end - end - end - -end From 63c6020da61fd2f77efa8cb4bd14b4c0ea31efad Mon Sep 17 00:00:00 2001 From: Gabriel Nagy Date: Mon, 7 Sep 2020 14:19:52 +0300 Subject: [PATCH 153/731] Revert "(PUP-391) Fix Rdoc 4+ specs on Windows Ruby 2 x64" This reverts commit 676768645f13a19381f0d40aa7e253db7d6cc4a8. As we are removing the Dir (win32/dir) monkeypatches, this workaround is no longer needed. --- lib/puppet/util/rdoc.rb | 7 ------- 1 file changed, 7 deletions(-) diff --git a/lib/puppet/util/rdoc.rb b/lib/puppet/util/rdoc.rb index 1a5f8c7d487..47894aec2a5 100644 --- a/lib/puppet/util/rdoc.rb +++ b/lib/puppet/util/rdoc.rb @@ -26,13 +26,6 @@ def rdoc(outputdir, files, charset = nil) options << "--force-update" options += [ "--charset", charset] if charset - # Rdoc root default is Dir.pwd, but the win32-dir gem monkey patches Dir.pwd - # replacing Ruby's normal / with \. When RDoc generates relative paths it - # uses relative_path_from that will generate errors when the slashes don't - # properly match. This is a workaround for that issue. - if Puppet::Util::Platform.windows? && RDoc::VERSION !~ /^[0-3]\./ - options += [ "--root", Dir.pwd.tr('\\', '/')] - end options += files # launch the documentation process From 4d10940ee3aad51f3062683bbfc486dbcb2cb7f6 Mon Sep 17 00:00:00 2001 From: Gabriel Nagy Date: Mon, 7 Sep 2020 16:31:42 +0300 Subject: [PATCH 154/731] (PUP-10583) Change checksum precedence Prefer `sha256` and other SHA algorithms over `md5` and `md5lite`. Update docs to refer to SHA256 as the default digest algorithm. Change md5-related variable names in the filebucket application to more general names. --- lib/puppet/application/filebucket.rb | 22 +++++++++++++--------- lib/puppet/defaults.rb | 12 ++++++------ lib/puppet/file_serving/http_metadata.rb | 2 +- lib/puppet/http/service/compiler.rb | 4 +--- lib/puppet/http/service/file_server.rb | 3 +-- lib/puppet/type/file/checksum.rb | 2 +- spec/unit/configurer_spec.rb | 2 +- spec/unit/defaults_spec.rb | 8 ++++---- 8 files changed, 28 insertions(+), 27 deletions(-) diff --git a/lib/puppet/application/filebucket.rb b/lib/puppet/application/filebucket.rb index 4e3cd560f42..e24661ffd77 100644 --- a/lib/puppet/application/filebucket.rb +++ b/lib/puppet/application/filebucket.rb @@ -16,6 +16,10 @@ def summary _("Store and retrieve files in a filebucket") end + def digest_algorithm + Puppet.default_digest_algorithm + end + def help <<-HELP @@ -38,14 +42,14 @@ def help backup: Send one or more files to the specified file bucket. Each sent file is - printed with its resulting md5 sum. + printed with its resulting #{digest_algorithm} sum. get: - Return the text associated with an md5 sum. The text is printed to + Return the text associated with an #{digest_algorithm} sum. The text is printed to stdout, and only one file can be retrieved at a time. restore: - Given a file path and an md5 sum, store the content associated with + Given a file path and an #{digest_algorithm} sum, store the content associated with the sum into the specified file path. You can specify an entirely new path to this argument; you are not restricted to restoring the content to its original location. @@ -212,8 +216,8 @@ def run_command end def get - md5 = args.shift - out = @client.getfile(md5) + digest = args.shift + out = @client.getfile(digest) print out end @@ -229,8 +233,8 @@ def backup $stderr.puts _("%{file}: cannot read file") % { file: file } next end - md5 = @client.backup(file) - puts "#{file}: #{md5}" + digest = @client.backup(file) + puts "#{file}: #{digest}" end end @@ -243,8 +247,8 @@ def list def restore file = args.shift - md5 = args.shift - @client.restore(file, md5) + digest = args.shift + @client.restore(file, digest) end def diff diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb index beeb9ed2ec6..61705fe17c8 100644 --- a/lib/puppet/defaults.rb +++ b/lib/puppet/defaults.rb @@ -17,19 +17,19 @@ def self.default_digest_algorithm def self.valid_digest_algorithms Puppet::Util::Platform.fips_enabled? ? %w[sha256 sha384 sha512 sha224] : - %w[md5 sha256 sha384 sha512 sha224] + %w[sha256 sha384 sha512 sha224 md5] end def self.default_file_checksum_types Puppet::Util::Platform.fips_enabled? ? %w[sha256 sha384 sha512 sha224] : - %w[md5 sha256 sha384 sha512 sha224] + %w[sha256 sha384 sha512 sha224 md5] end def self.valid_file_checksum_types Puppet::Util::Platform.fips_enabled? ? %w[sha256 sha256lite sha384 sha512 sha224 sha1 sha1lite mtime ctime] : - %w[md5 md5lite sha256 sha256lite sha384 sha512 sha224 sha1 sha1lite mtime ctime] + %w[sha256 sha256lite sha384 sha512 sha224 sha1 sha1lite md5 md5lite mtime ctime] end def self.default_basemodulepath @@ -793,9 +793,9 @@ def self.initialize_default_settings!(settings) only use lowercase letters, numbers, periods, underscores, and dashes. (That is, it should match `/\A[a-z0-9._-]+\Z/`.) * The special value `ca` is reserved, and can't be used as the certname - for a normal node. + for a normal node. - **Note:** You must set the certname in the main section of the puppet.conf file. Setting it in a different section causes errors. + **Note:** You must set the certname in the main section of the puppet.conf file. Setting it in a different section causes errors. Defaults to the node's fully qualified domain name.", :hook => proc { |value| raise(ArgumentError, _("Certificate names must be lower case")) unless value == value.downcase }}, @@ -1836,7 +1836,7 @@ def self.initialize_default_settings!(settings) :type => :ttl, :desc => "The maximum amount of time the puppet agent should wait for an already running puppet agent to finish before starting a new one. This is set by default to 1 minute. - A value of `unlimited` will cause puppet agent to wait indefinitely. + A value of `unlimited` will cause puppet agent to wait indefinitely. #{AS_DURATION}", } ) diff --git a/lib/puppet/file_serving/http_metadata.rb b/lib/puppet/file_serving/http_metadata.rb index 016cb2ad423..2aa5f62941f 100644 --- a/lib/puppet/file_serving/http_metadata.rb +++ b/lib/puppet/file_serving/http_metadata.rb @@ -51,7 +51,7 @@ def initialize(http_response, path = '/dev/null') def collect # Prefer the checksum_type from the indirector request options # but fall back to the alternative otherwise - [ @checksum_type, :md5, :sha256, :sha1, :mtime ].each do |type| + [ @checksum_type, :sha256, :sha1, :md5, :mtime ].each do |type| @checksum_type = type @checksum = @checksums[type] break if @checksum diff --git a/lib/puppet/http/service/compiler.rb b/lib/puppet/http/service/compiler.rb index 906c990e780..3edbcaea9b3 100644 --- a/lib/puppet/http/service/compiler.rb +++ b/lib/puppet/http/service/compiler.rb @@ -77,9 +77,7 @@ def get_node(name, environment:, configured_environment: nil, transaction_uuid: # @param [Boolean] static_catalog Indicates if the file metadata(s) are inlined # in the catalog. This informs the agent if it needs to make a second request # to retrieve metadata in addition to the initial catalog request. - # @param [Array] checksum_type An array of accepted checksum type. - # Currently defaults to `["md5", "sha256", "sha384", "sha512", "sha224"]`, - # or `["sha256", "sha384", "sha512", "sha224"]` if fips is enabled. + # @param [Array] checksum_type An array of accepted checksum types. # # @return [Array] An array # containing the request response and the deserialized catalog returned by diff --git a/lib/puppet/http/service/file_server.rb b/lib/puppet/http/service/file_server.rb index 44ffcf8ff92..f97f514e704 100644 --- a/lib/puppet/http/service/file_server.rb +++ b/lib/puppet/http/service/file_server.rb @@ -42,8 +42,7 @@ def initialize(client, session, server, port) # @param [Symbol] links Can be one of either `:follow` or `:manage`, defines # how links are handled. # @param [String] checksum_type The digest algorithm used to verify the file. - # Currently if fips is enabled, this defaults to `sha256`. Otherwise, it - # defaults to `md5`. + # Defaults to `sha256`. # @param [Symbol] source_permissions Can be one of `:use`, `:use_when_creating`, # or `:ignore`. This parameter tells the server if it should include the # file permissions in the response. If set to `:ignore`, the server will diff --git a/lib/puppet/type/file/checksum.rb b/lib/puppet/type/file/checksum.rb index 8446d0aaea8..983463e173b 100644 --- a/lib/puppet/type/file/checksum.rb +++ b/lib/puppet/type/file/checksum.rb @@ -7,7 +7,7 @@ desc "The checksum type to use when determining whether to replace a file's contents. - The default checksum type is md5." + The default checksum type is #{Puppet.default_digest_algorithm}." newvalues(*Puppet::Util::Checksums.known_checksum_types) diff --git a/spec/unit/configurer_spec.rb b/spec/unit/configurer_spec.rb index e3e716c4cd7..63ae7c97e0d 100644 --- a/spec/unit/configurer_spec.rb +++ b/spec/unit/configurer_spec.rb @@ -366,7 +366,7 @@ it "sets the checksum_type query param to the default supported_checksum_types in a catalog request" do expect(Puppet::Resource::Catalog.indirection).to receive(:find).with(anything, - hash_including(checksum_type: 'md5.sha256.sha384.sha512.sha224')) + hash_including(checksum_type: 'sha256.sha384.sha512.sha224.md5')) configurer.run end diff --git a/spec/unit/defaults_spec.rb b/spec/unit/defaults_spec.rb index aa5fc98a13d..c817b6e9156 100644 --- a/spec/unit/defaults_spec.rb +++ b/spec/unit/defaults_spec.rb @@ -77,9 +77,9 @@ end describe '.supported_checksum_types' do - it 'defaults to md5, sha256, sha384, sha512, sha224 when FIPS is not enabled' do + it 'defaults to sha256, sha384, sha512, sha224, md5 when FIPS is not enabled' do allow(Puppet::Util::Platform).to receive(:fips_enabled?).and_return(false) - expect(Puppet.default_file_checksum_types).to eq(%w[md5 sha256 sha384 sha512 sha224]) + expect(Puppet.default_file_checksum_types).to eq(%w[sha256 sha384 sha512 sha224 md5]) end it 'defaults to sha256, sha384, sha512, sha224 when FIPS is enabled' do @@ -89,8 +89,8 @@ end describe 'Puppet[:supported_checksum_types]' do - it 'defaults to md5, sha256, sha512, sha384, sha224' do - expect(Puppet.settings[:supported_checksum_types]).to eq(%w[md5 sha256 sha384 sha512 sha224]) + it 'defaults to sha256, sha512, sha384, sha224, md5' do + expect(Puppet.settings[:supported_checksum_types]).to eq(%w[sha256 sha384 sha512 sha224 md5]) end it 'should raise an error on an unsupported checksum type' do From 3ada8811cb482082444cb33abc4651eeffb93753 Mon Sep 17 00:00:00 2001 From: Gabriel Nagy Date: Mon, 7 Sep 2020 18:23:33 +0300 Subject: [PATCH 155/731] (PUP-10583) Update filebucket specs Update filebucket specs to not make assumptions about the type of digest used. --- spec/unit/application/filebucket_spec.rb | 70 ++++++++++++------------ 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/spec/unit/application/filebucket_spec.rb b/spec/unit/application/filebucket_spec.rb index da6e8d2e3b4..196ac0684f9 100644 --- a/spec/unit/application/filebucket_spec.rb +++ b/spec/unit/application/filebucket_spec.rb @@ -187,11 +187,11 @@ @filebucket.get end - it "should call the client getfile method with the given md5" do - md5="DEADBEEF" - allow(@filebucket).to receive(:args).and_return([md5]) + it "should call the client getfile method with the given digest" do + digest = 'DEADBEEF' + allow(@filebucket).to receive(:args).and_return([digest]) - expect(@client).to receive(:getfile).with(md5) + expect(@client).to receive(:getfile).with(digest) @filebucket.get end @@ -225,12 +225,12 @@ end describe "the command restore" do - it "should call the client getfile method with the given md5" do - md5="DEADBEEF" - file="testfile" - allow(@filebucket).to receive(:args).and_return([file, md5]) + it "should call the client getfile method with the given digest" do + digest = 'DEADBEEF' + file = 'testfile' + allow(@filebucket).to receive(:args).and_return([file, digest]) - expect(@client).to receive(:restore).with(file,md5) + expect(@client).to receive(:restore).with(file, digest) @filebucket.restore end @@ -238,55 +238,55 @@ describe "the command diff" do it "should call the client diff method with 2 given checksums" do - md5a="DEADBEEF" - md5b="BEEF" + digest_a = 'DEADBEEF' + digest_b = 'BEEF' allow(Puppet::FileSystem).to receive(:exist?).and_return(false) - allow(@filebucket).to receive(:args).and_return([md5a, md5b]) + allow(@filebucket).to receive(:args).and_return([digest_a, digest_b]) - expect(@client).to receive(:diff).with(md5a,md5b, nil, nil) + expect(@client).to receive(:diff).with(digest_a, digest_b, nil, nil) @filebucket.diff end - it "should call the clien diff with a path if the second argument is a file" do - md5a="DEADBEEF" - md5b="BEEF" - allow(Puppet::FileSystem).to receive(:exist?).with(md5a).and_return(false) - allow(Puppet::FileSystem).to receive(:exist?).with(md5b).and_return(true) - allow(@filebucket).to receive(:args).and_return([md5a, md5b]) + it "should call the client diff with a path if the second argument is a file" do + digest_a = 'DEADBEEF' + digest_b = 'BEEF' + allow(Puppet::FileSystem).to receive(:exist?).with(digest_a).and_return(false) + allow(Puppet::FileSystem).to receive(:exist?).with(digest_b).and_return(true) + allow(@filebucket).to receive(:args).and_return([digest_a, digest_b]) - expect(@client).to receive(:diff).with(md5a, nil, nil, md5b) + expect(@client).to receive(:diff).with(digest_a, nil, nil, digest_b) @filebucket.diff end - it "should call the clien diff with a path if the first argument is a file" do - md5a="DEADBEEF" - md5b="BEEF" - allow(Puppet::FileSystem).to receive(:exist?).with(md5a).and_return(true) - allow(Puppet::FileSystem).to receive(:exist?).with(md5b).and_return(false) - allow(@filebucket).to receive(:args).and_return([md5a, md5b]) + it "should call the client diff with a path if the first argument is a file" do + digest_a = 'DEADBEEF' + digest_b = 'BEEF' + allow(Puppet::FileSystem).to receive(:exist?).with(digest_a).and_return(true) + allow(Puppet::FileSystem).to receive(:exist?).with(digest_b).and_return(false) + allow(@filebucket).to receive(:args).and_return([digest_a, digest_b]) - expect(@client).to receive(:diff).with(nil, md5b, md5a, nil) + expect(@client).to receive(:diff).with(nil, digest_b, digest_a, nil) @filebucket.diff end it "should call the clien diff with paths if the both arguments are files" do - md5a="DEADBEEF" - md5b="BEEF" - allow(Puppet::FileSystem).to receive(:exist?).with(md5a).and_return(true) - allow(Puppet::FileSystem).to receive(:exist?).with(md5b).and_return(true) - allow(@filebucket).to receive(:args).and_return([md5a, md5b]) + digest_a = 'DEADBEEF' + digest_b = 'BEEF' + allow(Puppet::FileSystem).to receive(:exist?).with(digest_a).and_return(true) + allow(Puppet::FileSystem).to receive(:exist?).with(digest_b).and_return(true) + allow(@filebucket).to receive(:args).and_return([digest_a, digest_b]) - expect(@client).to receive(:diff).with(nil, nil, md5a, md5b) + expect(@client).to receive(:diff).with(nil, nil, digest_a, digest_b) @filebucket.diff end it "should fail if only one checksum is given" do - md5a="DEADBEEF" - allow(@filebucket).to receive(:args).and_return([md5a]) + digest_a = 'DEADBEEF' + allow(@filebucket).to receive(:args).and_return([digest_a]) expect { @filebucket.diff }.to raise_error Puppet::Error end From efa72c275a06c895390bc8d3af925ab6c5b9a8ec Mon Sep 17 00:00:00 2001 From: Gabriel Nagy Date: Thu, 10 Sep 2020 10:02:46 +0300 Subject: [PATCH 156/731] (PUP-10583) Use sha256 for filebucket acceptance test Now that sha256 is the default digest, md5 filebucketing fails. Previously a sha256 manifest was only applied on FIPS agents. Change the test to always use sha256. --- .../tests/resource/file/content_attribute.rb | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/acceptance/tests/resource/file/content_attribute.rb b/acceptance/tests/resource/file/content_attribute.rb index f43bf19aac9..37e89ba8a7a 100644 --- a/acceptance/tests/resource/file/content_attribute.rb +++ b/acceptance/tests/resource/file/content_attribute.rb @@ -56,18 +56,6 @@ dir = on(agent, puppet_filebucket("--configprint clientbucketdir")).stdout.chomp - md5_manifest = %Q| - filebucket { 'local': - path => '#{dir}', - } - - file { '#{target}': - ensure => present, - content => '{md5}18571d3a04b2bb7ccfdbb2c44c72caa9', - backup => local, - } - | - sha256_manifest = %Q| filebucket { 'local': path => '#{dir}', @@ -81,11 +69,7 @@ | step "Applying Manifest on Agent" - if on(agent, facter("fips_enabled")).stdout =~ /true/ - apply_manifest_on agent, sha256_manifest - else - apply_manifest_on agent, md5_manifest - end + apply_manifest_on agent, sha256_manifest step "Validate filebucket checksum file contents" on agent, "cat #{target}" do From 5464613bdb07b6c41f7f16245a846a99e14d015e Mon Sep 17 00:00:00 2001 From: Luchian Nemes Date: Tue, 8 Sep 2020 09:43:07 +0300 Subject: [PATCH 157/731] (PUP-10610) Change disable_i18n setting to true by default Starting with Puppet 7, the `disable_i18n` setting changes its default value from `false` to `true`. --- lib/puppet/defaults.rb | 2 +- spec/integration/defaults_spec.rb | 4 +++ spec/unit/node/environment_spec.rb | 54 ++++++++++++++++++------------ 3 files changed, 38 insertions(+), 22 deletions(-) diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb index 0ffd8df0a00..c102f09aef2 100644 --- a/lib/puppet/defaults.rb +++ b/lib/puppet/defaults.rb @@ -196,7 +196,7 @@ def self.initialize_default_settings!(settings) end }, :disable_i18n => { - :default => false, + :default => true, :type => :boolean, :desc => "If true, turns off all translations of Puppet and module log messages, which affects error, warning, and info log messages, diff --git a/spec/integration/defaults_spec.rb b/spec/integration/defaults_spec.rb index a76b8bb1bb3..05c6e2b6cdf 100644 --- a/spec/integration/defaults_spec.rb +++ b/spec/integration/defaults_spec.rb @@ -139,6 +139,10 @@ expect(Puppet.settings.value(:preferred_serialization_format)).to eq("json") end + it "should default to true the disable_i18n setting" do + expect(Puppet.settings.value(:disable_i18n)).to eq(true) + end + it "should have a setting for determining the configuration version and should default to an empty string" do expect(Puppet.settings[:config_version]).to eq("") end diff --git a/spec/unit/node/environment_spec.rb b/spec/unit/node/environment_spec.rb index 6f6c7b26984..d738928549b 100644 --- a/spec/unit/node/environment_spec.rb +++ b/spec/unit/node/environment_spec.rb @@ -526,34 +526,46 @@ def assert_manifest_conflict(expectation, envconf_manifest_value) end describe "managing module translations" do - it "creates a new text domain the first time we try to use the text domain" do - expect(Puppet::GettextConfig).to receive(:reset_text_domain).with(env.name) - expect(Puppet::ModuleTranslations).to receive(:load_from_modulepath) - expect(Puppet::GettextConfig).to receive(:clear_text_domain) + context "when i18n is enabled" do + before(:each) do + Puppet[:disable_i18n] = false + end - env.with_text_domain do; end - end + it "yields block results" do + ran = false + expect(env.with_text_domain { ran = true; :result }).to eq(:result) + expect(ran).to eq(true) + end - it "uses the existing text domain once it has been created" do - env.with_text_domain do; end + it "creates a new text domain the first time we try to use the text domain" do + expect(Puppet::GettextConfig).to receive(:reset_text_domain).with(env.name) + expect(Puppet::ModuleTranslations).to receive(:load_from_modulepath) + expect(Puppet::GettextConfig).to receive(:clear_text_domain) - expect(Puppet::GettextConfig).to receive(:use_text_domain).with(env.name) - env.with_text_domain do; end - end + env.with_text_domain do; end + end - it "yields block results" do - ran = false - expect(env.with_text_domain { ran = true; :result }).to eq(:result) - expect(ran).to eq(true) + it "uses the existing text domain once it has been created" do + env.with_text_domain do; end + + expect(Puppet::GettextConfig).to receive(:use_text_domain).with(env.name) + env.with_text_domain do; end + end end - it "yields block results when i18n is disabled" do - Puppet[:disable_i18n] = true + context "when i18n is disabled" do + it "yields block results" do + ran = false + expect(env.with_text_domain { ran = true; :result }).to eq(:result) + expect(ran).to eq(true) + end + + it "does not create a new text domain the first time we try to use the text domain" do + expect(Puppet::GettextConfig).not_to receive(:reset_text_domain) + expect(Puppet::ModuleTranslations).not_to receive(:load_from_modulepath) - ran = false - expect(env.with_text_domain { ran = true; :result }).to eq(:result) - expect(ran).to eq(true) + env.with_text_domain do; end + end end end - end From 4ec3d26ebeb1ce4b51054c9b1f268bea6521bc2d Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Fri, 4 Sep 2020 14:41:50 -0700 Subject: [PATCH 158/731] (PUP-10473) Delete legacy auth implementation Delete AuthConfigParser, AuthStore and Rights classes. AuthConfig and Authorization are unused, but we need to preserve the setter methods so that puppetserver can register its authentication provider. They can be removed after puppetserver no longer calls the setter[1] Delete dead RESTController. [1] https://github.com/puppetlabs/puppetserver/blob/6.13.0/src/ruby/puppetserver-lib/puppet/server/config.rb#L31-L36 --- lib/puppet/network/auth_config_parser.rb | 90 ---- lib/puppet/network/authconfig.rb | 98 +---- lib/puppet/network/authorization.rb | 38 +- lib/puppet/network/authstore.rb | 283 ------------ lib/puppet/network/http.rb | 2 + lib/puppet/network/http/handler.rb | 1 - lib/puppet/network/rest_controller.rb | 2 - lib/puppet/network/rights.rb | 210 --------- spec/integration/network/authconfig_spec.rb | 256 ----------- spec/unit/network/auth_config_parser_spec.rb | 115 ----- spec/unit/network/authconfig_spec.rb | 134 +----- spec/unit/network/authorization_spec.rb | 57 +-- spec/unit/network/authstore_spec.rb | 422 ------------------ spec/unit/network/http/handler_spec.rb | 1 - spec/unit/network/rights_spec.rb | 439 ------------------- 15 files changed, 10 insertions(+), 2138 deletions(-) delete mode 100644 lib/puppet/network/auth_config_parser.rb delete mode 100644 lib/puppet/network/authstore.rb delete mode 100644 lib/puppet/network/rest_controller.rb delete mode 100644 lib/puppet/network/rights.rb delete mode 100644 spec/integration/network/authconfig_spec.rb delete mode 100644 spec/unit/network/auth_config_parser_spec.rb delete mode 100644 spec/unit/network/authstore_spec.rb delete mode 100644 spec/unit/network/rights_spec.rb diff --git a/lib/puppet/network/auth_config_parser.rb b/lib/puppet/network/auth_config_parser.rb deleted file mode 100644 index 51ef7564723..00000000000 --- a/lib/puppet/network/auth_config_parser.rb +++ /dev/null @@ -1,90 +0,0 @@ -require 'puppet/network/rights' - -module Puppet::Network -class AuthConfigParser - - def self.new_from_file(file) - self.new(Puppet::FileSystem.read(file, :encoding => 'utf-8')) - end - - def initialize(string) - @string = string - end - - def parse - Puppet::Network::AuthConfig.new(parse_rights) - end - - def parse_rights - rights = Puppet::Network::Rights.new - right = nil - count = 1 - @string.each_line { |line| - case line.chomp - when /^\s*#/, /^\s*$/ - # skip comments and blank lines - when /^path\s+((?:~\s+)?[^ ]+)\s*$/ # "path /path" or "path ~ regex" - name = $1.chomp - right = rights.newright(name, count, @file) - when /^\s*(allow(?:_ip)?|deny(?:_ip)?|method|environment|auth(?:enticated)?)\s+(.+?)(\s*#.*)?$/ - if right.nil? - #TRANSLATORS "path" is a configuration file entry and should not be translated - raise Puppet::ConfigurationError, _("Missing or invalid 'path' before right directive at %{error_location}") % - { error_location: Puppet::Util::Errors.error_location(@file, count) } - end - parse_right_directive(right, $1, $2, count) - else - error_location_str = Puppet::Util::Errors.error_location(nil, count) - raise Puppet::ConfigurationError, _("Invalid entry at %{error_location}: %{file_text}") % - { error_location: error_location_str, file_text: line } - end - count += 1 - } - - # Verify each of the rights are valid. - # We let the check raise an error, so that it can raise an error - # pointing to the specific problem. - rights.each { |name, r| - r.valid? - } - rights - end - - def parse_right_directive(right, var, value, count) - value.strip! - case var - when "allow" - modify_right(right, :allow, value, _("allowing %{value} access"), count) - when "deny" - modify_right(right, :deny, value, _("denying %{value} access"), count) - when "allow_ip" - modify_right(right, :allow_ip, value, _("allowing IP %{value} access"), count) - when "deny_ip" - modify_right(right, :deny_ip, value, _("denying IP %{value} access"), count) - when "method" - modify_right(right, :restrict_method, value, _("allowing 'method' %{value}"), count) - when "environment" - modify_right(right, :restrict_environment, value, _("adding environment %{value}"), count) - when /auth(?:enticated)?/ - modify_right(right, :restrict_authenticated, value, _("adding authentication %{value}"), count) - else - error_location_str = Puppet::Util::Errors.error_location(nil, count) - raise Puppet::ConfigurationError, _("Invalid argument '%{var}' at %{error_location}") % - { var: var, error_location: error_location_str } - end - end - - def modify_right(right, method, value, msg, count) - value.split(/\s*,\s*/).each do |val| - begin - val.strip! - right.info msg % { value: val } - right.send(method, val) - rescue Puppet::AuthStoreError => detail - error_location_str = Puppet::Util::Errors.error_location(@file, count) - raise Puppet::ConfigurationError, "#{detail} #{error_location_str}", detail.backtrace - end - end - end -end -end diff --git a/lib/puppet/network/authconfig.rb b/lib/puppet/network/authconfig.rb index 2213cb6961a..bdb1d2000f0 100644 --- a/lib/puppet/network/authconfig.rb +++ b/lib/puppet/network/authconfig.rb @@ -1,101 +1,7 @@ -require 'puppet/network/rights' -require 'puppet/network/http' - module Puppet - class ConfigurationError < Puppet::Error; end - class Network::DefaultAuthProvider - attr_accessor :rights - - def self.master_url_prefix - Puppet::Network::HTTP::MASTER_URL_PREFIX - end - - def self.default_acl - [ - # Master API V3 - { :acl => "#{master_url_prefix}/v3/environments", :method => :find, :allow => '*', :authenticated => true }, - - { :acl => "~ ^#{master_url_prefix}\/v3\/catalog\/([^\/]+)$", :method => :find, :allow => '$1', :authenticated => true }, - { :acl => "~ ^#{master_url_prefix}\/v3\/node\/([^\/]+)$", :method => :find, :allow => '$1', :authenticated => true }, - { :acl => "~ ^#{master_url_prefix}\/v3\/report\/([^\/]+)$", :method => :save, :allow => '$1', :authenticated => true }, - - # this one will allow all file access, and thus delegate - # to fileserver.conf - { :acl => "#{master_url_prefix}/v3/file" }, - - { :acl => "#{master_url_prefix}/v3/status", :method => [:find], :authenticated => true }, - ] - end - - # Just proxy the setting methods to our rights stuff - [:allow, :deny].each do |method| - define_method(method) do |*args| - @rights.send(method, *args) - end - end - - # force regular ACLs to be present - def insert_default_acl - self.class.default_acl.each do |acl| - unless rights[acl[:acl]] - Puppet.info _("Inserting default '%{acl}' (auth %{auth}) ACL") % { acl: acl[:acl], auth: acl[:authenticated] } - mk_acl(acl) - end - end - # queue an empty (ie deny all) right for every other path - # actually this is not strictly necessary as the rights system - # denies not explicitly allowed paths - unless rights["/"] - rights.newright("/").restrict_authenticated(:any) - end - end - - def mk_acl(acl) - right = @rights.newright(acl[:acl]) - right.allow(acl[:allow] || "*") - - method = acl[:method] - if method - method = [method] unless method.is_a?(Array) - method.each { |m| right.restrict_method(m) } - end - right.restrict_authenticated(acl[:authenticated]) unless acl[:authenticated].nil? - end - - # check whether this request is allowed in our ACL - # raise an Puppet::Network::AuthorizedError if the request - # is denied. - def check_authorization(method, path, params) - authorization_failure_exception = @rights.is_request_forbidden_and_why?(method, path, params) - if authorization_failure_exception - Puppet.warning(_("Denying access: %{authorization_failure_exception}") % { authorization_failure_exception: authorization_failure_exception }) - raise authorization_failure_exception - end - end - - def initialize(rights=nil) - @rights = rights || Puppet::Network::Rights.new - insert_default_acl - end - end - class Network::AuthConfig - @@authprovider_class = nil - - def self.authprovider_class=(klass) - @@authprovider_class = klass - end - - def self.authprovider_class - @@authprovider_class || Puppet::Network::DefaultAuthProvider - end - - def initialize(rights=nil) - @authprovider = self.class.authprovider_class.new(rights) - end - - def check_authorization(method, path, params) - @authprovider.check_authorization(method, path, params) + def self.authprovider_class=(_) + # legacy auth is not supported, ignore end end end diff --git a/lib/puppet/network/authorization.rb b/lib/puppet/network/authorization.rb index ba52ffec84e..540c790c3ec 100644 --- a/lib/puppet/network/authorization.rb +++ b/lib/puppet/network/authorization.rb @@ -1,41 +1,7 @@ -require 'puppet/network/client_request' -require 'puppet/network/authconfig' -require 'puppet/network/auth_config_parser' - module Puppet::Network - class AuthConfigLoader - # Create our config object if necessary. If there's no configuration file - # we install our defaults - def self.authconfig - @auth_config_file ||= Puppet::Util::WatchedFile.new(Puppet[:rest_authconfig]) - if (not @auth_config) or @auth_config_file.changed? - begin - @auth_config = Puppet::Network::AuthConfigParser.new_from_file(Puppet[:rest_authconfig]).parse - rescue Errno::ENOENT, Errno::ENOTDIR - @auth_config = Puppet::Network::AuthConfig.new - end - end - - @auth_config - end - end - module Authorization - @@authconfigloader_class = nil - - def self.authconfigloader_class=(klass) - @@authconfigloader_class = klass - end - - def authconfig - authconfigloader = @@authconfigloader_class || AuthConfigLoader - authconfigloader.authconfig - end - - # Verify that our client has access. - def check_authorization(method, path, params) - authconfig.check_authorization(method, path, params) + def self.authconfigloader_class=(_) + # legacy auth is not supported, ignore end end end - diff --git a/lib/puppet/network/authstore.rb b/lib/puppet/network/authstore.rb deleted file mode 100644 index 7ac302421db..00000000000 --- a/lib/puppet/network/authstore.rb +++ /dev/null @@ -1,283 +0,0 @@ -# standard module for determining whether a given hostname or IP has access to -# the requested resource - -require 'ipaddr' -require 'puppet/util/logging' - -module Puppet - class AuthStoreError < Puppet::Error; end - class AuthorizationError < Puppet::Error; end - - class Network::AuthStore - include Puppet::Util::Logging - - # Is a given combination of name and ip address allowed? If either input - # is non-nil, then both inputs must be provided. If neither input - # is provided, then the authstore is considered local and defaults to "true". - def allowed?(name, ip) - if name or ip - # This is probably unnecessary, and can cause some weirdness in - # cases where we're operating over localhost but don't have a real - # IP defined. - raise Puppet::DevError, _("Name and IP must be passed to 'allowed?'") unless name and ip - # else, we're networked and such - else - # we're local - return true - end - - # yay insecure overrides - return true if globalallow? - - decl = declarations.find { |d| d.match?(name, ip) } - if decl - return decl.result - end - - info _("defaulting to no access for %{name}") % { name: name } - false - end - - # Mark a given pattern as allowed. - def allow(pattern) - # a simple way to allow anyone at all to connect - if pattern == "*" - @globalallow = true - else - store(:allow, pattern) - end - - nil - end - - def allow_ip(pattern) - store(:allow_ip, pattern) - end - - # Deny a given pattern. - def deny(pattern) - store(:deny, pattern) - end - - def deny_ip(pattern) - store(:deny_ip, pattern) - end - - # Is global allow enabled? - def globalallow? - @globalallow - end - - # does this auth store has any rules? - def empty? - @globalallow.nil? && @declarations.size == 0 - end - - def initialize - @globalallow = nil - @declarations = [] - end - - def to_s - "authstore" - end - - def interpolate(match) - @modified_declarations = @declarations.collect { |ace| ace.interpolate(match) }.sort - end - - def reset_interpolation - @modified_declarations = nil - end - - private - - # Returns our ACEs list, but if we have a modification of it, let's return - # it. This is used if we want to override the this purely immutable list - # by a modified version. - def declarations - @modified_declarations || @declarations - end - - # Store the results of a pattern into our hash. Basically just - # converts the pattern and sticks it into the hash. - def store(type, pattern) - @declarations << Declaration.new(type, pattern) - @declarations.sort! - - nil - end - - # A single declaration. Stores the info for a given declaration, - # provides the methods for determining whether a declaration matches, - # and handles sorting the declarations appropriately. - class Declaration - include Puppet::Util - include Comparable - - # The type of declaration: either :allow or :deny - attr_reader :type - VALID_TYPES = [ :allow, :deny, :allow_ip, :deny_ip ] - - attr_accessor :name - - # The pattern we're matching against. Can be an IPAddr instance, - # or an array of strings, resulting from reversing a hostname - # or domain name. - attr_reader :pattern - - # The length. Only used for iprange and domain. - attr_accessor :length - - # Sort the declarations most specific first. - def <=>(other) - compare(exact?, other.exact?) || - compare(ip?, other.ip?) || - ((length != other.length) && (other.length <=> length)) || - compare(deny?, other.deny?) || - ( ip? ? pattern.to_s <=> other.pattern.to_s : pattern <=> other.pattern) - end - - def deny? - type == :deny - end - - def exact? - @exact == :exact - end - - def initialize(type, pattern) - self.type = type - self.pattern = pattern - end - - # Are we an IP type? - def ip? - name == :ip - end - - # Does this declaration match the name/ip combo? - def match?(name, ip) - if ip? - pattern.include?(IPAddr.new(ip)) - else - matchname?(name) - end - end - - # Set the pattern appropriately. Also sets the name and length. - def pattern=(pattern) - if [:allow_ip, :deny_ip].include?(self.type) - parse_ip(pattern) - else - parse(pattern) - end - @orig = pattern - end - - # Mapping a type of statement into a return value. - def result - [:allow, :allow_ip].include?(type) - end - - def to_s - "#{type}: #{pattern}" - end - - # Set the declaration type. Either :allow or :deny. - def type=(type) - type = type.intern - raise ArgumentError, _("Invalid declaration type %{type}") % { type: type } unless VALID_TYPES.include?(type) - @type = type - end - - # interpolate a pattern to replace any - # backreferences by the given match - # for instance if our pattern is $1.reductivelabs.com - # and we're called with a MatchData whose capture 1 is puppet - # we'll return a pattern of puppet.reductivelabs.com - def interpolate(match) - clone = dup - if @name == :dynamic - clone.pattern = clone.pattern.reverse.collect do |p| - p.gsub(/\$(\d)/) { |m| match[$1.to_i] } - end.join(".") - end - clone - end - - private - - # Returns nil if both values are true or both are false, returns - # -1 if the first is true, and 1 if the second is true. Used - # in the <=> operator. - def compare(me, them) - (me and them) ? nil : me ? -1 : them ? 1 : nil - end - - # Does the name match our pattern? - def matchname?(name) - case @name - when :domain, :dynamic, :opaque - name = munge_name(name) - (pattern == name) or (not exact? and pattern.zip(name).all? { |p,n| p == n }) - when :regex - Regexp.new(pattern.slice(1..-2)).match(name) - end - end - - # Convert the name to a common pattern. - def munge_name(name) - # Change to name.downcase.split(".",-1).reverse for FQDN support - name.downcase.split(".").reverse - end - - # Parse our input pattern and figure out what kind of allowable - # statement it is. The output of this is used for later matching. - Octet = '(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])' - IPv4 = "#{Octet}\.#{Octet}\.#{Octet}\.#{Octet}" - IPv6_full = "_:_:_:_:_:_:_:_|_:_:_:_:_:_::_?|_:_:_:_:_::((_:)?_)?|_:_:_:_::((_:){0,2}_)?|_:_:_::((_:){0,3}_)?|_:_::((_:){0,4}_)?|_::((_:){0,5}_)?|::((_:){0,6}_)?" - IPv6_partial = "_:_:_:_:_:_:|_:_:_:_::(_:)?|_:_::(_:){0,2}|_::(_:){0,3}" - # It should be: - # IP = "#{IPv4}|#{IPv6_full}|(#{IPv6_partial}#{IPv4})".gsub(/_/,'([0-9a-fA-F]{1,4})').gsub(/\(/,'(?:') - # but ruby's ipaddr lib doesn't support the hybrid format - IP = "#{IPv4}|#{IPv6_full}".gsub(/_/,'([0-9a-fA-F]{1,4})').gsub(/\(/,'(?:') - - def parse_ip(value) - @name = :ip - @exact, @length, @pattern = *case value - when /^(?:#{IP})\/(\d+)$/ # 12.34.56.78/24, a001:b002::efff/120, c444:1000:2000::9:192.168.0.1/112 - [:inexact, $1.to_i, IPAddr.new(value)] - when /^(#{IP})$/ # 10.20.30.40, - [:exact, nil, IPAddr.new(value)] - when /^(#{Octet}\.){1,3}\*$/ # an ip address with a '*' at the end - segments = value.split(".")[0..-2] - bits = 8*segments.length - [:inexact, bits, IPAddr.new((segments+[0,0,0])[0,4].join(".") + "/#{bits}")] - else - raise AuthStoreError, _("Invalid IP pattern %{value}") % { value: value } - end - end - - def parse(value) - @name,@exact,@length,@pattern = *case value - when /^(\w[-\w]*\.)+[-\w]+$/ # a full hostname - # Change to /^(\w[-\w]*\.)+[-\w]+\.?$/ for FQDN support - [:domain,:exact,nil,munge_name(value)] - when /^\*(\.(\w[-\w]*)){1,}$/ # *.domain.com - host_sans_star = munge_name(value)[0..-2] - [:domain,:inexact,host_sans_star.length,host_sans_star] - when /\$\d+/ # a backreference pattern ala $1.reductivelabs.com or 192.168.0.$1 or $1.$2 - [:dynamic,:exact,nil,munge_name(value)] - when /^\w[-.@\w]*$/ # ? Just like a host name but allow '@'s and ending '.'s - [:opaque,:exact,nil,[value]] - when /^\/.*\/$/ # a regular expression - [:regex,:inexact,nil,value] - else - raise AuthStoreError, "Invalid pattern #{value}" - end - end - end - end -end - diff --git a/lib/puppet/network/http.rb b/lib/puppet/network/http.rb index bf0ceaa005c..330ce189711 100644 --- a/lib/puppet/network/http.rb +++ b/lib/puppet/network/http.rb @@ -9,7 +9,9 @@ module Puppet::Network::HTTP CA_URL_PREFIX = "/puppet-ca" CA_URL_VERSIONS = "v1" + require 'puppet/network/authconfig' require 'puppet/network/authorization' + require 'puppet/network/http/issues' require 'puppet/network/http/error' require 'puppet/network/http/route' diff --git a/lib/puppet/network/http/handler.rb b/lib/puppet/network/http/handler.rb index 6b4f8272c00..74328e1c2a3 100644 --- a/lib/puppet/network/http/handler.rb +++ b/lib/puppet/network/http/handler.rb @@ -2,7 +2,6 @@ module Puppet::Network::HTTP end require 'puppet/network/http' -require 'puppet/network/rights' require 'puppet/util/profiler' require 'puppet/util/profiler/aggregate' require 'resolv' diff --git a/lib/puppet/network/rest_controller.rb b/lib/puppet/network/rest_controller.rb deleted file mode 100644 index 76a9830eac5..00000000000 --- a/lib/puppet/network/rest_controller.rb +++ /dev/null @@ -1,2 +0,0 @@ -class Puppet::Network::RESTController # :nodoc: -end diff --git a/lib/puppet/network/rights.rb b/lib/puppet/network/rights.rb deleted file mode 100644 index 3cc34360174..00000000000 --- a/lib/puppet/network/rights.rb +++ /dev/null @@ -1,210 +0,0 @@ -require 'puppet/network/authstore' -require 'puppet/error' - -module Puppet::Network - -# this exception is thrown when a request is not authenticated -class AuthorizationError < Puppet::Error; end - -# Rights class manages a list of ACLs for paths. -class Rights - # Check that name is allowed or not - def allowed?(name, *args) - !is_forbidden_and_why?(name, :node => args[0], :ip => args[1]) - end - - def is_request_forbidden_and_why?(method, path, params) - methods_to_check = if method == :head - # :head is ok if either :find or :save is ok. - [:find, :save] - else - [method] - end - authorization_failure_exceptions = methods_to_check.map do |m| - is_forbidden_and_why?(path, params.merge({:method => m})) - end - if authorization_failure_exceptions.include? nil - # One of the methods we checked is ok, therefore this request is ok. - nil - else - # Just need to return any of the failure exceptions. - authorization_failure_exceptions.first - end - end - - def is_forbidden_and_why?(name, args = {}) - res = :nomatch - @rights.find do |acl| - found = false - # an acl can return :dunno, which means "I'm not qualified to answer your question, - # please ask someone else". This is used when for instance an acl matches, but not for the - # current rest method, where we might think some other acl might be more specific. - match = acl.match?(name) - if match - args[:match] = match - if (res = acl.allowed?(args[:node], args[:ip], args)) != :dunno - # return early if we're allowed - return nil if res - # we matched, select this acl - found = true - end - end - found - end - - # if we end up here, then that means we either didn't match or failed, in any - # case will return an error to the outside world - msg = "#{name} [#{args[:method]}]" - - AuthorizationError.new(_("Forbidden request: %{msg}") % { msg: msg }) - end - - def initialize - @rights = [] - end - - def [](name) - @rights.find { |acl| acl == name } - end - - def empty? - @rights.empty? - end - - def include?(name) - @rights.include?(name) - end - - def each - @rights.each { |r| yield r.name,r } - end - - # Define a new right to which access can be provided. - def newright(name, line=nil, file=nil) - add_right( Right.new(name, line, file) ) - end - - private - - def add_right(right) - @rights << right - right - end - - # Retrieve a right by name. - def right(name) - self[name] - end - - # A right. - class Right < Puppet::Network::AuthStore - attr_accessor :name, :key - # Overriding Object#methods sucks for debugging. If we're in here in the - # future, it would be nice to rename Right#methods - attr_accessor :methods, :environment, :authentication - attr_accessor :line, :file - - ALL = [:save, :destroy, :find, :search] - - Puppet::Util.logmethods(self, true) - - def initialize(name, line, file) - @methods = [] - @environment = [] - @authentication = true # defaults to authenticated - @name = name - @line = line || 0 - @file = file - @methods = ALL - - case name - when /^\// - @key = Regexp.new("^" + Regexp.escape(name)) - when /^~/ # this is a regex - @name = name.gsub(/^~\s+/,'') - @key = Regexp.new(@name) - else - raise ArgumentError, _("Unknown right type '%{name}'") % { name: name } - end - - super() - end - - def to_s - "access[#{@name}]" - end - - # There's no real check to do at this point - def valid? - true - end - - # does this right is allowed for this triplet? - # if this right is too restrictive (ie we don't match this access method) - # then return :dunno so that upper layers have a chance to try another right - # tailored to the given method - def allowed?(name, ip, args = {}) - if not @methods.include?(args[:method]) - return :dunno - elsif @environment.size > 0 and not @environment.include?(args[:environment]) - return :dunno - elsif (@authentication and not args[:authenticated]) - return :dunno - end - - begin - # make sure any capture are replaced if needed - interpolate(args[:match]) if args[:match] - res = super(name,ip) - ensure - reset_interpolation - end - res - end - - # restrict this right to some method only - def restrict_method(m) - m = m.intern if m.is_a?(String) - - raise ArgumentError, _("'%{m}' is not an allowed value for method directive") % { m: m } unless ALL.include?(m) - - # if we were allowing all methods, then starts from scratch - if @methods === ALL - @methods = [] - end - - raise ArgumentError, _("'%{m}' is already in the '%{name}' ACL") % { m: m, name: name } if @methods.include?(m) - - @methods << m - end - - def restrict_environment(environment) - env = Puppet.lookup(:environments).get(environment) - raise ArgumentError, _("'%{env}' is already in the '%{name}' ACL") % { env: env, name: name } if @environment.include?(env) - - @environment << env - end - - def restrict_authenticated(authentication) - case authentication - when "yes", "on", "true", true - authentication = true - when "no", "off", "false", false, "all" ,"any", :all, :any - authentication = false - else - raise ArgumentError, _("'%{name}' incorrect authenticated value: %{authentication}") % { name: name, authentication: authentication } - end - @authentication = authentication - end - - def match?(key) - # otherwise match with the regex - self.key.match(key) - end - - def ==(name) - self.name == name.gsub(/^~\s+/,'') - end - end -end -end diff --git a/spec/integration/network/authconfig_spec.rb b/spec/integration/network/authconfig_spec.rb deleted file mode 100644 index 48f8f3df333..00000000000 --- a/spec/integration/network/authconfig_spec.rb +++ /dev/null @@ -1,256 +0,0 @@ -require 'spec_helper' - -require 'puppet/network/authconfig' -require 'puppet/network/auth_config_parser' - -RSpec::Matchers.define :auth_allow do |params| - match do |auth| - begin - auth.check_authorization(*params) - true - rescue Puppet::Network::AuthorizationError - false - end - end - - failure_message do |instance| - "expected #{params[2][:node]}/#{params[2][:ip]} to be allowed" - end - - failure_message_when_negated do |instance| - "expected #{params[2][:node]}/#{params[2][:ip]} to be forbidden" - end -end - -describe Puppet::Network::AuthConfig do - include PuppetSpec::Files - - def add_rule(rule) - parser = Puppet::Network::AuthConfigParser.new( - "path /test\n#{rule}\n" - ) - @auth = parser.parse - end - - def add_regex_rule(regex, rule) - parser = Puppet::Network::AuthConfigParser.new( - "path ~ #{regex}\n#{rule}\n" - ) - @auth = parser.parse - end - - def add_raw_stanza(stanza) - parser = Puppet::Network::AuthConfigParser.new( - stanza - ) - @auth = parser.parse - end - - def request(args = {}) - args = { - :key => 'key', - :node => 'host.domain.com', - :ip => '10.1.1.1', - :authenticated => true - }.merge(args) - [:find, "/test/#{args[:key]}", args] - end - - describe "allow" do - it "should not match IP addresses" do - add_rule("allow 10.1.1.1") - - expect(@auth).not_to auth_allow(request) - end - - it "should not accept CIDR IPv4 address" do - expect { - add_rule("allow 10.0.0.0/8") - }.to raise_error Puppet::ConfigurationError, /Invalid pattern 10\.0\.0\.0\/8/ - end - - it "should not match wildcard IPv4 address" do - expect { - add_rule("allow 10.1.1.*") - }.to raise_error Puppet::ConfigurationError, /Invalid pattern 10\.1\.1\.*/ - end - - it "should not match IPv6 address" do - expect { - add_rule("allow 2001:DB8::8:800:200C:417A") - }.to raise_error Puppet::ConfigurationError, /Invalid pattern 2001/ - end - - it "should support hostname" do - add_rule("allow host.domain.com") - - expect(@auth).to auth_allow(request) - end - - it "should support wildcard host" do - add_rule("allow *.domain.com") - - expect(@auth).to auth_allow(request) - end - - it 'should warn about missing path before allow_ip in stanza' do - expect { - add_raw_stanza("allow_ip 10.0.0.1\n") - }.to raise_error Puppet::ConfigurationError, /Missing or invalid 'path' before right directive at \(line: .*\)/ - end - - it 'should warn about missing path before allow in stanza' do - expect { - add_raw_stanza("allow host.domain.com\n") - }.to raise_error Puppet::ConfigurationError, /Missing or invalid 'path' before right directive at \(line: .*\)/ - end - - it "should support hostname backreferences" do - add_regex_rule('^/test/([^/]+)$', "allow $1.domain.com") - - expect(@auth).to auth_allow(request(:key => 'host')) - end - - it "should support opaque strings" do - add_rule("allow this-is-opaque@or-not") - - expect(@auth).to auth_allow(request(:node => 'this-is-opaque@or-not')) - end - - it "should support opaque strings and backreferences" do - add_regex_rule('^/test/([^/]+)$', "allow $1") - - expect(@auth).to auth_allow(request(:key => 'this-is-opaque@or-not', :node => 'this-is-opaque@or-not')) - end - - it "should support hostname ending with '.'" do - pending('bug #7589') - add_rule("allow host.domain.com.") - - expect(@auth).to auth_allow(request(:node => 'host.domain.com.')) - end - - it "should support hostname ending with '.' and backreferences" do - pending('bug #7589') - add_regex_rule('^/test/([^/]+)$',"allow $1") - - expect(@auth).to auth_allow(request(:node => 'host.domain.com.')) - end - - it "should support trailing whitespace" do - add_rule('allow host.domain.com ') - - expect(@auth).to auth_allow(request) - end - - it "should support inlined comments" do - add_rule('allow host.domain.com # will it work?') - - expect(@auth).to auth_allow(request) - end - - it "should deny non-matching host" do - add_rule("allow inexistent") - - expect(@auth).not_to auth_allow(request) - end - end - - describe "allow_ip" do - it "should not warn when matches against IP addresses fail" do - add_rule("allow_ip 10.1.1.2") - - expect(@auth).not_to auth_allow(request) - - expect(@logs).not_to be_any {|log| log.level == :warning and log.message =~ /Authentication based on IP address is deprecated/} - end - - it "should support IPv4 address" do - add_rule("allow_ip 10.1.1.1") - - expect(@auth).to auth_allow(request) - end - - it "should support CIDR IPv4 address" do - add_rule("allow_ip 10.0.0.0/8") - - expect(@auth).to auth_allow(request) - end - - it "should support wildcard IPv4 address" do - add_rule("allow_ip 10.1.1.*") - - expect(@auth).to auth_allow(request) - end - - it "should support IPv6 address" do - add_rule("allow_ip 2001:DB8::8:800:200C:417A") - - expect(@auth).to auth_allow(request(:ip => '2001:DB8::8:800:200C:417A')) - end - - it "should support hostname" do - expect { - add_rule("allow_ip host.domain.com") - }.to raise_error Puppet::ConfigurationError, /Invalid IP pattern host.domain.com/ - end - end - - describe "deny" do - it "should deny denied hosts" do - add_rule <<-EOALLOWRULE - deny host.domain.com - allow *.domain.com - EOALLOWRULE - - expect(@auth).not_to auth_allow(request) - end - - it "denies denied hosts after allowing them" do - add_rule <<-EOALLOWRULE - allow *.domain.com - deny host.domain.com - EOALLOWRULE - - expect(@auth).not_to auth_allow(request) - end - - it "should not deny based on IP" do - add_rule <<-EOALLOWRULE - deny 10.1.1.1 - allow host.domain.com - EOALLOWRULE - - expect(@auth).to auth_allow(request) - end - - it "should not deny based on IP (ordering #2)" do - add_rule <<-EOALLOWRULE - allow host.domain.com - deny 10.1.1.1 - EOALLOWRULE - - expect(@auth).to auth_allow(request) - end - end - - describe "deny_ip" do - it "should deny based on IP" do - add_rule <<-EOALLOWRULE - deny_ip 10.1.1.1 - allow host.domain.com - EOALLOWRULE - - expect(@auth).not_to auth_allow(request) - end - - it "should deny based on IP (ordering #2)" do - add_rule <<-EOALLOWRULE - allow host.domain.com - deny_ip 10.1.1.1 - EOALLOWRULE - - expect(@auth).not_to auth_allow(request) - end - end -end diff --git a/spec/unit/network/auth_config_parser_spec.rb b/spec/unit/network/auth_config_parser_spec.rb deleted file mode 100644 index 9cbe1ef4320..00000000000 --- a/spec/unit/network/auth_config_parser_spec.rb +++ /dev/null @@ -1,115 +0,0 @@ -require 'spec_helper' -require 'puppet/network/auth_config_parser' -require 'puppet/network/authconfig' - -describe Puppet::Network::AuthConfigParser do - include PuppetSpec::Files - - let(:fake_authconfig) do - "path ~ ^/catalog/([^/])\nmethod find\nallow *\n" - end - - describe "Basic Parser" do - it "should accept a string by default" do - expect(described_class.new(fake_authconfig).parse).to be_a_kind_of Puppet::Network::AuthConfig - end - end - - describe "when parsing rights" do - it "skips comments" do - expect(described_class.new(' # comment\n').parse_rights).to be_empty - end - - it "increments line number even on commented lines" do - expect(described_class.new(" # comment\npath /").parse_rights['/'].line).to eq(2) - end - - it "skips blank lines" do - expect(described_class.new(' ').parse_rights).to be_empty - end - - it "increments line number even on blank lines" do - expect(described_class.new(" \npath /").parse_rights['/'].line).to eq(2) - end - - it "does not throw an error if the same path appears twice" do - expect { - described_class.new("path /hello\npath /hello").parse_rights - }.to_not raise_error - end - - it "should create a new right for each found path line" do - expect(described_class.new('path /certificates').parse_rights['/certificates']).to be - end - - it "should create a new right for each found regex line" do - expect(described_class.new('path ~ .rb$').parse_rights['.rb$']).to be - end - - it "should strip whitespace around ACE" do - expect_any_instance_of(Puppet::Network::Rights::Right).to receive(:allow).with('127.0.0.1') - expect_any_instance_of(Puppet::Network::Rights::Right).to receive(:allow).with('172.16.10.0') - - described_class.new("path /\n allow 127.0.0.1 , 172.16.10.0 ").parse_rights - end - - it "should allow ACE inline comments" do - expect_any_instance_of(Puppet::Network::Rights::Right).to receive(:allow).with('127.0.0.1') - - described_class.new("path /\n allow 127.0.0.1 # will it work?").parse_rights - end - - it "should create an allow ACE on each subsequent allow" do - expect_any_instance_of(Puppet::Network::Rights::Right).to receive(:allow).with('127.0.0.1') - - described_class.new("path /\nallow 127.0.0.1").parse_rights - end - - it "should create a deny ACE on each subsequent deny" do - expect_any_instance_of(Puppet::Network::Rights::Right).to receive(:deny).with('127.0.0.1') - - described_class.new("path /\ndeny 127.0.0.1").parse_rights - end - - it "should inform the current ACL if we get the 'method' directive" do - expect_any_instance_of(Puppet::Network::Rights::Right).to receive(:restrict_method).with('search') - expect_any_instance_of(Puppet::Network::Rights::Right).to receive(:restrict_method).with('find') - - described_class.new("path /certificates\nmethod search,find").parse_rights - end - - it "should inform the current ACL if we get the 'environment' directive" do - expect_any_instance_of(Puppet::Network::Rights::Right).to receive(:restrict_environment).with('production') - expect_any_instance_of(Puppet::Network::Rights::Right).to receive(:restrict_environment).with('development') - - described_class.new("path /certificates\nenvironment production,development").parse_rights - end - - it "should inform the current ACL if we get the 'auth' directive" do - expect_any_instance_of(Puppet::Network::Rights::Right).to receive(:restrict_authenticated).with('yes') - - described_class.new("path /certificates\nauth yes").parse_rights - end - - it "should also allow the long form 'authenticated' directive" do - expect_any_instance_of(Puppet::Network::Rights::Right).to receive(:restrict_authenticated).with('yes') - - described_class.new("path /certificates\nauthenticated yes").parse_rights - end - end - - describe "when parsing rights from files" do - it "can read UTF-8" do - rune_path = "/\u16A0\u16C7\u16BB" # ᚠᛇᚻ - config = tmpfile('config') - - File.open(config, 'w', :encoding => 'utf-8') do |file| - file.puts <<-EOF -path #{rune_path} - EOF - end - - expect(described_class.new_from_file(config).parse_rights[rune_path]).to be - end - end -end diff --git a/spec/unit/network/authconfig_spec.rb b/spec/unit/network/authconfig_spec.rb index 9ce5206f999..ce06247936e 100644 --- a/spec/unit/network/authconfig_spec.rb +++ b/spec/unit/network/authconfig_spec.rb @@ -1,138 +1,8 @@ require 'spec_helper' - require 'puppet/network/authconfig' -describe Puppet::Network::DefaultAuthProvider do - before :each do - allow(Puppet::FileSystem).to receive(:stat).and_return(double('stat', :ctime => :now)) - allow(Time).to receive(:now).and_return(Time.now) - - allow_any_instance_of(Puppet::Network::DefaultAuthProvider).to receive(:exists?).and_return(true) - # FIXME @authprovider = Puppet::Network::DefaultAuthProvider.new("dummy") - end - - describe "when initializing" do - it "inserts default ACLs after setting initial rights" do - expect_any_instance_of(Puppet::Network::DefaultAuthProvider).to receive(:insert_default_acl) - Puppet::Network::DefaultAuthProvider.new - end - end - - describe "when defining an acl with mk_acl" do - before :each do - allow_any_instance_of(Puppet::Network::DefaultAuthProvider).to receive(:insert_default_acl) - @authprovider = Puppet::Network::DefaultAuthProvider.new - end - - it "should create a new right for each default acl" do - @authprovider.mk_acl(:acl => '/') - expect(@authprovider.rights['/']).to be - end - - it "allows everyone for each default right" do - @authprovider.mk_acl(:acl => '/') - expect(@authprovider.rights['/']).to be_globalallow - end - - it "accepts an argument to restrict the method" do - @authprovider.mk_acl(:acl => '/', :method => :find) - expect(@authprovider.rights['/'].methods).to eq([:find]) - end - - it "creates rights with authentication set to true by default" do - @authprovider.mk_acl(:acl => '/') - expect(@authprovider.rights['/'].authentication).to be_truthy - end - - it "accepts an argument to set the authentication requirement" do - @authprovider.mk_acl(:acl => '/', :authenticated => :any) - expect(@authprovider.rights['/'].authentication).to be_falsey - end - end - - describe "when adding default ACLs" do - before :each do - allow_any_instance_of(Puppet::Network::DefaultAuthProvider).to receive(:insert_default_acl) - @authprovider = Puppet::Network::DefaultAuthProvider.new - allow_any_instance_of(Puppet::Network::DefaultAuthProvider).to receive(:insert_default_acl).and_call_original - end - - Puppet::Network::DefaultAuthProvider::default_acl.each do |acl| - it "should create a default right for #{acl[:acl]}" do - allow(@authprovider).to receive(:mk_acl) - expect(@authprovider).to receive(:mk_acl).with(acl) - @authprovider.insert_default_acl - end - end - - it "should log at info loglevel" do - expect(Puppet).to receive(:info).at_least(:once) - @authprovider.insert_default_acl - end - - it "creates an empty catch-all rule for '/' for any authentication request state" do - allow(@authprovider).to receive(:mk_acl) - - @authprovider.insert_default_acl - expect(@authprovider.rights['/']).to be_empty - expect(@authprovider.rights['/'].authentication).to be_falsey - end - - it '(CVE-2013-2275) allows report submission only for the node matching the certname by default' do - acl = { - :acl => "~ ^#{Puppet::Network::HTTP::MASTER_URL_PREFIX}\/v3\/report\/([^\/]+)$", - :method => :save, - :allow => '$1', - :authenticated => true - } - allow(@authprovider).to receive(:mk_acl) - expect(@authprovider).to receive(:mk_acl).with(acl) - @authprovider.insert_default_acl - end - end - - describe "when checking authorization" do - it "should ask for authorization to the ACL subsystem" do - params = { - :ip => "127.0.0.1", - :node => "me", - :environment => :env, - :authenticated => true - } - - expect_any_instance_of(Puppet::Network::Rights).to receive(:is_request_forbidden_and_why?).with(:save, "/path/to/resource", params) - - described_class.new.check_authorization(:save, "/path/to/resource", params) - end - end -end - describe Puppet::Network::AuthConfig do - after :each do - Puppet::Network::AuthConfig.authprovider_class = nil - end - - class TestAuthProvider - def initialize(rights=nil); end - def check_authorization(method, path, params); end - end - - it "instantiates authprovider_class with rights" do - Puppet::Network::AuthConfig.authprovider_class = TestAuthProvider - rights = Puppet::Network::Rights.new - expect(TestAuthProvider).to receive(:new).with(rights) - described_class.new(rights) - end - - it "delegates authorization check to authprovider_class" do - Puppet::Network::AuthConfig.authprovider_class = TestAuthProvider - expect_any_instance_of(TestAuthProvider).to receive(:check_authorization).with(:save, '/path/to/resource', {}) - described_class.new.check_authorization(:save, '/path/to/resource', {}) - end - - it "uses DefaultAuthProvider by default" do - Puppet::Network::AuthConfig.authprovider_class = nil - expect_any_instance_of(Puppet::Network::DefaultAuthProvider).to receive(:check_authorization).with(:save, '/path/to/resource', {}) - described_class.new.check_authorization(:save, '/path/to/resource', {}) + it "accepts an auth provider class" do + Puppet::Network::AuthConfig.authprovider_class = Object end end diff --git a/spec/unit/network/authorization_spec.rb b/spec/unit/network/authorization_spec.rb index bbb219c0f96..183ba3933f5 100644 --- a/spec/unit/network/authorization_spec.rb +++ b/spec/unit/network/authorization_spec.rb @@ -1,61 +1,8 @@ require 'spec_helper' -require 'puppet/network/http' -require 'puppet/network/http/api/indirected_routes' require 'puppet/network/authorization' describe Puppet::Network::Authorization do - class AuthTest - include Puppet::Network::Authorization - end - - subject { AuthTest.new } - - context "when creating an authconfig object" do - before :each do - # Other tests may have created an authconfig, so we have to undo that. - @orig_auth_config = Puppet::Network::AuthConfigLoader.instance_variable_get(:@auth_config) - @orig_auth_config_file = Puppet::Network::AuthConfigLoader.instance_variable_get(:@auth_config_file) - - Puppet::Network::AuthConfigLoader.instance_variable_set(:@auth_config, nil) - Puppet::Network::AuthConfigLoader.instance_variable_set(:@auth_config_file, nil) - end - - after :each do - Puppet::Network::AuthConfigLoader.instance_variable_set(:@auth_config, @orig_auth_config) - Puppet::Network::AuthConfigLoader.instance_variable_set(:@auth_config_file, @orig_auth_config_file) - end - - it "creates default ACL entries if no file has been read" do - expect(Puppet::Network::AuthConfigParser).to receive(:new_from_file).and_raise(Errno::ENOENT) - expect_any_instance_of(Puppet::Network::DefaultAuthProvider).to receive(:insert_default_acl) - - subject.authconfig - end - end - - class TestAuthConfig - def check_authorization(method, path, params); end - end - - class TestAuthConfigLoader - def self.authconfig - TestAuthConfig.new - end - end - - context "when checking authorization" do - after :each do - Puppet::Network::Authorization.authconfigloader_class = nil - end - - it "delegates to the authconfig object" do - Puppet::Network::Authorization.authconfigloader_class = - TestAuthConfigLoader - expect_any_instance_of(TestAuthConfig).to receive(:check_authorization).with( - :save, '/mypath', {:param1 => "value1"}).and_return("yay, it worked!") - expect(subject.check_authorization( - :save, '/mypath', - {:param1 => "value1"})).to eq("yay, it worked!") - end + it "accepts an auth config loader class" do + Puppet::Network::Authorization.authconfigloader_class = Object end end diff --git a/spec/unit/network/authstore_spec.rb b/spec/unit/network/authstore_spec.rb deleted file mode 100644 index 192aeb65aa5..00000000000 --- a/spec/unit/network/authstore_spec.rb +++ /dev/null @@ -1,422 +0,0 @@ -require 'spec_helper' -require 'rbconfig' - -require 'puppet/network/authconfig' - -describe Puppet::Network::AuthStore do - before :each do - @authstore = Puppet::Network::AuthStore.new - @authstore.reset_interpolation - end - - describe "when checking if the acl has some entries" do - it "should be empty if no ACE have been entered" do - expect(@authstore).to be_empty - end - - it "should not be empty if it is a global allow" do - @authstore.allow('*') - - expect(@authstore).not_to be_empty - end - - it "should not be empty if at least one allow has been entered" do - @authstore.allow_ip('1.1.1.*') - - expect(@authstore).not_to be_empty - end - - it "should not be empty if at least one deny has been entered" do - @authstore.deny_ip('1.1.1.*') - - expect(@authstore).not_to be_empty - end - end - - describe "when checking global allow" do - it "should not be enabled by default" do - expect(@authstore).not_to be_globalallow - expect(@authstore).not_to be_allowed('foo.bar.com', '192.168.1.1') - end - - it "should always allow when enabled" do - @authstore.allow('*') - - expect(@authstore).to be_globalallow - expect(@authstore).to be_allowed('foo.bar.com', '192.168.1.1') - end - end - - describe "when checking a regex type of allow" do - before :each do - @authstore.allow('/^(test-)?host[0-9]+\.other-domain\.(com|org|net)$|some-domain\.com/') - @ip = '192.168.1.1' - end - ['host5.other-domain.com', 'test-host12.other-domain.net', 'foo.some-domain.com'].each { |name| - it "should allow the host #{name}" do - expect(@authstore).to be_allowed(name, @ip) - end - } - ['host0.some-other-domain.com',''].each { |name| - it "should not allow the host #{name}" do - expect(@authstore).not_to be_allowed(name, @ip) - end - } - end -end - -describe Puppet::Network::AuthStore::Declaration do - - ['100.101.99.98','100.100.100.100','1.2.3.4','11.22.33.44'].each { |ip| - describe "when the pattern is a simple numeric IP such as #{ip}" do - before :each do - @declaration = Puppet::Network::AuthStore::Declaration.new(:allow_ip,ip) - end - it "should match the specified IP" do - expect(@declaration).to be_match('www.testsite.org',ip) - end - it "should not match other IPs" do - expect(@declaration).not_to be_match('www.testsite.org','200.101.99.98') - end - end - - (1..3).each { |n| - describe "when the pattern is an IP mask with #{n} numeric segments and a *" do - before :each do - @ip_pattern = ip.split('.')[0,n].join('.')+'.*' - @declaration = Puppet::Network::AuthStore::Declaration.new(:allow_ip,@ip_pattern) - end - it "should match an IP in the range" do - expect(@declaration).to be_match('www.testsite.org',ip) - end - it "should not match other IPs" do - expect(@declaration).not_to be_match('www.testsite.org','200.101.99.98') - end - it "should not match IPs that differ in the last non-wildcard segment" do - other = ip.split('.') - other[n-1].succ! - expect(@declaration).not_to be_match('www.testsite.org',other.join('.')) - end - end - } - } - - describe "when the pattern is a numeric IP with a back reference" do - pending("implementation of backreferences for IP") do - before :each do - @ip = '100.101.$1' - @declaration = Puppet::Network::AuthStore::Declaration.new(:allow_ip,@ip).interpolate('12.34'.match(/(.*)/)) - end - it "should match an IP with the appropriate interpolation" do - @declaration.should be_match('www.testsite.org',@ip.sub(/\$1/,'12.34')) - end - it "should not match other IPs" do - @declaration.should_not be_match('www.testsite.org',@ip.sub(/\$1/,'66.34')) - end - end - end - - [ - "02001:0000:1234:0000:0000:C1C0:ABCD:0876", - "2001:0000:1234:0000:00001:C1C0:ABCD:0876", - " 2001:0000:1234:0000:0000:C1C0:ABCD:0876 0", - "2001:0000:1234: 0000:0000:C1C0:ABCD:0876", - "3ffe:0b00:0000:0001:0000:0000:000a", - "FF02:0000:0000:0000:0000:0000:0000:0000:0001", - "3ffe:b00::1::a", - "1:2:3::4:5::7:8", - "12345::6:7:8", - "1::5:400.2.3.4", - "1::5:260.2.3.4", - "1::5:256.2.3.4", - "1::5:1.256.3.4", - "1::5:1.2.256.4", - "1::5:1.2.3.256", - "1::5:300.2.3.4", - "1::5:1.300.3.4", - "1::5:1.2.300.4", - "1::5:1.2.3.300", - "1::5:900.2.3.4", - "1::5:1.900.3.4", - "1::5:1.2.900.4", - "1::5:1.2.3.900", - "1::5:300.300.300.300", - "1::5:3000.30.30.30", - "1::400.2.3.4", - "1::260.2.3.4", - "1::256.2.3.4", - "1::1.256.3.4", - "1::1.2.256.4", - "1::1.2.3.256", - "1::300.2.3.4", - "1::1.300.3.4", - "1::1.2.300.4", - "1::1.2.3.300", - "1::900.2.3.4", - "1::1.900.3.4", - "1::1.2.900.4", - "1::1.2.3.900", - "1::300.300.300.300", - "1::3000.30.30.30", - "::400.2.3.4", - "::260.2.3.4", - "::256.2.3.4", - "::1.256.3.4", - "::1.2.256.4", - "::1.2.3.256", - "::300.2.3.4", - "::1.300.3.4", - "::1.2.300.4", - "::1.2.3.300", - "::900.2.3.4", - "::1.900.3.4", - "::1.2.900.4", - "::1.2.3.900", - "::300.300.300.300", - "::3000.30.30.30", - "2001:DB8:0:0:8:800:200C:417A:221", # unicast, full - "FF01::101::2" # multicast, compressed - ].each { |invalid_ip| - describe "when the pattern is an invalid IPv6 address such as #{invalid_ip}" do - it "should raise an exception" do - expect { Puppet::Network::AuthStore::Declaration.new(:allow,invalid_ip) }.to raise_error(Puppet::AuthStoreError, /Invalid pattern/) - end - end - } - - [ - "1.2.3.4", - "2001:0000:1234:0000:0000:C1C0:ABCD:0876", - "3ffe:0b00:0000:0000:0001:0000:0000:000a", - "FF02:0000:0000:0000:0000:0000:0000:0001", - "0000:0000:0000:0000:0000:0000:0000:0001", - "0000:0000:0000:0000:0000:0000:0000:0000", - "::ffff:192.168.1.26", - "2::10", - "ff02::1", - "fe80::", - "2002::", - "2001:db8::", - "2001:0db8:1234::", - "::ffff:0:0", - "::1", - "::ffff:192.168.1.1", - "1:2:3:4:5:6:7:8", - "1:2:3:4:5:6::8", - "1:2:3:4:5::8", - "1:2:3:4::8", - "1:2:3::8", - "1:2::8", - "1::8", - "1::2:3:4:5:6:7", - "1::2:3:4:5:6", - "1::2:3:4:5", - "1::2:3:4", - "1::2:3", - "1::8", - "::2:3:4:5:6:7", - "::2:3:4:5:6", - "::2:3:4:5", - "::2:3:4", - "::2:3", - "::8", - "1:2:3:4:5:6::", - "1:2:3:4:5::", - "1:2:3:4::", - "1:2:3::", - "1:2::", - "1::", - "1:2:3:4:5::7:8", - "1:2:3:4::7:8", - "1:2:3::7:8", - "1:2::7:8", - "1::7:8", - "1:2:3:4:5:6:1.2.3.4", - "1:2:3:4:5::1.2.3.4", - "1:2:3:4::1.2.3.4", - "1:2:3::1.2.3.4", - "1:2::1.2.3.4", - "1::1.2.3.4", - "1:2:3:4::5:1.2.3.4", - "1:2:3::5:1.2.3.4", - "1:2::5:1.2.3.4", - "1::5:1.2.3.4", - "1::5:11.22.33.44", - "fe80::217:f2ff:254.7.237.98", - "fe80::217:f2ff:fe07:ed62", - "2001:DB8:0:0:8:800:200C:417A", # unicast, full - "FF01:0:0:0:0:0:0:101", # multicast, full - "0:0:0:0:0:0:0:1", # loopback, full - "0:0:0:0:0:0:0:0", # unspecified, full - "2001:DB8::8:800:200C:417A", # unicast, compressed - "FF01::101", # multicast, compressed - "::1", # loopback, compressed, non-routable - "::", # unspecified, compressed, non-routable - "0:0:0:0:0:0:13.1.68.3", # IPv4-compatible IPv6 address, full, deprecated - "0:0:0:0:0:FFFF:129.144.52.38", # IPv4-mapped IPv6 address, full - "::13.1.68.3", # IPv4-compatible IPv6 address, compressed, deprecated - "::FFFF:129.144.52.38", # IPv4-mapped IPv6 address, compressed - "2001:0DB8:0000:CD30:0000:0000:0000:0000/60", # full, with prefix - "2001:0DB8::CD30:0:0:0:0/60", # compressed, with prefix - "2001:0DB8:0:CD30::/60", # compressed, with prefix #2 - "::/128", # compressed, unspecified address type, non-routable - "::1/128", # compressed, loopback address type, non-routable - "FF00::/8", # compressed, multicast address type - "FE80::/10", # compressed, link-local unicast, non-routable - "FEC0::/10", # compressed, site-local unicast, deprecated - "127.0.0.1", # standard IPv4, loopback, non-routable - "0.0.0.0", # standard IPv4, unspecified, non-routable - "255.255.255.255", # standard IPv4 - "fe80:0000:0000:0000:0204:61ff:fe9d:f156", - "fe80:0:0:0:204:61ff:fe9d:f156", - "fe80::204:61ff:fe9d:f156", - "fe80:0000:0000:0000:0204:61ff:254.157.241.086", - "fe80:0:0:0:204:61ff:254.157.241.86", - "fe80::204:61ff:254.157.241.86", - "::1", - "fe80::", - "fe80::1" - ].each { |ip| - describe "when the pattern is a valid IP such as #{ip}" do - before :each do - @declaration = Puppet::Network::AuthStore::Declaration.new(:allow_ip,ip) - end - it "should match the specified IP" do - expect(@declaration).to be_match('www.testsite.org',ip) - end - it "should not match other IPs" do - expect(@declaration).not_to be_match('www.testsite.org','200.101.99.98') - end - end unless ip =~ /:.*\./ # Hybrid IPs aren't supported by ruby's ipaddr - } - - [ - "::2:3:4:5:6:7:8", - ].each { |ip| - describe "when the pattern is a valid IP such as #{ip}" do - let(:declaration) do - Puppet::Network::AuthStore::Declaration.new(:allow_ip,ip) - end - - issue_7477 = !(IPAddr.new(ip) rescue false) - - describe "on rubies with a fix for issue [7477](https://goo.gl/Bb1LU)", :if => issue_7477 - it "should match the specified IP" do - expect(declaration).to be_match('www.testsite.org',ip) - end - it "should not match other IPs" do - expect(declaration).not_to be_match('www.testsite.org','200.101.99.98') - end - end - } - - { - 'spirit.mars.nasa.gov' => 'a PQDN', - 'ratchet.2ndsiteinc.com' => 'a PQDN with digits', - 'a.c.ru' => 'a PQDN with short segments', - }.each {|pqdn,desc| - describe "when the pattern is #{desc}" do - before :each do - @host = pqdn - @declaration = Puppet::Network::AuthStore::Declaration.new(:allow,@host) - end - it "should match the specified PQDN" do - expect(@declaration).to be_match(@host,'200.101.99.98') - end - it "should not match a similar FQDN" do - pending "FQDN consensus" - expect(@declaration).not_to be_match(@host+'.','200.101.99.98') - end - end - } - - ['abc.12seps.edu.phisher.biz','www.google.com','slashdot.org'].each { |host| - (1...(host.split('.').length)).each { |n| - describe "when the pattern is #{"*."+host.split('.')[-n,n].join('.')}" do - before :each do - @pattern = "*."+host.split('.')[-n,n].join('.') - @declaration = Puppet::Network::AuthStore::Declaration.new(:allow,@pattern) - end - it "should match #{host}" do - expect(@declaration).to be_match(host,'1.2.3.4') - end - it "should not match www.testsite.gov" do - expect(@declaration).not_to be_match('www.testsite.gov','200.101.99.98') - end - it "should not match hosts that differ in the first non-wildcard segment" do - other = host.split('.') - other[-n].succ! - expect(@declaration).not_to be_match(other.join('.'),'1.2.3.4') - end - end - } - } - - describe "when the pattern is a FQDN" do - before :each do - @host = 'spirit.mars.nasa.gov.' - @declaration = Puppet::Network::AuthStore::Declaration.new(:allow,@host) - end - it "should match the specified FQDN" do - pending "FQDN consensus" - expect(@declaration).to be_match(@host,'200.101.99.98') - end - it "should not match a similar PQDN" do - expect(@declaration).not_to be_match(@host[0..-2],'200.101.99.98') - end - end - - - describe "when the pattern is an opaque string with a back reference" do - before :each do - @host = 'c216f41a-f902-4bfb-a222-850dd957bebb' - @item = "/catalog/#{@host}" - @pattern = %{^/catalog/([^/]+)$} - @declaration = Puppet::Network::AuthStore::Declaration.new(:allow,'$1') - end - it "should match an IP with the appropriate interpolation" do - expect(@declaration.interpolate(@item.match(@pattern))).to be_match(@host,'10.0.0.5') - end - end - - describe "when the pattern is an opaque string with a back reference and the matched data contains dots" do - before :each do - @host = 'admin.mgmt.nym1' - @item = "/catalog/#{@host}" - @pattern = %{^/catalog/([^/]+)$} - @declaration = Puppet::Network::AuthStore::Declaration.new(:allow,'$1') - end - it "should match a name with the appropriate interpolation" do - expect(@declaration.interpolate(@item.match(@pattern))).to be_match(@host,'10.0.0.5') - end - end - - describe "when the pattern is an opaque string with a back reference and the matched data contains dots with an initial prefix that looks like an IP address" do - before :each do - @host = '01.admin.mgmt.nym1' - @item = "/catalog/#{@host}" - @pattern = %{^/catalog/([^/]+)$} - @declaration = Puppet::Network::AuthStore::Declaration.new(:allow,'$1') - end - it "should match a name with the appropriate interpolation" do - expect(@declaration.interpolate(@item.match(@pattern))).to be_match(@host,'10.0.0.5') - end - end - - describe "when comparing patterns" do - before :each do - @ip = Puppet::Network::AuthStore::Declaration.new(:allow,'127.0.0.1') - @host_name = Puppet::Network::AuthStore::Declaration.new(:allow,'www.hard_knocks.edu') - @opaque = Puppet::Network::AuthStore::Declaration.new(:allow,'hey_dude') - end - it "should consider ip addresses before host names" do - expect(@ip < @host_name).to be_truthy - end - it "should consider ip addresses before opaque strings" do - expect(@ip < @opaque).to be_truthy - end - it "should consider host_names before opaque strings" do - expect(@host_name < @opaque).to be_truthy - end - end -end diff --git a/spec/unit/network/http/handler_spec.rb b/spec/unit/network/http/handler_spec.rb index 912488f6fbe..69d6b02af5f 100644 --- a/spec/unit/network/http/handler_spec.rb +++ b/spec/unit/network/http/handler_spec.rb @@ -2,7 +2,6 @@ require 'puppet_spec/handler' require 'puppet/indirector_testing' -require 'puppet/network/authorization' require 'puppet/network/http' describe Puppet::Network::HTTP::Handler do diff --git a/spec/unit/network/rights_spec.rb b/spec/unit/network/rights_spec.rb deleted file mode 100644 index dbb60956519..00000000000 --- a/spec/unit/network/rights_spec.rb +++ /dev/null @@ -1,439 +0,0 @@ -require 'spec_helper' - -require 'puppet/network/rights' - -describe Puppet::Network::Rights do - before do - @right = Puppet::Network::Rights.new - end - - describe "when validating a :head request" do - [:find, :save].each do |allowed_method| - it "should allow the request if only #{allowed_method} is allowed" do - rights = Puppet::Network::Rights.new - right = rights.newright("/") - right.allow("*") - right.restrict_method(allowed_method) - right.restrict_authenticated(:any) - expect(rights.is_request_forbidden_and_why?(:head, "/indirection_name/key", {})).to eq(nil) - end - end - - it "should disallow the request if neither :find nor :save is allowed" do - rights = Puppet::Network::Rights.new - why_forbidden = rights.is_request_forbidden_and_why?(:head, "/indirection_name/key", {}) - expect(why_forbidden).to be_instance_of(Puppet::Network::AuthorizationError) - expect(why_forbidden.to_s).to eq("Forbidden request: /indirection_name/key [find]") - end - end - - it "should throw an error if type can't be determined" do - expect { @right.newright("name") }.to raise_error(ArgumentError, /Unknown right type/) - end - - describe "when creating new path ACLs" do - it "should not throw an error if the ACL already exists" do - @right.newright("/name") - - expect { @right.newright("/name")}.not_to raise_error - end - - it "should throw an error if the acl uri path is not absolute" do - expect { @right.newright("name")}.to raise_error(ArgumentError, /Unknown right type/) - end - - it "should create a new ACL with the correct path" do - @right.newright("/name") - - expect(@right["/name"]).not_to be_nil - end - - it "should create an ACL of type Puppet::Network::AuthStore" do - @right.newright("/name") - - expect(@right["/name"]).to be_a_kind_of(Puppet::Network::AuthStore) - end - end - - describe "when creating new regex ACLs" do - it "should not throw an error if the ACL already exists" do - @right.newright("~ .rb$") - - expect { @right.newright("~ .rb$")}.not_to raise_error - end - - it "should create a new ACL with the correct regex" do - @right.newright("~ .rb$") - - expect(@right.include?(".rb$")).not_to be_nil - end - - it "should be able to lookup the regex" do - @right.newright("~ .rb$") - - expect(@right[".rb$"]).not_to be_nil - end - - it "should be able to lookup the regex by its full name" do - @right.newright("~ .rb$") - - expect(@right["~ .rb$"]).not_to be_nil - end - - it "should create an ACL of type Puppet::Network::AuthStore" do - expect(@right.newright("~ .rb$")).to be_a_kind_of(Puppet::Network::AuthStore) - end - end - - describe "when checking ACLs existence" do - it "should return false if there are no matching rights" do - expect(@right.include?("name")).to be_falsey - end - - it "should return true if a path right exists" do - @right.newright("/name") - - expect(@right.include?("/name")).to be_truthy - end - - it "should return false if no matching path rights exist" do - @right.newright("/name") - - expect(@right.include?("/differentname")).to be_falsey - end - - it "should return true if a regex right exists" do - @right.newright("~ .rb$") - - expect(@right.include?(".rb$")).to be_truthy - end - - it "should return false if no matching path rights exist" do - @right.newright("~ .rb$") - - expect(@right.include?(".pp$")).to be_falsey - end - end - - describe "when checking if right is allowed" do - before :each do - allow(@right).to receive(:right).and_return(nil) - - @pathacl = double('pathacl', :"<=>" => 1, :line => 0, :file => 'dummy') - allow(Puppet::Network::Rights::Right).to receive(:new).and_return(@pathacl) - end - - it "should delegate to is_forbidden_and_why?" do - expect(@right).to receive(:is_forbidden_and_why?).with("namespace", :node => "host.domain.com", :ip => "127.0.0.1").and_return(nil) - - @right.allowed?("namespace", "host.domain.com", "127.0.0.1") - end - - it "should return true if is_forbidden_and_why? returns nil" do - allow(@right).to receive(:is_forbidden_and_why?).and_return(nil) - expect(@right.allowed?("namespace", :args)).to be_truthy - end - - it "should return false if is_forbidden_and_why? returns an AuthorizationError" do - allow(@right).to receive(:is_forbidden_and_why?).and_return(Puppet::Network::AuthorizationError.new("forbidden")) - expect(@right.allowed?("namespace", :args1, :args2)).to be_falsey - end - - it "should pass the match? return to allowed?" do - @right.newright("/path/to/there") - - expect(@pathacl).to receive(:match?).and_return(:match) - expect(@pathacl).to receive(:allowed?).with(anything, anything, hash_including(match: :match)).and_return(true) - - expect(@right.is_forbidden_and_why?("/path/to/there", {})).to eq(nil) - end - - describe "with path acls" do - before :each do - @long_acl = double('longpathacl', :name => "/path/to/there", :line => 0, :file => 'dummy') - allow(Puppet::Network::Rights::Right).to receive(:new).with("/path/to/there", 0, nil).and_return(@long_acl) - - @short_acl = double('shortpathacl', :name => "/path/to", :line => 0, :file => 'dummy') - allow(Puppet::Network::Rights::Right).to receive(:new).with("/path/to", 0, nil).and_return(@short_acl) - - allow(@long_acl).to receive(:"<=>").with(@short_acl).and_return(0) - allow(@short_acl).to receive(:"<=>").with(@long_acl).and_return(0) - end - - it "should select the first match" do - @right.newright("/path/to", 0) - @right.newright("/path/to/there", 0) - - allow(@long_acl).to receive(:match?).and_return(true) - allow(@short_acl).to receive(:match?).and_return(true) - - expect(@short_acl).to receive(:allowed?).and_return(true) - expect(@long_acl).not_to receive(:allowed?) - - expect(@right.is_forbidden_and_why?("/path/to/there/and/there", {})).to eq(nil) - end - - it "should select the first match that doesn't return :dunno" do - @right.newright("/path/to/there", 0, nil) - @right.newright("/path/to", 0, nil) - - allow(@long_acl).to receive(:match?).and_return(true) - allow(@short_acl).to receive(:match?).and_return(true) - - expect(@long_acl).to receive(:allowed?).and_return(:dunno) - expect(@short_acl).to receive(:allowed?).and_return(true) - - expect(@right.is_forbidden_and_why?("/path/to/there/and/there", {})).to eq(nil) - end - - it "should not select an ACL that doesn't match" do - @right.newright("/path/to/there", 0) - @right.newright("/path/to", 0) - - allow(@long_acl).to receive(:match?).and_return(false) - allow(@short_acl).to receive(:match?).and_return(true) - - expect(@long_acl).not_to receive(:allowed?) - expect(@short_acl).to receive(:allowed?).and_return(true) - - expect(@right.is_forbidden_and_why?("/path/to/there/and/there", {})).to eq(nil) - end - - it "should not raise an AuthorizationError if allowed" do - @right.newright("/path/to/there", 0) - - allow(@long_acl).to receive(:match?).and_return(true) - allow(@long_acl).to receive(:allowed?).and_return(true) - - expect(@right.is_forbidden_and_why?("/path/to/there/and/there", {})).to eq(nil) - end - - it "should raise an AuthorizationError if the match is denied" do - @right.newright("/path/to/there", 0, nil) - - allow(@long_acl).to receive(:match?).and_return(true) - allow(@long_acl).to receive(:allowed?).and_return(false) - - expect(@right.is_forbidden_and_why?("/path/to/there", {})).to be_instance_of(Puppet::Network::AuthorizationError) - end - - it "should raise an AuthorizationError if no path match" do - expect(@right.is_forbidden_and_why?("/nomatch", {})).to be_instance_of(Puppet::Network::AuthorizationError) - end - end - - describe "with regex acls" do - before :each do - @regex_acl1 = double('regex_acl1', :name => "/files/(.*)/myfile", :line => 0, :file => 'dummy') - allow(Puppet::Network::Rights::Right).to receive(:new).with("~ /files/(.*)/myfile", 0, nil).and_return(@regex_acl1) - - @regex_acl2 = double('regex_acl2', :name => "/files/(.*)/myfile/", :line => 0, :file => 'dummy') - allow(Puppet::Network::Rights::Right).to receive(:new).with("~ /files/(.*)/myfile/", 0, nil).and_return(@regex_acl2) - - allow(@regex_acl1).to receive(:"<=>").with(@regex_acl2).and_return(0) - allow(@regex_acl2).to receive(:"<=>").with(@regex_acl1).and_return(0) - end - - it "should select the first match" do - @right.newright("~ /files/(.*)/myfile", 0) - @right.newright("~ /files/(.*)/myfile/", 0) - - allow(@regex_acl1).to receive(:match?).and_return(true) - allow(@regex_acl2).to receive(:match?).and_return(true) - - expect(@regex_acl1).to receive(:allowed?).and_return(true) - expect(@regex_acl2).not_to receive(:allowed?) - - expect(@right.is_forbidden_and_why?("/files/repository/myfile/other", {})).to eq(nil) - end - - it "should select the first match that doesn't return :dunno" do - @right.newright("~ /files/(.*)/myfile", 0) - @right.newright("~ /files/(.*)/myfile/", 0) - - allow(@regex_acl1).to receive(:match?).and_return(true) - allow(@regex_acl2).to receive(:match?).and_return(true) - - expect(@regex_acl1).to receive(:allowed?).and_return(:dunno) - expect(@regex_acl2).to receive(:allowed?).and_return(true) - - expect(@right.is_forbidden_and_why?("/files/repository/myfile/other", {})).to eq(nil) - end - - it "should not select an ACL that doesn't match" do - @right.newright("~ /files/(.*)/myfile", 0) - @right.newright("~ /files/(.*)/myfile/", 0) - - allow(@regex_acl1).to receive(:match?).and_return(false) - allow(@regex_acl2).to receive(:match?).and_return(true) - - expect(@regex_acl1).not_to receive(:allowed?) - expect(@regex_acl2).to receive(:allowed?).and_return(true) - - expect(@right.is_forbidden_and_why?("/files/repository/myfile/other", {})).to eq(nil) - end - - it "should not raise an AuthorizationError if allowed" do - @right.newright("~ /files/(.*)/myfile", 0) - - allow(@regex_acl1).to receive(:match?).and_return(true) - allow(@regex_acl1).to receive(:allowed?).and_return(true) - - expect(@right.is_forbidden_and_why?("/files/repository/myfile/other", {})).to eq(nil) - end - - it "should raise an error if no regex acl match" do - expect(@right.is_forbidden_and_why?("/path", {})).to be_instance_of(Puppet::Network::AuthorizationError) - end - - it "should raise an AuthorizedError on deny" do - expect(@right.is_forbidden_and_why?("/path", {})).to be_instance_of(Puppet::Network::AuthorizationError) - end - - end - end - - describe Puppet::Network::Rights::Right do - before :each do - @acl = Puppet::Network::Rights::Right.new("/path",0, nil) - end - - describe "with path" do - it "should match up to its path length" do - expect(@acl.match?("/path/that/works")).not_to be_nil - end - - it "should match up to its path length" do - expect(@acl.match?("/paththatalsoworks")).not_to be_nil - end - - it "should return nil if no match" do - expect(@acl.match?("/notpath")).to be_nil - end - end - - describe "with regex" do - before :each do - @acl = Puppet::Network::Rights::Right.new("~ .rb$",0, nil) - end - - it "should match as a regex" do - expect(@acl.match?("this should work.rb")).not_to be_nil - end - - it "should return nil if no match" do - expect(@acl.match?("do not match")).to be_nil - end - end - - it "should allow all rest methods by default" do - expect(@acl.methods).to eq(Puppet::Network::Rights::Right::ALL) - end - - it "should allow only authenticated request by default" do - expect(@acl.authentication).to be_truthy - end - - it "should allow modification of the methods filters" do - @acl.restrict_method(:save) - - expect(@acl.methods).to eq([:save]) - end - - it "should stack methods filters" do - @acl.restrict_method(:save) - @acl.restrict_method(:destroy) - - expect(@acl.methods).to eq([:save, :destroy]) - end - - it "should raise an error if the method is already filtered" do - @acl.restrict_method(:save) - - expect { @acl.restrict_method(:save) }.to raise_error(ArgumentError, /'save' is already in the '\/path'/) - end - - it "should allow setting an environment filters" do - env = Puppet::Node::Environment.create(:acltest, []) - Puppet.override(:environments => Puppet::Environments::Static.new(env)) do - @acl.restrict_environment(:acltest) - - expect(@acl.environment).to eq([env]) - end - end - - ["on", "yes", "true", true].each do |auth| - it "should allow filtering on authenticated requests with '#{auth}'" do - @acl.restrict_authenticated(auth) - - expect(@acl.authentication).to be_truthy - end - end - - ["off", "no", "false", false, "all", "any", :all, :any].each do |auth| - it "should allow filtering on authenticated or unauthenticated requests with '#{auth}'" do - @acl.restrict_authenticated(auth) - expect(@acl.authentication).to be_falsey - end - end - - describe "when checking right authorization" do - it "should return :dunno if this right is not restricted to the given method" do - @acl.restrict_method(:destroy) - - expect(@acl.allowed?("me","127.0.0.1", { :method => :save } )).to eq(:dunno) - end - - it "should return true if this right is restricted to the given method" do - @acl.restrict_method(:save) - @acl.allow("me") - - expect(@acl.allowed?("me","127.0.0.1", { :method => :save, :authenticated => true })).to eq true - end - - it "should return :dunno if this right is not restricted to the given environment" do - prod = Puppet::Node::Environment.create(:production, []) - dev = Puppet::Node::Environment.create(:development, []) - Puppet.override(:environments => Puppet::Environments::Static.new(prod, dev)) do - @acl.restrict_environment(:production) - - expect(@acl.allowed?("me","127.0.0.1", { :method => :save, :environment => dev })).to eq(:dunno) - end - end - - it "returns true if the request is permitted for this environment" do - @acl.allow("me") - prod = Puppet::Node::Environment.create(:production, []) - Puppet.override(:environments => Puppet::Environments::Static.new(prod)) do - @acl.restrict_environment(:production) - expect(@acl.allowed?("me", "127.0.0.1", { :method => :save, :authenticated => true, :environment => prod })).to eq true - end - end - - it "should return :dunno if this right is not restricted to the given request authentication state" do - @acl.restrict_authenticated(true) - - expect(@acl.allowed?("me","127.0.0.1", { :method => :save, :authenticated => false })).to eq(:dunno) - end - - it "returns true if this right is restricted to the given request authentication state" do - @acl.restrict_authenticated(false) - @acl.allow("me") - - expect(@acl.allowed?("me","127.0.0.1", {:method => :save, :authenticated => false })).to eq true - end - - it "should interpolate allow/deny patterns with the given match" do - expect(@acl).to receive(:interpolate).with(:match) - - @acl.allowed?("me","127.0.0.1", { :method => :save, :match => :match, :authenticated => true }) - end - - it "should reset interpolation after the match" do - expect(@acl).to receive(:reset_interpolation) - - @acl.allowed?("me","127.0.0.1", { :method => :save, :match => :match, :authenticated => true }) - end - end - end -end From ba6c1746999b963bd1c75b214f694c4aedfe723a Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Thu, 10 Sep 2020 18:01:48 -0700 Subject: [PATCH 159/731] (maint) Call the terminus via the model Call the terminus via Puppet::TestModel.indirection.{find,search,...} like an actual caller would do instead of creating a request and passing that to the terminus. --- spec/unit/indirector/rest_spec.rb | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/spec/unit/indirector/rest_spec.rb b/spec/unit/indirector/rest_spec.rb index 4b8bcc9d948..2f16fcad4ed 100644 --- a/spec/unit/indirector/rest_spec.rb +++ b/spec/unit/indirector/rest_spec.rb @@ -10,40 +10,39 @@ class Puppet::TestModel class Puppet::TestModel::Rest < Puppet::Indirector::REST end -describe Puppet::Indirector::REST do - let(:terminus) { Puppet::TestModel::Rest.new } +describe Puppet::Indirector::REST do before :each do - terminus.indirection.terminus_class = :rest + Puppet::TestModel.indirection.terminus_class = :rest end it "raises when find is called" do expect { - terminus.find(Puppet::Indirector::Request.new(:test_model, :find, 'foo', nil)) + Puppet::TestModel.indirection.find('foo') }.to raise_error(NotImplementedError) end it "raises when head is called" do expect { - terminus.head(Puppet::Indirector::Request.new(:test_model, :head, 'foo', nil)) + Puppet::TestModel.indirection.head('foo') }.to raise_error(NotImplementedError) end it "raises when search is called" do expect { - terminus.search(Puppet::Indirector::Request.new(:test_model, :search, 'foo', nil)) + Puppet::TestModel.indirection.search('foo') }.to raise_error(NotImplementedError) end it "raises when save is called" do expect { - terminus.save(Puppet::Indirector::Request.new(:test_model, :save, 'foo', Puppet::TestModel.new)) + Puppet::TestModel.indirection.save(Puppet::TestModel.new, 'foo') }.to raise_error(NotImplementedError) end it "raises when destroy is called" do expect { - terminus.destroy(Puppet::Indirector::Request.new(:test_model, :destroy, 'foo', nil)) + Puppet::TestModel.indirection.destroy('foo') }.to raise_error(NotImplementedError) end end From 9c7163b889f138fe5c9914df3b9048a96d8dcb0a Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Thu, 10 Sep 2020 18:04:57 -0700 Subject: [PATCH 160/731] (PUP-10661) Verify rest terminus error handling If the `Content-Type` response header is missing or is not PSON/JSON, then return the response body instead of calling the non-existent method `uncompress_body`, which was removed in commit ca36093089d9. The HTTP client is responsible for decompressing the response instead of the caller having to do that. --- lib/puppet/indirector/rest.rb | 7 +-- spec/unit/indirector/rest_spec.rb | 101 ++++++++++++++++++++++++++++++ 2 files changed, 104 insertions(+), 4 deletions(-) diff --git a/lib/puppet/indirector/rest.rb b/lib/puppet/indirector/rest.rb index 600efda51e1..15ebca322af 100644 --- a/lib/puppet/indirector/rest.rb +++ b/lib/puppet/indirector/rest.rb @@ -34,10 +34,10 @@ def convert_to_http_error(response) if content_type =~ /[pj]son/ returned_message = Puppet::Util::Json.load(body)["message"] else - returned_message = uncompress_body(response) + returned_message = response.body end else - returned_message = uncompress_body(response) + returned_message = response.body end message = _("Error %{code} on SERVER: %{returned_message}") % { code: response.code, returned_message: returned_message } @@ -45,8 +45,7 @@ def convert_to_http_error(response) end # Returns the content_type, stripping any appended charset, and the - # body, decompressed if necessary (content-encoding is checked inside - # uncompress_body) + # body, decompressed if necessary def parse_response(response) if response['content-type'] [ response['content-type'].gsub(/\s*;.*$/,''), response.body ] diff --git a/spec/unit/indirector/rest_spec.rb b/spec/unit/indirector/rest_spec.rb index 2f16fcad4ed..883b8143f2f 100644 --- a/spec/unit/indirector/rest_spec.rb +++ b/spec/unit/indirector/rest_spec.rb @@ -10,6 +10,28 @@ class Puppet::TestModel class Puppet::TestModel::Rest < Puppet::Indirector::REST end +class Puppet::FailingTestModel + extend Puppet::Indirector + indirects :failing_test_model +end + +# The subclass must not be all caps even though the superclass is +class Puppet::FailingTestModel::Rest < Puppet::Indirector::REST + def find(request) + http = Puppet.runtime[:http] + response = http.get(URI('http://puppet.example.com:8140/puppet/v3/failing_test_model')) + + if response.code == 404 + return nil unless request.options[:fail_on_404] + + _, body = parse_response(response.nethttp) + msg = _("Find %{uri} resulted in 404 with the message: %{body}") % { uri: elide(response.url.path, 100), body: body } + raise Puppet::Error, msg + else + raise convert_to_http_error(response.nethttp) + end + end +end describe Puppet::Indirector::REST do before :each do @@ -45,4 +67,83 @@ class Puppet::TestModel::Rest < Puppet::Indirector::REST Puppet::TestModel.indirection.destroy('foo') }.to raise_error(NotImplementedError) end + + context 'when parsing the response error' do + before :each do + Puppet::FailingTestModel.indirection.terminus_class = :rest + end + + it 'returns nil if 404 is returned and fail_on_404 is omitted' do + stub_request(:get, 'http://puppet.example.com:8140/puppet/v3/failing_test_model').to_return(status: 404) + + expect(Puppet::FailingTestModel.indirection.find('foo')).to be_nil + end + + it 'raises if 404 is returned and fail_on_404 is true' do + stub_request( + :get, 'http://puppet.example.com:8140/puppet/v3/failing_test_model', + ).to_return(status: 404, + headers: { 'Content-Type' => 'text/plain' }, + body: 'plaintext') + + expect { + Puppet::FailingTestModel.indirection.find('foo', fail_on_404: true) + }.to raise_error(Puppet::Error, 'Find /puppet/v3/failing_test_model resulted in 404 with the message: plaintext') + end + + it 'returns the HTTP reason if the response body is empty' do + stub_request(:get, 'http://puppet.example.com:8140/puppet/v3/failing_test_model').to_return(status: [500, 'Internal Server Error']) + + expect { + Puppet::FailingTestModel.indirection.find('foo') + }.to raise_error(Net::HTTPError, 'Error 500 on SERVER: Internal Server Error') + end + + it 'parses the response body as text' do + stub_request( + :get, 'http://puppet.example.com:8140/puppet/v3/failing_test_model' + ).to_return(status: [500, 'Internal Server Error'], + headers: { 'Content-Type' => 'text/plain' }, + body: 'plaintext') + + expect { + Puppet::FailingTestModel.indirection.find('foo') + }.to raise_error(Net::HTTPError, 'Error 500 on SERVER: plaintext') + end + + it 'parses the response body as json and returns the "message"' do + stub_request( + :get, 'http://puppet.example.com:8140/puppet/v3/failing_test_model' + ).to_return(status: [500, 'Internal Server Error'], + headers: { 'Content-Type' => 'application/json' }, + body: JSON.dump({'status' => false, 'message' => 'json error'})) + + expect { + Puppet::FailingTestModel.indirection.find('foo') + }.to raise_error(Net::HTTPError, 'Error 500 on SERVER: json error') + end + + it 'parses the response body as pson and returns the "message"' do + stub_request( + :get, 'http://puppet.example.com:8140/puppet/v3/failing_test_model' + ).to_return(status: [500, 'Internal Server Error'], + headers: { 'Content-Type' => 'application/pson' }, + body: PSON.dump({'status' => false, 'message' => 'pson error'})) + + expect { + Puppet::FailingTestModel.indirection.find('foo') + }.to raise_error(Net::HTTPError, 'Error 500 on SERVER: pson error') + end + + it 'returns the response body if no content-type given' do + stub_request( + :get, 'http://puppet.example.com:8140/puppet/v3/failing_test_model' + ).to_return(status: [500, 'Internal Server Error'], + body: 'unknown text') + + expect { + Puppet::FailingTestModel.indirection.find('foo') + }.to raise_error(Net::HTTPError, 'Error 500 on SERVER: unknown text') + end + end end From eed96c5ede5e3e9ca301fe8d1a023920c7a549df Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Fri, 11 Sep 2020 02:01:07 +0000 Subject: [PATCH 161/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 10 +++++----- man/man8/puppet-filebucket.8 | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index 67e8fccd9a6..d51a4ef1566 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -276,7 +276,7 @@ For best compatibility, you should limit the value of \fBcertname\fR to only use The special value \fBca\fR is reserved, and can\'t be used as the certname for a normal node\. . .IP -\fBNote:\fR You must set the certname in the main section of the puppet\.conf file\. Setting it in a different section causes errors\. +\fBNote:\fR You must set the certname in the main section of the puppet\.conf file\. Setting it in a different section causes errors\. . .IP "" 0 . @@ -497,10 +497,10 @@ Which arguments to pass to the diff command when printing differences between fi .IP "" 0 . .SS "digest_algorithm" -Which digest algorithm to use for file resources and the filebucket\. Valid values are md5, sha256, sha384, sha512, sha224\. Default is md5\. +Which digest algorithm to use for file resources and the filebucket\. Valid values are sha256, sha384, sha512, sha224, md5\. Default is sha256\. . .IP "\(bu" 4 -\fIDefault\fR: md5 +\fIDefault\fR: sha256 . .IP "" 0 . @@ -1892,10 +1892,10 @@ Whether to print a transaction summary\. .IP "" 0 . .SS "supported_checksum_types" -Checksum types supported by this agent for use in file resources of a static catalog\. Values must be comma\-separated\. Valid types are md5, md5lite, sha256, sha256lite, sha384, sha512, sha224, sha1, sha1lite, mtime, ctime\. Default is md5, sha256, sha384, sha512, sha224\. +Checksum types supported by this agent for use in file resources of a static catalog\. Values must be comma\-separated\. Valid types are sha256, sha256lite, sha384, sha512, sha224, sha1, sha1lite, md5, md5lite, mtime, ctime\. Default is sha256, sha384, sha512, sha224, md5\. . .IP "\(bu" 4 -\fIDefault\fR: ["md5", "sha256", "sha384", "sha512", "sha224"] +\fIDefault\fR: ["sha256", "sha384", "sha512", "sha224", "md5"] . .IP "" 0 . diff --git a/man/man8/puppet-filebucket.8 b/man/man8/puppet-filebucket.8 index aca4fdb9c0a..7895cca66e0 100644 --- a/man/man8/puppet-filebucket.8 +++ b/man/man8/puppet-filebucket.8 @@ -16,13 +16,13 @@ puppet filebucket \fImode\fR [\-h|\-\-help] [\-V|\-\-version] [\-d|\-\-debug] [\ Puppet filebucket can operate in three modes, with only one mode per call: . .P -backup: Send one or more files to the specified file bucket\. Each sent file is printed with its resulting md5 sum\. +backup: Send one or more files to the specified file bucket\. Each sent file is printed with its resulting sha256 sum\. . .P -get: Return the text associated with an md5 sum\. The text is printed to stdout, and only one file can be retrieved at a time\. +get: Return the text associated with an sha256 sum\. The text is printed to stdout, and only one file can be retrieved at a time\. . .P -restore: Given a file path and an md5 sum, store the content associated with the sum into the specified file path\. You can specify an entirely new path to this argument; you are not restricted to restoring the content to its original location\. +restore: Given a file path and an sha256 sum, store the content associated with the sum into the specified file path\. You can specify an entirely new path to this argument; you are not restricted to restoring the content to its original location\. . .P diff: Print a diff in unified format between two checksums in the filebucket or between a checksum and its matching file\. From a0d37fb48a9ad975c6e7aaf3abd98b106aeaa801 Mon Sep 17 00:00:00 2001 From: Gabriel Nagy Date: Fri, 11 Sep 2020 10:52:55 +0300 Subject: [PATCH 162/731] (PUP-10583) Update acceptance after SHA256 digest change A few acceptance tests were still configured to expect MD5 hashes on non-FIPS mode. Since we changed the default digest to SHA256, update the tests to use it regardless of FIPS mode. --- .../parser_functions/calling_all_functions.rb | 7 ++--- ...should_create_a_file_and_report_the_md5.rb | 29 ------------------- ...uld_create_a_file_and_report_the_sha256.rb | 20 +++++++++++++ .../tests/resource/file/content_attribute.rb | 2 +- .../tests/resource/file/source_attribute.rb | 2 +- .../ticket_6541_invalid_filebucket_files.rb | 20 ++----------- 6 files changed, 28 insertions(+), 52 deletions(-) delete mode 100644 acceptance/tests/puppet_apply_a_file_should_create_a_file_and_report_the_md5.rb create mode 100644 acceptance/tests/puppet_apply_a_file_should_create_a_file_and_report_the_sha256.rb diff --git a/acceptance/tests/parser_functions/calling_all_functions.rb b/acceptance/tests/parser_functions/calling_all_functions.rb index 69b97f84f26..045562541b5 100644 --- a/acceptance/tests/parser_functions/calling_all_functions.rb +++ b/acceptance/tests/parser_functions/calling_all_functions.rb @@ -50,8 +50,8 @@ def manifest_call_each_function_from_array(functions) {:name => :debug, :args => '"consider yourself bugged"', :lambda => nil, :expected => '', :rvalue => false}, # no output expected unless run with debug {:name => :defined, :args => 'File["/tmp"]', :lambda => nil, :expected => 'false', :rvalue => true}, {:name => :dig, :args => '[100]', :lambda => nil, :expected => '[100]', :rvalue => true}, - # Expect sha256 hash value for the digest when running on fips enabled system - {:name => :digest, :args => '"Sansa"', :lambda => nil, :expected => on(agent, facter("fips_enabled")).stdout =~ /true/ ? '4ebf3a5527313f06c7965749d7764c15cba6fe86da11691ca9bd0ce448563979' : 'f16491bf0133c6103918b2edcd00cf89', :rvalue => true}, + # Expect sha256 hash value for the digest + {:name => :digest, :args => '"Sansa"', :lambda => nil, :expected => '4ebf3a5527313f06c7965749d7764c15cba6fe86da11691ca9bd0ce448563979', :rvalue => true}, {:name => :emerg, :args => '"consider yourself emergent"', :lambda => nil, :expected => 'consider yourself emergent', :rvalue => false}, {:name => :err, :args => '"consider yourself in err"', :lambda => nil, :expected => 'consider yourself in err', :rvalue => false}, {:name => :file, :args => '"call_em_all/rickon.txt"', :lambda => nil, :expected => 'who?', :rvalue => true}, @@ -67,8 +67,7 @@ def manifest_call_each_function_from_array(functions) {:name => :inline_template, :args => '\'empty<%= @x %>space\'', :lambda => nil, :expected => 'emptyspace', :rvalue => true}, # test the living life out of this thing in lookup.rb, and it doesn't allow for a default value #{:name => :lookup, :args => 'date,lookup_date', :lambda => nil, :expected => '', :rvalue => true}, # well tested elsewhere - # Use fips approved hash when running on fips enabled system - {:name => on(agent, facter("fips_enabled")).stdout =~ /true/ ? :sha256 : :md5, :args => '"Bran"', :lambda => nil, :expected => on(agent, facter("fips_enabled")).stdout =~ /true/ ? '824264f7f73d6026550b52a671c50ad0c4452af66c24f3784e30f515353f2ce0' : '723f9ac32ceb881ddf4fb8fc1020cf83' , :rvalue => true}, + {:name => :sha256, :args => '"Bran"', :lambda => nil, :expected => '824264f7f73d6026550b52a671c50ad0c4452af66c24f3784e30f515353f2ce0', :rvalue => true}, # Integer.new {:name => :Integer, :args => '"100"', :lambda => nil, :expected => '100', :rvalue => true}, {:name => :notice, :args => '"consider yourself under notice"', :lambda => nil, :expected => 'consider yourself under notice', :rvalue => false}, diff --git a/acceptance/tests/puppet_apply_a_file_should_create_a_file_and_report_the_md5.rb b/acceptance/tests/puppet_apply_a_file_should_create_a_file_and_report_the_md5.rb deleted file mode 100644 index 5f54d4f0310..00000000000 --- a/acceptance/tests/puppet_apply_a_file_should_create_a_file_and_report_the_md5.rb +++ /dev/null @@ -1,29 +0,0 @@ -test_name "puppet apply should create a file and report an MD5" - -tag 'audit:medium', - 'audit:unit' - -agents.each do |agent| - file = agent.tmpfile('hello-world') - manifest = "file{'#{file}': content => 'test'}" - - step "clean up #{file} for testing" - on(agent, "rm -f #{file}") - - fips_mode = on(agent, facter("fips_enabled")).stdout =~ /true/ - - if fips_mode - step "Run the manifest and verify SHA256 was printed" - apply_manifest_on(agent, manifest) do - assert_match(/defined content as '{sha256}9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08'/, stdout, "#{agent}: didn't find the content SHA256 on output") - end - else - step "Run the manifest and verify MD5 was printed" - apply_manifest_on(agent, manifest) do - assert_match(/defined content as '{md5}098f6bcd4621d373cade4e832627b4f6'/, stdout, "#{agent}: didn't find the content MD5 on output") - end - end - - step "clean up #{file} after testing" - on(agent, "rm -f #{file}") -end diff --git a/acceptance/tests/puppet_apply_a_file_should_create_a_file_and_report_the_sha256.rb b/acceptance/tests/puppet_apply_a_file_should_create_a_file_and_report_the_sha256.rb new file mode 100644 index 00000000000..541fd362114 --- /dev/null +++ b/acceptance/tests/puppet_apply_a_file_should_create_a_file_and_report_the_sha256.rb @@ -0,0 +1,20 @@ +test_name "puppet apply should create a file and report a SHA256 digest" + +tag 'audit:medium', + 'audit:unit' + +agents.each do |agent| + file = agent.tmpfile('hello-world') + manifest = "file{'#{file}': content => 'test'}" + + step "clean up #{file} for testing" + on(agent, "rm -f #{file}") + + step "Run the manifest and verify SHA256 was printed" + apply_manifest_on(agent, manifest) do + assert_match(/defined content as '{sha256}9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08'/, stdout, "#{agent}: didn't find the content SHA256 on output") + end + + step "clean up #{file} after testing" + on(agent, "rm -f #{file}") +end diff --git a/acceptance/tests/resource/file/content_attribute.rb b/acceptance/tests/resource/file/content_attribute.rb index 37e89ba8a7a..ca1d6712a47 100644 --- a/acceptance/tests/resource/file/content_attribute.rb +++ b/acceptance/tests/resource/file/content_attribute.rb @@ -12,7 +12,7 @@ step "Content Attribute: using raw content" checksums_fips = ['sha256', 'sha256lite'] - checksums_no_fips = ['md5', 'md5lite', 'sha256', 'sha256lite'] + checksums_no_fips = ['sha256', 'sha256lite', 'md5', 'md5lite'] if on(agent, facter("fips_enabled")).stdout =~ /true/ checksums = checksums_fips diff --git a/acceptance/tests/resource/file/source_attribute.rb b/acceptance/tests/resource/file/source_attribute.rb index 6270d184408..3532c6feed4 100644 --- a/acceptance/tests/resource/file/source_attribute.rb +++ b/acceptance/tests/resource/file/source_attribute.rb @@ -14,7 +14,7 @@ # In case any of the hosts happens to be fips enabled we limit to the lowest # common denominator. checksums_fips = [nil, 'sha256', 'sha256lite', 'ctime', 'mtime'] - checksums_no_fips = [nil, 'md5', 'md5lite', 'sha256', 'sha256lite', 'ctime', 'mtime'] + checksums_no_fips = [nil, 'sha256', 'sha256lite', 'md5', 'md5lite', 'ctime', 'mtime'] fips_host_present = hosts.any? { |host| on(host, facter("fips_enabled")).stdout =~ /true/ } diff --git a/acceptance/tests/ticket_6541_invalid_filebucket_files.rb b/acceptance/tests/ticket_6541_invalid_filebucket_files.rb index e826ed65b9d..7086872b0a7 100644 --- a/acceptance/tests/ticket_6541_invalid_filebucket_files.rb +++ b/acceptance/tests/ticket_6541_invalid_filebucket_files.rb @@ -19,14 +19,8 @@ apply_manifest_on(agent, manifest) test_name "verify invalid hashes should not change the file" - - fips_mode = on(agent, facter("fips_enabled")).stdout =~ /true/ - if fips_mode - manifest = "file { '#{target}': content => '{sha256}notahash' }" - else - manifest = "file { '#{target}': content => '{md5}notahash' }" - end + manifest = "file { '#{target}': content => '{sha256}notahash' }" apply_manifest_on(agent, manifest) do assert_no_match(/content changed/, stdout, "#{agent}: shouldn't have overwrote the file") @@ -39,17 +33,9 @@ end test_name "verify that an empty file can be retrieved from the filebucket" - if fips_mode - manifest = "file { '#{target}': content => '{sha256}e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', backup => 'puppet' }" - else - manifest = "file { '#{target}': content => '{md5}d41d8cd98f00b204e9800998ecf8427e', backup => 'puppet' }" - end + manifest = "file { '#{target}': content => '{sha256}e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', backup => 'puppet' }" apply_manifest_on(agent, manifest) do - if fips_mode - assert_match(/content changed '\{sha256\}b94f6f125c79e3a5ffaa826f584c10d52ada669e6762051b826b55776d05aed2' to '\{sha256\}e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'/, stdout, "#{agent}: shouldn't have overwrote the file") - else - assert_match(/content changed '\{md5\}552e21cd4cd9918678e3c1a0df491bc3' to '\{md5\}d41d8cd98f00b204e9800998ecf8427e'/, stdout, "#{agent}: shouldn't have overwrote the file") - end + assert_match(/content changed '\{sha256\}b94f6f125c79e3a5ffaa826f584c10d52ada669e6762051b826b55776d05aed2' to '\{sha256\}e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'/, stdout, "#{agent}: shouldn't have overwrote the file") end end From 17c21586c528e22313bf6ad4c0758fd819f61eaf Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Mon, 14 Sep 2020 15:12:28 -0700 Subject: [PATCH 163/731] (maint) Fix file_bucket typo --- spec/unit/network/http/api/indirected_routes_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/unit/network/http/api/indirected_routes_spec.rb b/spec/unit/network/http/api/indirected_routes_spec.rb index 6249b493fe8..e837f78dff1 100644 --- a/spec/unit/network/http/api/indirected_routes_spec.rb +++ b/spec/unit/network/http/api/indirected_routes_spec.rb @@ -63,7 +63,7 @@ }.to raise_error(bad_request_error) end - it "should not pass a buck_path parameter through (See Bugs #13553, #13518, #13511)" do + it "should not pass a bucket_path parameter through (See Bugs #13553, #13518, #13511)" do expect(handler.uri2indirection("GET", "#{master_url_prefix}/node/bar", { :environment => "env", :bucket_path => "/malicious/path" })[3]).not_to include({ :bucket_path => "/malicious/path" }) From 6b6d13867a24299e1ad2effb1be8c8edd10d7098 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Fri, 4 Sep 2020 16:45:02 -0700 Subject: [PATCH 164/731] (PUP-10473) Remove usage of rest_authconfig in beaker tests The beaker tests were originally written to support both puppetserver and webrick servers. Remove the latter, so only puppetserver's auth.conf is tested. --- ...llow_arbitrary_node_name_fact_for_agent.rb | 62 +++++-------------- .../allow_arbitrary_node_name_for_agent.rb | 50 ++++----------- 2 files changed, 27 insertions(+), 85 deletions(-) diff --git a/acceptance/tests/allow_arbitrary_node_name_fact_for_agent.rb b/acceptance/tests/allow_arbitrary_node_name_fact_for_agent.rb index 94cd955dd49..32e1189c815 100644 --- a/acceptance/tests/allow_arbitrary_node_name_fact_for_agent.rb +++ b/acceptance/tests/allow_arbitrary_node_name_fact_for_agent.rb @@ -16,19 +16,18 @@ node_names.uniq! -if @options[:is_puppetserver] - step "Prepare for custom tk-auth rules" do - on master, 'cp /etc/puppetlabs/puppetserver/conf.d/auth.conf /etc/puppetlabs/puppetserver/conf.d/auth.bak' - modify_tk_config(master, options['puppetserver-config'], {'jruby-puppet' => {'use-legacy-auth-conf' => false}}) - end +step "Prepare for custom tk-auth rules" do + on master, 'cp /etc/puppetlabs/puppetserver/conf.d/auth.conf /etc/puppetlabs/puppetserver/conf.d/auth.bak' + modify_tk_config(master, options['puppetserver-config'], {'jruby-puppet' => {'use-legacy-auth-conf' => false}}) +end - teardown do - modify_tk_config(master, options['puppetserver-config'], {'jruby-puppet' => {'use-legacy-auth-conf' => true}}) - on master, 'cp /etc/puppetlabs/puppetserver/conf.d/auth.bak /etc/puppetlabs/puppetserver/conf.d/auth.conf' - end +teardown do + modify_tk_config(master, options['puppetserver-config'], {'jruby-puppet' => {'use-legacy-auth-conf' => true}}) + on master, 'cp /etc/puppetlabs/puppetserver/conf.d/auth.bak /etc/puppetlabs/puppetserver/conf.d/auth.conf' +end - step "Setup tk-auth rules" do - tka_header = <<-HEADER +step "Setup tk-auth rules" do + tka_header = <<-HEADER authorization: { version: 1 rules: [ @@ -43,8 +42,8 @@ }, HEADER - tka_node_rules = node_names.map do |node_name| - <<-NODE_RULES + tka_node_rules = node_names.map do |node_name| + <<-NODE_RULES { match-request: { path: "/puppet/v3/catalog/#{node_name}" @@ -76,9 +75,9 @@ name: "puppetlabs report #{node_name}" }, NODE_RULES - end + end - tka_footer = <<-FOOTER + tka_footer = <<-FOOTER { match-request: { path: "/" @@ -92,43 +91,15 @@ } FOOTER - tk_auth = [tka_header, tka_node_rules, tka_footer].flatten.join("\n") + tk_auth = [tka_header, tka_node_rules, tka_footer].flatten.join("\n") - apply_manifest_on(master, <<-MANIFEST, :catch_failures => true) + apply_manifest_on(master, <<-MANIFEST, :catch_failures => true) file { '/etc/puppetlabs/puppetserver/conf.d/auth.conf': ensure => file, mode => '0644', content => '#{tk_auth}', } MANIFEST - end -else - step "Setup legacy auth.conf rules" do - authfile = "#{testdir}/auth.conf" - authconf = node_names.map do |node_name| - <<-AUTHCONF -path /puppet/v3/catalog/#{node_name} -auth yes -allow * - -path /puppet/v3/node/#{node_name} -auth yes -allow * - -path /puppet/v3/report/#{node_name} -auth yes -allow * - AUTHCONF - end.join("\n") - - apply_manifest_on(master, <<-MANIFEST, :catch_failures => true) - file { '#{authfile}': - ensure => file, - mode => '0644', - content => '#{authconf}', - } - MANIFEST - end end step "Setup site.pp for node name based classification" do @@ -170,7 +141,6 @@ 'environmentpath' => "#{testdir}/environments", }, 'master' => { - 'rest_authconfig' => "#{testdir}/auth.conf", 'node_terminus' => 'plain', }, } diff --git a/acceptance/tests/allow_arbitrary_node_name_for_agent.rb b/acceptance/tests/allow_arbitrary_node_name_for_agent.rb index 1e9212cb98a..9858d354a9a 100644 --- a/acceptance/tests/allow_arbitrary_node_name_for_agent.rb +++ b/acceptance/tests/allow_arbitrary_node_name_for_agent.rb @@ -8,19 +8,18 @@ success_message = "node_name_value setting was correctly used as the node name" testdir = master.tmpdir('nodenamevalue') -if @options[:is_puppetserver] - step "Prepare for custom tk-auth rules" do - on master, 'cp /etc/puppetlabs/puppetserver/conf.d/auth.conf /etc/puppetlabs/puppetserver/conf.d/auth.bak' - modify_tk_config(master, options['puppetserver-config'], {'jruby-puppet' => {'use-legacy-auth-conf' => false}}) - end +step "Prepare for custom tk-auth rules" do + on master, 'cp /etc/puppetlabs/puppetserver/conf.d/auth.conf /etc/puppetlabs/puppetserver/conf.d/auth.bak' + modify_tk_config(master, options['puppetserver-config'], {'jruby-puppet' => {'use-legacy-auth-conf' => false}}) +end - teardown do - on master, 'cp /etc/puppetlabs/puppetserver/conf.d/auth.bak /etc/puppetlabs/puppetserver/conf.d/auth.conf' - modify_tk_config(master, options['puppetserver-config'], {'jruby-puppet' => {'use-legacy-auth-conf' => true}}) - end +teardown do + on master, 'cp /etc/puppetlabs/puppetserver/conf.d/auth.bak /etc/puppetlabs/puppetserver/conf.d/auth.conf' + modify_tk_config(master, options['puppetserver-config'], {'jruby-puppet' => {'use-legacy-auth-conf' => true}}) +end - step "Setup tk-auth rules" do - tk_auth = <<-TK_AUTH +step "Setup tk-auth rules" do + tk_auth = <<-TK_AUTH authorization: { version: 1 rules: [ @@ -76,39 +75,13 @@ } TK_AUTH - apply_manifest_on(master, <<-MANIFEST, :catch_failures => true) + apply_manifest_on(master, <<-MANIFEST, :catch_failures => true) file { '/etc/puppetlabs/puppetserver/conf.d/auth.conf': ensure => file, mode => '0644', content => '#{tk_auth}', } MANIFEST - end -else - step "setup auth.conf rules" do - authfile = "#{testdir}/auth.conf" - authconf = <<-AUTHCONF -path /puppet/v3/catalog/specified_node_name -auth yes -allow * - -path /puppet/v3/node/specified_node_name -auth yes -allow * - -path /puppet/v3/report/specified_node_name -auth yes -allow * - AUTHCONF - - apply_manifest_on(master, <<-MANIFEST, :catch_failures => true) - file { '#{authfile}': - ensure => file, - mode => '0644', - content => '#{authconf}', - } - MANIFEST - end end step "Setup site.pp for node name based classification" do @@ -149,7 +122,6 @@ 'environmentpath' => "#{testdir}/environments", }, 'master' => { - 'rest_authconfig' => "#{testdir}/auth.conf", 'node_terminus' => 'plain', }, } From 02c3e9129eee488f1efb8cabf5334070b32326be Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Fri, 4 Sep 2020 16:47:50 -0700 Subject: [PATCH 165/731] (PUP-10473) Remove rest_authconfig setting --- lib/puppet/defaults.rb | 9 --------- 1 file changed, 9 deletions(-) diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb index 0ffd8df0a00..8a108993bb3 100644 --- a/lib/puppet/defaults.rb +++ b/lib/puppet/defaults.rb @@ -1315,15 +1315,6 @@ def self.initialize_default_settings!(settings) :group => "service", :desc => "Where FileBucket files are stored." }, - :rest_authconfig => { - :default => "$confdir/auth.conf", - :type => :file, - :deprecated => :completely, - :desc => "The configuration file that defines the rights to the different - rest indirections. This can be used as a fine-grained authorization system for - `puppet master`. The `puppet master` command is deprecated and Puppet Server - uses its own auth.conf that must be placed within its configuration directory.", - }, :trusted_oid_mapping_file => { :default => "$confdir/custom_trusted_oid_mapping.yaml", :type => :file, From 1c80f11ed1506e7986cf4b6935856d2cc25c0459 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Fri, 4 Sep 2020 16:50:57 -0700 Subject: [PATCH 166/731] (PUP-10473) Update auth.conf in API docs --- api/docs/http_api_index.md | 21 +++++++------------- api/docs/http_certificate_request.md | 2 +- api/docs/http_certificate_revocation_list.md | 6 +++--- api/docs/http_environments.md | 2 +- conf/fileserver.conf | 15 +++++--------- lib/puppet/defaults.rb | 14 ++++++------- lib/puppet/face/facts.rb | 6 +----- lib/puppet/type/filebucket.rb | 6 +++--- 8 files changed, 27 insertions(+), 45 deletions(-) diff --git a/api/docs/http_api_index.md b/api/docs/http_api_index.md index ce137062586..46b5a61103e 100644 --- a/api/docs/http_api_index.md +++ b/api/docs/http_api_index.md @@ -1,4 +1,4 @@ -A Puppet master server provides several services via HTTP API, and the Puppet +A Puppet server provides several services via HTTP API, and the Puppet agent application uses those services to resolve a node's credentials, retrieve a configuration catalog, retrieve file data, and submit reports. @@ -32,23 +32,17 @@ the letter `v`, and the version number of the API). ### Authorization -Authorization for `/puppet` endpoints is still controlled with Puppet's `auth.conf` -authorization system. - -Puppet Server ignores `auth.conf` for `/puppet-ca` endpoints. Access to the -`certificate_status` endpoint is configured in Puppet Server's `ca.conf` file, -and the remaining CA endpoints are always accessible. - -When specifying authorization in `auth.conf`, the prefix and the version number -(such as `/puppet/v3`) on the paths must be retained, since Puppet matches -authorization rules against the full request path. +As of Puppet 7, support for legacy auth.conf is removed. Puppet Server 7 +enforces all authorization using its `auth.conf`. See +https://puppet.com/docs/puppetserver/latest/config_file_auth.html for more +details. Puppet V3 HTTP API ------------------ The Puppet agent application uses several network services to manage systems. These services are all grouped under the `/puppet` API. Other tools can access -these services and use the Puppet master's data for other purposes. +these services and use the Puppet server's data for other purposes. The V3 API contains endpoints of two types: those that are based on dispatching to Puppet's internal "indirector" framework, and those that are not (namely the @@ -100,8 +94,7 @@ formatted as JSON and respond with JSON (MIME type of `application/json`). ### Puppet Server-specific endpoints -When using [Puppet Server 2.3 or newer](https://puppet.com/docs/puppetserver/2.3/) -as a Puppet master, Puppet Server adds additional `/puppet/v3/` endpoints: +Puppet Server adds additional `/puppet/v3/` endpoints: * [Static File Content](https://puppet.com/docs/puppetserver/latest/puppet-api/v3/static_file_content.md) * [Environment Classes](https://puppet.com/docs/puppetserver/latest/puppet-api/v3/environment_classes.md) diff --git a/api/docs/http_certificate_request.md b/api/docs/http_certificate_request.md index 888919034c1..4378b2b3312 100644 --- a/api/docs/http_certificate_request.md +++ b/api/docs/http_certificate_request.md @@ -54,7 +54,7 @@ Delete a submitted CSR ### Supported HTTP Methods The default configuration only allows requests that result in a Find and a -Save. You need to modify auth.conf in order to allow clients to use Search and +Save. You need to modify Puppet Server's `auth.conf` in order to allow clients to use Search and Destroy actions. It is not recommended that you change the default settings. GET, PUT, DELETE diff --git a/api/docs/http_certificate_revocation_list.md b/api/docs/http_certificate_revocation_list.md index b29b00c9764..83d239c2699 100644 --- a/api/docs/http_certificate_revocation_list.md +++ b/api/docs/http_certificate_revocation_list.md @@ -9,9 +9,9 @@ Under Puppet Server's CA service, the `environment` parameter is ignored and can be omitted. Under a Rack or WEBrick Puppet master, `environment` is required and must be a valid environment, but it has no effect on the response. -The `:nodename` should always be `ca`, due to the default auth.conf rules for -WEBrick and Rack Puppet masters. (You can use a different `:nodename` if you -change the auth rules, but it will have no effect on the response.) +The `:nodename` should always be `ca`, due to Puppet Server's default +`auth.conf`. (You can use a different `:nodename` if you change the auth rules, +but it will have no effect on the response.) Find ---- diff --git a/api/docs/http_environments.md b/api/docs/http_environments.md index a72519ac704..83996187e3f 100644 --- a/api/docs/http_environments.md +++ b/api/docs/http_environments.md @@ -3,7 +3,7 @@ Environments The `environments` endpoint allows for enumeration of the environments known to the master. Each environment contains information about itself like its modulepath, manifest directory, environment timeout, and the config version. -This endpoint is by default accessible to any client with a valid certificate, though this may be changed by `auth.conf`. +This endpoint is by default accessible to any client with a valid certificate, though this may be changed in Puppet Server's `auth.conf`. Get --- diff --git a/conf/fileserver.conf b/conf/fileserver.conf index 4ef362a8b73..b3ebca9aea4 100644 --- a/conf/fileserver.conf +++ b/conf/fileserver.conf @@ -12,10 +12,9 @@ # # [extra_files] # path /etc/puppetlabs/puppet/files -# allow * # -# In the example above, anything in /etc/puppetlabs/puppet/files/ would be -# available to authenticated nodes at puppet:///extra_files/. +# In the example above, anything in /etc/puppetlabs/puppet/files/ +# would be available to authenticated nodes at puppet:///extra_files/. # # Mount points may also use three placeholders as part of their path: # @@ -28,10 +27,6 @@ # PERMISSIONS # The ability to set permissions - for example, using the allow, allow_ip, or -# deny directives - has been removed. Instead, you can control file access in -# auth.conf by controlling the /file_metadata(s)/ and -# /file_content(s)/ paths. -# -# For details and an example, see the auth.conf file. If you're using Puppet -# Server, see the Puppet Server documentation at -# https://puppet.com/docs/puppetserver/latest/config_file_auth.html. +# deny directives - has been removed from fileserver.conf. Instead, you can +# control file access in Puppet Server's auth.conf file. See the documentation +# at https://puppet.com/docs/puppetserver/latest/config_file_auth.html. diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb index 8a108993bb3..e599b47bdeb 100644 --- a/lib/puppet/defaults.rb +++ b/lib/puppet/defaults.rb @@ -778,7 +778,7 @@ def self.initialize_default_settings!(settings) `certname` setting as its requested Subject CN. This is the name used when managing a node's permissions in - [auth.conf](https://puppet.com/docs/puppet/latest/config_file_auth.html). + Puppet Server's [auth.conf](https://puppet.com/docs/puppetserver/latest/config_file_auth.html). In most cases, it is also used as the node's name when matching [node definitions](https://puppet.com/docs/puppet/latest/lang_node_definitions.html) and requesting data from an ENC. (This can be changed with the `node_name_value` @@ -793,7 +793,7 @@ def self.initialize_default_settings!(settings) only use lowercase letters, numbers, periods, underscores, and dashes. (That is, it should match `/\A[a-z0-9._-]+\Z/`.) * The special value `ca` is reserved, and can't be used as the certname - for a normal node. + for a normal node. **Note:** You must set the certname in the main section of the puppet.conf file. Setting it in a different section causes errors. @@ -1439,17 +1439,15 @@ def self.initialize_default_settings!(settings) :default => "$certname", :desc => "The explicit value used for the node name for all requests the agent makes to the master. WARNING: This setting is mutually exclusive with - node_name_fact. Changing this setting also requires changes to the default - auth.conf configuration on the Puppet Master. Please see - http://links.puppet.com/node_name_value for more information." + node_name_fact. Changing this setting also requires changes to + Puppet Server's default [auth.conf](https://puppet.com/docs/puppetserver/latest/config_file_auth.html)." }, :node_name_fact => { :default => "", :desc => "The fact name used to determine the node name used for all requests the agent makes to the master. WARNING: This setting is mutually exclusive with - node_name_value. Changing this setting also requires changes to the default - auth.conf configuration on the Puppet Master. Please see - http://links.puppet.com/node_name_fact for more information.", + node_name_value. Changing this setting also requires changes to + Puppet Server's default [auth.conf](https://puppet.com/docs/puppetserver/latest/config_file_auth.html).", :hook => proc do |value| if !value.empty? and Puppet[:node_name_value] != Puppet[:certname] raise "Cannot specify both the node_name_value and node_name_fact settings" diff --git a/lib/puppet/face/facts.rb b/lib/puppet/face/facts.rb index ad49205d9ec..cf6c6076ef8 100644 --- a/lib/puppet/face/facts.rb +++ b/lib/puppet/face/facts.rb @@ -44,16 +44,12 @@ EOT returns "Nothing." notes <<-'EOT' - This action requires that the puppet master's `auth.conf` file + This action requires that the Puppet Server's `auth.conf` file allow `PUT` or `save` access to the `/puppet/v3/facts` API endpoint. For details on configuring Puppet Server's `auth.conf`, see: - - For legacy Rack-based Puppet Masters, see: - - EOT examples <<-'EOT' Upload facts: diff --git a/lib/puppet/type/filebucket.rb b/lib/puppet/type/filebucket.rb index f9655a3b9c4..2547f9a746a 100644 --- a/lib/puppet/type/filebucket.rb +++ b/lib/puppet/type/filebucket.rb @@ -5,7 +5,7 @@ module Puppet @doc = <<-EOT A repository for storing and retrieving file content by MD5 checksum. Can be local to each agent node, or centralized on a puppet master server. All - puppet masters provide a filebucket service that agent nodes can access + puppet servers provide a filebucket service that agent nodes can access via HTTP, but you must declare a filebucket resource before any agents will do so. @@ -30,9 +30,9 @@ module Puppet File { backup => main, } - Puppet master servers automatically provide the filebucket service, so + Puppet Servers automatically provide the filebucket service, so this will work in a default configuration. If you have a heavily - restricted `auth.conf` file, you may need to allow access to the + restricted Puppet Server `auth.conf` file, you may need to allow access to the `file_bucket_file` endpoint. EOT From 2d60297d009a020c24725c5733f2da2c5a497da3 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Fri, 4 Sep 2020 17:04:11 -0700 Subject: [PATCH 167/731] (PUP-10473) Delete default auth.conf Don't include the default auth.conf in puppet-agent packages. --- conf/auth.conf | 146 ------------------------------------- ext/osx/file_mapping.yaml | 5 -- ext/redhat/puppet.spec.erb | 1 - install.rb | 2 +- 4 files changed, 1 insertion(+), 153 deletions(-) delete mode 100644 conf/auth.conf diff --git a/conf/auth.conf b/conf/auth.conf deleted file mode 100644 index 3d51383b5fe..00000000000 --- a/conf/auth.conf +++ /dev/null @@ -1,146 +0,0 @@ -# This is the default auth.conf file, which implements the default rules -# used by the puppet master. (That is, the rules below will still apply -# even if this file is deleted.) -# -# The ACLs are evaluated in top-down order. More specific stanzas should -# be towards the top of the file and more general ones at the bottom; -# otherwise, the general rules may "steal" requests that should be -# governed by the specific rules. -# -# See https://puppet.com/docs/puppet/latest/config_file_auth.html -# for a more complete description of auth.conf's behavior. -# -# Supported syntax: -# Each stanza in auth.conf starts with a path to match, followed -# by optional modifiers, and finally, a series of allow or deny -# directives. -# -# Example Stanza -# --------------------------------- -# path /path/to/resource # simple prefix match -# # path ~ regex # alternately, regex match -# [environment envlist] -# [method methodlist] -# [auth[enthicated] {yes|no|on|off|any}] -# allow [host|backreference|*|regex] -# deny [host|backreference|*|regex] -# allow_ip [ip|cidr|ip_wildcard|*] -# deny_ip [ip|cidr|ip_wildcard|*] -# -# The path match can either be a simple prefix match or a regular -# expression. `path /file` would match both `/file_metadata` and -# `/file_content`. Regex matches allow the use of backreferences -# in the allow/deny directives. -# -# The regex syntax is the same as for Ruby regex, and captures backreferences -# for use in the `allow` and `deny` lines of that stanza -# -# Examples: -# -# path ~ ^/puppet/v3/path/to/resource # Equivalent to `path /puppet/v3/path/to/resource`. -# allow * # Allow all authenticated nodes (since auth -# # defaults to `yes`). -# -# path ~ ^/puppet/v3/catalog/([^/]+)$ # Permit nodes to access their own catalog (by -# allow $1 # certname), but not any other node's catalog. -# -# path ~ ^/puppet/v3/file_(metadata|content)/extra_files/ # Only allow certain nodes to -# auth yes # access the "extra_files" -# allow /^(.+)\.example\.com$/ # mount point; note this must -# allow_ip 192.168.100.0/24 # go ABOVE the "/file" rule, -# # since it is more specific. -# -# environment:: restrict an ACL to a comma-separated list of environments -# method:: restrict an ACL to a comma-separated list of HTTP methods -# auth:: restrict an ACL to an authenticated or unauthenticated request -# the default when unspecified is to restrict the ACL to authenticated requests -# (ie exactly as if auth yes was present). -# - -# CONTROLLING FILE ACCESS (previously in fileserver.conf) - -# In previous versions of Puppet, you controlled file access by adding -# rules to fileserver.conf. In Puppet 5 with Puppet Server, you can control -# file access in auth.conf by controlling the /file_metadata(s)/, -# /file_content(s)/, and /static_file_content/ paths. See the -# Puppet Server documentation at -# https://puppet.com/docs/puppetserver/latest/config_file_auth.html. -# -# If you are not using Puppet Server, or are using Puppet Server but with the -# "jruby-puppet.use-legacy-auth-conf" setting set to "true", you could set the -# desired file access in a new rule in this file. For example: -# -# path ~ ^/file_(metadata|content)s?/extra_files/ -# auth yes -# allow /^(.+)\.example\.com$/ -# allow_ip 192.168.100.0/24 -# -# If added to auth.conf BEFORE the default "path /file" rule, this rule -# will add stricter restrictions to the extra_files mount point. - -### Authenticated ACLs - these rules apply only when the client -### has a valid certificate and is thus authenticated - -path /puppet/v3/environments -method find -allow * - -# allow nodes to retrieve their own catalog -path ~ ^/puppet/v3/catalog/([^/]+)$ -method find -allow $1 - -# allow nodes to retrieve their own node definition -path ~ ^/puppet/v3/node/([^/]+)$ -method find -allow $1 - -# allow all nodes to store their own reports -path ~ ^/puppet/v3/report/([^/]+)$ -method save -allow $1 - -# allow all nodes to update their own facts -path ~ ^/puppet/v3/facts/([^/]+)$ -method save -allow $1 - -# Allow all nodes to access all file services; this is necessary for -# pluginsync, file serving from modules, and file serving from custom -# mount points (see fileserver.conf). Note that the `/file` prefix matches -# requests to both the file_metadata and file_content paths. See "Examples" -# above if you need more granular access control for custom mount points. -path /puppet/v3/file -allow * - -# allow all nodes to access the certificates services -path /puppet-ca/v1/certificate_revocation_list/ca -method find -allow * - -### Unauthenticated ACLs, for clients without valid certificates; authenticated -### clients can also access these paths, though they rarely need to. - -# allow access to the CA certificate; unauthenticated nodes need this -# in order to validate the puppet master's certificate -path /puppet-ca/v1/certificate/ca -auth any -method find -allow * - -# allow nodes to retrieve the certificate they requested earlier -path /puppet-ca/v1/certificate/ -auth any -method find -allow * - -# allow nodes to request a new certificate -path /puppet-ca/v1/certificate_request -auth any -method find, save -allow * - -# deny everything else; this ACL is not strictly necessary, but -# illustrates the default policy. -path / -auth any diff --git a/ext/osx/file_mapping.yaml b/ext/osx/file_mapping.yaml index 7a1d4e7f723..a3f62c3d319 100644 --- a/ext/osx/file_mapping.yaml +++ b/ext/osx/file_mapping.yaml @@ -15,11 +15,6 @@ directories: group: 'wheel' perms: '0755' files: - 'conf/auth.conf': - path: 'private/etc/puppet' - owner: 'root' - group: 'wheel' - perms: '0644' 'man/man5/puppet.conf.5': path: 'usr/share/man/man5' owner: 'root' diff --git a/ext/redhat/puppet.spec.erb b/ext/redhat/puppet.spec.erb index 0072e8a1520..0411c1c9163 100644 --- a/ext/redhat/puppet.spec.erb +++ b/ext/redhat/puppet.spec.erb @@ -199,7 +199,6 @@ touch %{buildroot}%{_localstatedir}/log/puppet/masterhttp.log %config(noreplace) %{_sysconfdir}/tmpfiles.d/%{name}.conf %endif %config(noreplace) %{_sysconfdir}/puppet/puppet.conf -%config(noreplace) %{_sysconfdir}/puppet/auth.conf %config(noreplace) %{_sysconfdir}/logrotate.d/puppet # We don't want to require emacs or vim, so we need to own these dirs %{_datadir}/emacs diff --git a/install.rb b/install.rb index 3b6376f9570..5d8c2e9952b 100755 --- a/install.rb +++ b/install.rb @@ -478,7 +478,7 @@ def install_binfile(from, op_file, target) # Change directory into the puppet root so we don't get the wrong files for install. FileUtils.cd File.dirname(__FILE__) do # Set these values to what you want installed. - configs = glob(%w{conf/auth.conf conf/puppet.conf conf/hiera.yaml}) + configs = glob(%w{conf/puppet.conf conf/hiera.yaml}) bins = glob(%w{bin/*}) #rdoc = glob(%w{bin/* lib/**/*.rb README* }).reject { |e| e=~ /\.(bat|cmd)$/ } #ri = glob(%w{bin/*.rb lib/**/*.rb}).reject { |e| e=~ /\.(bat|cmd)$/ } From 92dfb5fb25908cfcfaf306ad68def0a771481dc3 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Tue, 15 Sep 2020 18:36:26 +0000 Subject: [PATCH 168/731] (packaging) Updating the puppet.pot file --- locales/puppet.pot | 185 +++++++++++---------------------------------- 1 file changed, 46 insertions(+), 139 deletions(-) diff --git a/locales/puppet.pot b/locales/puppet.pot index ae5646fa521..748907bc5e6 100644 --- a/locales/puppet.pot +++ b/locales/puppet.pot @@ -6,11 +6,11 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Puppet automation framework 6.18.0-246-g156d26d66e\n" +"Project-Id-Version: Puppet automation framework 6.18.0-270-g715ac6903a\n" "\n" "Report-Msgid-Bugs-To: https://tickets.puppetlabs.com\n" -"POT-Creation-Date: 2020-09-10 03:21+0000\n" -"PO-Revision-Date: 2020-09-10 03:21+0000\n" +"POT-Creation-Date: 2020-09-15 18:36+0000\n" +"PO-Revision-Date: 2020-09-15 18:36+0000\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -352,27 +352,27 @@ msgstr "" msgid "Store and retrieve files in a filebucket" msgstr "" -#: ../lib/puppet/application/filebucket.rb:221 +#: ../lib/puppet/application/filebucket.rb:225 msgid "You must specify a file to back up" msgstr "" -#: ../lib/puppet/application/filebucket.rb:225 +#: ../lib/puppet/application/filebucket.rb:229 msgid "%{file}: no such file" msgstr "" -#: ../lib/puppet/application/filebucket.rb:229 +#: ../lib/puppet/application/filebucket.rb:233 msgid "%{file}: cannot read file" msgstr "" -#: ../lib/puppet/application/filebucket.rb:251 ../lib/puppet/application/filebucket.rb:274 +#: ../lib/puppet/application/filebucket.rb:255 ../lib/puppet/application/filebucket.rb:278 msgid "Need exactly two arguments: filebucket diff " msgstr "" -#: ../lib/puppet/application/filebucket.rb:271 +#: ../lib/puppet/application/filebucket.rb:275 msgid "Comparing %{checksum_a} %{checksum_b} %{file_a} %{file_b}" msgstr "" -#: ../lib/puppet/application/filebucket.rb:285 +#: ../lib/puppet/application/filebucket.rb:289 msgid "Cancelling" msgstr "" @@ -715,7 +715,7 @@ msgid "Invalid value '%{value}' for parameter %{name}. Allowed values are '%{all msgstr "" #. TRANSLATORS 'pluginsync' is a setting and should not be translated -#: ../lib/puppet/defaults.rb:1888 +#: ../lib/puppet/defaults.rb:1877 msgid "Setting 'pluginsync' is deprecated." msgstr "" @@ -1011,7 +1011,7 @@ msgstr "" msgid "Upload local facts to the puppet master." msgstr "" -#: ../lib/puppet/face/facts.rb:82 +#: ../lib/puppet/face/facts.rb:78 msgid "Uploading facts for '%{node}' to '%{server}'" msgstr "" @@ -1549,7 +1549,7 @@ msgstr "" msgid "Cannot find file: Invalid relative path '%{path}'" msgstr "" -#: ../lib/puppet/file_serving/configuration.rb:109 +#: ../lib/puppet/file_serving/configuration.rb:104 msgid "Error parsing fileserver configuration: %{detail}; using old configuration" msgstr "" @@ -1565,31 +1565,23 @@ msgstr "" msgid "Fileserver configuration file does not use '=' as a separator" msgstr "" -#: ../lib/puppet/file_serving/configuration/parser.rb:41 ../lib/puppet/network/auth_config_parser.rb:72 ../lib/puppet/util/network_device/config.rb:101 +#: ../lib/puppet/file_serving/configuration/parser.rb:40 ../lib/puppet/util/network_device/config.rb:101 msgid "Invalid argument '%{var}' at %{error_location}" msgstr "" -#: ../lib/puppet/file_serving/configuration/parser.rb:46 +#: ../lib/puppet/file_serving/configuration/parser.rb:45 msgid "Invalid entry at %{error_location}: '%{file_text}'" msgstr "" -#: ../lib/puppet/file_serving/configuration/parser.rb:71 -msgid "allowing %{val} access" -msgstr "" - -#: ../lib/puppet/file_serving/configuration/parser.rb:85 -msgid "denying %{val} access" -msgstr "" - -#: ../lib/puppet/file_serving/configuration/parser.rb:99 +#: ../lib/puppet/file_serving/configuration/parser.rb:70 msgid "%{mount} is already mounted at %{name} at %{error_location}" msgstr "" -#: ../lib/puppet/file_serving/configuration/parser.rb:124 +#: ../lib/puppet/file_serving/configuration/parser.rb:95 msgid "Removing mount \"%{mount}\": %{detail}" msgstr "" -#: ../lib/puppet/file_serving/configuration/parser.rb:128 +#: ../lib/puppet/file_serving/configuration/parser.rb:99 msgid "The '%{mount}' module can not have a path. Ignoring attempt to set it" msgstr "" @@ -1647,7 +1639,7 @@ msgstr "" msgid "Cannot manage files of type %{file_type}" msgstr "" -#: ../lib/puppet/file_serving/mount.rb:21 +#: ../lib/puppet/file_serving/mount.rb:20 msgid "Invalid mount name format '%{name}'" msgstr "" @@ -2516,11 +2508,7 @@ msgstr "" msgid "cannot lookup multiple files" msgstr "" -#: ../lib/puppet/indirector/file_server.rb:25 -msgid "Denying %{method} request for %{desc} on fileserver mount '%{mount_name}'. Use of auth directives for 'fileserver.conf' mount points is no longer supported. Remove these directives and use the 'auth.conf' file instead for access control." -msgstr "" - -#: ../lib/puppet/indirector/file_server.rb:49 +#: ../lib/puppet/indirector/file_server.rb:42 msgid "Could not find filesystem info for file '%{request}' in environment %{env}" msgstr "" @@ -3575,67 +3563,6 @@ msgstr "" msgid "No suitable tar implementation found" msgstr "" -#. TRANSLATORS "path" is a configuration file entry and should not be translated -#: ../lib/puppet/network/auth_config_parser.rb:32 -msgid "Missing or invalid 'path' before right directive at %{error_location}" -msgstr "" - -#: ../lib/puppet/network/auth_config_parser.rb:38 ../lib/puppet/util/network_device/config.rb:71 -msgid "Invalid entry at %{error_location}: %{file_text}" -msgstr "" - -#: ../lib/puppet/network/auth_config_parser.rb:57 -msgid "allowing %{value} access" -msgstr "" - -#: ../lib/puppet/network/auth_config_parser.rb:59 -msgid "denying %{value} access" -msgstr "" - -#: ../lib/puppet/network/auth_config_parser.rb:61 -msgid "allowing IP %{value} access" -msgstr "" - -#: ../lib/puppet/network/auth_config_parser.rb:63 -msgid "denying IP %{value} access" -msgstr "" - -#: ../lib/puppet/network/auth_config_parser.rb:65 -msgid "allowing 'method' %{value}" -msgstr "" - -#: ../lib/puppet/network/auth_config_parser.rb:67 -msgid "adding environment %{value}" -msgstr "" - -#: ../lib/puppet/network/auth_config_parser.rb:69 -msgid "adding authentication %{value}" -msgstr "" - -#: ../lib/puppet/network/authconfig.rb:41 -msgid "Inserting default '%{acl}' (auth %{auth}) ACL" -msgstr "" - -#: ../lib/puppet/network/authconfig.rb:71 -msgid "Denying access: %{authorization_failure_exception}" -msgstr "" - -#: ../lib/puppet/network/authstore.rb:22 -msgid "Name and IP must be passed to 'allowed?'" -msgstr "" - -#: ../lib/puppet/network/authstore.rb:37 -msgid "defaulting to no access for %{name}" -msgstr "" - -#: ../lib/puppet/network/authstore.rb:190 -msgid "Invalid declaration type %{type}" -msgstr "" - -#: ../lib/puppet/network/authstore.rb:258 -msgid "Invalid IP pattern %{value}" -msgstr "" - #: ../lib/puppet/network/client_request.rb:15 msgid "Request is not set up; cannot build call" msgstr "" @@ -3689,77 +3616,77 @@ msgstr "" msgid "Serialized YAML did not contain a valid instance of %{klass}" msgstr "" -#: ../lib/puppet/network/http/api/indirected_routes.rb:43 +#: ../lib/puppet/network/http/api/indirected_routes.rb:42 msgid "No handler for %{indirection}" msgstr "" -#: ../lib/puppet/network/http/api/indirected_routes.rb:66 +#: ../lib/puppet/network/http/api/indirected_routes.rb:65 msgid "The indirection name must be purely alphanumeric, not '%{indirection_name}'" msgstr "" -#: ../lib/puppet/network/http/api/indirected_routes.rb:76 +#: ../lib/puppet/network/http/api/indirected_routes.rb:75 msgid "Indirection '%{indirection_name}' does not match url prefix '%{url_prefix}'" msgstr "" -#: ../lib/puppet/network/http/api/indirected_routes.rb:82 +#: ../lib/puppet/network/http/api/indirected_routes.rb:81 msgid "Could not find indirection '%{indirection_name}'" msgstr "" -#: ../lib/puppet/network/http/api/indirected_routes.rb:88 +#: ../lib/puppet/network/http/api/indirected_routes.rb:87 msgid "An environment parameter must be specified" msgstr "" -#: ../lib/puppet/network/http/api/indirected_routes.rb:93 +#: ../lib/puppet/network/http/api/indirected_routes.rb:92 msgid "The environment must be purely alphanumeric, not '%{environment}'" msgstr "" -#: ../lib/puppet/network/http/api/indirected_routes.rb:110 +#: ../lib/puppet/network/http/api/indirected_routes.rb:103 msgid "Could not find environment '%{environment}'" msgstr "" -#: ../lib/puppet/network/http/api/indirected_routes.rb:117 +#: ../lib/puppet/network/http/api/indirected_routes.rb:110 msgid "No request key specified in %{uri}" msgstr "" -#: ../lib/puppet/network/http/api/indirected_routes.rb:129 +#: ../lib/puppet/network/http/api/indirected_routes.rb:122 msgid "Could not find %{value0} %{key}" msgstr "" -#: ../lib/puppet/network/http/api/indirected_routes.rb:136 +#: ../lib/puppet/network/http/api/indirected_routes.rb:129 msgid "Rendered result in %{format}" msgstr "" -#: ../lib/puppet/network/http/api/indirected_routes.rb:142 +#: ../lib/puppet/network/http/api/indirected_routes.rb:135 msgid "Sent response" msgstr "" -#: ../lib/puppet/network/http/api/indirected_routes.rb:150 +#: ../lib/puppet/network/http/api/indirected_routes.rb:143 msgid "Could not find %{indirection} %{key}" msgstr "" -#: ../lib/puppet/network/http/api/indirected_routes.rb:162 +#: ../lib/puppet/network/http/api/indirected_routes.rb:155 msgid "Could not find instances in %{indirection} with '%{key}'" msgstr "" -#: ../lib/puppet/network/http/api/indirected_routes.rb:210 ../lib/puppet/network/http/request.rb:61 +#: ../lib/puppet/network/http/api/indirected_routes.rb:203 ../lib/puppet/network/http/request.rb:61 msgid "No supported formats are acceptable (Accept: %{accepted_formats})" msgstr "" -#: ../lib/puppet/network/http/api/indirected_routes.rb:235 +#: ../lib/puppet/network/http/api/indirected_routes.rb:228 msgid "The request body is invalid: %{message}" msgstr "" #. TRANSLATORS "mime-type" is a keyword and should not be translated #. TRANSLATORS "mime-type" is a keyword and should not be translated -#: ../lib/puppet/network/http/api/indirected_routes.rb:241 ../lib/puppet/network/http/request.rb:32 +#: ../lib/puppet/network/http/api/indirected_routes.rb:234 ../lib/puppet/network/http/request.rb:32 msgid "Client sent a mime-type (%{header}) that doesn't correspond to a format we support" msgstr "" -#: ../lib/puppet/network/http/api/indirected_routes.rb:247 +#: ../lib/puppet/network/http/api/indirected_routes.rb:240 msgid "No support for http method %{http_method}" msgstr "" -#: ../lib/puppet/network/http/api/indirected_routes.rb:252 +#: ../lib/puppet/network/http/api/indirected_routes.rb:245 msgid "No support for plurality %{indirection} for %{http_method} operations" msgstr "" @@ -3807,19 +3734,19 @@ msgstr "" msgid "Server Error: %{message}" msgstr "" -#: ../lib/puppet/network/http/handler.rb:23 +#: ../lib/puppet/network/http/handler.rb:22 msgid "Given multiple routes with identical path regexes: %{regexes}" msgstr "" -#: ../lib/puppet/network/http/handler.rb:67 +#: ../lib/puppet/network/http/handler.rb:66 msgid "Processed request %{request_method} %{request_path}" msgstr "" -#: ../lib/puppet/network/http/handler.rb:113 +#: ../lib/puppet/network/http/handler.rb:112 msgid "No route for %{request} %{path}" msgstr "" -#: ../lib/puppet/network/http/handler.rb:138 +#: ../lib/puppet/network/http/handler.rb:137 msgid "Could not resolve %{ip}: %{detail}" msgstr "" @@ -3845,30 +3772,6 @@ msgstr "" msgid "An ssl_context is unnecessary when connecting to 'http://%{host}:%{port}' and will be ignored" msgstr "" -#: ../lib/puppet/network/rights.rb:59 -msgid "Forbidden request: %{msg}" -msgstr "" - -#: ../lib/puppet/network/rights.rb:127 -msgid "Unknown right type '%{name}'" -msgstr "" - -#: ../lib/puppet/network/rights.rb:169 -msgid "'%{m}' is not an allowed value for method directive" -msgstr "" - -#: ../lib/puppet/network/rights.rb:176 -msgid "'%{m}' is already in the '%{name}' ACL" -msgstr "" - -#: ../lib/puppet/network/rights.rb:183 -msgid "'%{env}' is already in the '%{name}' ACL" -msgstr "" - -#: ../lib/puppet/network/rights.rb:195 -msgid "'%{name}' incorrect authenticated value: %{authentication}" -msgstr "" - #: ../lib/puppet/node.rb:27 msgid "No name provided in serialized data" msgstr "" @@ -8992,6 +8895,10 @@ msgstr "" msgid "Duplicate device found at %{file_error_location}, already found at %{device_error_location}" msgstr "" +#: ../lib/puppet/util/network_device/config.rb:71 +msgid "Invalid entry at %{error_location}: %{file_text}" +msgstr "" + #: ../lib/puppet/util/network_device/config.rb:77 msgid "Configuration error: Cannot read %{file}; cannot serve" msgstr "" @@ -9048,7 +8955,7 @@ msgstr "" msgid "Could not create feature %{name}: %{detail}" msgstr "" -#: ../lib/puppet/util/rdoc.rb:44 ../lib/puppet/util/rdoc.rb:50 ../lib/puppet/util/rdoc.rb:54 ../lib/puppet/util/rdoc.rb:58 +#: ../lib/puppet/util/rdoc.rb:37 ../lib/puppet/util/rdoc.rb:43 ../lib/puppet/util/rdoc.rb:47 ../lib/puppet/util/rdoc.rb:51 msgid "RDOC SUPPORT FOR MANIFEST HAS BEEN REMOVED - See PUP-3638" msgstr "" From e698a78a43121ca312a1aa5e46212a54a651a4d9 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Tue, 15 Sep 2020 18:37:52 +0000 Subject: [PATCH 169/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 19 ++++++++----------- man/man8/puppet-agent.8 | 2 +- man/man8/puppet-apply.8 | 2 +- man/man8/puppet-catalog.8 | 2 +- man/man8/puppet-config.8 | 2 +- man/man8/puppet-describe.8 | 2 +- man/man8/puppet-device.8 | 2 +- man/man8/puppet-doc.8 | 2 +- man/man8/puppet-epp.8 | 2 +- man/man8/puppet-facts.8 | 10 ++-------- man/man8/puppet-filebucket.8 | 2 +- man/man8/puppet-generate.8 | 2 +- man/man8/puppet-help.8 | 2 +- man/man8/puppet-lookup.8 | 2 +- man/man8/puppet-module.8 | 2 +- man/man8/puppet-node.8 | 2 +- man/man8/puppet-parser.8 | 2 +- man/man8/puppet-plugin.8 | 2 +- man/man8/puppet-report.8 | 2 +- man/man8/puppet-resource.8 | 2 +- man/man8/puppet-script.8 | 2 +- man/man8/puppet-ssl.8 | 2 +- man/man8/puppet.8 | 3 +++ 23 files changed, 33 insertions(+), 39 deletions(-) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index d51a4ef1566..f0ca9aca58b 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -2,6 +2,11 @@ .\" http://github.com/rtomayko/ronn/tree/0.7.3 . .TH "PUPPETCONF" "5" "September 2020" "Puppet, Inc." "Puppet manual" +. +.SH "NAME" +\fBpuppetconf\fR +. +.P \fBThis page is autogenerated; any changes will get overwritten\fR . .SH "Configuration settings" @@ -264,7 +269,7 @@ When certificate_revocation is set to \'false\', Puppet disables all certificate The name to use when handling certificates\. When a node requests a certificate from the CA puppet master, it uses the value of the \fBcertname\fR setting as its requested Subject CN\. . .P -This is the name used when managing a node\'s permissions in auth\.conf \fIhttps://puppet\.com/docs/puppet/latest/config_file_auth\.html\fR\. In most cases, it is also used as the node\'s name when matching node definitions \fIhttps://puppet\.com/docs/puppet/latest/lang_node_definitions\.html\fR and requesting data from an ENC\. (This can be changed with the \fBnode_name_value\fR and \fBnode_name_fact\fR settings, although you should only do so if you have a compelling reason\.) +This is the name used when managing a node\'s permissions in Puppet Server\'s auth\.conf \fIhttps://puppet\.com/docs/puppetserver/latest/config_file_auth\.html\fR\. In most cases, it is also used as the node\'s name when matching node definitions \fIhttps://puppet\.com/docs/puppet/latest/lang_node_definitions\.html\fR and requesting data from an ENC\. (This can be changed with the \fBnode_name_value\fR and \fBnode_name_fact\fR settings, although you should only do so if you have a compelling reason\.) . .P A node\'s certname is available in Puppet manifests as \fB$trusted[\'certname\']\fR\. (See Facts and Built\-In Variables \fIhttps://puppet\.com/docs/puppet/latest/lang_facts_and_builtin_vars\.html\fR for more details\.) @@ -1283,10 +1288,10 @@ How to store cached nodes\. Valid values are (none), \'json\', \'msgpack\', or \ . .SS "node_name_fact" -The fact name used to determine the node name used for all requests the agent makes to the master\. WARNING: This setting is mutually exclusive with node_name_value\. Changing this setting also requires changes to the default auth\.conf configuration on the Puppet Master\. Please see http://links\.puppet\.com/node_name_fact for more information\. +The fact name used to determine the node name used for all requests the agent makes to the master\. WARNING: This setting is mutually exclusive with node_name_value\. Changing this setting also requires changes to Puppet Server\'s default auth\.conf \fIhttps://puppet\.com/docs/puppetserver/latest/config_file_auth\.html\fR\. . .SS "node_name_value" -The explicit value used for the node name for all requests the agent makes to the master\. WARNING: This setting is mutually exclusive with node_name_fact\. Changing this setting also requires changes to the default auth\.conf configuration on the Puppet Master\. Please see http://links\.puppet\.com/node_name_value for more information\. +The explicit value used for the node name for all requests the agent makes to the master\. WARNING: This setting is mutually exclusive with node_name_fact\. Changing this setting also requires changes to Puppet Server\'s default auth\.conf \fIhttps://puppet\.com/docs/puppetserver/latest/config_file_auth\.html\fR\. . .IP "\(bu" 4 \fIDefault\fR: $certname @@ -1593,14 +1598,6 @@ The file in which puppet agent stores a list of the resources associated with th . .IP "" 0 . -.SS "rest_authconfig" -The configuration file that defines the rights to the different rest indirections\. This can be used as a fine\-grained authorization system for \fBpuppet master\fR\. The \fBpuppet master\fR command is deprecated and Puppet Server uses its own auth\.conf that must be placed within its configuration directory\. -. -.IP "\(bu" 4 -\fIDefault\fR: $confdir/auth\.conf -. -.IP "" 0 -. .SS "resubmit_facts" Whether to send updated facts after every transaction\. By default puppet only submits facts at the beginning of the transaction before applying a catalog\. Since puppet can modify the state of the system, the value of the facts may change after puppet finishes\. Therefore, any facts stored in puppetdb may not be consistent until the agent next runs, typically in 30 minutes\. If this feature is enabled, puppet will resubmit facts after applying its catalog, ensuring facts for the node stored in puppetdb are current\. However, this will double the fact submission load on puppetdb, so it is disabled by default\. . diff --git a/man/man8/puppet-agent.8 b/man/man8/puppet-agent.8 index 17ec2193ce6..91a76c7c733 100644 --- a/man/man8/puppet-agent.8 +++ b/man/man8/puppet-agent.8 @@ -4,7 +4,7 @@ .TH "PUPPET\-AGENT" "8" "September 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" -\fBpuppet\-agent\fR \- The puppet agent daemon +\fBpuppet\-agent\fR . .SH "SYNOPSIS" Retrieves the client configuration from the Puppet master and applies it to the local host\. diff --git a/man/man8/puppet-apply.8 b/man/man8/puppet-apply.8 index 3db7bd45a4f..72bda4cc9aa 100644 --- a/man/man8/puppet-apply.8 +++ b/man/man8/puppet-apply.8 @@ -4,7 +4,7 @@ .TH "PUPPET\-APPLY" "8" "September 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" -\fBpuppet\-apply\fR \- Apply Puppet manifests locally +\fBpuppet\-apply\fR . .SH "SYNOPSIS" Applies a standalone Puppet manifest to the local system\. diff --git a/man/man8/puppet-catalog.8 b/man/man8/puppet-catalog.8 index d80588fa8ae..0fc352da358 100644 --- a/man/man8/puppet-catalog.8 +++ b/man/man8/puppet-catalog.8 @@ -4,7 +4,7 @@ .TH "PUPPET\-CATALOG" "8" "September 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" -\fBpuppet\-catalog\fR \- Compile, save, view, and convert catalogs\. +\fBpuppet\-catalog\fR . .SH "SYNOPSIS" puppet catalog \fIaction\fR [\-\-terminus _TERMINUS] [\-\-extra HASH] diff --git a/man/man8/puppet-config.8 b/man/man8/puppet-config.8 index f6f7c2eec51..99e4f3dd99b 100644 --- a/man/man8/puppet-config.8 +++ b/man/man8/puppet-config.8 @@ -4,7 +4,7 @@ .TH "PUPPET\-CONFIG" "8" "September 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" -\fBpuppet\-config\fR \- Interact with Puppet\'s settings\. +\fBpuppet\-config\fR . .SH "SYNOPSIS" puppet config \fIaction\fR [\-\-section SECTION_NAME] diff --git a/man/man8/puppet-describe.8 b/man/man8/puppet-describe.8 index 270c34d8c0d..cbf5f46d2d2 100644 --- a/man/man8/puppet-describe.8 +++ b/man/man8/puppet-describe.8 @@ -4,7 +4,7 @@ .TH "PUPPET\-DESCRIBE" "8" "September 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" -\fBpuppet\-describe\fR \- Display help about resource types +\fBpuppet\-describe\fR . .SH "SYNOPSIS" Prints help about Puppet resource types, providers, and metaparameters\. diff --git a/man/man8/puppet-device.8 b/man/man8/puppet-device.8 index 6e4c9b933d5..e356c6f9aa2 100644 --- a/man/man8/puppet-device.8 +++ b/man/man8/puppet-device.8 @@ -4,7 +4,7 @@ .TH "PUPPET\-DEVICE" "8" "September 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" -\fBpuppet\-device\fR \- Manage remote network devices +\fBpuppet\-device\fR . .SH "SYNOPSIS" Retrieves catalogs from the Puppet master and applies them to remote devices\. diff --git a/man/man8/puppet-doc.8 b/man/man8/puppet-doc.8 index e6a77cffb59..5fe6a1d0b69 100644 --- a/man/man8/puppet-doc.8 +++ b/man/man8/puppet-doc.8 @@ -4,7 +4,7 @@ .TH "PUPPET\-DOC" "8" "September 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" -\fBpuppet\-doc\fR \- Generate Puppet references +\fBpuppet\-doc\fR . .SH "SYNOPSIS" Generates a reference for all Puppet types\. Largely meant for internal Puppet Inc\. use\. (Deprecated) diff --git a/man/man8/puppet-epp.8 b/man/man8/puppet-epp.8 index 2c296fb3f5c..6f3419b0fc7 100644 --- a/man/man8/puppet-epp.8 +++ b/man/man8/puppet-epp.8 @@ -4,7 +4,7 @@ .TH "PUPPET\-EPP" "8" "September 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" -\fBpuppet\-epp\fR \- Interact directly with the EPP template parser/renderer\. +\fBpuppet\-epp\fR . .SH "SYNOPSIS" puppet epp \fIaction\fR diff --git a/man/man8/puppet-facts.8 b/man/man8/puppet-facts.8 index 4cb424ee8f9..cc561761e43 100644 --- a/man/man8/puppet-facts.8 +++ b/man/man8/puppet-facts.8 @@ -4,7 +4,7 @@ .TH "PUPPET\-FACTS" "8" "September 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" -\fBpuppet\-facts\fR \- Retrieve and store facts\. +\fBpuppet\-facts\fR . .SH "SYNOPSIS" puppet facts \fIaction\fR [\-\-terminus _TERMINUS] [\-\-extra HASH] @@ -123,7 +123,7 @@ Nothing\. \fBNOTES\fR . .IP -This action requires that the puppet master\'s \fBauth\.conf\fR file allow \fBPUT\fR or \fBsave\fR access to the \fB/puppet/v3/facts\fR API endpoint\. +This action requires that the Puppet Server\'s \fBauth\.conf\fR file allow \fBPUT\fR or \fBsave\fR access to the \fB/puppet/v3/facts\fR API endpoint\. . .IP For details on configuring Puppet Server\'s \fBauth\.conf\fR, see: @@ -131,12 +131,6 @@ For details on configuring Puppet Server\'s \fBauth\.conf\fR, see: .IP \fIhttps://puppet\.com/docs/puppetserver/latest/config_file_auth\.html\fR . -.IP -For legacy Rack\-based Puppet Masters, see: -. -.IP -\fIhttps://puppet\.com/docs/puppet/latest/config_file_auth\.html\fR -. .SH "EXAMPLES" \fBfind\fR . diff --git a/man/man8/puppet-filebucket.8 b/man/man8/puppet-filebucket.8 index 7895cca66e0..cf5fb6858ef 100644 --- a/man/man8/puppet-filebucket.8 +++ b/man/man8/puppet-filebucket.8 @@ -4,7 +4,7 @@ .TH "PUPPET\-FILEBUCKET" "8" "September 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" -\fBpuppet\-filebucket\fR \- Store and retrieve files in a filebucket +\fBpuppet\-filebucket\fR . .SH "SYNOPSIS" A stand\-alone Puppet filebucket client\. diff --git a/man/man8/puppet-generate.8 b/man/man8/puppet-generate.8 index b5b5343674c..50f65bc781f 100644 --- a/man/man8/puppet-generate.8 +++ b/man/man8/puppet-generate.8 @@ -4,7 +4,7 @@ .TH "PUPPET\-GENERATE" "8" "September 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" -\fBpuppet\-generate\fR \- Generates Puppet code from Ruby definitions\. +\fBpuppet\-generate\fR . .SH "SYNOPSIS" puppet generate \fIaction\fR diff --git a/man/man8/puppet-help.8 b/man/man8/puppet-help.8 index e397ffe0d01..6ed6e5d44f7 100644 --- a/man/man8/puppet-help.8 +++ b/man/man8/puppet-help.8 @@ -4,7 +4,7 @@ .TH "PUPPET\-HELP" "8" "September 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" -\fBpuppet\-help\fR \- Display Puppet help\. +\fBpuppet\-help\fR . .SH "SYNOPSIS" puppet help \fIaction\fR diff --git a/man/man8/puppet-lookup.8 b/man/man8/puppet-lookup.8 index b0e20c79095..a205a469b83 100644 --- a/man/man8/puppet-lookup.8 +++ b/man/man8/puppet-lookup.8 @@ -4,7 +4,7 @@ .TH "PUPPET\-LOOKUP" "8" "September 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" -\fBpuppet\-lookup\fR \- Interactive Hiera lookup +\fBpuppet\-lookup\fR . .SH "SYNOPSIS" Does Hiera lookups from the command line\. diff --git a/man/man8/puppet-module.8 b/man/man8/puppet-module.8 index c86f7df7d63..27f85eae7fb 100644 --- a/man/man8/puppet-module.8 +++ b/man/man8/puppet-module.8 @@ -4,7 +4,7 @@ .TH "PUPPET\-MODULE" "8" "September 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" -\fBpuppet\-module\fR \- Creates, installs and searches for modules on the Puppet Forge\. +\fBpuppet\-module\fR . .SH "SYNOPSIS" puppet module \fIaction\fR [\-\-environment production ] [\-\-modulepath ] diff --git a/man/man8/puppet-node.8 b/man/man8/puppet-node.8 index def01f5ee22..db7ccf19f67 100644 --- a/man/man8/puppet-node.8 +++ b/man/man8/puppet-node.8 @@ -4,7 +4,7 @@ .TH "PUPPET\-NODE" "8" "September 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" -\fBpuppet\-node\fR \- View and manage node definitions\. +\fBpuppet\-node\fR . .SH "SYNOPSIS" puppet node \fIaction\fR [\-\-terminus _TERMINUS] [\-\-extra HASH] diff --git a/man/man8/puppet-parser.8 b/man/man8/puppet-parser.8 index b0ef4173a70..0d327f22c67 100644 --- a/man/man8/puppet-parser.8 +++ b/man/man8/puppet-parser.8 @@ -4,7 +4,7 @@ .TH "PUPPET\-PARSER" "8" "September 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" -\fBpuppet\-parser\fR \- Interact directly with the parser\. +\fBpuppet\-parser\fR . .SH "SYNOPSIS" puppet parser \fIaction\fR diff --git a/man/man8/puppet-plugin.8 b/man/man8/puppet-plugin.8 index acda8a2efd5..34003663246 100644 --- a/man/man8/puppet-plugin.8 +++ b/man/man8/puppet-plugin.8 @@ -4,7 +4,7 @@ .TH "PUPPET\-PLUGIN" "8" "September 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" -\fBpuppet\-plugin\fR \- Interact with the Puppet plugin system\. +\fBpuppet\-plugin\fR . .SH "SYNOPSIS" puppet plugin \fIaction\fR diff --git a/man/man8/puppet-report.8 b/man/man8/puppet-report.8 index 0e979f26fa9..291f576a0cf 100644 --- a/man/man8/puppet-report.8 +++ b/man/man8/puppet-report.8 @@ -4,7 +4,7 @@ .TH "PUPPET\-REPORT" "8" "September 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" -\fBpuppet\-report\fR \- Create, display, and submit reports\. +\fBpuppet\-report\fR . .SH "SYNOPSIS" puppet report \fIaction\fR [\-\-terminus _TERMINUS] [\-\-extra HASH] diff --git a/man/man8/puppet-resource.8 b/man/man8/puppet-resource.8 index ad1ee3716ce..45a2b58c1be 100644 --- a/man/man8/puppet-resource.8 +++ b/man/man8/puppet-resource.8 @@ -4,7 +4,7 @@ .TH "PUPPET\-RESOURCE" "8" "September 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" -\fBpuppet\-resource\fR \- The resource abstraction layer shell +\fBpuppet\-resource\fR . .SH "SYNOPSIS" Uses the Puppet RAL to directly interact with the system\. diff --git a/man/man8/puppet-script.8 b/man/man8/puppet-script.8 index cda66166ac2..8c044d14b3a 100644 --- a/man/man8/puppet-script.8 +++ b/man/man8/puppet-script.8 @@ -4,7 +4,7 @@ .TH "PUPPET\-SCRIPT" "8" "September 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" -\fBpuppet\-script\fR \- Run a puppet manifests as a script without compiling a catalog +\fBpuppet\-script\fR . .SH "SYNOPSIS" Runs a puppet language script without compiling a catalog\. diff --git a/man/man8/puppet-ssl.8 b/man/man8/puppet-ssl.8 index 4e8a7adbe3d..98a376e78c3 100644 --- a/man/man8/puppet-ssl.8 +++ b/man/man8/puppet-ssl.8 @@ -4,7 +4,7 @@ .TH "PUPPET\-SSL" "8" "September 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" -\fBpuppet\-ssl\fR \- Manage SSL keys and certificates for puppet SSL clients +\fBpuppet\-ssl\fR . .SH "SYNOPSIS" Manage SSL keys and certificates for SSL clients needing to communicate with a puppet infrastructure\. diff --git a/man/man8/puppet.8 b/man/man8/puppet.8 index 35137d2f4a0..7295fcba5f2 100644 --- a/man/man8/puppet.8 +++ b/man/man8/puppet.8 @@ -7,6 +7,9 @@ \fBpuppet\fR . .P +@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ search path is: ["/var/lib/jenkins/\.puppetlabs/opt/puppet/cache/lib/facter", "/var/lib/jenkins/\.puppetlabs/opt/puppet/cache/facts"] /tmp/jenkins/workspace/platform_puppet_vanagon\-component\-manpage\-generation_main_agent\-main/puppet/lib/puppet/defaults\.rb:1907:in \fBblock in initialize_default_settings!\' /tmp/jenkins/workspace/platform_puppet_vanagon\-component\-manpage\-generation_main_agent\-main/puppet/lib/puppet/settings\.rb:413:in\fRblock in call_hooks_deferred_to_application_initialization\' /tmp/jenkins/workspace/platform_puppet_vanagon\-component\-manpage\-generation_main_agent\-main/puppet/lib/puppet/settings\.rb:411:in \fBeach\' /tmp/jenkins/workspace/platform_puppet_vanagon\-component\-manpage\-generation_main_agent\-main/puppet/lib/puppet/settings\.rb:411:in\fRcall_hooks_deferred_to_application_initialization\' /tmp/jenkins/workspace/platform_puppet_vanagon\-component\-manpage\-generation_main_agent\-main/puppet/lib/puppet/settings\.rb:386:in \fBinitialize_app_defaults\' /tmp/jenkins/workspace/platform_puppet_vanagon\-component\-manpage\-generation_main_agent\-main/puppet/lib/puppet\.rb:180:in\fRdo_initialize_settings_for_run_mode\' /tmp/jenkins/workspace/platform_puppet_vanagon\-component\-manpage\-generation_main_agent\-main/puppet/lib/puppet\.rb:153:in \fBinitialize_settings\' /tmp/jenkins/workspace/platform_puppet_vanagon\-component\-manpage\-generation_main_agent\-main/puppet/lib/puppet/util/command_line\.rb:72:in\fRblock in execute\' /tmp/jenkins/workspace/platform_puppet_vanagon\-component\-manpage\-generation_main_agent\-main/puppet/lib/puppet/util\.rb:735:in \fBexit_on_fail\' /tmp/jenkins/workspace/platform_puppet_vanagon\-component\-manpage\-generation_main_agent\-main/puppet/lib/puppet/util/command_line\.rb:71:in\fRexecute\' bin/puppet:5:in \fB
\' @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ search path is: ["/var/lib/jenkins/\.puppetlabs/opt/puppet/cache/lib/facter", "/var/lib/jenkins/\.puppetlabs/opt/puppet/cache/facts"] /tmp/jenkins/workspace/platform_puppet_vanagon\-component\-manpage\-generation_main_agent\-main/puppet/lib/puppet/defaults\.rb:1907:in\fRblock in initialize_default_settings!\' /tmp/jenkins/workspace/platform_puppet_vanagon\-component\-manpage\-generation_main_agent\-main/puppet/lib/puppet/settings\.rb:413:in \fBblock in call_hooks_deferred_to_application_initialization\' /tmp/jenkins/workspace/platform_puppet_vanagon\-component\-manpage\-generation_main_agent\-main/puppet/lib/puppet/settings\.rb:411:in\fReach\' /tmp/jenkins/workspace/platform_puppet_vanagon\-component\-manpage\-generation_main_agent\-main/puppet/lib/puppet/settings\.rb:411:in \fBcall_hooks_deferred_to_application_initialization\' /tmp/jenkins/workspace/platform_puppet_vanagon\-component\-manpage\-generation_main_agent\-main/puppet/lib/puppet/settings\.rb:386:in\fRinitialize_app_defaults\' /tmp/jenkins/workspace/platform_puppet_vanagon\-component\-manpage\-generation_main_agent\-main/puppet/lib/puppet/application\.rb:337:in \fBinitialize_app_defaults\' /tmp/jenkins/workspace/platform_puppet_vanagon\-component\-manpage\-generation_main_agent\-main/puppet/lib/puppet/application\.rb:367:in\fRblock in run\' /tmp/jenkins/workspace/platform_puppet_vanagon\-component\-manpage\-generation_main_agent\-main/puppet/lib/puppet/util\.rb:735:in \fBexit_on_fail\' /tmp/jenkins/workspace/platform_puppet_vanagon\-component\-manpage\-generation_main_agent\-main/puppet/lib/puppet/application\.rb:366:in\fRrun\' /tmp/jenkins/workspace/platform_puppet_vanagon\-component\-manpage\-generation_main_agent\-main/puppet/lib/puppet/util/command_line\.rb:143:in \fBrun\' /tmp/jenkins/workspace/platform_puppet_vanagon\-component\-manpage\-generation_main_agent\-main/puppet/lib/puppet/util/command_line\.rb:77:in\fRexecute\' bin/puppet:5:in `\fImain\fR\' +. +.P Usage: puppet \fIsubcommand\fR [options] \fIaction\fR [options] . .P From 9b268eb5c63374862e3d8c9ebf869936ffdc967a Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Tue, 15 Sep 2020 15:08:55 -0700 Subject: [PATCH 170/731] (PUP-10473) Expect fileserver config parser to return mounts The file server's config parser should successfully parse the mounts while ignoring the allow and deny rules. --- spec/unit/file_serving/configuration/parser_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/unit/file_serving/configuration/parser_spec.rb b/spec/unit/file_serving/configuration/parser_spec.rb index 72116de7a50..eb7c9ee790e 100644 --- a/spec/unit/file_serving/configuration/parser_spec.rb +++ b/spec/unit/file_serving/configuration/parser_spec.rb @@ -101,13 +101,13 @@ def write_config_file(content) it "should ignore inline comments in #{acl_type}" do write_config_file "[one]\n#{acl_type} something \# will it work?\n" - @parser.parse + expect(@parser.parse).to eq('one' => @mount) end it "should ignore #{acl_type} from ACLs with varying spacing around commas" do write_config_file "[one]\n#{acl_type} someone,sometwo, somethree , somefour ,somefive\n" - @parser.parse + expect(@parser.parse).to eq('one' => @mount) end it "should log an error and print the location of the #{acl_type} rule" do From a54094d20a52f4b0a9f2317bfb67934f9d46f8c1 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Wed, 16 Sep 2020 14:56:33 +0000 Subject: [PATCH 171/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 5 ----- man/man8/puppet-agent.8 | 2 +- man/man8/puppet-apply.8 | 2 +- man/man8/puppet-catalog.8 | 2 +- man/man8/puppet-config.8 | 2 +- man/man8/puppet-describe.8 | 2 +- man/man8/puppet-device.8 | 2 +- man/man8/puppet-doc.8 | 2 +- man/man8/puppet-epp.8 | 2 +- man/man8/puppet-facts.8 | 2 +- man/man8/puppet-filebucket.8 | 2 +- man/man8/puppet-generate.8 | 2 +- man/man8/puppet-help.8 | 2 +- man/man8/puppet-lookup.8 | 2 +- man/man8/puppet-module.8 | 2 +- man/man8/puppet-node.8 | 2 +- man/man8/puppet-parser.8 | 2 +- man/man8/puppet-plugin.8 | 2 +- man/man8/puppet-report.8 | 2 +- man/man8/puppet-resource.8 | 2 +- man/man8/puppet-script.8 | 2 +- man/man8/puppet-ssl.8 | 2 +- man/man8/puppet.8 | 3 --- 23 files changed, 21 insertions(+), 29 deletions(-) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index f0ca9aca58b..0e160326063 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -2,11 +2,6 @@ .\" http://github.com/rtomayko/ronn/tree/0.7.3 . .TH "PUPPETCONF" "5" "September 2020" "Puppet, Inc." "Puppet manual" -. -.SH "NAME" -\fBpuppetconf\fR -. -.P \fBThis page is autogenerated; any changes will get overwritten\fR . .SH "Configuration settings" diff --git a/man/man8/puppet-agent.8 b/man/man8/puppet-agent.8 index 91a76c7c733..17ec2193ce6 100644 --- a/man/man8/puppet-agent.8 +++ b/man/man8/puppet-agent.8 @@ -4,7 +4,7 @@ .TH "PUPPET\-AGENT" "8" "September 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" -\fBpuppet\-agent\fR +\fBpuppet\-agent\fR \- The puppet agent daemon . .SH "SYNOPSIS" Retrieves the client configuration from the Puppet master and applies it to the local host\. diff --git a/man/man8/puppet-apply.8 b/man/man8/puppet-apply.8 index 72bda4cc9aa..3db7bd45a4f 100644 --- a/man/man8/puppet-apply.8 +++ b/man/man8/puppet-apply.8 @@ -4,7 +4,7 @@ .TH "PUPPET\-APPLY" "8" "September 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" -\fBpuppet\-apply\fR +\fBpuppet\-apply\fR \- Apply Puppet manifests locally . .SH "SYNOPSIS" Applies a standalone Puppet manifest to the local system\. diff --git a/man/man8/puppet-catalog.8 b/man/man8/puppet-catalog.8 index 0fc352da358..d80588fa8ae 100644 --- a/man/man8/puppet-catalog.8 +++ b/man/man8/puppet-catalog.8 @@ -4,7 +4,7 @@ .TH "PUPPET\-CATALOG" "8" "September 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" -\fBpuppet\-catalog\fR +\fBpuppet\-catalog\fR \- Compile, save, view, and convert catalogs\. . .SH "SYNOPSIS" puppet catalog \fIaction\fR [\-\-terminus _TERMINUS] [\-\-extra HASH] diff --git a/man/man8/puppet-config.8 b/man/man8/puppet-config.8 index 99e4f3dd99b..f6f7c2eec51 100644 --- a/man/man8/puppet-config.8 +++ b/man/man8/puppet-config.8 @@ -4,7 +4,7 @@ .TH "PUPPET\-CONFIG" "8" "September 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" -\fBpuppet\-config\fR +\fBpuppet\-config\fR \- Interact with Puppet\'s settings\. . .SH "SYNOPSIS" puppet config \fIaction\fR [\-\-section SECTION_NAME] diff --git a/man/man8/puppet-describe.8 b/man/man8/puppet-describe.8 index cbf5f46d2d2..270c34d8c0d 100644 --- a/man/man8/puppet-describe.8 +++ b/man/man8/puppet-describe.8 @@ -4,7 +4,7 @@ .TH "PUPPET\-DESCRIBE" "8" "September 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" -\fBpuppet\-describe\fR +\fBpuppet\-describe\fR \- Display help about resource types . .SH "SYNOPSIS" Prints help about Puppet resource types, providers, and metaparameters\. diff --git a/man/man8/puppet-device.8 b/man/man8/puppet-device.8 index e356c6f9aa2..6e4c9b933d5 100644 --- a/man/man8/puppet-device.8 +++ b/man/man8/puppet-device.8 @@ -4,7 +4,7 @@ .TH "PUPPET\-DEVICE" "8" "September 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" -\fBpuppet\-device\fR +\fBpuppet\-device\fR \- Manage remote network devices . .SH "SYNOPSIS" Retrieves catalogs from the Puppet master and applies them to remote devices\. diff --git a/man/man8/puppet-doc.8 b/man/man8/puppet-doc.8 index 5fe6a1d0b69..e6a77cffb59 100644 --- a/man/man8/puppet-doc.8 +++ b/man/man8/puppet-doc.8 @@ -4,7 +4,7 @@ .TH "PUPPET\-DOC" "8" "September 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" -\fBpuppet\-doc\fR +\fBpuppet\-doc\fR \- Generate Puppet references . .SH "SYNOPSIS" Generates a reference for all Puppet types\. Largely meant for internal Puppet Inc\. use\. (Deprecated) diff --git a/man/man8/puppet-epp.8 b/man/man8/puppet-epp.8 index 6f3419b0fc7..2c296fb3f5c 100644 --- a/man/man8/puppet-epp.8 +++ b/man/man8/puppet-epp.8 @@ -4,7 +4,7 @@ .TH "PUPPET\-EPP" "8" "September 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" -\fBpuppet\-epp\fR +\fBpuppet\-epp\fR \- Interact directly with the EPP template parser/renderer\. . .SH "SYNOPSIS" puppet epp \fIaction\fR diff --git a/man/man8/puppet-facts.8 b/man/man8/puppet-facts.8 index cc561761e43..e97d4fd3be5 100644 --- a/man/man8/puppet-facts.8 +++ b/man/man8/puppet-facts.8 @@ -4,7 +4,7 @@ .TH "PUPPET\-FACTS" "8" "September 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" -\fBpuppet\-facts\fR +\fBpuppet\-facts\fR \- Retrieve and store facts\. . .SH "SYNOPSIS" puppet facts \fIaction\fR [\-\-terminus _TERMINUS] [\-\-extra HASH] diff --git a/man/man8/puppet-filebucket.8 b/man/man8/puppet-filebucket.8 index cf5fb6858ef..7895cca66e0 100644 --- a/man/man8/puppet-filebucket.8 +++ b/man/man8/puppet-filebucket.8 @@ -4,7 +4,7 @@ .TH "PUPPET\-FILEBUCKET" "8" "September 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" -\fBpuppet\-filebucket\fR +\fBpuppet\-filebucket\fR \- Store and retrieve files in a filebucket . .SH "SYNOPSIS" A stand\-alone Puppet filebucket client\. diff --git a/man/man8/puppet-generate.8 b/man/man8/puppet-generate.8 index 50f65bc781f..b5b5343674c 100644 --- a/man/man8/puppet-generate.8 +++ b/man/man8/puppet-generate.8 @@ -4,7 +4,7 @@ .TH "PUPPET\-GENERATE" "8" "September 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" -\fBpuppet\-generate\fR +\fBpuppet\-generate\fR \- Generates Puppet code from Ruby definitions\. . .SH "SYNOPSIS" puppet generate \fIaction\fR diff --git a/man/man8/puppet-help.8 b/man/man8/puppet-help.8 index 6ed6e5d44f7..e397ffe0d01 100644 --- a/man/man8/puppet-help.8 +++ b/man/man8/puppet-help.8 @@ -4,7 +4,7 @@ .TH "PUPPET\-HELP" "8" "September 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" -\fBpuppet\-help\fR +\fBpuppet\-help\fR \- Display Puppet help\. . .SH "SYNOPSIS" puppet help \fIaction\fR diff --git a/man/man8/puppet-lookup.8 b/man/man8/puppet-lookup.8 index a205a469b83..b0e20c79095 100644 --- a/man/man8/puppet-lookup.8 +++ b/man/man8/puppet-lookup.8 @@ -4,7 +4,7 @@ .TH "PUPPET\-LOOKUP" "8" "September 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" -\fBpuppet\-lookup\fR +\fBpuppet\-lookup\fR \- Interactive Hiera lookup . .SH "SYNOPSIS" Does Hiera lookups from the command line\. diff --git a/man/man8/puppet-module.8 b/man/man8/puppet-module.8 index 27f85eae7fb..c86f7df7d63 100644 --- a/man/man8/puppet-module.8 +++ b/man/man8/puppet-module.8 @@ -4,7 +4,7 @@ .TH "PUPPET\-MODULE" "8" "September 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" -\fBpuppet\-module\fR +\fBpuppet\-module\fR \- Creates, installs and searches for modules on the Puppet Forge\. . .SH "SYNOPSIS" puppet module \fIaction\fR [\-\-environment production ] [\-\-modulepath ] diff --git a/man/man8/puppet-node.8 b/man/man8/puppet-node.8 index db7ccf19f67..def01f5ee22 100644 --- a/man/man8/puppet-node.8 +++ b/man/man8/puppet-node.8 @@ -4,7 +4,7 @@ .TH "PUPPET\-NODE" "8" "September 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" -\fBpuppet\-node\fR +\fBpuppet\-node\fR \- View and manage node definitions\. . .SH "SYNOPSIS" puppet node \fIaction\fR [\-\-terminus _TERMINUS] [\-\-extra HASH] diff --git a/man/man8/puppet-parser.8 b/man/man8/puppet-parser.8 index 0d327f22c67..b0ef4173a70 100644 --- a/man/man8/puppet-parser.8 +++ b/man/man8/puppet-parser.8 @@ -4,7 +4,7 @@ .TH "PUPPET\-PARSER" "8" "September 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" -\fBpuppet\-parser\fR +\fBpuppet\-parser\fR \- Interact directly with the parser\. . .SH "SYNOPSIS" puppet parser \fIaction\fR diff --git a/man/man8/puppet-plugin.8 b/man/man8/puppet-plugin.8 index 34003663246..acda8a2efd5 100644 --- a/man/man8/puppet-plugin.8 +++ b/man/man8/puppet-plugin.8 @@ -4,7 +4,7 @@ .TH "PUPPET\-PLUGIN" "8" "September 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" -\fBpuppet\-plugin\fR +\fBpuppet\-plugin\fR \- Interact with the Puppet plugin system\. . .SH "SYNOPSIS" puppet plugin \fIaction\fR diff --git a/man/man8/puppet-report.8 b/man/man8/puppet-report.8 index 291f576a0cf..0e979f26fa9 100644 --- a/man/man8/puppet-report.8 +++ b/man/man8/puppet-report.8 @@ -4,7 +4,7 @@ .TH "PUPPET\-REPORT" "8" "September 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" -\fBpuppet\-report\fR +\fBpuppet\-report\fR \- Create, display, and submit reports\. . .SH "SYNOPSIS" puppet report \fIaction\fR [\-\-terminus _TERMINUS] [\-\-extra HASH] diff --git a/man/man8/puppet-resource.8 b/man/man8/puppet-resource.8 index 45a2b58c1be..ad1ee3716ce 100644 --- a/man/man8/puppet-resource.8 +++ b/man/man8/puppet-resource.8 @@ -4,7 +4,7 @@ .TH "PUPPET\-RESOURCE" "8" "September 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" -\fBpuppet\-resource\fR +\fBpuppet\-resource\fR \- The resource abstraction layer shell . .SH "SYNOPSIS" Uses the Puppet RAL to directly interact with the system\. diff --git a/man/man8/puppet-script.8 b/man/man8/puppet-script.8 index 8c044d14b3a..cda66166ac2 100644 --- a/man/man8/puppet-script.8 +++ b/man/man8/puppet-script.8 @@ -4,7 +4,7 @@ .TH "PUPPET\-SCRIPT" "8" "September 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" -\fBpuppet\-script\fR +\fBpuppet\-script\fR \- Run a puppet manifests as a script without compiling a catalog . .SH "SYNOPSIS" Runs a puppet language script without compiling a catalog\. diff --git a/man/man8/puppet-ssl.8 b/man/man8/puppet-ssl.8 index 98a376e78c3..4e8a7adbe3d 100644 --- a/man/man8/puppet-ssl.8 +++ b/man/man8/puppet-ssl.8 @@ -4,7 +4,7 @@ .TH "PUPPET\-SSL" "8" "September 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" -\fBpuppet\-ssl\fR +\fBpuppet\-ssl\fR \- Manage SSL keys and certificates for puppet SSL clients . .SH "SYNOPSIS" Manage SSL keys and certificates for SSL clients needing to communicate with a puppet infrastructure\. diff --git a/man/man8/puppet.8 b/man/man8/puppet.8 index 7295fcba5f2..35137d2f4a0 100644 --- a/man/man8/puppet.8 +++ b/man/man8/puppet.8 @@ -7,9 +7,6 @@ \fBpuppet\fR . .P -@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ search path is: ["/var/lib/jenkins/\.puppetlabs/opt/puppet/cache/lib/facter", "/var/lib/jenkins/\.puppetlabs/opt/puppet/cache/facts"] /tmp/jenkins/workspace/platform_puppet_vanagon\-component\-manpage\-generation_main_agent\-main/puppet/lib/puppet/defaults\.rb:1907:in \fBblock in initialize_default_settings!\' /tmp/jenkins/workspace/platform_puppet_vanagon\-component\-manpage\-generation_main_agent\-main/puppet/lib/puppet/settings\.rb:413:in\fRblock in call_hooks_deferred_to_application_initialization\' /tmp/jenkins/workspace/platform_puppet_vanagon\-component\-manpage\-generation_main_agent\-main/puppet/lib/puppet/settings\.rb:411:in \fBeach\' /tmp/jenkins/workspace/platform_puppet_vanagon\-component\-manpage\-generation_main_agent\-main/puppet/lib/puppet/settings\.rb:411:in\fRcall_hooks_deferred_to_application_initialization\' /tmp/jenkins/workspace/platform_puppet_vanagon\-component\-manpage\-generation_main_agent\-main/puppet/lib/puppet/settings\.rb:386:in \fBinitialize_app_defaults\' /tmp/jenkins/workspace/platform_puppet_vanagon\-component\-manpage\-generation_main_agent\-main/puppet/lib/puppet\.rb:180:in\fRdo_initialize_settings_for_run_mode\' /tmp/jenkins/workspace/platform_puppet_vanagon\-component\-manpage\-generation_main_agent\-main/puppet/lib/puppet\.rb:153:in \fBinitialize_settings\' /tmp/jenkins/workspace/platform_puppet_vanagon\-component\-manpage\-generation_main_agent\-main/puppet/lib/puppet/util/command_line\.rb:72:in\fRblock in execute\' /tmp/jenkins/workspace/platform_puppet_vanagon\-component\-manpage\-generation_main_agent\-main/puppet/lib/puppet/util\.rb:735:in \fBexit_on_fail\' /tmp/jenkins/workspace/platform_puppet_vanagon\-component\-manpage\-generation_main_agent\-main/puppet/lib/puppet/util/command_line\.rb:71:in\fRexecute\' bin/puppet:5:in \fB
\' @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ search path is: ["/var/lib/jenkins/\.puppetlabs/opt/puppet/cache/lib/facter", "/var/lib/jenkins/\.puppetlabs/opt/puppet/cache/facts"] /tmp/jenkins/workspace/platform_puppet_vanagon\-component\-manpage\-generation_main_agent\-main/puppet/lib/puppet/defaults\.rb:1907:in\fRblock in initialize_default_settings!\' /tmp/jenkins/workspace/platform_puppet_vanagon\-component\-manpage\-generation_main_agent\-main/puppet/lib/puppet/settings\.rb:413:in \fBblock in call_hooks_deferred_to_application_initialization\' /tmp/jenkins/workspace/platform_puppet_vanagon\-component\-manpage\-generation_main_agent\-main/puppet/lib/puppet/settings\.rb:411:in\fReach\' /tmp/jenkins/workspace/platform_puppet_vanagon\-component\-manpage\-generation_main_agent\-main/puppet/lib/puppet/settings\.rb:411:in \fBcall_hooks_deferred_to_application_initialization\' /tmp/jenkins/workspace/platform_puppet_vanagon\-component\-manpage\-generation_main_agent\-main/puppet/lib/puppet/settings\.rb:386:in\fRinitialize_app_defaults\' /tmp/jenkins/workspace/platform_puppet_vanagon\-component\-manpage\-generation_main_agent\-main/puppet/lib/puppet/application\.rb:337:in \fBinitialize_app_defaults\' /tmp/jenkins/workspace/platform_puppet_vanagon\-component\-manpage\-generation_main_agent\-main/puppet/lib/puppet/application\.rb:367:in\fRblock in run\' /tmp/jenkins/workspace/platform_puppet_vanagon\-component\-manpage\-generation_main_agent\-main/puppet/lib/puppet/util\.rb:735:in \fBexit_on_fail\' /tmp/jenkins/workspace/platform_puppet_vanagon\-component\-manpage\-generation_main_agent\-main/puppet/lib/puppet/application\.rb:366:in\fRrun\' /tmp/jenkins/workspace/platform_puppet_vanagon\-component\-manpage\-generation_main_agent\-main/puppet/lib/puppet/util/command_line\.rb:143:in \fBrun\' /tmp/jenkins/workspace/platform_puppet_vanagon\-component\-manpage\-generation_main_agent\-main/puppet/lib/puppet/util/command_line\.rb:77:in\fRexecute\' bin/puppet:5:in `\fImain\fR\' -. -.P Usage: puppet \fIsubcommand\fR [options] \fIaction\fR [options] . .P From 40f24fd9e6b5ab527a976b895c7f8a3675de6d63 Mon Sep 17 00:00:00 2001 From: Luchian Nemes Date: Tue, 8 Sep 2020 09:44:14 +0300 Subject: [PATCH 172/731] (maint) Avoid locale pluginsyncing when i18n is disabled Starting with Puppet 7, locales are not pluginsynced anymore when i18n is disabled. --- lib/puppet/configurer/plugin_handler.rb | 40 ++++---- spec/integration/application/plugin_spec.rb | 24 ++++- spec/unit/configurer/plugin_handler_spec.rb | 74 ++++++++++---- spec/unit/face/plugin_spec.rb | 102 ++++++++++++++------ 4 files changed, 175 insertions(+), 65 deletions(-) diff --git a/lib/puppet/configurer/plugin_handler.rb b/lib/puppet/configurer/plugin_handler.rb index d738f069aa2..f04cc02de6d 100644 --- a/lib/puppet/configurer/plugin_handler.rb +++ b/lib/puppet/configurer/plugin_handler.rb @@ -29,25 +29,27 @@ def download_plugins(environment) result += plugin_fact_downloader.evaluate result += plugin_downloader.evaluate - # until file metadata/content are using the rest client, we need to check - # both :server_agent_version and the session to see if the server supports - # the "locales" mount - server_agent_version = Puppet.lookup(:server_agent_version) { "0.0" } - locales = Gem::Version.new(server_agent_version) >= SUPPORTED_LOCALES_MOUNT_AGENT_VERSION - unless locales - session = Puppet.lookup(:http_session) - locales = session.supports?(:fileserver, 'locales') || session.supports?(:puppet, 'locales') - end - - if locales - locales_downloader = Puppet::Configurer::Downloader.new( - "locales", - Puppet[:localedest], - Puppet[:localesource], - Puppet[:pluginsignore] + " *.pot config.yaml", - environment - ) - result += locales_downloader.evaluate + unless Puppet[:disable_i18n] + # until file metadata/content are using the rest client, we need to check + # both :server_agent_version and the session to see if the server supports + # the "locales" mount + server_agent_version = Puppet.lookup(:server_agent_version) { "0.0" } + locales = Gem::Version.new(server_agent_version) >= SUPPORTED_LOCALES_MOUNT_AGENT_VERSION + unless locales + session = Puppet.lookup(:http_session) + locales = session.supports?(:fileserver, 'locales') || session.supports?(:puppet, 'locales') + end + + if locales + locales_downloader = Puppet::Configurer::Downloader.new( + "locales", + Puppet[:localedest], + Puppet[:localesource], + Puppet[:pluginsignore] + " *.pot config.yaml", + environment + ) + result += locales_downloader.evaluate + end end Puppet::Util::Autoload.reload_changed(Puppet.lookup(:current_environment)) diff --git a/spec/integration/application/plugin_spec.rb b/spec/integration/application/plugin_spec.rb index cd85ffd0293..bde70caf680 100644 --- a/spec/integration/application/plugin_spec.rb +++ b/spec/integration/application/plugin_spec.rb @@ -9,7 +9,8 @@ let(:plugin) { Puppet::Application[:plugin] } let(:response_body) { "[{\"path\":\"/etc/puppetlabs/code/environments/production/modules\",\"relative_path\":\".\",\"links\":\"follow\",\"owner\":0,\"group\":0,\"mode\":493,\"checksum\":{\"type\":\"ctime\",\"value\":\"{ctime}2020-03-06 20:14:25 UTC\"},\"type\":\"directory\",\"destination\":null}]" } - it "downloads from plugins, pluginsfacts and locales mounts" do + it "downloads from plugins, pluginsfacts and locales mounts when i18n is enabled" do + Puppet[:disable_i18n] = false current_version_handler = -> (req, res) { res['X-Puppet-Version'] = Puppet.version res['Content-Type'] = 'application/json' @@ -28,6 +29,27 @@ end end + it "downloads from plugins, pluginsfacts but no locales mounts when i18n is disabled" do + Puppet[:disable_i18n] = true + + current_version_handler = -> (req, res) { + res['X-Puppet-Version'] = Puppet.version + res['Content-Type'] = 'application/json' + res.body = response_body + } + + server.start_server(mounts: {file_metadatas: current_version_handler}) do |port| + Puppet[:masterport] = port + expect { + plugin.command_line.args << 'download' + plugin.run + }.to exit_with(0) + .and output(matching( + "Downloaded these plugins: #{Regexp.escape(Puppet[:pluginfactdest])}, #{Regexp.escape(Puppet[:plugindest])}" + )).to_stdout + end + end + it "downloads from plugins and pluginsfacts from older puppetservers" do no_locales_handler = -> (req, res) { res['X-Puppet-Version'] = '5.3.3' # locales mount was added in 5.3.4 diff --git a/spec/unit/configurer/plugin_handler_spec.rb b/spec/unit/configurer/plugin_handler_spec.rb index 0e461850d03..2bcdc52d7fa 100644 --- a/spec/unit/configurer/plugin_handler_spec.rb +++ b/spec/unit/configurer/plugin_handler_spec.rb @@ -19,30 +19,68 @@ end end - it "downloads plugins, facts, and locales" do - times_called = 0 - allow_any_instance_of(Puppet::Configurer::Downloader).to receive(:evaluate) { times_called += 1 }.and_return([]) + context "when i18n is enabled" do + before :each do + Puppet[:disable_i18n] = false + end - pluginhandler.download_plugins(environment) - expect(times_called).to eq(3) - end + it "downloads plugins, facts, and locales" do + times_called = 0 + allow_any_instance_of(Puppet::Configurer::Downloader).to receive(:evaluate) { times_called += 1 }.and_return([]) - it "returns downloaded plugin, fact, and locale filenames" do - times_called = 0 - allow_any_instance_of(Puppet::Configurer::Downloader).to receive(:evaluate) do - times_called += 1 + pluginhandler.download_plugins(environment) + expect(times_called).to eq(3) + end - if times_called == 1 - %w[/a] - elsif times_called == 2 - %w[/b] - else - %w[/c] + it "returns downloaded plugin, fact, and locale filenames" do + times_called = 0 + allow_any_instance_of(Puppet::Configurer::Downloader).to receive(:evaluate) do + times_called += 1 + + if times_called == 1 + %w[/a] + elsif times_called == 2 + %w[/b] + else + %w[/c] + end end + + expect(pluginhandler.download_plugins(environment)).to match_array(%w[/a /b /c]) + expect(times_called).to eq(3) + end + end + + context "when i18n is disabled" do + before :each do + Puppet[:disable_i18n] = true + end + + it "downloads plugins, facts, but no locales" do + times_called = 0 + allow_any_instance_of(Puppet::Configurer::Downloader).to receive(:evaluate) { times_called += 1 }.and_return([]) + + pluginhandler.download_plugins(environment) + expect(times_called).to eq(2) end - expect(pluginhandler.download_plugins(environment)).to match_array(%w[/a /b /c]) - expect(times_called).to eq(3) + it "returns downloaded plugin, fact, and locale filenames" do + times_called = 0 + allow_any_instance_of(Puppet::Configurer::Downloader).to receive(:evaluate) do + times_called += 1 + + if times_called == 1 + %w[/a] + elsif times_called == 2 + %w[/b] + else + %w[/c] + end + end + + expect(pluginhandler.download_plugins(environment)).to match_array(%w[/a /b]) + expect(times_called).to eq(2) + end end end diff --git a/spec/unit/face/plugin_spec.rb b/spec/unit/face/plugin_spec.rb index 3eb8adf559d..0fd365db74f 100644 --- a/spec/unit/face/plugin_spec.rb +++ b/spec/unit/face/plugin_spec.rb @@ -16,40 +16,88 @@ def render(result) end end - it "downloads plugins, external facts, and locales" do - receive_count = 0 - allow_any_instance_of(Puppet::Configurer::Downloader).to receive(:evaluate) { receive_count += 1 }.and_return([]) + context "when i18n is enabled" do + before(:each) do + Puppet[:disable_i18n] = false + end - pluginface.download - expect(receive_count).to eq(3) - end + it "downloads plugins, external facts, and locales" do + receive_count = 0 + allow_any_instance_of(Puppet::Configurer::Downloader).to receive(:evaluate) { receive_count += 1 }.and_return([]) - it "renders 'No plugins downloaded' if nothing was downloaded" do - receive_count = 0 - allow_any_instance_of(Puppet::Configurer::Downloader).to receive(:evaluate) { receive_count += 1 }.and_return([]) + pluginface.download + expect(receive_count).to eq(3) + end - result = pluginface.download - expect(receive_count).to eq(3) - expect(render(result)).to eq('No plugins downloaded.') - end + it "renders 'No plugins downloaded' if nothing was downloaded" do + receive_count = 0 + allow_any_instance_of(Puppet::Configurer::Downloader).to receive(:evaluate) { receive_count += 1 }.and_return([]) - it "renders comma separate list of downloaded file names" do - receive_count = 0 - allow_any_instance_of(Puppet::Configurer::Downloader).to receive(:evaluate) do - receive_count += 1 - case receive_count - when 1 - %w[/a] - when 2 - %w[/b] - when 3 - %w[/c] + result = pluginface.download + expect(receive_count).to eq(3) + expect(render(result)).to eq('No plugins downloaded.') + end + + it "renders comma separate list of downloaded file names" do + receive_count = 0 + allow_any_instance_of(Puppet::Configurer::Downloader).to receive(:evaluate) do + receive_count += 1 + case receive_count + when 1 + %w[/a] + when 2 + %w[/b] + when 3 + %w[/c] + end end + + result = pluginface.download + expect(receive_count).to eq(3) + expect(render(result)).to eq('Downloaded these plugins: /a, /b, /c') end + end - result = pluginface.download - expect(receive_count).to eq(3) - expect(render(result)).to eq('Downloaded these plugins: /a, /b, /c') + context "when i18n is enabled" do + before(:each) do + Puppet[:disable_i18n] = true + end + + it "downloads only plugins and external facts, no locales" do + receive_count = 0 + allow_any_instance_of(Puppet::Configurer::Downloader).to receive(:evaluate) { receive_count += 1 }.and_return([]) + + pluginface.download + expect(receive_count).to eq(2) + end + + it "renders 'No plugins downloaded' if nothing was downloaded, without checking for locales" do + receive_count = 0 + allow_any_instance_of(Puppet::Configurer::Downloader).to receive(:evaluate) { receive_count += 1 }.and_return([]) + + result = pluginface.download + expect(receive_count).to eq(2) + expect(render(result)).to eq('No plugins downloaded.') + end + + it "renders comma separate list of downloaded file names" do + receive_count = 0 + allow_any_instance_of(Puppet::Configurer::Downloader).to receive(:evaluate) do + receive_count += 1 + case receive_count + when 1 + %w[/a] + when 2 + %w[/b] + when 3 + %w[/c] + end + end + + result = pluginface.download + expect(receive_count).to eq(2) + expect(render(result)).to eq('Downloaded these plugins: /a, /b') + end end end From 201ae5b4c189393678b2c826d02416ea90cdcf2f Mon Sep 17 00:00:00 2001 From: Luchian Nemes Date: Fri, 18 Sep 2020 10:28:47 +0300 Subject: [PATCH 173/731] (maint) Clean up i18n acceptance tests This commit adds, cleans up, aligns with changes and removes obsolete i18n acceptance tests. --- .../tests/i18n/check_puppet_run_message.rb | 30 ------- .../tests/i18n/enable_option_disable_i18n.rb | 78 +++++++++++++++---- acceptance/tests/i18n/modules/puppet_agent.rb | 62 +++++++-------- .../modules/puppet_agent_cached_catalog.rb | 37 +++++---- ...puppet_agent_with_multiple_environments.rb | 10 ++- acceptance/tests/i18n/modules/puppet_apply.rb | 20 ++--- .../i18n/modules/puppet_apply_module_lang.rb | 8 +- .../tests/i18n/modules/puppet_describe.rb | 6 +- acceptance/tests/i18n/modules/puppet_face.rb | 2 +- acceptance/tests/i18n/modules/puppet_facts.rb | 46 ----------- .../tests/i18n/modules/puppet_resource.rb | 2 +- 11 files changed, 142 insertions(+), 159 deletions(-) delete mode 100644 acceptance/tests/i18n/check_puppet_run_message.rb delete mode 100644 acceptance/tests/i18n/modules/puppet_facts.rb diff --git a/acceptance/tests/i18n/check_puppet_run_message.rb b/acceptance/tests/i18n/check_puppet_run_message.rb deleted file mode 100644 index 75e5954fad7..00000000000 --- a/acceptance/tests/i18n/check_puppet_run_message.rb +++ /dev/null @@ -1,30 +0,0 @@ -test_name 'C100559: puppet agent run output with a supported language should be localized' do - confine :except, :platform => /^solaris/ # translation not supported - confine :except, :platform => /^aix/ # QENG-5283 needed for this to work - - skip_test "Localization files are unavailable" - - tag 'audit:medium', - 'audit:acceptance' - - require 'puppet/acceptance/i18n_utils' - extend Puppet::Acceptance::I18nUtils - - agents.each do |agent| - language = 'ja_JP' - - step("ensure #{language} locale is configured") do - language = enable_locale_language(agent, language) - skip_test("test machine is missing #{language} locale. Skipping") if language.nil? - end - - step "Run Puppet apply with language #{language} and check the output" do - on(agent, puppet("agent -t", 'ENV' => {'LANGUAGE' => language})) do |apply_result| - # Info: Applying configuration version '1505773208' - assert_match(/設定バージョン'[^']*'を適用しています。/, apply_result.stdout, "agent run does not contain 'Applying configuration version' translation") - # Notice: Applied catalog in 0.03 seconds - assert_match(/[0-9.]*\s*秒でカタログを適用しました。/, apply_result.stdout, "agent run does not contain 'Applied catalog in #.## seconds' translation") - end - end - end -end diff --git a/acceptance/tests/i18n/enable_option_disable_i18n.rb b/acceptance/tests/i18n/enable_option_disable_i18n.rb index c9cb152068f..67111477410 100644 --- a/acceptance/tests/i18n/enable_option_disable_i18n.rb +++ b/acceptance/tests/i18n/enable_option_disable_i18n.rb @@ -1,28 +1,78 @@ -test_name 'C100561: verify that disable_i18n can be set to true and have translations disabled' do +test_name 'Verify that disable_i18n can be set to true and have translations disabled' do confine :except, :platform => /^solaris/ # translation not supported - confine :except, :platform => /^aix/ # QENG-5283 needed for this to work - tag 'risk:medium', + tag 'audit:high', 'audit:acceptance' + require 'puppet/acceptance/environment_utils.rb' + extend Puppet::Acceptance::EnvironmentUtils + require 'puppet/acceptance/i18n_utils' extend Puppet::Acceptance::I18nUtils + require 'puppet/acceptance/i18ndemo_utils' + extend Puppet::Acceptance::I18nDemoUtils + language = 'ja_JP' - with_puppet_running_on master, 'master' => { 'disable_i18n' => true } do - agents.each do |agent| - step("ensure #{language} locale is configured") do - language = enable_locale_language(agent, language) - # fall back to ja_JP since we're expecting english fallback for this test anyways - language = 'ja_JP' if language.nil? + step "configure server locale to #{language}" do + configure_master_system_locale(language) + end + + tmp_environment = mk_tmp_environment_with_teardown(master, File.basename(__FILE__, '.*')) + + step 'install a i18ndemo module' do + install_i18n_demo_module(master, tmp_environment) + end + + teardown do + step 'resetting the server locale' do + reset_master_system_locale + end + step 'uninstall the module' do + agents.each do |agent| + uninstall_i18n_demo_module(agent) + end + uninstall_i18n_demo_module(master) + end + end + + agents.each do |agent| + agent_language = enable_locale_language(agent, language) + skip_test("test machine is missing #{agent_language} locale. Skipping") if agent_language.nil? + shell_env_language = { 'LANGUAGE' => agent_language, 'LANG' => agent_language } + + step 'enable i18n' do + on(master, puppet("config set disable_i18n false")) + on(agent, puppet("config set disable_i18n false")) + end + + step 'expect #{language} translation for a custom type' do + site_pp_content = <<-PP + node default { + i18ndemo_type { '12345': } + } + PP + create_sitepp(master, tmp_environment, site_pp_content) + on(agent, puppet("agent -t --environment #{tmp_environment}", 'ENV' => shell_env_language), :acceptable_exit_codes => 1) do |result| + assert_match(/Error: .* \w+-i18ndemo type: 値は有12345効な値ではありません/, result.stderr, 'missing error from invalid value for custom type param') end + end + + step 'disable i18n' do + on(master, puppet("config set disable_i18n true")) + on(agent, puppet("config set disable_i18n true")) + end - step "Run Puppet agent with language #{language} and check the output" do - on(agent, puppet("agent -t --disable_i18n", 'ENV' => {'LANGUAGE' => language})) do |agent_result| - assert_match(/Applying configuration version '[^']*'/, agent_result.stdout, "agent run does not contain english 'Applying configuration version'") - assert_match(/Applied catalog in\s+[0-9.]*\s+seconds/, agent_result.stdout, "agent run does not contain english 'Applied catalog in' ") - end + step 'expect no #{language} translation for a custom type' do + site_pp_content = <<-PP + node default { + i18ndemo_type { '12345': } + } + PP + create_sitepp(master, tmp_environment, site_pp_content) + on(agent, puppet("agent -t --environment #{tmp_environment}", 'ENV' => shell_env_language), :acceptable_exit_codes => 1) do |result| + assert_match(/Error: .* Value 12345 is not a valid value for i18ndemo_type\:\:name/, result.stderr) end end end diff --git a/acceptance/tests/i18n/modules/puppet_agent.rb b/acceptance/tests/i18n/modules/puppet_agent.rb index 6d5e378475c..c55795d3fc3 100644 --- a/acceptance/tests/i18n/modules/puppet_agent.rb +++ b/acceptance/tests/i18n/modules/puppet_agent.rb @@ -1,7 +1,7 @@ test_name 'C100565: puppet agent with module should translate messages' do confine :except, :platform => /^solaris/ # translation not supported - tag 'audit:medium', + tag 'audit:high', 'audit:acceptance' require 'puppet/acceptance/environment_utils.rb' @@ -18,11 +18,14 @@ configure_master_system_locale(language) end - app_type = File.basename(__FILE__, '.*') - tmp_environment_1 = mk_tmp_environment_with_teardown(master, app_type) + step 'enable i18n on master' do + on(master, puppet("config set disable_i18n false")) + end + + tmp_environment = mk_tmp_environment_with_teardown(master, File.basename(__FILE__, '.*')) step 'install a i18ndemo module' do - install_i18n_demo_module(master, tmp_environment_1) + install_i18n_demo_module(master, tmp_environment) end teardown do @@ -46,7 +49,11 @@ type_path = agent.tmpdir('provider') teardown do - on(agent, "rm -rf '#{type_path}'") + agent.rm_rf(type_path) + end + + step 'enable i18n' do + on(agent, puppet("config set disable_i18n false")) end step "Run puppet agent of a module with language #{agent_language} and verify the translations" do @@ -59,51 +66,38 @@ class { 'i18ndemo': } } PP - create_sitepp(master, tmp_environment_1, site_pp_content_1) - on(agent, puppet("agent -t --environment #{tmp_environment_1}", 'ENV' => shell_env_language), :acceptable_exit_codes => [0, 2]) do |result| + + create_sitepp(master, tmp_environment, site_pp_content_1) + on(agent, puppet("agent -t --no-disable_i18n --environment #{tmp_environment}", 'ENV' => shell_env_language), :acceptable_exit_codes => [0, 2]) do |result| assert_match(/.*\w+-i18ndemo fact: これは\w+-i18ndemoからのカスタムファクトからのレイズです/, result.stderr, 'missing translation for raise from ruby fact') end - end - - step 'verify translations from init.pp' do - # TODO This test needs to be updated with the proper translation and re-enabled when translations for the affected strings are updated. - # site_pp_content_3 = <<-PP - # node default { - # class { 'i18ndemo': param1 => false } - # } - # PP - # create_sitepp(master, tmp_environment_1, site_pp_content_3) - # on(agent, puppet("agent -t --environment #{tmp_environment_1}", 'ENV' => { 'LANGUAGE' => '', 'LANG' => language }), :acceptable_exit_codes => 1) do |result| - # assert_match(/Error: リモートサーバからカタログを取得できませんでした: SERVERのエラー500 : サーバエラー: Evaluation/, result.stderr, 'missing translation for Server Error') - # assert_match(/Error:.*の検証中にエラーが生じました。.*ファイルの作成に失敗しました/, result.stderr, 'missing translation for fail from init.pp') - # end - end + end unless agent['platform'] =~ /ubuntu-16.04/ # Condition to be removed after FACT-2799 gets resolved step 'verify custom type translations' do - site_pp_content_4 = <<-PP + site_pp_content_2 = <<-PP node default { i18ndemo_type { 'hello': } } PP - create_sitepp(master, tmp_environment_1, site_pp_content_4) - on(agent, puppet("agent -t --environment #{tmp_environment_1}", 'ENV' => shell_env_language), :acceptable_exit_codes => 1) do |result| + create_sitepp(master, tmp_environment, site_pp_content_2) + on(agent, puppet("agent -t --environment #{tmp_environment}", 'ENV' => shell_env_language), :acceptable_exit_codes => 1) do |result| assert_match(/Warning:.*\w+-i18ndemo type: 良い値/, result.stderr, 'missing warning from custom type') end - site_pp_content_5 = <<-PP + site_pp_content_3 = <<-PP node default { i18ndemo_type { '12345': } } PP - create_sitepp(master, tmp_environment_1, site_pp_content_5) - on(agent, puppet("agent -t --environment #{tmp_environment_1}", 'ENV' => shell_env_language), :acceptable_exit_codes => 1) do |result| + create_sitepp(master, tmp_environment, site_pp_content_3) + on(agent, puppet("agent -t --environment #{tmp_environment}", 'ENV' => shell_env_language), :acceptable_exit_codes => 1) do |result| assert_match(/Error: .* \w+-i18ndemo type: 値は有12345効な値ではありません/, result.stderr, 'missing error from invalid value for custom type param') end end step 'verify custom provider translation' do - site_pp_content_6 = <<-PP + site_pp_content_4 = <<-PP node default { i18ndemo_type { 'hello': ensure => present, @@ -111,22 +105,22 @@ class { 'i18ndemo': } } PP - create_sitepp(master, tmp_environment_1, site_pp_content_6) - on(agent, puppet("agent -t --environment #{tmp_environment_1}", 'ENV' => shell_env_language)) do |result| + create_sitepp(master, tmp_environment, site_pp_content_4) + on(agent, puppet("agent -t --environment #{tmp_environment}", 'ENV' => shell_env_language)) do |result| assert_match(/Warning:.*\w+-i18ndemo provider: i18ndemo_typeは存在しますか/, result.stderr, 'missing translated provider message') end end step 'verify function string translation' do - site_pp_content_7 = <<-PP + site_pp_content_5 = <<-PP node default { notify { 'happy': message => happyfuntime('happy') } } PP - create_sitepp(master, tmp_environment_1, site_pp_content_7) - on(agent, puppet("agent -t --environment #{tmp_environment_1}", 'ENV' => shell_env_language), :acceptable_exit_codes => 2) do |result| + create_sitepp(master, tmp_environment, site_pp_content_5) + on(agent, puppet("agent -t --environment #{tmp_environment}", 'ENV' => shell_env_language), :acceptable_exit_codes => 2) do |result| assert_match(/Notice: --\*\w+-i18ndemo function: それは楽しい時間です\*--/, result.stdout, 'missing translated notice message') end end diff --git a/acceptance/tests/i18n/modules/puppet_agent_cached_catalog.rb b/acceptance/tests/i18n/modules/puppet_agent_cached_catalog.rb index 1ed637c483d..bb8f2949890 100644 --- a/acceptance/tests/i18n/modules/puppet_agent_cached_catalog.rb +++ b/acceptance/tests/i18n/modules/puppet_agent_cached_catalog.rb @@ -1,7 +1,7 @@ test_name 'C100566: puppet agent with module should translate messages when using a cached catalog' do confine :except, :platform => /^solaris/ # translation not supported - tag 'audit:medium', + tag 'audit:high', 'audit:acceptance' require 'puppet/acceptance/environment_utils.rb' @@ -18,11 +18,14 @@ configure_master_system_locale(language) end - app_type = File.basename(__FILE__, '.*') - tmp_environment_1 = mk_tmp_environment_with_teardown(master, app_type) + step 'enable i18n on master' do + on(master, puppet("config set disable_i18n false")) + end + + tmp_environment = mk_tmp_environment_with_teardown(master, File.basename(__FILE__, '.*')) step 'install a i18ndemo module' do - install_i18n_demo_module(master, tmp_environment_1) + install_i18n_demo_module(master, tmp_environment) end teardown do @@ -49,6 +52,10 @@ on(agent, "rm -rf '#{type_path}'") end + step 'enable i18n' do + on(agent, puppet("config set disable_i18n false")) + end + unresolved_server = 'puppet.unresolved.host.example.com' step "Run puppet apply of a module with language #{agent_language} and verify the translations using the cached catalog" do @@ -60,17 +67,17 @@ class { 'i18ndemo': } } PP - create_sitepp(master, tmp_environment_1, site_pp_content_1) - on(agent, puppet("agent -t --environment #{tmp_environment_1}", 'ENV' => shell_env_language), :acceptable_exit_codes => [0, 2]) do |result| + create_sitepp(master, tmp_environment, site_pp_content_1) + on(agent, puppet("agent -t --environment #{tmp_environment}", 'ENV' => shell_env_language), :acceptable_exit_codes => [0, 2]) do |result| assert_match(/.*\w+-i18ndemo fact: これは\w+-i18ndemoからのカスタムファクトからのレイズです/, result.stderr, 'missing translation for raise from ruby fact') end - on(agent, puppet("agent -t --environment #{tmp_environment_1} --use_cached_catalog", 'ENV' => shell_env_language), :acceptable_exit_codes => [0, 2]) do |result| + on(agent, puppet("agent -t --environment #{tmp_environment} --use_cached_catalog", 'ENV' => shell_env_language), :acceptable_exit_codes => [0, 2]) do |result| assert_match(/.*\w+-i18ndemo fact: これは\w+-i18ndemoからのカスタムファクトからのレイズです/, result.stderr, 'missing translation for raise from ruby fact when using cached catalog') end end step 'verify custom provider translation' do - site_pp_content_6 = <<-PP + site_pp_content_2 = <<-PP node default { i18ndemo_type { 'hello': ensure => present, @@ -78,28 +85,28 @@ class { 'i18ndemo': } } PP - create_sitepp(master, tmp_environment_1, site_pp_content_6) - on(agent, puppet("agent -t --environment #{tmp_environment_1}", 'ENV' => shell_env_language), :acceptable_exit_codes => [0, 2]) do |result| + create_sitepp(master, tmp_environment, site_pp_content_2) + on(agent, puppet("agent -t --environment #{tmp_environment}", 'ENV' => shell_env_language), :acceptable_exit_codes => [0, 2]) do |result| assert_match(/Warning:.*\w+-i18ndemo provider: i18ndemo_typeは存在しますか/, result.stderr, 'missing translated provider message') end - on(agent, puppet("agent -t --server #{unresolved_server} --environment #{tmp_environment_1} --use_cached_catalog", 'ENV' => shell_env_language), :acceptable_exit_codes => [0, 2]) do |result| + on(agent, puppet("agent -t --server #{unresolved_server} --environment #{tmp_environment} --use_cached_catalog", 'ENV' => shell_env_language), :acceptable_exit_codes => [0, 2]) do |result| assert_match(/Warning:.*\w+-i18ndemo provider: i18ndemo_typeは存在しますか/, result.stderr, 'missing translated provider message when using cached catalog') end end step 'verify function string translation' do - site_pp_content_7 = <<-PP + site_pp_content_3 = <<-PP node default { notify { 'happy': message => happyfuntime('happy') } } PP - create_sitepp(master, tmp_environment_1, site_pp_content_7) - on(agent, puppet("agent -t --environment #{tmp_environment_1}", 'ENV' => shell_env_language), :acceptable_exit_codes => [0, 2]) do |result| + create_sitepp(master, tmp_environment, site_pp_content_3) + on(agent, puppet("agent -t --environment #{tmp_environment}", 'ENV' => shell_env_language), :acceptable_exit_codes => [0, 2]) do |result| assert_match(/Notice: --\*\w+-i18ndemo function: それは楽しい時間です\*--/, result.stdout, 'missing translated notice message') end - on(agent, puppet("agent -t --server #{unresolved_server} --environment #{tmp_environment_1} --use_cached_catalog", 'ENV' => shell_env_language), :acceptable_exit_codes => [0, 2]) do |result| + on(agent, puppet("agent -t --server #{unresolved_server} --environment #{tmp_environment} --use_cached_catalog", 'ENV' => shell_env_language), :acceptable_exit_codes => [0, 2]) do |result| assert_match(/Notice: --\*\w+-i18ndemo function: それは楽しい時間です\*--/, result.stdout, 'missing translated notice message when using cached catalog') end end diff --git a/acceptance/tests/i18n/modules/puppet_agent_with_multiple_environments.rb b/acceptance/tests/i18n/modules/puppet_agent_with_multiple_environments.rb index 1319d6ad338..3f3f6b59697 100644 --- a/acceptance/tests/i18n/modules/puppet_agent_with_multiple_environments.rb +++ b/acceptance/tests/i18n/modules/puppet_agent_with_multiple_environments.rb @@ -1,7 +1,7 @@ test_name 'C100575: puppet agent with different modules in different environments should translate based on their module' do confine :except, :platform => /^solaris/ # translation not supported - tag 'audit:medium', + tag 'audit:high', 'audit:acceptance' require 'puppet/acceptance/environment_utils.rb' @@ -23,6 +23,10 @@ full_path_env_2 = File.join('/tmp', tmp_environment_2) tmp_po_file = master.tmpfile('tmp_po_file') + step 'enable i18n on master' do + on(master, puppet("config set disable_i18n false")) + end + step 'install a i18ndemo module' do install_i18n_demo_module(master, tmp_environment_1) install_i18n_demo_module(master, tmp_environment_2) @@ -52,6 +56,10 @@ skip_test("test machine is missing #{agent_language} locale. Skipping") if agent_language.nil? shell_env_language = { 'LANGUAGE' => agent_language, 'LANG' => agent_language } + step 'enable i18n' do + on(agent, puppet("config set disable_i18n false")) + end + env_1_po_file = File.join(full_path_env_1, 'modules', I18NDEMO_NAME, 'locales', 'ja', "#{I18NDEMO_MODULE_NAME}.po") on(master, "sed -e 's/\\(msgstr \"\\)\\([^\"]\\)/\\1'\"ENV_1\"':\\2/' #{env_1_po_file} > #{tmp_po_file} && mv #{tmp_po_file} #{env_1_po_file}") env_2_po_file = File.join(full_path_env_2, 'modules', I18NDEMO_NAME, 'locales', 'ja', "#{I18NDEMO_MODULE_NAME}.po") diff --git a/acceptance/tests/i18n/modules/puppet_apply.rb b/acceptance/tests/i18n/modules/puppet_apply.rb index b9b097060d9..a4aba10b430 100644 --- a/acceptance/tests/i18n/modules/puppet_apply.rb +++ b/acceptance/tests/i18n/modules/puppet_apply.rb @@ -1,9 +1,7 @@ test_name 'C100567: puppet apply of module should translate messages' do confine :except, :platform => /^solaris/ # translation not supported - skip_test "Localizations are unavailable" - - tag 'audit:medium', + tag 'audit:high', 'audit:acceptance' require 'puppet/acceptance/temp_file_utils' @@ -37,6 +35,10 @@ install_i18n_demo_module(agent) end + step 'enable i18n' do + on(agent, puppet("config set disable_i18n false")) + end + teardown do uninstall_i18n_demo_module(agent) on(agent, "rm -rf '#{type_path}'") @@ -47,17 +49,7 @@ on(agent, puppet("apply -e \"class { 'i18ndemo': filename => '#{type_path}' }\"", 'ENV' => shell_env_language)) do |apply_result| assert_match(/.*\w+-i18ndemo fact: これは\w+-i18ndemoからのカスタムファクトからのレイズです/, apply_result.stderr, 'missing translation for raise from ruby fact') end - end - - step 'verify translations from init.pp' do - on(agent, puppet("apply -e \"class { 'i18ndemo': filename => '#{type_path}' }\"", 'ENV' => shell_env_language)) do |apply_result| - assert_match(/Warning:.*\w+-i18ndemo init.pp: ファイルの作成/, apply_result.stderr, 'missing warning translation from init.pp') - end - - on(agent, puppet("apply -e \"class { 'i18ndemo': param1 => false }\"", 'ENV' => shell_env_language), :acceptable_exit_codes => 1) do |apply_result| - assert_match(/Error:.*の検証中にエラーが生じました。.*ファイルの作成に失敗しました/, apply_result.stderr, 'missing translation for fail from init.pp') - end - end + end unless agent['platform'] =~ /ubuntu-16.04/ # Condition to be removed after FACT-2799 gets resolved step 'verify custom translations' do on(agent, puppet("apply -e \"i18ndemo_type { 'hello': }\"", 'ENV' => shell_env_language), :acceptable_exit_codes => 1) do |apply_result| diff --git a/acceptance/tests/i18n/modules/puppet_apply_module_lang.rb b/acceptance/tests/i18n/modules/puppet_apply_module_lang.rb index a4950e89dfe..59d242661ee 100644 --- a/acceptance/tests/i18n/modules/puppet_apply_module_lang.rb +++ b/acceptance/tests/i18n/modules/puppet_apply_module_lang.rb @@ -2,7 +2,7 @@ confine :except, :platform => /^windows/ # Can't print Finish on an English or Japanese code page - tag 'audit:medium', + tag 'audit:high', 'audit:acceptance' require 'puppet/acceptance/temp_file_utils' @@ -34,6 +34,10 @@ end type_path = agent.tmpdir('provider') + step 'enable i18n' do + on(agent, puppet("config set disable_i18n false")) + end + teardown do uninstall_i18n_demo_module(agent) on(agent, "rm -rf '#{type_path}'") @@ -46,7 +50,7 @@ apply_result.stderr, 'missing translated message for raise from ruby fact') assert_match(/Notice: Applied catalog in [0-9.]+ seconds/, apply_result.stdout, 'missing untranslated message for catalog applied') end - end + end unless agent['platform'] =~ /ubuntu-16.04/ # Condition to be removed after FACT-2799 gets resolved step 'verify warning translated from init.pp' do on(agent, puppet("apply -e \"class { 'i18ndemo': filename => '#{type_path}' }\"", 'ENV' => shell_env_language)) do |apply_result| diff --git a/acceptance/tests/i18n/modules/puppet_describe.rb b/acceptance/tests/i18n/modules/puppet_describe.rb index 8d0cbb13e87..2fa7fae64b3 100644 --- a/acceptance/tests/i18n/modules/puppet_describe.rb +++ b/acceptance/tests/i18n/modules/puppet_describe.rb @@ -1,7 +1,7 @@ test_name 'C100576: puppet describe with module type translates message' do confine :except, :platform => /^solaris/ # translation not supported - tag 'audit:medium', + tag 'audit:high', 'audit:acceptance' require 'puppet/acceptance/i18n_utils' @@ -27,6 +27,10 @@ skip_test("test machine is missing #{agent_language} locale. Skipping") if agent_language.nil? shell_env_language = { 'LANGUAGE' => agent_language, 'LANG' => agent_language } + step 'enable i18n' do + on(agent, puppet("config set disable_i18n false")) + end + step 'install a i18ndemo module' do install_i18n_demo_module(agent) end diff --git a/acceptance/tests/i18n/modules/puppet_face.rb b/acceptance/tests/i18n/modules/puppet_face.rb index 5259065a5e6..934f58fcca2 100644 --- a/acceptance/tests/i18n/modules/puppet_face.rb +++ b/acceptance/tests/i18n/modules/puppet_face.rb @@ -1,7 +1,7 @@ test_name 'C100573: puppet application/face with module translates messages' do confine :except, :platform => /^solaris/ # translation not supported - tag 'audit:medium', + tag 'audit:high', 'audit:acceptance' require 'puppet/acceptance/i18n_utils' diff --git a/acceptance/tests/i18n/modules/puppet_facts.rb b/acceptance/tests/i18n/modules/puppet_facts.rb deleted file mode 100644 index 889543ee513..00000000000 --- a/acceptance/tests/i18n/modules/puppet_facts.rb +++ /dev/null @@ -1,46 +0,0 @@ -test_name 'C100564: puppet facts translates the fact error message' do - confine :except, :platform => /^solaris/ # translation not supported - - tag 'audit:medium', - 'audit:acceptance' - - require 'puppet/acceptance/i18n_utils' - extend Puppet::Acceptance::I18nUtils - - require 'puppet/acceptance/i18ndemo_utils' - extend Puppet::Acceptance::I18nDemoUtils - - language = 'ja_JP' - - agents.each do |agent| - skip_test('on windows this test only works on a machine with a japanese code page set') if agent['platform'] =~ /windows/ && agent['locale'] != 'ja' - - # REMIND - It was noted that skipping tests on certain platforms sometimes causes - # beaker to mark the test as a failed even if the test succeeds on other targets. - # Hence we just print a message and skip w/o telling beaker about it. - if on(agent, facter("fips_enabled")).stdout =~ /true/ - puts "Module build, loading and installing is not supported on fips enabled platforms" - next - end - - agent_language = enable_locale_language(agent, language) - skip_test("test machine is missing #{agent_language} locale. Skipping") if agent_language.nil? - shell_env_language = { 'LANGUAGE' => agent_language, 'LANG' => agent_language } - - type_path = agent.tmpdir('provider') - step 'install a i18ndemo module' do - install_i18n_demo_module(agent) - end - - teardown do - uninstall_i18n_demo_module(agent) - on(agent, "rm -rf '#{type_path}'") - end - - step "Run puppet fact with a module and language #{agent_language} and verify the translations" do - on(agent, puppet("facts", 'ENV' => shell_env_language)) do |result| - assert_match(/.*\w+-i18ndemo fact: これは\w+-i18ndemoからのカスタムファクトからのレイズです/, result.stderr, 'missing translation for raise from ruby fact') - end - end - end -end diff --git a/acceptance/tests/i18n/modules/puppet_resource.rb b/acceptance/tests/i18n/modules/puppet_resource.rb index c6ffc02d937..ac98c90ce35 100644 --- a/acceptance/tests/i18n/modules/puppet_resource.rb +++ b/acceptance/tests/i18n/modules/puppet_resource.rb @@ -1,7 +1,7 @@ test_name 'C100572: puppet resource with module translates messages' do confine :except, :platform => /^solaris/ # translation not supported - tag 'audit:medium', + tag 'audit:high', 'audit:acceptance' require 'puppet/acceptance/i18n_utils' From 068d1cebfc207b3c9e74b03ca1a87926fd741c9c Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Mon, 21 Sep 2020 14:22:52 +0000 Subject: [PATCH 174/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index 0e160326063..db413a2a51f 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -508,7 +508,7 @@ Which digest algorithm to use for file resources and the filebucket\. Valid valu If true, turns off all translations of Puppet and module log messages, which affects error, warning, and info log messages, as well as any translations in the report and CLI\. . .IP "\(bu" 4 -\fIDefault\fR: false +\fIDefault\fR: true . .IP "" 0 . From 305af58a96cd8b248075c1b9967c9692489bb588 Mon Sep 17 00:00:00 2001 From: clairecadman Date: Mon, 28 Sep 2020 10:35:11 +0100 Subject: [PATCH 175/731] (DOCS) Clarify values in server_list --- lib/puppet/defaults.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb index 8a064b2cd4f..3e5c0aaebce 100644 --- a/lib/puppet/defaults.rb +++ b/lib/puppet/defaults.rb @@ -1545,8 +1545,8 @@ def self.initialize_default_settings!(settings) :server_list => { :default => [], :type => :server_list, - :desc => "The list of puppet master servers to which the puppet agent should connect, - in the order that they will be tried.", + :desc => "The list of Puppet master servers to which the Puppet agent should connect, + 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.", }, :use_srv_records => { :default => false, From f638777d6ece022dac8f8c2f6313870d494fc4aa Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Mon, 28 Sep 2020 21:37:31 +0000 Subject: [PATCH 176/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index db413a2a51f..4667611d008 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -1666,7 +1666,7 @@ The directory in which serialized data is stored, usually in a subdirectory\. .IP "" 0 . .SS "server_list" -The list of puppet master servers to which the puppet agent should connect, in the order that they will be tried\. +The list of Puppet master servers to which the Puppet agent should connect, 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\. . .IP "\(bu" 4 \fIDefault\fR: [] From 8f2c65a98894862ce0e80b38104b30761a26c822 Mon Sep 17 00:00:00 2001 From: Ciprian Badescu Date: Tue, 29 Sep 2020 15:01:58 +0300 Subject: [PATCH 177/731] (PUP-10680) update lookup test following site resource removal Test adaptation was needed following site resource removal from https://github.com/puppetlabs/puppet/pull/8316 --- acceptance/tests/lookup/lookup.rb | 7 ------- 1 file changed, 7 deletions(-) diff --git a/acceptance/tests/lookup/lookup.rb b/acceptance/tests/lookup/lookup.rb index 81dee69b435..e356d308dd9 100644 --- a/acceptance/tests/lookup/lookup.rb +++ b/acceptance/tests/lookup/lookup.rb @@ -276,13 +276,6 @@ class #{module_name}($#{env_data_implied_key}, file { '#{testdir}/environments/production/manifests/site.pp': ensure => file, content => " - site { - #this should not do anything on the agents as it's compiled into the environment catalog - # we're just ensuring it compiles, here - \\$lookup_port = lookup('#{hiera_data_key}') - notify { \\"the call to #{hiera_data_key} is coming from inside the site clause: \\$lookup_port\\": } - } - node default { include #{module_name} }", From 94990bf79335167f8628e4a3a70a49d4cc4d5ecb Mon Sep 17 00:00:00 2001 From: Luchian Nemes Date: Mon, 28 Sep 2020 17:48:30 +0300 Subject: [PATCH 178/731] (maint) Fix i18n acceptance tests During the change of disable_i18n's default value from false to true there have been reactivated multiple acceptance tests. One of those tests, tests/i18n/modules/puppet_agent.rb, was failing constantly on the first run and passing after. This was due to puppetserver's load of puppet.conf configuration file in memory at the service's startup. This was fixed by ensuring the desired disable_i18n value before restarting the puppetserver service and doing proper test teardown by reverting it to the original/default value. All i18n acceptance tests have been adapted in the same way. --- .../tests/i18n/enable_option_disable_i18n.rb | 15 ++++++++++++--- acceptance/tests/i18n/modules/puppet_agent.rb | 11 ++++++++--- .../i18n/modules/puppet_agent_cached_catalog.rb | 15 ++++++++++----- .../puppet_agent_with_multiple_environments.rb | 9 ++++++++- acceptance/tests/i18n/modules/puppet_apply.rb | 12 +++++++----- .../i18n/modules/puppet_apply_module_lang.rb | 16 +++++++++------- .../modules/puppet_apply_unsupported_lang.rb | 14 ++++++++++---- acceptance/tests/i18n/modules/puppet_describe.rb | 12 +++++++----- acceptance/tests/i18n/modules/puppet_face.rb | 16 +++++++++++----- acceptance/tests/i18n/modules/puppet_resource.rb | 16 +++++++++++----- 10 files changed, 93 insertions(+), 43 deletions(-) diff --git a/acceptance/tests/i18n/enable_option_disable_i18n.rb b/acceptance/tests/i18n/enable_option_disable_i18n.rb index 67111477410..d55e22c184d 100644 --- a/acceptance/tests/i18n/enable_option_disable_i18n.rb +++ b/acceptance/tests/i18n/enable_option_disable_i18n.rb @@ -1,7 +1,7 @@ test_name 'Verify that disable_i18n can be set to true and have translations disabled' do confine :except, :platform => /^solaris/ # translation not supported - tag 'audit:high', + tag 'audit:medium', 'audit:acceptance' require 'puppet/acceptance/environment_utils.rb' @@ -25,8 +25,10 @@ install_i18n_demo_module(master, tmp_environment) end + disable_i18n_default_master = master.puppet['disable_i18n'] teardown do step 'resetting the server locale' do + on(master, puppet("config set disable_i18n #{ disable_i18n_default_master }")) reset_master_system_locale end step 'uninstall the module' do @@ -42,9 +44,15 @@ skip_test("test machine is missing #{agent_language} locale. Skipping") if agent_language.nil? shell_env_language = { 'LANGUAGE' => agent_language, 'LANG' => agent_language } + disable_i18n_default_agent = agent.puppet['disable_i18n'] + teardown do + on(agent, puppet("config set disable_i18n #{ disable_i18n_default_agent }")) + end + step 'enable i18n' do - on(master, puppet("config set disable_i18n false")) on(agent, puppet("config set disable_i18n false")) + on(master, puppet("config set disable_i18n false")) + reset_master_system_locale end step 'expect #{language} translation for a custom type' do @@ -60,8 +68,9 @@ end step 'disable i18n' do - on(master, puppet("config set disable_i18n true")) on(agent, puppet("config set disable_i18n true")) + on(master, puppet("config set disable_i18n true")) + reset_master_system_locale end step 'expect no #{language} translation for a custom type' do diff --git a/acceptance/tests/i18n/modules/puppet_agent.rb b/acceptance/tests/i18n/modules/puppet_agent.rb index c55795d3fc3..db7580a32ca 100644 --- a/acceptance/tests/i18n/modules/puppet_agent.rb +++ b/acceptance/tests/i18n/modules/puppet_agent.rb @@ -14,14 +14,16 @@ extend Puppet::Acceptance::I18nDemoUtils language = 'ja_JP' - step "configure server locale to #{language}" do - configure_master_system_locale(language) - end + disable_i18n_default_master = master.puppet['disable_i18n'] step 'enable i18n on master' do on(master, puppet("config set disable_i18n false")) end + step "configure server locale to #{language}" do + configure_master_system_locale(language) + end + tmp_environment = mk_tmp_environment_with_teardown(master, File.basename(__FILE__, '.*')) step 'install a i18ndemo module' do @@ -30,6 +32,7 @@ teardown do step 'resetting the server locale' do + on(master, puppet("config set disable_i18n #{ disable_i18n_default_master }")) reset_master_system_locale end step 'uninstall the module' do @@ -48,7 +51,9 @@ shell_env_language = { 'LANGUAGE' => agent_language, 'LANG' => agent_language } type_path = agent.tmpdir('provider') + disable_i18n_default_agent = agent.puppet['disable_i18n'] teardown do + on(agent, puppet("config set disable_i18n #{ disable_i18n_default_agent }")) agent.rm_rf(type_path) end diff --git a/acceptance/tests/i18n/modules/puppet_agent_cached_catalog.rb b/acceptance/tests/i18n/modules/puppet_agent_cached_catalog.rb index bb8f2949890..46785dcb886 100644 --- a/acceptance/tests/i18n/modules/puppet_agent_cached_catalog.rb +++ b/acceptance/tests/i18n/modules/puppet_agent_cached_catalog.rb @@ -1,7 +1,7 @@ test_name 'C100566: puppet agent with module should translate messages when using a cached catalog' do confine :except, :platform => /^solaris/ # translation not supported - tag 'audit:high', + tag 'audit:medium', 'audit:acceptance' require 'puppet/acceptance/environment_utils.rb' @@ -14,14 +14,16 @@ extend Puppet::Acceptance::I18nDemoUtils language = 'ja_JP' - step "configure server locale to #{language}" do - configure_master_system_locale(language) - end + disable_i18n_default_master = master.puppet['disable_i18n'] step 'enable i18n on master' do on(master, puppet("config set disable_i18n false")) end + step "configure server locale to #{language}" do + configure_master_system_locale(language) + end + tmp_environment = mk_tmp_environment_with_teardown(master, File.basename(__FILE__, '.*')) step 'install a i18ndemo module' do @@ -30,6 +32,7 @@ teardown do step 'resetting the server locale' do + on(master, puppet("config set disable_i18n #{ disable_i18n_default_master }")) reset_master_system_locale end step 'uninstall the module' do @@ -48,8 +51,10 @@ shell_env_language = { 'LANGUAGE' => agent_language, 'LANG' => agent_language } type_path = agent.tmpdir('provider') + disable_i18n_default_agent = agent.puppet['disable_i18n'] teardown do - on(agent, "rm -rf '#{type_path}'") + on(agent, puppet("config set disable_i18n #{ disable_i18n_default_agent }")) + agent.rm_rf(type_path) end step 'enable i18n' do diff --git a/acceptance/tests/i18n/modules/puppet_agent_with_multiple_environments.rb b/acceptance/tests/i18n/modules/puppet_agent_with_multiple_environments.rb index 3f3f6b59697..5ec98de58a2 100644 --- a/acceptance/tests/i18n/modules/puppet_agent_with_multiple_environments.rb +++ b/acceptance/tests/i18n/modules/puppet_agent_with_multiple_environments.rb @@ -1,7 +1,7 @@ test_name 'C100575: puppet agent with different modules in different environments should translate based on their module' do confine :except, :platform => /^solaris/ # translation not supported - tag 'audit:high', + tag 'audit:medium', 'audit:acceptance' require 'puppet/acceptance/environment_utils.rb' @@ -23,6 +23,7 @@ full_path_env_2 = File.join('/tmp', tmp_environment_2) tmp_po_file = master.tmpfile('tmp_po_file') + disable_i18n_default_master = master.puppet['disable_i18n'] step 'enable i18n on master' do on(master, puppet("config set disable_i18n false")) end @@ -45,6 +46,7 @@ uninstall_i18n_demo_module(master) end step 'resetting the server locale' do + on(master, puppet("config set disable_i18n #{ disable_i18n_default_master }")) reset_master_system_locale end end @@ -56,6 +58,11 @@ skip_test("test machine is missing #{agent_language} locale. Skipping") if agent_language.nil? shell_env_language = { 'LANGUAGE' => agent_language, 'LANG' => agent_language } + disable_i18n_default_agent = agent.puppet['disable_i18n'] + teardown do + on(agent, puppet("config set disable_i18n #{ disable_i18n_default_agent }")) + end + step 'enable i18n' do on(agent, puppet("config set disable_i18n false")) end diff --git a/acceptance/tests/i18n/modules/puppet_apply.rb b/acceptance/tests/i18n/modules/puppet_apply.rb index a4aba10b430..ef549b94c3c 100644 --- a/acceptance/tests/i18n/modules/puppet_apply.rb +++ b/acceptance/tests/i18n/modules/puppet_apply.rb @@ -1,7 +1,7 @@ test_name 'C100567: puppet apply of module should translate messages' do confine :except, :platform => /^solaris/ # translation not supported - tag 'audit:high', + tag 'audit:medium', 'audit:acceptance' require 'puppet/acceptance/temp_file_utils' @@ -35,15 +35,17 @@ install_i18n_demo_module(agent) end - step 'enable i18n' do - on(agent, puppet("config set disable_i18n false")) - end - + disable_i18n_default_agent = agent.puppet['disable_i18n'] teardown do + on(agent, puppet("config set disable_i18n #{ disable_i18n_default_agent }")) uninstall_i18n_demo_module(agent) on(agent, "rm -rf '#{type_path}'") end + step 'enable i18n' do + on(agent, puppet("config set disable_i18n false")) + end + step "Run puppet apply of a module with language #{agent_language} and verify the translations" do step 'verify custom fact translations' do on(agent, puppet("apply -e \"class { 'i18ndemo': filename => '#{type_path}' }\"", 'ENV' => shell_env_language)) do |apply_result| diff --git a/acceptance/tests/i18n/modules/puppet_apply_module_lang.rb b/acceptance/tests/i18n/modules/puppet_apply_module_lang.rb index 59d242661ee..78ea85862c4 100644 --- a/acceptance/tests/i18n/modules/puppet_apply_module_lang.rb +++ b/acceptance/tests/i18n/modules/puppet_apply_module_lang.rb @@ -2,7 +2,7 @@ confine :except, :platform => /^windows/ # Can't print Finish on an English or Japanese code page - tag 'audit:high', + tag 'audit:medium', 'audit:acceptance' require 'puppet/acceptance/temp_file_utils' @@ -29,20 +29,22 @@ skip_test("test machine is missing #{agent_language} locale. Skipping") if agent_language.nil? shell_env_language = { 'LANGUAGE' => agent_language, 'LANG' => agent_language } + type_path = agent.tmpdir('provider') + disable_i18n_default_agent = agent.puppet['disable_i18n'] + teardown do + on(agent, puppet("config set disable_i18n #{ disable_i18n_default_agent }")) + uninstall_i18n_demo_module(agent) + on(agent, "rm -rf '#{type_path}'") + end + step 'install a i18ndemo module' do install_i18n_demo_module(agent) end - type_path = agent.tmpdir('provider') step 'enable i18n' do on(agent, puppet("config set disable_i18n false")) end - teardown do - uninstall_i18n_demo_module(agent) - on(agent, "rm -rf '#{type_path}'") - end - step "Run puppet apply of a module with language #{agent_language} and verify default english returned" do step 'verify custom fact message translated and applied catalog message not translatated' do on(agent, puppet("apply -e \"class { 'i18ndemo': filename => '#{type_path}' }\"", 'ENV' => shell_env_language)) do |apply_result| diff --git a/acceptance/tests/i18n/modules/puppet_apply_unsupported_lang.rb b/acceptance/tests/i18n/modules/puppet_apply_unsupported_lang.rb index c9ad4d51d28..46661b8f2b0 100644 --- a/acceptance/tests/i18n/modules/puppet_apply_unsupported_lang.rb +++ b/acceptance/tests/i18n/modules/puppet_apply_unsupported_lang.rb @@ -21,16 +21,22 @@ next end - step 'install a i18ndemo module' do - install_i18n_demo_module(agent) - end type_path = agent.tmpdir('provider') - + disable_i18n_default_agent = agent.puppet['disable_i18n'] teardown do + on(agent, puppet("config set disable_i18n #{ disable_i18n_default_agent }")) uninstall_i18n_demo_module(agent) on(agent, "rm -rf '#{type_path}'") end + step 'enable i18n' do + on(agent, puppet("config set disable_i18n false")) + end + + step 'install a i18ndemo module' do + install_i18n_demo_module(agent) + end + step "Run puppet apply of a module with language #{unsupported_language} and verify default english returned" do step 'verify custom fact messages not translatated' do on(agent, puppet("apply -e \"class { 'i18ndemo': filename => '#{type_path}' }\"", 'ENV' => shell_env_language)) do |apply_result| diff --git a/acceptance/tests/i18n/modules/puppet_describe.rb b/acceptance/tests/i18n/modules/puppet_describe.rb index 2fa7fae64b3..5e5916b4270 100644 --- a/acceptance/tests/i18n/modules/puppet_describe.rb +++ b/acceptance/tests/i18n/modules/puppet_describe.rb @@ -1,7 +1,7 @@ test_name 'C100576: puppet describe with module type translates message' do confine :except, :platform => /^solaris/ # translation not supported - tag 'audit:high', + tag 'audit:medium', 'audit:acceptance' require 'puppet/acceptance/i18n_utils' @@ -27,6 +27,12 @@ skip_test("test machine is missing #{agent_language} locale. Skipping") if agent_language.nil? shell_env_language = { 'LANGUAGE' => agent_language, 'LANG' => agent_language } + disable_i18n_default_agent = agent.puppet['disable_i18n'] + teardown do + on(agent, puppet("config set disable_i18n #{ disable_i18n_default_agent }")) + uninstall_i18n_demo_module(agent) + end + step 'enable i18n' do on(agent, puppet("config set disable_i18n false")) end @@ -35,10 +41,6 @@ install_i18n_demo_module(agent) end - teardown do - uninstall_i18n_demo_module(agent) - end - step "Run puppet describe from a module with language #{agent_language} and verify the translations" do on(agent, puppet('describe i18ndemo_type', 'ENV' => shell_env_language)) do |result| assert_match(/\w+-i18ndemo type: dirパラメータは、検査するディレクトリパスをとります/, result.stdout, 'missing translation of dir parameter from i18ndemo_type') diff --git a/acceptance/tests/i18n/modules/puppet_face.rb b/acceptance/tests/i18n/modules/puppet_face.rb index 934f58fcca2..50c83b86323 100644 --- a/acceptance/tests/i18n/modules/puppet_face.rb +++ b/acceptance/tests/i18n/modules/puppet_face.rb @@ -1,7 +1,7 @@ test_name 'C100573: puppet application/face with module translates messages' do confine :except, :platform => /^solaris/ # translation not supported - tag 'audit:high', + tag 'audit:medium', 'audit:acceptance' require 'puppet/acceptance/i18n_utils' @@ -27,14 +27,20 @@ skip_test("test machine is missing #{agent_language} locale. Skipping") if agent_language.nil? shell_env_language = { 'LANGUAGE' => agent_language, 'LANG' => agent_language } - step 'install a i18ndemo module' do - install_i18n_demo_module(agent) - end - + disable_i18n_default_agent = agent.puppet['disable_i18n'] teardown do + on(agent, puppet("config set disable_i18n #{ disable_i18n_default_agent }")) uninstall_i18n_demo_module(agent) end + step 'enable i18n' do + on(agent, puppet("config set disable_i18n false")) + end + + step 'install a i18ndemo module' do + install_i18n_demo_module(agent) + end + step "Run puppet i18ndemo (face/application from a module with language #{agent_language} and verify the translations" do step 'puppet --help contains i18ndemo summary translation' do on(agent, puppet('--help', 'ENV' => shell_env_language)) do |result| diff --git a/acceptance/tests/i18n/modules/puppet_resource.rb b/acceptance/tests/i18n/modules/puppet_resource.rb index ac98c90ce35..56dd97d1fa3 100644 --- a/acceptance/tests/i18n/modules/puppet_resource.rb +++ b/acceptance/tests/i18n/modules/puppet_resource.rb @@ -1,7 +1,7 @@ test_name 'C100572: puppet resource with module translates messages' do confine :except, :platform => /^solaris/ # translation not supported - tag 'audit:high', + tag 'audit:medium', 'audit:acceptance' require 'puppet/acceptance/i18n_utils' @@ -27,14 +27,20 @@ skip_test("test machine is missing #{agent_language} locale. Skipping") if agent_language.nil? shell_env_language = { 'LANGUAGE' => agent_language, 'LANG' => agent_language } - step 'install a i18ndemo module' do - install_i18n_demo_module(agent) - end - + disable_i18n_default_agent = agent.puppet['disable_i18n'] teardown do + on(agent, puppet("config set disable_i18n #{ disable_i18n_default_agent }")) uninstall_i18n_demo_module(agent) end + step 'enable i18n' do + on(agent, puppet("config set disable_i18n false")) + end + + step 'install a i18ndemo module' do + install_i18n_demo_module(agent) + end + step "Run puppet resource for a module with language #{agent_language} and verify the translations" do step 'puppet resource i18ndemo_type information contains translation' do on(agent, puppet('resource i18ndemo_type', 'ENV' => shell_env_language), :acceptable_exit_codes => 1) do |result| From ced1ac9034419e6a2ea4f3dc197d819133b2f5f3 Mon Sep 17 00:00:00 2001 From: Ciprian Badescu Date: Mon, 31 Aug 2020 13:59:06 +0300 Subject: [PATCH 179/731] (PUP-10598) Change default value of `ignore_plugin_errors` to false If `ignore_plugin_errors` is true(default value before this commit), puppet agents can fail to pluginsync and will be missing facts/types/providers that may be needed to request and apply the catalog. For example, missing custom/external facts can change which classes are included in the catalog or cause compilation failures if the manifests references the missing fact --- lib/puppet/defaults.rb | 2 +- spec/unit/configurer/downloader_spec.rb | 8 ++++++-- spec/unit/configurer_spec.rb | 4 ++++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb index 3e5c0aaebce..0a8fe77460e 100644 --- a/lib/puppet/defaults.rb +++ b/lib/puppet/defaults.rb @@ -1882,7 +1882,7 @@ def self.initialize_default_settings!(settings) :desc => "What files to ignore when pulling down plugins.", }, :ignore_plugin_errors => { - :default => true, + :default => false, :type => :boolean, :desc => "Whether the puppet run should ignore errors during pluginsync. If the setting is false and there are errors during pluginsync, then the agent will abort the run and diff --git a/spec/unit/configurer/downloader_spec.rb b/spec/unit/configurer/downloader_spec.rb index bcbda27e3cd..cdc2413d816 100644 --- a/spec/unit/configurer/downloader_spec.rb +++ b/spec/unit/configurer/downloader_spec.rb @@ -189,6 +189,8 @@ def generate_file_resource(options = {}) end it "should return all changed file paths" do + Puppet[:ignore_plugin_errors] = true + trans = double('transaction') catalog = double('catalog') @@ -204,6 +206,8 @@ def generate_file_resource(options = {}) end it "should yield the resources if a block is given" do + Puppet[:ignore_plugin_errors] = true + trans = double('transaction') catalog = double('catalog') @@ -221,6 +225,8 @@ def generate_file_resource(options = {}) end it "should catch and log exceptions" do + Puppet[:ignore_plugin_errors] = true + expect(Puppet).to receive(:log_exception) # The downloader creates a new catalog for each apply, and really the only object # that it is possible to stub for the purpose of generating a puppet error @@ -230,8 +236,6 @@ def generate_file_resource(options = {}) end it "raises an exception if catalog application fails" do - Puppet[:ignore_plugin_errors] = false - expect(@dler.file).to receive(:retrieve).and_raise(Puppet::Error, "testing") expect { diff --git a/spec/unit/configurer_spec.rb b/spec/unit/configurer_spec.rb index c9391ec22bf..09cb150c625 100644 --- a/spec/unit/configurer_spec.rb +++ b/spec/unit/configurer_spec.rb @@ -657,6 +657,8 @@ def expects_neither_new_or_cached_catalog end it "should pluginsync and compile a new catalog if none is found in the cache" do + Puppet[:ignore_plugin_errors] = true + expects_fallback_to_new_catalog(catalog) stub_request(:get, %r{/puppet/v3/file_metadatas?/plugins}).to_return(:status => 404) stub_request(:get, %r{/puppet/v3/file_metadatas?/pluginfacts}).to_return(:status => 404) @@ -668,6 +670,8 @@ def expects_neither_new_or_cached_catalog end it "should not attempt to retrieve a cached catalog again if the first attempt failed" do + Puppet[:ignore_plugin_errors] = true + expect(Puppet::Node.indirection).to receive(:find).and_return(nil) expects_neither_new_or_cached_catalog expects_pluginsync From e6227de8ede4fb02ae445837ea778d23dc81e689 Mon Sep 17 00:00:00 2001 From: gimmy Date: Tue, 29 Sep 2020 15:34:59 +0300 Subject: [PATCH 180/731] (PUP-10677) gem provider uses system ruby MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Because `INSTALL_DIR/puppet/bin` is prepended to PATH, gem provider always uses Puppet’s Ruby. This commit changes the gem provider to execute commands in a specific environment that has a PATH which does not contain `puppet/bin`. It also updates the puppet_gem provider to use the full path for the Puppet’s gem executable --- lib/puppet/provider/package/gem.rb | 26 +++++++++++++-- lib/puppet/provider/package/puppet_gem.rb | 5 +-- spec/unit/provider/package/gem_spec.rb | 32 +++++++++++++++++++ spec/unit/provider/package/puppet_gem_spec.rb | 5 +-- 4 files changed, 59 insertions(+), 9 deletions(-) diff --git a/lib/puppet/provider/package/gem.rb b/lib/puppet/provider/package/gem.rb index 2651c50905a..75393194bfd 100644 --- a/lib/puppet/provider/package/gem.rb +++ b/lib/puppet/provider/package/gem.rb @@ -14,7 +14,7 @@ This provider supports the `install_options` and `uninstall_options` attributes, which allow command-line flags to be passed to the gem command. - These options should be specified as an array where each element is either a + These options should be specified as an array where each element is either a string or a hash." has_feature :versionable, :install_options, :uninstall_options, :targetable, :version_ranges @@ -36,7 +36,11 @@ def self.specificity # Required by Puppet::Provider::Package::Targetable::resource_or_provider_command def self.provider_command - command(:gemcmd) + if Puppet::Util::Platform.windows? + Puppet::Util.withenv(PATH: windows_path_without_puppet_bin) { command(:gemcmd) } + else + command(:gemcmd) + end end # Define the default provider package command as optional when the provider is targetable. @@ -46,6 +50,18 @@ def self.provider_command is_optional end + # Having puppet/bin in PATH makes gem provider to use puppet/bin/gem + # This is an utility methods that reads the PATH and returns a string + # that contains the content of PATH but without puppet/bin dir. + # This is used to pass a custom PATH and execute commands in a controlled environment + def self.windows_path_without_puppet_bin + @path ||= Puppet::Util.get_env('PATH').split(File::PATH_SEPARATOR) + .reject { |dir| dir =~ /puppet\\bin$/ } + .join(File::PATH_SEPARATOR) + end + + private_class_method :windows_path_without_puppet_bin + # CommandDefiner in provider.rb creates convenience execution methods that set failonfail, combine, and optionally, environment. # And when a child provider defines its own command via commands() or has_command(), the provider-specific path is always returned by command(). # But when the convenience execution method is invoked, the last convenience method to be defined is executed. @@ -59,6 +75,10 @@ def self.execute_gem_command(command, command_options, custom_environment = {}) custom_environment = {'HOME'=>Puppet::Util.get_env('HOME')}.merge(custom_environment) + if Puppet::Util::Platform.windows? + custom_environment[:PATH] = windows_path_without_puppet_bin + end + execute(cmd, {:failonfail => true, :combine => true, :custom_environment => custom_environment}) end @@ -152,7 +172,7 @@ def insync?(is) end end end - + begin # Range intersections are not supported by Gem::Requirement, so just split by comma. dependency = Gem::Dependency.new('', should.split(',')) diff --git a/lib/puppet/provider/package/puppet_gem.rb b/lib/puppet/provider/package/puppet_gem.rb index 01065751036..f06a3e70dd0 100644 --- a/lib/puppet/provider/package/puppet_gem.rb +++ b/lib/puppet/provider/package/puppet_gem.rb @@ -5,10 +5,7 @@ has_feature :versionable, :install_options, :uninstall_options if Puppet::Util::Platform.windows? - # On windows, we put our ruby ahead of anything that already - # existed on the system PATH. This means that we do not need to - # sort out the absolute path. - commands :gemcmd => "gem" + commands :gemcmd => File.join(Puppet::Util.get_env('PUPPET_DIR').to_s, 'bin', 'gem.bat') else commands :gemcmd => "/opt/puppetlabs/puppet/bin/gem" end diff --git a/spec/unit/provider/package/gem_spec.rb b/spec/unit/provider/package/gem_spec.rb index 0490fd24f9e..ca814cd97d5 100644 --- a/spec/unit/provider/package/gem_spec.rb +++ b/spec/unit/provider/package/gem_spec.rb @@ -12,6 +12,10 @@ let(:provider_gem_cmd) { '/provider/gem' } let(:execute_options) { {:failonfail => true, :combine => true, :custom_environment => {"HOME"=>ENV["HOME"]}} } + before do + allow(Puppet::Util::Platform).to receive(:windows?).and_return(false) + end + context 'installing myresource' do let(:resource) do Puppet::Type.type(:package).new( @@ -36,6 +40,34 @@ allow(provider).to receive(:rubygem_version).and_return('1.9.9') end + context 'on windows' do + let(:path) do + "C:\\Program Files\\Puppet Labs\\Puppet\\puppet\\bin;C:\\Program Files\\Puppet Labs\\Puppet\\bin;C:\\Ruby26-x64\\bin;C:\\Windows\\system32\\bin" + end + + let(:expected_path) do + "C:\\Program Files\\Puppet Labs\\Puppet\\bin;C:\\Ruby26-x64\\bin;C:\\Windows\\system32\\bin" + end + + before do + allow(Puppet::Util::Platform).to receive(:windows?).and_return(true) + allow(Puppet::Util).to receive(:get_env) + allow(Puppet::Util).to receive(:get_env).with('PATH').and_return(path) + allow(described_class).to receive(:validate_command).with(provider_gem_cmd) + stub_const('::File::PATH_SEPARATOR', ';') + end + + it 'removes puppet/bin from PATH' do + expect(described_class).to receive(:execute) \ + .with( + anything, + hash_including(custom_environment: hash_including(PATH: expected_path)) + ) + .and_return("") + provider.install + end + end + it "should use the path to the gem command" do allow(described_class).to receive(:validate_command).with(provider_gem_cmd) expect(described_class).to receive(:execute).with(be_a(Array), execute_options) { |args| expect(args[0]).to eq(provider_gem_cmd) }.and_return("") diff --git a/spec/unit/provider/package/puppet_gem_spec.rb b/spec/unit/provider/package/puppet_gem_spec.rb index 261ba417ac9..e9c97c62158 100644 --- a/spec/unit/provider/package/puppet_gem_spec.rb +++ b/spec/unit/provider/package/puppet_gem_spec.rb @@ -15,19 +15,20 @@ end if Puppet::Util::Platform.windows? - let(:provider_gem_cmd) { 'gem' } + let(:provider_gem_cmd) { 'C:\Program Files\Puppet Labs\Puppet\puppet\bin\gem.bat' } else let(:provider_gem_cmd) { '/opt/puppetlabs/puppet/bin/gem' } end custom_environment = {"HOME"=>ENV["HOME"]} - custom_environment['PKG_CONFIG_PATH'] = '/opt/puppetlabs/puppet/lib/pkgconfig' unless Puppet::Util::Platform.windows? + custom_environment['PKG_CONFIG_PATH'] = '/opt/puppetlabs/puppet/lib/pkgconfig' let(:execute_options) { {:failonfail => true, :combine => true, :custom_environment => custom_environment} } before :each do resource.provider = provider allow(described_class).to receive(:command).with(:gemcmd).and_return(provider_gem_cmd) + allow(Puppet::Util::Platform).to receive(:windows?).and_return(false) end context "when installing" do From b3fe419f5170d8726f493d707b3751ccbf7c1bbd Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Thu, 1 Oct 2020 16:07:46 +0000 Subject: [PATCH 181/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 2 +- man/man8/puppet-agent.8 | 2 +- man/man8/puppet-apply.8 | 2 +- man/man8/puppet-catalog.8 | 2 +- man/man8/puppet-config.8 | 2 +- man/man8/puppet-describe.8 | 2 +- man/man8/puppet-device.8 | 2 +- man/man8/puppet-doc.8 | 2 +- man/man8/puppet-epp.8 | 2 +- man/man8/puppet-facts.8 | 2 +- man/man8/puppet-filebucket.8 | 2 +- man/man8/puppet-generate.8 | 2 +- man/man8/puppet-help.8 | 2 +- man/man8/puppet-lookup.8 | 2 +- man/man8/puppet-module.8 | 2 +- man/man8/puppet-node.8 | 2 +- man/man8/puppet-parser.8 | 2 +- man/man8/puppet-plugin.8 | 2 +- man/man8/puppet-report.8 | 2 +- man/man8/puppet-resource.8 | 2 +- man/man8/puppet-script.8 | 2 +- man/man8/puppet-ssl.8 | 2 +- man/man8/puppet.8 | 2 +- 23 files changed, 23 insertions(+), 23 deletions(-) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index 4667611d008..306ec20aff4 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPETCONF" "5" "September 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPETCONF" "5" "October 2020" "Puppet, Inc." "Puppet manual" \fBThis page is autogenerated; any changes will get overwritten\fR . .SH "Configuration settings" diff --git a/man/man8/puppet-agent.8 b/man/man8/puppet-agent.8 index 17ec2193ce6..b15688aa1c1 100644 --- a/man/man8/puppet-agent.8 +++ b/man/man8/puppet-agent.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-AGENT" "8" "September 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-AGENT" "8" "October 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-agent\fR \- The puppet agent daemon diff --git a/man/man8/puppet-apply.8 b/man/man8/puppet-apply.8 index 3db7bd45a4f..9d53a6e7e35 100644 --- a/man/man8/puppet-apply.8 +++ b/man/man8/puppet-apply.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-APPLY" "8" "September 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-APPLY" "8" "October 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-apply\fR \- Apply Puppet manifests locally diff --git a/man/man8/puppet-catalog.8 b/man/man8/puppet-catalog.8 index d80588fa8ae..f1015fa22f7 100644 --- a/man/man8/puppet-catalog.8 +++ b/man/man8/puppet-catalog.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-CATALOG" "8" "September 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-CATALOG" "8" "October 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-catalog\fR \- Compile, save, view, and convert catalogs\. diff --git a/man/man8/puppet-config.8 b/man/man8/puppet-config.8 index f6f7c2eec51..36d3442bfbd 100644 --- a/man/man8/puppet-config.8 +++ b/man/man8/puppet-config.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-CONFIG" "8" "September 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-CONFIG" "8" "October 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-config\fR \- Interact with Puppet\'s settings\. diff --git a/man/man8/puppet-describe.8 b/man/man8/puppet-describe.8 index 270c34d8c0d..4140615653d 100644 --- a/man/man8/puppet-describe.8 +++ b/man/man8/puppet-describe.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-DESCRIBE" "8" "September 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-DESCRIBE" "8" "October 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-describe\fR \- Display help about resource types diff --git a/man/man8/puppet-device.8 b/man/man8/puppet-device.8 index 6e4c9b933d5..9e0e270df7f 100644 --- a/man/man8/puppet-device.8 +++ b/man/man8/puppet-device.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-DEVICE" "8" "September 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-DEVICE" "8" "October 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-device\fR \- Manage remote network devices diff --git a/man/man8/puppet-doc.8 b/man/man8/puppet-doc.8 index e6a77cffb59..f4c18b79c93 100644 --- a/man/man8/puppet-doc.8 +++ b/man/man8/puppet-doc.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-DOC" "8" "September 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-DOC" "8" "October 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-doc\fR \- Generate Puppet references diff --git a/man/man8/puppet-epp.8 b/man/man8/puppet-epp.8 index 2c296fb3f5c..a442da453f6 100644 --- a/man/man8/puppet-epp.8 +++ b/man/man8/puppet-epp.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-EPP" "8" "September 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-EPP" "8" "October 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-epp\fR \- Interact directly with the EPP template parser/renderer\. diff --git a/man/man8/puppet-facts.8 b/man/man8/puppet-facts.8 index e97d4fd3be5..80b334c8524 100644 --- a/man/man8/puppet-facts.8 +++ b/man/man8/puppet-facts.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-FACTS" "8" "September 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-FACTS" "8" "October 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-facts\fR \- Retrieve and store facts\. diff --git a/man/man8/puppet-filebucket.8 b/man/man8/puppet-filebucket.8 index 7895cca66e0..b9fd841552f 100644 --- a/man/man8/puppet-filebucket.8 +++ b/man/man8/puppet-filebucket.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-FILEBUCKET" "8" "September 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-FILEBUCKET" "8" "October 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-filebucket\fR \- Store and retrieve files in a filebucket diff --git a/man/man8/puppet-generate.8 b/man/man8/puppet-generate.8 index b5b5343674c..d64e0237747 100644 --- a/man/man8/puppet-generate.8 +++ b/man/man8/puppet-generate.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-GENERATE" "8" "September 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-GENERATE" "8" "October 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-generate\fR \- Generates Puppet code from Ruby definitions\. diff --git a/man/man8/puppet-help.8 b/man/man8/puppet-help.8 index e397ffe0d01..c9e2a554926 100644 --- a/man/man8/puppet-help.8 +++ b/man/man8/puppet-help.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-HELP" "8" "September 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-HELP" "8" "October 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-help\fR \- Display Puppet help\. diff --git a/man/man8/puppet-lookup.8 b/man/man8/puppet-lookup.8 index b0e20c79095..a1d7a016630 100644 --- a/man/man8/puppet-lookup.8 +++ b/man/man8/puppet-lookup.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-LOOKUP" "8" "September 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-LOOKUP" "8" "October 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-lookup\fR \- Interactive Hiera lookup diff --git a/man/man8/puppet-module.8 b/man/man8/puppet-module.8 index c86f7df7d63..b71a65ff5b2 100644 --- a/man/man8/puppet-module.8 +++ b/man/man8/puppet-module.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-MODULE" "8" "September 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-MODULE" "8" "October 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-module\fR \- Creates, installs and searches for modules on the Puppet Forge\. diff --git a/man/man8/puppet-node.8 b/man/man8/puppet-node.8 index def01f5ee22..b3bb22de6ae 100644 --- a/man/man8/puppet-node.8 +++ b/man/man8/puppet-node.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-NODE" "8" "September 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-NODE" "8" "October 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-node\fR \- View and manage node definitions\. diff --git a/man/man8/puppet-parser.8 b/man/man8/puppet-parser.8 index b0ef4173a70..bbc5cd78d51 100644 --- a/man/man8/puppet-parser.8 +++ b/man/man8/puppet-parser.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-PARSER" "8" "September 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-PARSER" "8" "October 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-parser\fR \- Interact directly with the parser\. diff --git a/man/man8/puppet-plugin.8 b/man/man8/puppet-plugin.8 index acda8a2efd5..0dd166c2ff4 100644 --- a/man/man8/puppet-plugin.8 +++ b/man/man8/puppet-plugin.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-PLUGIN" "8" "September 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-PLUGIN" "8" "October 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-plugin\fR \- Interact with the Puppet plugin system\. diff --git a/man/man8/puppet-report.8 b/man/man8/puppet-report.8 index 0e979f26fa9..18952856587 100644 --- a/man/man8/puppet-report.8 +++ b/man/man8/puppet-report.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-REPORT" "8" "September 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-REPORT" "8" "October 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-report\fR \- Create, display, and submit reports\. diff --git a/man/man8/puppet-resource.8 b/man/man8/puppet-resource.8 index ad1ee3716ce..11e6d8c4845 100644 --- a/man/man8/puppet-resource.8 +++ b/man/man8/puppet-resource.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-RESOURCE" "8" "September 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-RESOURCE" "8" "October 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-resource\fR \- The resource abstraction layer shell diff --git a/man/man8/puppet-script.8 b/man/man8/puppet-script.8 index cda66166ac2..500b14f2d58 100644 --- a/man/man8/puppet-script.8 +++ b/man/man8/puppet-script.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-SCRIPT" "8" "September 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-SCRIPT" "8" "October 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-script\fR \- Run a puppet manifests as a script without compiling a catalog diff --git a/man/man8/puppet-ssl.8 b/man/man8/puppet-ssl.8 index 4e8a7adbe3d..4b21a4eaf71 100644 --- a/man/man8/puppet-ssl.8 +++ b/man/man8/puppet-ssl.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-SSL" "8" "September 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-SSL" "8" "October 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-ssl\fR \- Manage SSL keys and certificates for puppet SSL clients diff --git a/man/man8/puppet.8 b/man/man8/puppet.8 index 35137d2f4a0..f8356806f44 100644 --- a/man/man8/puppet.8 +++ b/man/man8/puppet.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET" "8" "September 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET" "8" "October 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\fR From 0befcf3270d738aeb1a480590ee824c82ca312c8 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Wed, 30 Sep 2020 11:19:59 -0700 Subject: [PATCH 182/731] (PUP-7582) Error on virtual and exported classes Previously puppet would warn or error if it encountered a virtual class (indicated by `@class`) or an exported class (indicated by `@@class`) based on the `Puppet[:strict]` setting. By default, puppet would warn, yet include resources from the virtual class in the catalog. So the resources in the virtual class weren't virtual! Also note, it wasn't possible to turn off the warning. This commit makes puppet always error on virtual and exported classes. The validator_factory_4_0.rb validates static resource expressions, while runtime3_support validates `create_resources` calls, which can be used to create resources at runtime, so we need to prevent things like: create_resources('@class', {}) The integration tests are removed since we already test for validation errors in unit tests. --- lib/puppet/pops/evaluator/runtime3_support.rb | 2 +- .../pops/validation/validator_factory_4_0.rb | 2 +- spec/integration/parser/catalog_spec.rb | 38 ------------------- .../parser/functions/create_resources_spec.rb | 22 +---------- spec/unit/pops/validator/validator_spec.rb | 24 ++++++------ 5 files changed, 16 insertions(+), 72 deletions(-) diff --git a/lib/puppet/pops/evaluator/runtime3_support.rb b/lib/puppet/pops/evaluator/runtime3_support.rb index f6468447f79..cec3d56e40b 100644 --- a/lib/puppet/pops/evaluator/runtime3_support.rb +++ b/lib/puppet/pops/evaluator/runtime3_support.rb @@ -505,7 +505,7 @@ def initialize # Store config issues, ignore or warning p[Issues::RT_NO_STORECONFIGS_EXPORT] = Puppet[:storeconfigs] ? :ignore : :warning p[Issues::RT_NO_STORECONFIGS] = Puppet[:storeconfigs] ? :ignore : :warning - p[Issues::CLASS_NOT_VIRTUALIZABLE] = Puppet[:strict] == :off ? :warning : Puppet[:strict] + p[Issues::CLASS_NOT_VIRTUALIZABLE] = :error p[Issues::NUMERIC_COERCION] = Puppet[:strict] == :off ? :ignore : Puppet[:strict] p[Issues::SERIALIZATION_DEFAULT_CONVERTED_TO_STRING] = Puppet[:strict] == :off ? :warning : Puppet[:strict] p[Issues::SERIALIZATION_UNKNOWN_CONVERTED_TO_STRING] = Puppet[:strict] == :off ? :warning : Puppet[:strict] diff --git a/lib/puppet/pops/validation/validator_factory_4_0.rb b/lib/puppet/pops/validation/validator_factory_4_0.rb index 82c90b25247..ebd94f784c1 100644 --- a/lib/puppet/pops/validation/validator_factory_4_0.rb +++ b/lib/puppet/pops/validation/validator_factory_4_0.rb @@ -35,7 +35,7 @@ def severity_producer p[Issues::DUPLICATE_KEY] = Puppet[:strict] == :off ? :ignore : Puppet[:strict] p[Issues::NAME_WITH_HYPHEN] = :error p[Issues::EMPTY_RESOURCE_SPECIALIZATION] = :ignore - p[Issues::CLASS_NOT_VIRTUALIZABLE] = Puppet[:strict] == :off ? :warning : Puppet[:strict] + p[Issues::CLASS_NOT_VIRTUALIZABLE] = :error p end end diff --git a/spec/integration/parser/catalog_spec.rb b/spec/integration/parser/catalog_spec.rb index 83911d4588b..87a7d44c78f 100644 --- a/spec/integration/parser/catalog_spec.rb +++ b/spec/integration/parser/catalog_spec.rb @@ -48,44 +48,6 @@ class { "third": } expect(resources_in(agent_catalog)). to include_in_order(*resources_in_declaration_order) end - - it "does not contain unrealized, virtual resources" do - virtual_resources = ["Unrealized[unreal]", "Class[Unreal]"] - - master_catalog, agent_catalog = master_and_agent_catalogs_for(<<-EOM) - class unreal { } - define unrealized() { } - - class real { - @unrealized { "unreal": } - @class { "unreal": } - } - - include real - EOM - - expect(resources_in(master_catalog)).to_not include(*virtual_resources) - expect(resources_in(agent_catalog)).to_not include(*virtual_resources) - end - - it "does not contain unrealized, exported resources" do - exported_resources = ["Unrealized[unreal]", "Class[Unreal]"] - - master_catalog, agent_catalog = master_and_agent_catalogs_for(<<-EOM) - class unreal { } - define unrealized() { } - - class real { - @@unrealized { "unreal": } - @@class { "unreal": } - } - - include real - EOM - - expect(resources_in(master_catalog)).to_not include(*exported_resources) - expect(resources_in(agent_catalog)).to_not include(*exported_resources) - end end end diff --git a/spec/unit/parser/functions/create_resources_spec.rb b/spec/unit/parser/functions/create_resources_spec.rb index 941c38786ea..16f21abed95 100644 --- a/spec/unit/parser/functions/create_resources_spec.rb +++ b/spec/unit/parser/functions/create_resources_spec.rb @@ -257,31 +257,13 @@ class bar($one) { expect(catalog.resource(:class, "bar")).not_to be_nil end - [:off, :warning].each do | strictness | - it "should warn if strict = #{strictness} and class is exported" do - Puppet[:strict] = strictness - collect_notices('class test{} create_resources("@@class", {test => {}})') - expect(warnings).to include(/Classes are not virtualizable/) - end - end - - it 'should error if strict = error and class is exported' do - Puppet[:strict] = :error + it 'should error if class is exported' do expect{ compile_to_catalog('class test{} create_resources("@@class", {test => {}})') }.to raise_error(/Classes are not virtualizable/) end - [:off, :warning].each do | strictness | - it "should warn if strict = #{strictness} and class is virtual" do - Puppet[:strict] = strictness - collect_notices('class test{} create_resources("@class", {test => {}})') - expect(warnings).to include(/Classes are not virtualizable/) - end - end - - it 'should error if strict = error and class is virtual' do - Puppet[:strict] = :error + it 'should error if class is virtual' do expect{ compile_to_catalog('class test{} create_resources("@class", {test => {}})') }.to raise_error(/Classes are not virtualizable/) diff --git a/spec/unit/pops/validator/validator_spec.rb b/spec/unit/pops/validator/validator_spec.rb index 6a5379a8c84..9d822a24aa2 100644 --- a/spec/unit/pops/validator/validator_spec.rb +++ b/spec/unit/pops/validator/validator_spec.rb @@ -179,17 +179,17 @@ def with_environment(environment, env_params = {}) expect(acceptor).to have_issue(Puppet::Pops::Issues::DUPLICATE_KEY) end - it 'produces a warning for virtual class resource' do + it 'produces an error for virtual class resource' do acceptor = validate(parse('@class { test: }')) - expect(acceptor.warning_count).to eql(1) - expect(acceptor.error_count).to eql(0) + expect(acceptor.warning_count).to eql(0) + expect(acceptor.error_count).to eql(1) expect(acceptor).to have_issue(Puppet::Pops::Issues::CLASS_NOT_VIRTUALIZABLE) end - it 'produces a warning for exported class resource' do + it 'produces an error for exported class resource' do acceptor = validate(parse('@@class { test: }')) - expect(acceptor.warning_count).to eql(1) - expect(acceptor.error_count).to eql(0) + expect(acceptor.warning_count).to eql(0) + expect(acceptor.error_count).to eql(1) expect(acceptor).to have_issue(Puppet::Pops::Issues::CLASS_NOT_VIRTUALIZABLE) end @@ -310,17 +310,17 @@ def with_environment(environment, env_params = {}) expect(acceptor).to have_issue(Puppet::Pops::Issues::DUPLICATE_DEFAULT) end - it 'produces a warning for virtual class resource' do + it 'produces an error for virtual class resource' do acceptor = validate(parse('@class { test: }')) - expect(acceptor.warning_count).to eql(1) - expect(acceptor.error_count).to eql(0) + expect(acceptor.warning_count).to eql(0) + expect(acceptor.error_count).to eql(1) expect(acceptor).to have_issue(Puppet::Pops::Issues::CLASS_NOT_VIRTUALIZABLE) end - it 'produces a warning for exported class resource' do + it 'produces an error for exported class resource' do acceptor = validate(parse('@@class { test: }')) - expect(acceptor.warning_count).to eql(1) - expect(acceptor.error_count).to eql(0) + expect(acceptor.warning_count).to eql(0) + expect(acceptor.error_count).to eql(1) expect(acceptor).to have_issue(Puppet::Pops::Issues::CLASS_NOT_VIRTUALIZABLE) end end From e5fab68015a31398059ffaae001cc54ea3aa8a91 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Fri, 2 Oct 2020 02:52:29 +0000 Subject: [PATCH 183/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index 306ec20aff4..a2249cf7031 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -915,7 +915,7 @@ The HTTP User\-Agent string to send when making network requests\. Whether the puppet run should ignore errors during pluginsync\. If the setting is false and there are errors during pluginsync, then the agent will abort the run and submit a report containing information about the failed run\. . .IP "\(bu" 4 -\fIDefault\fR: true +\fIDefault\fR: false . .IP "" 0 . From 254cc225da642ca12db75f1caef2c1ea530b2528 Mon Sep 17 00:00:00 2001 From: gimmy Date: Thu, 1 Oct 2020 15:21:26 +0300 Subject: [PATCH 184/731] (PUP-10640) setup github actions for main branch --- .github/workflows/checks.yaml | 4 ++-- .github/workflows/rspec_tests.yaml | 9 +++------ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/.github/workflows/checks.yaml b/.github/workflows/checks.yaml index ca7fd79578d..a9f30898193 100644 --- a/.github/workflows/checks.yaml +++ b/.github/workflows/checks.yaml @@ -3,9 +3,9 @@ name: Checks on: push: - branches: [master] + branches: [main] pull_request: - branches: [master] + branches: [main] jobs: checks: diff --git a/.github/workflows/rspec_tests.yaml b/.github/workflows/rspec_tests.yaml index f7b29841e45..fc18d0e47dc 100644 --- a/.github/workflows/rspec_tests.yaml +++ b/.github/workflows/rspec_tests.yaml @@ -3,7 +3,7 @@ name: RSpec tests on: push: - branches: [master] + branches: [main] paths-ignore: ['**.md', 'docs/*', 'examples/*', 'ext/*', 'benchmarks/*'] pull_request: paths-ignore: ['**.md', 'docs/*', 'examples/*', 'ext/*', 'benchmarks/*'] @@ -14,16 +14,13 @@ jobs: strategy: matrix: cfg: - - {os: ubuntu-18.04, ruby: 2.3} - - {os: ubuntu-18.04, ruby: 2.4} - {os: ubuntu-18.04, ruby: 2.5} - {os: ubuntu-18.04, ruby: 2.6} - {os: ubuntu-18.04, ruby: 2.7} - {os: ubuntu-18.04, ruby: jruby-9.2.9.0} - - {os: windows-2016, ruby: 2.3} - - {os: windows-2016, ruby: 2.4} - {os: windows-2016, ruby: 2.5} - {os: windows-2016, ruby: 2.6} + - {os: windows-2016, ruby: 2.7} runs-on: ${{ matrix.cfg.os }} steps: @@ -44,7 +41,7 @@ jobs: - name: Run tests on Windows if: runner.os == 'Windows' run: | - # from: https://github.com/MSP-Greg/ruby/blob/4f1147e6555bbb7f0868bca40c86ca078a7381c3/.github/workflows/mingw.yml + # https://github.com/ruby/ruby/pull/2791/files#diff-ff5ff976e81bebd977f0834e60416abbR97-R100 # Actions uses UTF8, causes test failures, similar to normal OS setup $PSDefaultParameterValues['*:Encoding'] = 'utf8' [Console]::OutputEncoding = [System.Text.Encoding]::GetEncoding("IBM437") From 88fbc32576bcb036cef451d2db22538f7e3052c4 Mon Sep 17 00:00:00 2001 From: Oana Tanasoiu Date: Thu, 3 Sep 2020 12:37:30 +0300 Subject: [PATCH 185/731] (PUP-10644) Add show action for puppet facts --- lib/puppet/face/facts.rb | 61 +++++++++++++++ lib/puppet/indirector/facts/facter.rb | 25 ++++++- spec/unit/face/facts_spec.rb | 4 + spec/unit/indirector/facts/facter_spec.rb | 91 +++++++++++++++++++++++ 4 files changed, 179 insertions(+), 2 deletions(-) diff --git a/lib/puppet/face/facts.rb b/lib/puppet/face/facts.rb index cf6c6076ef8..b90a1d46aab 100644 --- a/lib/puppet/face/facts.rb +++ b/lib/puppet/face/facts.rb @@ -83,4 +83,65 @@ nil end end + + action(:show) do + summary _("Facter plugin sync") + arguments _("[]") + description <<-'EOT' + Reads facts from the local system using facter gem. + EOT + returns "The output of facter with added puppet specific facts" + notes <<-'EOT' + + EOT + examples <<-'EOT' + retrieve facts: + + $ puppet facts show os + EOT + + option("--config-file " + _("")) do + default_to { nil } + summary _("The location of the config file for Facter.") + end + + option("--custom-dir " + _("")) do + default_to { nil } + summary _("The path to a directory that contains custom facts.") + end + + option("--external-dir " + _("")) do + default_to { nil } + summary _("The path to a directory that contains external facts.") + end + + option("--no-block") do + summary _("Disable fact blocking mechanism.") + end + + option("--no-cache") do + summary _("Disable fact caching mechanism.") + end + + option("--show-legacy") do + summary _("Show legacy facts when querying all facts.") + end + + render_as :json + + when_invoked do |*args| + options = args.pop + + Puppet.settings.preferred_run_mode = :agent + Puppet::Node::Facts.indirection.terminus_class = :facter + + + options[:user_query] = args + options[:resolve_options] = true + result = Puppet::Node::Facts.indirection.find(Puppet.settings[:certname], options) + + result.values + end + end end + diff --git a/lib/puppet/indirector/facts/facter.rb b/lib/puppet/indirector/facts/facter.rb index f57821c38b4..76e39563356 100644 --- a/lib/puppet/indirector/facts/facter.rb +++ b/lib/puppet/indirector/facts/facter.rb @@ -32,7 +32,13 @@ def find(request) # Initialize core Puppet facts, such as puppetversion Puppet.initialize_facts - result = Puppet::Node::Facts.new(request.key, Facter.to_hash) + result = if request.options[:resolve_options] + raise(Puppet::Error, _("puppet facts show requires version 4.0.40 or greater of Facter.")) unless Facter.respond_to?(:resolve) + find_with_options(request) + else + Puppet::Node::Facts.new(request.key, Facter.to_hash) + end + result.add_local_facts result.sanitize result @@ -61,7 +67,7 @@ def self.setup_search_paths(request) true end - + dirs << request.options[:custom_dir] if request.options[:custom_dir] Facter.search(*dirs) end @@ -83,6 +89,21 @@ def self.setup_external_search_paths(request) dirs << dir end + dirs << request.options[:external_dir] if request.options[:external_dir] Facter.search_external dirs end + + private + + def find_with_options(request) + options = request.options + options_for_facter = String.new + options_for_facter += options[:user_query].join(' ') + options_for_facter += " --config #{options[:config_file]}" if options[:config_file] + options_for_facter += " --show-legacy" if options[:show_legacy] + options_for_facter += " --no-block" if options[:no_block] == false + options_for_facter += " --no-cache" if options[:no_cache] == false + + Puppet::Node::Facts.new(request.key, Facter.resolve(options_for_facter)) + end end diff --git a/spec/unit/face/facts_spec.rb b/spec/unit/face/facts_spec.rb index 53da6bce0a1..1af99546da5 100644 --- a/spec/unit/face/facts_spec.rb +++ b/spec/unit/face/facts_spec.rb @@ -71,4 +71,8 @@ log.message =~ /Uploading facts for '.*' to 'puppet\.server\.test'/} end end + + describe "#show" do + it { is_expected.to be_action :show } + end end diff --git a/spec/unit/indirector/facts/facter_spec.rb b/spec/unit/indirector/facts/facter_spec.rb index 7a18dd803ac..abe7d3be930 100644 --- a/spec/unit/indirector/facts/facter_spec.rb +++ b/spec/unit/indirector/facts/facter_spec.rb @@ -29,6 +29,7 @@ @request = double('request', :key => @name) @environment = double('environment') allow(@request).to receive(:environment).and_return(@environment) + allow(@request).to receive(:options).and_return({}) allow(@request.environment).to receive(:modules).and_return([]) allow(@request.environment).to receive(:modulepath).and_return([]) end @@ -105,6 +106,7 @@ expect(FileTest).to receive(:directory?).with(factpath1).and_return(true) expect(FileTest).to receive(:directory?).with(factpath2).and_return(true) allow(@request.environment).to receive(:modulepath).and_return([modulepath]) + allow(@request).to receive(:options).and_return({}) expect(Dir).to receive(:glob).with("#{modulepath}/*/lib/facter").and_return([modulelibfacter]) expect(Dir).to receive(:glob).with("#{modulepath}/*/plugins/facter").and_return([modulepluginsfacter]) @@ -150,4 +152,93 @@ Puppet::Node::Facts::Facter.setup_external_search_paths @request end end + + describe 'when :resolve_options is true' do + let(:options) { { resolve_options: true, user_query: ["os", "timezone"], show_legacy: true } } + let(:facts) { Puppet::Node::Facts.new("foo") } + + before :each do + allow(@request).to receive(:options).and_return(options) + allow(Puppet::Node::Facts).to receive(:new).and_return(facts) + allow(Facter).to receive(:respond_to?).and_return(false) + allow(Facter).to receive(:respond_to?).with(:resolve).and_return(true) + allow(facts).to receive(:add_local_facts) + end + + it 'should call Facter.resolve method' do + expect(Facter).to receive(:resolve).with("os timezone --show-legacy") + @facter.find(@request) + end + + describe 'when Facter version is lower than 4.0.40' do + before :each do + allow(Facter).to receive(:respond_to?).and_return(false) + allow(Facter).to receive(:respond_to?).with(:resolve).and_return(false) + end + + it 'raises an error' do + expect { @facter.find(@request) }.to raise_error(Puppet::Error, "puppet facts show requires version 4.0.40 or greater of Facter.") + end + end + + describe 'when setting up external search paths' do + let(:options) { { resolve_options: true, user_query: ["os", "timezone"], external_dir: 'some/dir' } } + let(:pluginfactdest) { File.expand_path 'plugin/dest' } + let(:modulepath) { File.expand_path 'module/foo' } + let(:modulefactsd) { File.expand_path 'module/foo/facts.d' } + + before :each do + expect(FileTest).to receive(:directory?).with(pluginfactdest).and_return(true) + mod = Puppet::Module.new('foo', modulepath, @request.environment) + allow(@request.environment).to receive(:modules).and_return([mod]) + Puppet[:pluginfactdest] = pluginfactdest + end + + it 'should skip files' do + expect(File).to receive(:directory?).with(modulefactsd).and_return(false) + expect(Facter).to receive(:search_external).with([pluginfactdest, options[:external_dir]]) + Puppet::Node::Facts::Facter.setup_external_search_paths @request + end + + it 'should add directories' do + expect(File).to receive(:directory?).with(modulefactsd).and_return(true) + expect(Facter).to receive(:search_external).with([modulefactsd, pluginfactdest, options[:external_dir]]) + Puppet::Node::Facts::Facter.setup_external_search_paths @request + end + end + + describe 'when setting up search paths' do + let(:factpath1) { File.expand_path 'one' } + let(:factpath2) { File.expand_path 'two' } + let(:factpath) { [factpath1, factpath2].join(File::PATH_SEPARATOR) } + let(:modulepath) { File.expand_path 'module/foo' } + let(:modulelibfacter) { File.expand_path 'module/foo/lib/facter' } + let(:modulepluginsfacter) { File.expand_path 'module/foo/plugins/facter' } + let(:options) { { resolve_options: true, custom_dir: 'some/dir' } } + + before :each do + expect(FileTest).to receive(:directory?).with(factpath1).and_return(true) + expect(FileTest).to receive(:directory?).with(factpath2).and_return(true) + allow(@request.environment).to receive(:modulepath).and_return([modulepath]) + expect(Dir).to receive(:glob).with("#{modulepath}/*/lib/facter").and_return([modulelibfacter]) + expect(Dir).to receive(:glob).with("#{modulepath}/*/plugins/facter").and_return([modulepluginsfacter]) + + Puppet[:factpath] = factpath + end + + it 'should skip files' do + expect(FileTest).to receive(:directory?).with(modulelibfacter).and_return(false) + expect(FileTest).to receive(:directory?).with(modulepluginsfacter).and_return(false) + expect(Facter).to receive(:search).with(factpath1, factpath2, options[:custom_dir]) + Puppet::Node::Facts::Facter.setup_search_paths @request + end + + it 'should add directories' do + expect(FileTest).to receive(:directory?).with(modulelibfacter).and_return(true) + expect(FileTest).to receive(:directory?).with(modulepluginsfacter).and_return(false) + expect(Facter).to receive(:search).with(modulelibfacter, factpath1, factpath2, options[:custom_dir]) + Puppet::Node::Facts::Facter.setup_search_paths @request + end + end + end end From 4fba39caf69da3f8b425c0662aa09d09b6542b54 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Sat, 3 Oct 2020 00:36:35 +0000 Subject: [PATCH 186/731] (packaging) Updating the puppet.pot file --- locales/puppet.pot | 128 +++++++++++++++++++++++++++++---------------- 1 file changed, 82 insertions(+), 46 deletions(-) diff --git a/locales/puppet.pot b/locales/puppet.pot index 748907bc5e6..30542175fe4 100644 --- a/locales/puppet.pot +++ b/locales/puppet.pot @@ -6,11 +6,11 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Puppet automation framework 6.18.0-270-g715ac6903a\n" +"Project-Id-Version: Puppet automation framework 6.18.0-326-ga3da3cd354\n" "\n" "Report-Msgid-Bugs-To: https://tickets.puppetlabs.com\n" -"POT-Creation-Date: 2020-09-15 18:36+0000\n" -"PO-Revision-Date: 2020-09-15 18:36+0000\n" +"POT-Creation-Date: 2020-10-03 00:36+0000\n" +"PO-Revision-Date: 2020-10-03 00:36+0000\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -522,100 +522,100 @@ msgstr "" msgid "Cannot remove %{file}: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:72 +#: ../lib/puppet/configurer.rb:80 msgid "Using cached catalog from environment '%{environment}'" msgstr "" -#: ../lib/puppet/configurer.rb:78 +#: ../lib/puppet/configurer.rb:86 msgid "Not using cache on failed catalog" msgstr "" -#: ../lib/puppet/configurer.rb:87 +#: ../lib/puppet/configurer.rb:95 msgid "Not using cached catalog because its environment '%{catalog_env}' does not match '%{local_env}'" msgstr "" -#: ../lib/puppet/configurer.rb:92 ../lib/puppet/configurer.rb:174 +#: ../lib/puppet/configurer.rb:100 ../lib/puppet/configurer.rb:182 msgid "Using cached catalog from environment '%{catalog_env}'" msgstr "" -#: ../lib/puppet/configurer.rb:167 +#: ../lib/puppet/configurer.rb:175 msgid "Could not retrieve catalog; skipping run" msgstr "" -#: ../lib/puppet/configurer.rb:183 +#: ../lib/puppet/configurer.rb:191 msgid "Applied catalog in %{seconds} seconds" msgstr "" -#: ../lib/puppet/configurer.rb:217 ../lib/puppet/http/resolver/server_list.rb:78 +#: ../lib/puppet/configurer.rb:225 msgid "Could not select a functional puppet master from server_list: '%{server_list}'" msgstr "" -#: ../lib/puppet/configurer.rb:254 +#: ../lib/puppet/configurer.rb:262 msgid "Local environment: '%{local_env}' doesn't match the environment of the cached catalog '%{catalog_env}', switching agent to '%{catalog_env}'." msgstr "" -#: ../lib/puppet/configurer.rb:299 +#: ../lib/puppet/configurer.rb:307 msgid "Local environment: '%{local_env}' doesn't match server specified node environment '%{node_env}', switching agent to '%{node_env}'." msgstr "" -#: ../lib/puppet/configurer.rb:314 +#: ../lib/puppet/configurer.rb:322 msgid "Using configured environment '%{env}'" msgstr "" -#: ../lib/puppet/configurer.rb:318 +#: ../lib/puppet/configurer.rb:326 msgid "Unable to fetch my node definition, but the agent run will continue:" msgstr "" -#: ../lib/puppet/configurer.rb:346 +#: ../lib/puppet/configurer.rb:354 msgid "Not using catalog because its environment '%{catalog_env}' does not match agent specified environment '%{local_env}' and strict_environment_mode is set" msgstr "" -#: ../lib/puppet/configurer.rb:357 +#: ../lib/puppet/configurer.rb:365 msgid "Catalog environment didn't stabilize after %{tries} fetches, aborting run" msgstr "" -#: ../lib/puppet/configurer.rb:359 +#: ../lib/puppet/configurer.rb:367 msgid "Local environment: '%{local_env}' doesn't match server specified environment '%{catalog_env}', restarting agent run with environment '%{catalog_env}'" msgstr "" -#: ../lib/puppet/configurer.rb:400 +#: ../lib/puppet/configurer.rb:408 msgid "Failed to apply catalog: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:429 ../lib/puppet/http/resolver/server_list.rb:67 +#: ../lib/puppet/configurer.rb:437 ../lib/puppet/http/resolver/server_list.rb:67 msgid "Puppet server %{host}:%{port} is unavailable: %{code} %{reason}" msgstr "" #. TRANSLATORS 'server_list' is the name of a setting and should not be translated -#: ../lib/puppet/configurer.rb:433 ../lib/puppet/http/resolver/server_list.rb:72 +#: ../lib/puppet/configurer.rb:441 ../lib/puppet/http/resolver/server_list.rb:70 msgid "Unable to connect to server from server_list setting: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:444 ../lib/puppet/face/report.rb:47 +#: ../lib/puppet/configurer.rb:452 ../lib/puppet/face/report.rb:47 msgid "Could not send report: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:453 +#: ../lib/puppet/configurer.rb:461 msgid "Could not save last run local report: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:472 +#: ../lib/puppet/configurer.rb:480 msgid "Uploading facts for %{node} to %{server}" msgstr "" -#: ../lib/puppet/configurer.rb:480 +#: ../lib/puppet/configurer.rb:488 msgid "Failed to submit facts: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:495 +#: ../lib/puppet/configurer.rb:503 msgid "Could not run command from %{setting}: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:513 +#: ../lib/puppet/configurer.rb:521 msgid "Could not retrieve catalog from cache: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:534 +#: ../lib/puppet/configurer.rb:542 msgid "Could not retrieve catalog from remote server: %{detail}" msgstr "" @@ -1015,6 +1015,42 @@ msgstr "" msgid "Uploading facts for '%{node}' to '%{server}'" msgstr "" +#: ../lib/puppet/face/facts.rb:88 +msgid "Facter plugin sync" +msgstr "" + +#: ../lib/puppet/face/facts.rb:89 +msgid "[]" +msgstr "" + +#: ../lib/puppet/face/facts.rb:103 ../lib/puppet/face/facts.rb:108 ../lib/puppet/face/facts.rb:113 ../lib/puppet/face/module/changes.rb:21 +msgid "" +msgstr "" + +#: ../lib/puppet/face/facts.rb:105 +msgid "The location of the config file for Facter." +msgstr "" + +#: ../lib/puppet/face/facts.rb:110 +msgid "The path to a directory that contains custom facts." +msgstr "" + +#: ../lib/puppet/face/facts.rb:115 +msgid "The path to a directory that contains external facts." +msgstr "" + +#: ../lib/puppet/face/facts.rb:119 +msgid "Disable fact blocking mechanism." +msgstr "" + +#: ../lib/puppet/face/facts.rb:123 +msgid "Disable fact caching mechanism." +msgstr "" + +#: ../lib/puppet/face/facts.rb:127 +msgid "Show legacy facts when querying all facts." +msgstr "" + #: ../lib/puppet/face/generate.rb:9 msgid "Generates Puppet code from Ruby definitions." msgstr "" @@ -1136,10 +1172,6 @@ msgstr "" msgid "Array of strings representing paths of modified files." msgstr "" -#: ../lib/puppet/face/module/changes.rb:21 -msgid "" -msgstr "" - #: ../lib/puppet/face/module/changes.rb:27 msgid "Could not find a valid module at %{path}" msgstr "" @@ -2195,7 +2227,7 @@ msgstr "" msgid "Ignoring extra header \"%{name}\" as it has no value." msgstr "" -#: ../lib/puppet/http/service.rb:147 ../lib/puppet/indirector/rest.rb:54 +#: ../lib/puppet/http/service.rb:147 ../lib/puppet/indirector/rest.rb:53 msgid "No content type in http response; cannot parse" msgstr "" @@ -2441,7 +2473,11 @@ msgstr "" msgid "You cannot save facts to the code store; it is only used for getting facts from Facter" msgstr "" -#: ../lib/puppet/indirector/facts/facter.rb:56 +#: ../lib/puppet/indirector/facts/facter.rb:36 +msgid "puppet facts show requires version 4.0.40 or greater of Facter." +msgstr "" + +#: ../lib/puppet/indirector/facts/facter.rb:62 msgid "Loading facts" msgstr "" @@ -6266,7 +6302,7 @@ msgstr "" msgid "Could not list installed Packages: %{detail}" msgstr "" -#: ../lib/puppet/provider/package/aix.rb:156 ../lib/puppet/provider/package/yum.rb:332 +#: ../lib/puppet/provider/package/aix.rb:156 ../lib/puppet/provider/package/yum.rb:333 msgid "Tried to get latest on a missing package" msgstr "" @@ -6923,51 +6959,51 @@ msgstr "" msgid "Could not evaluate: %{detail}" msgstr "" -#: ../lib/puppet/resource/type.rb:86 +#: ../lib/puppet/resource/type.rb:87 msgid "Invalid resource supertype '%{type}'" msgstr "" -#: ../lib/puppet/resource/type.rb:116 +#: ../lib/puppet/resource/type.rb:117 msgid "%{name} is not a class; cannot add code to it" msgstr "" -#: ../lib/puppet/resource/type.rb:117 +#: ../lib/puppet/resource/type.rb:118 msgid "%{name} is not a class; cannot add code from it" msgstr "" -#: ../lib/puppet/resource/type.rb:121 +#: ../lib/puppet/resource/type.rb:122 msgid "Cannot have code outside of a class/node/define because 'freeze_main' is enabled" msgstr "" -#: ../lib/puppet/resource/type.rb:125 +#: ../lib/puppet/resource/type.rb:126 msgid "Cannot merge classes with different parent classes (%{name} => %{parent} vs. %{other_name} => %{other_parent})" msgstr "" -#: ../lib/puppet/resource/type.rb:156 +#: ../lib/puppet/resource/type.rb:157 msgid "Cannot create resources for defined resource types" msgstr "" -#: ../lib/puppet/resource/type.rb:209 +#: ../lib/puppet/resource/type.rb:210 msgid "Could not find parent resource type '%{parent}' of type %{parent_type} in %{env}" msgstr "" -#: ../lib/puppet/resource/type.rb:335 +#: ../lib/puppet/resource/type.rb:336 msgid "Parameter '%{name}' is given a type, but is not a valid parameter." msgstr "" -#: ../lib/puppet/resource/type.rb:338 +#: ../lib/puppet/resource/type.rb:339 msgid "Parameter '%{name}' is given a type that is not a Puppet Type, got %{class_name}" msgstr "" -#: ../lib/puppet/resource/type.rb:372 +#: ../lib/puppet/resource/type.rb:373 msgid "Could not find scope for %{class_name}" msgstr "" -#: ../lib/puppet/resource/type.rb:393 +#: ../lib/puppet/resource/type.rb:394 msgid "%{param} is a metaparam; this value will inherit to all contained resources in the %{name} definition" msgstr "" -#: ../lib/puppet/resource/type.rb:395 +#: ../lib/puppet/resource/type.rb:396 msgid "%{param} is a metaparameter; please choose another parameter name in the %{name} definition" msgstr "" From 22a787b6c7d5533fe9bb2704417286ad898b103d Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Sat, 3 Oct 2020 00:37:58 +0000 Subject: [PATCH 187/731] (packaging) Updating manpage file for main --- man/man8/puppet-facts.8 | 49 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/man/man8/puppet-facts.8 b/man/man8/puppet-facts.8 index 80b334c8524..8078d92e77e 100644 --- a/man/man8/puppet-facts.8 +++ b/man/man8/puppet-facts.8 @@ -101,6 +101,46 @@ puppet facts save [\-\-terminus _TERMINUS] [\-\-extra HASH] \fIkey\fR API only: create or overwrite an object\. As the Faces framework does not currently accept data from STDIN, save actions cannot currently be invoked from the command line\. . .TP +\fBshow\fR \- Facter plugin sync +\fBSYNOPSIS\fR +. +.IP +puppet facts show [\-\-terminus _TERMINUS] [\-\-extra HASH] [\-\-config\-file \fIpath\fR] [\-\-custom\-dir \fIpath\fR] [\-\-external\-dir \fIpath\fR] [\-\-no\-block] [\-\-no\-cache] [\-\-show\-legacy] [\fIfacts\fR] +. +.IP +\fBDESCRIPTION\fR +. +.IP +Reads facts from the local system using facter gem\. +. +.IP +\fBOPTIONS\fR \fI\-\-config\-file \- The location of the config file for Facter\. +. +.IP +\fI\-\-custom\-dir \- The path to a directory that contains custom facts\. +. +.IP +\fI\-\-external\-dir \- The path to a directory that contains external facts\. +. +.IP +\fI\-\-no\-block\fR \- Disable fact blocking mechanism\. +. +.IP +\fI\-\-no\-cache\fR \- Disable fact caching mechanism\. +. +.IP +\fI\-\-show\-legacy\fR \- Show legacy facts when querying all facts\. +. +.IP +\fBRETURNS\fR +. +.IP +The output of facter with added puppet specific facts +. +.IP +\fBNOTES\fR +. +.TP \fBupload\fR \- Upload local facts to the puppet master\. \fBSYNOPSIS\fR . @@ -141,6 +181,15 @@ Get facts from the local system: $ puppet facts find . .P +\fBshow\fR +. +.P +retrieve facts: +. +.P +$ puppet facts show os +. +.P \fBupload\fR . .P From 14420d367345ce0d9c40010da4ecdfb3f3e4730b Mon Sep 17 00:00:00 2001 From: gimmy Date: Mon, 5 Oct 2020 14:02:57 +0300 Subject: [PATCH 188/731] (PUP-8682) Allow disabling of settings catalog This commit adds a new setting `settings_catalog` which defaults to `true`. This settings can is used to configuer if Puppet will compile and apply the settings catalog when `Puppet.settings.use(*sections)` is used. --- lib/puppet/defaults.rb | 5 ++++ lib/puppet/settings.rb | 52 ++++++++++++++++++++------------------ spec/unit/settings_spec.rb | 17 +++++++++++++ 3 files changed, 50 insertions(+), 24 deletions(-) diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb index 0a8fe77460e..3b35736aae6 100644 --- a/lib/puppet/defaults.rb +++ b/lib/puppet/defaults.rb @@ -255,6 +255,11 @@ def self.initialize_default_settings!(settings) which occurs only on a Puppet Server master when the `code-id-command` and `code-content-command` settings are configured in its `puppetserver.conf` file.", }, + :settings_catalog => { + :default => true, + :type => :boolean, + :desc => "Whether to compile and apply the settings catalog", + }, :strict_environment_mode => { :default => false, :type => :boolean, diff --git a/lib/puppet/settings.rb b/lib/puppet/settings.rb index 78b9ed686bb..29d594bac72 100644 --- a/lib/puppet/settings.rb +++ b/lib/puppet/settings.rb @@ -1054,36 +1054,40 @@ def to_manifest # Create the necessary objects to use a section. This is idempotent; # you can 'use' a section as many times as you want. def use(*sections) - sections = sections.collect { |s| s.to_sym } - sections = sections.reject { |s| @used.include?(s) } + if Puppet[:settings_catalog] + sections = sections.collect { |s| s.to_sym } + sections = sections.reject { |s| @used.include?(s) } - return if sections.empty? + return if sections.empty? - Puppet.debug { "Applying settings catalog for sections #{sections.join(', ')}" } + Puppet.debug { "Applying settings catalog for sections #{sections.join(', ')}" } - begin - catalog = to_catalog(*sections).to_ral - rescue => detail - Puppet.log_and_raise(detail, "Could not create resources for managing Puppet's files and directories in sections #{sections.inspect}: #{detail}") - end - - catalog.host_config = false - catalog.apply do |transaction| - if transaction.any_failed? - report = transaction.report - status_failures = report.resource_statuses.values.select { |r| r.failed? } - status_fail_msg = status_failures. - collect(&:events). - flatten. - select { |event| event.status == 'failure' }. - collect { |event| "#{event.resource}: #{event.message}" }.join("; ") + begin + catalog = to_catalog(*sections).to_ral + rescue => detail + Puppet.log_and_raise(detail, "Could not create resources for managing Puppet's files and directories in sections #{sections.inspect}: #{detail}") + end - raise "Got #{status_failures.length} failure(s) while initializing: #{status_fail_msg}" + catalog.host_config = false + catalog.apply do |transaction| + if transaction.any_failed? + report = transaction.report + status_failures = report.resource_statuses.values.select { |r| r.failed? } + status_fail_msg = status_failures. + collect(&:events). + flatten. + select { |event| event.status == 'failure' }. + collect { |event| "#{event.resource}: #{event.message}" }.join("; ") + + raise "Got #{status_failures.length} failure(s) while initializing: #{status_fail_msg}" + end end - end - sections.each { |s| @used << s } - @used.uniq! + sections.each { |s| @used << s } + @used.uniq! + else + Puppet.debug("Skipping settings catalog for sections #{sections.join(', ')}") + end end def valid?(param) diff --git a/spec/unit/settings_spec.rb b/spec/unit/settings_spec.rb index ef6a484856b..a81c78cfc51 100644 --- a/spec/unit/settings_spec.rb +++ b/spec/unit/settings_spec.rb @@ -1654,6 +1654,23 @@ def assert_accessing_setting_is_deprecated(settings, setting) end end + describe 'when settings_catalog is disabled' do + let(:settings) { Puppet::Settings.new } + before do + allow(Puppet).to receive(:[]).with(:settings_catalog).and_return(false) + end + + it 'does not compile and apply settings catalog' do + expect(settings).not_to receive(:to_catalog) + settings.use(:main) + end + + it 'logs a message that settings catalog is skipped' do + expect(Puppet).to receive(:debug).with('Skipping settings catalog for sections main') + settings.use(:main) + end + end + describe "when dealing with printing configs" do before do @settings = Puppet::Settings.new From 7b3931d4f69b78637171343c98f12dd2c656bda7 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Tue, 6 Oct 2020 17:23:26 -0700 Subject: [PATCH 189/731] (PUP-10598) Update expectation when puppet agent fails Prior to PUP-10598, puppet would ignore the pluginsync errors due to the non-existent environment on the server and would fail when trying to request a catalog. As of PUP-10598, puppet will fail on the first pluginsync error, so the error message is different. The overall behavior is similar though. The cached catalog is ignored since `puppet agent --test` implies `--no-usecacheonfailure`. --- acceptance/tests/environment/environment_scenario-bad.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/acceptance/tests/environment/environment_scenario-bad.rb b/acceptance/tests/environment/environment_scenario-bad.rb index 5ab6c3e3826..30dd7e644d2 100644 --- a/acceptance/tests/environment/environment_scenario-bad.rb +++ b/acceptance/tests/environment/environment_scenario-bad.rb @@ -58,12 +58,12 @@ } agents.each do |host| - unless host['locale'] == 'ja' + if host['locale'] != 'ja' expectations[:puppet_agent][:matches] = [%r{(Warning|Error).*(404|400).*Could not find environment '#{env}'}, - %r{Could not retrieve catalog; skipping run}] + %r{Error: Failed to apply catalog: Failed to retrieve}] end end assert_review(review_results(results, expectations)) end -end \ No newline at end of file +end From eba376ccbcadc5a92504098854513cc6d6b45849 Mon Sep 17 00:00:00 2001 From: Ciprian Badescu Date: Wed, 7 Oct 2020 09:52:16 +0300 Subject: [PATCH 190/731] Revert "(maint) increment report schema" This reverts commit dd3887a88d26e22efc50fef190c9f4f9ba07880a. --- api/schemas/report.json | 7 +++---- lib/puppet/transaction/report.rb | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/api/schemas/report.json b/api/schemas/report.json index df4af20fa25..cd4b8a1c827 100644 --- a/api/schemas/report.json +++ b/api/schemas/report.json @@ -111,12 +111,11 @@ }, "cached_catalog_status": { - "description": "Whether a cached catalog was used, and if so, why it was used. Enumerator with one of the values:\n\n* `not_used`, if a cached catalog was not used.\n* `explicitly_requested`, if a cached catalog was used because the use_cached_catalog option was set.\n* `on_failure`, if a cached catalog was used because the usecacheonfailure setting was set and the agent failed to download a new catalog. \n* `on_pluginsync_failure`, if a cached catalog was used because the usecacheonfailure setting was set and the pluginsync failed while having ignore_plugin_errors set to false.", + "description": "Whether a cached catalog was used, and if so, why it was used. Enumerator with one of the values:\n\n* `not_used`, if a cached catalog was not used.\n* `explicitly_requested`, if a cached catalog was used because the use_cached_catalog option was set.\n* `on_failure`, if a cached catalog was used because the usecacheonfailure setting was set and the agent failed to download a new catalog", "enum": [ "not_used", "explicitly_requested", - "on_failure", - "on_pluginsync_failure" + "on_failure" ] }, @@ -128,7 +127,7 @@ "report_format": { "description": "The report format version documented by this schema", "type": "integer", - "enum": ["11", 11] + "enum": ["10", 10] }, "puppet_version": { diff --git a/lib/puppet/transaction/report.rb b/lib/puppet/transaction/report.rb index 5b10b7774b6..7d4456ff682 100644 --- a/lib/puppet/transaction/report.rb +++ b/lib/puppet/transaction/report.rb @@ -224,7 +224,7 @@ def initialize(configuration_version=nil, environment=nil, transaction_uuid=nil, @external_times ||= {} @host = Puppet[:node_name_value] @time = start_time - @report_format = 11 + @report_format = 10 @puppet_version = Puppet.version @configuration_version = configuration_version @transaction_uuid = transaction_uuid From fb30b8e01b3f173380f033518a16dfb645313f21 Mon Sep 17 00:00:00 2001 From: Ciprian Badescu Date: Wed, 7 Oct 2020 09:54:53 +0300 Subject: [PATCH 191/731] (maint) revert showing specific error details in cached_catalog_status While fixing `ignore_plugin_errors`/`usecacheonfailure` interaction a new specific value was added for cached_catalog_status. This new value does not bring enough benefit vs complexity, reverting to using generic `on_failure` value --- lib/puppet/configurer.rb | 2 +- spec/integration/configurer_spec.rb | 2 +- spec/unit/configurer_spec.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/puppet/configurer.rb b/lib/puppet/configurer.rb index 4c1c9fa598f..bbdda35170e 100644 --- a/lib/puppet/configurer.rb +++ b/lib/puppet/configurer.rb @@ -74,7 +74,7 @@ def retrieve_catalog(facts, query_options) if Puppet[:use_cached_catalog] @cached_catalog_status = 'explicitly_requested' elsif @pluginsync_failed - @cached_catalog_status = 'on_pluginsync_failure' + @cached_catalog_status = 'on_failure' end Puppet.info _("Using cached catalog from environment '%{environment}'") % { environment: result.environment } diff --git a/spec/integration/configurer_spec.rb b/spec/integration/configurer_spec.rb index 8a29a3dd622..1c60a22b041 100644 --- a/spec/integration/configurer_spec.rb +++ b/spec/integration/configurer_spec.rb @@ -71,7 +71,7 @@ expect(Puppet::Resource::Catalog.indirection).to receive(:find).and_return(@catalog) @configurer.run(pluginsync: true, report: report) - expect(report.cached_catalog_status).to eq('on_pluginsync_failure') + expect(report.cached_catalog_status).to eq('on_failure') end describe 'resubmitting facts' do diff --git a/spec/unit/configurer_spec.rb b/spec/unit/configurer_spec.rb index 09cb150c625..57166c3b9d8 100644 --- a/spec/unit/configurer_spec.rb +++ b/spec/unit/configurer_spec.rb @@ -119,7 +119,7 @@ ) expect(configurer.run(pluginsync: true, :report => report)).to eq(0) - expect(report.cached_catalog_status).to eq('on_pluginsync_failure') + expect(report.cached_catalog_status).to eq('on_failure') end it "applies a cached catalog when it can't connect to the master" do From e06b87a71b09e7598182c9753f6151bd4155e659 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Wed, 7 Oct 2020 16:37:53 +0000 Subject: [PATCH 192/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index a2249cf7031..4d967a1c767 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -1673,6 +1673,14 @@ The list of Puppet master servers to which the Puppet agent should connect, in t . .IP "" 0 . +.SS "settings_catalog" +Whether to compile and apply the settings catalog +. +.IP "\(bu" 4 +\fIDefault\fR: true +. +.IP "" 0 +. .SS "show_diff" Whether to log and report a contextual diff when files are being replaced\. This causes partial file contents to pass through Puppet\'s normal logging and reporting system, so this setting should be used with caution if you are sending Puppet\'s reports to an insecure destination\. This feature currently requires the \fBdiff/lcs\fR Ruby library\. . From e89aa76eb2b34ec3e504af732acae14226024d43 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Wed, 7 Oct 2020 19:23:03 +0000 Subject: [PATCH 193/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index 4d967a1c767..fb1c2933c4c 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -149,7 +149,7 @@ The name to use the Certificate Authority certificate\. The port to use for the certificate authority\. . .IP "\(bu" 4 -\fIDefault\fR: $masterport +\fIDefault\fR: $serverport . .IP "" 0 . @@ -1149,7 +1149,7 @@ Setting a global value for \fBmanifest\fR in puppet\.conf is not allowed (but it The default port puppet subcommands use to communicate with Puppet Server\. (eg \fBpuppet facts upload\fR, \fBpuppet agent\fR)\. May be overridden by more specific settings (see \fBca_port\fR, \fBreport_port\fR)\. . .IP "\(bu" 4 -\fIDefault\fR: 8140 +\fIDefault\fR: $serverport . .IP "" 0 . @@ -1535,7 +1535,7 @@ Whether the \'http\' report processor should include the system certificate stor The port to communicate with the report_server\. . .IP "\(bu" 4 -\fIDefault\fR: $masterport +\fIDefault\fR: $serverport . .IP "" 0 . @@ -1673,6 +1673,14 @@ The list of Puppet master servers to which the Puppet agent should connect, in t . .IP "" 0 . +.SS "serverport" +The default port puppet subcommands use to communicate with Puppet Server\. (eg \fBpuppet facts upload\fR, \fBpuppet agent\fR)\. May be overridden by more specific settings (see \fBca_port\fR, \fBreport_port\fR)\. +. +.IP "\(bu" 4 +\fIDefault\fR: 8140 +. +.IP "" 0 +. .SS "settings_catalog" Whether to compile and apply the settings catalog . From 2b8f2a3ad41abf6204f91ad42d62350018141620 Mon Sep 17 00:00:00 2001 From: Gabriel Nagy Date: Fri, 9 Oct 2020 16:04:56 +0300 Subject: [PATCH 194/731] (maint) Skip SSL spec when openssl >= 1.1.1h More details in https://tickets.puppetlabs.com/browse/PUP-10689 --- spec/unit/ssl/ssl_provider_spec.rb | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/spec/unit/ssl/ssl_provider_spec.rb b/spec/unit/ssl/ssl_provider_spec.rb index 7c2b611d40a..8c1dd7e2d3d 100644 --- a/spec/unit/ssl/ssl_provider_spec.rb +++ b/spec/unit/ssl/ssl_provider_spec.rb @@ -271,14 +271,17 @@ end # This option is only available in openssl 1.1 - it 'raises if root cert signature is invalid', if: defined?(OpenSSL::X509::V_FLAG_CHECK_SS_SIGNATURE) do - ca = global_cacerts.first - ca.sign(wrong_key, OpenSSL::Digest::SHA256.new) - - expect { - subject.create_context(**config.merge(cacerts: global_cacerts)) - }.to raise_error(Puppet::SSL::CertVerifyError, - "Invalid signature for certificate 'CN=Test CA'") + # TODO PUP-10689 behavior changed in openssl 1.1.1h + if Puppet::Util::Package.versioncmp(OpenSSL::OPENSSL_LIBRARY_VERSION.split[1], '1.1.1h') < 0 + it 'raises if root cert signature is invalid', if: defined?(OpenSSL::X509::V_FLAG_CHECK_SS_SIGNATURE) do + ca = global_cacerts.first + ca.sign(wrong_key, OpenSSL::Digest::SHA256.new) + + expect { + subject.create_context(**config.merge(cacerts: global_cacerts)) + }.to raise_error(Puppet::SSL::CertVerifyError, + "Invalid signature for certificate 'CN=Test CA'") + end end it 'raises if intermediate CA signature is invalid' do From 59ca6f7700a79e6179ba47c016449f8e03e5289f Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Fri, 9 Oct 2020 19:37:24 +0000 Subject: [PATCH 195/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 34 +++++++++++++++++++++++----------- man/man8/puppet-agent.8 | 7 ++----- 2 files changed, 25 insertions(+), 16 deletions(-) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index fb1c2933c4c..35aad237b1a 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -149,7 +149,7 @@ The name to use the Certificate Authority certificate\. The port to use for the certificate authority\. . .IP "\(bu" 4 -\fIDefault\fR: $serverport +\fIDefault\fR: $masterport . .IP "" 0 . @@ -615,6 +615,26 @@ Any value other than \fB0\fR or \fBunlimited\fR is deprecated, since most Puppet . .IP "" 0 . +.SS "environment_ttl" +How long after the last access Puppet server will wait to evict an environment from the environment cache\. +. +.P +A value of \fB0\fR will disable caching\. This setting can also be set to \fBunlimited\fR, which will cache environments until the server is restarted or told to refresh the cache\. All other values will result in Puppet server evicting environments that have not been accessed within that ttl\. +. +.P +You should change this setting once your Puppet deployment is doing non\-trivial work\. We chose the default value of \fB0\fR because it lets new users update their code without any extra steps, but it lowers the performance of your Puppet server\. +. +.P +We recommend setting this to a number that will keep your most actively used environments cached, but allow testing environments to fall out of the cache and reduce memory usage\. A value of 3 minutes (3m) is a reasonable value\. +. +.P +Once you set \fBenvironment_ttl\fR to a non\-zero value, you need to tell Puppet server to read new code from disk using the \fBenvironment\-cache\fR API endpoint after you deploy new code\. See the docs for the Puppet Server administrative API \fIhttps://puppet\.com/docs/puppetserver/latest/admin\-api/v1/environment\-cache\.html\fR\. +. +.IP "\(bu" 4 +\fIDefault\fR: 0 +. +.IP "" 0 +. .SS "environmentpath" A search path for directory environments, as a list of directories separated by the system path separator character\. (The POSIX path separator is \':\', and the Windows path separator is \';\'\.) . @@ -1149,7 +1169,7 @@ Setting a global value for \fBmanifest\fR in puppet\.conf is not allowed (but it The default port puppet subcommands use to communicate with Puppet Server\. (eg \fBpuppet facts upload\fR, \fBpuppet agent\fR)\. May be overridden by more specific settings (see \fBca_port\fR, \fBreport_port\fR)\. . .IP "\(bu" 4 -\fIDefault\fR: $serverport +\fIDefault\fR: 8140 . .IP "" 0 . @@ -1535,7 +1555,7 @@ Whether the \'http\' report processor should include the system certificate stor The port to communicate with the report_server\. . .IP "\(bu" 4 -\fIDefault\fR: $serverport +\fIDefault\fR: $masterport . .IP "" 0 . @@ -1673,14 +1693,6 @@ The list of Puppet master servers to which the Puppet agent should connect, in t . .IP "" 0 . -.SS "serverport" -The default port puppet subcommands use to communicate with Puppet Server\. (eg \fBpuppet facts upload\fR, \fBpuppet agent\fR)\. May be overridden by more specific settings (see \fBca_port\fR, \fBreport_port\fR)\. -. -.IP "\(bu" 4 -\fIDefault\fR: 8140 -. -.IP "" 0 -. .SS "settings_catalog" Whether to compile and apply the settings catalog . diff --git a/man/man8/puppet-agent.8 b/man/man8/puppet-agent.8 index 9182ab6763b..b15688aa1c1 100644 --- a/man/man8/puppet-agent.8 +++ b/man/man8/puppet-agent.8 @@ -13,7 +13,7 @@ Retrieves the client configuration from the Puppet master and applies it to the This service may be run as a daemon, run periodically using cron (or something similar), or run interactively for testing purposes\. . .SH "USAGE" -puppet agent [\-\-certname \fINAME\fR] [\-D|\-\-daemonize|\-\-no\-daemonize] [\-d|\-\-debug] [\-\-detailed\-exitcodes] [\-\-digest \fIDIGEST\fR] [\-\-disable [MESSAGE]] [\-\-enable] [\-\-fingerprint] [\-h|\-\-help] [\-l|\-\-logdest syslog|eventlog|\fIABS FILEPATH\fR|console] [\-\-serverport \fIPORT\fR] [\-\-noop] [\-o|\-\-onetime] [\-\-sourceaddress \fIIP_ADDRESS\fR] [\-t|\-\-test] [\-v|\-\-verbose] [\-V|\-\-version] [\-w|\-\-waitforcert \fISECONDS\fR] +puppet agent [\-\-certname \fINAME\fR] [\-D|\-\-daemonize|\-\-no\-daemonize] [\-d|\-\-debug] [\-\-detailed\-exitcodes] [\-\-digest \fIDIGEST\fR] [\-\-disable [MESSAGE]] [\-\-enable] [\-\-fingerprint] [\-h|\-\-help] [\-l|\-\-logdest syslog|eventlog|\fIABS FILEPATH\fR|console] [\-\-masterport \fIPORT\fR] [\-\-noop] [\-o|\-\-onetime] [\-\-sourceaddress \fIIP_ADDRESS\fR] [\-t|\-\-test] [\-v|\-\-verbose] [\-V|\-\-version] [\-w|\-\-waitforcert \fISECONDS\fR] . .SH "DESCRIPTION" This is the main puppet client\. Its job is to retrieve the local machine\'s configuration from a remote server and apply it\. In order to successfully communicate with the remote server, the client must have a certificate signed by a certificate authority that the server trusts; the recommended method for this, at the moment, is to run a certificate authority as part of the puppet server (which is the default)\. The client will connect and request a signed certificate, and will continue connecting until it receives one\. @@ -135,7 +135,7 @@ A path ending with \'\.json\' will receive structured output in JSON format\. Th A path ending with \'\.jsonl\' will receive structured output in JSON Lines format\. . .IP "\(bu" 4 -\-\-masterport: The port on which to contact the Puppet Server\. (This is a Puppet setting, and can go in puppet\.conf\. Deprecated in favor of the \'serverport\' setting\.) +\-\-masterport: The port on which to contact the puppet master\. (This is a Puppet setting, and can go in puppet\.conf\.) . .IP "\(bu" 4 \-\-noop: Use \'noop\' mode where the daemon runs in a no\-op or dry\-run mode\. This is useful for seeing what changes Puppet would make without actually executing the changes\. (This is a Puppet setting, and can go in puppet\.conf\. Note the special \'no\-\' prefix for boolean settings on the command line\.) @@ -144,9 +144,6 @@ A path ending with \'\.jsonl\' will receive structured output in JSON Lines form \-\-onetime: Run the configuration once\. Runs a single (normally daemonized) Puppet run\. Useful for interactively running puppet agent when used in conjunction with the \-\-no\-daemonize option\. (This is a Puppet setting, and can go in puppet\.conf\. Note the special \'no\-\' prefix for boolean settings on the command line\.) . .IP "\(bu" 4 -\-\-serverport: The port on which to contact the Puppet Server\. (This is a Puppet setting, and can go in puppet\.conf\.) -. -.IP "\(bu" 4 \-\-sourceaddress: Set the source IP address for transactions\. This defaults to automatically selected\. (This is a Puppet setting, and can go in puppet\.conf\.) . .IP "\(bu" 4 From e813e2078ec58286969dafa7072c20c1003e1a89 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Sat, 10 Oct 2020 22:51:43 +0000 Subject: [PATCH 196/731] (packaging) Updating the puppet.pot file --- locales/puppet.pot | 54 +++++++++++++++++++++++----------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/locales/puppet.pot b/locales/puppet.pot index 30542175fe4..ea534a4a5e2 100644 --- a/locales/puppet.pot +++ b/locales/puppet.pot @@ -6,11 +6,11 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Puppet automation framework 6.18.0-326-ga3da3cd354\n" +"Project-Id-Version: Puppet automation framework 6.18.0-385-g4f90b0dfd8\n" "\n" "Report-Msgid-Bugs-To: https://tickets.puppetlabs.com\n" -"POT-Creation-Date: 2020-10-03 00:36+0000\n" -"PO-Revision-Date: 2020-10-03 00:36+0000\n" +"POT-Creation-Date: 2020-10-10 22:51+0000\n" +"PO-Revision-Date: 2020-10-10 22:51+0000\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -547,7 +547,7 @@ msgid "Applied catalog in %{seconds} seconds" msgstr "" #: ../lib/puppet/configurer.rb:225 -msgid "Could not select a functional puppet master from server_list: '%{server_list}'" +msgid "Could not select a functional puppet server from server_list: '%{server_list}'" msgstr "" #: ../lib/puppet/configurer.rb:262 @@ -692,30 +692,30 @@ msgid "Valid values are '%{values}'." msgstr "" #. TRANSLATORS 'data_binding_terminus' is a setting and should not be translated -#: ../lib/puppet/defaults.rb:517 +#: ../lib/puppet/defaults.rb:522 msgid "Setting 'data_binding_terminus' is deprecated." msgstr "" #. TRANSLATORS 'hiera' should not be translated -#: ../lib/puppet/defaults.rb:519 +#: ../lib/puppet/defaults.rb:524 msgid "Convert custom terminus to hiera 5 API." msgstr "" #. TRANSLATORS 'environment_data_provider' is a setting and should not be translated -#: ../lib/puppet/defaults.rb:718 +#: ../lib/puppet/defaults.rb:747 msgid "Setting 'environment_data_provider' is deprecated." msgstr "" -#: ../lib/puppet/defaults.rb:801 +#: ../lib/puppet/defaults.rb:830 msgid "Certificate names must be lower case" msgstr "" -#: ../lib/puppet/defaults.rb:1051 ../lib/puppet/settings/enum_setting.rb:13 ../lib/puppet/settings/symbolic_enum_setting.rb:14 +#: ../lib/puppet/defaults.rb:1080 ../lib/puppet/settings/enum_setting.rb:13 ../lib/puppet/settings/symbolic_enum_setting.rb:14 msgid "Invalid value '%{value}' for parameter %{name}. Allowed values are '%{allowed_values}'" msgstr "" #. TRANSLATORS 'pluginsync' is a setting and should not be translated -#: ../lib/puppet/defaults.rb:1877 +#: ../lib/puppet/defaults.rb:1906 msgid "Setting 'pluginsync' is deprecated." msgstr "" @@ -6382,27 +6382,27 @@ msgstr "" msgid "source is defined but does not have trailing slash, ignoring %{source}" msgstr "" -#: ../lib/puppet/provider/package/gem.rb:102 ../lib/puppet/provider/package/puppetserver_gem.rb:61 +#: ../lib/puppet/provider/package/gem.rb:122 ../lib/puppet/provider/package/puppetserver_gem.rb:61 msgid "Could not list gems: %{detail}" msgstr "" -#: ../lib/puppet/provider/package/gem.rb:128 +#: ../lib/puppet/provider/package/gem.rb:148 msgid "Could not match %{desc}" msgstr "" -#: ../lib/puppet/provider/package/gem.rb:206 ../lib/puppet/provider/package/puppetserver_gem.rb:93 +#: ../lib/puppet/provider/package/gem.rb:226 ../lib/puppet/provider/package/puppetserver_gem.rb:93 msgid "Invalid source '%{uri}': %{detail}" msgstr "" -#: ../lib/puppet/provider/package/gem.rb:217 ../lib/puppet/provider/package/puppetserver_gem.rb:104 +#: ../lib/puppet/provider/package/gem.rb:237 ../lib/puppet/provider/package/puppetserver_gem.rb:104 msgid "puppet:// URLs are not supported as gem sources" msgstr "" -#: ../lib/puppet/provider/package/gem.rb:233 ../lib/puppet/provider/package/puppetserver_gem.rb:115 +#: ../lib/puppet/provider/package/gem.rb:253 ../lib/puppet/provider/package/puppetserver_gem.rb:115 msgid "Could not install: %{output}" msgstr "" -#: ../lib/puppet/provider/package/gem.rb:259 ../lib/puppet/provider/package/puppetserver_gem.rb:125 +#: ../lib/puppet/provider/package/gem.rb:279 ../lib/puppet/provider/package/puppetserver_gem.rb:125 msgid "Could not uninstall: %{output}" msgstr "" @@ -7055,49 +7055,49 @@ msgstr "" msgid "Invalid setting type '%{type}'" msgstr "" -#: ../lib/puppet/settings.rb:895 +#: ../lib/puppet/settings.rb:904 msgid "Unknown searchpath case: %{source_type} for the %{source} settings path element." msgstr "" -#: ../lib/puppet/settings.rb:958 +#: ../lib/puppet/settings.rb:967 msgid "setting definition for '%{name}' is not a hash!" msgstr "" -#: ../lib/puppet/settings.rb:963 +#: ../lib/puppet/settings.rb:972 msgid "Setting %{name} is already defined" msgstr "" -#: ../lib/puppet/settings.rb:969 +#: ../lib/puppet/settings.rb:978 msgid "Setting %{name} is already using short name '%{short}'" msgstr "" -#: ../lib/puppet/settings.rb:1228 +#: ../lib/puppet/settings.rb:1241 msgid "Setting %{name} is deprecated." msgstr "" #. TRANSLATORS 'puppet.conf' is a file name and should not be translated -#: ../lib/puppet/settings.rb:1233 +#: ../lib/puppet/settings.rb:1246 msgid "Setting %{name} is deprecated in puppet.conf." msgstr "" -#: ../lib/puppet/settings.rb:1404 +#: ../lib/puppet/settings.rb:1417 msgid "Error converting value for param '%{name}': %{detail}" msgstr "" -#: ../lib/puppet/settings.rb:1428 +#: ../lib/puppet/settings.rb:1441 msgid "Could not find value for %{expression}" msgstr "" #. TRANSLATORS '$environment' is a Puppet specific variable and should not be translated -#: ../lib/puppet/settings.rb:1438 +#: ../lib/puppet/settings.rb:1451 msgid "You cannot interpolate $environment within '%{setting_name}' when using directory environments." msgstr "" -#: ../lib/puppet/settings.rb:1439 +#: ../lib/puppet/settings.rb:1452 msgid "Its value will remain %{value}." msgstr "" -#: ../lib/puppet/settings.rb:1470 +#: ../lib/puppet/settings.rb:1483 msgid "Attempt to assign a value to unknown setting %{name}" msgstr "" From 8112327d45944db46db8fd74f06aa20db00e820d Mon Sep 17 00:00:00 2001 From: gimmy Date: Thu, 8 Oct 2020 15:19:03 +0300 Subject: [PATCH 197/731] (PUP-10673) Call simple server status endpoint This commit updates the path of simple server status to `/status/v1/simple/server`. If this returns 404 it calls `/status/v1/simple/server` to ensure backwards compatibility. --- lib/puppet/http/service/puppetserver.rb | 23 +++++++++---- spec/integration/application/agent_spec.rb | 4 +-- spec/lib/puppet_spec/puppetserver.rb | 2 +- spec/unit/application/filebucket_spec.rb | 10 +++--- spec/unit/configurer_spec.rb | 10 +++--- spec/unit/http/resolver_spec.rb | 26 +++++++------- spec/unit/http/service/puppetserver_spec.rb | 38 ++++++++++++++++++--- spec/unit/http/session_spec.rb | 12 +++---- 8 files changed, 84 insertions(+), 41 deletions(-) diff --git a/lib/puppet/http/service/puppetserver.rb b/lib/puppet/http/service/puppetserver.rb index f7babef5247..dd0e867f7d5 100644 --- a/lib/puppet/http/service/puppetserver.rb +++ b/lib/puppet/http/service/puppetserver.rb @@ -26,13 +26,24 @@ def initialize(client, session, server, port) # @api private # def get_simple_status(ssl_context: nil) - response = @client.get( - with_base_url("/status/v1/simple/master"), - headers: add_puppet_headers({}), - options: {ssl_context: ssl_context} - ) + request_path = "/status/v1/simple/server" - process_response(response) + begin + response = @client.get( + with_base_url(request_path), + headers: add_puppet_headers({}), + options: {ssl_context: ssl_context} + ) + + process_response(response) + rescue Puppet::HTTP::ResponseError => e + if e.response.code == 404 && e.response.url.path == "/status/v1/simple/server" + request_path = "/status/v1/simple/master" + retry + else + raise e + end + end [response, response.body.to_s] end diff --git a/spec/integration/application/agent_spec.rb b/spec/integration/application/agent_spec.rb index 3defcad31bd..9a7fa85a228 100644 --- a/spec/integration/application/agent_spec.rb +++ b/spec/integration/application/agent_spec.rb @@ -25,7 +25,7 @@ agent.command_line.args << '--test' agent.run }.to exit_with(0) - .and output(%r{HTTP GET https://127.0.0.1:#{port}/status/v1/simple/master returned 200 OK}).to_stdout + .and output(%r{HTTP GET https://127.0.0.1:#{port}/status/v1/simple/server returned 200 OK}).to_stdout end end @@ -39,7 +39,7 @@ agent.run }.to exit_with(0) .and output(%r{Notice: Applied catalog}).to_stdout - .and output(%r{Unable to connect to server from server_list setting: Request to https://puppet.example.com:#{port}/status/v1/simple/master failed}).to_stderr + .and output(%r{Unable to connect to server from server_list setting: Request to https://puppet.example.com:#{port}/status/v1/simple/server failed}).to_stderr report = Puppet::Transaction::Report.convert_from(:yaml, File.read(Puppet[:lastrunreport])) expect(report.master_used).to eq("127.0.0.1:#{port}") diff --git a/spec/lib/puppet_spec/puppetserver.rb b/spec/lib/puppet_spec/puppetserver.rb index 2a1ad008b5c..9d41f7124c3 100644 --- a/spec/lib/puppet_spec/puppetserver.rb +++ b/spec/lib/puppet_spec/puppetserver.rb @@ -103,7 +103,7 @@ def start_server(mounts: {}, &block) end def register_mounts(mounts: {}) - register_mount('/status/v1/simple/master', proc { |req, res| }, nil) + register_mount('/status/v1/simple/server', proc { |req, res| }, nil) register_mount('/puppet/v3/node', mounts[:node], NodeServlet) register_mount('/puppet/v3/catalog', mounts[:catalog], CatalogServlet) register_mount('/puppet/v3/file_metadatas', mounts[:file_metadatas], FileMetadatasServlet) diff --git a/spec/unit/application/filebucket_spec.rb b/spec/unit/application/filebucket_spec.rb index 196ac0684f9..e058266c035 100644 --- a/spec/unit/application/filebucket_spec.rb +++ b/spec/unit/application/filebucket_spec.rb @@ -115,15 +115,15 @@ end it "should default to the first good server_list entry if server_list is set" do - stub_request(:get, "https://foo:8140/status/v1/simple/master").to_return(status: 200) + stub_request(:get, "https://foo:8140/status/v1/simple/server").to_return(status: 200) Puppet[:server_list] = "foo,bar,baz" expect(Puppet::FileBucket::Dipper).to receive(:new).with(hash_including(Server: "foo")) @filebucket.setup end it "should walk server_list until it finds a good entry" do - stub_request(:get, "https://foo:8140/status/v1/simple/master").to_return(status: 502) - stub_request(:get, "https://bar:8140/status/v1/simple/master").to_return(status: 200) + stub_request(:get, "https://foo:8140/status/v1/simple/server").to_return(status: 502) + stub_request(:get, "https://bar:8140/status/v1/simple/server").to_return(status: 200) Puppet[:server_list] = "foo,bar,baz" expect(Puppet::FileBucket::Dipper).to receive(:new).with(hash_including(Server: "bar")) @filebucket.setup @@ -131,6 +131,8 @@ # FileBucket catches any exceptions raised, logs them, then just exits it "raises an error if there are no functional servers in server_list" do + stub_request(:get, "https://foo:8140/status/v1/simple/server").to_return(status: 404) + stub_request(:get, "https://bar:8140/status/v1/simple/server").to_return(status: 404) stub_request(:get, "https://foo:8140/status/v1/simple/master").to_return(status: 404) stub_request(:get, "https://bar:8140/status/v1/simple/master").to_return(status: 404) Puppet[:server] = 'horacio' @@ -146,7 +148,7 @@ end it "should take both the server and port specified in server_list" do - stub_request(:get, "https://foo:632/status/v1/simple/master").to_return(status: 200) + stub_request(:get, "https://foo:632/status/v1/simple/server").to_return(status: 200) Puppet[:server_list] = "foo:632,bar:6215,baz:351" expect(Puppet::FileBucket::Dipper).to receive(:new).with({ :Server => "foo", :Port => 632 }) @filebucket.setup diff --git a/spec/unit/configurer_spec.rb b/spec/unit/configurer_spec.rb index 6cd25f42caa..543e305a690 100644 --- a/spec/unit/configurer_spec.rb +++ b/spec/unit/configurer_spec.rb @@ -1043,7 +1043,7 @@ def expects_neither_new_or_cached_catalog it "should select a server when it receives 200 OK response" do Puppet.settings[:server_list] = ["myserver:123"] - stub_request(:get, 'https://myserver:123/status/v1/simple/master').to_return(status: 200) + stub_request(:get, 'https://myserver:123/status/v1/simple/server').to_return(status: 200) options = {} configurer.run(options) @@ -1054,7 +1054,7 @@ def expects_neither_new_or_cached_catalog it "should report when a server is unavailable" do Puppet.settings[:server_list] = ["myserver:123"] - stub_request(:get, 'https://myserver:123/status/v1/simple/master').to_return(status: [500, "Internal Server Error"]) + stub_request(:get, 'https://myserver:123/status/v1/simple/server').to_return(status: [500, "Internal Server Error"]) expect { configurer.run @@ -1066,8 +1066,8 @@ def expects_neither_new_or_cached_catalog it "should error when no servers in 'server_list' are reachable" do Puppet.settings[:server_list] = "myserver:123,someotherservername" - stub_request(:get, 'https://myserver:123/status/v1/simple/master').to_return(status: 400) - stub_request(:get, 'https://someotherservername:8140/status/v1/simple/master').to_return(status: 400) + stub_request(:get, 'https://myserver:123/status/v1/simple/server').to_return(status: 400) + stub_request(:get, 'https://someotherservername:8140/status/v1/simple/server').to_return(status: 400) expect{ configurer.run @@ -1080,7 +1080,7 @@ def expects_neither_new_or_cached_catalog Puppet::Node.indirection.terminus_class = :rest Puppet::Resource::Catalog.indirection.terminus_class = :rest - stub_request(:get, 'https://myserver:123/status/v1/simple/master').to_return(status: 200) + stub_request(:get, 'https://myserver:123/status/v1/simple/server').to_return(status: 200) stub_request(:post, %r{https://myserver:123/puppet/v3/catalog}).to_return(status: 200) node_request = stub_request(:get, %r{https://myserver:123/puppet/v3/node/}).to_return(status: 200) diff --git a/spec/unit/http/resolver_spec.rb b/spec/unit/http/resolver_spec.rb index b62a49235cd..85d08999982 100644 --- a/spec/unit/http/resolver_spec.rb +++ b/spec/unit/http/resolver_spec.rb @@ -28,7 +28,7 @@ end it 'returns a service based on the current server_list setting' do - stub_request(:get, "https://ca.example.com:8141/status/v1/simple/master").to_return(status: 200) + stub_request(:get, "https://ca.example.com:8141/status/v1/simple/server").to_return(status: 200) service = subject.resolve(session, :ca) expect(service).to be_an_instance_of(Puppet::HTTP::Service::Ca) @@ -36,7 +36,7 @@ end it 'returns a service based on the current server_list setting if the server returns any success codes' do - stub_request(:get, "https://ca.example.com:8141/status/v1/simple/master").to_return(status: 202) + stub_request(:get, "https://ca.example.com:8141/status/v1/simple/server").to_return(status: 202) service = subject.resolve(session, :ca) expect(service).to be_an_instance_of(Puppet::HTTP::Service::Ca) @@ -46,24 +46,24 @@ it 'includes extra http headers' do Puppet[:http_extra_headers] = 'region:us-west' - stub_request(:get, "https://ca.example.com:8141/status/v1/simple/master") + stub_request(:get, "https://ca.example.com:8141/status/v1/simple/server") .with(headers: {'Region' => 'us-west'}) subject.resolve(session, :ca) end it 'uses the provided ssl context during resolution' do - stub_request(:get, "https://ca.example.com:8141/status/v1/simple/master").to_return(status: 200) + stub_request(:get, "https://ca.example.com:8141/status/v1/simple/server").to_return(status: 200) other_ctx = Puppet::SSL::SSLContext.new - expect(client).to receive(:connect).with(URI("https://ca.example.com:8141/status/v1/simple/master"), options: {ssl_context: other_ctx}).and_call_original + expect(client).to receive(:connect).with(URI("https://ca.example.com:8141/status/v1/simple/server"), options: {ssl_context: other_ctx}).and_call_original subject.resolve(session, :ca, ssl_context: other_ctx) end it 'logs unsuccessful HTTP 500 responses' do - stub_request(:get, "https://ca.example.com:8141/status/v1/simple/master").to_return(status: [500, 'Internal Server Error']) - stub_request(:get, "https://apple.example.com:8142/status/v1/simple/master").to_return(status: 200) + stub_request(:get, "https://ca.example.com:8141/status/v1/simple/server").to_return(status: [500, 'Internal Server Error']) + stub_request(:get, "https://apple.example.com:8142/status/v1/simple/server").to_return(status: 200) subject.resolve(session, :ca) @@ -71,8 +71,8 @@ end it 'cancels resolution if no servers in server_list are accessible' do - stub_request(:get, "https://ca.example.com:8141/status/v1/simple/master").to_return(status: 503) - stub_request(:get, "https://apple.example.com:8142/status/v1/simple/master").to_return(status: 503) + stub_request(:get, "https://ca.example.com:8141/status/v1/simple/server").to_return(status: 503) + stub_request(:get, "https://apple.example.com:8142/status/v1/simple/server").to_return(status: 503) canceled = false canceled_handler = lambda { |cancel| canceled = cancel } @@ -82,8 +82,8 @@ end it 'cycles through server_list until a valid server is found' do - stub_request(:get, "https://ca.example.com:8141/status/v1/simple/master").to_return(status: 503) - stub_request(:get, "https://apple.example.com:8142/status/v1/simple/master").to_return(status: 200) + stub_request(:get, "https://ca.example.com:8141/status/v1/simple/server").to_return(status: 503) + stub_request(:get, "https://apple.example.com:8142/status/v1/simple/server").to_return(status: 200) service = subject.resolve(session, :ca) expect(service).to be_an_instance_of(Puppet::HTTP::Service::Ca) @@ -91,8 +91,8 @@ end it 'resolves once per session' do - failed = stub_request(:get, "https://ca.example.com:8141/status/v1/simple/master").to_return(status: 503) - passed = stub_request(:get, "https://apple.example.com:8142/status/v1/simple/master").to_return(status: 200) + failed = stub_request(:get, "https://ca.example.com:8141/status/v1/simple/server").to_return(status: 503) + passed = stub_request(:get, "https://apple.example.com:8142/status/v1/simple/server").to_return(status: 200) service = subject.resolve(session, :puppet) expect(service).to be_a(Puppet::HTTP::Service::Compiler) diff --git a/spec/unit/http/service/puppetserver_spec.rb b/spec/unit/http/service/puppetserver_spec.rb index 4909aa4b06d..89a04bb8931 100644 --- a/spec/unit/http/service/puppetserver_spec.rb +++ b/spec/unit/http/service/puppetserver_spec.rb @@ -12,7 +12,7 @@ context 'when making requests' do it 'includes default HTTP headers' do - stub_request(:get, "https://puppetserver.example.com:8140/status/v1/simple/master").with do |request| + stub_request(:get, "https://puppetserver.example.com:8140/status/v1/simple/server").with do |request| expect(request.headers).to include({'X-Puppet-Version' => /./, 'User-Agent' => /./}) expect(request.headers).to_not include('X-Puppet-Profiling') end.to_return(body: "running", headers: {'Content-Type' => 'text/plain;charset=utf-8'}) @@ -23,7 +23,7 @@ it 'includes extra headers' do Puppet[:http_extra_headers] = 'region:us-west' - stub_request(:get, "https://puppetserver.example.com:8140/status/v1/simple/master") + stub_request(:get, "https://puppetserver.example.com:8140/status/v1/simple/server") .with(headers: {'Region' => 'us-west'}) .to_return(body: "running", headers: {'Content-Type' => 'text/plain;charset=utf-8'}) @@ -36,7 +36,7 @@ Puppet[:server] = 'compiler2.example.com' Puppet[:masterport] = 8141 - stub_request(:get, "https://compiler2.example.com:8141/status/v1/simple/master") + stub_request(:get, "https://compiler2.example.com:8141/status/v1/simple/server") .to_return(body: "running", headers: {'Content-Type' => 'text/plain;charset=utf-8'}) subject.get_simple_status @@ -44,7 +44,7 @@ end context 'when getting puppetserver status' do - let(:url) { "https://puppetserver.example.com:8140/status/v1/simple/master" } + let(:url) { "https://puppetserver.example.com:8140/status/v1/simple/server" } it 'returns the request response and status' do stub_request(:get, url) @@ -79,4 +79,34 @@ service.get_simple_status(ssl_context: other_ctx) end end + + context 'when /status/v1/simple/server returns not found' do + it 'calls /status/v1/simple/master' do + stub_request(:get, "https://puppetserver.example.com:8140/status/v1/simple/server") + .to_return(status: [404, 'not found: server']) + + stub_request(:get, "https://puppetserver.example.com:8140/status/v1/simple/master") + .to_return(body: "running", headers: {'Content-Type' => 'text/plain;charset=utf-8'}) + + resp, status = subject.get_simple_status + expect(resp).to be_a(Puppet::HTTP::Response) + expect(status).to eq('running') + end + + it 'raises a response error if fallback is unsuccessful' do + stub_request(:get, "https://puppetserver.example.com:8140/status/v1/simple/server") + .to_return(status: [404, 'not found: server']) + + stub_request(:get, "https://puppetserver.example.com:8140/status/v1/simple/master") + .to_return(status: [404, 'not found: master']) + + expect { + subject.get_simple_status + }.to raise_error do |err| + expect(err).to be_an_instance_of(Puppet::HTTP::ResponseError) + expect(err.message).to eq('not found: master') + expect(err.response.code).to eq(404) + end + end + end end diff --git a/spec/unit/http/session_spec.rb b/spec/unit/http/session_spec.rb index 10cce553e20..9ab7efd7163 100644 --- a/spec/unit/http/session_spec.rb +++ b/spec/unit/http/session_spec.rb @@ -148,8 +148,8 @@ def resolve(session, name, ssl_context: nil, canceled_handler: nil) Puppet[:server_list] = 'foo.example.com,bar.example.com,baz.example.com' allow_any_instance_of(Puppet::HTTP::DNS).to receive(:each_srv_record) - stub_request(:get, "https://foo.example.com:8140/status/v1/simple/master").to_return(status: 500) - stub_request(:get, "https://bar.example.com:8140/status/v1/simple/master").to_return(status: 200) + stub_request(:get, "https://foo.example.com:8140/status/v1/simple/server").to_return(status: 500) + stub_request(:get, "https://bar.example.com:8140/status/v1/simple/server").to_return(status: 200) service = session.route_to(:ca) @@ -160,7 +160,7 @@ def resolve(session, name, ssl_context: nil, canceled_handler: nil) Puppet[:server_list] = 'foo.example.com' expect_any_instance_of(Puppet::HTTP::Resolver::Settings).to receive(:resolve).never - stub_request(:get, "https://foo.example.com:8140/status/v1/simple/master").to_return(status: 500) + stub_request(:get, "https://foo.example.com:8140/status/v1/simple/server").to_return(status: 500) expect { session.route_to(:ca) @@ -179,7 +179,7 @@ def resolve(session, name, ssl_context: nil, canceled_handler: nil) Puppet::HTTP::Service::SERVICE_NAMES.each do |name| it "resolves #{name} using server_list" do Puppet[:server_list] = 'apple.example.com' - req = stub_request(:get, "https://apple.example.com:8140/status/v1/simple/master").to_return(status: 200) + req = stub_request(:get, "https://apple.example.com:8140/status/v1/simple/server").to_return(status: 200) session.route_to(name) @@ -201,7 +201,7 @@ def resolve(session, name, ssl_context: nil, canceled_handler: nil) it 'resolves once for all services in a session' do Puppet[:server_list] = 'apple.example.com' - req = stub_request(:get, "https://apple.example.com:8140/status/v1/simple/master").to_return(status: 200) + req = stub_request(:get, "https://apple.example.com:8140/status/v1/simple/server").to_return(status: 200) Puppet::HTTP::Service::SERVICE_NAMES.each do |name| session.route_to(name) @@ -212,7 +212,7 @@ def resolve(session, name, ssl_context: nil, canceled_handler: nil) it 'resolves server_list for each new session' do Puppet[:server_list] = 'apple.example.com' - req = stub_request(:get, "https://apple.example.com:8140/status/v1/simple/master").to_return(status: 200) + req = stub_request(:get, "https://apple.example.com:8140/status/v1/simple/server").to_return(status: 200) client.create_session.route_to(:puppet) client.create_session.route_to(:puppet) From 501c62f350e37dd013ac9918dc774029718ada37 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Sat, 10 Oct 2020 09:25:11 -0700 Subject: [PATCH 198/731] (PUP-10473) Verify puppetserver registers its authconfigloader Verify puppetserver registered its authconfigloader class, which indicates it will authorize REST requests. If it fails to do so, either due to misconfiguration or bug, then return HTTP Unauthorized (401) for all v3 REST endpoints so we fail securely. Note when legacy routes was enabled (in 6.x) indirected routes performed the authorization check within its `uri2indirection2` method. But here we do the check before the route is called, since we just need to know the request method and path to format the error message. --- lib/puppet/network/authorization.rb | 16 +++++++++-- lib/puppet/network/http/api/master/v3.rb | 9 ++++--- spec/unit/network/http/api/master/v3_spec.rb | 28 ++++++++++++++++++++ spec/unit/network/http/api_spec.rb | 10 +++++++ 4 files changed, 57 insertions(+), 6 deletions(-) diff --git a/lib/puppet/network/authorization.rb b/lib/puppet/network/authorization.rb index 540c790c3ec..def664d8a6a 100644 --- a/lib/puppet/network/authorization.rb +++ b/lib/puppet/network/authorization.rb @@ -1,7 +1,19 @@ module Puppet::Network module Authorization - def self.authconfigloader_class=(_) - # legacy auth is not supported, ignore + class << self + # This method is deprecated and will be removed in a future release. + def authconfigloader_class=(klass) + @authconfigloader_class = klass + end + + # Verify something external to puppet is authorizing REST requests, so + # we don't fail insecurely due to misconfiguration. + def check_external_authorization(method, path) + if @authconfigloader_class.nil? + message = "Forbidden request: #{path} (method #{method})" + raise Puppet::Network::HTTP::Error::HTTPNotAuthorizedError.new(message, Puppet::Network::HTTP::Issues::FAILED_AUTHORIZATION) + end + end end end end diff --git a/lib/puppet/network/http/api/master/v3.rb b/lib/puppet/network/http/api/master/v3.rb index b0df5604d87..3f7342729f8 100644 --- a/lib/puppet/network/http/api/master/v3.rb +++ b/lib/puppet/network/http/api/master/v3.rb @@ -4,18 +4,19 @@ class Puppet::Network::HTTP::API::Master::V3 def self.wrap(&block) lambda do |request, response| + Puppet::Network::Authorization.check_external_authorization(request.method, request.path) + block.call.call(request, response) end end INDIRECTED = Puppet::Network::HTTP::Route. path(/.*/). - any(Puppet::Network::HTTP::API::IndirectedRoutes.new) + any(wrap { Puppet::Network::HTTP::API::IndirectedRoutes.new } ) ENVIRONMENTS = Puppet::Network::HTTP::Route. - path(%r{^/environments$}).get(wrap do - Environments.new(Puppet.lookup(:environments)) - end) + path(%r{^/environments$}). + get(wrap { Environments.new(Puppet.lookup(:environments)) } ) def self.routes Puppet::Network::HTTP::Route.path(%r{v3}). diff --git a/spec/unit/network/http/api/master/v3_spec.rb b/spec/unit/network/http/api/master/v3_spec.rb index ca2e6b05c9c..a37f4568514 100644 --- a/spec/unit/network/http/api/master/v3_spec.rb +++ b/spec/unit/network/http/api/master/v3_spec.rb @@ -15,6 +15,16 @@ chain(Puppet::Network::HTTP::API::Master::V3.routes) } + # simulate puppetserver registering its authconfigloader class + around :each do |example| + Puppet::Network::Authorization.authconfigloader_class = Object + begin + example.run + ensure + Puppet::Network::Authorization.authconfigloader_class = nil + end + end + it "mounts the environments endpoint" do request = Puppet::Network::HTTP::Request.from_hash(:path => "#{master_url_prefix}/environments") master_routes.process(request, response) @@ -47,4 +57,22 @@ master_routes.process(request, response) }.to raise_error(not_found_error) end + + it "checks authorization for indirected routes" do + Puppet::Network::Authorization.authconfigloader_class = nil + + request = Puppet::Network::HTTP::Request.from_hash(:path => "#{master_url_prefix}/catalog/foo") + expect { + master_routes.process(request, response) + }.to raise_error(Puppet::Network::HTTP::Error::HTTPNotAuthorizedError, %r{Not Authorized: Forbidden request: /puppet/v3/catalog/foo \(method GET\)}) + end + + it "checks authorization for environments" do + Puppet::Network::Authorization.authconfigloader_class = nil + + request = Puppet::Network::HTTP::Request.from_hash(:path => "#{master_url_prefix}/environments") + expect { + master_routes.process(request, response) + }.to raise_error(Puppet::Network::HTTP::Error::HTTPNotAuthorizedError, %r{Not Authorized: Forbidden request: /puppet/v3/environments \(method GET\)}) + end end diff --git a/spec/unit/network/http/api_spec.rb b/spec/unit/network/http/api_spec.rb index 3d27cdd57a0..90e5176b466 100644 --- a/spec/unit/network/http/api_spec.rb +++ b/spec/unit/network/http/api_spec.rb @@ -70,6 +70,16 @@ def respond(text) end describe "when processing master routes" do + # simulate puppetserver registering its authconfigloader class + around :each do |example| + Puppet::Network::Authorization.authconfigloader_class = Object + begin + example.run + ensure + Puppet::Network::Authorization.authconfigloader_class = nil + end + end + it "responds to v3 indirector requests" do req = Puppet::Network::HTTP::Request.from_hash(:path => "#{master_prefix}/v3/node/foo", :params => {:environment => "production"}, From fe66b4fd2fd9ddf4d29a7d9906435a92a08ff8fd Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Mon, 12 Oct 2020 15:01:42 -0700 Subject: [PATCH 199/731] (maint) Remove unused allow stub The warn_if_near_expiration logic was removed in commit ea98df762, this removes the unused stub. --- spec/unit/network/http/api/indirected_routes_spec.rb | 1 - spec/unit/network/http/handler_spec.rb | 5 ----- 2 files changed, 6 deletions(-) diff --git a/spec/unit/network/http/api/indirected_routes_spec.rb b/spec/unit/network/http/api/indirected_routes_spec.rb index 1e53d90c537..f1f7bc80f82 100644 --- a/spec/unit/network/http/api/indirected_routes_spec.rb +++ b/spec/unit/network/http/api/indirected_routes_spec.rb @@ -17,7 +17,6 @@ before do Puppet::IndirectorTesting.indirection.terminus_class = :memory Puppet::IndirectorTesting.indirection.terminus.clear - allow(handler).to receive(:warn_if_near_expiration) end describe "when converting a URI into a request" do diff --git a/spec/unit/network/http/handler_spec.rb b/spec/unit/network/http/handler_spec.rb index 69d6b02af5f..be8a6979956 100644 --- a/spec/unit/network/http/handler_spec.rb +++ b/spec/unit/network/http/handler_spec.rb @@ -101,11 +101,6 @@ def respond(text) { :status => 200 } end - before do - allow(handler).to receive(:check_authorization) - allow(handler).to receive(:warn_if_near_expiration) - end - it "should setup a profiler when the puppet-profiling header exists" do request = a_request request[:headers][Puppet::Network::HTTP::HEADER_ENABLE_PROFILING.downcase] = "true" From d84ce12f15ed1da2ac0092231e9c386fc4560316 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Tue, 13 Oct 2020 23:08:47 +0000 Subject: [PATCH 200/731] (packaging) Updating the puppet.pot file --- locales/puppet.pot | 89 ++++++++++++++++++++++++---------------------- 1 file changed, 46 insertions(+), 43 deletions(-) diff --git a/locales/puppet.pot b/locales/puppet.pot index ea534a4a5e2..deb54845c29 100644 --- a/locales/puppet.pot +++ b/locales/puppet.pot @@ -6,11 +6,11 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Puppet automation framework 6.18.0-385-g4f90b0dfd8\n" +"Project-Id-Version: Puppet automation framework 6.18.0-410-gf8b64860f1\n" "\n" "Report-Msgid-Bugs-To: https://tickets.puppetlabs.com\n" -"POT-Creation-Date: 2020-10-10 22:51+0000\n" -"PO-Revision-Date: 2020-10-10 22:51+0000\n" +"POT-Creation-Date: 2020-10-13 23:08+0000\n" +"PO-Revision-Date: 2020-10-13 23:08+0000\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -184,19 +184,19 @@ msgstr "" msgid "The puppet agent daemon" msgstr "" -#: ../lib/puppet/application/agent.rb:409 +#: ../lib/puppet/application/agent.rb:414 msgid "Fingerprint asked but neither the certificate, nor the certificate request have been issued" msgstr "" -#: ../lib/puppet/application/agent.rb:414 +#: ../lib/puppet/application/agent.rb:419 msgid "Failed to generate fingerprint: %{message}" msgstr "" -#: ../lib/puppet/application/agent.rb:437 +#: ../lib/puppet/application/agent.rb:442 msgid "Starting Puppet client version %{version}" msgstr "" -#: ../lib/puppet/application/agent.rb:453 +#: ../lib/puppet/application/agent.rb:458 msgid "The puppet agent command does not take parameters" msgstr "" @@ -546,76 +546,76 @@ msgstr "" msgid "Applied catalog in %{seconds} seconds" msgstr "" -#: ../lib/puppet/configurer.rb:225 +#: ../lib/puppet/configurer.rb:226 msgid "Could not select a functional puppet server from server_list: '%{server_list}'" msgstr "" -#: ../lib/puppet/configurer.rb:262 +#: ../lib/puppet/configurer.rb:276 msgid "Local environment: '%{local_env}' doesn't match the environment of the cached catalog '%{catalog_env}', switching agent to '%{catalog_env}'." msgstr "" -#: ../lib/puppet/configurer.rb:307 +#: ../lib/puppet/configurer.rb:321 msgid "Local environment: '%{local_env}' doesn't match server specified node environment '%{node_env}', switching agent to '%{node_env}'." msgstr "" -#: ../lib/puppet/configurer.rb:322 +#: ../lib/puppet/configurer.rb:336 msgid "Using configured environment '%{env}'" msgstr "" -#: ../lib/puppet/configurer.rb:326 +#: ../lib/puppet/configurer.rb:340 msgid "Unable to fetch my node definition, but the agent run will continue:" msgstr "" -#: ../lib/puppet/configurer.rb:354 +#: ../lib/puppet/configurer.rb:368 msgid "Not using catalog because its environment '%{catalog_env}' does not match agent specified environment '%{local_env}' and strict_environment_mode is set" msgstr "" -#: ../lib/puppet/configurer.rb:365 +#: ../lib/puppet/configurer.rb:379 msgid "Catalog environment didn't stabilize after %{tries} fetches, aborting run" msgstr "" -#: ../lib/puppet/configurer.rb:367 +#: ../lib/puppet/configurer.rb:381 msgid "Local environment: '%{local_env}' doesn't match server specified environment '%{catalog_env}', restarting agent run with environment '%{catalog_env}'" msgstr "" -#: ../lib/puppet/configurer.rb:408 +#: ../lib/puppet/configurer.rb:422 msgid "Failed to apply catalog: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:437 ../lib/puppet/http/resolver/server_list.rb:67 +#: ../lib/puppet/configurer.rb:451 ../lib/puppet/http/resolver/server_list.rb:67 msgid "Puppet server %{host}:%{port} is unavailable: %{code} %{reason}" msgstr "" #. TRANSLATORS 'server_list' is the name of a setting and should not be translated -#: ../lib/puppet/configurer.rb:441 ../lib/puppet/http/resolver/server_list.rb:70 +#: ../lib/puppet/configurer.rb:455 ../lib/puppet/http/resolver/server_list.rb:70 msgid "Unable to connect to server from server_list setting: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:452 ../lib/puppet/face/report.rb:47 +#: ../lib/puppet/configurer.rb:466 ../lib/puppet/face/report.rb:47 msgid "Could not send report: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:461 +#: ../lib/puppet/configurer.rb:475 msgid "Could not save last run local report: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:480 +#: ../lib/puppet/configurer.rb:494 msgid "Uploading facts for %{node} to %{server}" msgstr "" -#: ../lib/puppet/configurer.rb:488 +#: ../lib/puppet/configurer.rb:502 msgid "Failed to submit facts: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:503 +#: ../lib/puppet/configurer.rb:517 msgid "Could not run command from %{setting}: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:521 +#: ../lib/puppet/configurer.rb:535 msgid "Could not retrieve catalog from cache: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:542 +#: ../lib/puppet/configurer.rb:556 msgid "Could not retrieve catalog from remote server: %{detail}" msgstr "" @@ -702,20 +702,20 @@ msgid "Convert custom terminus to hiera 5 API." msgstr "" #. TRANSLATORS 'environment_data_provider' is a setting and should not be translated -#: ../lib/puppet/defaults.rb:747 +#: ../lib/puppet/defaults.rb:737 msgid "Setting 'environment_data_provider' is deprecated." msgstr "" -#: ../lib/puppet/defaults.rb:830 +#: ../lib/puppet/defaults.rb:820 msgid "Certificate names must be lower case" msgstr "" -#: ../lib/puppet/defaults.rb:1080 ../lib/puppet/settings/enum_setting.rb:13 ../lib/puppet/settings/symbolic_enum_setting.rb:14 +#: ../lib/puppet/defaults.rb:1070 ../lib/puppet/settings/enum_setting.rb:13 ../lib/puppet/settings/symbolic_enum_setting.rb:14 msgid "Invalid value '%{value}' for parameter %{name}. Allowed values are '%{allowed_values}'" msgstr "" #. TRANSLATORS 'pluginsync' is a setting and should not be translated -#: ../lib/puppet/defaults.rb:1906 +#: ../lib/puppet/defaults.rb:1908 msgid "Setting 'pluginsync' is deprecated." msgstr "" @@ -817,7 +817,7 @@ msgstr "" #: ../lib/puppet/face/config.rb:146 msgid "" -"The environment should be set in either the `[user]`, `[agent]`, or `[master]`\n" +"The environment should be set in either the `[user]`, `[agent]`, or `[server]`\n" "section. Variables set in the `[agent]` section are used when running\n" "`puppet agent`. Variables set in the `[user]` section are used when running\n" "various other puppet subcommands, like `puppet apply` and `puppet module`; these\n" @@ -827,25 +827,28 @@ msgid "" "https://puppet.com/docs/puppet/latest/configuration.html#environment\n" msgstr "" -#: ../lib/puppet/face/config.rb:174 +#: ../lib/puppet/face/config.rb:176 +msgid "Deleted setting from '%{section_name}': '%{setting_string}', and adding it to 'server' section" +msgstr "" + +#: ../lib/puppet/face/config.rb:191 msgid "Delete a Puppet setting." msgstr "" -#: ../lib/puppet/face/config.rb:175 +#: ../lib/puppet/face/config.rb:192 msgid "" msgstr "" -#. TRANSLATORS 'main' is a specific section name and should not be translated -#: ../lib/puppet/face/config.rb:212 +#: ../lib/puppet/face/config.rb:226 ../lib/puppet/face/config.rb:230 ../lib/puppet/face/config.rb:241 msgid "Deleted setting from '%{section_name}': '%{setting_string}'" msgstr "" -#: ../lib/puppet/face/config.rb:215 +#: ../lib/puppet/face/config.rb:244 msgid "No setting found in configuration file for section '%{section_name}' setting name '%{name}'" msgstr "" #. TRANSLATORS the 'puppet.conf' is a specific file and should not be translated -#: ../lib/puppet/face/config.rb:222 +#: ../lib/puppet/face/config.rb:252 msgid "The puppet.conf file does not exist %{puppet_conf}" msgstr "" @@ -7071,33 +7074,33 @@ msgstr "" msgid "Setting %{name} is already using short name '%{short}'" msgstr "" -#: ../lib/puppet/settings.rb:1241 +#: ../lib/puppet/settings.rb:1249 msgid "Setting %{name} is deprecated." msgstr "" #. TRANSLATORS 'puppet.conf' is a file name and should not be translated -#: ../lib/puppet/settings.rb:1246 +#: ../lib/puppet/settings.rb:1254 msgid "Setting %{name} is deprecated in puppet.conf." msgstr "" -#: ../lib/puppet/settings.rb:1417 +#: ../lib/puppet/settings.rb:1425 msgid "Error converting value for param '%{name}': %{detail}" msgstr "" -#: ../lib/puppet/settings.rb:1441 +#: ../lib/puppet/settings.rb:1449 msgid "Could not find value for %{expression}" msgstr "" #. TRANSLATORS '$environment' is a Puppet specific variable and should not be translated -#: ../lib/puppet/settings.rb:1451 +#: ../lib/puppet/settings.rb:1459 msgid "You cannot interpolate $environment within '%{setting_name}' when using directory environments." msgstr "" -#: ../lib/puppet/settings.rb:1452 +#: ../lib/puppet/settings.rb:1460 msgid "Its value will remain %{value}." msgstr "" -#: ../lib/puppet/settings.rb:1483 +#: ../lib/puppet/settings.rb:1491 msgid "Attempt to assign a value to unknown setting %{name}" msgstr "" From eeb3f7a2f6f5bc14fbfe147ad465d480cfa7c210 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Tue, 13 Oct 2020 23:10:06 +0000 Subject: [PATCH 201/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 48 ++++++++++++++++++---------------------- man/man8/puppet-agent.8 | 7 ++++-- man/man8/puppet-config.8 | 10 ++++----- 3 files changed, 32 insertions(+), 33 deletions(-) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index 35aad237b1a..486d5c82800 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -149,7 +149,7 @@ The name to use the Certificate Authority certificate\. The port to use for the certificate authority\. . .IP "\(bu" 4 -\fIDefault\fR: $masterport +\fIDefault\fR: $serverport . .IP "" 0 . @@ -591,47 +591,35 @@ The name of a registered environment data provider used when obtaining environme . .SS "environment_timeout" -How long the Puppet master should cache data it loads from an environment\. +How long the Puppet server should cache data it loads from an environment\. . .P -A value of \fB0\fR will disable caching\. This setting can also be set to \fBunlimited\fR, which will cache environments until the master is restarted or told to refresh the cache\. +A value of \fB0\fR will disable caching\. This setting can also be set to \fBunlimited\fR, which will cache environments until the server is restarted or told to refresh the cache\. All other values will result in Puppet server evicting expired environments\. The expiration time is computed based on either when the environment was created or last accessed, see \fBenvironment_timeout_mode\fR\. . .P -You should change this setting once your Puppet deployment is doing non\-trivial work\. We chose the default value of \fB0\fR because it lets new users update their code without any extra steps, but it lowers the performance of your Puppet master\. +You should change this setting once your Puppet deployment is doing non\-trivial work\. We chose the default value of \fB0\fR because it lets new users update their code without any extra steps, but it lowers the performance of your Puppet server\. We recommend either: . -.P -We recommend setting this to \fBunlimited\fR and explicitly refreshing your Puppet master as part of your code deployment process\. +.IP "\(bu" 4 +Setting this to \fBunlimited\fR and explicitly refreshing your Puppet server as part of your code deployment process\. . .IP "\(bu" 4 -With Puppet Server, you should refresh environments by calling the \fBenvironment\-cache\fR API endpoint\. See the docs for the Puppet Server administrative API \fIhttps://puppet\.com/docs/puppetserver/latest/admin\-api/v1/environment\-cache\.html\fR\. +Setting this to a number that will keep your most actively used environments cached, but allow testing environments to fall out of the cache and reduce memory usage\. A value of 3 minutes (3m) is a reasonable value\. This option requires setting \fBenvironment_timeout_mode\fR to \fBfrom_last_used\fR\. . .IP "" 0 . .P -Any value other than \fB0\fR or \fBunlimited\fR is deprecated, since most Puppet servers use a pool of Ruby interpreters which all have their own cache timers\. When these timers drift out of sync, agents can be served inconsistent catalogs\. +Once you set \fBenvironment_timeout\fR to a non\-zero value, you need to tell Puppet server to read new code from disk using the \fBenvironment\-cache\fR API endpoint after you deploy new code\. See the docs for the Puppet Server administrative API \fIhttps://puppet\.com/docs/puppetserver/latest/admin\-api/v1/environment\-cache\.html\fR\. . .IP "\(bu" 4 \fIDefault\fR: 0 . .IP "" 0 . -.SS "environment_ttl" -How long after the last access Puppet server will wait to evict an environment from the environment cache\. -. -.P -A value of \fB0\fR will disable caching\. This setting can also be set to \fBunlimited\fR, which will cache environments until the server is restarted or told to refresh the cache\. All other values will result in Puppet server evicting environments that have not been accessed within that ttl\. -. -.P -You should change this setting once your Puppet deployment is doing non\-trivial work\. We chose the default value of \fB0\fR because it lets new users update their code without any extra steps, but it lowers the performance of your Puppet server\. -. -.P -We recommend setting this to a number that will keep your most actively used environments cached, but allow testing environments to fall out of the cache and reduce memory usage\. A value of 3 minutes (3m) is a reasonable value\. -. -.P -Once you set \fBenvironment_ttl\fR to a non\-zero value, you need to tell Puppet server to read new code from disk using the \fBenvironment\-cache\fR API endpoint after you deploy new code\. See the docs for the Puppet Server administrative API \fIhttps://puppet\.com/docs/puppetserver/latest/admin\-api/v1/environment\-cache\.html\fR\. +.SS "environment_timeout_mode" +How Puppet interprets the \fBenvironment_timeout\fR setting when \fBenvironment_timeout\fR is neither \fB0\fR nor \fBunlimited\fR\. If set to \fBfrom_created\fR, then the environment will be evicted \fBenvironment_timeout\fR seconds from when it was created\. If set to \fBfrom_last_used\fR then the environment will be evicted \fBenvironment_timeout\fR seconds from when it was last used\. . .IP "\(bu" 4 -\fIDefault\fR: 0 +\fIDefault\fR: from_created . .IP "" 0 . @@ -801,7 +789,7 @@ The group Puppet Server will run as\. Used to ensure the agent side processes (a .IP "" 0 . .SS "hiera_config" -The hiera configuration file\. Puppet only reads this file on startup, so you must restart the puppet master every time you edit it\. +The hiera configuration file\. Puppet only reads this file on startup, so you must restart the puppet server every time you edit it\. . .IP "\(bu" 4 \fIDefault\fR: $confdir/hiera\.yaml\. However, for backwards compatibility, if a file exists at $codedir/hiera\.yaml, Puppet uses that instead\. @@ -1381,7 +1369,7 @@ Where puppet agent stores the password for its private key\. Generally unused\. The shell search path\. Defaults to whatever is inherited from the parent process\. . .P -This setting can only be set in the \fB[main]\fR section of puppet\.conf; it cannot be set in \fB[master]\fR, \fB[agent]\fR, or an environment config section\. +This setting can only be set in the \fB[main]\fR section of puppet\.conf; it cannot be set in \fB[server]\fR, \fB[agent]\fR, or an environment config section\. . .IP "\(bu" 4 \fIDefault\fR: none @@ -1555,7 +1543,7 @@ Whether the \'http\' report processor should include the system certificate stor The port to communicate with the report_server\. . .IP "\(bu" 4 -\fIDefault\fR: $masterport +\fIDefault\fR: $serverport . .IP "" 0 . @@ -1693,6 +1681,14 @@ The list of Puppet master servers to which the Puppet agent should connect, in t . .IP "" 0 . +.SS "serverport" +The default port puppet subcommands use to communicate with Puppet Server\. (eg \fBpuppet facts upload\fR, \fBpuppet agent\fR)\. May be overridden by more specific settings (see \fBca_port\fR, \fBreport_port\fR)\. +. +.IP "\(bu" 4 +\fIDefault\fR: 8140 +. +.IP "" 0 +. .SS "settings_catalog" Whether to compile and apply the settings catalog . diff --git a/man/man8/puppet-agent.8 b/man/man8/puppet-agent.8 index b15688aa1c1..9182ab6763b 100644 --- a/man/man8/puppet-agent.8 +++ b/man/man8/puppet-agent.8 @@ -13,7 +13,7 @@ Retrieves the client configuration from the Puppet master and applies it to the This service may be run as a daemon, run periodically using cron (or something similar), or run interactively for testing purposes\. . .SH "USAGE" -puppet agent [\-\-certname \fINAME\fR] [\-D|\-\-daemonize|\-\-no\-daemonize] [\-d|\-\-debug] [\-\-detailed\-exitcodes] [\-\-digest \fIDIGEST\fR] [\-\-disable [MESSAGE]] [\-\-enable] [\-\-fingerprint] [\-h|\-\-help] [\-l|\-\-logdest syslog|eventlog|\fIABS FILEPATH\fR|console] [\-\-masterport \fIPORT\fR] [\-\-noop] [\-o|\-\-onetime] [\-\-sourceaddress \fIIP_ADDRESS\fR] [\-t|\-\-test] [\-v|\-\-verbose] [\-V|\-\-version] [\-w|\-\-waitforcert \fISECONDS\fR] +puppet agent [\-\-certname \fINAME\fR] [\-D|\-\-daemonize|\-\-no\-daemonize] [\-d|\-\-debug] [\-\-detailed\-exitcodes] [\-\-digest \fIDIGEST\fR] [\-\-disable [MESSAGE]] [\-\-enable] [\-\-fingerprint] [\-h|\-\-help] [\-l|\-\-logdest syslog|eventlog|\fIABS FILEPATH\fR|console] [\-\-serverport \fIPORT\fR] [\-\-noop] [\-o|\-\-onetime] [\-\-sourceaddress \fIIP_ADDRESS\fR] [\-t|\-\-test] [\-v|\-\-verbose] [\-V|\-\-version] [\-w|\-\-waitforcert \fISECONDS\fR] . .SH "DESCRIPTION" This is the main puppet client\. Its job is to retrieve the local machine\'s configuration from a remote server and apply it\. In order to successfully communicate with the remote server, the client must have a certificate signed by a certificate authority that the server trusts; the recommended method for this, at the moment, is to run a certificate authority as part of the puppet server (which is the default)\. The client will connect and request a signed certificate, and will continue connecting until it receives one\. @@ -135,7 +135,7 @@ A path ending with \'\.json\' will receive structured output in JSON format\. Th A path ending with \'\.jsonl\' will receive structured output in JSON Lines format\. . .IP "\(bu" 4 -\-\-masterport: The port on which to contact the puppet master\. (This is a Puppet setting, and can go in puppet\.conf\.) +\-\-masterport: The port on which to contact the Puppet Server\. (This is a Puppet setting, and can go in puppet\.conf\. Deprecated in favor of the \'serverport\' setting\.) . .IP "\(bu" 4 \-\-noop: Use \'noop\' mode where the daemon runs in a no\-op or dry\-run mode\. This is useful for seeing what changes Puppet would make without actually executing the changes\. (This is a Puppet setting, and can go in puppet\.conf\. Note the special \'no\-\' prefix for boolean settings on the command line\.) @@ -144,6 +144,9 @@ A path ending with \'\.jsonl\' will receive structured output in JSON Lines form \-\-onetime: Run the configuration once\. Runs a single (normally daemonized) Puppet run\. Useful for interactively running puppet agent when used in conjunction with the \-\-no\-daemonize option\. (This is a Puppet setting, and can go in puppet\.conf\. Note the special \'no\-\' prefix for boolean settings on the command line\.) . .IP "\(bu" 4 +\-\-serverport: The port on which to contact the Puppet Server\. (This is a Puppet setting, and can go in puppet\.conf\.) +. +.IP "\(bu" 4 \-\-sourceaddress: Set the source IP address for transactions\. This defaults to automatically selected\. (This is a Puppet setting, and can go in puppet\.conf\.) . .IP "\(bu" 4 diff --git a/man/man8/puppet-config.8 b/man/man8/puppet-config.8 index 36d3442bfbd..66f3b0b2468 100644 --- a/man/man8/puppet-config.8 +++ b/man/man8/puppet-config.8 @@ -35,7 +35,7 @@ Whether to log debug information\. The section of the puppet\.conf configuration file to interact with\. . .IP -The three most commonly used sections are \'main\', \'master\', and \'agent\'\. \'Main\' is the default, and is used by all Puppet applications\. Other sections can override \'main\' values for specific applications \-\-\- the \'master\' section affects Puppet Server, and the \'agent\' section affects puppet agent\. +The three most commonly used sections are \'main\', \'server\', and \'agent\'\. \'Main\' is the default, and is used by all Puppet applications\. Other sections can override \'main\' values for specific applications \-\-\- the \'server\' section affects Puppet Server, and the \'agent\' section affects puppet agent\. . .IP Less commonly used is the \'user\' section, which affects puppet apply\. Any other section will be treated as the name of a legacy environment (a deprecated feature), and can only include the \'manifest\' and \'modulepath\' settings\. @@ -112,10 +112,10 @@ Delete the setting \'setting_name\' from the \'main\' configuration domain: $ puppet config delete setting_name . .P -Delete the setting \'setting_name\' from the \'master\' configuration domain: +Delete the setting \'setting_name\' from the \'server\' configuration domain: . .P -$ puppet config delete setting_name \-\-section master +$ puppet config delete setting_name \-\-section server . .P \fBprint\fR @@ -127,10 +127,10 @@ Get puppet\'s runfile directory: $ puppet config print rundir . .P -Get a list of important directories from the master\'s config: +Get a list of important directories from the server\'s config: . .P -$ puppet config print all \-\-section master | grep \-E "(path|dir)" +$ puppet config print all \-\-section server | grep \-E "(path|dir)" . .P \fBset\fR From 7aaeef94f37c7c3b2ae6ca7b212be6582d532b74 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Sat, 10 Oct 2020 09:50:07 -0700 Subject: [PATCH 202/731] (PUP-10619) Tag some environment acceptance tests as high Tag environment_timeout related tests as high. --- acceptance/tests/direct_puppet/static_catalog_env_control.rb | 2 +- acceptance/tests/environment/use_enc_environment_for_files.rb | 2 +- .../tests/environment/variables_refreshed_each_compilation.rb | 2 +- acceptance/tests/lookup/lookup.rb | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/acceptance/tests/direct_puppet/static_catalog_env_control.rb b/acceptance/tests/direct_puppet/static_catalog_env_control.rb index 1fb37b0b927..e3dca4c20c4 100644 --- a/acceptance/tests/direct_puppet/static_catalog_env_control.rb +++ b/acceptance/tests/direct_puppet/static_catalog_env_control.rb @@ -1,6 +1,6 @@ test_name "Environment control of static catalogs" -tag 'audit:medium', +tag 'audit:high', 'audit:acceptance', 'audit:refactor', # use mk_tmp_environment_with_teardown helper for environment construction 'server' diff --git a/acceptance/tests/environment/use_enc_environment_for_files.rb b/acceptance/tests/environment/use_enc_environment_for_files.rb index 4a42b72ca59..4fb6b31b00d 100644 --- a/acceptance/tests/environment/use_enc_environment_for_files.rb +++ b/acceptance/tests/environment/use_enc_environment_for_files.rb @@ -1,6 +1,6 @@ test_name "Agent should use environment given by ENC for fetching remote files" do - tag 'audit:medium', + tag 'audit:high', 'audit:integration', 'audit:refactor', # This test should be rolled into use_enc_environment 'server' diff --git a/acceptance/tests/environment/variables_refreshed_each_compilation.rb b/acceptance/tests/environment/variables_refreshed_each_compilation.rb index d54a584c0cf..0aab349ba41 100644 --- a/acceptance/tests/environment/variables_refreshed_each_compilation.rb +++ b/acceptance/tests/environment/variables_refreshed_each_compilation.rb @@ -4,7 +4,7 @@ confine :except, :platform => /^(aix|osx|solaris)/ - tag 'audit:medium', + tag 'audit:high', 'audit:integration', 'server' diff --git a/acceptance/tests/lookup/lookup.rb b/acceptance/tests/lookup/lookup.rb index e356d308dd9..eea6c52e671 100644 --- a/acceptance/tests/lookup/lookup.rb +++ b/acceptance/tests/lookup/lookup.rb @@ -2,7 +2,7 @@ # pre-docs: # https://puppet-on-the-edge.blogspot.com/2015/01/puppet-40-data-in-modules-and.html -tag 'audit:medium', +tag 'audit:high', 'audit:acceptance', 'audit:refactor', # Master is not needed for this test. Refactor # to use puppet apply with a local module tree. From dac9d8a2503cb8360fec8cf8014e6f0fc03ffe52 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Tue, 13 Oct 2020 11:05:20 -0700 Subject: [PATCH 203/731] (PUP-10619) Evict environments based on last used time Remove `environment_timeout_mode` setting and change default behavior to `from_last_used`. There is no change in behavior if `environment_timeout` is `0` or `unlimited`. Otherwise, evict environments if not used within the last `environment_timeout` seconds. Also remove deprecation warning, since the setting now works as expected. --- lib/puppet/defaults.rb | 28 ++++----------------------- lib/puppet/environments.rb | 35 ++++++++++------------------------ spec/unit/environments_spec.rb | 3 --- 3 files changed, 14 insertions(+), 52 deletions(-) diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb index ef96c88f9a5..fef165b41b0 100644 --- a/lib/puppet/defaults.rb +++ b/lib/puppet/defaults.rb @@ -682,9 +682,8 @@ def self.initialize_default_settings!(settings) A value of `0` will disable caching. This setting can also be set to `unlimited`, which will cache environments until the server is restarted or told to refresh the cache. All other values will result in Puppet - server evicting expired environments. The expiration time is computed - based on either when the environment was created or last accessed, see - `environment_timeout_mode`. + server evicting environments that haven't been used within the last + `environment_timeout` seconds. You should change this setting once your Puppet deployment is doing non-trivial work. We chose the default value of `0` because it lets new @@ -697,32 +696,13 @@ def self.initialize_default_settings!(settings) * Setting this to a number that will keep your most actively used environments cached, but allow testing environments to fall out of the cache and reduce memory usage. A value of 3 minutes (3m) is a reasonable - value. This option requires setting `environment_timeout_mode` to - `from_last_used`. + value. Once you set `environment_timeout` to a non-zero value, you need to tell Puppet server to read new code from disk using the `environment-cache` API endpoint after you deploy new code. See the docs for the Puppet Server [administrative API](https://puppet.com/docs/puppetserver/latest/admin-api/v1/environment-cache.html). - ", - :hook => proc do |val| - if Puppet[:environment_timeout_mode] == :from_created - unless [0, 'unlimited', Float::INFINITY].include?(val) - Puppet.deprecation_warning("Evicting environments based on their creation time is deprecated, please set `environment_timeout_mode` to `from_last_used` instead.") - end - end - end - }, - :environment_timeout_mode => { - :default => :from_created, - :type => :symbolic_enum, - :values => [:from_created, :from_last_used], - :desc => "How Puppet interprets the `environment_timeout` setting when - `environment_timeout` is neither `0` nor `unlimited`. If set to - `from_created`, then the environment will be evicted `environment_timeout` - seconds from when it was created. If set to `from_last_used` then the - environment will be evicted `environment_timeout` seconds from when it - was last used." + " }, :environment_data_provider => { :desc => "The name of a registered environment data provider used when obtaining environment diff --git a/lib/puppet/environments.rb b/lib/puppet/environments.rb index d3c910e5919..a45ac78ab9a 100644 --- a/lib/puppet/environments.rb +++ b/lib/puppet/environments.rb @@ -459,11 +459,7 @@ def entry(env) when Float::INFINITY Entry.new(env) # Entry that never expires (avoids syscall to get time) else - if Puppet[:environment_timeout_mode] == :from_last_used - MRUEntry.new(env, ttl) # Entry that expires in ttl from when it was last touched - else - TTLEntry.new(env, ttl) # Entry that expires in ttl from when it was created - end + MRUEntry.new(env, ttl) # Entry that expires in ttl from when it was last touched end end @@ -517,41 +513,30 @@ def expires end end - # Policy that expires in ttl_seconds from when it was created - class TTLEntry < Entry + # Policy that expires if it hasn't been touched within ttl_seconds + class MRUEntry < Entry def initialize(value, ttl_seconds) super(value) @ttl = Time.now + ttl_seconds @ttl_seconds = ttl_seconds + + touch end - def expired? - Time.now > @ttl + def touch + @ttl = Time.now + @ttl_seconds end - def label - "(ttl = #{@ttl_seconds} sec)" + def expired? + Time.now > @ttl end def expires @ttl end - end - - # Policy that expires if it hasn't been touched within ttl_seconds - class MRUEntry < TTLEntry - def initialize(value, ttl_seconds) - super(value, ttl_seconds) - - touch - end - - def touch - @ttl = Time.now + @ttl_seconds - end def label - "(mru = #{@ttl_seconds} sec)" + "(ttl = #{@ttl_seconds} sec)" end end end diff --git a/spec/unit/environments_spec.rb b/spec/unit/environments_spec.rb index 5b6a6f51cfc..cf26f7ece4e 100644 --- a/spec/unit/environments_spec.rb +++ b/spec/unit/environments_spec.rb @@ -677,7 +677,6 @@ def with_environment_loaded(service, &block) it "evicts an environment that hasn't been recently touched" do Puppet[:environment_timeout] = 1 - Puppet[:environment_timeout_mode] = :from_last_used with_environment_loaded(service) do |cached| future = Time.now + 60 @@ -694,7 +693,6 @@ def with_environment_loaded(service, &block) it "reuses an environment that was recently touched" do Puppet[:environment_timeout] = 60 - Puppet[:environment_timeout_mode] = :from_last_used with_environment_loaded(service) do |cached| # reuse the already cached environment @@ -707,7 +705,6 @@ def with_environment_loaded(service, &block) it "evicts a recently touched environment" do Puppet[:environment_timeout] = 60 - Puppet[:environment_timeout_mode] = :from_last_used # see note above about "twice" expect(service).to receive(:expired?).twice.and_return(true) From ac248dd5b66e7ac1701316b149e0c47af26ab64b Mon Sep 17 00:00:00 2001 From: Ciprian Badescu Date: Mon, 12 Oct 2020 09:32:37 +0300 Subject: [PATCH 204/731] (PUP-10714) Remove master_used from report Remove master_used from report since it was replaced by server_used --- api/schemas/report.json | 7 +------ lib/puppet/transaction/report.rb | 6 ++---- spec/integration/application/agent_spec.rb | 3 --- spec/unit/configurer_spec.rb | 1 - spec/unit/transaction/report_spec.rb | 2 -- 5 files changed, 3 insertions(+), 16 deletions(-) diff --git a/api/schemas/report.json b/api/schemas/report.json index 8787211cb57..85420049acd 100644 --- a/api/schemas/report.json +++ b/api/schemas/report.json @@ -119,11 +119,6 @@ ] }, - "master_used": { - "description": "The name of the master that was used to compile the catalog. If failover occurred, this will hold the first master successfully contacted. If this run had no master (e.g. a `puppet apply` run), this field will be blank", - "type": "string" - }, - "server_used": { "description": "The name of the server that was used to compile the catalog. If failover occurred, this will hold the first server successfully contacted. If this run had no server (e.g. a `puppet apply` run), this field will be blank", "type": "string" @@ -132,7 +127,7 @@ "report_format": { "description": "The report format version documented by this schema", "type": "integer", - "enum": ["11", 11] + "enum": ["12", 12] }, "puppet_version": { diff --git a/lib/puppet/transaction/report.rb b/lib/puppet/transaction/report.rb index a949a3da6fc..5379ea1450f 100644 --- a/lib/puppet/transaction/report.rb +++ b/lib/puppet/transaction/report.rb @@ -66,8 +66,6 @@ class Puppet::Transaction::Report # Contains the name and port of the server that was successfully contacted # @return [String] a string of the format 'servername:port' attr_accessor :server_used - alias :master_used :server_used - alias :master_used= :server_used= # The host name for which the report is generated # @return [String] the host name @@ -226,7 +224,7 @@ def initialize(configuration_version=nil, environment=nil, transaction_uuid=nil, @external_times ||= {} @host = Puppet[:node_name_value] @time = start_time - @report_format = 11 + @report_format = 12 @puppet_version = Puppet.version @configuration_version = configuration_version @transaction_uuid = transaction_uuid @@ -326,7 +324,7 @@ def to_data_hash } # The following is include only when set - hash['master_used'] = hash['server_used'] = @server_used unless @server_used.nil? + hash['server_used'] = @server_used unless @server_used.nil? hash['catalog_uuid'] = @catalog_uuid unless @catalog_uuid.nil? hash['code_id'] = @code_id unless @code_id.nil? hash['job_id'] = @job_id unless @job_id.nil? diff --git a/spec/integration/application/agent_spec.rb b/spec/integration/application/agent_spec.rb index 3defcad31bd..bb4f999a339 100644 --- a/spec/integration/application/agent_spec.rb +++ b/spec/integration/application/agent_spec.rb @@ -42,7 +42,6 @@ .and output(%r{Unable to connect to server from server_list setting: Request to https://puppet.example.com:#{port}/status/v1/simple/master failed}).to_stderr report = Puppet::Transaction::Report.convert_from(:yaml, File.read(Puppet[:lastrunreport])) - expect(report.master_used).to eq("127.0.0.1:#{port}") expect(report.server_used).to eq("127.0.0.1:#{port}") end end @@ -75,7 +74,6 @@ end report = Puppet::Transaction::Report.convert_from(:yaml, File.read(Puppet[:lastrunreport])) - expect(report.master_used).to be_nil expect(report.server_used).to be_nil end @@ -93,7 +91,6 @@ .and output(%r{Debug: Resolved service 'puppet' to https://127.0.0.1:#{port}/puppet/v3}).to_stdout report = Puppet::Transaction::Report.convert_from(:yaml, File.read(Puppet[:lastrunreport])) - expect(report.master_used).to eq("127.0.0.1:#{port}") expect(report.server_used).to eq("127.0.0.1:#{port}") end end diff --git a/spec/unit/configurer_spec.rb b/spec/unit/configurer_spec.rb index 6cd25f42caa..c69818422ed 100644 --- a/spec/unit/configurer_spec.rb +++ b/spec/unit/configurer_spec.rb @@ -1047,7 +1047,6 @@ def expects_neither_new_or_cached_catalog options = {} configurer.run(options) - expect(options[:report].master_used).to eq('myserver:123') expect(options[:report].server_used).to eq('myserver:123') end diff --git a/spec/unit/transaction/report_spec.rb b/spec/unit/transaction/report_spec.rb index d1c0b0478a5..aea6895d4b0 100644 --- a/spec/unit/transaction/report_spec.rb +++ b/spec/unit/transaction/report_spec.rb @@ -675,7 +675,6 @@ def generate_report report.code_id = "some code id" report.catalog_uuid = "some catalog uuid" report.cached_catalog_status = "not_used" - report.master_used = "test:000" report.server_used = "test:000" report.add_resource_status(status) report.transaction_completed = true @@ -694,7 +693,6 @@ def generate_report_with_error report.code_id = "some code id" report.catalog_uuid = "some catalog uuid" report.cached_catalog_status = "not_used" - report.master_used = "test:000" report.server_used = "test:000" report.add_resource_status(status) report.transaction_completed = true From 1750a6dad45ab68ea95cc2b8e787e0e571d052d8 Mon Sep 17 00:00:00 2001 From: Luchi <39198766+luchihoratiu@users.noreply.github.com> Date: Wed, 14 Oct 2020 16:58:41 +0300 Subject: [PATCH 205/731] (maint) Add temporary GitHub Actions workflow This temporary workflow should fix hanging jobs. --- .github/workflows/temporary.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .github/workflows/temporary.yml diff --git a/.github/workflows/temporary.yml b/.github/workflows/temporary.yml new file mode 100644 index 00000000000..ca4b84f9ec3 --- /dev/null +++ b/.github/workflows/temporary.yml @@ -0,0 +1,15 @@ +--- +name: 'Temporary hourly workflow' + +on: + schedule: + - cron: '0 * * * *' + +jobs: + temporary_hourly_job: + name: Temporary hourly job + + runs-on: ubuntu-latest + steps: + - name: Temporary dummy step + run: echo "Done" From 4af1a283e407ce9fcd31e88cee57b70f466d1b34 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Thu, 15 Oct 2020 18:05:05 -0700 Subject: [PATCH 206/731] (maint) Update test to stub /status/v1/simple/server Commit 139b5e93a2b added a test that stubbed the old API, but the configurer was modified in 8112327d45 to call the simple server service instead. Update the test to match the code. --- spec/unit/configurer_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/unit/configurer_spec.rb b/spec/unit/configurer_spec.rb index ecd01602d1e..abea6614547 100644 --- a/spec/unit/configurer_spec.rb +++ b/spec/unit/configurer_spec.rb @@ -1079,8 +1079,8 @@ def expects_neither_new_or_cached_catalog Puppet.settings[:server_list] = "myserver:123,someotherservername" Puppet[:usecacheonfailure] = true - stub_request(:get, 'https://myserver:123/status/v1/simple/master').to_return(status: 400) - stub_request(:get, 'https://someotherservername:8140/status/v1/simple/master').to_return(status: 400) + stub_request(:get, 'https://myserver:123/status/v1/simple/server').to_return(status: 400) + stub_request(:get, 'https://someotherservername:8140/status/v1/simple/server').to_return(status: 400) options = {} From a6ab08914bb44d7563c1e996f22f7abdf03cbfd0 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Fri, 16 Oct 2020 17:07:41 +0000 Subject: [PATCH 207/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index 486d5c82800..8ae45d431d7 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -594,7 +594,7 @@ The name of a registered environment data provider used when obtaining environme How long the Puppet server should cache data it loads from an environment\. . .P -A value of \fB0\fR will disable caching\. This setting can also be set to \fBunlimited\fR, which will cache environments until the server is restarted or told to refresh the cache\. All other values will result in Puppet server evicting expired environments\. The expiration time is computed based on either when the environment was created or last accessed, see \fBenvironment_timeout_mode\fR\. +A value of \fB0\fR will disable caching\. This setting can also be set to \fBunlimited\fR, which will cache environments until the server is restarted or told to refresh the cache\. All other values will result in Puppet server evicting environments that haven\'t been used within the last \fBenvironment_timeout\fR seconds\. . .P You should change this setting once your Puppet deployment is doing non\-trivial work\. We chose the default value of \fB0\fR because it lets new users update their code without any extra steps, but it lowers the performance of your Puppet server\. We recommend either: @@ -603,7 +603,7 @@ You should change this setting once your Puppet deployment is doing non\-trivial Setting this to \fBunlimited\fR and explicitly refreshing your Puppet server as part of your code deployment process\. . .IP "\(bu" 4 -Setting this to a number that will keep your most actively used environments cached, but allow testing environments to fall out of the cache and reduce memory usage\. A value of 3 minutes (3m) is a reasonable value\. This option requires setting \fBenvironment_timeout_mode\fR to \fBfrom_last_used\fR\. +Setting this to a number that will keep your most actively used environments cached, but allow testing environments to fall out of the cache and reduce memory usage\. A value of 3 minutes (3m) is a reasonable value\. . .IP "" 0 . @@ -615,14 +615,6 @@ Once you set \fBenvironment_timeout\fR to a non\-zero value, you need to tell Pu . .IP "" 0 . -.SS "environment_timeout_mode" -How Puppet interprets the \fBenvironment_timeout\fR setting when \fBenvironment_timeout\fR is neither \fB0\fR nor \fBunlimited\fR\. If set to \fBfrom_created\fR, then the environment will be evicted \fBenvironment_timeout\fR seconds from when it was created\. If set to \fBfrom_last_used\fR then the environment will be evicted \fBenvironment_timeout\fR seconds from when it was last used\. -. -.IP "\(bu" 4 -\fIDefault\fR: from_created -. -.IP "" 0 -. .SS "environmentpath" A search path for directory environments, as a list of directories separated by the system path separator character\. (The POSIX path separator is \':\', and the Windows path separator is \';\'\.) . From 5010fe4f57ff43e8c56698f355e1222ea1ecbe29 Mon Sep 17 00:00:00 2001 From: Luchian Nemes Date: Mon, 19 Oct 2020 12:34:37 +0300 Subject: [PATCH 208/731] (maint) Remove temporary workflow This temporary workflow was added in an attempt to solve the issue presented in #8403. This commit simply removes the workflow. --- .github/workflows/temporary.yml | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 .github/workflows/temporary.yml diff --git a/.github/workflows/temporary.yml b/.github/workflows/temporary.yml deleted file mode 100644 index ca4b84f9ec3..00000000000 --- a/.github/workflows/temporary.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- -name: 'Temporary hourly workflow' - -on: - schedule: - - cron: '0 * * * *' - -jobs: - temporary_hourly_job: - name: Temporary hourly job - - runs-on: ubuntu-latest - steps: - - name: Temporary dummy step - run: echo "Done" From c9dfabb6a395ca96c216b52d6686678e0b0751ee Mon Sep 17 00:00:00 2001 From: BogdanIrimie Date: Fri, 16 Oct 2020 16:01:08 +0300 Subject: [PATCH 209/731] (PUP-10717) Puppet should not append facts to facter results when calling puppet facts show. --- lib/puppet/indirector/facts/facter.rb | 2 +- spec/unit/indirector/facts/facter_spec.rb | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/puppet/indirector/facts/facter.rb b/lib/puppet/indirector/facts/facter.rb index 76e39563356..0d45927e15a 100644 --- a/lib/puppet/indirector/facts/facter.rb +++ b/lib/puppet/indirector/facts/facter.rb @@ -39,7 +39,7 @@ def find(request) Puppet::Node::Facts.new(request.key, Facter.to_hash) end - result.add_local_facts + result.add_local_facts unless request.options[:resolve_options] result.sanitize result end diff --git a/spec/unit/indirector/facts/facter_spec.rb b/spec/unit/indirector/facts/facter_spec.rb index abe7d3be930..3e1e0e2b5e6 100644 --- a/spec/unit/indirector/facts/facter_spec.rb +++ b/spec/unit/indirector/facts/facter_spec.rb @@ -170,6 +170,12 @@ @facter.find(@request) end + it 'should NOT add local facts' do + expect(facts).not_to receive(:add_local_facts) + + @facter.find(@request) + end + describe 'when Facter version is lower than 4.0.40' do before :each do allow(Facter).to receive(:respond_to?).and_return(false) From b3cf24b390a9d4857276637adc1efa40b7de9cfb Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Mon, 19 Oct 2020 13:36:24 +0000 Subject: [PATCH 210/731] (packaging) Updating the puppet.pot file --- locales/puppet.pot | 55 +++++++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 25 deletions(-) diff --git a/locales/puppet.pot b/locales/puppet.pot index deb54845c29..2d25e9c8584 100644 --- a/locales/puppet.pot +++ b/locales/puppet.pot @@ -6,11 +6,11 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Puppet automation framework 6.18.0-410-gf8b64860f1\n" +"Project-Id-Version: Puppet automation framework 6.19.0-330-ge015d69afc\n" "\n" "Report-Msgid-Bugs-To: https://tickets.puppetlabs.com\n" -"POT-Creation-Date: 2020-10-13 23:08+0000\n" -"PO-Revision-Date: 2020-10-13 23:08+0000\n" +"POT-Creation-Date: 2020-10-19 13:36+0000\n" +"PO-Revision-Date: 2020-10-19 13:36+0000\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -546,76 +546,81 @@ msgstr "" msgid "Applied catalog in %{seconds} seconds" msgstr "" -#: ../lib/puppet/configurer.rb:226 +#: ../lib/puppet/configurer.rb:225 msgid "Could not select a functional puppet server from server_list: '%{server_list}'" msgstr "" -#: ../lib/puppet/configurer.rb:276 +#. TRANSLATORS 'server_list' is the name of a setting and should not be translated +#: ../lib/puppet/configurer.rb:239 +msgid "Selected puppet server from the `server_list` setting: %{server}:%{port}" +msgstr "" + +#: ../lib/puppet/configurer.rb:275 msgid "Local environment: '%{local_env}' doesn't match the environment of the cached catalog '%{catalog_env}', switching agent to '%{catalog_env}'." msgstr "" -#: ../lib/puppet/configurer.rb:321 +#: ../lib/puppet/configurer.rb:320 msgid "Local environment: '%{local_env}' doesn't match server specified node environment '%{node_env}', switching agent to '%{node_env}'." msgstr "" -#: ../lib/puppet/configurer.rb:336 +#: ../lib/puppet/configurer.rb:335 msgid "Using configured environment '%{env}'" msgstr "" -#: ../lib/puppet/configurer.rb:340 +#: ../lib/puppet/configurer.rb:339 msgid "Unable to fetch my node definition, but the agent run will continue:" msgstr "" -#: ../lib/puppet/configurer.rb:368 +#: ../lib/puppet/configurer.rb:367 msgid "Not using catalog because its environment '%{catalog_env}' does not match agent specified environment '%{local_env}' and strict_environment_mode is set" msgstr "" -#: ../lib/puppet/configurer.rb:379 +#: ../lib/puppet/configurer.rb:378 msgid "Catalog environment didn't stabilize after %{tries} fetches, aborting run" msgstr "" -#: ../lib/puppet/configurer.rb:381 +#: ../lib/puppet/configurer.rb:380 msgid "Local environment: '%{local_env}' doesn't match server specified environment '%{catalog_env}', restarting agent run with environment '%{catalog_env}'" msgstr "" -#: ../lib/puppet/configurer.rb:422 +#: ../lib/puppet/configurer.rb:421 msgid "Failed to apply catalog: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:451 ../lib/puppet/http/resolver/server_list.rb:67 +#: ../lib/puppet/configurer.rb:450 ../lib/puppet/http/resolver/server_list.rb:67 msgid "Puppet server %{host}:%{port} is unavailable: %{code} %{reason}" msgstr "" #. TRANSLATORS 'server_list' is the name of a setting and should not be translated -#: ../lib/puppet/configurer.rb:455 ../lib/puppet/http/resolver/server_list.rb:70 +#: ../lib/puppet/configurer.rb:454 ../lib/puppet/http/resolver/server_list.rb:70 msgid "Unable to connect to server from server_list setting: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:466 ../lib/puppet/face/report.rb:47 +#: ../lib/puppet/configurer.rb:465 ../lib/puppet/face/report.rb:47 msgid "Could not send report: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:475 +#: ../lib/puppet/configurer.rb:474 msgid "Could not save last run local report: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:494 +#: ../lib/puppet/configurer.rb:493 msgid "Uploading facts for %{node} to %{server}" msgstr "" -#: ../lib/puppet/configurer.rb:502 +#: ../lib/puppet/configurer.rb:501 msgid "Failed to submit facts: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:517 +#: ../lib/puppet/configurer.rb:516 msgid "Could not run command from %{setting}: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:535 +#: ../lib/puppet/configurer.rb:534 msgid "Could not retrieve catalog from cache: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:556 +#: ../lib/puppet/configurer.rb:555 msgid "Could not retrieve catalog from remote server: %{detail}" msgstr "" @@ -702,20 +707,20 @@ msgid "Convert custom terminus to hiera 5 API." msgstr "" #. TRANSLATORS 'environment_data_provider' is a setting and should not be translated -#: ../lib/puppet/defaults.rb:737 +#: ../lib/puppet/defaults.rb:717 msgid "Setting 'environment_data_provider' is deprecated." msgstr "" -#: ../lib/puppet/defaults.rb:820 +#: ../lib/puppet/defaults.rb:800 msgid "Certificate names must be lower case" msgstr "" -#: ../lib/puppet/defaults.rb:1070 ../lib/puppet/settings/enum_setting.rb:13 ../lib/puppet/settings/symbolic_enum_setting.rb:14 +#: ../lib/puppet/defaults.rb:1050 ../lib/puppet/settings/enum_setting.rb:13 ../lib/puppet/settings/symbolic_enum_setting.rb:14 msgid "Invalid value '%{value}' for parameter %{name}. Allowed values are '%{allowed_values}'" msgstr "" #. TRANSLATORS 'pluginsync' is a setting and should not be translated -#: ../lib/puppet/defaults.rb:1908 +#: ../lib/puppet/defaults.rb:1888 msgid "Setting 'pluginsync' is deprecated." msgstr "" From 9225f65a8fa08211473abcbf334ca988bfc53a7d Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Fri, 9 Oct 2020 16:04:22 -0700 Subject: [PATCH 211/731] (maint) Refactor response body reading Previously, each get, post, etc method called `response.body` in the non-streaming case. Move that call into the private `execute_streaming` method and simplify the callers. The overall effect is the same. Non-streamed responses are fully read before the `execute_streaming` method returns. Streamed responses are yielded to the caller, so they can read the body in chunks. --- lib/puppet/http/client.rb | 34 ++++++++++------------------------ 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/lib/puppet/http/client.rb b/lib/puppet/http/client.rb index 5191e30cfb2..cf945ef32b3 100644 --- a/lib/puppet/http/client.rb +++ b/lib/puppet/http/client.rb @@ -126,13 +126,7 @@ def get(url, headers: {}, params: {}, options: {}, &block) request = Net::HTTP::Get.new(url, @default_headers.merge(headers)) - execute_streaming(request, options: options) do |response| - if block_given? - yield response - else - response.body - end - end + execute_streaming(request, options: options, &block) end # @@ -158,9 +152,7 @@ def head(url, headers: {}, params: {}, options: {}) request = Net::HTTP::Head.new(url, @default_headers.merge(headers)) - execute_streaming(request, options: options) do |response| - response.body - end + execute_streaming(request, options: options) end # @@ -193,9 +185,7 @@ def put(url, body, headers: {}, params: {}, options: {}) raise ArgumentError, "'put' requires a 'content-type' header" unless request['Content-Type'] - execute_streaming(request, options: options) do |response| - response.body - end + execute_streaming(request, options: options) end # @@ -228,13 +218,7 @@ def post(url, body, headers: {}, params: {}, options: {}, &block) raise ArgumentError, "'post' requires a 'content-type' header" unless request['Content-Type'] - execute_streaming(request, options: options) do |response| - if block_given? - yield response - else - response.body - end - end + execute_streaming(request, options: options, &block) end # @@ -260,9 +244,7 @@ def delete(url, headers: {}, params: {}, options: {}) request = Net::HTTP::Delete.new(url, @default_headers.merge(headers)) - execute_streaming(request, options: options) do |response| - response.body - end + execute_streaming(request, options: options) end # @@ -329,7 +311,11 @@ def execute_streaming(request, options: {}, &block) end end - yield response + if block_given? + yield response + else + response.body + end ensure response.drain end From c0f7073415d61ec2f76f8cff62fe3268776721f5 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Fri, 2 Oct 2020 11:12:19 -0700 Subject: [PATCH 212/731] (maint) Document Puppet::HTTP --- lib/puppet/http.rb | 8 +- lib/puppet/http/client.rb | 234 +++++++++++++++--------- lib/puppet/http/errors.rb | 16 ++ lib/puppet/http/external_client.rb | 8 +- lib/puppet/http/factory.rb | 1 - lib/puppet/http/pool.rb | 1 - lib/puppet/http/pool_entry.rb | 1 - lib/puppet/http/redirector.rb | 16 +- lib/puppet/http/resolver.rb | 20 +- lib/puppet/http/resolver/server_list.rb | 16 +- lib/puppet/http/resolver/settings.rb | 11 +- lib/puppet/http/resolver/srv.rb | 16 +- lib/puppet/http/response.rb | 59 +++--- lib/puppet/http/retry_after_handler.rb | 17 +- lib/puppet/http/service.rb | 38 ++-- lib/puppet/http/service/ca.rb | 33 ++-- lib/puppet/http/service/compiler.rb | 60 +++--- lib/puppet/http/service/file_server.rb | 42 ++--- lib/puppet/http/service/puppetserver.rb | 15 +- lib/puppet/http/service/report.rb | 18 +- lib/puppet/http/session.rb | 27 +-- lib/puppet/http/site.rb | 1 - 22 files changed, 313 insertions(+), 345 deletions(-) diff --git a/lib/puppet/http.rb b/lib/puppet/http.rb index ffc62a9e8d7..4717ed1b818 100644 --- a/lib/puppet/http.rb +++ b/lib/puppet/http.rb @@ -5,7 +5,13 @@ module HTTP end end - # @api private + # Contains an HTTP client for making network requests to puppet and other + # HTTP servers. + # + # @see Puppet::HTTP::Client + # @see Puppet::HTTP::HTTPError + # @see Puppet::HTTP::Response + # @api public module HTTP ACCEPT_ENCODING = "gzip;q=1.0,deflate;q=0.6,identity;q=0.3".freeze HEADER_PUPPET_VERSION = "X-Puppet-Version".freeze diff --git a/lib/puppet/http/client.rb b/lib/puppet/http/client.rb index 84f506c6d45..be4853d62c8 100644 --- a/lib/puppet/http/client.rb +++ b/lib/puppet/http/client.rb @@ -1,21 +1,94 @@ +# The HTTP client provides methods for making `GET`, `POST`, etc requests to +# HTTP(S) servers. It also provides methods for resolving Puppetserver REST +# service endpoints using SRV records and settings (such as `server_list`, +# `server`, `ca_server`, etc). Once a service endpoint has been resolved, there +# are methods for making REST requests (such as getting a node, sending facts, +# etc). # -# @api private +# The client uses persistent HTTP connections by default unless the `Connection: +# close` header is specified and supports streaming response bodies. # -# The client contains a pool of persistent HTTP connections and creates HTTP -# sessions. +# By default the client only trusts the Puppet CA for HTTPS connections. However, +# if the `include_system_store` request option is set to true, then Puppet will +# trust certificates in the puppet-agent CA bundle. # +# @example To access the HTTP client: +# client = Puppet.runtime[:http] +# +# @example To make an HTTP GET request: +# response = client.get(URI("http://www.example.com")) +# +# @example To make an HTTPS GET request, trusting the puppet CA and certs in Puppet's CA bundle: +# response = client.get(URI("https://www.example.com"), include_system_store: true) +# +# @example To use a URL containing special characters, such as spaces: +# response = client.get(URI(Puppet::Util.uri_encode("https://www.example.com/path to file"))) +# +# @example To pass query parameters: +# response = client.get(URI("https://www.example.com"), query: {'q' => 'puppet'}) +# +# @example To pass custom headers: +# response = client.get(URI("https://www.example.com"), headers: {'Accept-Content' => 'application/json'}) +# +# @example To check if the response is successful (2xx): +# response = client.get(URI("http://www.example.com")) +# puts response.success? +# +# @example To get the response code and reason: +# response = client.get(URI("http://www.example.com")) +# unless response.success? +# puts "HTTP #{response.code} #{response.reason}" +# end +# +# @example To read response headers: +# response = client.get(URI("http://www.example.com")) +# puts response['Content-Type'] +# +# @example To stream the response body: +# client.get(URI("http://www.example.com")) do |response| +# if response.success? +# response.read_body do |data| +# puts data +# end +# end +# end +# +# @example To handle exceptions: +# begin +# client.get(URI("https://www.example.com")) +# rescue Puppet::HTTP::ResponseError => e +# puts "HTTP #{e.response.code} #{e.response.reason}" +# rescue Puppet::HTTP::ConnectionError => e +# puts "Connection error #{e.message}" +# rescue Puppet::SSL::SSLError => e +# puts "SSL error #{e.message}" +# rescue Puppet::HTTP::HTTPError => e +# puts "General HTTP error #{e.message}" +# end +# +# @example To route to the `:puppet` service: +# session = client.create_session +# service = session.route_to(:puppet) +# +# @example To make a node request: +# node = service.get_node(Puppet[:certname], environment: 'production') +# +# @example To submit facts: +# facts = Puppet::Indirection::Facts.indirection.find(Puppet[:certname]) +# service.put_facts(Puppet[:certname], environment: 'production', facts: facts) +# +# @example To submit a report to the `:report` service: +# report = Puppet::Transaction::Report.new +# service = session.route_to(:report) +# service.put_report(Puppet[:certname], report, environment: 'production') +# +# @api public class Puppet::HTTP::Client - # @api private - # @return [Puppet::HTTP::Pool] the pool instance associated with - # this client attr_reader :pool - # - # @api private - # - # Create a new http client instance. The client contains a pool of persistent - # HTTP connections and creates HTTP sessions. + # Create a new http client instance. Use `Puppet.runtime[:http]` to get + # the current client instead of creating an instance of this class. # # @param [Puppet::HTTP::Pool] pool pool of persistent Net::HTTP # connections @@ -40,22 +113,19 @@ def initialize(pool: Puppet::HTTP::Pool.new(Puppet[:http_keepalive_timeout]), ss @retry_after_handler = Puppet::HTTP::RetryAfterHandler.new(retry_limit, Puppet[:runinterval]) end - # - # @api private - # # Create a new HTTP session. A session is the object through which services # may be connected to and accessed. # # @return [Puppet::HTTP::Session] the newly created HTTP session # + # @api public def create_session Puppet::HTTP::Session.new(self, build_resolvers) end - # - # @api private - # - # Open a connection to the given URI + # Open a connection to the given URI. It is typically not necessary to call + # this method as the client will create connections as needed when a request + # is made. # # @param [URI] uri the connection destination # @param [Hash] options @@ -63,10 +133,6 @@ def create_session # be used for connections # @option options [Boolean] :include_system_store (false) if we should include # the system store for connection - # - # @yield [Net::HTTP] If a block is given, yields an active http connection - # from the pool - # def connect(uri, options: {}, &block) start = Time.now verifier = nil @@ -101,26 +167,34 @@ def connect(uri, options: {}, &block) {uri: uri, elapsed: elapsed(start), message: e.message}, e, connected) end - # - # @api private - # + # These options apply to all HTTP request methods + # + # @!macro [new] request_options + # @param [Hash] options HTTP request options. Options not recognized by the + # HTTP implementation will be ignored. + # @option options [Puppet::SSL::SSLContext] :ssl_context (nil) ssl context to + # be used for connections + # @option options [Boolean] :include_system_store (false) if we should include + # the system store for connection + # @option options [Integer] :redirect_limit (10) The maximum number of HTTP + # redirections to allow for this request. + # @option options [Hash] :basic_auth A map of `:username` => `String` and + # `:password` => `String` + # @option options [String] :metric_id The metric id used to track metrics + # on requests. + # Submits a GET HTTP request to the given url # # @param [URI] url the location to submit the http request # @param [Hash] headers merged with the default headers defined by the client # @param [Hash] params encoded and set as the url query - # @param [Hash] options passed through to the request execution - # @option options [Puppet::SSL::SSLContext] :ssl_context (nil) ssl context to - # be used for connections - # @option options [Boolean] :include_system_store (false) if we should include - # the system store for connection - # @param options [Integer] :redirect_limit number of HTTP redirections to allow - # for this request. + # @!macro request_options # # @yield [Puppet::HTTP::Response] if a block is given yields the response # - # @return [String] if a block is not given, returns the response body + # @return [Puppet::HTTP::Response] the response # + # @api public def get(url, headers: {}, params: {}, options: {}, &block) url = encode_query(url, params) @@ -135,24 +209,16 @@ def get(url, headers: {}, params: {}, options: {}, &block) end end - # - # @api private - # # Submits a HEAD HTTP request to the given url # # @param [URI] url the location to submit the http request # @param [Hash] headers merged with the default headers defined by the client # @param [Hash] params encoded and set as the url query - # @param [Hash] options passed through to the request execution - # @option options [Puppet::SSL::SSLContext] :ssl_context (nil) ssl context to - # be used for connections - # @option options [Boolean] :include_system_store (false) if we should include - # the system store for connection - # @param options [Integer] :redirect_limit number of HTTP redirections to allow - # for this request. + # @!macro request_options # - # @return [String] the body of the request response + # @return [Puppet::HTTP::Response] the response # + # @api public def head(url, headers: {}, params: {}, options: {}) url = encode_query(url, params) @@ -163,26 +229,19 @@ def head(url, headers: {}, params: {}, options: {}) end end - # - # @api private - # # Submits a PUT HTTP request to the given url # # @param [URI] url the location to submit the http request # @param [String] body the body of the PUT request - # @param [Hash] headers merged with the default headers defined by the client + # @param [Hash] headers merged with the default headers defined by the client. The + # `Content-Type` header is required and should correspond to the type of data passed + # as the `body` argument. # @param [Hash] params encoded and set as the url query - # @param [Hash] options passed through to the request execution - # @option options [String] :content_type the type of the body content - # @option options [Puppet::SSL::SSLContext] :ssl_context (nil) ssl context to - # be used for connections - # @option options [Boolean] :include_system_store (false) if we should include - # the system store for connection - # @param options [Integer] :redirect_limit number of HTTP redirections to allow - # for this request. + # @!macro request_options # - # @return [String] the body of the request response + # @return [Puppet::HTTP::Response] the response # + # @api public def put(url, body, headers: {}, params: {}, options: {}) raise ArgumentError, "'put' requires a string 'body' argument" unless body.is_a?(String) url = encode_query(url, params) @@ -198,26 +257,21 @@ def put(url, body, headers: {}, params: {}, options: {}) end end - # - # @api private - # # Submits a POST HTTP request to the given url # # @param [URI] url the location to submit the http request # @param [String] body the body of the POST request - # @param [Hash] headers merged with the default headers defined by the client + # @param [Hash] headers merged with the default headers defined by the client. The + # `Content-Type` header is required and should correspond to the type of data passed + # as the `body` argument. # @param [Hash] params encoded and set as the url query - # @param [Hash] options passed through to the request execution - # @option options [String] :content_type the type of the body content - # @option options [Puppet::SSL::SSLContext] :ssl_context (nil) ssl context to - # be used for connections - # @option options [Boolean] :include_system_store (false) if we should include - # the system store for connection - # @param options [Integer] :redirect_limit number of HTTP redirections to allow - # for this request. + # @!macro request_options + # + # @yield [Puppet::HTTP::Response] if a block is given yields the response # - # @return [String] the body of the request response + # @return [Puppet::HTTP::Response] the response # + # @api public def post(url, body, headers: {}, params: {}, options: {}, &block) raise ArgumentError, "'post' requires a string 'body' argument" unless body.is_a?(String) url = encode_query(url, params) @@ -237,24 +291,16 @@ def post(url, body, headers: {}, params: {}, options: {}, &block) end end - # - # @api private - # - # Submits a DELETE HTTP request to the given url + # Submits a DELETE HTTP request to the given url. # # @param [URI] url the location to submit the http request # @param [Hash] headers merged with the default headers defined by the client # @param [Hash] params encoded and set as the url query - # @param [Hash] options options hash passed through to the request execution - # @option options [Puppet::SSL::SSLContext] :ssl_context (nil) ssl context to - # be used for connections - # @option options [Boolean] :include_system_store (false) if we should include - # the system store for connection - # @param options [Integer] :redirect_limit number of HTTP redirections to allow - # for this request. + # @!macro request_options # - # @return [String] the body of the request response + # @return [Puppet::HTTP::Response] the response # + # @api public def delete(url, headers: {}, params: {}, options: {}) url = encode_query(url, params) @@ -265,11 +311,11 @@ def delete(url, headers: {}, params: {}, options: {}) end end + # Close persistent connections in the pool. # - # @api private - # - # Close persistent connections in the pool + # @return [void] # + # @api public def close @pool.close end @@ -286,6 +332,21 @@ def encode_query(url, params) private + # Connect or borrow a connection from the pool to the host and port associated + # with the request's URL. Then execute the HTTP request, retrying and + # following redirects as needed, and return the HTTP response. The response + # body will always be fully drained/consumed when this method returns. + # + # If a block is provided, then the response will be yielded to the caller, + # allowing the response body to be streamed. + # + # If the request/response did not result in an exception and the caller did + # not ask for the connection to be closed (via Connection: close), then the + # connection will be returned to the pool. + # + # @yieldparam [Puppet::HTTP::Response] response The final response, after + # following redirects and retrying + # @return [Puppet::HTTP::Response] def execute_streaming(request, options: {}, &block) redirector = Puppet::HTTP::Redirector.new(options.fetch(:redirect_limit, @default_redirect_limit)) @@ -331,6 +392,9 @@ def execute_streaming(request, options: {}, &block) yield response ensure + # we need to make sure the response body is fully consumed before + # the connection is put back in the pool, otherwise the response + # for one request could leak into a future response. response.drain end diff --git a/lib/puppet/http/errors.rb b/lib/puppet/http/errors.rb index 58cbd74c63b..043954febda 100644 --- a/lib/puppet/http/errors.rb +++ b/lib/puppet/http/errors.rb @@ -1,14 +1,26 @@ module Puppet::HTTP + # A base class for puppet http errors + # @api public class HTTPError < Puppet::Error; end + # A connection error such as if the server refuses the connection. + # @api public class ConnectionError < HTTPError; end + # A failure to route to the server such as if the `server_list` is exhausted. + # @api public class RouteError < HTTPError; end + # An HTTP protocol error, such as the server's response missing a required header. + # @api public class ProtocolError < HTTPError; end + # An error serializing or deserializing an object via REST. + # @api public class SerializationError < HTTPError; end + # An error due to an unsuccessful HTTP response, such as HTTP 500. + # @api public class ResponseError < HTTPError attr_reader :response @@ -18,12 +30,16 @@ def initialize(response) end end + # An error if asked to follow too many redirects (such as HTTP 301). + # @api public class TooManyRedirects < HTTPError def initialize(addr) super(_("Too many HTTP redirections for %{addr}") % { addr: addr}) end end + # An error if asked to retry (such as HTTP 503) too many times. + # @api public class TooManyRetryAfters < HTTPError def initialize(addr) super(_("Too many HTTP retries for %{addr}") % { addr: addr}) diff --git a/lib/puppet/http/external_client.rb b/lib/puppet/http/external_client.rb index acb1ccb0770..f2a0b1b74a7 100644 --- a/lib/puppet/http/external_client.rb +++ b/lib/puppet/http/external_client.rb @@ -1,4 +1,3 @@ -# # Adapts an external http_client_class to the HTTP client API. The former # is typically registered by puppetserver and only implements a subset of # the Puppet::Network::HTTP::Connection methods. As a result, only the @@ -7,10 +6,10 @@ # # @api private class Puppet::HTTP::ExternalClient < Puppet::HTTP::Client - # Create an external http client + + # Create an external http client. # # @param [Class] http_client_class The class to create to handle the request - # @api private def initialize(http_client_class) @http_client_class = http_client_class end @@ -58,8 +57,7 @@ def post(url, body, headers: {}, params: {}, options: {}, &block) raise Puppet::HTTP::HTTPError.new(e.message, e) end - # Close the external http client. - # + # (see Puppet::HTTP::Client#close) # @api private def close # This is a noop as puppetserver doesn't provide a way to close its http client. diff --git a/lib/puppet/http/factory.rb b/lib/puppet/http/factory.rb index 78d94c1d2d7..398a054c299 100644 --- a/lib/puppet/http/factory.rb +++ b/lib/puppet/http/factory.rb @@ -8,7 +8,6 @@ # specified {Puppet::HTTP::Site Site} and puppet settings. # # @api private -# class Puppet::HTTP::Factory @@openssl_initialized = false diff --git a/lib/puppet/http/pool.rb b/lib/puppet/http/pool.rb index d8e9a491c69..216c5ad8908 100644 --- a/lib/puppet/http/pool.rb +++ b/lib/puppet/http/pool.rb @@ -7,7 +7,6 @@ # same site, and will be reused in MRU order. # # @api private -# class Puppet::HTTP::Pool attr_reader :factory, :keepalive_timeout diff --git a/lib/puppet/http/pool_entry.rb b/lib/puppet/http/pool_entry.rb index 8d75746e16e..a7759c53b14 100644 --- a/lib/puppet/http/pool_entry.rb +++ b/lib/puppet/http/pool_entry.rb @@ -2,7 +2,6 @@ # an expiration time for the connection. # # @api private -# class Puppet::HTTP::PoolEntry attr_reader :connection, :verifier diff --git a/lib/puppet/http/redirector.rb b/lib/puppet/http/redirector.rb index 66ee6896859..0b1c6fef80e 100644 --- a/lib/puppet/http/redirector.rb +++ b/lib/puppet/http/redirector.rb @@ -1,23 +1,16 @@ -# -# @api private -# # Handle HTTP redirects # +# @api private class Puppet::HTTP::Redirector - # - # @api private - # # Create a new redirect handler # # @param [Integer] redirect_limit maximum number of redirects allowed # + # @api private def initialize(redirect_limit) @redirect_limit = redirect_limit end - # - # @api private - # # Determine of the HTTP response code indicates a redirect # # @param [Net::HTTP] request request that received the response @@ -25,6 +18,7 @@ def initialize(redirect_limit) # # @return [Boolean] true if the response code is 301, 302, or 307. # + # @api private def redirect?(request, response) # Net::HTTPRedirection is not used because historically puppet # has only handled these, and we're not a browser @@ -36,9 +30,6 @@ def redirect?(request, response) end end - # - # @api private - # # Implement the HTTP request redirection # # @param [Net::HTTP] request request that has been redirected @@ -48,6 +39,7 @@ def redirect?(request, response) # @return [Net::HTTP] A new request based on the original request, but with # the redirected location # + # @api private def redirect_to(request, response, redirects) raise Puppet::HTTP::TooManyRedirects.new(request.uri) if redirects >= @redirect_limit diff --git a/lib/puppet/http/resolver.rb b/lib/puppet/http/resolver.rb index d889c24cbc8..f771a77e54d 100644 --- a/lib/puppet/http/resolver.rb +++ b/lib/puppet/http/resolver.rb @@ -1,26 +1,17 @@ -# -# @api private -# # Resolver base class. Each resolver represents a different strategy for # resolving a service name into a list of candidate servers and ports. # # @abstract Subclass and override {#resolve} to create a new resolver. -# +# @api public class Puppet::HTTP::Resolver # - # @api private - # - # Create a new resolver + # Create a new resolver. # # @param [Puppet::HTTP::Client] client - # def initialize(client) @client = client end - # - # @api private - # # Return a working server/port for the resolver. This is the base # implementation and is meant to be a placeholder. # @@ -33,14 +24,12 @@ def initialize(client) # # @raise [NotImplementedError] this base class is not implemented # + # @api public def resolve(session, name, ssl_context: nil, canceled_handler: nil) raise NotImplementedError end - # - # @api private - # - # Check a given connection to establish if it can be relied on for future use + # Check a given connection to establish if it can be relied on for future use. # # @param [Puppet::HTTP::Session] session # @param [Puppet::HTTP::Service] service @@ -48,6 +37,7 @@ def resolve(session, name, ssl_context: nil, canceled_handler: nil) # # @return [Boolean] Returns true if a connection is successful, false otherwise # + # @api public def check_connection?(session, service, ssl_context: nil) service.connect(ssl_context: ssl_context) return true diff --git a/lib/puppet/http/resolver/server_list.rb b/lib/puppet/http/resolver/server_list.rb index 18d93ea0803..ac2d21a31de 100644 --- a/lib/puppet/http/resolver/server_list.rb +++ b/lib/puppet/http/resolver/server_list.rb @@ -1,12 +1,10 @@ -# -# @api private -# # Use the server_list setting to resolve a service. This resolver is only used # if server_list is set either on the command line or in the configuration file. # +# @api public class Puppet::HTTP::Resolver::ServerList < Puppet::HTTP::Resolver - # - # @api private + + # Create a server list resolver. # # @param [Puppet::HTTP::Client] client # @param [Array] server_list_setting array of servers set via the @@ -24,15 +22,12 @@ def initialize(client, server_list_setting:, default_port:, services: ) @services = services end - # - # @api private - # # Walk the server_list to find a server and port that will connect successfully. # - # @param [Puppet::HTTP::Session] session + # @param [Puppet::HTTP::Session] session # @param [Symbol] name the name of the service being resolved # @param [Puppet::SSL::SSLContext] ssl_context - # @param [Proc] canceled_handler (nil) optional callback allowing a resolver + # @param [Proc] canceled_handler optional callback allowing a resolver # to cancel resolution. # # @return [nil] return nil if the service to be resolved does not support @@ -43,6 +38,7 @@ def initialize(client, server_list_setting:, default_port:, services: ) # @raise [Puppet::Error] raise if none of the servers defined in server_list # are available # + # @api public def resolve(session, name, ssl_context: nil, canceled_handler: nil) # If we're configured to use an explicit service host, e.g. report_server # then don't use server_list to resolve the `:report` service. diff --git a/lib/puppet/http/resolver/settings.rb b/lib/puppet/http/resolver/settings.rb index c2ed1bac32a..4e7ac6f9d79 100644 --- a/lib/puppet/http/resolver/settings.rb +++ b/lib/puppet/http/resolver/settings.rb @@ -1,24 +1,21 @@ -# -# @api private -# # Resolve a service using settings. This is the default resolver if none of the # other resolvers find a functional connection. # +# @api public class Puppet::HTTP::Resolver::Settings < Puppet::HTTP::Resolver - # - # @api private - # + # Resolve a service using the default server and port settings for this service. # # @param [Puppet::HTTP::Session] session # @param [Symbol] name the name of the service to be resolved # @param [Puppet::SSL::SSLContext] ssl_context - # @param [Proc] canceled_handler (nil) optional callback allowing a resolver + # @param [Proc] canceled_handler optional callback allowing a resolver # to cancel resolution. # # @return [Puppet::HTTP::Service] if the service successfully connects, # return it. Otherwise, return nil. # + # @api public def resolve(session, name, ssl_context: nil, canceled_handler: nil) service = Puppet::HTTP::Service.create_service(@client, session, name) check_connection?(session, service, ssl_context: ssl_context) ? service : nil diff --git a/lib/puppet/http/resolver/srv.rb b/lib/puppet/http/resolver/srv.rb index 7ca7edfb322..73ad5782e67 100644 --- a/lib/puppet/http/resolver/srv.rb +++ b/lib/puppet/http/resolver/srv.rb @@ -1,11 +1,9 @@ +# Resolve a service using DNS SRV records. # -# @api private -# -# Resolve a service using SRV -# +# @api public class Puppet::HTTP::Resolver::SRV < Puppet::HTTP::Resolver - # - # @api private + + # Create an DNS SRV resolver. # # @param [Puppet::HTTP::Client] client # @param [String] domain srv domain @@ -17,20 +15,18 @@ def initialize(client, domain:, dns: Resolv::DNS.new) @delegate = Puppet::HTTP::DNS.new(dns) end - # - # @api private - # # Walk the available srv records and return the first that successfully connects # # @param [Puppet::HTTP::Session] session # @param [Symbol] name the service being resolved # @param [Puppet::SSL::SSLContext] ssl_context - # @param [Proc] canceled_handler (nil) optional callback allowing a resolver + # @param [Proc] canceled_handler optional callback allowing a resolver # to cancel resolution. # # @return [Puppet::HTTP::Service] if an available service is found, return # it. Return nil otherwise. # + # @api public def resolve(session, name, ssl_context: nil, canceled_handler: nil) # Here we pass our HTTP service name as the DNS SRV service name # This is fine for :ca, but note that :puppet and :file are handled diff --git a/lib/puppet/http/response.rb b/lib/puppet/http/response.rb index a0c5e0e4ec4..d70a2dccd3a 100644 --- a/lib/puppet/http/response.rb +++ b/lib/puppet/http/response.rb @@ -1,118 +1,103 @@ +# Represents the response returned from the server from an HTTP request. # -# @api private -# -# Represents the response returned from the server from an HTTP request -# +# @api public class Puppet::HTTP::Response # @api private # @return [Net::HTTP] the Net::HTTP response attr_reader :nethttp - # @api private # @return [URI] the response uri attr_reader :url - # - # @api private - # - # Object to represent the response returned from an HTTP request + # Object to represent the response returned from an HTTP request. # # @param [Net::HTTP] nethttp the request response # @param [URI] url - # def initialize(nethttp, url) @nethttp = nethttp @url = url end - # - # @api private - # - # Extract the response code + # Extract the response code. # # @return [Integer] Response code for the request # + # @api public def code @nethttp.code.to_i end - # - # @api private - # - # Extract the response message + # Extract the response message. # # @return [String] Response message for the request # + # @api public def reason @nethttp.message end - # - # @api private - # # Returns the entire response body. Can be used instead of - # Puppet::HTTP::Response.read_body, but both methods cannot be used for the + # `Puppet::HTTP::Response.read_body`, but both methods cannot be used for the # same response. # # @return [String] Response body for the request # + # @api public def body @nethttp.body end - # - # @api private - # # Streams the response body to the caller in chunks. Can be used instead of - # Puppet::HTTP::Response.body, but both methods cannot be used for the same + # `Puppet::HTTP::Response.body`, but both methods cannot be used for the same # response. # # @yield [String] Streams the response body in chunks # # @raise [ArgumentError] raise if a block is not given # + # @api public def read_body(&block) raise ArgumentError, "A block is required" unless block_given? @nethttp.read_body(&block) end - # - # @api private - # - # Check if the request received a response of success + # Check if the request received a response of success (HTTP 2xx). # # @return [Boolean] Returns true if the response indicates success # + # @api public def success? @nethttp.is_a?(Net::HTTPSuccess) end - # @api private - # # Get a header case-insensitively. + # # @param [String] name The header name # @return [String] The header value # + # @api public def [](name) @nethttp[name] end - # @api private - # # Yield each header name and value. Returns an enumerator if no block is given. # # @yieldparam [String] header name # @yieldparam [String] header value # + # @api public def each_header(&block) @nethttp.each_header(&block) end - # @api private - # - # Drain the response body. + # Ensure the response body is fully read so that the server is not blocked + # waiting for us to read data from the socket. Also if the caller streamed + # the response, but didn't read the data, we need a way to drain the socket + # before adding the connection back to the connection pool, otherwise the + # unread response data would "leak" into the next HTTP request/response. # + # @api public def drain body true diff --git a/lib/puppet/http/retry_after_handler.rb b/lib/puppet/http/retry_after_handler.rb index bd9d47b01b9..b7241580abc 100644 --- a/lib/puppet/http/retry_after_handler.rb +++ b/lib/puppet/http/retry_after_handler.rb @@ -1,28 +1,20 @@ require 'date' require 'time' -# -# @api private -# # Parse information relating to responses containing a Retry-After headers # +# @api private class Puppet::HTTP::RetryAfterHandler - # - # @api private - # + # Create a handler to allow the system to sleep between HTTP requests # # @param [Integer] retry_limit number of retries allowed # @param [Integer] max_sleep maximum sleep time allowed - # def initialize(retry_limit, max_sleep) @retry_limit = retry_limit @max_sleep = max_sleep end - # - # @api private - # # Does the response from the server tell us to wait until we attempt the next # retry? # @@ -32,6 +24,7 @@ def initialize(retry_limit, max_sleep) # @return [Boolean] Return true if the response code is 429 or 503, return # false otherwise # + # @api private def retry_after?(request, response) case response.code when 429, 503 @@ -41,9 +34,6 @@ def retry_after?(request, response) end end - # - # @api private - # # The amount of time to wait before attempting a retry # # @param [Net::HTTP] request @@ -55,6 +45,7 @@ def retry_after?(request, response) # @raise [Puppet::HTTP::TooManyRetryAfters] raise if we have hit our retry # limit # + # @api private def retry_after_interval(request, response, retries) raise Puppet::HTTP::TooManyRetryAfters.new(request.uri) if retries >= @retry_limit diff --git a/lib/puppet/http/service.rb b/lib/puppet/http/service.rb index 7c82ffbdfa3..b5606ca1b0f 100644 --- a/lib/puppet/http/service.rb +++ b/lib/puppet/http/service.rb @@ -1,24 +1,17 @@ +# Represents an abstract Puppet web service. # -# @api private -# -# Represents a puppet web service -# +# @abstract Subclass and implement methods for the service's REST APIs. +# @api public class Puppet::HTTP::Service - # @api private # @return [URI] the url associated with this service attr_reader :url - # @api private # @return [Array] available services SERVICE_NAMES = [:ca, :fileserver, :puppet, :puppetserver, :report].freeze - # @api private # @return [Array] format types that are unsupported EXCLUDED_FORMATS = [:yaml, :b64_zlib_yaml, :dot].freeze - # - # @api private - # # Create a new web service, which contains the URL used to connect to the # service. The four services implemented are `:ca`, `:fileserver`, `:puppet`, # and `:report`. @@ -35,6 +28,7 @@ class Puppet::HTTP::Service # # @return [Puppet::HTTP::Service] an instance of the service type requested # + # @api private def self.create_service(client, session, name, server = nil, port = nil) case name when :ca @@ -52,57 +46,49 @@ def self.create_service(client, session, name, server = nil, port = nil) end end - # - # @api private - # # Check if the service named is included in the list of available services. # # @param [Symbol] name # # @return [Boolean] # + # @api private def self.valid_name?(name) SERVICE_NAMES.include?(name) end - # - # @api private - # - # Create a new service + # Create a new service. Services should be created by calling `Puppet::HTTP::Session#route_to`. # # @param [Puppet::HTTP::Client] client # @param [Puppet::HTTP::Session] session # @param [URI] url The url to connect to # + # @api private def initialize(client, session, url) @client = client @session = session @url = url end - # - # @api private - # # Return the url with the given path encoded and appended # # @param [String] path the string to append to the base url # # @return [URI] the URI object containing the encoded path # + # @api public def with_base_url(path) u = @url.dup u.path += Puppet::Util.uri_encode(path) u end + # Open a connection using the given ssl context. # - # @api private - # - # Open a connection using the given ssl context - # - # @param [Puppet::SSL::SSLContext] ssl_context (nil) optional ssl context to - # connect with + # @param [Puppet::SSL::SSLContext] ssl_context An optional ssl context to connect with + # @return [void] # + # @api public def connect(ssl_context: nil) @client.connect(@url, options: {ssl_context: ssl_context}) end diff --git a/lib/puppet/http/service/ca.rb b/lib/puppet/http/service/ca.rb index 20465aecb68..ffb7a1ddb9a 100644 --- a/lib/puppet/http/service/ca.rb +++ b/lib/puppet/http/service/ca.rb @@ -1,26 +1,21 @@ +# The CA service is used to handle certificate related REST requests. # -# @api private -# -# The Ca service is used to handle certificate requests -# +# @api public class Puppet::HTTP::Service::Ca < Puppet::HTTP::Service - # @api private # @return [Hash] default headers for the ca service HEADERS = { 'Accept' => 'text/plain' }.freeze - # @api private # @return [String] default API for the ca service API = '/puppet-ca/v1'.freeze - # - # @api private + # Use `Puppet::HTTP::Session.route_to(:ca)` to create or get an instance of this class. # # @param [Puppet::HTTP::Client] client # @param [Puppet::HTTP::Session] session - # @param [String] server (Puppet[:ca_server]) If an explicit server is given, + # @param [String] server (`Puppet[:ca_server]`) If an explicit server is given, # create a service using that server. If server is nil, the default value # is used to create the service. - # @param [Integer] port (Puppet[:ca_port]) If an explicit port is given, create + # @param [Integer] port (`Puppet[:ca_port]`) If an explicit port is given, create # a service using that port. If port is nil, the default value is used to # create the service. # @@ -29,10 +24,7 @@ def initialize(client, session, server, port) super(client, session, url) end - # - # @api private - # - # Submit a GET request to retrieve the named certificate from the server + # Submit a GET request to retrieve the named certificate from the server. # # @param [String] name name of the certificate to request # @param [Puppet::SSL::SSLContext] ssl_context @@ -40,6 +32,7 @@ def initialize(client, session, server, port) # @return [Array] An array containing the # request response and the stringified body of the request response # + # @api public def get_certificate(name, ssl_context: nil) response = @client.get( with_base_url("/certificate/#{name}"), @@ -52,11 +45,8 @@ def get_certificate(name, ssl_context: nil) [response, response.body.to_s] end - # - # @api private - # # Submit a GET request to retrieve the certificate revocation list from the - # server + # server. # # @param [Time] if_modified_since If not nil, only download the CRL if it has # been modified since the specified time. @@ -65,6 +55,7 @@ def get_certificate(name, ssl_context: nil) # @return [Array] An array containing the # request response and the stringified body of the request response # + # @api public def get_certificate_revocation_list(if_modified_since: nil, ssl_context: nil) headers = add_puppet_headers(HEADERS) headers['If-Modified-Since'] = if_modified_since.httpdate if if_modified_since @@ -80,10 +71,7 @@ def get_certificate_revocation_list(if_modified_since: nil, ssl_context: nil) [response, response.body.to_s] end - # - # @api private - # - # Submit a PUT request to send a certificate request to the server + # Submit a PUT request to send a certificate request to the server. # # @param [String] name The name of the certificate request being sent # @param [OpenSSL::X509::Request] csr Certificate request to send to the @@ -92,6 +80,7 @@ def get_certificate_revocation_list(if_modified_since: nil, ssl_context: nil) # # @return [Puppet::HTTP::Response] The request response # + # @api public def put_certificate_request(name, csr, ssl_context: nil) headers = add_puppet_headers(HEADERS) headers['Content-Type'] = 'text/plain' diff --git a/lib/puppet/http/service/compiler.rb b/lib/puppet/http/service/compiler.rb index 3edbcaea9b3..935dd12d882 100644 --- a/lib/puppet/http/service/compiler.rb +++ b/lib/puppet/http/service/compiler.rb @@ -1,23 +1,19 @@ -# -# @api private -# # The Compiler service is used to submit and retrieve data from the # puppetserver. # +# @api public class Puppet::HTTP::Service::Compiler < Puppet::HTTP::Service - # @api private # @return [String] Default API for the Compiler service API = '/puppet/v3'.freeze - # - # @api private + # Use `Puppet::HTTP::Session.route_to(:puppet)` to create or get an instance of this class. # # @param [Puppet::HTTP::Client] client # @param [Puppet::HTTP::Session] session - # @param [String] server (Puppet[:ca_server]) If an explicit server is given, + # @param [String] server (`Puppet[:server]`) If an explicit server is given, # create a service using that server. If server is nil, the default value # is used to create the service. - # @param [Integer] port (Puppet[:ca_port]) If an explicit port is given, create + # @param [Integer] port (`Puppet[:masterport]`) If an explicit port is given, create # a service using that port. If port is nil, the default value is used to # create the service. # @@ -26,10 +22,7 @@ def initialize(client, session, server, port) super(client, session, url) end - # - # @api private - # - # Submit a GET request to retrieve a node from the server + # Submit a GET request to retrieve a node from the server. # # @param [String] name The name of the node being requested # @param [String] environment The name of the environment we are operating in @@ -41,6 +34,7 @@ def initialize(client, session, server, port) # @return [Array] An array containing # the request response and the deserialized requested node # + # @api public def get_node(name, environment:, configured_environment: nil, transaction_uuid: nil) headers = add_puppet_headers('Accept' => get_mime_types(Puppet::Node).join(', ')) @@ -59,10 +53,7 @@ def get_node(name, environment:, configured_environment: nil, transaction_uuid: [response, deserialize(response, Puppet::Node)] end - # - # @api private - # - # Submit a POST request to submit a catalog to the server + # Submit a POST request to submit a catalog to the server. # # @param [String] name The name of the catalog to be submitted # @param [Puppet::Node::Facts] facts Facts for this catalog @@ -83,6 +74,7 @@ def get_node(name, environment:, configured_environment: nil, transaction_uuid: # containing the request response and the deserialized catalog returned by # the server # + # @api public def post_catalog(name, facts:, environment:, configured_environment: nil, transaction_uuid: nil, job_uuid: nil, static_catalog: true, checksum_type: Puppet[:supported_checksum_types]) if Puppet[:preferred_serialization_format] == "pson" formatter = Puppet::Network::FormatHandler.format_for(:pson) @@ -127,10 +119,7 @@ def post_catalog(name, facts:, environment:, configured_environment: nil, transa [response, deserialize(response, Puppet::Resource::Catalog)] end - # - # @api private - # - # Submit a GET request to retrieve the facts for the named node + # Submit a GET request to retrieve the facts for the named node. # # @param [String] name Name of the node to retrieve facts for # @param [String] environment Name of the environment we are operating in @@ -139,6 +128,7 @@ def post_catalog(name, facts:, environment:, configured_environment: nil, transa # containing the request response and the deserialized facts for the # specified node # + # @api public def get_facts(name, environment:) headers = add_puppet_headers('Accept' => get_mime_types(Puppet::Node::Facts).join(', ')) @@ -153,10 +143,7 @@ def get_facts(name, environment:) [response, deserialize(response, Puppet::Node::Facts)] end - # - # @api private - # - # Submits a PUT request to submit facts for the node to the server + # Submits a PUT request to submit facts for the node to the server. # # @param [String] name Name of the node we are submitting facts for # @param [String] environment Name of the environment we are operating in @@ -164,6 +151,7 @@ def get_facts(name, environment:) # # @return [Puppet::HTTP::Response] The request response # + # @api public def put_facts(name, environment:, facts:) formatter = Puppet::Network::FormatHandler.format_for(Puppet[:preferred_serialization_format]) @@ -184,12 +172,9 @@ def put_facts(name, environment:, facts:) response end + # Submit a GET request to retrieve a file stored with filebucket. # - # @api private - # - # Submit a GET request to retrieve a file stored with filebucket - # - # @param [String] path The request path, formatted by Puppet::FileBucket::Dipper + # @param [String] path The request path, formatted by `Puppet::FileBucket::Dipper` # @param [String] environment Name of the environment we are operating in. # This should not impact filebucket at all, but is included to be consistent # with legacy code. @@ -204,6 +189,7 @@ def put_facts(name, environment:, facts:) # containing the request response and the deserialized file returned from # the server. # + # @api public def get_filebucket_file(path, environment:, bucket_path: nil, diff_with: nil, list_all: nil, fromdate: nil, todate: nil) headers = add_puppet_headers('Accept' => 'application/octet-stream') @@ -225,12 +211,9 @@ def get_filebucket_file(path, environment:, bucket_path: nil, diff_with: nil, li [response, deserialize(response, Puppet::FileBucket::File)] end + # Submit a PUT request to store a file with filebucket. # - # @api private - # - # Submit a PUT request to store a file with filebucket - # - # @param [String] path The request path, formatted by Puppet::FileBucket::Dipper + # @param [String] path The request path, formatted by `Puppet::FileBucket::Dipper` # @param [String] body The contents of the file to be backed # @param [String] environment Name of the environment we are operating in. # This should not impact filebucket at all, but is included to be consistent @@ -238,6 +221,7 @@ def get_filebucket_file(path, environment:, bucket_path: nil, diff_with: nil, li # # @return [Puppet::HTTP::Response] The response request # + # @api public def put_filebucket_file(path, body:, environment:) headers = add_puppet_headers({ 'Accept' => 'application/octet-stream', @@ -258,12 +242,9 @@ def put_filebucket_file(path, body:, environment:) response end + # Submit a HEAD request to check the status of a file stored with filebucket. # - # @api private - # - # Submit a HEAD request to check the status of a file stored with filebucket - # - # @param [String] path The request path, formatted by Puppet::FileBucket::Dipper + # @param [String] path The request path, formatted by `Puppet::FileBucket::Dipper` # @param [String] environment Name of the environment we are operating in. # This should not impact filebucket at all, but is included to be consistent # with legacy code. @@ -271,6 +252,7 @@ def put_filebucket_file(path, body:, environment:) # # @return [Puppet::HTTP::Response] The request response # + # @api public def head_filebucket_file(path, environment:, bucket_path: nil) headers = add_puppet_headers('Accept' => 'application/octet-stream') diff --git a/lib/puppet/http/service/file_server.rb b/lib/puppet/http/service/file_server.rb index f97f514e704..7d36cc98c9d 100644 --- a/lib/puppet/http/service/file_server.rb +++ b/lib/puppet/http/service/file_server.rb @@ -1,28 +1,24 @@ require 'puppet/file_serving/metadata' +# The FileServer service is used to retrieve file metadata and content. # -# @api private -# -# The FileServer service is used to retrieve file metadata and content +# @api public # class Puppet::HTTP::Service::FileServer < Puppet::HTTP::Service - # @api private # @return [String] Default API for the FileServer service API = '/puppet/v3'.freeze - # @api private # @return [RegEx] RegEx used to determine if a path contains a leading slash PATH_REGEX = /^\// - # - # @api private + # Use `Puppet::HTTP::Session.route_to(:fileserver)` to create or get an instance of this class. # # @param [Puppet::HTTP::Client] client # @param [Puppet::HTTP::Session] session - # @param [String] server (Puppet[:ca_server]) If an explicit server is given, + # @param [String] server (`Puppet[:server]`) If an explicit server is given, # create a service using that server. If server is nil, the default value # is used to create the service. - # @param [Integer] port (Puppet[:ca_port]) If an explicit port is given, create + # @param [Integer] port (`Puppet[:masterport]`) If an explicit port is given, create # a service using that port. If port is nil, the default value is used to # create the service. # @@ -31,11 +27,7 @@ def initialize(client, session, server, port) super(client, session, url) end - # - # @api private - # - # Submit a GET request to the server to retrieve the metadata for a specified - # file + # Submit a GET request to the server to retrieve the metadata for a specified file. # # @param [String] path path to the file to retrieve data from # @param [String] environment the name of the environment we are operating in @@ -52,6 +44,8 @@ def initialize(client, session, server, port) # array with the request response and the deserialized metadata for the # file returned from the server # + # @api public + # def get_file_metadata(path:, environment:, links: :manage, checksum_type: Puppet[:digest_algorithm], source_permissions: :ignore) validate_path(path) @@ -73,9 +67,6 @@ def get_file_metadata(path:, environment:, links: :manage, checksum_type: Puppet [response, deserialize(response, Puppet::FileServing::Metadata)] end - # - # @api private - # # Submit a GET request to the server to retrieve the metadata for multiple files # # @param [String] path path to the file(s) to retrieve data from @@ -105,6 +96,8 @@ def get_file_metadata(path:, environment:, links: :manage, checksum_type: Puppet # An array with the request response and an array of the deserialized # metadata for each file returned from the server # + # @api public + # def get_file_metadatas(path: nil, environment:, recurse: :false, recurselimit: nil, ignore: nil, links: :manage, checksum_type: Puppet[:digest_algorithm], source_permissions: :ignore) validate_path(path) @@ -129,10 +122,7 @@ def get_file_metadatas(path: nil, environment:, recurse: :false, recurselimit: n [response, deserialize_multiple(response, Puppet::FileServing::Metadata)] end - # - # @api private - # - # Submit a GET request to the server to retrieve content of a file + # Submit a GET request to the server to retrieve content of a file. # # @param [String] path path to the file to retrieve data from # @param [String] environment the name of the environment we are operating in @@ -141,6 +131,8 @@ def get_file_metadatas(path: nil, environment:, recurse: :false, recurselimit: n # # @return [Puppet::HTTP::Response] The request response # + # @api public + # def get_file_content(path:, environment:, &block) validate_path(path) @@ -162,10 +154,8 @@ def get_file_content(path:, environment:, &block) response end - # - # @api private - # - # Submit a GET request to + # Submit a GET request to retrieve file content using the `static_file_content` API + # uniquely identified by (`code_id`, `environment`, `path`). # # @param [String] path path to the file to retrieve data from # @param [String] environment the name of the environment we are operating in @@ -175,6 +165,8 @@ def get_file_content(path:, environment:, &block) # # @return [Puppet::HTTP::Response] The request response # + # @api public + # def get_static_file_content(path:, environment:, code_id:, &block) validate_path(path) diff --git a/lib/puppet/http/service/puppetserver.rb b/lib/puppet/http/service/puppetserver.rb index f7babef5247..d2ee01cd1aa 100644 --- a/lib/puppet/http/service/puppetserver.rb +++ b/lib/puppet/http/service/puppetserver.rb @@ -1,29 +1,32 @@ # The puppetserver service. # -# @api private +# @api public # class Puppet::HTTP::Service::Puppetserver < Puppet::HTTP::Service + + # Use `Puppet::HTTP::Session.route_to(:puppetserver)` to create or get an instance of this class. + # # @param [Puppet::HTTP::Client] client # @param [Puppet::HTTP::Session] session - # @param [String] server If an explicit server is given, + # @param [String] server (`Puppet[:server]`) If an explicit server is given, # create a service using that server. If server is nil, the default value # is used to create the service. - # @param [Integer] port If an explicit port is given, create + # @param [Integer] port (`Puppet[:masterport]`) If an explicit port is given, create # a service using that port. If port is nil, the default value is used to # create the service. - # @api private # def initialize(client, session, server, port) url = build_url('', server || Puppet[:server], port || Puppet[:masterport]) super(client, session, url) end - # Request the puppetserver's simple status + # Request the puppetserver's simple status. # # @param [Puppet::SSL::SSLContext] ssl_context to use when establishing # the connection. # @return Puppet::HTTP::Response The HTTP response - # @api private + # + # @api public # def get_simple_status(ssl_context: nil) response = @client.get( diff --git a/lib/puppet/http/service/report.rb b/lib/puppet/http/service/report.rb index 0d2be22ab83..4358d542f5c 100644 --- a/lib/puppet/http/service/report.rb +++ b/lib/puppet/http/service/report.rb @@ -1,16 +1,13 @@ +# The Report service is used to submit run reports to the report server. # -# @api private -# -# The Report service is used to submit run reports to the report server +# @api public # class Puppet::HTTP::Service::Report < Puppet::HTTP::Service - # @api private # @return [String] Default API for the report service API = '/puppet/v3'.freeze - # - # @api private + # Use `Puppet::HTTP::Session.route_to(:report)` to create or get an instance of this class. # # @param [Puppet::HTTP::Client] client # @param [Puppet::HTTP::Session] session @@ -21,15 +18,14 @@ class Puppet::HTTP::Service::Report < Puppet::HTTP::Service # a service using that port. If port is nil, the default value is used to # create the service. # + # @api private + # def initialize(client, session, server, port) url = build_url(API, server || Puppet[:report_server], port || Puppet[:report_port]) super(client, session, url) end - # - # @api private - # - # Submit a report to the report server + # Submit a report to the report server. # # @param [String] name the name of the report being submitted # @param [Puppet::Transaction::Report] report run report to be submitted @@ -37,6 +33,8 @@ def initialize(client, session, server, port) # # @return [Puppet::HTTP::Response] response returned by the server # + # @api public + # def put_report(name, report, environment:) formatter = Puppet::Network::FormatHandler.format_for(Puppet[:preferred_serialization_format]) headers = add_puppet_headers( diff --git a/lib/puppet/http/session.rb b/lib/puppet/http/session.rb index 2ea00211538..74e14432642 100644 --- a/lib/puppet/http/session.rb +++ b/lib/puppet/http/session.rb @@ -1,8 +1,6 @@ -# -# @api private -# # The session is the mechanism by which services may be connected to and accessed. # +# @api public class Puppet::HTTP::Session # capabilities for a site CAP_LOCALES = 'locales'.freeze @@ -14,16 +12,15 @@ class Puppet::HTTP::Session # puppet version where JSON was enabled by default SUPPORTED_JSON_DEFAULT = Gem::Version.new("5.0.0") - # - # @api private - # # Create a new HTTP session. The session is the mechanism by which services - # may be connected to and accessed. + # may be connected to and accessed. Sessions should be created using + # `Puppet::HTTP::Client#create_session`. # # @param [Puppet::HTTP::Client] client the container for this session # @param [Array] resolvers array of resolver strategies # to implement. # + # @api private def initialize(client, resolvers) @client = client @resolvers = resolvers @@ -31,9 +28,6 @@ def initialize(client, resolvers) @server_versions = {} end - # - # @api private - # # If an explicit server and port are specified on the command line or # configuration file, this method always returns a Service with that host and # port. Otherwise, we walk the list of resolvers in priority order: @@ -45,12 +39,13 @@ def initialize(client, resolvers) # is cached and returned if `route_to` is called again. # # @param [Symbol] name the service to resolve - # @param [URI] url (nil) optional explicit url to use, if it is already known - # @param [Puppet::SSL::SSLContext] ssl_context ssl_context ssl context to be + # @param [URI] url optional explicit url to use, if it is already known + # @param [Puppet::SSL::SSLContext] ssl_context ssl context to be # used for connections # # @return [Puppet::HTTP::Service] the resolved service # + # @api public def route_to(name, url: nil, ssl_context: nil) raise ArgumentError, "Unknown service #{name}" unless Puppet::HTTP::Service.valid_name?(name) @@ -82,14 +77,12 @@ def route_to(name, url: nil, ssl_context: nil) raise Puppet::HTTP::RouteError, "No more routes to #{name}" end - # - # @api private - # # Collect per-site server versions. This will allow us to modify future # requests based on the version of puppetserver we are talking to. # # @param [Puppet::HTTP::Response] response the request response containing headers # + # @api private def process_response(response) version = response[Puppet::HTTP::HEADER_PUPPET_VERSION] if version @@ -98,9 +91,6 @@ def process_response(response) end end - # - # @api private - # # Determine if a session supports a capability. Depending on the server version # we are talking to, we know certain features are available or not. These # specifications are defined here so we can modify our requests appropriately. @@ -110,6 +100,7 @@ def process_response(response) # # @return [Boolean] # + # @api public def supports?(name, capability) raise ArgumentError, "Unknown service #{name}" unless Puppet::HTTP::Service.valid_name?(name) diff --git a/lib/puppet/http/site.rb b/lib/puppet/http/site.rb index f471bcf47be..61bcb1bbe61 100644 --- a/lib/puppet/http/site.rb +++ b/lib/puppet/http/site.rb @@ -4,7 +4,6 @@ # for the second. # # @api private -# class Puppet::HTTP::Site attr_reader :scheme, :host, :port From c7b1cbab1d795ce01931e18ee74cf22c6733e3fa Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Fri, 2 Oct 2020 11:13:30 -0700 Subject: [PATCH 213/731] (maint) Document Puppet::SSL --- lib/puppet/ssl.rb | 8 +++++++- lib/puppet/ssl/certificate_signer.rb | 6 ++++++ lib/puppet/ssl/oids.rb | 4 +++- lib/puppet/ssl/ssl_provider.rb | 17 +++++++++++++++++ lib/puppet/ssl/state_machine.rb | 4 +++- lib/puppet/ssl/verifier.rb | 2 ++ 6 files changed, 38 insertions(+), 3 deletions(-) diff --git a/lib/puppet/ssl.rb b/lib/puppet/ssl.rb index 2b9625ebfcb..2eccd85a42f 100644 --- a/lib/puppet/ssl.rb +++ b/lib/puppet/ssl.rb @@ -2,9 +2,15 @@ require 'puppet' require 'puppet/ssl/openssl_loader' +# Responsible for bootstrapping an agent's certificate and private key, generating +# SSLContexts for use in making HTTPS connections, and handling CSR attributes and +# certificate extensions. +# +# @see Puppet::SSL::SSLProvider # @api private -module Puppet::SSL # :nodoc: +module Puppet::SSL CA_NAME = "ca".freeze + require 'puppet/ssl/oids' require 'puppet/ssl/error' require 'puppet/ssl/ssl_context' diff --git a/lib/puppet/ssl/certificate_signer.rb b/lib/puppet/ssl/certificate_signer.rb index 7016731f827..af89d4872bf 100644 --- a/lib/puppet/ssl/certificate_signer.rb +++ b/lib/puppet/ssl/certificate_signer.rb @@ -27,6 +27,12 @@ def initialize @digest end + # Sign a certificate signing request (CSR) with a private key. + # + # @param [OpenSSL::X509::Request] content The CSR to sign + # @param [OpenSSL::X509::PKey] key The private key to sign with + # + # @api private def sign(content, key) content.sign(key, @digest.new) end diff --git a/lib/puppet/ssl/oids.rb b/lib/puppet/ssl/oids.rb index 07848b062b0..eb2ec668738 100644 --- a/lib/puppet/ssl/oids.rb +++ b/lib/puppet/ssl/oids.rb @@ -2,10 +2,11 @@ # This module defines OIDs for use within Puppet. # -# == ASN.1 Definition +# # ASN.1 Definition # # The following is the formal definition of OIDs specified in this file. # +# ``` # puppetCertExtensions OBJECT IDENTIFIER ::= {iso(1) identified-organization(3) # dod(6) internet(1) private(4) enterprise(1) 34380 1} # @@ -22,6 +23,7 @@ # pp_instance_id OBJECT IDENTIFIER ::= { registeredExtensions 2 } # pp_image_name OBJECT IDENTIFIER ::= { registeredExtensions 3 } # pp_preshared_key OBJECT IDENTIFIER ::= { registeredExtensions 4 } +# ``` # # @api private module Puppet::SSL::Oids diff --git a/lib/puppet/ssl/ssl_provider.rb b/lib/puppet/ssl/ssl_provider.rb index f634205d4fd..cd249000732 100644 --- a/lib/puppet/ssl/ssl_provider.rb +++ b/lib/puppet/ssl/ssl_provider.rb @@ -3,6 +3,23 @@ # SSL Provider creates `SSLContext` objects that can be used to create # secure connections. # +# @example To load an SSLContext from an existing private key and related certs/crls: +# ssl_context = provider.load_context +# +# @example To load an SSLContext from an existing password-protected private key and related certs/crls: +# ssl_context = provider.load_context(password: 'opensesame') +# +# @example To create an SSLContext from in-memory certs and keys: +# cacerts = [] +# crls = [] +# key = +# cert = +# ssl_context = provider.create_context(cacerts: cacerts, crls: crls, private_key: key, client_cert: cert) +# +# @example To create an SSLContext to connect to non-puppet HTTPS servers: +# cacerts = [] +# ssl_context = provider.create_root_context(cacerts: cacerts) +# # @api private class Puppet::SSL::SSLProvider # Create an insecure `SSLContext`. Connections made from the returned context diff --git a/lib/puppet/ssl/state_machine.rb b/lib/puppet/ssl/state_machine.rb index a9476234d2f..c7c38b6c222 100644 --- a/lib/puppet/ssl/state_machine.rb +++ b/lib/puppet/ssl/state_machine.rb @@ -10,7 +10,7 @@ # certs. This way we're sure about which SSLContext is being used during any # phase of the bootstrapping process. # -# @private +# @api private class Puppet::SSL::StateMachine class SSLState attr_reader :ssl_context @@ -405,6 +405,7 @@ def initialize(waitforcert: Puppet[:waitforcert], # # @return [Puppet::SSL::SSLContext] initialized SSLContext # @raise [Puppet::Error] If we fail to generate an SSLContext + # @api private def ensure_ca_certificates final_state = run_machine(NeedLock.new(self), NeedKey) final_state.ssl_context @@ -414,6 +415,7 @@ def ensure_ca_certificates # # @return [Puppet::SSL::SSLContext] initialized SSLContext # @raise [Puppet::Error] If we fail to generate an SSLContext + # @api private def ensure_client_certificate final_state = run_machine(NeedLock.new(self), Done) ssl_context = final_state.ssl_context diff --git a/lib/puppet/ssl/verifier.rb b/lib/puppet/ssl/verifier.rb index 75dcde55dc1..a3df7b5a463 100644 --- a/lib/puppet/ssl/verifier.rb +++ b/lib/puppet/ssl/verifier.rb @@ -14,6 +14,7 @@ class Puppet::SSL::Verifier # @param hostname [String] FQDN of the server we're attempting to connect to # @param ssl_context [Puppet::SSL::SSLContext] ssl_context containing CA certs, # CRLs, etc needed to verify the server's certificate chain + # @api private def initialize(hostname, ssl_context) @hostname = hostname @ssl_context = ssl_context @@ -25,6 +26,7 @@ def initialize(hostname, ssl_context) # # @param verifier [Puppet::SSL::Verifier] the verifier to compare against # @return [Boolean] return true if a cached connection can be used, false otherwise + # @api private def reusable?(verifier) verifier.instance_of?(self.class) && verifier.ssl_context.object_id == @ssl_context.object_id From 545898f785db2e6260eaa565f4b5a593f2151b0b Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Fri, 2 Oct 2020 11:14:03 -0700 Subject: [PATCH 214/731] (maint) Document Puppet::X509 --- lib/puppet/x509.rb | 6 +++++- lib/puppet/x509/cert_provider.rb | 30 +++++++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/lib/puppet/x509.rb b/lib/puppet/x509.rb index e91a46fa0b8..75191993ff3 100644 --- a/lib/puppet/x509.rb +++ b/lib/puppet/x509.rb @@ -1,7 +1,11 @@ require 'puppet' require 'puppet/ssl/openssl_loader' -module Puppet::X509 # :nodoc: +# Responsible for loading and saving certificates and private keys. +# +# @see Puppet::X509::CertProvider +# @api private +module Puppet::X509 require 'puppet/x509/pem_store' require 'puppet/x509/cert_provider' end diff --git a/lib/puppet/x509/cert_provider.rb b/lib/puppet/x509/cert_provider.rb index 4f4e8a9b4a8..d170736f29b 100644 --- a/lib/puppet/x509/cert_provider.rb +++ b/lib/puppet/x509/cert_provider.rb @@ -1,6 +1,11 @@ require 'puppet/x509' -# Class for loading and saving cert related objects. +# Class for loading and saving cert related objects. By default the provider +# loads and saves based on puppet's default settings, such as `Puppet[:localcacert]`. +# The providers sets the permissions on files it saves, such as the private key. +# All of the `load_*` methods take an optional `required` parameter. If an object +# doesn't exist, then by default the provider returns `nil`. However, if the +# `required` parameter is true, then an exception will be raised instead. # # @api private class Puppet::X509::CertProvider @@ -32,6 +37,7 @@ def initialize(capath: Puppet[:localcacert], # # @param certs [Array] Array of CA certs to save # @raise [Puppet::Error] if the certs cannot be saved + # # @api private def save_cacerts(certs) save_pem(certs.map(&:to_pem).join, @capath, **permissions_for_setting(:localcacert)) @@ -45,6 +51,7 @@ def save_cacerts(certs) # @return (see #load_cacerts_from_pem) # @raise (see #load_cacerts_from_pem) # @raise [Puppet::Error] if the certs cannot be loaded + # # @api private def load_cacerts(required: false) pem = load_pem(@capath) @@ -61,6 +68,7 @@ def load_cacerts(required: false) # @param pem [String] PEM encoded certificate(s) # @return [Array] Array of CA certs # @raise [OpenSSL::X509::CertificateError] The `pem` text does not contain a valid cert + # # @api private def load_cacerts_from_pem(pem) # TRANSLATORS 'PEM' is an acronym and shouldn't be translated @@ -75,6 +83,7 @@ def load_cacerts_from_pem(pem) # # @param crls [Array] Array of CRLs to save # @raise [Puppet::Error] if the CRLs cannot be saved + # # @api private def save_crls(crls) save_pem(crls.map(&:to_pem).join, @crlpath, **permissions_for_setting(:hostcrl)) @@ -88,6 +97,7 @@ def save_crls(crls) # @return (see #load_crls_from_pem) # @raise (see #load_crls_from_pem) # @raise [Puppet::Error] if the CRLs cannot be loaded + # # @api private def load_crls(required: false) pem = load_pem(@crlpath) @@ -104,6 +114,7 @@ def load_crls(required: false) # @param pem [String] PEM encoded CRL(s) # @return [Array] Array of CRLs # @raise [OpenSSL::X509::CRLError] The `pem` text does not contain a valid CRL + # # @api private def load_crls_from_pem(pem) # TRANSLATORS 'PEM' is an acronym and shouldn't be translated @@ -118,6 +129,8 @@ def load_crls_from_pem(pem) # # @return [Time, nil] Time when the CRL was last updated, or nil if we don't # have a CRL + # + # @api private def crl_last_update stat = Puppet::FileSystem.stat(@crlpath) Time.at(stat.mtime) @@ -129,6 +142,7 @@ def crl_last_update # # @param time [Time] The last updated time # + # @api private def crl_last_update=(time) Puppet::FileSystem.touch(@crlpath, mtime: time) end @@ -142,6 +156,7 @@ def crl_last_update=(time) # from the password, and use that to encrypt the private key. If nil, # save the private key unencrypted. # @raise [Puppet::Error] if the private key cannot be saved + # # @api private def save_private_key(name, key, password: nil) pem = if password @@ -167,6 +182,7 @@ def save_private_key(name, key, password: nil) # @return (see #load_private_key_from_pem) # @raise (see #load_private_key_from_pem) # @raise [Puppet::Error] if the private key cannot be loaded + # # @api private def load_private_key(name, required: false, password: nil) path = @hostprivkey || to_path(@privatekeydir, name) @@ -187,6 +203,7 @@ def load_private_key(name, required: false, password: nil) # not specified, then the key cannot be loaded. # @return [OpenSSL::PKey::RSA, OpenSSL::PKey::EC] The private key # @raise [OpenSSL::PKey::PKeyError] The `pem` text does not contain a valid key + # # @api private def load_private_key_from_pem(pem, password: nil) # set a non-nil password to ensure openssl doesn't prompt @@ -216,6 +233,8 @@ def load_private_key_from_pem(pem, password: nil) # # @return [String, nil] The private key password as a binary string or nil # if there is none. + # + # @api private def load_private_key_password Puppet::FileSystem.read(Puppet[:passfile], :encoding => Encoding::BINARY) rescue Errno::ENOENT @@ -227,6 +246,7 @@ def load_private_key_password # @param name [String] The client cert identity # @param cert [OpenSSL::X509::Certificate] The cert to save # @raise [Puppet::Error] if the client cert cannot be saved + # # @api private def save_client_cert(name, cert) path = @hostcert || to_path(@certdir, name) @@ -242,6 +262,7 @@ def save_client_cert(name, cert) # @return (see #load_request_from_pem) # @raise (see #load_client_cert_from_pem) # @raise [Puppet::Error] if the client cert cannot be loaded + # # @api private def load_client_cert(name, required: false) path = @hostcert || to_path(@certdir, name) @@ -259,6 +280,7 @@ def load_client_cert(name, required: false) # @param pem [String] PEM encoded cert # @return [OpenSSL::X509::Certificate] the certificate # @raise [OpenSSL::X509::CertificateError] The `pem` text does not contain a valid cert + # # @api private def load_client_cert_from_pem(pem) OpenSSL::X509::Certificate.new(pem) @@ -270,6 +292,7 @@ def load_client_cert_from_pem(pem) # @param private_key [OpenSSL::PKey::RSA] private key # @return [Puppet::X509::Request] The request # + # @api private def create_request(name, private_key) options = {} @@ -292,6 +315,7 @@ def create_request(name, private_key) # @param name [String] the request identity # @param csr [OpenSSL::X509::Request] the request # @raise [Puppet::Error] if the cert request cannot be saved + # # @api private def save_request(name, csr) path = to_path(@requestdir, name) @@ -306,6 +330,7 @@ def save_request(name, csr) # @return (see #load_request_from_pem) # @raise (see #load_request_from_pem) # @raise [Puppet::Error] if the cert request cannot be saved + # # @api private def load_request(name) path = to_path(@requestdir, name) @@ -319,6 +344,8 @@ def load_request(name) # # @param name [String] The request identity # @return [Boolean] true if the CSR was deleted + # + # @api private def delete_request(name) path = to_path(@requestdir, name) delete_pem(path) @@ -331,6 +358,7 @@ def delete_request(name) # @param pem [String] PEM encoded request # @return [OpenSSL::X509::Request] the request # @raise [OpenSSL::X509::RequestError] The `pem` text does not contain a valid request + # # @api private def load_request_from_pem(pem) OpenSSL::X509::Request.new(pem) From b06d76bb28669a98d72d66781a053b709792a9c9 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Fri, 3 Apr 2020 17:21:01 -0700 Subject: [PATCH 215/731] (maint) Move under Puppet::Pal constant The JsonCatalogEncoder was polluting the top-level namespace. Define it under Puppet::Pal. The only use of the class was CatalogCompiler which is defined under the same constant. --- lib/puppet/pal/json_catalog_encoder.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/puppet/pal/json_catalog_encoder.rb b/lib/puppet/pal/json_catalog_encoder.rb index f2de695828a..1d5c2f73140 100644 --- a/lib/puppet/pal/json_catalog_encoder.rb +++ b/lib/puppet/pal/json_catalog_encoder.rb @@ -4,6 +4,8 @@ # # @api public # +module Puppet +module Pal class JsonCatalogEncoder # Is the resulting Json pretty printed or not. attr_reader :pretty @@ -65,3 +67,5 @@ def possibly_filtered_catalog end private :possibly_filtered_catalog end +end +end From 0ef330e0060d021bb0e664bdc18767c846342556 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Fri, 9 Oct 2020 14:32:03 -0700 Subject: [PATCH 216/731] (maint) Document Puppet::Application --- lib/puppet/application.rb | 270 ++++++++++++++++++++++++-------------- 1 file changed, 172 insertions(+), 98 deletions(-) diff --git a/lib/puppet/application.rb b/lib/puppet/application.rb index b4999801e69..478271f3475 100644 --- a/lib/puppet/application.rb +++ b/lib/puppet/application.rb @@ -6,95 +6,74 @@ module Puppet -# This class handles all the aspects of a Puppet application/executable -# * setting up options -# * setting up logs -# * choosing what to run -# * representing execution status +# Defines an abstract Puppet application. # -# === Usage -# An application is a subclass of Puppet::Application. -# -# For legacy compatibility, -# Puppet::Application[:example].run -# is equivalent to -# Puppet::Application::Example.new.run +# # Usage # +# To create a new application extend `Puppet::Application`. Derived applications +# must implement the `main` method and should implement the `summary` and +# `help` methods in order to be included in `puppet help`, and should define +# application-specific options. For example: # +# ``` # class Puppet::Application::Example < Puppet::Application # -# def preinit -# # perform some pre initialization -# @all = false -# end -# -# # run_command is called to actually run the specified command -# def run_command -# send Puppet::Util::CommandLine.new.args.shift -# end +# def summary +# "My puppet example application" +# end # -# # option uses metaprogramming to create a method -# # and also tells the option parser how to invoke that method -# option("--arg ARGUMENT") do |v| -# @args << v -# end +# def help +# <<~HELP +# puppet-example(8) -- #{summary} +# ... +# HELP +# end # -# option("--debug", "-d") do |v| -# @debug = v -# end +# # define arg with a required option +# option("--arg ARGUMENT") do |v| +# options[:arg] = v +# end # -# option("--all", "-a:) do |v| -# @all = v -# end +# # define arg with an optional option +# option("--maybe [ARGUMENT]") do |v| +# options[:maybe] = v +# end # -# def handle_unknown(opt,arg) -# # last chance to manage an option -# ... -# # let's say to the framework we finally handle this option -# true -# end +# # define long and short arg +# option("--all", "-a") # -# def read -# # read action -# end +# def initialize(command_line = Puppet::Util::CommandLine.new) +# super +# @data = {} +# end # -# def write -# # writeaction -# end -# -# end +# def main +# # call action +# send(@command_line.args.shift) +# end # -# === Preinit -# The preinit block is the first code to be called in your application, before option parsing, -# setup or command execution. +# def read +# # read action +# end # -# === Options -# Puppet::Application uses +OptionParser+ to manage the application options. -# Options are defined with the +option+ method to which are passed various -# arguments, including the long option, the short option, a description... -# Refer to +OptionParser+ documentation for the exact format. -# * If the option method is given a block, this one will be called whenever -# the option is encountered in the command-line argument. -# * If the option method has no block, a default functionality will be used, that -# stores the argument (or true/false if the option doesn't require an argument) in -# the global (to the application) options array. -# * If a given option was not defined by a the +option+ method, but it exists as a Puppet settings: -# * if +unknown+ was used with a block, it will be called with the option name and argument -# * if +unknown+ wasn't used, then the option/argument is handed to Puppet.settings.handlearg for -# a default behavior +# def write +# # write action +# end # -# --help is managed directly by the Puppet::Application class, but can be overridden. +# end +# ``` # -# === Setup -# Applications can use the setup block to perform any initialization. -# The default +setup+ behaviour is to: read Puppet configuration and manage log level and destination +# Puppet defines the following application lifecycle methods that are called in +# the following order: # -# === What and how to run -# If the +dispatch+ block is defined it is called. This block should return the name of the registered command -# to be run. -# If it doesn't exist, it defaults to execute the +main+ command if defined. +# * {#initialize} +# * {#initialize_app_defaults} +# * {#preinit} +# * {#parse_options} +# * {#setup} +# * {#main} # -# === Execution state +# ## Execution state # The class attributes/methods of Puppet::Application serve as a global place to set and query the execution # status of the application: stopping, restarting, etc. The setting of the application status does not directly # affect its running status; it's assumed that the various components within the application will consult these @@ -104,21 +83,27 @@ module Puppet # # So, if something in your application needs to stop the process, for some reason, you might consider: # +# ``` # def stop_me! -# # indicate that we're stopping -# Puppet::Application.stop! -# # ...do stuff... +# # indicate that we're stopping +# Puppet::Application.stop! +# # ...do stuff... # end +# ``` # # And, if you have some component that involves a long-running process, you might want to consider: # +# ``` # def my_long_process(giant_list_to_munge) -# giant_list_to_munge.collect do |member| -# # bail if we're stopping -# return if Puppet::Application.stop_requested? -# process_member(member) -# end +# giant_list_to_munge.collect do |member| +# # bail if we're stopping +# return if Puppet::Application.stop_requested? +# process_member(member) +# end # end +# ``` +# @abstract +# @api public class Application require 'puppet/util' include Puppet::Util @@ -137,34 +122,42 @@ def clear! self.run_status = nil end + # Signal that the application should stop. + # @api public def stop! self.run_status = :stop_requested end + # Signal that the application should restart. + # @api public def restart! self.run_status = :restart_requested end # Indicates that Puppet::Application.restart! has been invoked and components should # do what is necessary to facilitate a restart. + # @api public def restart_requested? :restart_requested == run_status end # Indicates that Puppet::Application.stop! has been invoked and components should do what is necessary # for a clean stop. + # @api public def stop_requested? :stop_requested == run_status end # Indicates that one of stop! or start! was invoked on Puppet::Application, and some kind of process # shutdown/short-circuit may be necessary. + # @api public def interrupted? [:restart_requested, :stop_requested].include? run_status end # Indicates that Puppet::Application believes that it's in usual running run_mode (no stop/restart request # currently active). + # @api public def clear? run_status.nil? end @@ -270,14 +263,21 @@ def try_load_class(class_name) end private :try_load_class + # Return an instance of the specified application. + # + # @param [Symbol] name the lowercase name of the application + # @return [Puppet::Application] an instance of the specified name + # @raise [Puppet::Error] if the application class was not found. + # @raise [LoadError] if there was a problem loading the application file. + # @api public def [](name) find(name).new end # Sets or gets the run_mode name. Sets the run_mode name if a mode_name is # passed. Otherwise, gets the run_mode or a default run_mode - # - def run_mode( mode_name = nil) + # @api public + def run_mode(mode_name = nil) if mode_name Puppet.settings.preferred_run_mode = mode_name end @@ -288,12 +288,19 @@ def run_mode( mode_name = nil) @run_mode = Puppet::Util::RunMode[ mode_name || Puppet.settings.preferred_run_mode ] end - # Sets environment_mode name + # Sets environment_mode name. When acting as a compiler, the environment mode + # should be `:local` since the directory must exist to compile the catalog. + # When acting as an agent, the environment mode should be `:remote` since + # the Puppet[:environment] setting refers to an environment directoy on a remote + # system. The `:not_required` mode is for cases where the application does not + # need an environment to run. + # # @param mode_name [Symbol] The name of the environment mode to run in. May - # be one of :local, :remote, or :not_required. This impacts where the - # application looks for its specified environment. If :not_required or - # :remote are set, the application will not fail if the environment does + # be one of `:local`, `:remote`, or `:not_required`. This impacts where the + # application looks for its specified environment. If `:not_required` or + # `:remote` are set, the application will not fail if the environment does # not exist on the local filesystem. + # @api public def environment_mode(mode_name) raise Puppet::Error, _("Invalid environment mode '%{mode_name}'") % { mode_name: mode_name } unless [:local, :remote, :not_required].include?(mode_name) @environment_mode = mode_name @@ -301,11 +308,14 @@ def environment_mode(mode_name) # Gets environment_mode name. If none is set with `environment_mode=`, # default to :local. + # @return [Symbol] The current environment mode + # @api public def get_environment_mode @environment_mode || :local end # This is for testing only + # @api public def clear_everything_for_tests @run_mode = @banner = @run_status = @option_parser_commands = nil end @@ -327,37 +337,66 @@ def clear_everything_for_tests exit(0) end - def app_defaults() + # Initialize the application receiving the {Puppet::Util::CommandLine} object + # containing the application name and arguments. + # + # @param command_line [Puppet::Util::CommandLine] An instance of the command line to create the application with + # @api public + def initialize(command_line = Puppet::Util::CommandLine.new) + @command_line = CommandLineArgs.new(command_line.subcommand_name, command_line.args.dup) + @options = {} + end + + # Now that the `run_mode` has been resolved, return default settings for the + # application. Note these values may be overridden when puppet's configuration + # is loaded later. + # + # @example To override the facts terminus: + # def app_defaults + # super.merge({ + # :facts_terminus => 'yaml' + # }) + # end + # + # @return [Hash] default application settings + # @api public + def app_defaults Puppet::Settings.app_defaults_for_run_mode(self.class.run_mode).merge( :name => name ) end + # Initialize application defaults. It's usually not necessary to override this method. + # @return [void] + # @api public def initialize_app_defaults() Puppet.settings.initialize_app_defaults(app_defaults) end - # override to execute code before running anything else + # The preinit block is the first code to be called in your application, after + # `initialize`, but before option parsing, setup or command execution. It is + # usually not necessary to override this method. + # @return [void] + # @api public def preinit end - def initialize(command_line = Puppet::Util::CommandLine.new) - @command_line = CommandLineArgs.new(command_line.subcommand_name, command_line.args.dup) - @options = {} - end - - # call in setup of subclass to deprecate an application + # Call in setup of subclass to deprecate an application. + # @return [void] + # @api public def deprecate @deprecated = true end + # Return true if this application is deprecated. + # @api public def deprecated? @deprecated end - # Execute the application. - # @api public + # Execute the application. This method should not be overridden. # @return [void] + # @api public def run # I don't really like the names of these lifecycle phases. It would be nice to change them to some more meaningful @@ -382,18 +421,34 @@ def run exit_on_fail(_("Could not run")) { run_command } end + # This method must be overridden and perform whatever action is required for + # the application. The `command_line` reader contains the actions and + # arguments. + # @return [void] + # @api public def main raise NotImplementedError, _("No valid command or main") end + # Run the application. By default, it calls {#main}. + # @return [void] + # @api public def run_command main end + # Setup the application. It is usually not necessary to override this method. + # @return [void] + # @api public def setup setup_logs end + # Setup logging. By default the `console` log destination will only be created + # if `debug` or `verbose` is specified on the command line. Override to customize + # the logging behavior. + # @return [void] + # @api public def setup_logs handle_logdest_arg(Puppet[:logdest]) if !options[:setdest] @@ -436,11 +491,10 @@ def configure_indirector_routes # Output basic information about the runtime environment for debugging # purposes. # - # @api public - # # @param extra_info [Hash{String => #to_s}] a flat hash of extra information # to log. Intended to be passed to super by subclasses. # @return [void] + # @api public def log_runtime_environment(extra_info=nil) runtime_info = { 'puppet_version' => Puppet.version, @@ -453,6 +507,21 @@ def log_runtime_environment(extra_info=nil) Puppet.debug 'Runtime environment: ' + runtime_info.map{|k,v| k + '=' + v.to_s}.join(', ') end + # Options defined with the `option` method are parsed from settings and the command line. + # Refer to {OptionParser} documentation for the exact format. Options are parsed as follows: + # + # * If the option method is given a block, then it will be called whenever the option is encountered in the command-line argument. + # * If the option method has no block, then the default option handler will store the argument in the `options` instance variable. + # * If a given option was not defined by an `option` method, but it exists as a Puppet setting: + # * if `unknown` was used with a block, it will be called with the option name and argument. + # * if `unknown` wasn't used, then the option/argument is handed to Puppet.settings.handlearg for + # a default behavior. + # * The `-h` and `--help` options are automatically handled by the command line before creating the application. + # + # Options specified on the command line override settings. It is usually not + # necessary to override this method. + # @return [void] + # @api public def parse_options # Create an option parser option_parser = OptionParser.new(self.class.banner) @@ -500,6 +569,9 @@ def name self.class.to_s.sub(/.*::/,"").downcase.to_sym end + # Return the text to display when running `puppet help`. + # @return [String] The help to display + # @api public def help _("No help available for puppet %{app_name}") % { app_name: name } end @@ -507,6 +579,8 @@ def help # The description used in top level `puppet help` output # If left empty in implementations, we will attempt to extract # the summary from the help text itself. + # @return [String] + # @api public def summary "" end From 4f7fe70c87a51100f579aa46017627a11ec98f3d Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Fri, 9 Oct 2020 14:32:31 -0700 Subject: [PATCH 217/731] (maint) Move docs to Puppet::Pal module --- lib/puppet/pal/pal_impl.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/puppet/pal/pal_impl.rb b/lib/puppet/pal/pal_impl.rb index e6f09031e43..60c345c4389 100644 --- a/lib/puppet/pal/pal_impl.rb +++ b/lib/puppet/pal/pal_impl.rb @@ -5,6 +5,7 @@ require 'puppet/parser/script_compiler' require 'puppet/parser/catalog_compiler' +module Puppet # This is the main entry point for "Puppet As a Library" PAL. # This file should be required instead of "puppet" # Initially, this will require ALL of puppet - over time this will change as the monolithical "puppet" is broken up @@ -24,7 +25,7 @@ # end # # The result is what 'mymodule::myfunction' returns # -module Puppet +# @api public module Pal # Defines a context in which multiple operations in an env with a script compiler can be performed in a given block. @@ -258,6 +259,7 @@ def self.in_tmp_environment(env_name, # @return [Object] returns what the given block returns # @yieldparam [Puppet::Pal] context, a context that responds to Puppet::Pal methods # + # @api public def self.in_environment(env_name, modulepath: nil, pre_modulepath: [], From 91f7ddfba6a92979f37bf5a888c0f9384eee9d2b Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Fri, 9 Oct 2020 14:33:08 -0700 Subject: [PATCH 218/731] (maint) Update top-level puppet docs --- README.md | 2 +- lib/puppet.rb | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index b5d807b086c..eff3cecaca2 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Documentation for Puppet and related projects can be found online at the ### HTTP API -[HTTP API Index](https://puppet.com/docs/puppet/5.5/http_api/http_api_index.html) +[HTTP API Index](https://puppet.com/docs/puppet/latest/http_api/http_api_index.html) ## Installation diff --git a/lib/puppet.rb b/lib/puppet.rb index f53431f1d1f..44cb3de3701 100644 --- a/lib/puppet.rb +++ b/lib/puppet.rb @@ -27,16 +27,16 @@ require 'puppet/gettext/config' require 'puppet/defaults' - -#------------------------------------------------------------ -# the top-level module +# Defines the `Puppet` module. There are different entry points into Puppet +# depending on your use case. # -# all this really does is dictate how the whole system behaves, through -# preferences for things like debugging +# To use puppet as a library, see {Puppet::Pal}. # -# it's also a place to find top-level commands like 'debug' - -# The main Puppet class. Everything is contained here. +# To create a new application, see {Puppet::Application}. +# +# To create a new function, see {Puppet::Functions}. +# +# To access puppet's REST APIs, see https://puppet.com/docs/puppet/latest/http_api/http_api_index.html. # # @api public module Puppet From 39048ed6792a5721e989996c1064e211cb77ebac Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Fri, 9 Oct 2020 14:43:06 -0700 Subject: [PATCH 219/731] (maint) Fix links to Puppet::HTTP::Site --- lib/puppet/http/factory.rb | 6 +++--- lib/puppet/http/pool.rb | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/puppet/http/factory.rb b/lib/puppet/http/factory.rb index 398a054c299..34fa9ca63de 100644 --- a/lib/puppet/http/factory.rb +++ b/lib/puppet/http/factory.rb @@ -2,10 +2,10 @@ require 'net/http' require 'puppet/http' -# Factory for Net::HTTP objects. +# Factory for `Net::HTTP` objects. # -# Encapsulates the logic for creating a Net::HTTP object based on the -# specified {Puppet::HTTP::Site Site} and puppet settings. +# Encapsulates the logic for creating a `Net::HTTP` object based on the +# specified {Site} and puppet settings. # # @api private class Puppet::HTTP::Factory diff --git a/lib/puppet/http/pool.rb b/lib/puppet/http/pool.rb index 216c5ad8908..37f01243d07 100644 --- a/lib/puppet/http/pool.rb +++ b/lib/puppet/http/pool.rb @@ -1,5 +1,5 @@ -# A pool for persistent Net::HTTP connections. Connections are -# stored in the pool indexed by their {Puppet::HTTP::Site Site}. +# A pool for persistent `Net::HTTP` connections. Connections are +# stored in the pool indexed by their {Site}. # Connections are borrowed from the pool, yielded to the caller, and # released back into the pool. If a connection is expired, it will be # closed either when a connection to that site is requested, or when From 33a7837d8ed53cfd03b7a1eafb21e87ad3308abf Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Tue, 20 Oct 2020 17:05:25 -0700 Subject: [PATCH 220/731] (PUP-9469) Remove func3x_check setting Remove func3x_check setting which made it possible to disable 3x function checking and stray single quote in the exception message. Preserve the "illegal function is loaded" test to show the behavior when an invalid 3x function is loaded. --- lib/puppet/defaults.rb | 10 ------- .../ruby_legacy_function_instantiator.rb | 14 +++++----- spec/unit/pops/loaders/loaders_spec.rb | 27 +++++-------------- 3 files changed, 12 insertions(+), 39 deletions(-) diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb index fef165b41b0..1eb8d5a18ec 100644 --- a/lib/puppet/defaults.rb +++ b/lib/puppet/defaults.rb @@ -2108,16 +2108,6 @@ def self.initialize_default_settings!(settings) referencing variables that are explicitly set to undef). EOT }, - :func3x_check => { - :default => true, - :type => :boolean, - :desc => <<-'EOT' - Causes validation of loaded legacy Ruby functions (3x API) to raise errors about illegal constructs that - could cause harm or that simply does not work. This flag is on by default. This flag is made available - so that the validation can be turned off in case the method of validation is faulty - if encountered, please - file a bug report. - EOT - }, :tasks => { :default => false, :type => :boolean, diff --git a/lib/puppet/pops/loader/ruby_legacy_function_instantiator.rb b/lib/puppet/pops/loader/ruby_legacy_function_instantiator.rb index 74204b83743..14481bc2be0 100644 --- a/lib/puppet/pops/loader/ruby_legacy_function_instantiator.rb +++ b/lib/puppet/pops/loader/ruby_legacy_function_instantiator.rb @@ -16,13 +16,11 @@ class Puppet::Pops::Loader::RubyLegacyFunctionInstantiator # @return [Puppet::Pops::Functions.Function] - an instantiated function with global scope closure associated with the given loader # def self.create(loader, typed_name, source_ref, ruby_code_string) - # When func3x turned on, assert content by parsing, when turned off continue with (legacy) undefined behavior - if Puppet[:func3x_check] - assertion_result = [] - if assert_code(ruby_code_string, assertion_result) - unless ruby_code_string.is_a?(String) && assertion_result.include?(:found_newfunction) - raise ArgumentError, _("The code loaded from %{source_ref} does not seem to be a Puppet 3x API function - no 'newfunction' call.") % { source_ref: source_ref } - end + # Assert content of 3x function by parsing + assertion_result = [] + if assert_code(ruby_code_string, assertion_result) + unless ruby_code_string.is_a?(String) && assertion_result.include?(:found_newfunction) + raise ArgumentError, _("The code loaded from %{source_ref} does not seem to be a Puppet 3x API function - no 'newfunction' call.") % { source_ref: source_ref } end end @@ -91,7 +89,7 @@ def self.walk(x, result) when :def, :defs # There should not be any calls to def in a 3x function mname, mline = extract_name_line(find_identity(x)) - raise SecurityError, _("Illegal method definition of method '%{method_name}' on line %{line}' in legacy function. See %{url} for more information") % { + raise SecurityError, _("Illegal method definition of method '%{method_name}' on line %{line} in legacy function. See %{url} for more information") % { method_name: mname, line: mline, url: "https://puppet.com/docs/puppet/latest/functions_refactor_legacy.html" diff --git a/spec/unit/pops/loaders/loaders_spec.rb b/spec/unit/pops/loaders/loaders_spec.rb index f29b569bd76..b4696025464 100644 --- a/spec/unit/pops/loaders/loaders_spec.rb +++ b/spec/unit/pops/loaders/loaders_spec.rb @@ -575,27 +575,6 @@ def compile_and_get_notifications(code) end end -context 'when a 3x load has illegal construct and --func3x_check is false' do - let(:env) { environment_for(mix_4x_and_3x_functions) } - let(:compiler) { Puppet::Parser::Compiler.new(Puppet::Node.new("test", :environment => env)) } - let(:scope) { compiler.topscope } - let(:loader) { compiler.loaders.private_loader_for_module('user') } - - before(:each) do - Puppet.push_context(:current_environment => scope.environment, :global_scope => scope, :loaders => compiler.loaders) - Puppet[:func3x_check] = false - end - after(:each) do - Puppet.pop_context - Puppet[:func3x_check] = true - end - - it "an illegal function is loaded" do - f = loader.load_typed(typed_name(:function, 'bad_func_load3')).value - expect(f.call(scope)).to eql("some return value") - end -end - context 'when causing a 3x load followed by a 4x load' do let(:env) { environment_for(mix_4x_and_3x_functions) } let(:compiler) { Puppet::Parser::Compiler.new(Puppet::Node.new("test", :environment => env)) } @@ -623,6 +602,12 @@ def compile_and_get_notifications(code) function = loader.load_typed(typed_name(:function, 'callee_ws')).value expect(function.call(scope, 'passed in scope')).to eql("usee::callee_ws() got 'value'") end + + it "an illegal function is loaded" do + expect { + loader.load_typed(typed_name(:function, 'bad_func_load3')).value + }.to raise_error(SecurityError, /Illegal method definition of method 'bad_func_load3_illegal_method' on line 8 in legacy function/) + end end context 'loading' do From e653b428f9a27d11b4fb3122842f6c36d39d73bf Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Wed, 21 Oct 2020 23:36:53 +0000 Subject: [PATCH 221/731] (packaging) Updating the puppet.pot file --- locales/puppet.pot | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/locales/puppet.pot b/locales/puppet.pot index 2d25e9c8584..37813f185e4 100644 --- a/locales/puppet.pot +++ b/locales/puppet.pot @@ -6,11 +6,11 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Puppet automation framework 6.19.0-330-ge015d69afc\n" +"Project-Id-Version: Puppet automation framework 6.19.0-342-g36d30c1b1d\n" "\n" "Report-Msgid-Bugs-To: https://tickets.puppetlabs.com\n" -"POT-Creation-Date: 2020-10-19 13:36+0000\n" -"PO-Revision-Date: 2020-10-19 13:36+0000\n" +"POT-Creation-Date: 2020-10-21 23:36+0000\n" +"PO-Revision-Date: 2020-10-21 23:36+0000\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -5413,21 +5413,21 @@ msgstr "" msgid "The code loaded from %{source_ref} did not produce a Function class when evaluated. Got '%{klass}'" msgstr "" -#: ../lib/puppet/pops/loader/ruby_legacy_function_instantiator.rb:24 +#: ../lib/puppet/pops/loader/ruby_legacy_function_instantiator.rb:23 msgid "The code loaded from %{source_ref} does not seem to be a Puppet 3x API function - no 'newfunction' call." msgstr "" #. TRANSLATORS - the word 'newfunction' should not be translated as it is a method name. -#: ../lib/puppet/pops/loader/ruby_legacy_function_instantiator.rb:47 +#: ../lib/puppet/pops/loader/ruby_legacy_function_instantiator.rb:45 msgid "Illegal legacy function definition! The code loaded from %{source_ref} did not return the result of calling 'newfunction'. Got '%{klass}'" msgstr "" -#: ../lib/puppet/pops/loader/ruby_legacy_function_instantiator.rb:50 +#: ../lib/puppet/pops/loader/ruby_legacy_function_instantiator.rb:48 msgid "The code loaded from %{source_ref} produced mis-matched name, expected 'function_%{type_name}', got '%{created_name}'" msgstr "" -#: ../lib/puppet/pops/loader/ruby_legacy_function_instantiator.rb:94 -msgid "Illegal method definition of method '%{method_name}' on line %{line}' in legacy function. See %{url} for more information" +#: ../lib/puppet/pops/loader/ruby_legacy_function_instantiator.rb:92 +msgid "Illegal method definition of method '%{method_name}' on line %{line} in legacy function. See %{url} for more information" msgstr "" #: ../lib/puppet/pops/loader/task_instantiator.rb:22 From 03073d2285ce32011b7a401e04b83266c12d4a13 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Wed, 21 Oct 2020 23:38:09 +0000 Subject: [PATCH 222/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 8 -------- 1 file changed, 8 deletions(-) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index 8ae45d431d7..3686709a0fc 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -723,14 +723,6 @@ Freezes the \'main\' class, disallowing any code to be added to it\. This essent . .IP "" 0 . -.SS "func3x_check" -Causes validation of loaded legacy Ruby functions (3x API) to raise errors about illegal constructs that could cause harm or that simply does not work\. This flag is on by default\. This flag is made available so that the validation can be turned off in case the method of validation is faulty \- if encountered, please file a bug report\. -. -.IP "\(bu" 4 -\fIDefault\fR: true -. -.IP "" 0 -. .SS "genconfig" When true, causes Puppet applications to print an example config file to stdout and exit\. The example will include descriptions of each setting, and the current (or default) value of each setting, incorporating any settings overridden on the CLI (with the exception of \fBgenconfig\fR itself)\. This setting only makes sense when specified on the command line as \fB\-\-genconfig\fR\. . From eafff42154eec6929f27823d30fc610fa8481885 Mon Sep 17 00:00:00 2001 From: Oana Tanasoiu Date: Tue, 20 Oct 2020 17:15:59 +0300 Subject: [PATCH 223/731] (PUP-10716) Fix show action output formatting --- lib/puppet/face/facts.rb | 6 ++++-- spec/unit/application/facts_spec.rb | 17 +++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/lib/puppet/face/facts.rb b/lib/puppet/face/facts.rb index b90a1d46aab..4857a17ac4d 100644 --- a/lib/puppet/face/facts.rb +++ b/lib/puppet/face/facts.rb @@ -127,8 +127,6 @@ summary _("Show legacy facts when querying all facts.") end - render_as :json - when_invoked do |*args| options = args.pop @@ -142,6 +140,10 @@ result.values end + + when_rendering :console do |result| + Puppet::Util::Json.dump(result, :pretty => true) + end end end diff --git a/spec/unit/application/facts_spec.rb b/spec/unit/application/facts_spec.rb index b3327598e1e..6e939c02a0a 100644 --- a/spec/unit/application/facts_spec.rb +++ b/spec/unit/application/facts_spec.rb @@ -50,4 +50,21 @@ }.to exit_with(0) .and output(expected).to_stdout end + + context 'when show action is called' do + let(:expected) { "{\n \"filesystems\": \"apfs,autofs,devfs\",\n \"macaddress\": \"64:52:11:22:03:25\"\n}\n" } + + before :each do + Puppet::Node::Facts.indirection.terminus_class = :facter + allow(Facter).to receive(:resolve).and_return(values) + app.command_line.args = %w{show} + end + + it 'correctly displays facts with default formatting' do + expect { + app.run + }.to exit_with(0) + .and output(expected).to_stdout + end + end end From 271177ebea342447225e1b7c641dabf0a5327355 Mon Sep 17 00:00:00 2001 From: Justin Stoller Date: Thu, 20 Aug 2020 15:11:50 -0700 Subject: [PATCH 224/731] (PUP-10656) Provide a JSON fact terminus We have a YAML terminus for facts, however YAML can problematic for hexidecimal numbers (see PUP-9505). Additionally, JSON is generally a better serialization format for machines to understand, is a smaller spec than YAML, has a relatively mature ecosystem in Java around parsing/serializing, and is backwards compatible with YAML for recent YAML parsers (YAML has become a superset of JSON). For these reasons we should implement a JSON terminus for facts (there already exists one for catalogs) and users should be encouraged to use it instead of the YAML terminus. --- lib/puppet/indirector/fact_search.rb | 60 ++++++ lib/puppet/indirector/facts/json.rb | 27 +++ lib/puppet/indirector/facts/yaml.rb | 61 +----- lib/puppet/indirector/json.rb | 6 +- spec/unit/indirector/facts/json_spec.rb | 255 ++++++++++++++++++++++++ 5 files changed, 350 insertions(+), 59 deletions(-) create mode 100644 lib/puppet/indirector/fact_search.rb create mode 100644 lib/puppet/indirector/facts/json.rb create mode 100644 spec/unit/indirector/facts/json_spec.rb diff --git a/lib/puppet/indirector/fact_search.rb b/lib/puppet/indirector/fact_search.rb new file mode 100644 index 00000000000..15826e7e81d --- /dev/null +++ b/lib/puppet/indirector/fact_search.rb @@ -0,0 +1,60 @@ +# module containing common methods used by json and yaml facts indirection terminus +module Puppet::Indirector::FactSearch + def node_matches?(facts, options) + options.each do |key, value| + type, name, operator = key.to_s.split(".") + operator ||= 'eq' + + return false unless node_matches_option?(type, name, operator, value, facts) + end + return true + end + + def node_matches_option?(type, name, operator, value, facts) + case type + when "meta" + case name + when "timestamp" + compare_timestamp(operator, facts.timestamp, Time.parse(value)) + end + when "facts" + compare_facts(operator, facts.values[name], value) + end + end + + def compare_facts(operator, value1, value2) + return false unless value1 + + case operator + when "eq" + value1.to_s == value2.to_s + when "le" + value1.to_f <= value2.to_f + when "ge" + value1.to_f >= value2.to_f + when "lt" + value1.to_f < value2.to_f + when "gt" + value1.to_f > value2.to_f + when "ne" + value1.to_s != value2.to_s + end + end + + def compare_timestamp(operator, value1, value2) + case operator + when "eq" + value1 == value2 + when "le" + value1 <= value2 + when "ge" + value1 >= value2 + when "lt" + value1 < value2 + when "gt" + value1 > value2 + when "ne" + value1 != value2 + end + end +end \ No newline at end of file diff --git a/lib/puppet/indirector/facts/json.rb b/lib/puppet/indirector/facts/json.rb new file mode 100644 index 00000000000..038e45fb2c8 --- /dev/null +++ b/lib/puppet/indirector/facts/json.rb @@ -0,0 +1,27 @@ +require 'puppet/node/facts' +require 'puppet/indirector/json' +require 'puppet/indirector/fact_search' + +class Puppet::Node::Facts::Json < Puppet::Indirector::JSON + desc "Store client facts as flat files, serialized using JSON, or + return deserialized facts from disk." + + include Puppet::Indirector::FactSearch + + def search(request) + node_names = [] + Dir.glob(json_dir_path).each do |file| + facts = load_json_from_file(file, '') + if facts && node_matches?(facts, request.options) + node_names << facts.name + end + end + node_names + end + + private + + def json_dir_path + self.path("*") + end +end diff --git a/lib/puppet/indirector/facts/yaml.rb b/lib/puppet/indirector/facts/yaml.rb index 9ee5b31cebb..6a5f0693113 100644 --- a/lib/puppet/indirector/facts/yaml.rb +++ b/lib/puppet/indirector/facts/yaml.rb @@ -1,10 +1,13 @@ require 'puppet/node/facts' require 'puppet/indirector/yaml' +require 'puppet/indirector/fact_search' class Puppet::Node::Facts::Yaml < Puppet::Indirector::Yaml desc "Store client facts as flat files, serialized using YAML, or return deserialized facts from disk." + include Puppet::Indirector::FactSearch + def search(request) node_names = [] Dir.glob(yaml_dir_path).each do |file| @@ -23,62 +26,4 @@ def yaml_dir_path base = Puppet.run_mode.server? ? Puppet[:yamldir] : Puppet[:clientyamldir] File.join(base, 'facts', '*.yaml') end - - def node_matches?(facts, options) - options.each do |key, value| - type, name, operator = key.to_s.split(".") - operator ||= 'eq' - - return false unless node_matches_option?(type, name, operator, value, facts) - end - return true - end - - def node_matches_option?(type, name, operator, value, facts) - case type - when "meta" - case name - when "timestamp" - compare_timestamp(operator, facts.timestamp, Time.parse(value)) - end - when "facts" - compare_facts(operator, facts.values[name], value) - end - end - - def compare_facts(operator, value1, value2) - return false unless value1 - - case operator - when "eq" - value1.to_s == value2.to_s - when "le" - value1.to_f <= value2.to_f - when "ge" - value1.to_f >= value2.to_f - when "lt" - value1.to_f < value2.to_f - when "gt" - value1.to_f > value2.to_f - when "ne" - value1.to_s != value2.to_s - end - end - - def compare_timestamp(operator, value1, value2) - case operator - when "eq" - value1 == value2 - when "le" - value1 <= value2 - when "ge" - value1 >= value2 - when "lt" - value1 < value2 - when "gt" - value1 > value2 - when "ne" - value1 != value2 - end - end end diff --git a/lib/puppet/indirector/json.rb b/lib/puppet/indirector/json.rb index b23ecd09b9b..fe16aa1f401 100644 --- a/lib/puppet/indirector/json.rb +++ b/lib/puppet/indirector/json.rb @@ -41,12 +41,16 @@ def path(name, ext = '.json') raise ArgumentError, _("invalid key") end - base = Puppet.run_mode.server? ? Puppet[:server_datadir] : Puppet[:client_datadir] + base = data_dir File.join(base, self.class.indirection_name.to_s, name.to_s + ext) end private + def data_dir() + Puppet.run_mode.server? ? Puppet[:server_datadir] : Puppet[:client_datadir] + end + def load_json_from_file(file, key) json = nil diff --git a/spec/unit/indirector/facts/json_spec.rb b/spec/unit/indirector/facts/json_spec.rb new file mode 100644 index 00000000000..11776203e23 --- /dev/null +++ b/spec/unit/indirector/facts/json_spec.rb @@ -0,0 +1,255 @@ +require 'spec_helper' + +require 'puppet/node/facts' +require 'puppet/indirector/facts/json' + +def dir_containing_json_facts(hash) + jsondir = tmpdir('json_facts') + + Puppet[:client_datadir] = jsondir + dir = File.join(jsondir, 'facts') + Dir.mkdir(dir) + hash.each_pair do |file, facts| + File.open(File.join(dir, file), 'wb') do |f| + f.write(JSON.dump(facts)) + end + end +end + +describe Puppet::Node::Facts::Json do + include PuppetSpec::Files + + it "should be a subclass of the Json terminus" do + expect(Puppet::Node::Facts::Json.superclass).to equal(Puppet::Indirector::JSON) + end + + it "should have documentation" do + expect(Puppet::Node::Facts::Json.doc).not_to be_nil + expect(Puppet::Node::Facts::Json.doc).not_to be_empty + end + + it "should be registered with the facts indirection" do + indirection = Puppet::Indirector::Indirection.instance(:facts) + expect(Puppet::Node::Facts::Json.indirection).to equal(indirection) + end + + it "should have its name set to :json" do + expect(Puppet::Node::Facts::Json.name).to eq(:json) + end + + it "should allow network requests" do + # Doesn't allow json as a network format, but allows `puppet facts upload` + # to update the JSON cache on a master. + expect(Puppet::Node::Facts::Json.new.allow_remote_requests?).to be(true) + end + + describe "#search" do + def assert_search_matches(matching, nonmatching, query) + request = Puppet::Indirector::Request.new(:inventory, :search, nil, nil, query) + + dir_containing_json_facts(matching.merge(nonmatching)) + + results = Puppet::Node::Facts::Json.new.search(request) + expect(results).to match_array(matching.values.map {|facts| facts.name}) + end + + it "should return node names that match the search query options" do + assert_search_matches({ + 'matching.json' => Puppet::Node::Facts.new("matchingnode", "architecture" => "i386", 'processor_count' => '4'), + 'matching1.json' => Puppet::Node::Facts.new("matchingnode1", "architecture" => "i386", 'processor_count' => '4', 'randomfact' => 'foo') + }, + { + "nonmatching.json" => Puppet::Node::Facts.new("nonmatchingnode", "architecture" => "powerpc", 'processor_count' => '4'), + "nonmatching1.json" => Puppet::Node::Facts.new("nonmatchingnode1", "architecture" => "powerpc", 'processor_count' => '5'), + "nonmatching2.json" => Puppet::Node::Facts.new("nonmatchingnode2", "architecture" => "i386", 'processor_count' => '5'), + "nonmatching3.json" => Puppet::Node::Facts.new("nonmatchingnode3", 'processor_count' => '4'), + }, + {'facts.architecture' => 'i386', 'facts.processor_count' => '4'} + ) + end + + it "should return empty array when no nodes match the search query options" do + assert_search_matches({}, { + "nonmatching.json" => Puppet::Node::Facts.new("nonmatchingnode", "architecture" => "powerpc", 'processor_count' => '10'), + "nonmatching1.json" => Puppet::Node::Facts.new("nonmatchingnode1", "architecture" => "powerpc", 'processor_count' => '5'), + "nonmatching2.json" => Puppet::Node::Facts.new("nonmatchingnode2", "architecture" => "i386", 'processor_count' => '5'), + "nonmatching3.json" => Puppet::Node::Facts.new("nonmatchingnode3", 'processor_count' => '4'), + }, + {'facts.processor_count.lt' => '4', 'facts.processor_count.gt' => '4'} + ) + end + + it "should return node names that match the search query options with the greater than operator" do + assert_search_matches({ + 'matching.json' => Puppet::Node::Facts.new("matchingnode", "architecture" => "i386", 'processor_count' => '5'), + 'matching1.json' => Puppet::Node::Facts.new("matchingnode1", "architecture" => "powerpc", 'processor_count' => '10', 'randomfact' => 'foo') + }, + { + "nonmatching.json" => Puppet::Node::Facts.new("nonmatchingnode", "architecture" => "powerpc", 'processor_count' => '4'), + "nonmatching2.json" => Puppet::Node::Facts.new("nonmatchingnode2", "architecture" => "i386", 'processor_count' => '3'), + "nonmatching3.json" => Puppet::Node::Facts.new("nonmatchingnode3" ), + }, + {'facts.processor_count.gt' => '4'} + ) + end + + it "should return node names that match the search query options with the less than operator" do + assert_search_matches({ + 'matching.json' => Puppet::Node::Facts.new("matchingnode", "architecture" => "i386", 'processor_count' => '5'), + 'matching1.json' => Puppet::Node::Facts.new("matchingnode1", "architecture" => "powerpc", 'processor_count' => '30', 'randomfact' => 'foo') + }, + { + "nonmatching.json" => Puppet::Node::Facts.new("nonmatchingnode", "architecture" => "powerpc", 'processor_count' => '50' ), + "nonmatching2.json" => Puppet::Node::Facts.new("nonmatchingnode2", "architecture" => "i386", 'processor_count' => '100'), + "nonmatching3.json" => Puppet::Node::Facts.new("nonmatchingnode3" ), + }, + {'facts.processor_count.lt' => '50'} + ) + end + + it "should return node names that match the search query options with the less than or equal to operator" do + assert_search_matches({ + 'matching.json' => Puppet::Node::Facts.new("matchingnode", "architecture" => "i386", 'processor_count' => '5'), + 'matching1.json' => Puppet::Node::Facts.new("matchingnode1", "architecture" => "powerpc", 'processor_count' => '50', 'randomfact' => 'foo') + }, + { + "nonmatching.json" => Puppet::Node::Facts.new("nonmatchingnode", "architecture" => "powerpc", 'processor_count' => '100' ), + "nonmatching2.json" => Puppet::Node::Facts.new("nonmatchingnode2", "architecture" => "i386", 'processor_count' => '5000'), + "nonmatching3.json" => Puppet::Node::Facts.new("nonmatchingnode3" ), + }, + {'facts.processor_count.le' => '50'} + ) + end + + it "should return node names that match the search query options with the greater than or equal to operator" do + assert_search_matches({ + 'matching.json' => Puppet::Node::Facts.new("matchingnode", "architecture" => "i386", 'processor_count' => '100'), + 'matching1.json' => Puppet::Node::Facts.new("matchingnode1", "architecture" => "powerpc", 'processor_count' => '50', 'randomfact' => 'foo') + }, + { + "nonmatching.json" => Puppet::Node::Facts.new("nonmatchingnode", "architecture" => "powerpc", 'processor_count' => '40'), + "nonmatching2.json" => Puppet::Node::Facts.new("nonmatchingnode2", "architecture" => "i386", 'processor_count' => '9' ), + "nonmatching3.json" => Puppet::Node::Facts.new("nonmatchingnode3" ), + }, + {'facts.processor_count.ge' => '50'} + ) + end + + it "should return node names that match the search query options with the not equal operator" do + assert_search_matches({ + 'matching.json' => Puppet::Node::Facts.new("matchingnode", "architecture" => 'arm' ), + 'matching1.json' => Puppet::Node::Facts.new("matchingnode1", "architecture" => 'powerpc', 'randomfact' => 'foo') + }, + { + "nonmatching.json" => Puppet::Node::Facts.new("nonmatchingnode", "architecture" => "i386" ), + "nonmatching2.json" => Puppet::Node::Facts.new("nonmatchingnode2", "architecture" => "i386", 'processor_count' => '9' ), + "nonmatching3.json" => Puppet::Node::Facts.new("nonmatchingnode3" ), + }, + {'facts.architecture.ne' => 'i386'} + ) + end + + def apply_timestamp(facts, timestamp) + facts.timestamp = timestamp + facts + end + + it "should be able to query based on meta.timestamp.gt" do + assert_search_matches({ + '2010-11-01.json' => apply_timestamp(Puppet::Node::Facts.new("2010-11-01", {}), Time.parse("2010-11-01")), + '2010-11-10.json' => apply_timestamp(Puppet::Node::Facts.new("2010-11-10", {}), Time.parse("2010-11-10")), + }, + { + '2010-10-01.json' => apply_timestamp(Puppet::Node::Facts.new("2010-10-01", {}), Time.parse("2010-10-01")), + '2010-10-10.json' => apply_timestamp(Puppet::Node::Facts.new("2010-10-10", {}), Time.parse("2010-10-10")), + '2010-10-15.json' => apply_timestamp(Puppet::Node::Facts.new("2010-10-15", {}), Time.parse("2010-10-15")), + }, + {'meta.timestamp.gt' => '2010-10-15'} + ) + end + + it "should be able to query based on meta.timestamp.le" do + assert_search_matches({ + '2010-10-01.json' => apply_timestamp(Puppet::Node::Facts.new("2010-10-01", {}), Time.parse("2010-10-01")), + '2010-10-10.json' => apply_timestamp(Puppet::Node::Facts.new("2010-10-10", {}), Time.parse("2010-10-10")), + '2010-10-15.json' => apply_timestamp(Puppet::Node::Facts.new("2010-10-15", {}), Time.parse("2010-10-15")), + }, + { + '2010-11-01.json' => apply_timestamp(Puppet::Node::Facts.new("2010-11-01", {}), Time.parse("2010-11-01")), + '2010-11-10.json' => apply_timestamp(Puppet::Node::Facts.new("2010-11-10", {}), Time.parse("2010-11-10")), + }, + {'meta.timestamp.le' => '2010-10-15'} + ) + end + + it "should be able to query based on meta.timestamp.lt" do + assert_search_matches({ + '2010-10-01.json' => apply_timestamp(Puppet::Node::Facts.new("2010-10-01", {}), Time.parse("2010-10-01")), + '2010-10-10.json' => apply_timestamp(Puppet::Node::Facts.new("2010-10-10", {}), Time.parse("2010-10-10")), + }, + { + '2010-11-01.json' => apply_timestamp(Puppet::Node::Facts.new("2010-11-01", {}), Time.parse("2010-11-01")), + '2010-11-10.json' => apply_timestamp(Puppet::Node::Facts.new("2010-11-10", {}), Time.parse("2010-11-10")), + '2010-10-15.json' => apply_timestamp(Puppet::Node::Facts.new("2010-10-15", {}), Time.parse("2010-10-15")), + }, + {'meta.timestamp.lt' => '2010-10-15'} + ) + end + + it "should be able to query based on meta.timestamp.ge" do + assert_search_matches({ + '2010-11-01.json' => apply_timestamp(Puppet::Node::Facts.new("2010-11-01", {}), Time.parse("2010-11-01")), + '2010-11-10.json' => apply_timestamp(Puppet::Node::Facts.new("2010-11-10", {}), Time.parse("2010-11-10")), + '2010-10-15.json' => apply_timestamp(Puppet::Node::Facts.new("2010-10-15", {}), Time.parse("2010-10-15")), + }, + { + '2010-10-01.json' => apply_timestamp(Puppet::Node::Facts.new("2010-10-01", {}), Time.parse("2010-10-01")), + '2010-10-10.json' => apply_timestamp(Puppet::Node::Facts.new("2010-10-10", {}), Time.parse("2010-10-10")), + }, + {'meta.timestamp.ge' => '2010-10-15'} + ) + end + + it "should be able to query based on meta.timestamp.eq" do + assert_search_matches({ + '2010-10-15.json' => apply_timestamp(Puppet::Node::Facts.new("2010-10-15", {}), Time.parse("2010-10-15")), + }, + { + '2010-11-01.json' => apply_timestamp(Puppet::Node::Facts.new("2010-11-01", {}), Time.parse("2010-11-01")), + '2010-11-10.json' => apply_timestamp(Puppet::Node::Facts.new("2010-11-10", {}), Time.parse("2010-11-10")), + '2010-10-01.json' => apply_timestamp(Puppet::Node::Facts.new("2010-10-01", {}), Time.parse("2010-10-01")), + '2010-10-10.json' => apply_timestamp(Puppet::Node::Facts.new("2010-10-10", {}), Time.parse("2010-10-10")), + }, + {'meta.timestamp.eq' => '2010-10-15'} + ) + end + + it "should be able to query based on meta.timestamp" do + assert_search_matches({ + '2010-10-15.json' => apply_timestamp(Puppet::Node::Facts.new("2010-10-15", {}), Time.parse("2010-10-15")), + }, + { + '2010-11-01.json' => apply_timestamp(Puppet::Node::Facts.new("2010-11-01", {}), Time.parse("2010-11-01")), + '2010-11-10.json' => apply_timestamp(Puppet::Node::Facts.new("2010-11-10", {}), Time.parse("2010-11-10")), + '2010-10-01.json' => apply_timestamp(Puppet::Node::Facts.new("2010-10-01", {}), Time.parse("2010-10-01")), + '2010-10-10.json' => apply_timestamp(Puppet::Node::Facts.new("2010-10-10", {}), Time.parse("2010-10-10")), + }, + {'meta.timestamp' => '2010-10-15'} + ) + end + + it "should be able to query based on meta.timestamp.ne" do + assert_search_matches({ + '2010-11-01.json' => apply_timestamp(Puppet::Node::Facts.new("2010-11-01", {}), Time.parse("2010-11-01")), + '2010-11-10.json' => apply_timestamp(Puppet::Node::Facts.new("2010-11-10", {}), Time.parse("2010-11-10")), + '2010-10-01.json' => apply_timestamp(Puppet::Node::Facts.new("2010-10-01", {}), Time.parse("2010-10-01")), + '2010-10-10.json' => apply_timestamp(Puppet::Node::Facts.new("2010-10-10", {}), Time.parse("2010-10-10")), + }, + { + '2010-10-15.json' => apply_timestamp(Puppet::Node::Facts.new("2010-10-15", {}), Time.parse("2010-10-15")), + }, + {'meta.timestamp.ne' => '2010-10-15'} + ) + end + end +end From c2b87527385516b64fbe3ef991ea4417df346e9e Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Fri, 23 Oct 2020 16:44:36 +0000 Subject: [PATCH 225/731] (packaging) Updating manpage file for main --- man/man8/puppet-facts.8 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/man/man8/puppet-facts.8 b/man/man8/puppet-facts.8 index 8078d92e77e..9d2fed1fd30 100644 --- a/man/man8/puppet-facts.8 +++ b/man/man8/puppet-facts.8 @@ -205,6 +205,9 @@ This subcommand is an indirector face, which exposes \fBfind\fR, \fBsearch\fR, \ \fBfacter\fR . .IP "\(bu" 4 +\fBjson\fR +. +.IP "\(bu" 4 \fBmemory\fR . .IP "\(bu" 4 From cac467756b3eb70fe0c2b0a07ed108714b383ff1 Mon Sep 17 00:00:00 2001 From: Oana Tanasoiu Date: Mon, 26 Oct 2020 10:30:19 +0200 Subject: [PATCH 226/731] (PUP-10715) Show action default for puppet facts --- lib/puppet/face/facts.rb | 9 +++++---- spec/unit/application/facts_spec.rb | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/lib/puppet/face/facts.rb b/lib/puppet/face/facts.rb index 4857a17ac4d..37e4f27e774 100644 --- a/lib/puppet/face/facts.rb +++ b/lib/puppet/face/facts.rb @@ -31,7 +31,6 @@ $ puppet facts find EOT - find.default = true deactivate_action(:destroy) deactivate_action(:search) @@ -85,12 +84,13 @@ end action(:show) do - summary _("Facter plugin sync") + summary _("Retrieve current node's facts.") arguments _("[]") description <<-'EOT' - Reads facts from the local system using facter gem. + Reads facts from the local system using `facter` terminus. + A query can be provided to retrieve just a specific fact or a set of facts. EOT - returns "The output of facter with added puppet specific facts" + returns "The output of facter with added puppet specific facts." notes <<-'EOT' EOT @@ -99,6 +99,7 @@ $ puppet facts show os EOT + default true option("--config-file " + _("")) do default_to { nil } diff --git a/spec/unit/application/facts_spec.rb b/spec/unit/application/facts_spec.rb index 6e939c02a0a..cb07c908304 100644 --- a/spec/unit/application/facts_spec.rb +++ b/spec/unit/application/facts_spec.rb @@ -67,4 +67,22 @@ .and output(expected).to_stdout end end + + context 'when default action is called' do + let(:expected) { "---\nfilesystems: apfs,autofs,devfs\nmacaddress: 64:52:11:22:03:25\n" } + + before :each do + Puppet::Node::Facts.indirection.terminus_class = :facter + allow(Facter).to receive(:resolve).and_return(values) + app.command_line.args = %w{--render-as yaml} + end + + it 'calls show action' do + expect { + app.run + }.to exit_with(0) + .and output(expected).to_stdout + expect(app.action.name).to eq(:show) + end + end end From abcf99813b48ff59d73896ecf8f1c0d30ece4dcf Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Mon, 26 Oct 2020 09:06:18 +0000 Subject: [PATCH 227/731] (packaging) Updating the puppet.pot file --- locales/puppet.pot | 274 ++++++++++++++++++++++----------------------- 1 file changed, 137 insertions(+), 137 deletions(-) diff --git a/locales/puppet.pot b/locales/puppet.pot index 37813f185e4..f9410f4f3c4 100644 --- a/locales/puppet.pot +++ b/locales/puppet.pot @@ -6,11 +6,11 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Puppet automation framework 6.19.0-342-g36d30c1b1d\n" +"Project-Id-Version: Puppet automation framework 6.19.1-378-g1ea1f3c274\n" "\n" "Report-Msgid-Bugs-To: https://tickets.puppetlabs.com\n" -"POT-Creation-Date: 2020-10-21 23:36+0000\n" -"PO-Revision-Date: 2020-10-21 23:36+0000\n" +"POT-Creation-Date: 2020-10-26 09:06+0000\n" +"PO-Revision-Date: 2020-10-26 09:06+0000\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -120,59 +120,59 @@ msgstr "" msgid "Failed to acquire lock" msgstr "" -#: ../lib/puppet/application.rb:238 +#: ../lib/puppet/application.rb:231 msgid "Unable to find application '%{application_name}'. %{error}" msgstr "" -#: ../lib/puppet/application.rb:259 +#: ../lib/puppet/application.rb:252 msgid "Unable to load application class '%{class_name}' from file 'puppet/application/%{application_name}.rb'" msgstr "" -#: ../lib/puppet/application.rb:298 +#: ../lib/puppet/application.rb:305 msgid "Invalid environment mode '%{mode_name}'" msgstr "" -#: ../lib/puppet/application.rb:366 +#: ../lib/puppet/application.rb:405 msgid "Could not get application-specific default settings" msgstr "" -#: ../lib/puppet/application.rb:372 +#: ../lib/puppet/application.rb:411 msgid "Could not initialize" msgstr "" -#: ../lib/puppet/application.rb:373 +#: ../lib/puppet/application.rb:412 msgid "Could not parse application options" msgstr "" -#: ../lib/puppet/application.rb:374 +#: ../lib/puppet/application.rb:413 msgid "Could not prepare for execution" msgstr "" -#: ../lib/puppet/application.rb:377 +#: ../lib/puppet/application.rb:416 msgid "`puppet %{name}` is deprecated and will be removed in a future release." msgstr "" -#: ../lib/puppet/application.rb:380 +#: ../lib/puppet/application.rb:419 msgid "Could not configure routes from %{route_file}" msgstr "" -#: ../lib/puppet/application.rb:381 +#: ../lib/puppet/application.rb:420 msgid "Could not log runtime debug info" msgstr "" -#: ../lib/puppet/application.rb:382 +#: ../lib/puppet/application.rb:421 msgid "Could not run" msgstr "" -#: ../lib/puppet/application.rb:386 +#: ../lib/puppet/application.rb:430 msgid "No valid command or main" msgstr "" -#: ../lib/puppet/application.rb:428 +#: ../lib/puppet/application.rb:483 msgid "Could not set logdest to %{dest}." msgstr "" -#: ../lib/puppet/application.rb:504 +#: ../lib/puppet/application.rb:576 msgid "No help available for puppet %{app_name}" msgstr "" @@ -410,7 +410,7 @@ msgstr "" msgid "Unknown rendering format '%{format}'" msgstr "" -#: ../lib/puppet/application/lookup.rb:366 ../lib/puppet/face/epp.rb:520 +#: ../lib/puppet/application/lookup.rb:366 ../lib/puppet/face/epp.rb:530 msgid "Incorrect formatted data in %{fact_file} given via the --facts flag" msgstr "" @@ -587,12 +587,12 @@ msgstr "" msgid "Failed to apply catalog: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:450 ../lib/puppet/http/resolver/server_list.rb:67 +#: ../lib/puppet/configurer.rb:450 ../lib/puppet/http/resolver/server_list.rb:63 msgid "Puppet server %{host}:%{port} is unavailable: %{code} %{reason}" msgstr "" #. TRANSLATORS 'server_list' is the name of a setting and should not be translated -#: ../lib/puppet/configurer.rb:454 ../lib/puppet/http/resolver/server_list.rb:70 +#: ../lib/puppet/configurer.rb:454 ../lib/puppet/http/resolver/server_list.rb:66 msgid "Unable to connect to server from server_list setting: %{detail}" msgstr "" @@ -1015,47 +1015,47 @@ msgstr "" msgid "[]" msgstr "" -#: ../lib/puppet/face/facts.rb:40 +#: ../lib/puppet/face/facts.rb:39 msgid "Upload local facts to the puppet master." msgstr "" -#: ../lib/puppet/face/facts.rb:78 +#: ../lib/puppet/face/facts.rb:77 msgid "Uploading facts for '%{node}' to '%{server}'" msgstr "" -#: ../lib/puppet/face/facts.rb:88 -msgid "Facter plugin sync" +#: ../lib/puppet/face/facts.rb:87 +msgid "Retrieve current node's facts." msgstr "" -#: ../lib/puppet/face/facts.rb:89 +#: ../lib/puppet/face/facts.rb:88 msgid "[]" msgstr "" -#: ../lib/puppet/face/facts.rb:103 ../lib/puppet/face/facts.rb:108 ../lib/puppet/face/facts.rb:113 ../lib/puppet/face/module/changes.rb:21 +#: ../lib/puppet/face/facts.rb:104 ../lib/puppet/face/facts.rb:109 ../lib/puppet/face/facts.rb:114 ../lib/puppet/face/module/changes.rb:21 msgid "" msgstr "" -#: ../lib/puppet/face/facts.rb:105 +#: ../lib/puppet/face/facts.rb:106 msgid "The location of the config file for Facter." msgstr "" -#: ../lib/puppet/face/facts.rb:110 +#: ../lib/puppet/face/facts.rb:111 msgid "The path to a directory that contains custom facts." msgstr "" -#: ../lib/puppet/face/facts.rb:115 +#: ../lib/puppet/face/facts.rb:116 msgid "The path to a directory that contains external facts." msgstr "" -#: ../lib/puppet/face/facts.rb:119 +#: ../lib/puppet/face/facts.rb:120 msgid "Disable fact blocking mechanism." msgstr "" -#: ../lib/puppet/face/facts.rb:123 +#: ../lib/puppet/face/facts.rb:124 msgid "Disable fact caching mechanism." msgstr "" -#: ../lib/puppet/face/facts.rb:127 +#: ../lib/puppet/face/facts.rb:128 msgid "Show legacy facts when querying all facts." msgstr "" @@ -2179,68 +2179,68 @@ msgstr "" msgid "Try the '--graph' option and opening the resulting '.dot' file in OmniGraffle or GraphViz" msgstr "" -#: ../lib/puppet/http/client.rb:90 +#: ../lib/puppet/http/client.rb:156 msgid "Request to %{uri} timed out connect operation after %{elapsed} seconds" msgstr "" -#: ../lib/puppet/http/client.rb:92 +#: ../lib/puppet/http/client.rb:158 msgid "Request to %{uri} timed out read operation after %{elapsed} seconds" msgstr "" -#: ../lib/puppet/http/client.rb:94 +#: ../lib/puppet/http/client.rb:160 msgid "Request to %{uri} interrupted after %{elapsed} seconds" msgstr "" -#: ../lib/puppet/http/client.rb:100 +#: ../lib/puppet/http/client.rb:166 msgid "Request to %{uri} failed after %{elapsed} seconds: %{message}" msgstr "" -#: ../lib/puppet/http/client.rb:326 +#: ../lib/puppet/http/client.rb:369 msgid "Sleeping for %{interval} seconds before retrying the request" msgstr "" -#: ../lib/puppet/http/client.rb:369 +#: ../lib/puppet/http/client.rb:419 msgid "HTTP REST queries cannot handle values of type '%{klass}'" msgstr "" -#: ../lib/puppet/http/errors.rb:23 +#: ../lib/puppet/http/errors.rb:37 msgid "Too many HTTP redirections for %{addr}" msgstr "" -#: ../lib/puppet/http/errors.rb:29 +#: ../lib/puppet/http/errors.rb:45 msgid "Too many HTTP retries for %{addr}" msgstr "" -#: ../lib/puppet/http/pool.rb:85 +#: ../lib/puppet/http/pool.rb:84 msgid "Failed to close connection for %{site}: %{detail}" msgstr "" -#: ../lib/puppet/http/redirector.rb:78 +#: ../lib/puppet/http/redirector.rb:70 msgid "Location response header is missing" msgstr "" -#: ../lib/puppet/http/redirector.rb:82 +#: ../lib/puppet/http/redirector.rb:74 msgid "Location URI is invalid: %{detail}" msgstr "" -#: ../lib/puppet/http/retry_after_handler.rb:83 +#: ../lib/puppet/http/retry_after_handler.rb:74 msgid "Failed to parse Retry-After header '%{retry_after}' as an integer or RFC 2822 date" msgstr "" -#: ../lib/puppet/http/service.rb:121 +#: ../lib/puppet/http/service.rb:107 msgid "Ignoring extra header \"%{name}\" as it was previously set." msgstr "" -#: ../lib/puppet/http/service.rb:124 +#: ../lib/puppet/http/service.rb:110 msgid "Ignoring extra header \"%{name}\" as it has no value." msgstr "" -#: ../lib/puppet/http/service.rb:147 ../lib/puppet/indirector/rest.rb:53 +#: ../lib/puppet/http/service.rb:133 ../lib/puppet/indirector/rest.rb:53 msgid "No content type in http response; cannot parse" msgstr "" #. TRANSLATORS "pson", "preferred_serialization_format", and "puppetserver" should not be translated -#: ../lib/puppet/http/service/report.rb:61 +#: ../lib/puppet/http/service/report.rb:59 msgid "To submit reports to a server running puppetserver %{server_version}, set preferred_serialization_format to pson" msgstr "" @@ -2651,11 +2651,11 @@ msgstr "" msgid "invalid key" msgstr "" -#: ../lib/puppet/indirector/json.rb:58 +#: ../lib/puppet/indirector/json.rb:62 msgid "Could not read JSON data for %{name} %{key}: %{detail}" msgstr "" -#: ../lib/puppet/indirector/json.rb:64 +#: ../lib/puppet/indirector/json.rb:68 msgid "Could not parse JSON data for %{name} %{key}: %{detail}" msgstr "" @@ -2704,6 +2704,14 @@ msgstr "" msgid "Could not load external node results for %{name}: %{detail}" msgstr "" +#: ../lib/puppet/indirector/report/json.rb:19 ../lib/puppet/indirector/report/yaml.rb:19 +msgid "replace_file mode: %{mode} is invalid" +msgstr "" + +#: ../lib/puppet/indirector/report/json.rb:31 ../lib/puppet/indirector/report/yaml.rb:31 ../lib/puppet/indirector/yaml.rb:32 +msgid "Could not save %{indirection} %{request}: %{detail}" +msgstr "" + #: ../lib/puppet/indirector/report/processor.rb:39 msgid "Report %{report} failed: %{detail}" msgstr "" @@ -2716,14 +2724,6 @@ msgstr "" msgid "Server version %{version} does not accept reports in '%{format}', use `preferred_serialization_format=pson`" msgstr "" -#: ../lib/puppet/indirector/report/yaml.rb:19 -msgid "replace_file mode: %{mode} is invalid" -msgstr "" - -#: ../lib/puppet/indirector/report/yaml.rb:31 ../lib/puppet/indirector/yaml.rb:32 -msgid "Could not save %{indirection} %{request}: %{detail}" -msgstr "" - #: ../lib/puppet/indirector/request.rb:102 msgid "Could not find indirection '%{indirection}'" msgstr "" @@ -3866,60 +3866,60 @@ msgid "Given data_type value is not a data type, got '%{type}'" msgstr "" #. TRANSLATORS 'type' and 'title' are internal parameter names - do not translate -#: ../lib/puppet/pal/json_catalog_encoder.rb:52 +#: ../lib/puppet/pal/json_catalog_encoder.rb:54 msgid "Both type and title must be given" msgstr "" #. TRANSLATORS: do not translate the variable names in this error message #. TRANSLATORS: do not translate the variable names in this error message -#: ../lib/puppet/pal/pal_impl.rb:75 ../lib/puppet/pal/pal_impl.rb:173 +#: ../lib/puppet/pal/pal_impl.rb:76 ../lib/puppet/pal/pal_impl.rb:174 msgid "manifest_file or code_string cannot be given when configured_by_env is true" msgstr "" -#: ../lib/puppet/pal/pal_impl.rb:221 +#: ../lib/puppet/pal/pal_impl.rb:222 msgid "temporary environment name" msgstr "" #. TRANSLATORS: do not translate variable name string in these assertions -#: ../lib/puppet/pal/pal_impl.rb:226 +#: ../lib/puppet/pal/pal_impl.rb:227 msgid "A block must be given to 'in_tmp_environment'" msgstr "" #. TRANSLATORS terms in the assertions below are names of terms in code -#: ../lib/puppet/pal/pal_impl.rb:280 +#: ../lib/puppet/pal/pal_impl.rb:282 msgid "A block must be given to 'in_environment'" msgstr "" #. TRANSLATORS 'in_environment' is a name, do not translate -#: ../lib/puppet/pal/pal_impl.rb:285 +#: ../lib/puppet/pal/pal_impl.rb:287 msgid "The environment directory '%{env_dir}' does not exist" msgstr "" -#: ../lib/puppet/pal/pal_impl.rb:308 +#: ../lib/puppet/pal/pal_impl.rb:310 msgid "No directory found for the environment '%{env_name}' on the path '%{envpath}'" msgstr "" -#: ../lib/puppet/pal/pal_impl.rb:362 +#: ../lib/puppet/pal/pal_impl.rb:364 msgid "Given variables must be a hash, got %{type}" msgstr "" -#: ../lib/puppet/pal/pal_impl.rb:368 +#: ../lib/puppet/pal/pal_impl.rb:370 msgid "Given variable '%{varname}' has illegal name" msgstr "" -#: ../lib/puppet/pal/pal_impl.rb:372 +#: ../lib/puppet/pal/pal_impl.rb:374 msgid "Given value for '%{varname}' has illegal type - got: %{type}" msgstr "" -#: ../lib/puppet/pal/pal_impl.rb:509 +#: ../lib/puppet/pal/pal_impl.rb:511 msgid "Puppet Pal: %{what}" msgstr "" -#: ../lib/puppet/pal/pal_impl.rb:523 +#: ../lib/puppet/pal/pal_impl.rb:525 msgid "Cannot use '%{a_term}' and '%{b_term}' at the same time" msgstr "" -#: ../lib/puppet/pal/pal_impl.rb:530 +#: ../lib/puppet/pal/pal_impl.rb:532 msgid "A block must be given" msgstr "" @@ -4503,23 +4503,23 @@ msgstr "" msgid "multi var assignment from class" msgstr "" -#: ../lib/puppet/pops/evaluator/evaluator_impl.rb:742 +#: ../lib/puppet/pops/evaluator/evaluator_impl.rb:761 msgid "break() from context where this is illegal" msgstr "" -#: ../lib/puppet/pops/evaluator/evaluator_impl.rb:1217 +#: ../lib/puppet/pops/evaluator/evaluator_impl.rb:1236 msgid "Can only append Array or Hash to a Hash" msgstr "" -#: ../lib/puppet/pops/evaluator/evaluator_impl.rb:1221 +#: ../lib/puppet/pops/evaluator/evaluator_impl.rb:1240 msgid "An URI can only be merged with an URI or String" msgstr "" -#: ../lib/puppet/pops/evaluator/evaluator_impl.rb:1224 +#: ../lib/puppet/pops/evaluator/evaluator_impl.rb:1243 msgid "Can only append Binary to a Binary" msgstr "" -#: ../lib/puppet/pops/evaluator/evaluator_impl.rb:1257 +#: ../lib/puppet/pops/evaluator/evaluator_impl.rb:1276 msgid "Can only delete from an Array or Hash." msgstr "" @@ -7051,61 +7051,61 @@ msgstr "" msgid "Attempting to initialize global default settings more than once!" msgstr "" -#: ../lib/puppet/settings.rb:501 +#: ../lib/puppet/settings.rb:514 msgid "Using --configprint is deprecated. Use 'puppet config ' instead." msgstr "" -#: ../lib/puppet/settings.rb:643 +#: ../lib/puppet/settings.rb:656 msgid "Could not load %{file}: %{detail}" msgstr "" -#: ../lib/puppet/settings.rb:749 +#: ../lib/puppet/settings.rb:762 msgid "Invalid setting type '%{type}'" msgstr "" -#: ../lib/puppet/settings.rb:904 +#: ../lib/puppet/settings.rb:917 msgid "Unknown searchpath case: %{source_type} for the %{source} settings path element." msgstr "" -#: ../lib/puppet/settings.rb:967 +#: ../lib/puppet/settings.rb:990 msgid "setting definition for '%{name}' is not a hash!" msgstr "" -#: ../lib/puppet/settings.rb:972 +#: ../lib/puppet/settings.rb:995 msgid "Setting %{name} is already defined" msgstr "" -#: ../lib/puppet/settings.rb:978 +#: ../lib/puppet/settings.rb:1001 msgid "Setting %{name} is already using short name '%{short}'" msgstr "" -#: ../lib/puppet/settings.rb:1249 +#: ../lib/puppet/settings.rb:1272 msgid "Setting %{name} is deprecated." msgstr "" #. TRANSLATORS 'puppet.conf' is a file name and should not be translated -#: ../lib/puppet/settings.rb:1254 +#: ../lib/puppet/settings.rb:1277 msgid "Setting %{name} is deprecated in puppet.conf." msgstr "" -#: ../lib/puppet/settings.rb:1425 +#: ../lib/puppet/settings.rb:1448 msgid "Error converting value for param '%{name}': %{detail}" msgstr "" -#: ../lib/puppet/settings.rb:1449 +#: ../lib/puppet/settings.rb:1472 msgid "Could not find value for %{expression}" msgstr "" #. TRANSLATORS '$environment' is a Puppet specific variable and should not be translated -#: ../lib/puppet/settings.rb:1459 +#: ../lib/puppet/settings.rb:1482 msgid "You cannot interpolate $environment within '%{setting_name}' when using directory environments." msgstr "" -#: ../lib/puppet/settings.rb:1460 +#: ../lib/puppet/settings.rb:1483 msgid "Its value will remain %{value}." msgstr "" -#: ../lib/puppet/settings.rb:1491 +#: ../lib/puppet/settings.rb:1514 msgid "Attempt to assign a value to unknown setting %{name}" msgstr "" @@ -7251,7 +7251,7 @@ msgstr "" msgid "%{name} has not declared what class it wraps" msgstr "" -#: ../lib/puppet/ssl/base.rb:31 ../lib/puppet/x509/cert_provider.rb:342 +#: ../lib/puppet/ssl/base.rb:31 ../lib/puppet/x509/cert_provider.rb:370 msgid "Certname %{name} must not contain unprintable or non-ASCII characters" msgstr "" @@ -7351,107 +7351,107 @@ msgstr "" msgid "Server hostname '%{host}' did not match server certificate; %{expected_certnames}" msgstr "" -#: ../lib/puppet/ssl/oids.rb:110 +#: ../lib/puppet/ssl/oids.rb:112 msgid "Error loading ssl custom OIDs mapping file from '%{custom_oid_file}': %{err}" msgstr "" -#: ../lib/puppet/ssl/oids.rb:114 +#: ../lib/puppet/ssl/oids.rb:116 msgid "Error loading ssl custom OIDs mapping file from '%{custom_oid_file}': no such index '%{map_key}'" msgstr "" -#: ../lib/puppet/ssl/oids.rb:118 +#: ../lib/puppet/ssl/oids.rb:120 msgid "Error loading ssl custom OIDs mapping file from '%{custom_oid_file}': data under index '%{map_key}' must be a Hash" msgstr "" -#: ../lib/puppet/ssl/oids.rb:125 +#: ../lib/puppet/ssl/oids.rb:127 msgid "Error loading ssl custom OIDs mapping file from '%{custom_oid_file}': incomplete definition of oid '%{oid}'" msgstr "" -#: ../lib/puppet/ssl/oids.rb:157 +#: ../lib/puppet/ssl/oids.rb:159 msgid "Error registering ssl custom OIDs mapping from file '%{custom_oid_file}': %{err}" msgstr "" -#: ../lib/puppet/ssl/ssl_provider.rb:66 +#: ../lib/puppet/ssl/ssl_provider.rb:83 msgid "Failed to add '%{path}' as a trusted CA file: %{detail}" msgstr "" -#: ../lib/puppet/ssl/ssl_provider.rb:70 +#: ../lib/puppet/ssl/ssl_provider.rb:87 msgid "The 'ssl_trust_store' setting does not refer to a file and will be ignored: '%{path}'" msgstr "" -#: ../lib/puppet/ssl/ssl_provider.rb:104 +#: ../lib/puppet/ssl/ssl_provider.rb:121 msgid "CA certs are missing" msgstr "" -#: ../lib/puppet/ssl/ssl_provider.rb:105 +#: ../lib/puppet/ssl/ssl_provider.rb:122 msgid "CRLs are missing" msgstr "" -#: ../lib/puppet/ssl/ssl_provider.rb:106 +#: ../lib/puppet/ssl/ssl_provider.rb:123 msgid "Private key is missing" msgstr "" -#: ../lib/puppet/ssl/ssl_provider.rb:107 +#: ../lib/puppet/ssl/ssl_provider.rb:124 msgid "Client cert is missing" msgstr "" -#: ../lib/puppet/ssl/ssl_provider.rb:113 +#: ../lib/puppet/ssl/ssl_provider.rb:130 msgid "Unsupported key '%{type}'" msgstr "" -#: ../lib/puppet/ssl/ssl_provider.rb:117 +#: ../lib/puppet/ssl/ssl_provider.rb:134 msgid "The certificate for '%{name}' does not match its private key" msgstr "" -#: ../lib/puppet/ssl/ssl_provider.rb:156 +#: ../lib/puppet/ssl/ssl_provider.rb:173 msgid "Failed to load private key for host '%{name}': %{message}" msgstr "" -#: ../lib/puppet/ssl/ssl_provider.rb:170 +#: ../lib/puppet/ssl/ssl_provider.rb:187 msgid "The CSR for host '%{name}' does not match the public key" msgstr "" -#: ../lib/puppet/ssl/ssl_provider.rb:234 +#: ../lib/puppet/ssl/ssl_provider.rb:251 msgid "The issuer '%{issuer}' of certificate '%{subject}' cannot be found locally" msgstr "" -#: ../lib/puppet/ssl/ssl_provider.rb:250 +#: ../lib/puppet/ssl/ssl_provider.rb:267 msgid "The certificate '%{subject}' is not yet valid, verify time is synchronized" msgstr "" -#: ../lib/puppet/ssl/ssl_provider.rb:252 +#: ../lib/puppet/ssl/ssl_provider.rb:269 msgid "The certificate '%{subject}' has expired, verify time is synchronized" msgstr "" -#: ../lib/puppet/ssl/ssl_provider.rb:254 +#: ../lib/puppet/ssl/ssl_provider.rb:271 msgid "The CRL issued by '%{issuer}' is not yet valid, verify time is synchronized" msgstr "" -#: ../lib/puppet/ssl/ssl_provider.rb:256 +#: ../lib/puppet/ssl/ssl_provider.rb:273 msgid "The CRL issued by '%{issuer}' has expired, verify time is synchronized" msgstr "" -#: ../lib/puppet/ssl/ssl_provider.rb:258 +#: ../lib/puppet/ssl/ssl_provider.rb:275 msgid "Invalid signature for certificate '%{subject}'" msgstr "" -#: ../lib/puppet/ssl/ssl_provider.rb:260 +#: ../lib/puppet/ssl/ssl_provider.rb:277 msgid "Invalid signature for CRL issued by '%{issuer}'" msgstr "" -#: ../lib/puppet/ssl/ssl_provider.rb:262 +#: ../lib/puppet/ssl/ssl_provider.rb:279 msgid "The issuer '%{issuer}' of certificate '%{subject}' is missing" msgstr "" -#: ../lib/puppet/ssl/ssl_provider.rb:265 +#: ../lib/puppet/ssl/ssl_provider.rb:282 msgid "The CRL issued by '%{issuer}' is missing" msgstr "" -#: ../lib/puppet/ssl/ssl_provider.rb:267 +#: ../lib/puppet/ssl/ssl_provider.rb:284 msgid "Certificate '%{subject}' is revoked" msgstr "" -#: ../lib/puppet/ssl/ssl_provider.rb:271 +#: ../lib/puppet/ssl/ssl_provider.rb:288 msgid "Certificate '%{subject}' failed verification (%{err}): %{err_utf8}" msgstr "" @@ -7551,16 +7551,16 @@ msgstr "" msgid "Another puppet instance is already running; waiting for it to finish" msgstr "" -#: ../lib/puppet/ssl/state_machine.rb:427 +#: ../lib/puppet/ssl/state_machine.rb:429 msgid "Verified client certificate '%{subject}' fingerprint %{digest}" msgstr "" -#: ../lib/puppet/ssl/state_machine.rb:429 +#: ../lib/puppet/ssl/state_machine.rb:431 msgid "Verified CA certificate '%{subject}' fingerprint %{digest}" msgstr "" #. TRANSLATORS: `error` is an untranslated message from openssl describing why a certificate in the server's chain is invalid, and `subject` is the identity/name of the failed certificate -#: ../lib/puppet/ssl/verifier.rb:128 +#: ../lib/puppet/ssl/verifier.rb:130 msgid "certificate verify failed [%{error} for %{subject}]" msgstr "" @@ -9569,72 +9569,72 @@ msgstr "" msgid "Failed to unload user profile %{user}" msgstr "" -#: ../lib/puppet/x509/cert_provider.rb:39 +#: ../lib/puppet/x509/cert_provider.rb:45 msgid "Failed to save CA certificates to '%{capath}'" msgstr "" -#: ../lib/puppet/x509/cert_provider.rb:52 +#: ../lib/puppet/x509/cert_provider.rb:59 msgid "The CA certificates are missing from '%{path}'" msgstr "" -#: ../lib/puppet/x509/cert_provider.rb:56 +#: ../lib/puppet/x509/cert_provider.rb:63 msgid "Failed to load CA certificates from '%{capath}'" msgstr "" #. TRANSLATORS 'PEM' is an acronym and shouldn't be translated -#: ../lib/puppet/x509/cert_provider.rb:67 +#: ../lib/puppet/x509/cert_provider.rb:75 msgid "Failed to parse CA certificates as PEM" msgstr "" -#: ../lib/puppet/x509/cert_provider.rb:82 +#: ../lib/puppet/x509/cert_provider.rb:91 msgid "Failed to save CRLs to '%{crlpath}'" msgstr "" -#: ../lib/puppet/x509/cert_provider.rb:95 +#: ../lib/puppet/x509/cert_provider.rb:105 msgid "The CRL is missing from '%{path}'" msgstr "" -#: ../lib/puppet/x509/cert_provider.rb:99 +#: ../lib/puppet/x509/cert_provider.rb:109 msgid "Failed to load CRLs from '%{crlpath}'" msgstr "" #. TRANSLATORS 'PEM' is an acronym and shouldn't be translated -#: ../lib/puppet/x509/cert_provider.rb:110 +#: ../lib/puppet/x509/cert_provider.rb:121 msgid "Failed to parse CRLs as PEM" msgstr "" -#: ../lib/puppet/x509/cert_provider.rb:156 +#: ../lib/puppet/x509/cert_provider.rb:171 msgid "Failed to save private key for '%{name}'" msgstr "" -#: ../lib/puppet/x509/cert_provider.rb:175 +#: ../lib/puppet/x509/cert_provider.rb:191 msgid "The private key is missing from '%{path}'" msgstr "" -#: ../lib/puppet/x509/cert_provider.rb:179 +#: ../lib/puppet/x509/cert_provider.rb:195 msgid "Failed to load private key for '%{name}'" msgstr "" -#: ../lib/puppet/x509/cert_provider.rb:235 +#: ../lib/puppet/x509/cert_provider.rb:255 msgid "Failed to save client certificate for '%{name}'" msgstr "" -#: ../lib/puppet/x509/cert_provider.rb:250 +#: ../lib/puppet/x509/cert_provider.rb:271 msgid "The client certificate is missing from '%{path}'" msgstr "" -#: ../lib/puppet/x509/cert_provider.rb:254 +#: ../lib/puppet/x509/cert_provider.rb:275 msgid "Failed to load client certificate for '%{name}'" msgstr "" -#: ../lib/puppet/x509/cert_provider.rb:300 +#: ../lib/puppet/x509/cert_provider.rb:324 msgid "Failed to save certificate request for '%{name}'" msgstr "" -#: ../lib/puppet/x509/cert_provider.rb:315 +#: ../lib/puppet/x509/cert_provider.rb:340 msgid "Failed to load certificate request for '%{name}'" msgstr "" -#: ../lib/puppet/x509/cert_provider.rb:326 +#: ../lib/puppet/x509/cert_provider.rb:353 msgid "Failed to delete certificate request for '%{name}'" msgstr "" From de3c3a8d746bb2e2449110977a3adb58b7f7fa2a Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Mon, 26 Oct 2020 09:07:36 +0000 Subject: [PATCH 228/731] (packaging) Updating manpage file for main --- man/man8/puppet-facts.8 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/man/man8/puppet-facts.8 b/man/man8/puppet-facts.8 index 9d2fed1fd30..e3f21f6ef3c 100644 --- a/man/man8/puppet-facts.8 +++ b/man/man8/puppet-facts.8 @@ -51,7 +51,7 @@ The terminus for an action is often determined by context, but occasionally need \fBSYNOPSIS\fR . .IP -puppet facts [\-\-terminus _TERMINUS] [\-\-extra HASH] [\fInode_certname\fR] +puppet facts find [\-\-terminus _TERMINUS] [\-\-extra HASH] [\fInode_certname\fR] . .IP \fBDESCRIPTION\fR @@ -101,17 +101,17 @@ puppet facts save [\-\-terminus _TERMINUS] [\-\-extra HASH] \fIkey\fR API only: create or overwrite an object\. As the Faces framework does not currently accept data from STDIN, save actions cannot currently be invoked from the command line\. . .TP -\fBshow\fR \- Facter plugin sync +\fBshow\fR \- Retrieve current node\'s facts\. \fBSYNOPSIS\fR . .IP -puppet facts show [\-\-terminus _TERMINUS] [\-\-extra HASH] [\-\-config\-file \fIpath\fR] [\-\-custom\-dir \fIpath\fR] [\-\-external\-dir \fIpath\fR] [\-\-no\-block] [\-\-no\-cache] [\-\-show\-legacy] [\fIfacts\fR] +puppet facts [\-\-terminus _TERMINUS] [\-\-extra HASH] [\-\-config\-file \fIpath\fR] [\-\-custom\-dir \fIpath\fR] [\-\-external\-dir \fIpath\fR] [\-\-no\-block] [\-\-no\-cache] [\-\-show\-legacy] [\fIfacts\fR] . .IP \fBDESCRIPTION\fR . .IP -Reads facts from the local system using facter gem\. +Reads facts from the local system using \fBfacter\fR terminus\. A query can be provided to retrieve just a specific fact or a set of facts\. . .IP \fBOPTIONS\fR \fI\-\-config\-file \- The location of the config file for Facter\. @@ -135,7 +135,7 @@ Reads facts from the local system using facter gem\. \fBRETURNS\fR . .IP -The output of facter with added puppet specific facts +The output of facter with added puppet specific facts\. . .IP \fBNOTES\fR From 2dd43150b3596b872e82141a6b1be515dd805809 Mon Sep 17 00:00:00 2001 From: Enis Inan Date: Mon, 23 Jul 2018 13:55:37 -0700 Subject: [PATCH 229/731] (PUP-9051) Fix SMF provider to properly implement enableable semantics Previously, the SMF provider had the same semantics for enable as it did for ensure. Specifically, #enable and #disable delegated to #start and #stop. This is completely inconsistent with the enableable semantics for service providers, semantics which other Unix-based service providers like systemd implement. For example, if you had a SMF-based service resource with enable => true and ensure => false, the net effect of the operation would be a disabled service that would remain disabled when rebooted, which is incorrect and inconsistent. The correct and consistent effect should be a disabled service that would start up when rebooted. Essentially, enableable semantics requires that enable and ensure be independent operations where enable handles whether the service starts or stops at boot time, while ensure handles whether the service starts or stops in the current running instance. The previous SMF provider was conflating the two properties together so that enable and ensure were no longer independent operations. This commit fixes that. It rewrites core parts of the SMF provider to now conform to enableable semantics and also fixes some possible issues with it. The key takeaways here are: * Service commands now use the service FMRI instead of the resource name. This is the unique resource identifier for the particular instance. Previously, we'd pass in the resource name instead which would match a pattern corresponding to multiple service instances. We only want to manage one service instance in a single service resource. The code now fails if more than one FMRI exists for a given service resource name. * We now sync. the enable and ensure properties of the service resource in a single transaction, specifically inside the #flush method. This is due to the dependency between the ensure and enable properties caused by how SMF works under the hood. Acceptance tests for this new behavior have been added. The existing nonexistent service tests on the AIX service provider have been refactored to a common helper function that both the SMF and AIX provider tests can call on. This helper function should provide a clean interface for nonexistent service tests that may be used for other service providers in the future. --- .../lib/puppet/acceptance/solaris_util.rb | 12 +- .../resource/service/AIX_service_provider.rb | 7 +- .../tests/resource/service/smf_basic_tests.rb | 84 ++- lib/puppet/provider/service/smf.rb | 264 +++++--- .../smf/{svcs.out => svcs_instances.out} | 0 spec/unit/provider/service/smf_spec.rb | 566 +++++++++++++----- 6 files changed, 666 insertions(+), 267 deletions(-) rename spec/fixtures/unit/provider/service/smf/{svcs.out => svcs_instances.out} (100%) diff --git a/acceptance/lib/puppet/acceptance/solaris_util.rb b/acceptance/lib/puppet/acceptance/solaris_util.rb index a62bf5de583..8d4fc64c761 100644 --- a/acceptance/lib/puppet/acceptance/solaris_util.rb +++ b/acceptance/lib/puppet/acceptance/solaris_util.rb @@ -57,8 +57,15 @@ def set_publisher(agent, o={}) module SMFUtils def clean(agent, o={}) o = {:service => 'tstapp'}.merge(o) - on agent, "svcadm disable %s ||:" % o[:service] - on agent, "svccfg delete %s ||:" % o[:service] + on(agent, "svcs -l %s" % o[:service], acceptable_exit_codes: [0, 1]) do |result| + next if result.stdout =~ /doesn't match/ + lines = result.stdout.chomp.lines + instances = lines.select { |line| line =~ /^fmri/ }.map { |line| line.split(' ')[1].chomp } + instances.each do |instance| + on agent, "svcadm disable %s ||:" % instance + on agent, "svccfg delete %s ||:" % instance + end + end on agent, "rm -rf /var/svc/manifest/application/%s.xml ||:" % o[:service] on agent, "rm -f /opt/bin/%s ||:" % o[:service] end @@ -103,7 +110,6 @@ def setup_methodscript(agent, o={}) - diff --git a/acceptance/tests/resource/service/AIX_service_provider.rb b/acceptance/tests/resource/service/AIX_service_provider.rb index ebf041577dd..049fe82e83a 100644 --- a/acceptance/tests/resource/service/AIX_service_provider.rb +++ b/acceptance/tests/resource/service/AIX_service_provider.rb @@ -60,7 +60,12 @@ def lssrc_assert_status(host, service, expected_status) agents.each do |agent| - run_nonexistent_service_tests('nonexistent_service') + ## Setup + run_nonexistent_service_tests( + 'sloth_daemon', + /The sloth_daemon Subsystem is not on file/, + { 'starting' => 'ensure => running' } + ) step "Setup on #{agent}" sloth_daemon_path = agent.tmpfile("sloth_daemon.sh") diff --git a/acceptance/tests/resource/service/smf_basic_tests.rb b/acceptance/tests/resource/service/smf_basic_tests.rb index b289b5f7e2a..88f7445383a 100644 --- a/acceptance/tests/resource/service/smf_basic_tests.rb +++ b/acceptance/tests/resource/service/smf_basic_tests.rb @@ -12,59 +12,93 @@ require 'puppet/acceptance/service_utils' extend Puppet::Acceptance::ServiceUtils - teardown do - step "SMF: cleanup" do - agents.each do |agent| - clean agent, :service => 'tstapp' + def assert_svcs_info_matches_on(agent, service, info_hash) + info_hash.merge({ 'next_state' => 'none' }) + on(agent, "svcs -l #{service}") do |result| + info_hash.each do |key, value| + escaped_key, escaped_value = Regexp.escape(key), Regexp.escape(value) + + assert_match( + /^#{escaped_key}.*#{escaped_value}$/, + result.stdout, + "`svcs -l #{service}` does not indicate that #{key} = #{value} on #{agent}" + ) end end end + teardown do + agents.each do |agent| + clean agent, :service => 'tstapp' + end + end + agents.each do |agent| clean agent, :service => 'tstapp' + # Run the tests for a non-existent service first run_nonexistent_service_tests('tstapp') manifest, _ = setup agent, :service => 'tstapp' - step "SMF: ensure it is created with a manifest" do - apply_manifest_on(agent, 'service {tstapp : ensure=>running, manifest=>"%s"}' % manifest) do - assert_match( /ensure changed 'stopped'.* to 'running'/, result.stdout, "err: #{agent}") + step "Ensure that the service is created with a manifest" do + apply_manifest_on(agent, 'service {tstapp : enable=>true, manifest=>"%s", ensure=>"running"}' % manifest) do |result| + assert_match( /ensure changed 'stopped' to 'running'/, result.stdout, "Failed to create, enable and start the service on #{agent}") end end - step "SMF: verify with svcs that the service is online" do - on agent, "svcs -l application/tstapp" do - assert_match( /state\s+online/, result.stdout, "err: #{agent}") + step "Ensure that the SMF provider is idempotent -- it does not create services again" do + apply_manifest_on(agent, 'service {tstapp : enable=>true, manifest=>"%s"}' % manifest, :catch_changes => true) + end + + step "Ensure you can query the service with the ral" do + on(agent, puppet("resource service tstapp")) do |result| + { ensure: 'running', enable: true, provider: 'smf' }.each do |property, value| + assert_match(/#{property}.*#{value}.*$/, result.stdout, "Puppet does not report #{property}=#{value} for tstapp service") + end end end - step "SMF: ensure it is idempotent - ie not created again" do - apply_manifest_on(agent, 'service {tstapp : ensure=>running, manifest=>"%s"}' % manifest, :catch_changes => true) + step "Verify that ensure can be syncd. without changing the service's enabled? status" do + on(agent, puppet("resource service tstapp ensure=stopped")) + assert_svcs_info_matches_on(agent, 'application/tstapp', { 'enabled' => 'false (temporary)', 'state' => 'disabled' }) end - step "SMF: ensure you can query the service with the ral" do - on(agent, puppet("resource service tstapp")) do - assert_match( /ensure.+=> 'running'/, result.stdout, "err: #{agent}") - end + step "Ensure that when syncing only enable, the service's current status is preserved" do + # Mark the service as maint using svcadm + on(agent, 'svcadm mark -I maintenance tstapp') + on(agent, puppet("resource service tstapp enable=false")) + assert_svcs_info_matches_on(agent, 'application/tstapp', { 'enabled' => 'false', 'state' => 'maintenance' }) end - step "SMF: ensure you can stop the service" do - apply_manifest_on(agent, 'service {tstapp : ensure=>stopped}') do - assert_match( /changed 'running'.* to 'stopped'/, result.stdout, "err: #{agent}") - end + step "enable == true and ensure == stopped stop the service, but enable it to start again upon reboot" do + on(agent, puppet("resource service tstapp enable=true ensure=stopped")) + assert_svcs_info_matches_on(agent, 'application/tstapp', { 'enabled' => 'false (temporary)', 'state' => 'disabled' }) + end + + step "enable == false and ensure == running start the service, but disable it upon reboot" do + on(agent, puppet("resource service tstapp enable=false ensure=running")) + assert_svcs_info_matches_on(agent, 'application/tstapp', { 'enabled' => 'true (temporary)', 'state' => 'online' }) + end + + step "Verify that puppet will noop on the service if enable + ensure are already synced" do + apply_manifest_on(agent, 'service {tstapp : enable=>false, ensure=>"running"}' % manifest, :catch_changes => true) + assert_svcs_info_matches_on(agent, 'application/tstapp', { 'enabled' => 'true (temporary)', 'state' => 'online' }) end - step "SMF: verify with svcs that the service is not online" do - on agent, "svcs -l application/tstapp", :acceptable_exit_codes => [0,1] do - assert_no_match( /state\s+online/, result.stdout, "err: #{agent}") + step "Ensure that pupppet fails when multiple instances of the service resource exist" do + # Add a second service instance. + on(agent, 'svccfg -s application/tstapp add second') + apply_manifest_on(agent, 'service {tstapp : enable=>true}') do |result| + assert_match(/Error:.*'tstapp' matches multiple FMRIs/, result.stderr, "Puppet fails to output an error message when multiple FMRIs of a given service exist") end + on(agent, 'svccfg delete svc:/application/tstapp:second') end if agent['platform'] =~ /11/ step "SMF: unset the general/complete property to mark the service as an incomplete service" do fmri = on(agent, "svcs -H -o fmri tstapp").stdout.chomp - on(agent, "svccfg -s #{fmri} delprop general/complete") + on(agent, "svccfg -s #{fmri} delprop general/complete") end step "Verify that an incomplete service is considered stopped and disabled" do @@ -74,7 +108,7 @@ end end end - + step "Verify that stopping and disabling an incomplete service is a no-op" do manifest = service_manifest('tstapp', ensure: :stopped, enable: false) apply_manifest_on(agent, manifest, catch_changes: true) diff --git a/lib/puppet/provider/service/smf.rb b/lib/puppet/provider/service/smf.rb index 3fed31a731f..50244c91305 100644 --- a/lib/puppet/provider/service/smf.rb +++ b/lib/puppet/provider/service/smf.rb @@ -5,48 +5,100 @@ desc <<-EOT Support for Sun's new Service Management Framework. - Starting a service is effectively equivalent to enabling it, so there is - only support for starting and stopping services, which also enables and - disables them, respectively. + When managing the enable property, this provider will try to preserve + the previous ensure state per the enableable semantics. On Solaris, + enabling a service starts it up while disabling a service stops it. Thus, + there's a chance for this provider to execute two operations when managing + the enable property. For example, if enable is set to true and the ensure + state is stopped, this provider will manage the service using two operations: + one to enable the service which will start it up, and another to stop the + service (without affecting its enabled status). By specifying `manifest => "/path/to/service.xml"`, the SMF manifest will be imported if it does not exist. - EOT defaultfor :osfamily => :solaris confine :osfamily => :solaris - commands :adm => "/usr/sbin/svcadm", :svcs => "/usr/bin/svcs" - commands :svccfg => "/usr/sbin/svccfg" + commands :adm => "/usr/sbin/svcadm", + :svcs => "/usr/bin/svcs", + :svccfg => "/usr/sbin/svccfg" has_feature :refreshable - def setupservice - if resource[:manifest] - begin - svcs("-l", @resource[:name]) - rescue Puppet::ExecutionFailure - Puppet.notice "Importing #{@resource[:manifest]} for #{@resource[:name]}" - svccfg :import, resource[:manifest] - end - end + def self.instances + service_instances = svcs("-H", "-o", "state,fmri" ).split("\n") + + # Puppet does not manage services in the legacy_run state, so filter those out. + service_instances.reject! { |line| line =~ /^legacy_run/ } + + service_instances.collect! do |line| + state, fmri = line.split(/\s+/) + + status = case state + when /online/; :running + when /maintenance/; :maintenance + when /degraded/; :degraded + else :stopped + end + new({:name => fmri, :ensure => status}) + end + + service_instances + end + + def initialize(*args) + super(*args) + + # This hash contains the properties we need to sync. in our flush method. + # + # TODO (PUP-9051): Should we use @property_hash here? It seems like + # @property_hash should be empty by default and is something we can + # control so I think so? + @properties_to_sync = {} + end + + def service_exists? + self.service_fmri + true + rescue Puppet::ExecutionFailure + false + end + + def setup_service + return unless @resource[:manifest] + return if self.service_exists? + + Puppet.notice("Importing #{@resource[:manifest]} for #{@resource[:name]}") + svccfg(:import, @resource[:manifest]) rescue Puppet::ExecutionFailure => detail - raise Puppet::Error.new( "Cannot config #{self.name} to enable it: #{detail}", detail ) + raise Puppet::Error.new( "Cannot config #{@resource[:name]} to enable it: #{detail}", detail ) end - def self.instances - svcs("-H", "-o", "state,fmri" ).split("\n").select{|l| l !~ /^legacy_run/ }.collect do |line| - state,fmri = line.split(/\s+/) - status = case state - when /online/; :running - when /maintenance/; :maintenance - when /degraded/; :degraded - else :stopped - end - new({:name => fmri, :ensure => status}) - end + # Returns the service's FMRI. We fail if multiple FMRIs correspond to + # @resource[:name]. + # + # If the service does not exist or we fail to get any FMRIs from svcs, + # this method will raise a Puppet::ExecutionFailure + def service_fmri + return @fmri if @fmri + + # `svcs -l` is better to use because we can detect service instances + # that have not yet been activated or enabled (i.e. it lets us detect + # services that svcadm has not yet touched). `svcs -H -o fmri` is a bit + # more limited. + lines = svcs("-l", @resource[:name]).chomp.lines.to_a + lines.select! { |line| line =~ /^fmri/ } + fmris = lines.map! { |line| line.split(' ')[-1].chomp } + unless fmris.length == 1 + raise Puppet::Error.new( + "Failed to get #{@resource[:name]}'s FMRI: The pattern '#{@resource[:name]}' matches multiple FMRIs! These are the FMRIs it matches: #{fmris.join(', ')}" + ) + end + + @fmri = fmris.first end # Returns the service's FMRI. We fail if multiple FMRIs correspond to @@ -96,51 +148,50 @@ def complete_service? end def enable - self.start + @properties_to_sync[:enable] = true end def enabled? - case self.status - when :running - return :true - else - return :false - end + return :false unless service_exists? + _property, _type, value = svccfg("-s", self.service_fmri, "listprop", "general/enabled").split(' ') + value == 'true' ? :true : :false end def disable - self.stop + @properties_to_sync[:enable] = false end def restartcmd if Puppet::Util::Package.versioncmp(Facter.value(:operatingsystemrelease), '11.2') >= 0 - [command(:adm), :restart, "-s", @resource[:name]] + [command(:adm), :restart, "-s", self.service_fmri] else # Synchronous restart only supported in Solaris 11.2 and above - [command(:adm), :restart, @resource[:name]] + [command(:adm), :restart, self.service_fmri] end end - def startcmd - self.setupservice - case self.status - when :maintenance, :degraded - [command(:adm), :clear, @resource[:name]] - else - [command(:adm), :enable, "-rs", @resource[:name]] - end + def service_states + # Gets the current and next state of the service. We have a next state because SMF + # manages services asynchronously. If there is no 'next' state, svcs will put a '-' + # to indicate as such. + current_state, next_state = svcs("-H", "-o", "state,nstate", self.service_fmri).chomp.split(' ') + + { + :current => current_state, + :next => next_state == "-" ? nil : next_state + } end # Wait for the service to transition into the specified state before returning. # This is necessary due to the asynchronous nature of SMF services. - # desired_state should be online, offline, disabled, or uninitialized. + # desired_states should include only online, offline, disabled, or uninitialized. # See PUP-5474 for long-term solution to this issue. - def wait(*desired_state) + def wait(*desired_states) Timeout.timeout(60) do loop do states = self.service_states - break if desired_state.include?(states[0]) && states[1] == '-' - sleep(1) + break if desired_states.include?(states[:current]) && states[:next].nil? + Kernel.sleep(1) end end rescue Timeout::Error @@ -148,15 +199,11 @@ def wait(*desired_state) end def start - # Wait for the service to actually start before returning. - super - self.wait('online') + @properties_to_sync[:ensure] = :running end def stop - # Wait for the service to actually stop before returning. - super - self.wait('offline', 'disabled', 'uninitialized') + @properties_to_sync[:ensure] = :stopped end def restart @@ -165,16 +212,8 @@ def restart self.wait('online') end - # Determine the current and next states of a service. - def service_states - svcs("-H", "-o", "state,nstate", @resource[:name]).chomp.split - end - def status - if @resource[:status] - super - return - end + return super if @resource[:status] begin if supports_incomplete_services? @@ -185,10 +224,10 @@ def status end end - # get the current state and the next state, and if the next - # state is set (i.e. not "-") use it for state comparison - states = service_states - state = states[1] == "-" ? states[0] : states[1] + # Get the current state and the next state. If there is a next state, + # use that for the state comparison. + states = self.service_states + state = states[:next] || states[:current] rescue Puppet::ExecutionFailure # TODO (PUP-8957): Should this be set back to INFO ? debug "Could not get status on service #{self.name} #{$!}" @@ -197,10 +236,8 @@ def status case state when "online" - #self.warning "matched running #{line.inspect}" return :running when "offline", "disabled", "uninitialized" - #self.warning "matched stopped #{line.inspect}" return :stopped when "maintenance" return :maintenance @@ -213,11 +250,92 @@ def status raise Puppet::Error, "Unmanageable state '#{state}' on service #{self.name}" end + end + # Helper that encapsulates the clear + svcadm [enable|disable] + # logic in one place. Makes it easy to test things out and also + # cleans up flush's code. + def maybe_clear_service_then_svcadm(cur_state, subcmd, flags) + # If the cur_state is maint or degraded, then we need to clear the service + # before we enable or disable it. + adm('clear', self.service_fmri) if [:maintenance, :degraded].include?(cur_state) + adm(subcmd, flags, self.service_fmri) end - def stopcmd - [command(:adm), :disable, "-s", @resource[:name]] + # The flush method is necessary for the SMF provider because syncing the enable and ensure + # properties are not independent operations like they are in most of our other service + # providers. + def flush + # We append the "_" because ensure is a Ruby keyword, and it is good to keep property + # variable names consistent with each other. + enable_, ensure_ = @properties_to_sync[:enable], @properties_to_sync[:ensure] + + # All of the relevant properties are in sync., so we do not need to do + # anything here. + return if enable_.nil? and ensure_.nil? + + # Set-up our service so that we know it will exist and so we can collect its fmri. Also + # simplifies the code. For a nonexistent service, one of enable or ensure will be true + # here (since we're syncing them), so we can fail early if setup_service fails. + setup_service + fmri = self.service_fmri + + # Useful constants for operations involving multiple states + stopped = ['offline', 'disabled', 'uninitialized'] + + # Get the current state of the service. + cur_state = self.status + + if enable_.nil? + # Only ensure needs to be syncd. The -t flag tells svcadm to temporarily + # enable/disable the service, where the temporary status is gone upon + # reboot. This is exactly what we want, because we do not want to touch + # the enable property. + if ensure_ == :stopped + self.maybe_clear_service_then_svcadm(cur_state, 'disable', '-st') + wait(*stopped) + else # ensure == :running + self.maybe_clear_service_then_svcadm(cur_state, 'enable', '-rst') + wait('online') + end + + return + end + + # Here, enable is being syncd. svcadm starts the service if we enable it, or shuts it down if we + # disable it. However, we want our service to be in a final state, which is either whatever the + # new ensured value is, or what our original state was prior to enabling it. + # + # NOTE: Even if you try to set the general/enabled property with svccfg, SMF will still + # try to start or shut down the service. Plus, setting general/enabled with svccfg does not + # enable the service's dependencies, while svcadm handles this correctly. + # + # NOTE: We're treating :running and :degraded the same. The reason is b/c an SMF managed service + # can only enter the :degraded state if it is online. Since disabling the service also shuts it + # off, we cannot set it back to the :degraded state. Thus, it is best to lump :running and :degraded + # into the same category to maintain a consistent postcondition on the service's final state when + # enabling and disabling it. + final_state = ensure_ || cur_state + final_state = :running if final_state == :degraded + + if enable_ + self.maybe_clear_service_then_svcadm(cur_state, 'enable', '-rs') + else + self.maybe_clear_service_then_svcadm(cur_state, 'disable', '-s') + end + + # We're safe with 'whens' here since self.status already errors on any + # unmanageable states. + case final_state + when :running + adm('enable', '-rst', fmri) unless enable_ + wait('online') + when :stopped + adm('disable', '-st', fmri) if enable_ + wait(*stopped) + when :maintenance + adm('mark', '-I', 'maintenance', fmri) + wait('maintenance') + end end end - diff --git a/spec/fixtures/unit/provider/service/smf/svcs.out b/spec/fixtures/unit/provider/service/smf/svcs_instances.out similarity index 100% rename from spec/fixtures/unit/provider/service/smf/svcs.out rename to spec/fixtures/unit/provider/service/smf/svcs_instances.out diff --git a/spec/unit/provider/service/smf_spec.rb b/spec/unit/provider/service/smf_spec.rb index 667f6ae2e7f..00b58c0c9f9 100644 --- a/spec/unit/provider/service/smf_spec.rb +++ b/spec/unit/provider/service/smf_spec.rb @@ -4,6 +4,16 @@ unless: Puppet::Util::Platform.windows? || Puppet::Util::Platform.jruby? do let(:provider_class) { Puppet::Type.type(:service).provider(:smf) } + def set_resource_params(params = {}) + params.each do |param, value| + if value.nil? + @provider.resource.delete(param) if @provider.resource[param] + else + @provider.resource[param] = value + end + end + end + before(:each) do # Create a mock resource @resource = Puppet::Type.type(:service).new( @@ -18,14 +28,13 @@ allow(Facter).to receive(:value).with(:osfamily).and_return('Solaris') allow(Facter).to receive(:value).with(:operatingsystemrelease).and_return('11.2') end - context ".instances" do it "should have an instances method" do expect(provider_class).to respond_to :instances end it "should get a list of services (excluding legacy)" do - expect(provider_class).to receive(:svcs).with('-H', '-o', 'state,fmri').and_return(File.read(my_fixture('svcs.out'))) + expect(provider_class).to receive(:svcs).with('-H', '-o', 'state,fmri').and_return(File.read(my_fixture('svcs_instances.out'))) instances = provider_class.instances.map { |p| {:name => p.get(:name), :ensure => p.get(:ensure)} } # we dont manage legacy expect(instances.size).to eq(3) @@ -35,255 +44,482 @@ end end - it "should have a restart method" do - expect(@provider).to respond_to(:restart) - end + describe '#service_exists?' do + it 'returns true if the service exists' do + expect(@provider).to receive(:service_fmri) + expect(@provider.service_exists?).to be(true) + end - it "should have a restartcmd method" do - expect(@provider).to respond_to(:restartcmd) - end + it 'returns false if the service does not exist' do + expect(@provider).to receive(:service_fmri).and_raise( + Puppet::ExecutionFailure, 'svcs failed!' + ) - it "should have a start method" do - expect(@provider).to respond_to(:start) + expect(@provider.service_exists?).to be(false) + end end - it "should have a stop method" do - expect(@provider).to respond_to(:stop) - end + describe '#setup_service' do + it 'noops if the service resource does not have the manifest parameter passed-in' do + expect(@provider).not_to receive(:svccfg) - it "should have an enabled? method" do - expect(@provider).to respond_to(:enabled?) - end + set_resource_params({ :manifest => nil }) + @provider.setup_service + end - it "should have an enable method" do - expect(@provider).to respond_to(:enable) - end + context 'when the service resource has a manifest parameter passed-in' do + let(:manifest) { 'foo' } + before(:each) { set_resource_params({ :manifest => manifest }) } + + it 'noops if the service resource already exists' do + expect(@provider).not_to receive(:svccfg) + + expect(@provider).to receive(:service_exists?).and_return(true) + @provider.setup_service + end - it "should have a disable method" do - expect(@provider).to respond_to(:disable) + it "imports the service resource's manifest" do + expect(@provider).to receive(:service_exists?).and_return(false) + + expect(@provider).to receive(:svccfg).with(:import, manifest) + @provider.setup_service + end + + it 'raises a Puppet::Error if SMF fails to import the manifest' do + expect(@provider).to receive(:service_exists?).and_return(false) + + failure_reason = 'svccfg failed!' + expect(@provider).to receive(:svccfg).with(:import, manifest).and_raise(Puppet::ExecutionFailure, failure_reason) + expect { @provider.setup_service }.to raise_error do |error| + expect(error).to be_a(Puppet::Error) + expect(error.message).to match(failure_reason) + end + end + end end - describe "when checking status" do - before(:each) do - allow(@provider).to receive(:complete_service?).and_return(true) + describe '#service_fmri' do + it 'returns the memoized the fmri if it exists' do + @provider.instance_variable_set(:@fmri, 'resource_fmri') + expect(@provider.service_fmri).to eql('resource_fmri') end - it "should call the external command 'svcs /system/myservice' once" do - expect(@provider).to receive(:svcs).with('-H', '-o', 'state,nstate', "/system/myservice").and_return("online\t-") - @provider.status + it 'raises a Puppet::Error if the service resource matches multiple FMRIs' do + expect(@provider).to receive(:svcs).with('-l', @provider.resource[:name]).and_return(File.read(my_fixture('svcs_multiple_fmris.out'))) + + expect { @provider.service_fmri }.to raise_error do |error| + expect(error).to be_a(Puppet::Error) + expect(error.message).to match(@provider.resource[:name]) + expect(error.message).to match('multiple') + + matched_fmris = ["svc:/application/tstapp:one", "svc:/application/tstapp:two"] + expect(error.message).to match(matched_fmris.join(', ')) + end end - it "should return stopped if svcs can't find the service" do - allow(@provider).to receive(:svcs).and_raise(Puppet::ExecutionFailure.new("no svc found")) - expect(@provider.status).to eq(:stopped) + it 'raises a Puppet:ExecutionFailure if svcs fails' do + expect(@provider).to receive(:svcs).with('-l', @provider.resource[:name]).and_raise( + Puppet::ExecutionFailure, 'svcs failed!' + ) + + expect { @provider.service_fmri }.to raise_error do |error| + expect(error).to be_a(Puppet::ExecutionFailure) + expect(error.message).to match('svcs failed!') + end end - it "should return stopped for an incomplete service on Solaris 11" do - allow(Facter).to receive(:value).with(:operatingsystemrelease).and_return('11.3') - allow(@provider).to receive(:complete_service?).and_return(false) - expect(@provider.status).to eq(:stopped) + it "returns the service resource's fmri and memoizes it" do + expect(@provider).to receive(:svcs).with('-l', @provider.resource[:name]).and_return(File.read(my_fixture('svcs_fmri.out'))) + + expected_fmri = 'svc:/application/tstapp:default' + + expect(@provider.service_fmri).to eql(expected_fmri) + expect(@provider.instance_variable_get(:@fmri)).to eql(expected_fmri) end + end - it "should return running if online in svcs output" do - allow(@provider).to receive(:svcs).and_return("online\t-") - expect(@provider.status).to eq(:running) + describe '#enabled?' do + let(:fmri) { 'resource_fmri' } + before(:each) do + allow(@provider).to receive(:service_fmri).and_return(fmri) end - it "should return stopped if disabled in svcs output" do - allow(@provider).to receive(:svcs).and_return("disabled\t-") - expect(@provider.status).to eq(:stopped) + it 'returns :true if the service is enabled' do + expect(@provider).to receive(:svccfg).with('-s', fmri, 'listprop', 'general/enabled').and_return( + 'general/enabled boolean true' + ) + + expect(@provider.enabled?).to be(:true) end - it "should return maintenance if in maintenance in svcs output" do - allow(@provider).to receive(:svcs).and_return("maintenance\t-") - expect(@provider.status).to eq(:maintenance) + it 'return :false if the service is not enabled' do + expect(@provider).to receive(:svccfg).with('-s', fmri, 'listprop', 'general/enabled').and_return( + 'general/enabled boolean false' + ) + + expect(@provider.enabled?).to be(:false) end - it "should return degraded if in degraded in svcs output" do - allow(@provider).to receive(:svcs).and_return("degraded\t-") - expect(@provider.status).to eq(:degraded) + it 'returns :false if the service does not exist' do + expect(@provider).to receive(:service_exists?).and_return(false) + expect(@provider.enabled?).to be(:false) end + end - it "should return target state if transitioning in svcs output" do - allow(@provider).to receive(:svcs).and_return("online\tdisabled") - expect(@provider.status).to eq(:stopped) + describe '#restartcmd' do + let(:fmri) { 'resource_fmri' } + before(:each) do + allow(@provider).to receive(:service_fmri).and_return(fmri) end - it "should throw error if it's a legacy service in svcs output" do - allow(@provider).to receive(:svcs).and_return("legacy_run\t-") - expect { @provider.status }.to raise_error(Puppet::Error, "Cannot manage legacy services through SMF") + it 'returns the right command for restarting the service for Solaris versions newer than 11.2' do + expect(Facter).to receive(:value).with(:operatingsystemrelease).and_return('11.3') + + expect(@provider.restartcmd).to eql([@provider.command(:adm), :restart, '-s', fmri]) end - end - context "when starting" do - it "should enable the service if it is not enabled" do - expect(@provider).to receive(:status).and_return(:stopped) - expect(@provider).to receive(:texecute).with(:start, ['/usr/sbin/svcadm', :enable, '-rs', '/system/myservice'], true) - expect(@provider).to receive(:wait).with('online') - @provider.start + it 'returns the right command for restarting the service on Solaris 11.2' do + expect(Facter).to receive(:value).with(:operatingsystemrelease).and_return('11.2') + + expect(@provider.restartcmd).to eql([@provider.command(:adm), :restart, '-s', fmri]) end - it "should always execute external command 'svcadm enable /system/myservice'" do - expect(@provider).to receive(:status).and_return(:running) - expect(@provider).to receive(:texecute).with(:start, ['/usr/sbin/svcadm', :enable, '-rs', '/system/myservice'], true) - expect(@provider).to receive(:wait).with('online') - @provider.start + it 'returns the right command for restarting the service for Solaris versions older than Solaris 11.2' do + expect(Facter).to receive(:value).with(:operatingsystemrelease).and_return('10.3') + + expect(@provider.restartcmd).to eql([@provider.command(:adm), :restart, fmri]) end + end - it "should execute external command 'svcadm clear /system/myservice' if in maintenance" do - allow(@provider).to receive(:status).and_return(:maintenance) - expect(@provider).to receive(:texecute).with(:start, ["/usr/sbin/svcadm", :clear, "/system/myservice"], true) - expect(@provider).to receive(:wait).with('online') - @provider.start + describe '#service_states' do + let(:fmri) { 'resource_fmri' } + before(:each) do + allow(@provider).to receive(:service_fmri).and_return(fmri) end - it "should execute external command 'svcadm clear /system/myservice' if in degraded" do - allow(@provider).to receive(:status).and_return(:degraded) - expect(@provider).to receive(:texecute).with(:start, ["/usr/sbin/svcadm", :clear, "/system/myservice"], true) - expect(@provider).to receive(:wait).with('online') - @provider.start + it 'returns the current and next states of the service' do + expect(@provider).to receive(:svcs).with('-H', '-o', 'state,nstate', fmri).and_return( + 'online disabled' + ) + + expect(@provider.service_states).to eql({ :current => 'online', :next => 'disabled' }) end - it "should error if timeout occurs while starting the service" do - expect(@provider).to receive(:status).and_return(:stopped) - expect(@provider).to receive(:texecute).with(:start, ["/usr/sbin/svcadm", :enable, '-rs', "/system/myservice"], true) - expect(Timeout).to receive(:timeout).with(60).and_raise(Timeout::Error) - expect { @provider.start }.to raise_error Puppet::Error, ('Timed out waiting for /system/myservice to transition states') + it "returns nil for the next state if svcs marks it as '-'" do + expect(@provider).to receive(:svcs).with('-H', '-o', 'state,nstate', fmri).and_return( + 'online -' + ) + + expect(@provider.service_states).to eql({ :current => 'online', :next => nil }) end end - context "when starting a service with a manifest" do + describe '#wait' do + # TODO: Document this method! + def transition_service(from, to, tries) + intermediate_returns = [{ :current => from, :next => to }] * (tries - 1) + final_return = { :current => to, :next => nil } + + allow(@provider).to receive(:service_states).and_return(*intermediate_returns.push(final_return)) + end + before(:each) do - @resource = Puppet::Type.type(:service).new(:name => "/system/myservice", :ensure => :running, :enable => :true, :manifest => "/tmp/myservice.xml") - @provider = provider_class.new(@resource) - allow($CHILD_STATUS).to receive(:exitstatus).and_return(1) + allow(Timeout).to receive(:timeout).and_yield + allow(Kernel).to receive(:sleep) end - it "should import the manifest if service is missing" do - allow(@provider).to receive(:complete_service?).and_return(true) - expect(@provider).to receive(:svcs).with('-l', '/system/myservice').and_raise(Puppet::ExecutionFailure, "Exited 1") - expect(@provider).to receive(:svccfg).with(:import, "/tmp/myservice.xml") - expect(@provider).to receive(:texecute).with(:start, ["/usr/sbin/svcadm", :enable, '-rs', "/system/myservice"], true) - expect(@provider).to receive(:wait).with('online') - expect(@provider).to receive(:svcs).with('-H', '-o', 'state,nstate', "/system/myservice").and_return("online\t-") - @provider.start + it 'waits for the service to enter the desired state' do + transition_service('online', 'disabled', 1) + @provider.wait('offline', 'disabled', 'uninitialized') end - it "should handle failures if importing a manifest" do - expect(@provider).to receive(:svcs).with('-l', '/system/myservice').and_raise(Puppet::ExecutionFailure, "Exited 1") - expect(@provider).to receive(:svccfg).and_raise(Puppet::ExecutionFailure.new("can't svccfg import")) - expect { @provider.start }.to raise_error(Puppet::Error, "Cannot config /system/myservice to enable it: can't svccfg import") + it 'times out and raises a Puppet::Error after sixty seconds' do + expect(Timeout).to receive(:timeout).with(60).and_raise(Timeout::Error, 'method timed out!') + + expect { @provider.wait('online') }.to raise_error do |error| + expect(error).to be_a(Puppet::Error) + expect(error.message).to match(@provider.resource[:name]) + end + end + + it 'sleeps a bit before querying the service state' do + transition_service('disabled', 'online', 10) + expect(Kernel).to receive(:sleep).with(1).exactly(9).times + + @provider.wait('online') end end - context "when stopping" do - it "should execute external command 'svcadm disable /system/myservice'" do - expect(@provider).to receive(:texecute).with(:stop, ["/usr/sbin/svcadm", :disable, '-s', "/system/myservice"], true) - expect(@provider).to receive(:wait).with('offline', 'disabled', 'uninitialized') - @provider.stop + describe '#restart' do + let(:fmri) { 'resource_fmri' } + + before(:each) do + allow(@provider).to receive(:service_fmri).and_return(fmri) + allow(@provider).to receive(:texecute) + allow(@provider).to receive(:wait) + end + + it 'should restart the service' do + expect(@provider).to receive(:texecute) + @provider.restart end - it "should error if timeout occurs while stopping the service" do - expect(@provider).to receive(:texecute).with(:stop, ["/usr/sbin/svcadm", :disable, '-s', "/system/myservice"], true) - expect(Timeout).to receive(:timeout).with(60).and_raise(Timeout::Error) - expect { @provider.stop }.to raise_error Puppet::Error, ('Timed out waiting for /system/myservice to transition states') + it 'should wait for the service to restart' do + expect(@provider).to receive(:wait).with('online') + @provider.restart end end - context "when restarting" do - it "should error if timeout occurs while restarting the service" do - expect(@provider).to receive(:texecute).with(:restart, ["/usr/sbin/svcadm", :restart, '-s', "/system/myservice"], true) - expect(Timeout).to receive(:timeout).with(60).and_raise(Timeout::Error) - expect { @provider.restart }.to raise_error Puppet::Error, ('Timed out waiting for /system/myservice to transition states') + describe '#status' do + let(:states) do + { + :current => 'online', + :next => nil + } end - context 'with :operatingsystemrelease == 10_u10' do - it "should call 'svcadm restart /system/myservice'" do - allow(Facter).to receive(:value).with(:operatingsystemrelease).and_return('10_u10') - expect(@provider).to receive(:texecute).with(:restart, ["/usr/sbin/svcadm", :restart, "/system/myservice"], true) - expect(@provider).to receive(:wait).with('online') - @provider.restart - end + before(:each) do + allow(@provider).to receive(:service_states).and_return(states) + + allow(Facter).to receive(:value).with(:operatingsystemrelease).and_return('10.3') end - context 'with :operatingsystemrelease == 11.2' do - it "should call 'svcadm restart -s /system/myservice'" do - allow(Facter).to receive(:value).with(:operatingsystemrelease).and_return('11.2') - expect(@provider).to receive(:texecute).with(:restart, ["/usr/sbin/svcadm", :restart, '-s', "/system/myservice"], true) - expect(@provider).to receive(:wait).with('online') - @provider.restart + it "should run the status command if it's passed in" do + set_resource_params({ :status => 'status_cmd' }) + expect(@provider).to receive(:ucommand).with(:status, false) do |_, _| + expect($CHILD_STATUS).to receive(:exitstatus).and_return(0) end + expect(@provider).not_to receive(:service_states) + + expect(@provider.status).to eql(:running) end - context 'with :operatingsystemrelease > 11.2' do - it "should call 'svcadm restart -s /system/myservice'" do - allow(Facter).to receive(:value).with(:operatingsystemrelease).and_return('11.3') - expect(@provider).to receive(:texecute).with(:restart, ["/usr/sbin/svcadm", :restart, '-s', "/system/myservice"], true) - expect(@provider).to receive(:wait).with('online') - @provider.restart + shared_examples 'returns the right status' do |svcs_state, expected_state| + it "returns '#{expected_state}' if the svcs state is '#{svcs_state}'" do + + states[:current] = svcs_state + expect(@provider.status).to eql(expected_state) end end - end - describe '#service_fmri' do - it 'raises a Puppet::Error if the service resource matches multiple FMRIs' do - allow(@provider).to receive(:svcs).with('-l', @provider.resource[:name]).and_return(File.read(my_fixture('svcs_multiple_fmris.out'))) + include_examples 'returns the right status', 'online', :running + include_examples 'returns the right status', 'offline', :stopped + include_examples 'returns the right status', 'disabled', :stopped + include_examples 'returns the right status', 'uninitialized', :stopped + include_examples 'returns the right status', 'maintenance', :maintenance + include_examples 'returns the right status', 'degraded', :degraded - expect { @provider.service_fmri }.to raise_error do |error| + it "raises a Puppet::Error if the svcs state is 'legacy_run'" do + states[:current] = 'legacy_run' + expect { @provider.status }.to raise_error do |error| expect(error).to be_a(Puppet::Error) - expect(error.message).to match(@provider.resource[:name]) - expect(error.message).to match('multiple') - - matched_fmris = ["svc:/application/tstapp:one", "svc:/application/tstapp:two"] - expect(error.message).to match(matched_fmris.join(', ')) + expect(error.message).to match('legacy') end end - it 'raises a Puppet:ExecutionFailure if svcs fails' do - allow(@provider).to receive(:svcs).with('-l', @provider.resource[:name]).and_raise( - Puppet::ExecutionFailure, 'svcs failed!' - ) - - expect { @provider.service_fmri }.to raise_error do |error| - expect(error).to be_a(Puppet::ExecutionFailure) - expect(error.message).to match('svcs failed!') + it "raises a Puppet::Error if the svcs state is unmanageable" do + states[:current] = 'unmanageable state' + expect { @provider.status }.to raise_error do |error| + expect(error).to be_a(Puppet::Error) + expect(error.message).to match(states[:current]) end end - it "returns the service resource's fmri and memoizes it" do - allow(@provider).to receive(:svcs).with('-l', @provider.resource[:name]).and_return(File.read(my_fixture('svcs_fmri.out'))) + it "returns 'stopped' if the service does not exist" do + expect(@provider).to receive(:service_states).and_raise(Puppet::ExecutionFailure, 'service does not exist!') + expect(@provider.status).to eql(:stopped) + end - expected_fmri = 'svc:/application/tstapp:default' + it "uses the current state for comparison if the next state is not provided" do + states[:next] = 'disabled' + expect(@provider.status).to eql(:stopped) + end - expect(@provider.service_fmri).to eql(expected_fmri) - expect(@provider.instance_variable_get(:@fmri)).to eql(expected_fmri) + it "should return stopped for an incomplete service on Solaris 11" do + allow(Facter).to receive(:value).with(:operatingsystemrelease).and_return('11.3') + allow(@provider).to receive(:complete_service?).and_return(false) + expect(@provider.status).to eq(:stopped) end end - describe '#complete_service?' do - let(:fmri) { 'service_fmri' } - + describe '#maybe_clear_service_then_svcadm' do + let(:fmri) { 'resource_fmri' } before(:each) do allow(@provider).to receive(:service_fmri).and_return(fmri) end - it 'should raise a Puppet::Error if it is called on an older Solaris machine' do - allow(Facter).to receive(:value).with(:operatingsystemrelease).and_return('10.0') + it 'applies the svcadm subcommand with the given flags' do + expect(@provider).to receive(:adm).with('enable', '-rst', fmri) + @provider.maybe_clear_service_then_svcadm(:stopped, 'enable', '-rst') + end - expect { @provider.complete_service? }.to raise_error(Puppet::Error) + [:maintenance, :degraded].each do |status| + it "clears the service before applying the svcadm subcommand if the service status is #{status}" do + expect(@provider).to receive(:adm).with('clear', fmri) + expect(@provider).to receive(:adm).with('enable', '-rst', fmri) + + @provider.maybe_clear_service_then_svcadm(status, 'enable', '-rst') + end end + end - it 'should return false for an incomplete service' do - allow(@provider).to receive(:svccfg).with('-s', fmri, 'listprop', 'general/complete').and_return("") - expect(@provider.complete_service?).to be false + describe '#flush' do + def mark_property_for_syncing(property, value) + properties_to_sync = @provider.instance_variable_get(:@properties_to_sync) + properties_to_sync[property] = value end - it 'should return true for a complete service' do - allow(@provider).to receive(:svccfg) - .with('-s', fmri, 'listprop', 'general/complete') - .and_return("general/complete astring") + it 'should noop if enable and ensure do not need to be syncd' do + expect(@provider).not_to receive(:setup_service) + @provider.flush + end - expect(@provider.complete_service?).to be true + context 'enable or ensure need to be syncd' do + let(:stopped_states) do + ['offline', 'disabled', 'uninitialized'] + end + + let(:fmri) { 'resource_fmri' } + let(:mock_status) { :maintenance } + before(:each) do + allow(@provider).to receive(:setup_service) + allow(@provider).to receive(:service_fmri).and_return(fmri) + + # We will update this mock on a per-test basis. + allow(@provider).to receive(:status).and_return(mock_status) + allow(@provider).to receive(:wait) + end + + context 'only ensure needs to be syncd' do + it 'stops the service if ensure == stopped' do + mark_property_for_syncing(:ensure, :stopped) + + expect(@provider).to receive(:maybe_clear_service_then_svcadm).with(mock_status, 'disable', '-st') + expect(@provider).to receive(:wait).with(*stopped_states) + + @provider.flush + end + + it 'starts the service if ensure == running' do + mark_property_for_syncing(:ensure, :running) + + expect(@provider).to receive(:maybe_clear_service_then_svcadm).with(mock_status, 'enable', '-rst') + expect(@provider).to receive(:wait).with('online') + + @provider.flush + end + end + + context 'enable needs to be syncd' do + before(:each) do + # We will stub this value out later, this default is useful + # for the final state tests. + mark_property_for_syncing(:enable, true) + end + + it 'enables the service' do + mark_property_for_syncing(:enable, true) + + expect(@provider).to receive(:maybe_clear_service_then_svcadm).with(mock_status, 'enable', '-rs') + + expect(@provider).to receive(:adm).with('mark', '-I', 'maintenance', fmri) + + @provider.flush + end + + it 'disables the service' do + mark_property_for_syncing(:enable, false) + + expect(@provider).to receive(:maybe_clear_service_then_svcadm).with(mock_status, 'disable', '-s') + + expect(@provider).to receive(:adm).with('mark', '-I', 'maintenance', fmri) + + @provider.flush + end + + context 'when the final service state is running' do + before(:each) do + allow(@provider).to receive(:status).and_return(:running) + end + + it 'starts the service if enable was false' do + mark_property_for_syncing(:enable, false) + + expect(@provider).to receive(:adm).with('disable', '-s', fmri) + expect(@provider).to receive(:adm).with('enable', '-rst', fmri) + expect(@provider).to receive(:wait).with('online') + + @provider.flush + end + + it 'waits for the service to start if enable was true' do + mark_property_for_syncing(:enable, true) + + expect(@provider).to receive(:adm).with('enable', '-rs', fmri) + expect(@provider).to receive(:wait).with('online') + + @provider.flush + end + end + + context 'when the final service state is stopped' do + before(:each) do + allow(@provider).to receive(:status).and_return(:stopped) + end + + it 'stops the service if enable was true' do + mark_property_for_syncing(:enable, true) + + expect(@provider).to receive(:adm).with('enable', '-rs', fmri) + expect(@provider).to receive(:adm).with('disable', '-st', fmri) + expect(@provider).to receive(:wait).with(*stopped_states) + + @provider.flush + end + + it 'waits for the service to stop if enable was false' do + mark_property_for_syncing(:enable, false) + + expect(@provider).to_not receive(:adm).with('disable', '-st', fmri) + expect(@provider).to receive(:wait).with(*stopped_states) + + @provider.flush + end + end + + it 'marks the service as being under maintenance if the final state is maintenance' do + expect(@provider).to receive(:status).and_return(:maintenance) + + expect(@provider).to receive(:adm).with('clear', fmri) + expect(@provider).to receive(:adm).with('enable', '-rs', fmri) + + expect(@provider).to receive(:adm).with('mark', '-I', 'maintenance', fmri) + expect(@provider).to receive(:wait).with('maintenance') + + @provider.flush + end + + it 'uses the ensure value as the final state if ensure also needs to be syncd' do + mark_property_for_syncing(:ensure, :running) + expect(@provider).to receive(:status).and_return(:stopped) + + expect(@provider).to receive(:adm).with('enable', '-rs', fmri) + expect(@provider).to receive(:wait).with('online') + + @provider.flush + end + + it 'marks the final state of a degraded service as running' do + expect(@provider).to receive(:status).and_return(:degraded) + + expect(@provider).to receive(:adm).with('clear', fmri) + expect(@provider).to receive(:adm).with('enable', '-rs', fmri) + + expect(@provider).to receive(:wait).with('online') + + @provider.flush + end + end end end end From 90b06271b583cd19aab4c37cb0fe42a6f6851569 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Tue, 27 Oct 2020 17:13:21 -0700 Subject: [PATCH 230/731] (PUP-7843) Reserve missing type names The checker class validates the AST produced by the puppet parser, but was missing some type names. As a result of this change, a class or defined type in top scope can no longer be named 'init', 'object', etc. Classes or defined types in other scopes will still work, e.g. `mymodule::object`. --- lib/puppet/pops/validation/checker4_0.rb | 9 +++++++++ spec/unit/pops/validator/validator_spec.rb | 22 ++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/lib/puppet/pops/validation/checker4_0.rb b/lib/puppet/pops/validation/checker4_0.rb index 791e480d4b0..65093eaabe0 100644 --- a/lib/puppet/pops/validation/checker4_0.rb +++ b/lib/puppet/pops/validation/checker4_0.rb @@ -370,6 +370,15 @@ def check_NamedAccessExpression(o) 'regexp' => true, 'pattern' => true, 'runtime' => true, + 'init' => true, + 'object' => true, + 'sensitive' => true, + 'semver' => true, + 'semverrange' => true, + 'string' => true, + 'timestamp' => true, + 'timespan' => true, + 'typeset' => true, } FUTURE_RESERVED_WORDS = { diff --git a/spec/unit/pops/validator/validator_spec.rb b/spec/unit/pops/validator/validator_spec.rb index 9d822a24aa2..69922f0e23a 100644 --- a/spec/unit/pops/validator/validator_spec.rb +++ b/spec/unit/pops/validator/validator_spec.rb @@ -669,6 +669,15 @@ def with_environment(environment, env_params = {}) 'regexp', 'pattern', 'runtime', + 'init', + 'object', + 'sensitive', + 'semver', + 'semverrange', + 'string', + 'timestamp', + 'timespan', + 'typeset', ].each do |name| it "produces an error for 'class #{name}'" do @@ -693,6 +702,7 @@ def with_environment(environment, env_params = {}) source = "type('a', 'b')" expect(validate(parse(source))).not_to have_any_issues end + it "should allow using the 'type' as the name of a function with no parameters and a block" do source = "type() |$x| { $x }" expect(validate(parse(source))).not_to have_any_issues @@ -968,6 +978,18 @@ def issue(at_top) end end + it "allows a reserved type name" do + source = <<-SOURCE + class foo { + define string() {} + foo::string { 'a': } + } + SOURCE + + acceptor = validate(parse(source, 'path/foo/manifests/init.pp')) + expect(acceptor.error_count).to eql(0) + end + it "will give multiple errors in one file with multiple issues" do source = <<-SOURCE class foo {} From c4728bab781b38c3eba4ce3e1f6a7758deb9fd64 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Wed, 28 Oct 2020 13:40:49 +0000 Subject: [PATCH 231/731] (packaging) Updating manpage file for main --- man/man8/puppet-filebucket.8 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/man/man8/puppet-filebucket.8 b/man/man8/puppet-filebucket.8 index b9fd841552f..84c9306d17f 100644 --- a/man/man8/puppet-filebucket.8 +++ b/man/man8/puppet-filebucket.8 @@ -152,8 +152,8 @@ $ puppet filebucket \-b /tmp/TestBucket backup /tmp/TestFile2 $ puppet filebucket \-b /tmp/TestBucket list d41d8cd98f00b204e9800998ecf8427e 2015\-05\-11 09:33:22 /tmp/TestFile2 -## From a Puppet master, list files in the master bucketdir -$ puppet filebucket \-b $(puppet config print bucketdir \-\-section master) list +## From a Puppet Server, list files in the server bucketdir +$ puppet filebucket \-b $(puppet config print bucketdir \-\-section server) list d43a6ecaa892a1962398ac9170ea9bf2 2015\-05\-11 09:27:56 /tmp/TestFile 7ae322f5791217e031dc60188f4521ef 2015\-05\-11 09:52:15 /tmp/TestFile . From e0dab29d1ef4dd74c5ad6ac8d8c2207fa2ca1a3d Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Wed, 28 Oct 2020 19:09:13 -0700 Subject: [PATCH 232/731] (PUP-10730) Separate abstract response and net http adapter Move behavior specific to Net::HTTPResponse into an adapter, and leave the common behaviors in the abstract Puppet::HTTP::Response class. It also makes it possible to create a response in tests given just the URL, code and status. --- lib/puppet/http.rb | 1 + lib/puppet/http/client.rb | 2 +- lib/puppet/http/external_client.rb | 4 +-- lib/puppet/http/response.rb | 33 ++++++++++---------- lib/puppet/http/response_net_http.rb | 42 ++++++++++++++++++++++++++ spec/unit/http/client_spec.rb | 10 +++--- spec/unit/http/external_client_spec.rb | 4 +-- spec/unit/http/session_spec.rb | 14 +++++---- 8 files changed, 78 insertions(+), 32 deletions(-) create mode 100644 lib/puppet/http/response_net_http.rb diff --git a/lib/puppet/http.rb b/lib/puppet/http.rb index 4717ed1b818..0eabb2d6601 100644 --- a/lib/puppet/http.rb +++ b/lib/puppet/http.rb @@ -24,6 +24,7 @@ module HTTP require 'puppet/http/pool' require 'puppet/http/dns' require 'puppet/http/response' + require 'puppet/http/response_net_http' require 'puppet/http/service' require 'puppet/http/service/ca' require 'puppet/http/service/compiler' diff --git a/lib/puppet/http/client.rb b/lib/puppet/http/client.rb index b3b8ac83b01..15b47af4446 100644 --- a/lib/puppet/http/client.rb +++ b/lib/puppet/http/client.rb @@ -350,7 +350,7 @@ def execute_streaming(request, options: {}, &block) # don't call return within the `request` block http.request(request) do |nethttp| - response = Puppet::HTTP::Response.new(nethttp, request.uri) + response = Puppet::HTTP::ResponseNetHTTP.new(request.uri, nethttp) begin Puppet.debug("HTTP #{request.method.upcase} #{request.uri} returned #{response.code} #{response.reason}") diff --git a/lib/puppet/http/external_client.rb b/lib/puppet/http/external_client.rb index f2a0b1b74a7..2797ff88fb1 100644 --- a/lib/puppet/http/external_client.rb +++ b/lib/puppet/http/external_client.rb @@ -22,7 +22,7 @@ def get(url, headers: {}, params: {}, options: {}, &block) options[:use_ssl] = url.scheme == 'https' client = @http_client_class.new(url.host, url.port, options) - response = Puppet::HTTP::Response.new(client.get(url.request_uri, headers, options), url) + response = Puppet::HTTP::ResponseNetHTTP.new(url, client.get(url.request_uri, headers, options)) if block_given? yield response @@ -44,7 +44,7 @@ def post(url, body, headers: {}, params: {}, options: {}, &block) options[:use_ssl] = url.scheme == 'https' client = @http_client_class.new(url.host, url.port, options) - response = Puppet::HTTP::Response.new(client.post(url.request_uri, body, headers, options), url) + response = Puppet::HTTP::ResponseNetHTTP.new(url, client.post(url.request_uri, body, headers, options)) if block_given? yield response diff --git a/lib/puppet/http/response.rb b/lib/puppet/http/response.rb index d70a2dccd3a..23bf4ea64a5 100644 --- a/lib/puppet/http/response.rb +++ b/lib/puppet/http/response.rb @@ -1,39 +1,42 @@ # Represents the response returned from the server from an HTTP request. # +# @api abstract # @api public class Puppet::HTTP::Response # @api private # @return [Net::HTTP] the Net::HTTP response attr_reader :nethttp - # @return [URI] the response uri + # @return [URI] the response url attr_reader :url - # Object to represent the response returned from an HTTP request. + # Create a response associated with the URL. # - # @param [Net::HTTP] nethttp the request response # @param [URI] url - def initialize(nethttp, url) - @nethttp = nethttp + # @param [Integer] HTTP status + # @param [String] HTTP reason + def initialize(url, code, reason) @url = url + @code = code + @reason = reason end - # Extract the response code. + # Return the response code. # # @return [Integer] Response code for the request # # @api public def code - @nethttp.code.to_i + @code end - # Extract the response message. + # Return the response message. # # @return [String] Response message for the request # # @api public def reason - @nethttp.message + @reason end # Returns the entire response body. Can be used instead of @@ -44,7 +47,7 @@ def reason # # @api public def body - @nethttp.body + raise NotImplementedError end # Streams the response body to the caller in chunks. Can be used instead of @@ -57,9 +60,7 @@ def body # # @api public def read_body(&block) - raise ArgumentError, "A block is required" unless block_given? - - @nethttp.read_body(&block) + raise NotImplementedError end # Check if the request received a response of success (HTTP 2xx). @@ -68,7 +69,7 @@ def read_body(&block) # # @api public def success? - @nethttp.is_a?(Net::HTTPSuccess) + 200 <= @code && @code < 300 end # Get a header case-insensitively. @@ -78,7 +79,7 @@ def success? # # @api public def [](name) - @nethttp[name] + raise NotImplementedError end # Yield each header name and value. Returns an enumerator if no block is given. @@ -88,7 +89,7 @@ def [](name) # # @api public def each_header(&block) - @nethttp.each_header(&block) + raise NotImplementedError end # Ensure the response body is fully read so that the server is not blocked diff --git a/lib/puppet/http/response_net_http.rb b/lib/puppet/http/response_net_http.rb new file mode 100644 index 00000000000..28d7d64c6a5 --- /dev/null +++ b/lib/puppet/http/response_net_http.rb @@ -0,0 +1,42 @@ +# Adapts Net::HTTPResponse to Puppet::HTTP::Response +# +# @api public +class Puppet::HTTP::ResponseNetHTTP < Puppet::HTTP::Response + + # Create a response associated with the URL. + # + # @param [URI] url + # @param [Net::HTTPResponse] nethttp The response + def initialize(url, nethttp) + super(url, nethttp.code.to_i, nethttp.message) + + @nethttp = nethttp + end + + # (see Puppet::HTTP::Response#body) + def body + @nethttp.body + end + + # (see Puppet::HTTP::Response#read_body) + def read_body(&block) + raise ArgumentError, "A block is required" unless block_given? + + @nethttp.read_body(&block) + end + + # (see Puppet::HTTP::Response#success?) + def success? + @nethttp.is_a?(Net::HTTPSuccess) + end + + # (see Puppet::HTTP::Response#[]) + def [](name) + @nethttp[name] + end + + # (see Puppet::HTTP::Response#each_header) + def each_header(&block) + @nethttp.each_header(&block) + end +end diff --git a/spec/unit/http/client_spec.rb b/spec/unit/http/client_spec.rb index 83aa58ed345..a4fa2b06dfd 100644 --- a/spec/unit/http/client_spec.rb +++ b/spec/unit/http/client_spec.rb @@ -154,7 +154,7 @@ def expect_http_error(cause, expected_message) stub_request(:get, uri) response = client.get(uri) - expect(response).to be_an_instance_of(Puppet::HTTP::Response) + expect(response).to be_a(Puppet::HTTP::Response) expect(response).to be_success expect(response.code).to eq(200) end @@ -224,7 +224,7 @@ def expect_http_error(cause, expected_message) stub_request(:head, uri) response = client.head(uri) - expect(response).to be_an_instance_of(Puppet::HTTP::Response) + expect(response).to be_a(Puppet::HTTP::Response) expect(response).to be_success expect(response.code).to eq(200) end @@ -284,7 +284,7 @@ def expect_http_error(cause, expected_message) stub_request(:put, uri) response = client.put(uri, "", headers: {'Content-Type' => 'text/plain'}) - expect(response).to be_an_instance_of(Puppet::HTTP::Response) + expect(response).to be_a(Puppet::HTTP::Response) expect(response).to be_success expect(response.code).to eq(200) end @@ -353,7 +353,7 @@ def expect_http_error(cause, expected_message) stub_request(:post, uri) response = client.post(uri, "", headers: {'Content-Type' => 'text/plain'}) - expect(response).to be_an_instance_of(Puppet::HTTP::Response) + expect(response).to be_a(Puppet::HTTP::Response) expect(response).to be_success expect(response.code).to eq(200) end @@ -435,7 +435,7 @@ def expect_http_error(cause, expected_message) stub_request(:delete, uri) response = client.delete(uri) - expect(response).to be_an_instance_of(Puppet::HTTP::Response) + expect(response).to be_a(Puppet::HTTP::Response) expect(response).to be_success expect(response.code).to eq(200) end diff --git a/spec/unit/http/external_client_spec.rb b/spec/unit/http/external_client_spec.rb index e29b5c632d8..a235380d94f 100644 --- a/spec/unit/http/external_client_spec.rb +++ b/spec/unit/http/external_client_spec.rb @@ -61,7 +61,7 @@ def do_request(request, options) stub_request(:get, uri) response = client.get(uri) - expect(response).to be_an_instance_of(Puppet::HTTP::Response) + expect(response).to be_a(Puppet::HTTP::Response) expect(response).to be_success expect(response.code).to eq(200) end @@ -113,7 +113,7 @@ def do_request(request, options) stub_request(:post, uri) response = client.post(uri, "", headers: {'Content-Type' => 'text/plain'}) - expect(response).to be_an_instance_of(Puppet::HTTP::Response) + expect(response).to be_a(Puppet::HTTP::Response) expect(response).to be_success expect(response.code).to eq(200) end diff --git a/spec/unit/http/session_spec.rb b/spec/unit/http/session_spec.rb index 9ab7efd7163..99bf150d696 100644 --- a/spec/unit/http/session_spec.rb +++ b/spec/unit/http/session_spec.rb @@ -222,6 +222,8 @@ def resolve(session, name, ssl_context: nil, canceled_handler: nil) end context 'when retrieving capabilities' do + let(:response) { Puppet::HTTP::Response.new(uri, 200, 'OK') } + let(:session) do resolver = DummyResolver.new(good_service) described_class.new(client, [resolver]) @@ -242,7 +244,7 @@ def resolve(session, name, ssl_context: nil, canceled_handler: nil) end it "supports locales if the cached service's version is 5.3.4 or greater" do - response = Puppet::HTTP::Response.new({'X-Puppet-Version' => '5.3.4'}, uri) + allow(response).to receive(:[]).with('X-Puppet-Version').and_return('5.3.4') session.route_to(:puppet) session.process_response(response) @@ -251,7 +253,7 @@ def resolve(session, name, ssl_context: nil, canceled_handler: nil) end it "does not support locales if the cached service's version is 5.3.3" do - response = Puppet::HTTP::Response.new({'X-Puppet-Version' => '5.3.3'}, uri) + allow(response).to receive(:[]).with('X-Puppet-Version').and_return('5.3.3') session.route_to(:puppet) session.process_response(response) @@ -260,7 +262,7 @@ def resolve(session, name, ssl_context: nil, canceled_handler: nil) end it "does not support locales if the cached service's version is missing" do - response = Puppet::HTTP::Response.new({}, uri) + allow(response).to receive(:[]).with('X-Puppet-Version').and_return(nil) session.route_to(:puppet) session.process_response(response) @@ -277,7 +279,7 @@ def resolve(session, name, ssl_context: nil, canceled_handler: nil) end it "supports json if the cached service's version is 5 or greater" do - response = Puppet::HTTP::Response.new({'X-Puppet-Version' => '5.5.12'}, uri) + allow(response).to receive(:[]).with('X-Puppet-Version').and_return('5.5.12') session.route_to(:puppet) session.process_response(response) @@ -286,7 +288,7 @@ def resolve(session, name, ssl_context: nil, canceled_handler: nil) end it "does not support json if the cached service's version is less than 5.0" do - response = Puppet::HTTP::Response.new({'X-Puppet-Version' => '4.10.1'}, uri) + allow(response).to receive(:[]).with('X-Puppet-Version').and_return('4.10.1') session.route_to(:puppet) session.process_response(response) @@ -295,7 +297,7 @@ def resolve(session, name, ssl_context: nil, canceled_handler: nil) end it "supports json if the cached service's version is missing" do - response = Puppet::HTTP::Response.new({}, uri) + allow(response).to receive(:[]).with('X-Puppet-Version').and_return(nil) session.route_to(:puppet) session.process_response(response) From 651ba07154923b48d0a5823aef7b283767df7403 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Wed, 28 Oct 2020 10:43:22 -0700 Subject: [PATCH 233/731] (PUP-10730) Add response converter Add a module to convert a Puppet::HTTP::Response object to Net::HTTPResponse based on the HTTP status code. The code is borrowed from puppetserver. --- lib/puppet/http.rb | 1 + lib/puppet/http/response_converter.rb | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 lib/puppet/http/response_converter.rb diff --git a/lib/puppet/http.rb b/lib/puppet/http.rb index 0eabb2d6601..5129f7d73a9 100644 --- a/lib/puppet/http.rb +++ b/lib/puppet/http.rb @@ -24,6 +24,7 @@ module HTTP require 'puppet/http/pool' require 'puppet/http/dns' require 'puppet/http/response' + require 'puppet/http/response_converter' require 'puppet/http/response_net_http' require 'puppet/http/service' require 'puppet/http/service/ca' diff --git a/lib/puppet/http/response_converter.rb b/lib/puppet/http/response_converter.rb new file mode 100644 index 00000000000..4cef1fd3bdb --- /dev/null +++ b/lib/puppet/http/response_converter.rb @@ -0,0 +1,24 @@ +module Puppet::HTTP::ResponseConverter + module_function + + # Borrowed from puppetserver, see https://github.com/puppetlabs/puppetserver/commit/a1ebeaaa5af590003ccd23c89f808ba4f0c89609 + def to_ruby_response(response) + str_code = response.code.to_s + + # Copied from Net::HTTPResponse because it is private there. + clazz = Net::HTTPResponse::CODE_TO_OBJ[str_code] or + Net::HTTPResponse::CODE_CLASS_TO_OBJ[str_code[0,1]] or + Net::HTTPUnknownResponse + result = clazz.new(nil, str_code, nil) + result.body = response.body + # This is nasty, nasty. But apparently there is no way to create + # an instance of Net::HttpResponse from outside of the library and have + # the body be readable, unless you do stupid things like this. + result.instance_variable_set(:@read, true) + response.each_header do |k,v| + result[k] = v + end + result + end +end + From cdbc1bbc91ee1acd9daab6a307d02f291f8bbc28 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Wed, 28 Oct 2020 11:05:56 -0700 Subject: [PATCH 234/731] (PUP-10730) Convert puppet http responses in the connection adapter Puppetserver's http client implementation returns instances of `Puppet::HTTP::Response` but they don't wrap `Net::HTTPResponse`, so we can't make that assumption in the connection adapter. Use the newly added response converter for that. Since `Puppet::Network::HTTP::Connection` depends on `Puppet::HTTP`, require the former after the latter. --- lib/puppet/http.rb | 13 +++++---- lib/puppet/network/http/connection.rb | 40 +++++++++++++++------------ 2 files changed, 29 insertions(+), 24 deletions(-) diff --git a/lib/puppet/http.rb b/lib/puppet/http.rb index 5129f7d73a9..d4e9cb3a1e9 100644 --- a/lib/puppet/http.rb +++ b/lib/puppet/http.rb @@ -1,10 +1,4 @@ module Puppet - module Network - module HTTP - require 'puppet/network/http_pool' - end - end - # Contains an HTTP client for making network requests to puppet and other # HTTP servers. # @@ -42,4 +36,11 @@ module HTTP require 'puppet/http/retry_after_handler' require 'puppet/http/external_client' end + + # Legacy HTTP API + module Network + module HTTP + require 'puppet/network/http_pool' + end + end end diff --git a/lib/puppet/network/http/connection.rb b/lib/puppet/network/http/connection.rb index 2e94b9aca92..721036ecea5 100644 --- a/lib/puppet/network/http/connection.rb +++ b/lib/puppet/network/http/connection.rb @@ -1,3 +1,5 @@ +require 'puppet/http' + # This will be raised if too many redirects happen for a given HTTP request class Puppet::Network::HTTP::RedirectionLimitExceededException < Puppet::Error ; end @@ -14,6 +16,8 @@ class Puppet::Network::HTTP::RedirectionLimitExceededException < Puppet::Error ; # @deprecated Use {Puppet.runtime[:http]} # @api public class Puppet::Network::HTTP::Connection + include Puppet::HTTP::ResponseConverter + OPTION_DEFAULTS = { :use_ssl => true, :verifier => nil, @@ -95,8 +99,7 @@ def get(path, headers = {}, options = {}) options[:redirect_limit] ||= @redirect_limit with_error_handling do - resp = @client.get(to_url(path), headers: headers, options: options) - resp.nethttp + to_ruby_response(@client.get(to_url(path), headers: headers, options: options)) end end @@ -113,8 +116,7 @@ def post(path, data, headers = nil, options = {}) options[:redirect_limit] ||= @redirect_limit with_error_handling do - resp = @client.post(to_url(path), data, headers: headers, options: options) - resp.nethttp + to_ruby_response(@client.post(to_url(path), data, headers: headers, options: options)) end end @@ -128,8 +130,7 @@ def head(path, headers = {}, options = {}) options[:redirect_limit] ||= @redirect_limit with_error_handling do - resp = @client.head(to_url(path), headers: headers, options: options) - resp.nethttp + to_ruby_response(@client.head(to_url(path), headers: headers, options: options)) end end @@ -143,8 +144,7 @@ def delete(path, headers = {'Depth' => 'Infinity'}, options = {}) options[:redirect_limit] ||= @redirect_limit with_error_handling do - resp = @client.delete(to_url(path), headers: headers, options: options) - resp.nethttp + to_ruby_response(@client.delete(to_url(path), headers: headers, options: options)) end end @@ -161,8 +161,7 @@ def put(path, data, headers = nil, options = {}) options[:redirect_limit] ||= @redirect_limit with_error_handling do - resp = @client.put(to_url(path), data, headers: headers, options: options) - resp.nethttp + to_ruby_response(@client.put(to_url(path), data, headers: headers, options: options)) end end @@ -174,10 +173,12 @@ def request_get(*args, &block) redirect_limit: @redirect_limit } - resp = @client.get(to_url(path), headers: headers, options: options) do |response| - yield response.nethttp if block_given? + ruby_response = nil + @client.get(to_url(path), headers: headers, options: options) do |response| + ruby_response = to_ruby_response(response) + yield ruby_response if block_given? end - resp.nethttp + ruby_response end def request_head(*args, &block) @@ -189,8 +190,9 @@ def request_head(*args, &block) } response = @client.head(to_url(path), headers: headers, options: options) - yield response.nethttp if block_given? - response.nethttp + ruby_response = to_ruby_response(response) + yield ruby_response if block_given? + ruby_response end def request_post(*args, &block) @@ -202,10 +204,12 @@ def request_post(*args, &block) redirect_limit: @redirect_limit } - resp = @client.post(to_url(path), data, headers: headers, options: options) do |response| - yield response.nethttp if block_given? + ruby_response = nil + @client.post(to_url(path), data, headers: headers, options: options) do |response| + ruby_response = to_ruby_response(response) + yield ruby_response if block_given? end - resp.nethttp + ruby_response end private From 87406b4cbc818ce74cad814f963c161847a76276 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Wed, 28 Oct 2020 19:24:36 -0700 Subject: [PATCH 235/731] (PUP-10730) Use HTTP client constants Use constants defined in the http client code instead of the server-side handlers. --- lib/puppet/indirector/report/rest.rb | 2 +- spec/unit/indirector/report/rest_spec.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/puppet/indirector/report/rest.rb b/lib/puppet/indirector/report/rest.rb index 5a3fd3f71e4..def5ebd0e94 100644 --- a/lib/puppet/indirector/report/rest.rb +++ b/lib/puppet/indirector/report/rest.rb @@ -23,7 +23,7 @@ def save(request) # This is called by the superclass when not using our httpclient. def handle_response(request, response) if !response.is_a?(Net::HTTPSuccess) - server_version = response[Puppet::Network::HTTP::HEADER_PUPPET_VERSION] + server_version = response[Puppet::HTTP::HEADER_PUPPET_VERSION] if server_version && SemanticPuppet::Version.parse(server_version).major < Puppet::Indirector::REST::MAJOR_VERSION_JSON_DEFAULT && Puppet[:preferred_serialization_format] != 'pson' diff --git a/spec/unit/indirector/report/rest_spec.rb b/spec/unit/indirector/report/rest_spec.rb index 4b6f512bf97..6ce041d556a 100644 --- a/spec/unit/indirector/report/rest_spec.rb +++ b/spec/unit/indirector/report/rest_spec.rb @@ -62,7 +62,7 @@ def report_response stub_request(:put, uri) .to_return(status: 500, - headers: { 'Content-Type' => 'text/pson', Puppet::Network::HTTP::HEADER_PUPPET_VERSION => '4.10.1' }) + headers: { 'Content-Type' => 'text/pson', Puppet::HTTP::HEADER_PUPPET_VERSION => '4.10.1' }) expect { described_class.indirection.save(report) @@ -74,7 +74,7 @@ def report_response stub_request(:put, uri) .to_return(status: 500, - headers: { 'Content-Type' => 'text/pson', Puppet::Network::HTTP::HEADER_PUPPET_VERSION => '4.10.1' }) + headers: { 'Content-Type' => 'text/pson', Puppet::HTTP::HEADER_PUPPET_VERSION => '4.10.1' }) expect { described_class.indirection.save(report) From 2fed85f530ef4a3442c783cf50fc58eee5ec93d0 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Wed, 28 Oct 2020 11:08:24 -0700 Subject: [PATCH 236/731] (PUP-10730) Convert puppet http responses in rest termini This is similar to what was done for the connection adapter, but this is for the `parse_response` and `convert_http_http_error` methods used by rest termini. Since the latter method now receives an instance of Puppet::HTTP::Response, we call the `:reason` reader instead of `:message` and call `response.success?`. --- lib/puppet/indirector/catalog/rest.rb | 4 ++-- lib/puppet/indirector/facts/rest.rb | 7 +++---- lib/puppet/indirector/file_bucket_file/rest.rb | 6 +++--- lib/puppet/indirector/file_content/rest.rb | 4 ++-- lib/puppet/indirector/file_metadata/rest.rb | 6 +++--- lib/puppet/indirector/node/rest.rb | 4 ++-- lib/puppet/indirector/report/rest.rb | 6 +++--- lib/puppet/indirector/rest.rb | 6 +++--- lib/puppet/type/file/source.rb | 2 +- spec/unit/indirector/rest_spec.rb | 4 ++-- 10 files changed, 24 insertions(+), 25 deletions(-) diff --git a/lib/puppet/indirector/catalog/rest.rb b/lib/puppet/indirector/catalog/rest.rb index 07b532386fc..00681f7f0d1 100644 --- a/lib/puppet/indirector/catalog/rest.rb +++ b/lib/puppet/indirector/catalog/rest.rb @@ -28,11 +28,11 @@ def find(request) if e.response.code == 404 return nil unless request.options[:fail_on_404] - _, body = parse_response(e.response.nethttp) + _, body = parse_response(e.response) msg = _("Find %{uri} resulted in 404 with the message: %{body}") % { uri: elide(e.response.url.path, 100), body: body } raise Puppet::Error, msg else - raise convert_to_http_error(e.response.nethttp) + raise convert_to_http_error(e.response) end end end diff --git a/lib/puppet/indirector/facts/rest.rb b/lib/puppet/indirector/facts/rest.rb index 5102dd2b091..15f5d83164e 100644 --- a/lib/puppet/indirector/facts/rest.rb +++ b/lib/puppet/indirector/facts/rest.rb @@ -16,11 +16,11 @@ def find(request) if e.response.code == 404 return nil unless request.options[:fail_on_404] - _, body = parse_response(e.response.nethttp) + _, body = parse_response(e.response) msg = _("Find %{uri} resulted in 404 with the message: %{body}") % { uri: elide(e.response.url.path, 100), body: body } raise Puppet::Error, msg else - raise convert_to_http_error(e.response.nethttp) + raise convert_to_http_error(e.response) end end @@ -39,7 +39,6 @@ def save(request) nil rescue Puppet::HTTP::ResponseError => e # always raise even if fail_on_404 is false - raise convert_to_http_error(e.response.nethttp) - + raise convert_to_http_error(e.response) end end diff --git a/lib/puppet/indirector/file_bucket_file/rest.rb b/lib/puppet/indirector/file_bucket_file/rest.rb index a0d59ef22dd..8a71140b98a 100644 --- a/lib/puppet/indirector/file_bucket_file/rest.rb +++ b/lib/puppet/indirector/file_bucket_file/rest.rb @@ -15,7 +15,7 @@ def head(request) ) rescue Puppet::HTTP::ResponseError => e return nil if e.response.code == 404 - raise convert_to_http_error(e.response.nethttp) + raise convert_to_http_error(e.response) end def find(request) @@ -32,7 +32,7 @@ def find(request) ) filebucket_file rescue Puppet::HTTP::ResponseError => e - raise convert_to_http_error(e.response.nethttp) + raise convert_to_http_error(e.response) end def save(request) @@ -44,7 +44,7 @@ def save(request) environment: request.environment.to_s, ) rescue Puppet::HTTP::ResponseError => e - raise convert_to_http_error(e.response.nethttp) + raise convert_to_http_error(e.response) end end end diff --git a/lib/puppet/indirector/file_content/rest.rb b/lib/puppet/indirector/file_content/rest.rb index 54df626f0c9..a776e37fb04 100644 --- a/lib/puppet/indirector/file_content/rest.rb +++ b/lib/puppet/indirector/file_content/rest.rb @@ -25,11 +25,11 @@ def find(request) if e.response.code == 404 return nil unless request.options[:fail_on_404] - _, body = parse_response(e.response.nethttp) + _, body = parse_response(e.response) msg = _("Find %{uri} resulted in 404 with the message: %{body}") % { uri: elide(e.response.url.path, 100), body: body } raise Puppet::Error, msg else - raise convert_to_http_error(e.response.nethttp) + raise convert_to_http_error(e.response) end end end diff --git a/lib/puppet/indirector/file_metadata/rest.rb b/lib/puppet/indirector/file_metadata/rest.rb index c7efb13f178..d72ff63ae68 100644 --- a/lib/puppet/indirector/file_metadata/rest.rb +++ b/lib/puppet/indirector/file_metadata/rest.rb @@ -22,11 +22,11 @@ def find(request) if e.response.code == 404 return nil unless request.options[:fail_on_404] - _, body = parse_response(e.response.nethttp) + _, body = parse_response(e.response) msg = _("Find %{uri} resulted in 404 with the message: %{body}") % { uri: elide(e.response.url.path, 100), body: body } raise Puppet::Error, msg else - raise convert_to_http_error(e.response.nethttp) + raise convert_to_http_error(e.response) end end @@ -50,6 +50,6 @@ def search(request) # since it's search, return empty array instead of nil return [] if e.response.code == 404 - raise convert_to_http_error(e.response.nethttp) + raise convert_to_http_error(e.response) end end diff --git a/lib/puppet/indirector/node/rest.rb b/lib/puppet/indirector/node/rest.rb index 5630683ac83..b935a38057b 100644 --- a/lib/puppet/indirector/node/rest.rb +++ b/lib/puppet/indirector/node/rest.rb @@ -19,11 +19,11 @@ def find(request) if e.response.code == 404 return nil unless request.options[:fail_on_404] - _, body = parse_response(e.response.nethttp) + _, body = parse_response(e.response) msg = _("Find %{uri} resulted in 404 with the message: %{body}") % { uri: elide(e.response.url.path, 100), body: body } raise Puppet::Error, msg else - raise convert_to_http_error(e.response.nethttp) + raise convert_to_http_error(e.response) end end end diff --git a/lib/puppet/indirector/report/rest.rb b/lib/puppet/indirector/report/rest.rb index def5ebd0e94..13dae98defb 100644 --- a/lib/puppet/indirector/report/rest.rb +++ b/lib/puppet/indirector/report/rest.rb @@ -17,13 +17,13 @@ def save(request) rescue Puppet::HTTP::ResponseError => e return nil if e.response.code == 404 - raise convert_to_http_error(e.response.nethttp) + raise convert_to_http_error(e.response) end # This is called by the superclass when not using our httpclient. def handle_response(request, response) - if !response.is_a?(Net::HTTPSuccess) - server_version = response[Puppet::HTTP::HEADER_PUPPET_VERSION] + if !response.success? + server_version = response[Puppet::Network::HEADER_PUPPET_VERSION] if server_version && SemanticPuppet::Version.parse(server_version).major < Puppet::Indirector::REST::MAJOR_VERSION_JSON_DEFAULT && Puppet[:preferred_serialization_format] != 'pson' diff --git a/lib/puppet/indirector/rest.rb b/lib/puppet/indirector/rest.rb index 15ebca322af..630184308cc 100644 --- a/lib/puppet/indirector/rest.rb +++ b/lib/puppet/indirector/rest.rb @@ -27,8 +27,8 @@ def validate_key(request) private def convert_to_http_error(response) - if response.body.to_s.empty? && response.respond_to?(:message) - returned_message = response.message + if response.body.to_s.empty? && response.reason + returned_message = response.reason elsif response['content-type'].is_a?(String) content_type, body = parse_response(response) if content_type =~ /[pj]son/ @@ -41,7 +41,7 @@ def convert_to_http_error(response) end message = _("Error %{code} on SERVER: %{returned_message}") % { code: response.code, returned_message: returned_message } - Net::HTTPError.new(message, response) + Net::HTTPError.new(message, Puppet::HTTP::ResponseConverter.to_ruby_response(response)) end # Returns the content_type, stripping any appended charset, and the diff --git a/lib/puppet/type/file/source.rb b/lib/puppet/type/file/source.rb index e66e181d700..8e54bfa5410 100644 --- a/lib/puppet/type/file/source.rb +++ b/lib/puppet/type/file/source.rb @@ -340,7 +340,7 @@ def chunk_file_from_source(&block) def handle_response_error(response) message = "Error #{response.code} on SERVER: #{response.body.empty? ? response.reason : response.body}" - raise Net::HTTPError.new(message, response.nethttp) + raise Net::HTTPError.new(message, Puppet::HTTP::ResponseConverter.to_ruby_response(response)) end end diff --git a/spec/unit/indirector/rest_spec.rb b/spec/unit/indirector/rest_spec.rb index 883b8143f2f..03686276967 100644 --- a/spec/unit/indirector/rest_spec.rb +++ b/spec/unit/indirector/rest_spec.rb @@ -24,11 +24,11 @@ def find(request) if response.code == 404 return nil unless request.options[:fail_on_404] - _, body = parse_response(response.nethttp) + _, body = parse_response(response) msg = _("Find %{uri} resulted in 404 with the message: %{body}") % { uri: elide(response.url.path, 100), body: body } raise Puppet::Error, msg else - raise convert_to_http_error(response.nethttp) + raise convert_to_http_error(response) end end end From 0cc96f09db5c79be5edd01b4a853e25380d7289a Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Wed, 28 Oct 2020 10:46:00 -0700 Subject: [PATCH 237/731] (PUP-10730) Remove response nethttp reader Puppetserver's HTTP response doesn't use `Net::HTTP` so that shouldn't be part of the API. --- lib/puppet/http/response.rb | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/puppet/http/response.rb b/lib/puppet/http/response.rb index 23bf4ea64a5..3e55fe8e5f0 100644 --- a/lib/puppet/http/response.rb +++ b/lib/puppet/http/response.rb @@ -3,10 +3,6 @@ # @api abstract # @api public class Puppet::HTTP::Response - # @api private - # @return [Net::HTTP] the Net::HTTP response - attr_reader :nethttp - # @return [URI] the response url attr_reader :url From cb11e7371b2efcae5bcc28d9c097d32ef0575ccb Mon Sep 17 00:00:00 2001 From: Gabriel Nagy Date: Mon, 26 Oct 2020 16:33:02 +0200 Subject: [PATCH 238/731] (PUP-10711) Add `:port` and `:integer` setting types Add an `:integer` setting type which coerces the given value to a valid integer, and raises if the value is invalid. Add a `:port` setting type which coerces the given value to an integer and raises if the value is not in the valid port range (0-65535). --- lib/puppet/settings.rb | 4 +++ lib/puppet/settings/integer_setting.rb | 17 +++++++++ lib/puppet/settings/port_setting.rb | 15 ++++++++ spec/unit/settings/integer_setting_spec.rb | 42 ++++++++++++++++++++++ spec/unit/settings/port_setting_spec.rb | 31 ++++++++++++++++ 5 files changed, 109 insertions(+) create mode 100644 lib/puppet/settings/integer_setting.rb create mode 100644 lib/puppet/settings/port_setting.rb create mode 100644 spec/unit/settings/integer_setting_spec.rb create mode 100644 spec/unit/settings/port_setting_spec.rb diff --git a/lib/puppet/settings.rb b/lib/puppet/settings.rb index 9ede4d24ede..c47b6e86e90 100644 --- a/lib/puppet/settings.rb +++ b/lib/puppet/settings.rb @@ -21,6 +21,8 @@ class Puppet::Settings require 'puppet/settings/file_or_directory_setting' require 'puppet/settings/path_setting' require 'puppet/settings/boolean_setting' + require 'puppet/settings/integer_setting' + require 'puppet/settings/port_setting' require 'puppet/settings/terminus_setting' require 'puppet/settings/duration_setting' require 'puppet/settings/ttl_setting' @@ -733,6 +735,8 @@ def apply_metadata_from_section(section) :file_or_directory => FileOrDirectorySetting, :path => PathSetting, :boolean => BooleanSetting, + :integer => IntegerSetting, + :port => PortSetting, :terminus => TerminusSetting, :duration => DurationSetting, :ttl => TTLSetting, diff --git a/lib/puppet/settings/integer_setting.rb b/lib/puppet/settings/integer_setting.rb new file mode 100644 index 00000000000..04a1abf2622 --- /dev/null +++ b/lib/puppet/settings/integer_setting.rb @@ -0,0 +1,17 @@ +class Puppet::Settings::IntegerSetting < Puppet::Settings::BaseSetting + def munge(value) + return value if Integer === value + + begin + value = Integer(value) + rescue ArgumentError, TypeError + raise Puppet::Settings::ValidationError, _("Cannot convert '%{value}' to an integer for parameter: %{name}") % { value: value.inspect, name: @name } + end + + value + end + + def type + :integer + end +end diff --git a/lib/puppet/settings/port_setting.rb b/lib/puppet/settings/port_setting.rb new file mode 100644 index 00000000000..5d89667c4e7 --- /dev/null +++ b/lib/puppet/settings/port_setting.rb @@ -0,0 +1,15 @@ +class Puppet::Settings::PortSetting < Puppet::Settings::IntegerSetting + def munge(value) + value = super + + if value < 0 || value > 65535 + raise Puppet::Settings::ValidationError, _("Value '%{value}' is not a valid port number for parameter: %{name}") % { value: value.inspect, name: @name } + end + + value + end + + def type + :port + end +end diff --git a/spec/unit/settings/integer_setting_spec.rb b/spec/unit/settings/integer_setting_spec.rb new file mode 100644 index 00000000000..02aaaefae90 --- /dev/null +++ b/spec/unit/settings/integer_setting_spec.rb @@ -0,0 +1,42 @@ +require 'spec_helper' + +require 'puppet/settings' +require 'puppet/settings/integer_setting' + +describe Puppet::Settings::IntegerSetting do + let(:setting) { described_class.new(:settings => double('settings'), :desc => "test") } + + it "is of type :integer" do + expect(setting.type).to eq(:integer) + end + + describe "when munging the setting" do + it "returns the same value if given a positive integer" do + expect(setting.munge(5)).to eq(5) + end + + it "returns the same value if given a negative integer" do + expect(setting.munge(-25)).to eq(-25) + end + + it "returns an integer if given a valid integer as string" do + expect(setting.munge('12')).to eq(12) + end + + it "returns an integer if given a valid negative integer as string" do + expect(setting.munge('-12')).to eq(-12) + end + + it "returns an integer if given a valid positive integer as string" do + expect(setting.munge('+12')).to eq(12) + end + + it "raises if given an invalid value" do + expect { setting.munge('a5') }.to raise_error(Puppet::Settings::ValidationError) + end + + it "raises if given nil" do + expect { setting.munge(nil) }.to raise_error(Puppet::Settings::ValidationError) + end + end +end diff --git a/spec/unit/settings/port_setting_spec.rb b/spec/unit/settings/port_setting_spec.rb new file mode 100644 index 00000000000..23435a9449c --- /dev/null +++ b/spec/unit/settings/port_setting_spec.rb @@ -0,0 +1,31 @@ +require 'spec_helper' + +require 'puppet/settings' +require 'puppet/settings/port_setting' + +describe Puppet::Settings::PortSetting do + let(:setting) { described_class.new(:settings => double('settings'), :desc => "test") } + + it "is of type :port" do + expect(setting.type).to eq(:port) + end + + describe "when munging the setting" do + it "returns the same value if given a valid port as integer" do + expect(setting.munge(5)).to eq(5) + end + + it "returns an integer if given valid port as string" do + expect(setting.munge('12')).to eq(12) + end + + it "raises if given a negative port number" do + expect { setting.munge('-5') }.to raise_error(Puppet::Settings::ValidationError) + end + + it "raises if the port number is too high" do + expect { setting.munge(65536) }.to raise_error(Puppet::Settings::ValidationError) + end + + end +end From a936efa97f35748c360b3d8d89173cf6b2bb6cb3 Mon Sep 17 00:00:00 2001 From: Gabriel Nagy Date: Mon, 26 Oct 2020 16:38:43 +0200 Subject: [PATCH 239/731] (PUP-10711) Update defaults for port settings --- lib/puppet/defaults.rb | 6 +++++- spec/integration/defaults_spec.rb | 6 +++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb index 1eb8d5a18ec..f18e2cbe172 100644 --- a/lib/puppet/defaults.rb +++ b/lib/puppet/defaults.rb @@ -1302,6 +1302,7 @@ def self.initialize_default_settings!(settings) }, :serverport => { :default => 8140, + :type => :port, :desc => "The default port puppet subcommands use to communicate with Puppet Server. (eg `puppet facts upload`, `puppet agent`). May be overridden by more specific settings (see `ca_port`, `report_port`).", @@ -1310,7 +1311,8 @@ def self.initialize_default_settings!(settings) end }, :masterport => { - :default => 8140, + :default => "$serverport", + :type => :port, :desc => "The default port puppet subcommands use to communicate with Puppet Server. (eg `puppet facts upload`, `puppet agent`). May be overridden by more specific settings (see `ca_port`, `report_port`).", @@ -1633,6 +1635,7 @@ def self.initialize_default_settings!(settings) }, :ca_port => { :default => "$serverport", + :type => :port, :desc => "The port to use for the certificate authority.", }, :preferred_serialization_format => { @@ -1722,6 +1725,7 @@ def self.initialize_default_settings!(settings) }, :report_port => { :default => "$serverport", + :type => :port, :desc => "The port to communicate with the report_server.", }, :report => { diff --git a/spec/integration/defaults_spec.rb b/spec/integration/defaults_spec.rb index 5a05e4d39e7..1adff9bc886 100644 --- a/spec/integration/defaults_spec.rb +++ b/spec/integration/defaults_spec.rb @@ -175,18 +175,18 @@ it "should use the default serverport value when report port is unspecified" do Puppet.settings[:serverport] = "1234" - expect(Puppet.settings[:report_port]).to eq("1234") + expect(Puppet.settings[:report_port]).to eq(1234) end it "should use the default masterport value when report port is unspecified" do Puppet.settings[:masterport] = "1234" - expect(Puppet.settings[:report_port]).to eq("1234") + expect(Puppet.settings[:report_port]).to eq(1234) end it "should use report_port when set" do Puppet.settings[:serverport] = "1234" Puppet.settings[:report_port] = "5678" - expect(Puppet.settings[:report_port]).to eq("5678") + expect(Puppet.settings[:report_port]).to eq(5678) end end From 791950fb568219ff71adc54c9f29222fad7b0eed Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Thu, 29 Oct 2020 10:41:46 +0000 Subject: [PATCH 240/731] (packaging) Updating the puppet.pot file --- locales/puppet.pot | 74 +++++++++++++++++++++++++--------------------- 1 file changed, 41 insertions(+), 33 deletions(-) diff --git a/locales/puppet.pot b/locales/puppet.pot index f9410f4f3c4..2ee168d45e8 100644 --- a/locales/puppet.pot +++ b/locales/puppet.pot @@ -6,11 +6,11 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Puppet automation framework 6.19.1-378-g1ea1f3c274\n" +"Project-Id-Version: Puppet automation framework 6.19.1-404-g6fd33ed69c\n" "\n" "Report-Msgid-Bugs-To: https://tickets.puppetlabs.com\n" -"POT-Creation-Date: 2020-10-26 09:06+0000\n" -"PO-Revision-Date: 2020-10-26 09:06+0000\n" +"POT-Creation-Date: 2020-10-29 10:41+0000\n" +"PO-Revision-Date: 2020-10-29 10:41+0000\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -711,16 +711,16 @@ msgstr "" msgid "Setting 'environment_data_provider' is deprecated." msgstr "" -#: ../lib/puppet/defaults.rb:800 +#: ../lib/puppet/defaults.rb:802 msgid "Certificate names must be lower case" msgstr "" -#: ../lib/puppet/defaults.rb:1050 ../lib/puppet/settings/enum_setting.rb:13 ../lib/puppet/settings/symbolic_enum_setting.rb:14 +#: ../lib/puppet/defaults.rb:1053 ../lib/puppet/settings/enum_setting.rb:13 ../lib/puppet/settings/symbolic_enum_setting.rb:14 msgid "Invalid value '%{value}' for parameter %{name}. Allowed values are '%{allowed_values}'" msgstr "" #. TRANSLATORS 'pluginsync' is a setting and should not be translated -#: ../lib/puppet/defaults.rb:1888 +#: ../lib/puppet/defaults.rb:1895 msgid "Setting 'pluginsync' is deprecated." msgstr "" @@ -6743,15 +6743,15 @@ msgstr "" msgid "Waiting 5 seconds for runsvdir to discover service %{service}" msgstr "" -#: ../lib/puppet/provider/service/smf.rb:68 +#: ../lib/puppet/provider/service/smf.rb:120 msgid "Failed to get the FMRI of the %{service} service: The pattern '%{service}' matches multiple FMRIs! These are the FMRIs it matches: %{all_fmris}" msgstr "" -#: ../lib/puppet/provider/service/smf.rb:83 +#: ../lib/puppet/provider/service/smf.rb:135 msgid "Cannot query if the %{service} service is complete: The concept of complete/incomplete services was introduced in Solaris 11.1. You are on a Solaris %{release} machine." msgstr "" -#: ../lib/puppet/provider/service/smf.rb:182 +#: ../lib/puppet/provider/service/smf.rb:221 msgid "The %{service} service is incomplete so its status will be reported as :stopped. See `svcs -xv %{fmri}` for more details." msgstr "" @@ -7043,69 +7043,69 @@ msgstr "" msgid "Not attempting to load %{type} %{fqname} as this object was missing during a prior compilation" msgstr "" -#: ../lib/puppet/settings.rb:99 +#: ../lib/puppet/settings.rb:101 msgid "New environment loaders generated from the requested section." msgstr "" -#: ../lib/puppet/settings.rb:301 +#: ../lib/puppet/settings.rb:303 msgid "Attempting to initialize global default settings more than once!" msgstr "" -#: ../lib/puppet/settings.rb:514 +#: ../lib/puppet/settings.rb:516 msgid "Using --configprint is deprecated. Use 'puppet config ' instead." msgstr "" -#: ../lib/puppet/settings.rb:656 +#: ../lib/puppet/settings.rb:658 msgid "Could not load %{file}: %{detail}" msgstr "" -#: ../lib/puppet/settings.rb:762 +#: ../lib/puppet/settings.rb:766 msgid "Invalid setting type '%{type}'" msgstr "" -#: ../lib/puppet/settings.rb:917 +#: ../lib/puppet/settings.rb:921 msgid "Unknown searchpath case: %{source_type} for the %{source} settings path element." msgstr "" -#: ../lib/puppet/settings.rb:990 +#: ../lib/puppet/settings.rb:994 msgid "setting definition for '%{name}' is not a hash!" msgstr "" -#: ../lib/puppet/settings.rb:995 +#: ../lib/puppet/settings.rb:999 msgid "Setting %{name} is already defined" msgstr "" -#: ../lib/puppet/settings.rb:1001 +#: ../lib/puppet/settings.rb:1005 msgid "Setting %{name} is already using short name '%{short}'" msgstr "" -#: ../lib/puppet/settings.rb:1272 +#: ../lib/puppet/settings.rb:1276 msgid "Setting %{name} is deprecated." msgstr "" #. TRANSLATORS 'puppet.conf' is a file name and should not be translated -#: ../lib/puppet/settings.rb:1277 +#: ../lib/puppet/settings.rb:1281 msgid "Setting %{name} is deprecated in puppet.conf." msgstr "" -#: ../lib/puppet/settings.rb:1448 +#: ../lib/puppet/settings.rb:1452 msgid "Error converting value for param '%{name}': %{detail}" msgstr "" -#: ../lib/puppet/settings.rb:1472 +#: ../lib/puppet/settings.rb:1476 msgid "Could not find value for %{expression}" msgstr "" #. TRANSLATORS '$environment' is a Puppet specific variable and should not be translated -#: ../lib/puppet/settings.rb:1482 +#: ../lib/puppet/settings.rb:1486 msgid "You cannot interpolate $environment within '%{setting_name}' when using directory environments." msgstr "" -#: ../lib/puppet/settings.rb:1483 +#: ../lib/puppet/settings.rb:1487 msgid "Its value will remain %{value}." msgstr "" -#: ../lib/puppet/settings.rb:1514 +#: ../lib/puppet/settings.rb:1518 msgid "Attempt to assign a value to unknown setting %{name}" msgstr "" @@ -7118,38 +7118,38 @@ msgid "Invalid autosign value %{value}: must be 'true'/'false' or an absolute pa msgstr "" #. TRANSLATORS ':%{name}', ':call_hook', and ':on_write_only' should not be translated -#: ../lib/puppet/settings/base_setting.rb:15 +#: ../lib/puppet/settings/base_setting.rb:37 msgid "Setting :%{name} :call_hook is nil, defaulting to :on_write_only" msgstr "" #. TRANSLATORS 'call_hook' is a Puppet option name and should not be translated -#: ../lib/puppet/settings/base_setting.rb:20 +#: ../lib/puppet/settings/base_setting.rb:42 msgid "Invalid option %{value} for call_hook" msgstr "" #. TRANSLATORS ':call_hook' and ':hook' are specific setting names and should not be translated -#: ../lib/puppet/settings/base_setting.rb:77 +#: ../lib/puppet/settings/base_setting.rb:101 msgid "Cannot reference :call_hook for :%{name} if no :hook is defined" msgstr "" -#: ../lib/puppet/settings/base_setting.rb:83 +#: ../lib/puppet/settings/base_setting.rb:107 msgid "%{class_name} (setting '%{setting}') does not accept %{parameter}" msgstr "" -#: ../lib/puppet/settings/base_setting.rb:90 +#: ../lib/puppet/settings/base_setting.rb:114 msgid "You must provide a description for the %{class_name} config option" msgstr "" -#: ../lib/puppet/settings/base_setting.rb:104 +#: ../lib/puppet/settings/base_setting.rb:128 msgid "Short names can only be one character." msgstr "" #. TRANSLATORS 'deprecated' is a Puppet setting and ':completely' and ':allowed_on_commandline' are possible values and should not be translated -#: ../lib/puppet/settings/base_setting.rb:173 +#: ../lib/puppet/settings/base_setting.rb:197 msgid "Unsupported deprecated value '%{deprecation}'." msgstr "" -#: ../lib/puppet/settings/base_setting.rb:174 +#: ../lib/puppet/settings/base_setting.rb:198 msgid "Supported values for deprecated are ':completely' or ':allowed_on_commandline'" msgstr "" @@ -7227,6 +7227,14 @@ msgstr "" msgid "Expected an Array, String, or Hash, got a %{klass}" msgstr "" +#: ../lib/puppet/settings/integer_setting.rb:8 +msgid "Cannot convert '%{value}' to an integer for parameter: %{name}" +msgstr "" + +#: ../lib/puppet/settings/port_setting.rb:6 +msgid "Value '%{value}' is not a valid port number for parameter: %{name}" +msgstr "" + #: ../lib/puppet/settings/priority_setting.rb:40 msgid "Invalid priority format '%{value}' for parameter: %{name}" msgstr "" From 2a8d01bc8c4e1d4a0b4d99eff87eea0abc0c3f9a Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Thu, 29 Oct 2020 10:43:04 +0000 Subject: [PATCH 241/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index 3686709a0fc..a14a2ca775a 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -1141,7 +1141,7 @@ Setting a global value for \fBmanifest\fR in puppet\.conf is not allowed (but it The default port puppet subcommands use to communicate with Puppet Server\. (eg \fBpuppet facts upload\fR, \fBpuppet agent\fR)\. May be overridden by more specific settings (see \fBca_port\fR, \fBreport_port\fR)\. . .IP "\(bu" 4 -\fIDefault\fR: 8140 +\fIDefault\fR: $serverport . .IP "" 0 . From d61cf32faae73454d4b0dcc2f199466a457e8397 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Fri, 30 Oct 2020 17:52:45 +0000 Subject: [PATCH 242/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index a14a2ca775a..0a5f0799f4d 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -952,7 +952,7 @@ Where puppet agent stores the last run report summary in yaml format\. .IP "" 0 . .SS "lastrunreport" -Where puppet agent stores the last run report in yaml format\. +Where Puppet Agent stores the last run report, by default, in yaml format\. The format of the report can be changed by setting the \fBcache\fR key of the \fBreport\fR terminus in the routes\.yaml \fIhttps://puppet\.com/docs/puppet/latest/config_file_routes\.html\fR file\. To avoid mismatches between content and file extension, this setting needs to be manually updated to reflect the terminus changes\. . .IP "\(bu" 4 \fIDefault\fR: $statedir/last_run_report\.yaml From e1ae34b6b9958474c60caebb1ecf37eedc37d070 Mon Sep 17 00:00:00 2001 From: Tony Vu Date: Fri, 30 Oct 2020 10:46:06 -0700 Subject: [PATCH 243/731] (PUP-10720) Update cadir setting for migration warnings This change updates the cadir default to warn users to run the puppetserver ca tool to migrate the ca directory from under a `puppet/ssl/` to the new default `puppetserver/ca` location. --- lib/puppet/defaults.rb | 44 +++++++++++++++++++++- spec/unit/defaults_spec.rb | 75 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 118 insertions(+), 1 deletion(-) diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb index 6b5b0a1d4ef..70109750da6 100644 --- a/lib/puppet/defaults.rb +++ b/lib/puppet/defaults.rb @@ -32,6 +32,41 @@ def self.valid_file_checksum_types %w[sha256 sha256lite sha384 sha512 sha224 sha1 sha1lite md5 md5lite mtime ctime] end + def self.log_ca_migration_warning + urge_to_migrate = <<-UTM +The cadir is currently configured to be inside the #{Puppet[:ssldir]} directory. This config +setting and the directory location will not be used in a future version of puppet. Please run the +puppetserver ca tool to migrate out from the puppet confdir to the /etc/puppetlabs/puppetserver/ca +directory. Use `puppetserver ca migrate --help` for more info. +UTM + Puppet.warn_once('deprecations', + 'CA migration message', + urge_to_migrate, + :default, + :default) + end + + def self.default_cadir + return "" if Puppet::Util::Platform.windows? + old_ca_dir = "#{Puppet[:ssldir]}/ca" + new_ca_dir = "/etc/puppetlabs/puppetserver/ca" + + if File.exist?(old_ca_dir) + if File.symlink?(old_ca_dir) + target = File.readlink(old_ca_dir) + if target.start_with?(Puppet[:ssldir]) + Puppet.log_ca_migration_warning + end + target + else + Puppet.log_ca_migration_warning + old_ca_dir + end + else + new_ca_dir + end + end + def self.default_basemodulepath if Puppet::Util::Platform.windows? path = ['$codedir/modules'] @@ -1074,9 +1109,16 @@ def self.initialize_default_settings!(settings) :desc => "The name to use the Certificate Authority certificate.", }, :cadir => { - :default => "$ssldir/ca", + :default => lambda { default_cadir }, :type => :directory, :desc => "The root directory for the certificate authority.", + :call_hook => :on_initialize_and_write, + :hook => proc do |value| + if value.start_with?(Puppet[:ssldir]) + Puppet.log_ca_migration_warning + end + value + end }, :cacert => { :default => "$cadir/ca_crt.pem", diff --git a/spec/unit/defaults_spec.rb b/spec/unit/defaults_spec.rb index 0d9ac6cb7d7..585a96f9aa7 100644 --- a/spec/unit/defaults_spec.rb +++ b/spec/unit/defaults_spec.rb @@ -189,4 +189,79 @@ Puppet.initialize_settings end end + + describe "the call hook for the cadir setting", unless: Puppet::Util::Platform.windows? do + it 'does not warn when the cadir is outside the puppet ssldir' do + FileUtils.mkdir_p(Puppet[:confdir]) + # This is fun; in order to get the confdir setting from the spec_helper to + # not be deleted by the #unsafe_clear in Puppet::Settings#parse_config, + # we can code it into the confdir itself, and thus we can avoid getting + # that setting wiped out during Puppet.initialize_settings. + File.write(File.join(Puppet[:confdir], 'puppet.conf'), + "cadir = /my/cool/path/for/my/cadir\n + confdir = #{Puppet[:confdir]}") + expect(Puppet).to_not receive(:log_ca_migration_warning) + Puppet.initialize_settings + expect(Puppet[:cadir]).to eq("/my/cool/path/for/my/cadir") + end + + it 'does warn when the cadir is inside the puppet ssldir' do + FileUtils.mkdir_p(Puppet[:confdir]) + cadir_location = File.join(Puppet[:ssldir], 'still_inside_ssldir') + # This is fun; in order to get the confdir setting from the spec_helper to + # not be deleted by the #unsafe_clear in Puppet::Settings#parse_config, + # we can code it into the confdir itself, and thus we can avoid getting + # that setting wiped out during Puppet.initialize_settings. + File.write(File.join(Puppet[:confdir], 'puppet.conf'), + "cadir = #{cadir_location}\n + confdir = #{Puppet[:confdir]}") + expect(Puppet).to receive(:log_ca_migration_warning).twice + Puppet.initialize_settings + expect(Puppet[:cadir]).to eq(cadir_location) + end + end + + describe "the default cadir", :unless => Puppet::Util::Platform.windows? do + it 'defaults to the puppetserver confdir' do + Puppet.initialize_settings + expect(Puppet[:cadir]).to eq('/etc/puppetlabs/puppetserver/ca') + end + + it 'returns an empty string for Windows platforms', :if => Puppet::Util::Platform.windows? do + Puppet.initialize_settings + expect(Puppet[:cadir]).to eq("") + end + end + + describe '#default_cadir', :unless => Puppet::Util::Platform.windows? do + it 'returns the new puppetserver directory when no ca dir is present' do + expect(Puppet).to_not receive(:log_ca_migration_warning) + expect(Puppet.default_cadir).to eq('/etc/puppetlabs/puppetserver/ca') + end + + it 'warns when a CA dir exists in the current ssldir' do + cadir = File.join(Puppet[:ssldir], 'ca') + FileUtils.mkdir_p(cadir) + expect(Puppet).to receive(:log_ca_migration_warning) + expect(Puppet.default_cadir).to eq(cadir) + end + + it 'warns when the cadir is a symlink still inside the ssldir' do + another_dir = File.join(Puppet[:ssldir], 'another_dir') + cadir = File.join(Puppet[:ssldir], 'ca') + FileUtils.mkdir_p(another_dir) + File.symlink(another_dir, cadir) + expect(Puppet).to receive(:log_ca_migration_warning) + expect(Puppet.default_cadir).to eq(another_dir) + end + + it 'does not warn when the cadir is a symlink targeted outside the ssldir' do + another_dir = Dir.mktmpdir + cadir = File.join(Puppet[:ssldir], 'ca') + FileUtils.mkdir_p(Puppet[:ssldir]) + File.symlink(another_dir, cadir) + expect(Puppet).to_not receive(:log_ca_migration_warning) + expect(Puppet.default_cadir).to eq(another_dir) + end + end end From 2117ee236f5ed840bc180a2528d37844dd88fb4c Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Tue, 3 Nov 2020 01:07:31 +0000 Subject: [PATCH 244/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 4 ++-- man/man8/puppet-agent.8 | 2 +- man/man8/puppet-apply.8 | 2 +- man/man8/puppet-catalog.8 | 2 +- man/man8/puppet-config.8 | 2 +- man/man8/puppet-describe.8 | 2 +- man/man8/puppet-device.8 | 2 +- man/man8/puppet-doc.8 | 2 +- man/man8/puppet-epp.8 | 2 +- man/man8/puppet-facts.8 | 2 +- man/man8/puppet-filebucket.8 | 2 +- man/man8/puppet-generate.8 | 2 +- man/man8/puppet-help.8 | 2 +- man/man8/puppet-lookup.8 | 2 +- man/man8/puppet-module.8 | 2 +- man/man8/puppet-node.8 | 2 +- man/man8/puppet-parser.8 | 2 +- man/man8/puppet-plugin.8 | 2 +- man/man8/puppet-report.8 | 2 +- man/man8/puppet-resource.8 | 2 +- man/man8/puppet-script.8 | 2 +- man/man8/puppet-ssl.8 | 2 +- man/man8/puppet.8 | 2 +- 23 files changed, 24 insertions(+), 24 deletions(-) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index 0a5f0799f4d..ddf43632613 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPETCONF" "5" "October 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPETCONF" "5" "November 2020" "Puppet, Inc." "Puppet manual" \fBThis page is autogenerated; any changes will get overwritten\fR . .SH "Configuration settings" @@ -189,7 +189,7 @@ The certificate revocation list (CRL) for the CA\. The root directory for the certificate authority\. . .IP "\(bu" 4 -\fIDefault\fR: $ssldir/ca +\fIDefault\fR: /etc/puppetlabs/puppetserver/ca . .IP "" 0 . diff --git a/man/man8/puppet-agent.8 b/man/man8/puppet-agent.8 index 9182ab6763b..0456f634ff2 100644 --- a/man/man8/puppet-agent.8 +++ b/man/man8/puppet-agent.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-AGENT" "8" "October 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-AGENT" "8" "November 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-agent\fR \- The puppet agent daemon diff --git a/man/man8/puppet-apply.8 b/man/man8/puppet-apply.8 index 9d53a6e7e35..905f5718ae1 100644 --- a/man/man8/puppet-apply.8 +++ b/man/man8/puppet-apply.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-APPLY" "8" "October 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-APPLY" "8" "November 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-apply\fR \- Apply Puppet manifests locally diff --git a/man/man8/puppet-catalog.8 b/man/man8/puppet-catalog.8 index f1015fa22f7..c4e18ee6ef5 100644 --- a/man/man8/puppet-catalog.8 +++ b/man/man8/puppet-catalog.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-CATALOG" "8" "October 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-CATALOG" "8" "November 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-catalog\fR \- Compile, save, view, and convert catalogs\. diff --git a/man/man8/puppet-config.8 b/man/man8/puppet-config.8 index 66f3b0b2468..87d64485532 100644 --- a/man/man8/puppet-config.8 +++ b/man/man8/puppet-config.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-CONFIG" "8" "October 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-CONFIG" "8" "November 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-config\fR \- Interact with Puppet\'s settings\. diff --git a/man/man8/puppet-describe.8 b/man/man8/puppet-describe.8 index 4140615653d..8ee988e19f1 100644 --- a/man/man8/puppet-describe.8 +++ b/man/man8/puppet-describe.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-DESCRIBE" "8" "October 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-DESCRIBE" "8" "November 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-describe\fR \- Display help about resource types diff --git a/man/man8/puppet-device.8 b/man/man8/puppet-device.8 index 9e0e270df7f..81a73d6fd25 100644 --- a/man/man8/puppet-device.8 +++ b/man/man8/puppet-device.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-DEVICE" "8" "October 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-DEVICE" "8" "November 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-device\fR \- Manage remote network devices diff --git a/man/man8/puppet-doc.8 b/man/man8/puppet-doc.8 index f4c18b79c93..9bc99e3c5f5 100644 --- a/man/man8/puppet-doc.8 +++ b/man/man8/puppet-doc.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-DOC" "8" "October 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-DOC" "8" "November 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-doc\fR \- Generate Puppet references diff --git a/man/man8/puppet-epp.8 b/man/man8/puppet-epp.8 index a442da453f6..90b15bdb69f 100644 --- a/man/man8/puppet-epp.8 +++ b/man/man8/puppet-epp.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-EPP" "8" "October 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-EPP" "8" "November 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-epp\fR \- Interact directly with the EPP template parser/renderer\. diff --git a/man/man8/puppet-facts.8 b/man/man8/puppet-facts.8 index e3f21f6ef3c..96a428115b2 100644 --- a/man/man8/puppet-facts.8 +++ b/man/man8/puppet-facts.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-FACTS" "8" "October 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-FACTS" "8" "November 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-facts\fR \- Retrieve and store facts\. diff --git a/man/man8/puppet-filebucket.8 b/man/man8/puppet-filebucket.8 index 84c9306d17f..f2bee3d1f96 100644 --- a/man/man8/puppet-filebucket.8 +++ b/man/man8/puppet-filebucket.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-FILEBUCKET" "8" "October 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-FILEBUCKET" "8" "November 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-filebucket\fR \- Store and retrieve files in a filebucket diff --git a/man/man8/puppet-generate.8 b/man/man8/puppet-generate.8 index d64e0237747..ee2b58bf173 100644 --- a/man/man8/puppet-generate.8 +++ b/man/man8/puppet-generate.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-GENERATE" "8" "October 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-GENERATE" "8" "November 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-generate\fR \- Generates Puppet code from Ruby definitions\. diff --git a/man/man8/puppet-help.8 b/man/man8/puppet-help.8 index c9e2a554926..095f9fb78f2 100644 --- a/man/man8/puppet-help.8 +++ b/man/man8/puppet-help.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-HELP" "8" "October 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-HELP" "8" "November 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-help\fR \- Display Puppet help\. diff --git a/man/man8/puppet-lookup.8 b/man/man8/puppet-lookup.8 index a1d7a016630..b383c646c13 100644 --- a/man/man8/puppet-lookup.8 +++ b/man/man8/puppet-lookup.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-LOOKUP" "8" "October 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-LOOKUP" "8" "November 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-lookup\fR \- Interactive Hiera lookup diff --git a/man/man8/puppet-module.8 b/man/man8/puppet-module.8 index b71a65ff5b2..9a8106db702 100644 --- a/man/man8/puppet-module.8 +++ b/man/man8/puppet-module.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-MODULE" "8" "October 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-MODULE" "8" "November 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-module\fR \- Creates, installs and searches for modules on the Puppet Forge\. diff --git a/man/man8/puppet-node.8 b/man/man8/puppet-node.8 index ba4a83778ba..578b7f71b97 100644 --- a/man/man8/puppet-node.8 +++ b/man/man8/puppet-node.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-NODE" "8" "October 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-NODE" "8" "November 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-node\fR \- View and manage node definitions\. diff --git a/man/man8/puppet-parser.8 b/man/man8/puppet-parser.8 index bbc5cd78d51..b76f609930a 100644 --- a/man/man8/puppet-parser.8 +++ b/man/man8/puppet-parser.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-PARSER" "8" "October 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-PARSER" "8" "November 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-parser\fR \- Interact directly with the parser\. diff --git a/man/man8/puppet-plugin.8 b/man/man8/puppet-plugin.8 index 0dd166c2ff4..1b5585f0048 100644 --- a/man/man8/puppet-plugin.8 +++ b/man/man8/puppet-plugin.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-PLUGIN" "8" "October 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-PLUGIN" "8" "November 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-plugin\fR \- Interact with the Puppet plugin system\. diff --git a/man/man8/puppet-report.8 b/man/man8/puppet-report.8 index 50e134b164c..77f4c00dab7 100644 --- a/man/man8/puppet-report.8 +++ b/man/man8/puppet-report.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-REPORT" "8" "October 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-REPORT" "8" "November 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-report\fR \- Create, display, and submit reports\. diff --git a/man/man8/puppet-resource.8 b/man/man8/puppet-resource.8 index 11e6d8c4845..c699e9c7c11 100644 --- a/man/man8/puppet-resource.8 +++ b/man/man8/puppet-resource.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-RESOURCE" "8" "October 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-RESOURCE" "8" "November 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-resource\fR \- The resource abstraction layer shell diff --git a/man/man8/puppet-script.8 b/man/man8/puppet-script.8 index 500b14f2d58..c5c9d545953 100644 --- a/man/man8/puppet-script.8 +++ b/man/man8/puppet-script.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-SCRIPT" "8" "October 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-SCRIPT" "8" "November 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-script\fR \- Run a puppet manifests as a script without compiling a catalog diff --git a/man/man8/puppet-ssl.8 b/man/man8/puppet-ssl.8 index 4b21a4eaf71..9b93b6635f0 100644 --- a/man/man8/puppet-ssl.8 +++ b/man/man8/puppet-ssl.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-SSL" "8" "October 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-SSL" "8" "November 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-ssl\fR \- Manage SSL keys and certificates for puppet SSL clients diff --git a/man/man8/puppet.8 b/man/man8/puppet.8 index f8356806f44..6aa9e2bc509 100644 --- a/man/man8/puppet.8 +++ b/man/man8/puppet.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET" "8" "October 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET" "8" "November 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\fR From 57f712546b6ae2d840bc3bc92c14842754380dc9 Mon Sep 17 00:00:00 2001 From: Luchian Nemes Date: Wed, 4 Nov 2020 12:21:05 +0200 Subject: [PATCH 245/731] (PUP-10627) Add default file permissions 640 for last_run_summary.yaml Due to security concerns, this commit downgrades file permissions for `last_run_summary.yaml` from `644` to `640`. This allows only file owner and its group access to it by default. --- .../tests/agent/last_run_summary_report.rb | 22 ++++++++++++++----- lib/puppet/defaults.rb | 2 +- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/acceptance/tests/agent/last_run_summary_report.rb b/acceptance/tests/agent/last_run_summary_report.rb index 9852fac71a9..0fd51758ab7 100644 --- a/acceptance/tests/agent/last_run_summary_report.rb +++ b/acceptance/tests/agent/last_run_summary_report.rb @@ -50,7 +50,7 @@ end end - step "Check if the 'last_run_summary.yaml' report file created has '0644' permissions" do + step "Check if the 'last_run_summary.yaml' report file created has '0640' permissions" do if agent['platform'] =~ /windows/ on(agent, "icacls #{File.join(publicdir, 'last_run_summary.yaml')}") do |result| # Linux 'Owner' premissions class equivalent @@ -58,11 +58,16 @@ # Linux 'Group' permissions class equivalent assert_match('None:(R)', result.stdout) # Linux 'Public' permissions class equivalent - assert_match('Everyone:(R)', result.stdout) + assert_match('Everyone:(Rc,S,RA)', result.stdout) + # According to icacls docs: + # Rc = Read control + # S = Synchronize + # RA = Read attributes + # More at https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/icacls end else on(agent, "ls -al #{publicdir}") do |result| - assert_match(/rw-r--r--.+last_run_summary\.yaml$/, result.stdout) + assert_match(/rw-r-----.+last_run_summary\.yaml$/, result.stdout) end end end @@ -86,7 +91,7 @@ end end - step "Check if the 'last_run_summary.yaml' report file was created in the new location and still has '0644' permissions" do + step "Check if the 'last_run_summary.yaml' report file was created in the new location and still has '0640' permissions" do if agent['platform'] =~ /windows/ on(agent, "icacls #{File.join(custom_publicdir, 'last_run_summary.yaml')}") do |result| # Linux 'Owner' premissions class equivalent @@ -94,11 +99,16 @@ # Linux 'Group' permissions class equivalent assert_match('None:(R)', result.stdout) # Linux 'Public' permissions class equivalent - assert_match('Everyone:(R)', result.stdout) + assert_match('Everyone:(Rc,S,RA)', result.stdout) + # According to icacls docs: + # Rc = Read control + # S = Synchronize + # RA = Read attributes + # More at https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/icacls end else on(agent, "ls -al #{custom_publicdir}") do |result| - assert_match(/rw-r--r--.+last_run_summary\.yaml$/, result.stdout) + assert_match(/rw-r-----.+last_run_summary\.yaml$/, result.stdout) end end end diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb index 91abb1e7674..1f2d6ddbc11 100644 --- a/lib/puppet/defaults.rb +++ b/lib/puppet/defaults.rb @@ -1809,7 +1809,7 @@ def self.initialize_default_settings!(settings) :lastrunfile => { :default => "$publicdir/last_run_summary.yaml", :type => :file, - :mode => "0644", + :mode => "0640", :desc => "Where puppet agent stores the last run report summary in yaml format." }, :lastrunreport => { From b613e3624fd6c34dcd3142367630c8b7bb819da5 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Mon, 9 Nov 2020 13:39:49 +0000 Subject: [PATCH 246/731] (packaging) Bump to version '7.1.0' [no-promote] --- .gemspec | 2 +- lib/puppet/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gemspec b/.gemspec index ba06deedebe..da899e58b92 100644 --- a/.gemspec +++ b/.gemspec @@ -13,7 +13,7 @@ Gem::Specification.new do |s| s.name = "puppet" - version = "7.0.0" + version = "7.1.0" mdata = version.match(/(\d+\.\d+\.\d+)/) s.version = mdata ? mdata[1] : version diff --git a/lib/puppet/version.rb b/lib/puppet/version.rb index 305bd09f51c..674db86a3b2 100644 --- a/lib/puppet/version.rb +++ b/lib/puppet/version.rb @@ -6,7 +6,7 @@ # Raketasks and such to set the version based on the output of `git describe` module Puppet - PUPPETVERSION = '7.0.0' + PUPPETVERSION = '7.1.0' ## # version is a public API method intended to always provide a fast and From 1af4a1ad62ec73a1c58cc5f3d073d23a7f889e65 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Mon, 9 Nov 2020 13:57:43 +0000 Subject: [PATCH 247/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 2 +- man/man8/puppet.8 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index ddf43632613..215e04e0e5c 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -899,7 +899,7 @@ The time to wait for data to be read from an HTTP connection\. If nothing is rea The HTTP User\-Agent string to send when making network requests\. . .IP "\(bu" 4 -\fIDefault\fR: Puppet/7\.0\.0 Ruby/2\.5\.1\-p57 (x86_64\-linux) +\fIDefault\fR: Puppet/7\.1\.0 Ruby/2\.5\.1\-p57 (x86_64\-linux) . .IP "" 0 . diff --git a/man/man8/puppet.8 b/man/man8/puppet.8 index 6aa9e2bc509..42fc5a576f1 100644 --- a/man/man8/puppet.8 +++ b/man/man8/puppet.8 @@ -25,4 +25,4 @@ Specialized: 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 . .P -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\.0\.0 +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\.1\.0 From 7b82d9a661a0455559968adba964a2a7f0eaaaf7 Mon Sep 17 00:00:00 2001 From: gimmy Date: Thu, 19 Nov 2020 16:47:54 +0200 Subject: [PATCH 248/731] (PUP-10774) Do not query all groups/users `get_posix_value` method checks if the user/group that is added in the manifest corresponds with the user/group retrieved from system. If they differ, a full query is executed to retrieve all the users/groups and match them with the required value. This commit adds an extra check, for the case when multiple users/groups have a same identifier(uid/gid) In this case a full query is not needed, and the found identifier is returned. --- lib/puppet/util/posix.rb | 11 ++++++++++- spec/unit/util/posix_spec.rb | 19 +++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/lib/puppet/util/posix.rb b/lib/puppet/util/posix.rb index 1b0718b12ef..8e6e30bbaf2 100644 --- a/lib/puppet/util/posix.rb +++ b/lib/puppet/util/posix.rb @@ -144,8 +144,17 @@ def get_posix_value(location, id_field, field) name = get_posix_field(location, :name, id) check_value = name end + if check_value != field - return search_posix_field(location, id_field, field) + check_value_id = get_posix_field(location, id_field, check_value) + + if id == check_value_id + Puppet.debug("Multiple entries found for resource: '#{location}' with #{id_field}: #{id}") + return id + else + Puppet.debug("The value retrieved: '#{check_value}' is different than the required state: '#{field}', searching in all entries") + return search_posix_field(location, id_field, field) + end else return id end diff --git a/spec/unit/util/posix_spec.rb b/spec/unit/util/posix_spec.rb index ad8cd92e4b3..100e23b8854 100644 --- a/spec/unit/util/posix_spec.rb +++ b/spec/unit/util/posix_spec.rb @@ -189,6 +189,16 @@ class PosixTest expect(@posix.gid("asdf")).to eq(100) end + it "returns the id without full groups query if multiple groups have the same id" do + expect(@posix).to receive(:get_posix_field).with(:group, :gid, "asdf").and_return(100) + expect(@posix).to receive(:get_posix_field).with(:group, :name, 100).and_return("boo") + expect(@posix).to receive(:get_posix_field).with(:group, :gid, "boo").and_return(100) + + expect(@posix).not_to receive(:search_posix_field) + expect(@posix.gid("asdf")).to eq(100) + end + + it "should use :search_posix_field if the discovered name does not match the passed-in name" do expect(@posix).to receive(:get_posix_field).with(:group, :gid, "asdf").and_return(100) expect(@posix).to receive(:get_posix_field).with(:group, :name, 100).and_return("boo") @@ -265,6 +275,15 @@ class PosixTest expect(@posix.uid("asdf")).to eq(100) end + it "returns the id without full users query if multiple users have the same id" do + expect(@posix).to receive(:get_posix_field).with(:passwd, :uid, "asdf").and_return(100) + expect(@posix).to receive(:get_posix_field).with(:passwd, :name, 100).and_return("boo") + expect(@posix).to receive(:get_posix_field).with(:passwd, :uid, "boo").and_return(100) + + expect(@posix).not_to receive(:search_posix_field) + expect(@posix.uid("asdf")).to eq(100) + end + it "should use :search_posix_field if the discovered name does not match the passed-in name" do expect(@posix).to receive(:get_posix_field).with(:passwd, :uid, "asdf").and_return(100) expect(@posix).to receive(:get_posix_field).with(:passwd, :name, 100).and_return("boo") From 8e054afba2643218049b8711069264e4d9c311ae Mon Sep 17 00:00:00 2001 From: Justin Stoller Date: Thu, 19 Nov 2020 10:36:12 -0800 Subject: [PATCH 249/731] (PUP-10786) Update puppet node clean for ca-cli 2 Previously, the puppet node clean action called the PuppetServer CA CLI as a library to clean certs. To do so it implemented a bridge between the CA library's logger and Puppet's logger. That implementation only included those methods used by the CA's clean action. However, in the most recent version of the CA it will now also `warn` if the cadir is in the legacy location (like Puppet proper does). This patch implements the remaining API for the CA's logger (debug and warn). It also filters out the warning from the CA library for a cadir nested w/in the ssldir, as Puppet should have already warned about that if needed. --- Gemfile | 2 +- lib/puppet/face/node/clean.rb | 8 ++++++++ spec/unit/face/node_spec.rb | 16 ++++++++++++++-- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 9ba41f5fb04..3daf552a7ce 100644 --- a/Gemfile +++ b/Gemfile @@ -33,7 +33,7 @@ group(:features) do # gem 'ruby-augeas', require: false, platforms: [:ruby] # requires native ldap headers/libs # gem 'ruby-ldap', '~> 0.9', require: false, platforms: [:ruby] - gem 'puppetserver-ca', '~> 1.1', require: false + gem 'puppetserver-ca', '~> 2.0', require: false end group(:test) do diff --git a/lib/puppet/face/node/clean.rb b/lib/puppet/face/node/clean.rb index 9f93f27f854..31256a0d62e 100644 --- a/lib/puppet/face/node/clean.rb +++ b/lib/puppet/face/node/clean.rb @@ -47,6 +47,14 @@ def cleanup(node) end class LoggerIO + def debug(message) + Puppet.debug(message) + end + + def warn(message) + Puppet.warning(message) unless message =~ /cadir is currently configured to be inside/ + end + def err(message) Puppet.err(message) unless message =~ /^\s*Error:\s*/ end diff --git a/spec/unit/face/node_spec.rb b/spec/unit/face/node_spec.rb index afcc2f164a4..99f4314414d 100644 --- a/spec/unit/face/node_spec.rb +++ b/spec/unit/face/node_spec.rb @@ -89,8 +89,20 @@ describe "when cleaning certificate", :if => Puppet.features.puppetserver_ca? do it "should call the CA CLI gem's clean action" do - expect_any_instance_of(Puppetserver::Ca::Action::Clean).to receive(:run).with({ 'certnames' => ['hostname'] }).and_return(0) - subject.clean_cert('hostname') + expect_any_instance_of(Puppetserver::Ca::Action::Clean). + to receive(:clean_certs). + with(['hostname'], anything). + and_return(:success) + + if Puppet[:cadir].start_with?(Puppet[:ssldir]) + expect_any_instance_of(LoggerIO). + to receive(:warn). + with(/cadir is currently configured to be inside/) + end + + expect(Puppet).not_to receive(:warning) + result = subject.clean_cert('hostname') + expect(result).to eq(0) end it "should not call the CA CLI gem's clean action if the gem is missing" do From 96029b003cfbb5303426cbc110f350a0d4b6af06 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Wed, 2 Dec 2020 12:53:13 +0000 Subject: [PATCH 250/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 2 +- man/man8/puppet-agent.8 | 2 +- man/man8/puppet-apply.8 | 2 +- man/man8/puppet-catalog.8 | 2 +- man/man8/puppet-config.8 | 2 +- man/man8/puppet-describe.8 | 2 +- man/man8/puppet-device.8 | 2 +- man/man8/puppet-doc.8 | 2 +- man/man8/puppet-epp.8 | 2 +- man/man8/puppet-facts.8 | 2 +- man/man8/puppet-filebucket.8 | 2 +- man/man8/puppet-generate.8 | 2 +- man/man8/puppet-help.8 | 2 +- man/man8/puppet-lookup.8 | 2 +- man/man8/puppet-module.8 | 2 +- man/man8/puppet-node.8 | 2 +- man/man8/puppet-parser.8 | 2 +- man/man8/puppet-plugin.8 | 2 +- man/man8/puppet-report.8 | 2 +- man/man8/puppet-resource.8 | 2 +- man/man8/puppet-script.8 | 2 +- man/man8/puppet-ssl.8 | 2 +- man/man8/puppet.8 | 2 +- 23 files changed, 23 insertions(+), 23 deletions(-) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index 215e04e0e5c..fd1084334d2 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPETCONF" "5" "November 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPETCONF" "5" "December 2020" "Puppet, Inc." "Puppet manual" \fBThis page is autogenerated; any changes will get overwritten\fR . .SH "Configuration settings" diff --git a/man/man8/puppet-agent.8 b/man/man8/puppet-agent.8 index 0456f634ff2..3cd4ed674fb 100644 --- a/man/man8/puppet-agent.8 +++ b/man/man8/puppet-agent.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-AGENT" "8" "November 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-AGENT" "8" "December 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-agent\fR \- The puppet agent daemon diff --git a/man/man8/puppet-apply.8 b/man/man8/puppet-apply.8 index 905f5718ae1..9bd030c2700 100644 --- a/man/man8/puppet-apply.8 +++ b/man/man8/puppet-apply.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-APPLY" "8" "November 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-APPLY" "8" "December 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-apply\fR \- Apply Puppet manifests locally diff --git a/man/man8/puppet-catalog.8 b/man/man8/puppet-catalog.8 index c4e18ee6ef5..e7e86d5164b 100644 --- a/man/man8/puppet-catalog.8 +++ b/man/man8/puppet-catalog.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-CATALOG" "8" "November 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-CATALOG" "8" "December 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-catalog\fR \- Compile, save, view, and convert catalogs\. diff --git a/man/man8/puppet-config.8 b/man/man8/puppet-config.8 index 87d64485532..7aaa32b0e4e 100644 --- a/man/man8/puppet-config.8 +++ b/man/man8/puppet-config.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-CONFIG" "8" "November 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-CONFIG" "8" "December 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-config\fR \- Interact with Puppet\'s settings\. diff --git a/man/man8/puppet-describe.8 b/man/man8/puppet-describe.8 index 8ee988e19f1..34b4a8b9ca0 100644 --- a/man/man8/puppet-describe.8 +++ b/man/man8/puppet-describe.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-DESCRIBE" "8" "November 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-DESCRIBE" "8" "December 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-describe\fR \- Display help about resource types diff --git a/man/man8/puppet-device.8 b/man/man8/puppet-device.8 index 81a73d6fd25..ade7fcfa9f1 100644 --- a/man/man8/puppet-device.8 +++ b/man/man8/puppet-device.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-DEVICE" "8" "November 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-DEVICE" "8" "December 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-device\fR \- Manage remote network devices diff --git a/man/man8/puppet-doc.8 b/man/man8/puppet-doc.8 index 9bc99e3c5f5..3688a0229d4 100644 --- a/man/man8/puppet-doc.8 +++ b/man/man8/puppet-doc.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-DOC" "8" "November 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-DOC" "8" "December 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-doc\fR \- Generate Puppet references diff --git a/man/man8/puppet-epp.8 b/man/man8/puppet-epp.8 index 90b15bdb69f..cafbc6283d4 100644 --- a/man/man8/puppet-epp.8 +++ b/man/man8/puppet-epp.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-EPP" "8" "November 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-EPP" "8" "December 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-epp\fR \- Interact directly with the EPP template parser/renderer\. diff --git a/man/man8/puppet-facts.8 b/man/man8/puppet-facts.8 index 96a428115b2..2b0856efdce 100644 --- a/man/man8/puppet-facts.8 +++ b/man/man8/puppet-facts.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-FACTS" "8" "November 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-FACTS" "8" "December 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-facts\fR \- Retrieve and store facts\. diff --git a/man/man8/puppet-filebucket.8 b/man/man8/puppet-filebucket.8 index f2bee3d1f96..ad510dcaaa7 100644 --- a/man/man8/puppet-filebucket.8 +++ b/man/man8/puppet-filebucket.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-FILEBUCKET" "8" "November 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-FILEBUCKET" "8" "December 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-filebucket\fR \- Store and retrieve files in a filebucket diff --git a/man/man8/puppet-generate.8 b/man/man8/puppet-generate.8 index ee2b58bf173..1c67da5cdaa 100644 --- a/man/man8/puppet-generate.8 +++ b/man/man8/puppet-generate.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-GENERATE" "8" "November 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-GENERATE" "8" "December 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-generate\fR \- Generates Puppet code from Ruby definitions\. diff --git a/man/man8/puppet-help.8 b/man/man8/puppet-help.8 index 095f9fb78f2..80fcd7711fd 100644 --- a/man/man8/puppet-help.8 +++ b/man/man8/puppet-help.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-HELP" "8" "November 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-HELP" "8" "December 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-help\fR \- Display Puppet help\. diff --git a/man/man8/puppet-lookup.8 b/man/man8/puppet-lookup.8 index b383c646c13..3b247535ef0 100644 --- a/man/man8/puppet-lookup.8 +++ b/man/man8/puppet-lookup.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-LOOKUP" "8" "November 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-LOOKUP" "8" "December 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-lookup\fR \- Interactive Hiera lookup diff --git a/man/man8/puppet-module.8 b/man/man8/puppet-module.8 index 9a8106db702..aadf2a85e50 100644 --- a/man/man8/puppet-module.8 +++ b/man/man8/puppet-module.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-MODULE" "8" "November 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-MODULE" "8" "December 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-module\fR \- Creates, installs and searches for modules on the Puppet Forge\. diff --git a/man/man8/puppet-node.8 b/man/man8/puppet-node.8 index 578b7f71b97..2b8daef70a3 100644 --- a/man/man8/puppet-node.8 +++ b/man/man8/puppet-node.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-NODE" "8" "November 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-NODE" "8" "December 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-node\fR \- View and manage node definitions\. diff --git a/man/man8/puppet-parser.8 b/man/man8/puppet-parser.8 index b76f609930a..c25a8bd6a97 100644 --- a/man/man8/puppet-parser.8 +++ b/man/man8/puppet-parser.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-PARSER" "8" "November 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-PARSER" "8" "December 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-parser\fR \- Interact directly with the parser\. diff --git a/man/man8/puppet-plugin.8 b/man/man8/puppet-plugin.8 index 1b5585f0048..1e3c7804d46 100644 --- a/man/man8/puppet-plugin.8 +++ b/man/man8/puppet-plugin.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-PLUGIN" "8" "November 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-PLUGIN" "8" "December 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-plugin\fR \- Interact with the Puppet plugin system\. diff --git a/man/man8/puppet-report.8 b/man/man8/puppet-report.8 index 77f4c00dab7..0cf9544a808 100644 --- a/man/man8/puppet-report.8 +++ b/man/man8/puppet-report.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-REPORT" "8" "November 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-REPORT" "8" "December 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-report\fR \- Create, display, and submit reports\. diff --git a/man/man8/puppet-resource.8 b/man/man8/puppet-resource.8 index c699e9c7c11..264a32d6450 100644 --- a/man/man8/puppet-resource.8 +++ b/man/man8/puppet-resource.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-RESOURCE" "8" "November 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-RESOURCE" "8" "December 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-resource\fR \- The resource abstraction layer shell diff --git a/man/man8/puppet-script.8 b/man/man8/puppet-script.8 index c5c9d545953..5000c51bc98 100644 --- a/man/man8/puppet-script.8 +++ b/man/man8/puppet-script.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-SCRIPT" "8" "November 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-SCRIPT" "8" "December 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-script\fR \- Run a puppet manifests as a script without compiling a catalog diff --git a/man/man8/puppet-ssl.8 b/man/man8/puppet-ssl.8 index 9b93b6635f0..37ac3d91ff6 100644 --- a/man/man8/puppet-ssl.8 +++ b/man/man8/puppet-ssl.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-SSL" "8" "November 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-SSL" "8" "December 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-ssl\fR \- Manage SSL keys and certificates for puppet SSL clients diff --git a/man/man8/puppet.8 b/man/man8/puppet.8 index 42fc5a576f1..42d6b90eee3 100644 --- a/man/man8/puppet.8 +++ b/man/man8/puppet.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET" "8" "November 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET" "8" "December 2020" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\fR From 2c4e357a9b1eb0303ee4acb1d9baab3632678b83 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Wed, 2 Dec 2020 14:08:25 -0800 Subject: [PATCH 251/731] (PUP-10797) Add runtime dependency on scanf Previously, puppet had a dependency on the ruby `scanf` gem when running puppet from source, but not when running as a gem. To ensure transitive dependencies are resolved correctly, like when running puppetlabs-puppetdb specs against puppet as a gem, move the `scanf` dependency to `project_data.yaml`. Note the runtime dependency is only needed when running ruby 2.7 or up. If running on 2.5 or 2.6, then the `scanf` gem will be ignored, so there's no harm in including it. --- .gemspec | 1 + Gemfile | 2 -- ext/project_data.yaml | 1 + 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gemspec b/.gemspec index da899e58b92..0c7ac7cd687 100644 --- a/.gemspec +++ b/.gemspec @@ -38,6 +38,7 @@ Gem::Specification.new do |s| s.add_runtime_dependency(%q, "~> 1.13") s.add_runtime_dependency(%q, "~> 1.0") s.add_runtime_dependency(%q, "~> 1.0") + s.add_runtime_dependency(%q, "~> 1.0") # loads platform specific gems like ffi, win32 platform gems # as additional runtime dependencies diff --git a/Gemfile b/Gemfile index 3daf552a7ce..d67d6c2daac 100644 --- a/Gemfile +++ b/Gemfile @@ -18,8 +18,6 @@ gem "hiera", *location_for(ENV['HIERA_LOCATION']) if ENV.has_key?('HIERA_LOCATIO gem "semantic_puppet", *location_for(ENV['SEMANTIC_PUPPET_LOCATION'] || ["~> 1.0"]) gem "puppet-resource_api", *location_for(ENV['RESOURCE_API_LOCATION'] || ["~> 1.5"]) -gem "scanf" if RUBY_VERSION.to_f >= 2.7 - group(:features) do gem 'diff-lcs', '~> 1.3', require: false gem 'hiera-eyaml', *location_for(ENV['HIERA_EYAML_LOCATION']) diff --git a/ext/project_data.yaml b/ext/project_data.yaml index 3545c644deb..7027c6349f3 100644 --- a/ext/project_data.yaml +++ b/ext/project_data.yaml @@ -26,6 +26,7 @@ gem_runtime_dependencies: puppet-resource_api: '~>1.5' concurrent-ruby: '~> 1.0' deep_merge: '~> 1.0' + scanf: '~> 1.0' gem_rdoc_options: - --title - "Puppet - Configuration Management" From 6d085519f3a3bf49af882de44a25e7d01e13f1d6 Mon Sep 17 00:00:00 2001 From: Tony Vu Date: Tue, 8 Dec 2020 11:54:23 -0800 Subject: [PATCH 252/731] (PUP-10812) Remove chatty CA dir deprecation This change stops puppet from emitting CA dir deprecation warnings, but it still keeps the cadir defaulted to the puppetserver dir unless it already exists within the puppet/ssl dir. --- lib/puppet/defaults.rb | 28 +---------------- lib/puppet/face/node/clean.rb | 2 +- spec/unit/defaults_spec.rb | 57 +---------------------------------- 3 files changed, 3 insertions(+), 84 deletions(-) diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb index 1f2d6ddbc11..b6f43b2bebc 100644 --- a/lib/puppet/defaults.rb +++ b/lib/puppet/defaults.rb @@ -32,20 +32,6 @@ def self.valid_file_checksum_types %w[sha256 sha256lite sha384 sha512 sha224 sha1 sha1lite md5 md5lite mtime ctime] end - def self.log_ca_migration_warning - urge_to_migrate = <<-UTM -The cadir is currently configured to be inside the #{Puppet[:ssldir]} directory. This config -setting and the directory location will not be used in a future version of puppet. Please run the -puppetserver ca tool to migrate out from the puppet confdir to the /etc/puppetlabs/puppetserver/ca -directory. Use `puppetserver ca migrate --help` for more info. -UTM - Puppet.warn_once('deprecations', - 'CA migration message', - urge_to_migrate, - :default, - :default) - end - def self.default_cadir return "" if Puppet::Util::Platform.windows? old_ca_dir = "#{Puppet[:ssldir]}/ca" @@ -53,13 +39,8 @@ def self.default_cadir if File.exist?(old_ca_dir) if File.symlink?(old_ca_dir) - target = File.readlink(old_ca_dir) - if target.start_with?(Puppet[:ssldir]) - Puppet.log_ca_migration_warning - end - target + File.readlink(old_ca_dir) else - Puppet.log_ca_migration_warning old_ca_dir end else @@ -1112,13 +1093,6 @@ def self.initialize_default_settings!(settings) :default => lambda { default_cadir }, :type => :directory, :desc => "The root directory for the certificate authority.", - :call_hook => :on_initialize_and_write, - :hook => proc do |value| - if value.start_with?(Puppet[:ssldir]) - Puppet.log_ca_migration_warning - end - value - end }, :cacert => { :default => "$cadir/ca_crt.pem", diff --git a/lib/puppet/face/node/clean.rb b/lib/puppet/face/node/clean.rb index 31256a0d62e..08dce8e4ab6 100644 --- a/lib/puppet/face/node/clean.rb +++ b/lib/puppet/face/node/clean.rb @@ -52,7 +52,7 @@ def debug(message) end def warn(message) - Puppet.warning(message) unless message =~ /cadir is currently configured to be inside/ + Puppet.warning(message) end def err(message) diff --git a/spec/unit/defaults_spec.rb b/spec/unit/defaults_spec.rb index 585a96f9aa7..959d4360b75 100644 --- a/spec/unit/defaults_spec.rb +++ b/spec/unit/defaults_spec.rb @@ -190,39 +190,8 @@ end end - describe "the call hook for the cadir setting", unless: Puppet::Util::Platform.windows? do - it 'does not warn when the cadir is outside the puppet ssldir' do - FileUtils.mkdir_p(Puppet[:confdir]) - # This is fun; in order to get the confdir setting from the spec_helper to - # not be deleted by the #unsafe_clear in Puppet::Settings#parse_config, - # we can code it into the confdir itself, and thus we can avoid getting - # that setting wiped out during Puppet.initialize_settings. - File.write(File.join(Puppet[:confdir], 'puppet.conf'), - "cadir = /my/cool/path/for/my/cadir\n - confdir = #{Puppet[:confdir]}") - expect(Puppet).to_not receive(:log_ca_migration_warning) - Puppet.initialize_settings - expect(Puppet[:cadir]).to eq("/my/cool/path/for/my/cadir") - end - - it 'does warn when the cadir is inside the puppet ssldir' do - FileUtils.mkdir_p(Puppet[:confdir]) - cadir_location = File.join(Puppet[:ssldir], 'still_inside_ssldir') - # This is fun; in order to get the confdir setting from the spec_helper to - # not be deleted by the #unsafe_clear in Puppet::Settings#parse_config, - # we can code it into the confdir itself, and thus we can avoid getting - # that setting wiped out during Puppet.initialize_settings. - File.write(File.join(Puppet[:confdir], 'puppet.conf'), - "cadir = #{cadir_location}\n - confdir = #{Puppet[:confdir]}") - expect(Puppet).to receive(:log_ca_migration_warning).twice - Puppet.initialize_settings - expect(Puppet[:cadir]).to eq(cadir_location) - end - end - describe "the default cadir", :unless => Puppet::Util::Platform.windows? do - it 'defaults to the puppetserver confdir' do + it 'defaults to the puppetserver confdir when no cadir is found' do Puppet.initialize_settings expect(Puppet[:cadir]).to eq('/etc/puppetlabs/puppetserver/ca') end @@ -234,34 +203,10 @@ end describe '#default_cadir', :unless => Puppet::Util::Platform.windows? do - it 'returns the new puppetserver directory when no ca dir is present' do - expect(Puppet).to_not receive(:log_ca_migration_warning) - expect(Puppet.default_cadir).to eq('/etc/puppetlabs/puppetserver/ca') - end - it 'warns when a CA dir exists in the current ssldir' do cadir = File.join(Puppet[:ssldir], 'ca') FileUtils.mkdir_p(cadir) - expect(Puppet).to receive(:log_ca_migration_warning) expect(Puppet.default_cadir).to eq(cadir) end - - it 'warns when the cadir is a symlink still inside the ssldir' do - another_dir = File.join(Puppet[:ssldir], 'another_dir') - cadir = File.join(Puppet[:ssldir], 'ca') - FileUtils.mkdir_p(another_dir) - File.symlink(another_dir, cadir) - expect(Puppet).to receive(:log_ca_migration_warning) - expect(Puppet.default_cadir).to eq(another_dir) - end - - it 'does not warn when the cadir is a symlink targeted outside the ssldir' do - another_dir = Dir.mktmpdir - cadir = File.join(Puppet[:ssldir], 'ca') - FileUtils.mkdir_p(Puppet[:ssldir]) - File.symlink(another_dir, cadir) - expect(Puppet).to_not receive(:log_ca_migration_warning) - expect(Puppet.default_cadir).to eq(another_dir) - end end end From 85be0bf028f98c5a1d31c22958fd10811328f371 Mon Sep 17 00:00:00 2001 From: Luchian Nemes Date: Wed, 9 Dec 2020 12:06:13 +0200 Subject: [PATCH 253/731] (PUP-10790) Fix regex warnings introduced in Ruby 2.7 Ruby 2.7 introduced a warning for checking invalid objects (such as Integer in our case) against a regular expression. The check in this case would always return nil even though a valid String would respect the given regular expression, resulting in the possibility of unwanted behaviour. This commit replaces the check accordingly in the user type and keeps previous logic. --- lib/puppet/type/user.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/puppet/type/user.rb b/lib/puppet/type/user.rb index 0ff941a5007..cb9940c036f 100644 --- a/lib/puppet/type/user.rb +++ b/lib/puppet/type/user.rb @@ -465,7 +465,7 @@ def insync?(current) groups = obj.shouldorig if obj if groups groups = groups.collect { |group| - if group =~ /^\d+$/ + if group.is_a?(String) && group =~/^\d+$/ Integer(group) else group From 39ba3874e1321caf430af42d1b714ab9271ebcb9 Mon Sep 17 00:00:00 2001 From: Dorin Pleava Date: Thu, 10 Dec 2020 12:21:09 +0200 Subject: [PATCH 254/731] (maint) Fix parallel:spec, 0 failures but exit code 1 Running the `parallel:spec` rake task on Windows with Ruby v2.5 started to surface a constant issue in our tests: passing with 0 failures but always completing with exit code 1. The `should raise an error if the state file does not contain valid YAML and cannot be renamed` test from `storage_spec.rb` was forcing the `File.rename` method to raise a `SystemCallError` any time it was called as it didn't mention any specific arguments. Since this is a fairly common method, this, at some point, started being called more than once, before and apart from the case that the test was expecting, causing the code to quit unexpectedly and kill the parent thread of the parallel group that was currently running. This commit fixes the test by raising the needed `SystemCallError` when specific arguments are found and allowing the original `File.rename` method to be called. More information can be found in the pull request's description. --- spec/unit/util/storage_spec.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spec/unit/util/storage_spec.rb b/spec/unit/util/storage_spec.rb index 16da50b18ee..002b87717e1 100644 --- a/spec/unit/util/storage_spec.rb +++ b/spec/unit/util/storage_spec.rb @@ -143,9 +143,11 @@ def write_state_file(contents) end it "should raise an error if the state file does not contain valid YAML and cannot be renamed" do + allow(File).to receive(:rename).and_call_original + write_state_file('{ invalid') - expect(File).to receive(:rename).and_raise(SystemCallError) + expect(File).to receive(:rename).with(@state_file, "#{@state_file}.bad").and_raise(SystemCallError) expect { Puppet::Util::Storage.load }.to raise_error(Puppet::Error, /Could not rename/) end From cc790e7cd2a93b1153b827ed1f50e905f907c17c Mon Sep 17 00:00:00 2001 From: Luchian Nemes Date: Thu, 10 Dec 2020 15:45:58 +0200 Subject: [PATCH 255/731] (maint) Lock bundler version in GitHub Actions The release of bundler `2.2.0` is breaking some tests. This commit is temporarily locking bundler to version `2.1.4`. --- .github/workflows/rspec_tests.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/rspec_tests.yaml b/.github/workflows/rspec_tests.yaml index 8bd0c0b6c9f..02edacfb55f 100644 --- a/.github/workflows/rspec_tests.yaml +++ b/.github/workflows/rspec_tests.yaml @@ -33,7 +33,8 @@ jobs: - name: Install bundler and gems run: | - gem install bundler + gem uninstall bundler + gem install bundler -v '2.1.4' bundle config set without packaging documentation bundle install --jobs 4 --retry 3 From 466918f0b913a428edc19131cd75094861ebbe7b Mon Sep 17 00:00:00 2001 From: Dorin Pleava Date: Thu, 3 Dec 2020 13:39:39 +0200 Subject: [PATCH 256/731] (PUP-10773) Reroute master settings to server Master application settings will also be used on server application --- lib/puppet/application_support.rb | 7 +++++++ spec/unit/application_spec.rb | 34 +++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/lib/puppet/application_support.rb b/lib/puppet/application_support.rb index 9e5b6c94d1d..b3f8a7e09bf 100644 --- a/lib/puppet/application_support.rb +++ b/lib/puppet/application_support.rb @@ -53,6 +53,13 @@ def self.configure_indirector_routes(application_name) route_file = Puppet[:route_file] if Puppet::FileSystem.exist?(route_file) routes = Puppet::Util::Yaml.safe_load_file(route_file, [Symbol]) + if routes["server"] && routes["master"] + Puppet.warning("Route file #{route_file} contains both server and master route settings.") + elsif routes["server"] && !routes["master"] + routes["master"] = routes["server"] + elsif routes["master"] && !routes["server"] + routes["server"] = routes["master"] + end application_routes = routes[application_name] Puppet::Indirector.configure_routes(application_routes) if application_routes end diff --git a/spec/unit/application_spec.rb b/spec/unit/application_spec.rb index c56c78c5240..cbe4e03db55 100644 --- a/spec/unit/application_spec.rb +++ b/spec/unit/application_spec.rb @@ -511,6 +511,40 @@ def run_command expect { @app.configure_indirector_routes }.to raise_error(Puppet::Error, /mapping values are not allowed/) end + + it "should treat master routes on server application" do + allow(@app).to receive(:name).and_return("server") + + Puppet[:route_file] = tmpfile('routes') + File.open(Puppet[:route_file], 'w') do |f| + f.print <<-ROUTES + master: + node: + terminus: exec + ROUTES + end + + @app.configure_indirector_routes + + expect(Puppet::Node.indirection.terminus_class).to eq('exec') + end + + it "should treat server routes on master application" do + allow(@app).to receive(:name).and_return("master") + + Puppet[:route_file] = tmpfile('routes') + File.open(Puppet[:route_file], 'w') do |f| + f.print <<-ROUTES + server: + node: + terminus: exec + ROUTES + end + + @app.configure_indirector_routes + + expect(Puppet::Node.indirection.terminus_class).to eq('exec') + end end describe "when running" do From 262c50ca362d9bdf1bac87c2c2d545d1e4c1b858 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Sat, 12 Dec 2020 11:46:25 +0000 Subject: [PATCH 257/731] (packaging) Bump to version '7.2.0' [no-promote] --- .gemspec | 2 +- lib/puppet/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gemspec b/.gemspec index 0c7ac7cd687..a71b29d84e8 100644 --- a/.gemspec +++ b/.gemspec @@ -13,7 +13,7 @@ Gem::Specification.new do |s| s.name = "puppet" - version = "7.1.0" + version = "7.2.0" mdata = version.match(/(\d+\.\d+\.\d+)/) s.version = mdata ? mdata[1] : version diff --git a/lib/puppet/version.rb b/lib/puppet/version.rb index 674db86a3b2..6f1dfbe83b6 100644 --- a/lib/puppet/version.rb +++ b/lib/puppet/version.rb @@ -6,7 +6,7 @@ # Raketasks and such to set the version based on the output of `git describe` module Puppet - PUPPETVERSION = '7.1.0' + PUPPETVERSION = '7.2.0' ## # version is a public API method intended to always provide a fast and From f30ef97402f526ae9ca6be2038314c1f6f1fe17a Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Sat, 12 Dec 2020 11:52:50 +0000 Subject: [PATCH 258/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 2 +- man/man8/puppet.8 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index fd1084334d2..0baf580199e 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -899,7 +899,7 @@ The time to wait for data to be read from an HTTP connection\. If nothing is rea The HTTP User\-Agent string to send when making network requests\. . .IP "\(bu" 4 -\fIDefault\fR: Puppet/7\.1\.0 Ruby/2\.5\.1\-p57 (x86_64\-linux) +\fIDefault\fR: Puppet/7\.2\.0 Ruby/2\.5\.1\-p57 (x86_64\-linux) . .IP "" 0 . diff --git a/man/man8/puppet.8 b/man/man8/puppet.8 index 42d6b90eee3..0c9135568f1 100644 --- a/man/man8/puppet.8 +++ b/man/man8/puppet.8 @@ -25,4 +25,4 @@ Specialized: 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 . .P -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\.1\.0 +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\.2\.0 From ef4f356d005c8cd278124db7afe5986720c52b60 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Tue, 15 Dec 2020 15:23:35 +0000 Subject: [PATCH 259/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index 0baf580199e..78f3e0c6430 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -10,7 +10,7 @@ Each of these settings can be specified in \fBpuppet\.conf\fR or on the command line\. . .IP "\(bu" 4 -Puppet Enterprise (PE) and open source Puppet share the configuration settings that are documented here\. However, PE defaults for some settings differ from the open source Puppet defaults\. Some examples of settings that have different PE defaults include \fBdisable18n\fR, \fBenvironment_timeout\fR, \fBalways_retry_plugins\fR, and the Puppet Server JRuby \fBmax\-active\-instances\fR setting\. To verify PE configuration defaults, check the \fBpuppet\.conf\fR file after installation\. +Puppet Enterprise (PE) and open source Puppet share the configuration settings documented here\. However, PE defaults differ from open source defaults for some settings, such as \fBnode_terminus\fR, \fBstoreconfigs\fR, \fBalways_retry_plugins\fR, \fBdisable18n\fR, \fBenvironment_timeout\fR (when Code Manager is enabled), and the Puppet Server JRuby \fBmax\-active\-instances\fR setting\. To verify PE configuration defaults, check the \fBpuppet\.conf\fR or \fBpe\-puppet\-server\.conf\fR file after installation\. . .IP "\(bu" 4 When using boolean settings on the command line, use \fB\-\-setting\fR and \fB\-\-no\-setting\fR instead of \fB\-\-setting (true|false)\fR\. (Using \fB\-\-setting false\fR results in "Error: Could not parse application options: needless argument"\.) From dfa2b2429183dbedb704401561bc8cfad7aa1d30 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Tue, 5 Jan 2021 21:07:46 +0000 Subject: [PATCH 260/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 2 +- man/man8/puppet-facts.8 | 2 +- man/man8/puppet-filebucket.8 | 2 +- man/man8/puppet-module.8 | 2 +- man/man8/puppet.8 | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index 78f3e0c6430..26590ae6527 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPETCONF" "5" "December 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPETCONF" "5" "January 2021" "Puppet, Inc." "Puppet manual" \fBThis page is autogenerated; any changes will get overwritten\fR . .SH "Configuration settings" diff --git a/man/man8/puppet-facts.8 b/man/man8/puppet-facts.8 index 2b0856efdce..a95cf468716 100644 --- a/man/man8/puppet-facts.8 +++ b/man/man8/puppet-facts.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-FACTS" "8" "December 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-FACTS" "8" "January 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-facts\fR \- Retrieve and store facts\. diff --git a/man/man8/puppet-filebucket.8 b/man/man8/puppet-filebucket.8 index ad510dcaaa7..a3086ae0682 100644 --- a/man/man8/puppet-filebucket.8 +++ b/man/man8/puppet-filebucket.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-FILEBUCKET" "8" "December 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-FILEBUCKET" "8" "January 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-filebucket\fR \- Store and retrieve files in a filebucket diff --git a/man/man8/puppet-module.8 b/man/man8/puppet-module.8 index aadf2a85e50..51c1dd15cbd 100644 --- a/man/man8/puppet-module.8 +++ b/man/man8/puppet-module.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-MODULE" "8" "December 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-MODULE" "8" "January 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-module\fR \- Creates, installs and searches for modules on the Puppet Forge\. diff --git a/man/man8/puppet.8 b/man/man8/puppet.8 index 0c9135568f1..555b5d623d0 100644 --- a/man/man8/puppet.8 +++ b/man/man8/puppet.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET" "8" "December 2020" "Puppet, Inc." "Puppet manual" +.TH "PUPPET" "8" "January 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\fR From 944626e6a62b22affe5496aca5fa97481eb521b4 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Tue, 10 Nov 2020 00:49:45 -0800 Subject: [PATCH 261/731] (maint) Call set_facts on the scope in test Set facts directly on the scope (fact names can't be symbols). The `known_resource_types` method exists on the environment, not the resource. The test passed previously because the Resource#to_hash method behaves the same if the type or definition can't be found. --- spec/unit/resource_spec.rb | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/spec/unit/resource_spec.rb b/spec/unit/resource_spec.rb index 06f11300d0c..498442f865c 100644 --- a/spec/unit/resource_spec.rb +++ b/spec/unit/resource_spec.rb @@ -288,7 +288,7 @@ def ast_leaf(value) describe "when the resource type is :hostclass" do let(:environment_name) { "testing env" } - let(:fact_values) { { :a => 1 } } + let(:fact_values) { { 'a' => 1 } } let(:port) { Puppet::Parser::AST::Leaf.new(:value => '80') } def inject_and_set_defaults(resource, scope) @@ -297,10 +297,7 @@ def inject_and_set_defaults(resource, scope) before do environment.known_resource_types.add(apache) - - allow(scope).to receive(:host).and_return('host') - allow(scope).to receive(:environment).and_return(environment) - allow(scope).to receive(:facts).and_return(Puppet::Node::Facts.new("facts", fact_values)) + scope.set_facts(fact_values) end context 'with a default value expression' do @@ -571,11 +568,15 @@ def inject_and_set_defaults(resource, scope) expect(resource.to_hash[:myvar]).to eq("bob") end - it "should set :name to the title if :name is not present for non-builtin types" do - krt = Puppet::Resource::TypeCollection.new("myenv") - krt.add Puppet::Resource::Type.new(:definition, :foo) - resource = Puppet::Resource.new :foo, "bar" - allow(resource).to receive(:known_resource_types).and_return(krt) + it "should set :name to the title if :name is not present for non-existent types" do + resource = Puppet::Resource.new :doesnotexist, "bar" + expect(resource.to_hash[:name]).to eq("bar") + end + + it "should set :name to the title if :name is not present for a definition" do + type = Puppet::Resource::Type.new(:definition, :foo) + environment.known_resource_types.add(type) + resource = Puppet::Resource.new :foo, "bar", :environment => environment expect(resource.to_hash[:name]).to eq("bar") end end From e95d9ee78dbe7c0271738beb5e53194690dc5460 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Tue, 10 Nov 2020 15:44:16 -0800 Subject: [PATCH 262/731] (maint) Use a facter double The tests for lookup and external facts are passing when they shouldn't. Make a note of the issue. Create a double for the facter module, so we can stub the `value` method. respond_to may be called with additional arguments, if so, ignore them. --- spec/unit/util/logging_spec.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/unit/util/logging_spec.rb b/spec/unit/util/logging_spec.rb index 7f3b7f4ed49..4669701c0cd 100644 --- a/spec/unit/util/logging_spec.rb +++ b/spec/unit/util/logging_spec.rb @@ -552,7 +552,7 @@ def run(exception_class) describe 'does support debugging' do before :each do - allow(Facter).to receive(:respond_to?).with(:debugging).and_return(true) + allow(Facter).to receive(:respond_to?).with(:debugging, any_args).and_return(true) end it 'enables Facter debugging when debug level' do @@ -568,7 +568,7 @@ def run(exception_class) describe 'does support trace' do before :each do - allow(Facter).to receive(:respond_to?).with(:trace).and_return(true) + allow(Facter).to receive(:respond_to?).with(:trace, any_args).and_return(true) end it 'enables Facter trace when enabled' do @@ -584,7 +584,7 @@ def run(exception_class) describe 'does support on_message' do before :each do - allow(Facter).to receive(:respond_to?).with(:on_message).and_return(true) + allow(Facter).to receive(:respond_to?).with(:on_message, any_args).and_return(true) end def setup(level, message) From 763451d761e4dde9b17e037129cd1a8ed84e4b64 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Tue, 10 Nov 2020 15:52:52 -0800 Subject: [PATCH 263/731] (maint) Remove stubs for non-existent methods The following methods no longer exist, but we were stubbing them: Puppet.settraps Puppet::Application#get_command Puppet::FileServing::Configuration::Parser#add_modules_mount Puppet::FileServing::FileSet#stat Puppet::Network::DefaultAuthProvider#exists? Puppet::Network::HTTP::API::IndirectedRoutes#{handler,warn_if_near_expiration,check_authorization} Puppet::Node.{terminus_class=,cache_class=} Puppet::Node::Facts::Facter.reload_facter Puppet::SSL::Base.valid_certname Puppet::SSL::Key::File#ca? Puppet::Transaction#add_dynamically_generated_resources Puppet::Type::File::ParamContent#standalone? Puppet::Type::File::ParamSel*#normalize_selinux_category Puppet::Type::File::ParamSource#flush Puppet::Util.execute The following methods were not being called due to typos and instance vs class mismatches: Puppet.features.posix? Puppet::Parser::Scope#newscope Puppet::Transaction#retrieve Puppet::Util::Autoload.search_directories --- .../file_content/file_server_spec.rb | 2 -- .../file_metadata/file_server_spec.rb | 2 -- .../resource/type_collection_spec.rb | 8 ++----- spec/integration/transaction_spec.rb | 13 ++++------- spec/unit/application/agent_spec.rb | 1 - spec/unit/application/filebucket_spec.rb | 2 -- spec/unit/application_spec.rb | 7 ------ spec/unit/face/node_spec.rb | 11 ---------- .../file_serving/configuration/parser_spec.rb | 1 - spec/unit/indirector/face_spec.rb | 1 - spec/unit/indirector/facts/facter_spec.rb | 3 --- .../http/api/indirected_routes_spec.rb | 4 ---- spec/unit/parser/resource_spec.rb | 22 ++++++++++++------- spec/unit/provider/package/pip_spec.rb | 17 +++++--------- spec/unit/provider/package/pkgdmg_spec.rb | 4 ---- spec/unit/provider/user/hpux_spec.rb | 2 +- spec/unit/resource/type_spec.rb | 2 +- spec/unit/ssl/base_spec.rb | 1 - spec/unit/transaction_spec.rb | 14 ++++++++---- spec/unit/type/file/content_spec.rb | 1 - spec/unit/type/file/selinux_spec.rb | 2 -- spec/unit/type/file_spec.rb | 6 ----- spec/unit/type/tidy_spec.rb | 1 - spec/unit/type_spec.rb | 4 ++-- spec/unit/util/at_fork_spec.rb | 4 ++-- spec/unit/util/autoload_spec.rb | 2 +- spec/unit/util/backups_spec.rb | 3 +-- spec/unit/util_spec.rb | 8 +++---- 28 files changed, 48 insertions(+), 100 deletions(-) diff --git a/spec/integration/indirector/file_content/file_server_spec.rb b/spec/integration/indirector/file_content/file_server_spec.rb index 59f4a8ca08d..90326c2a1aa 100644 --- a/spec/integration/indirector/file_content/file_server_spec.rb +++ b/spec/integration/indirector/file_content/file_server_spec.rb @@ -86,8 +86,6 @@ # Use a real mount, so the integration is a bit deeper. mount1 = Puppet::FileServing::Configuration::Mount::File.new("one") - allow(mount1).to receive(:globalallow?).and_return(true) - allow(mount1).to receive(:allowed?).and_return(true) mount1.path = File.join(path, "%h") parser = double('parser', :changed? => false) diff --git a/spec/integration/indirector/file_metadata/file_server_spec.rb b/spec/integration/indirector/file_metadata/file_server_spec.rb index 46a4b205da6..328fb851d93 100644 --- a/spec/integration/indirector/file_metadata/file_server_spec.rb +++ b/spec/integration/indirector/file_metadata/file_server_spec.rb @@ -59,8 +59,6 @@ # Use a real mount, so the integration is a bit deeper. mount1 = Puppet::FileServing::Configuration::Mount::File.new("one") - allow(mount1).to receive(:globalallow?).and_return(true) - allow(mount1).to receive(:allowed?).and_return(true) mount1.path = File.join(env_path, "%h") parser = double('parser', :changed? => false) diff --git a/spec/integration/resource/type_collection_spec.rb b/spec/integration/resource/type_collection_spec.rb index 7c0ef9b5e9e..32a59af8ce2 100644 --- a/spec/integration/resource/type_collection_spec.rb +++ b/spec/integration/resource/type_collection_spec.rb @@ -11,12 +11,8 @@ @dir = tmpfile("autoload_testing") FileUtils.mkdir_p @dir - loader = Object.new - allow(loader).to receive(:load).and_return(nil) - allow(loader).to receive(:set_entry) - - loaders = Object.new - expect(loaders).to receive(:runtime3_type_loader).at_most(:once).and_return(loader) + loader = double('loader', load: nil, set_entry: nil) + loaders = double('loaders', runtime3_type_loader: loader) expect(Puppet::Pops::Loaders).to receive(:loaders).at_most(:once).and_return(loaders) environment = Puppet::Node::Environment.create(:env, [@dir]) diff --git a/spec/integration/transaction_spec.rb b/spec/integration/transaction_spec.rb index d23d58c8fd0..947ac1dfe36 100644 --- a/spec/integration/transaction_spec.rb +++ b/spec/integration/transaction_spec.rb @@ -61,7 +61,7 @@ def touch(path) transaction = Puppet::Transaction.new(catalog, nil, Puppet::Graph::SequentialPrioritizer.new) - expect(resource).not_to receive(:evaluate) + expect(resource).not_to receive(:retrieve) transaction.evaluate end @@ -86,7 +86,7 @@ def touch(path) transaction = Puppet::Transaction.new(catalog, nil, Puppet::Graph::SequentialPrioritizer.new) - expect(resource).not_to receive(:evaluate) + expect(resource).not_to receive(:retrieve) transaction.evaluate end @@ -315,16 +315,14 @@ def touch(path) file1 = tmpfile("file1") file2 = tmpfile("file2") + expect(Puppet::FileSystem).to_not be_exist(file2) + exec1 = Puppet::Type.type(:exec).new( :name => "exec1", :path => ENV["PATH"], :command => touch(file1), ) - allow(exec1).to receive(:eval_generate).and_return( - [ Puppet::Type.type(:notify).new(:name => "eval1_notify") ] - ) - exec2 = Puppet::Type.type(:exec).new( :name => "exec2", :path => ENV["PATH"], @@ -332,9 +330,6 @@ def touch(path) :refreshonly => true, :subscribe => exec1, ) - allow(exec2).to receive(:eval_generate).and_return( - [ Puppet::Type.type(:notify).new(:name => "eval2_notify") ] - ) Puppet[:tags] = "exec" catalog = mk_catalog(exec1, exec2) diff --git a/spec/unit/application/agent_spec.rb b/spec/unit/application/agent_spec.rb index 9cba622d6b6..d37848d2f65 100644 --- a/spec/unit/application/agent_spec.rb +++ b/spec/unit/application/agent_spec.rb @@ -202,7 +202,6 @@ allow(Puppet::Resource::Catalog.indirection).to receive(:terminus_class=) allow(Puppet::Resource::Catalog.indirection).to receive(:cache_class=) allow(Puppet::Node::Facts.indirection).to receive(:terminus_class=) - allow(Puppet).to receive(:settraps) end it "should not run with extra arguments" do diff --git a/spec/unit/application/filebucket_spec.rb b/spec/unit/application/filebucket_spec.rb index e058266c035..9b3b71d7033 100644 --- a/spec/unit/application/filebucket_spec.rb +++ b/spec/unit/application/filebucket_spec.rb @@ -42,7 +42,6 @@ describe "during setup" do before :each do allow(Puppet::Log).to receive(:newdestination) - allow(Puppet).to receive(:settraps) allow(Puppet::FileBucket::Dipper).to receive(:new) allow(@filebucket.options).to receive(:[]) end @@ -159,7 +158,6 @@ describe "when running" do before :each do allow(Puppet::Log).to receive(:newdestination) - allow(Puppet).to receive(:settraps) allow(Puppet::FileBucket::Dipper).to receive(:new) allow(@filebucket.options).to receive(:[]) diff --git a/spec/unit/application_spec.rb b/spec/unit/application_spec.rb index cbe4e03db55..070bed8a1be 100644 --- a/spec/unit/application_spec.rb +++ b/spec/unit/application_spec.rb @@ -594,13 +594,6 @@ def run_command end it "should raise an error if dispatch returns no command" do - allow(@app).to receive(:get_command).and_return(nil) - expect(Puppet).to receive(:send_log).with(:err, "Could not run: No valid command or main") - expect { @app.run }.to exit_with 1 - end - - it "should raise an error if dispatch returns an invalid command" do - allow(@app).to receive(:get_command).and_return(:this_function_doesnt_exist) expect(Puppet).to receive(:send_log).with(:err, "Could not run: No valid command or main") expect { @app.run }.to exit_with 1 end diff --git a/spec/unit/face/node_spec.rb b/spec/unit/face/node_spec.rb index 99f4314414d..e8a4528f696 100644 --- a/spec/unit/face/node_spec.rb +++ b/spec/unit/face/node_spec.rb @@ -15,13 +15,6 @@ end describe 'when running #clean' do - before :each do - allow(Puppet::Node::Facts.indirection).to receive(:terminus_class=) - allow(Puppet::Node::Facts.indirection).to receive(:cache_class=) - allow(Puppet::Node).to receive(:terminus_class=) - allow(Puppet::Node).to receive(:cache_class=) - end - it 'should invoke #cleanup' do expect(subject).to receive(:cleanup).with('hostname') subject.clean('hostname') @@ -30,10 +23,6 @@ describe "clean action" do before :each do - allow(Puppet::Node::Facts.indirection).to receive(:terminus_class=) - allow(Puppet::Node::Facts.indirection).to receive(:cache_class=) - allow(Puppet::Node).to receive(:terminus_class=) - allow(Puppet::Node).to receive(:cache_class=) allow(subject).to receive(:cleanup) end diff --git a/spec/unit/file_serving/configuration/parser_spec.rb b/spec/unit/file_serving/configuration/parser_spec.rb index eb7c9ee790e..8e11f1bb5a2 100644 --- a/spec/unit/file_serving/configuration/parser_spec.rb +++ b/spec/unit/file_serving/configuration/parser_spec.rb @@ -87,7 +87,6 @@ def write_config_file(content) before do @mount = double('testmount', :name => "one", :validate => true) expect(Puppet::FileServing::Mount::File).to receive(:new).with("one").and_return(@mount) - allow(@parser).to receive(:add_modules_mount) end it "should set the mount path to the path attribute from that section" do diff --git a/spec/unit/indirector/face_spec.rb b/spec/unit/indirector/face_spec.rb index 74589015744..9019994e139 100644 --- a/spec/unit/indirector/face_spec.rb +++ b/spec/unit/indirector/face_spec.rb @@ -33,7 +33,6 @@ describe "as an instance" do it "should be able to determine its indirection" do # Loading actions here can get, um, complicated - allow(Puppet::Face).to receive(:load_actions) expect(Puppet::Indirector::Face.new(:catalog, '0.0.1').indirection).to equal(Puppet::Resource::Catalog.indirection) end end diff --git a/spec/unit/indirector/facts/facter_spec.rb b/spec/unit/indirector/facts/facter_spec.rb index 3e1e0e2b5e6..196ab8e23f4 100644 --- a/spec/unit/indirector/facts/facter_spec.rb +++ b/spec/unit/indirector/facts/facter_spec.rb @@ -22,7 +22,6 @@ end before :each do - allow(Puppet::Node::Facts::Facter).to receive(:reload_facter) @facter = Puppet::Node::Facts::Facter.new allow(Facter).to receive(:to_hash).and_return({}) @name = "me" @@ -160,8 +159,6 @@ before :each do allow(@request).to receive(:options).and_return(options) allow(Puppet::Node::Facts).to receive(:new).and_return(facts) - allow(Facter).to receive(:respond_to?).and_return(false) - allow(Facter).to receive(:respond_to?).with(:resolve).and_return(true) allow(facts).to receive(:add_local_facts) end diff --git a/spec/unit/network/http/api/indirected_routes_spec.rb b/spec/unit/network/http/api/indirected_routes_spec.rb index f1f7bc80f82..eed180317ab 100644 --- a/spec/unit/network/http/api/indirected_routes_spec.rb +++ b/spec/unit/network/http/api/indirected_routes_spec.rb @@ -24,10 +24,6 @@ let(:env_loaders) { Puppet::Environments::Static.new(environment) } let(:params) { { :environment => "env" } } - before do - allow(handler).to receive(:handler).and_return("foo") - end - around do |example| Puppet.override(:environments => env_loaders) do example.run diff --git a/spec/unit/parser/resource_spec.rb b/spec/unit/parser/resource_spec.rb index 891c46274d2..146dd384d9b 100644 --- a/spec/unit/parser/resource_spec.rb +++ b/spec/unit/parser/resource_spec.rb @@ -418,22 +418,27 @@ class foo { end describe "when merging overrides" do + def resource_type(name) + double(name, :child_of? => false) + end + before do - @source = "source1" + @source = resource_type("source1") @resource = mkresource :source => @source @override = mkresource :source => @source end it "should fail when the override was not created by a parent class" do - @override.source = "source2" - expect(@override.source).to receive(:child_of?).with("source1").and_return(false) + @override.source = resource_type("source2") + expect(@override.source).to receive(:child_of?).with(@source).and_return(false) expect { @resource.merge(@override) }.to raise_error(Puppet::ParseError) end it "should succeed when the override was created in the current scope" do - @resource.source = "source3" + @source3 = resource_type("source3") + @resource.source = @source3 @override.source = @resource.source - expect(@override.source).not_to receive(:child_of?).with("source3") + expect(@override.source).not_to receive(:child_of?).with(@source3) params = {:a => :b, :c => :d} expect(@override).to receive(:parameters).and_return(params) expect(@resource).to receive(:override_parameter).with(:b) @@ -442,9 +447,10 @@ class foo { end it "should succeed when a parent class created the override" do - @resource.source = "source3" - @override.source = "source4" - expect(@override.source).to receive(:child_of?).with("source3").and_return(true) + @source3 = resource_type("source3") + @resource.source = @source3 + @override.source = resource_type("source4") + expect(@override.source).to receive(:child_of?).with(@source3).and_return(true) params = {:a => :b, :c => :d} expect(@override).to receive(:parameters).and_return(params) expect(@resource).to receive(:override_parameter).with(:b) diff --git a/spec/unit/provider/package/pip_spec.rb b/spec/unit/provider/package/pip_spec.rb index c22a0aa929c..e0072ae1361 100644 --- a/spec/unit/provider/package/pip_spec.rb +++ b/spec/unit/provider/package/pip_spec.rb @@ -14,9 +14,8 @@ it { is_expected.to be_version_ranges } before do - @resource = Puppet::Resource.new(:package, "fake_package") - allow(@resource).to receive(:original_parameters).and_return({}) - @provider = described_class.new(@resource) + @resource = Puppet::Type.type(:package).new(name: "fake_package", provider: :pip) + @provider = @resource.provider @client = double('client') allow(@client).to receive(:call).with('package_releases', 'real_package').and_return(["1.3", "1.2.5", "1.2.4"]) allow(@client).to receive(:call).with('package_releases', 'fake_package').and_return([]) @@ -335,7 +334,6 @@ it "should install" do @resource[:ensure] = :installed - @resource[:source] = nil expect(@provider).to receive(:execute).with(["/fake/bin/pip", ["install", "-q", "fake_package"]]) @provider.install end @@ -368,7 +366,6 @@ it "should install a particular version" do @resource[:ensure] = "0.0.0" - @resource[:source] = nil # TJK expect(@provider).to receive(:execute).with(["/fake/bin/pip", ["install", "-q", "fake_package==0.0.0"]]) @provider.install @@ -376,7 +373,6 @@ it "should upgrade" do @resource[:ensure] = :latest - @resource[:source] = nil # TJK expect(@provider).to receive(:execute).with(["/fake/bin/pip", ["install", "-q", "--upgrade", "fake_package"]]) @provider.install @@ -384,7 +380,6 @@ it "should handle install options" do @resource[:ensure] = :installed - @resource[:source] = nil @resource[:install_options] = [{"--timeout" => "10"}, "--no-index"] expect(@provider).to receive(:execute).with(["/fake/bin/pip", ["install", "-q", "--timeout=10", "--no-index", "fake_package"]]) @provider.install @@ -415,7 +410,7 @@ let(:pip) { '/fake/bin/pip' } it "should look up version if pip is present" do - allow(described_class).to receive(:pip_cmd).and_return(pip) + allow(described_class).to receive(:cmd).and_return(pip) process = ['pip 8.0.2 from /usr/local/lib/python2.7/dist-packages (python 2.7)'] allow(described_class).to receive(:execpipe).with([pip, '--version']).and_yield(process) @@ -423,7 +418,7 @@ end it "parses multiple lines of output" do - allow(described_class).to receive(:pip_cmd).and_return(pip) + allow(described_class).to receive(:cmd).and_return(pip) process = [ "/usr/local/lib/python2.7/dist-packages/urllib3/contrib/socks.py:37: DependencyWarning: SOCKS support in urllib3 requires the installation of optional dependencies: specifically, PySocks. For more information, see https://urllib3.readthedocs.io/en/latest/contrib.html#socks-proxies", " DependencyWarning", @@ -435,7 +430,7 @@ end it "raises if there isn't a version string" do - allow(described_class).to receive(:pip_cmd).and_return(pip) + allow(described_class).to receive(:cmd).and_return(pip) allow(described_class).to receive(:execpipe).with([pip, '--version']).and_yield([""]) expect { described_class.pip_version(pip) @@ -444,7 +439,7 @@ it "quotes commands with spaces" do pip = 'C:\Program Files\Python27\Scripts\pip.exe' - allow(described_class).to receive(:pip_cmd).and_return(pip) + allow(described_class).to receive(:cmd).and_return(pip) process = ["pip 18.1 from c:\program files\python27\lib\site-packages\pip (python 2.7)\r\n"] allow(described_class).to receive(:execpipe).with(["\"#{pip}\"", '--version']).and_yield(process) diff --git a/spec/unit/provider/package/pkgdmg_spec.rb b/spec/unit/provider/package/pkgdmg_spec.rb index 0417bd47a48..d5664247557 100644 --- a/spec/unit/provider/package/pkgdmg_spec.rb +++ b/spec/unit/provider/package/pkgdmg_spec.rb @@ -8,10 +8,6 @@ it { is_expected.not_to be_uninstallable } describe "when installing it should fail when" do - before :each do - expect(Puppet::Util).not_to receive(:execute) - end - it "no source is specified" do expect { provider.install }.to raise_error(Puppet::Error, /must specify a package source/) end diff --git a/spec/unit/provider/user/hpux_spec.rb b/spec/unit/provider/user/hpux_spec.rb index 5df5bb6025b..0e5fdfeb02d 100644 --- a/spec/unit/provider/user/hpux_spec.rb +++ b/spec/unit/provider/user/hpux_spec.rb @@ -33,7 +33,7 @@ before :each do allow(Etc).to receive(:getpwent).and_return(pwent) allow(Etc).to receive(:getpwnam).and_return(pwent) - allow(resource).to receive(:command).with(:modify).and_return('/usr/sam/lbin/usermod.sam') + allow(provider).to receive(:command).with(:modify).and_return('/usr/sam/lbin/usermod.sam') end it "should have feature manages_passwords" do diff --git a/spec/unit/resource/type_spec.rb b/spec/unit/resource/type_spec.rb index 8641ca30018..90648d0dfe3 100644 --- a/spec/unit/resource/type_spec.rb +++ b/spec/unit/resource/type_spec.rb @@ -554,7 +554,7 @@ def matchref_expression(number) it "should not create a subscope for the :main class" do allow(@resource).to receive(:title).and_return(:main) - expect(@type).not_to receive(:subscope) + expect(@scope).not_to receive(:newscope) expect(@type).to receive(:set_resource_parameters).with(@resource, @scope) @type.evaluate_code(@resource) diff --git a/spec/unit/ssl/base_spec.rb b/spec/unit/ssl/base_spec.rb index 1a0d4434186..942db649464 100644 --- a/spec/unit/ssl/base_spec.rb +++ b/spec/unit/ssl/base_spec.rb @@ -46,7 +46,6 @@ class TestCertificate < Puppet::SSL::Base describe "when initializing wrapped class from a file with #read" do it "should open the file with ASCII encoding" do path = '/foo/bar/cert' - allow(Puppet::SSL::Base).to receive(:valid_certname).and_return(true) expect(Puppet::FileSystem).to receive(:read).with(path, :encoding => Encoding::ASCII).and_return("bar") @base.read(path) end diff --git a/spec/unit/transaction_spec.rb b/spec/unit/transaction_spec.rb index c9c1841ab9d..c300d526466 100644 --- a/spec/unit/transaction_spec.rb +++ b/spec/unit/transaction_spec.rb @@ -5,6 +5,13 @@ require 'puppet/transaction' require 'fileutils' +Puppet::Type.newtype(:generator) do + newparam(:name) { isnamevar } + + def generate + end +end + describe Puppet::Transaction do include PuppetSpec::Files include PuppetSpec::Compiler @@ -323,9 +330,9 @@ def transaction_with_resource(resource) describe "when generating resources before traversal" do let(:catalog) { Puppet::Resource::Catalog.new } let(:transaction) { Puppet::Transaction.new(catalog, nil, Puppet::Graph::SequentialPrioritizer.new) } - let(:generator) { Puppet::Type.type(:notify).new :title => "generator" } + let(:generator) { Puppet::Type.type(:generator).new :title => "generator" } let(:generated) do - %w[a b c].map { |name| Puppet::Type.type(:notify).new(:name => name) } + %w[a b c].map { |name| Puppet::Type.type(:generator).new(:name => name) } end before :each do @@ -633,7 +640,7 @@ def transaction_with_resource(resource) end describe "and new resources are generated" do - let(:generator) { Puppet::Type.type(:notify).new :title => "generator" } + let(:generator) { Puppet::Type.type(:generator).new :title => "generator" } let(:generated) do %w[a b c].map { |name| Puppet::Type.type(:package).new :title => "foo", :name => name, :provider => :apt } end @@ -794,7 +801,6 @@ def self.is_selinux_enabled before do @resource = Puppet::Type.type(:notify).new :title => "foobar" @catalog.add_resource @resource - allow(@transaction).to receive(:add_dynamically_generated_resources) end it 'should stop processing if :stop_processing? is true' do diff --git a/spec/unit/type/file/content_spec.rb b/spec/unit/type/file/content_spec.rb index 928868c10cd..055724d6364 100644 --- a/spec/unit/type/file/content_spec.rb +++ b/spec/unit/type/file/content_spec.rb @@ -11,7 +11,6 @@ before do File.open(filename, 'w') {|f| f.write "initial file content"} - allow(described_class).to receive(:standalone?).and_return(false) end around do |example| diff --git a/spec/unit/type/file/selinux_spec.rb b/spec/unit/type/file/selinux_spec.rb index a453f39c3c0..51259a4f779 100644 --- a/spec/unit/type/file/selinux_spec.rb +++ b/spec/unit/type/file/selinux_spec.rb @@ -9,8 +9,6 @@ @path = make_absolute("/my/file") @resource = Puppet::Type.type(:file).new :path => @path @sel = property.new :resource => @resource - allow(@sel).to receive(:normalize_selinux_category).with("s0").and_return("s0") - allow(@sel).to receive(:normalize_selinux_category).with(nil).and_return(nil) end it "retrieve on #{param} should return :absent if the file isn't statable" do diff --git a/spec/unit/type/file_spec.rb b/spec/unit/type/file_spec.rb index 31573b85c8b..06100eb81e3 100644 --- a/spec/unit/type/file_spec.rb +++ b/spec/unit/type/file_spec.rb @@ -349,12 +349,6 @@ end describe "#flush" do - it "should flush all properties that respond to :flush" do - file[:source] = File.expand_path(__FILE__) - expect(file.parameter(:source)).to receive(:flush) - file.flush - end - it "should reset its stat reference" do FileUtils.touch(path) stat1 = file.stat diff --git a/spec/unit/type/tidy_spec.rb b/spec/unit/type/tidy_spec.rb index 63d2bad817b..e32452e3735 100644 --- a/spec/unit/type/tidy_spec.rb +++ b/spec/unit/type/tidy_spec.rb @@ -191,7 +191,6 @@ describe "and recursion is used" do before do @tidy[:recurse] = true - allow_any_instance_of(Puppet::FileServing::Fileset).to receive(:stat).and_return(double("stat")) @fileset = Puppet::FileServing::Fileset.new(@basepath) allow(Puppet::FileServing::Fileset).to receive(:new).and_return(@fileset) end diff --git a/spec/unit/type_spec.rb b/spec/unit/type_spec.rb index 6bd2acaf52e..cc2e637c0fd 100644 --- a/spec/unit/type_spec.rb +++ b/spec/unit/type_spec.rb @@ -932,8 +932,8 @@ def post_compile it "should always retrieve the ensure value by default" do @ensurable_resource = Puppet::Type.type(:file).new(:name => "/not/existent", :mode => "0644") - allow(Puppet::Type::File::Ensure).to receive(:ensure).and_return(:absent) - expect_any_instance_of(Puppet::Type::File::Ensure).to receive(:retrieve).once + # the ensure property is lazily metaprogrammed... + allow_any_instance_of(Puppet::Type::File::Ensure).to receive(:retrieve).and_return(:absent) @ensurable_resource.retrieve_resource end diff --git a/spec/unit/util/at_fork_spec.rb b/spec/unit/util/at_fork_spec.rb index 1db39f801b6..478bb381ca5 100644 --- a/spec/unit/util/at_fork_spec.rb +++ b/spec/unit/util/at_fork_spec.rb @@ -50,8 +50,8 @@ def stub_solaris_handler(stub_noop_too = false) const_set(:TYPE_VOID, nil) const_set(:TYPE_INT, nil) const_set(:DLError, Class.new(StandardError)) - const_set(:Handle, Class.new) - const_set(:Function, Class.new) + const_set(:Handle, Class.new { def initialize(library = nil, flags = 0); end }) + const_set(:Function, Class.new { def initialize(ptr, args, ret_type, abi = 0); end }) end) end end diff --git a/spec/unit/util/autoload_spec.rb b/spec/unit/util/autoload_spec.rb index 325fcdd8902..3a03d12af85 100644 --- a/spec/unit/util/autoload_spec.rb +++ b/spec/unit/util/autoload_spec.rb @@ -157,7 +157,7 @@ def with_libdir(libdir) end it "should load the first file in the searchpath" do - allow(@autoload).to receive(:search_directories).and_return([make_absolute("/a"), make_absolute("/b")]) + allow(@autoload.class).to receive(:search_directories).and_return([make_absolute("/a"), make_absolute("/b")]) allow(FileTest).to receive(:directory?).and_return(true) allow(Puppet::FileSystem).to receive(:exist?).and_return(true) expect(Kernel).to receive(:load).with(make_absolute("/a/tmp/myfile.rb"), any_args) diff --git a/spec/unit/util/backups_spec.rb b/spec/unit/util/backups_spec.rb index 6406329b43c..8d7a5d7a3e0 100644 --- a/spec/unit/util/backups_spec.rb +++ b/spec/unit/util/backups_spec.rb @@ -117,8 +117,7 @@ file = Puppet::Type.type(:file).new(:name => path, :backup => 'foo', :recurse => true) expect(bucket).not_to receive(:backup) - stub_file = double('file', :stat => double('stat', :ftype => 'directory')) - allow(Puppet::FileSystem).to receive(:new).with(path).and_return(stub_file) + allow(Puppet::FileSystem).to receive(:stat).with(path).and_return(double('stat', :ftype => 'directory')) expect(Find).not_to receive(:find) file.perform_backup diff --git a/spec/unit/util_spec.rb b/spec/unit/util_spec.rb index a40dfea165a..63a6b36aa1a 100644 --- a/spec/unit/util_spec.rb +++ b/spec/unit/util_spec.rb @@ -309,7 +309,7 @@ def withenv_utf8(&block) describe "when using platform :posix" do before :each do - allow(Puppet.features).to receive(:posix).and_return(true) + allow(Puppet.features).to receive(:posix?).and_return(true) allow(Puppet::Util::Platform).to receive(:windows?).and_return(false) end @@ -322,7 +322,7 @@ def withenv_utf8(&block) describe "when using platform :windows" do before :each do - allow(Puppet.features).to receive(:posix).and_return(false) + allow(Puppet.features).to receive(:posix?).and_return(false) allow(Puppet::Util::Platform).to receive(:windows?).and_return(true) end @@ -456,7 +456,7 @@ def withenv_utf8(&block) describe "when using platform :posix" do before :each do - allow(Puppet.features).to receive(:posix).and_return(true) + allow(Puppet.features).to receive(:posix?).and_return(true) allow(Puppet::Util::Platform).to receive(:windows?).and_return(false) end @@ -495,7 +495,7 @@ def withenv_utf8(&block) describe "when using platform :windows" do before :each do - allow(Puppet.features).to receive(:posix).and_return(false) + allow(Puppet.features).to receive(:posix?).and_return(false) allow(Puppet::Util::Platform).to receive(:windows?).and_return(true) end From e875109a478ac0c65cd04b1f7e711cfe2b4d5598 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Tue, 10 Nov 2020 16:17:53 -0800 Subject: [PATCH 264/731] (maint) Return instances of Puppet::Type::Provider::PackageApt Previously the test's instances method returned instances of the resource, Puppet::Type::Package, not the provider, Puppet::Type::Provider::PackageApt, and the test hid that by stubbing a non-existent `mark=` method on the resource. Add a `mark` reader to the provider to make it easy to get its value. --- lib/puppet/provider/package/apt.rb | 4 ++++ spec/unit/provider/package/apt_spec.rb | 12 ++++-------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/puppet/provider/package/apt.rb b/lib/puppet/provider/package/apt.rb index 0fccbd233e5..33faaeb60fb 100644 --- a/lib/puppet/provider/package/apt.rb +++ b/lib/puppet/provider/package/apt.rb @@ -51,6 +51,10 @@ def initialize(value={}) @property_flush = {} end + def mark + @property_flush[:mark] + end + def mark=(value) @property_flush[:mark] = value end diff --git a/spec/unit/provider/package/apt_spec.rb b/spec/unit/provider/package/apt_spec.rb index 03bcb86931b..b3c9096a7b1 100644 --- a/spec/unit/provider/package/apt_spec.rb +++ b/spec/unit/provider/package/apt_spec.rb @@ -11,9 +11,7 @@ end let(:provider) do - provider = subject() - provider.resource = resource - provider + resource.provider end it "should be the default provider on :osfamily => Debian" do @@ -88,7 +86,7 @@ describe ".instances" do before do - allow(Puppet::Type::Package::ProviderDpkg).to receive(:instances).and_return([resource]) + allow(Puppet::Type::Package::ProviderDpkg).to receive(:instances).and_return([provider]) end context "when package is manual marked" do @@ -97,8 +95,7 @@ end it 'sets mark to manual' do - expect(resource).to receive(:mark=).with(:manual) - described_class.instances + expect(described_class.instances.map(&:mark)).to eq([:manual]) end end @@ -108,8 +105,7 @@ end it 'does not set mark to manual' do - expect(resource).not_to receive(:mark=).with(:manual) - described_class.instances + expect(described_class.instances.map(&:mark)).to eq([nil]) end end end From 9407d0fe4e28000bec6f35bc2c57a552b0601556 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Tue, 10 Nov 2020 16:27:09 -0800 Subject: [PATCH 265/731] (maint) Make sure test classes implement the interface Implement methods for test classes so that we can enable partial double verification later. For example, we won't be able to add an expectation for `AgentTestClient#run` if the class doesn't implement the method. It also makes it less likely that our test will pass because the subject is overly stubbed, such as trying to use a `notify` resource to test the relationship graph, yet it doesn't implement `generate`. --- spec/unit/agent_spec.rb | 14 +- spec/unit/application_spec.rb | 6 +- spec/unit/confine/feature_spec.rb | 2 +- spec/unit/confine_spec.rb | 10 +- .../unit/file_serving/terminus_helper_spec.rb | 15 +- spec/unit/property_spec.rb | 1 + spec/unit/provider/nameservice_spec.rb | 131 +++++++++--------- spec/unit/provider/package/base_spec.rb | 11 +- .../additional_resource_generator_spec.rb | 10 +- spec/unit/type/group_spec.rb | 19 ++- spec/unit/type/resources_spec.rb | 14 +- 11 files changed, 128 insertions(+), 105 deletions(-) diff --git a/spec/unit/agent_spec.rb b/spec/unit/agent_spec.rb index 6bad7ed1a27..dfef4c3abb6 100644 --- a/spec/unit/agent_spec.rb +++ b/spec/unit/agent_spec.rb @@ -3,9 +3,13 @@ require 'puppet/configurer' class AgentTestClient - def run + def initialize(transaction_uuid = nil, job_id = nil) + end + + def run(client_args) # no-op end + def stop # no-op end @@ -49,11 +53,10 @@ def controlled_run(&block) it "should create an instance of its client class and run it when asked to run" do client = double('client') - expect(AgentTestClient).to receive(:new).and_return(client) - - expect(client).to receive(:run) + allow(AgentTestClient).to receive(:new).with(nil, nil).and_return(client) allow(@agent).to receive(:disabled?).and_return(false) + expect(client).to receive(:run) @agent.run end @@ -90,7 +93,6 @@ def controlled_run(&block) describe "when being run" do before do - allow(AgentTestClient).to receive(:lockfile_path).and_return("/my/lock") allow(@agent).to receive(:disabled?).and_return(false) end @@ -186,7 +188,7 @@ def controlled_run(&block) allow(lockfile).to receive(:lock).and_return(false) end - it "should notify that a run is already in progres" do + it "should notify that a run is already in progress" do client = AgentTestClient.new expect(AgentTestClient).to receive(:new).and_return(client) expect(Puppet).to receive(:notice).with(/Run of .* already in progress; skipping .* exists/) diff --git a/spec/unit/application_spec.rb b/spec/unit/application_spec.rb index 070bed8a1be..bfaa8d73984 100644 --- a/spec/unit/application_spec.rb +++ b/spec/unit/application_spec.rb @@ -7,8 +7,10 @@ describe Puppet::Application do before(:each) do - @app = Class.new(Puppet::Application).new - @appclass = @app.class + @appclass = Class.new(Puppet::Application) do + def handle_unknown(opt, arg); end + end + @app = @appclass.new allow(@app).to receive(:name).and_return("test_app") end diff --git a/spec/unit/confine/feature_spec.rb b/spec/unit/confine/feature_spec.rb index e7f5514f0da..8bdf9bd4483 100644 --- a/spec/unit/confine/feature_spec.rb +++ b/spec/unit/confine/feature_spec.rb @@ -22,7 +22,7 @@ end it "should use the Puppet features instance to test validity" do - expect(Puppet.features).to receive(:myfeature?) + Puppet.features.add(:myfeature) do true end @confine.valid? end diff --git a/spec/unit/confine_spec.rb b/spec/unit/confine_spec.rb index 8fb76165662..ddff0fc03bb 100644 --- a/spec/unit/confine_spec.rb +++ b/spec/unit/confine_spec.rb @@ -2,6 +2,12 @@ require 'puppet/confine' +class Puppet::TestConfine < Puppet::Confine + def pass?(value) + false + end +end + describe Puppet::Confine do it "should require a value" do expect { Puppet::Confine.new }.to raise_error(ArgumentError) @@ -33,7 +39,7 @@ describe "when testing all values" do before do - @confine = Puppet::Confine.new(%w{a b c}) + @confine = Puppet::TestConfine.new(%w{a b c}) @confine.label = "foo" end @@ -64,7 +70,7 @@ end describe "when testing the result of the values" do - before { @confine = Puppet::Confine.new(%w{a b c d}) } + before { @confine = Puppet::TestConfine.new(%w{a b c d}) } it "should return an array with the result of the test for each value" do allow(@confine).to receive(:pass?).and_return(true) diff --git a/spec/unit/file_serving/terminus_helper_spec.rb b/spec/unit/file_serving/terminus_helper_spec.rb index 374205d62d5..6c22e7921d2 100644 --- a/spec/unit/file_serving/terminus_helper_spec.rb +++ b/spec/unit/file_serving/terminus_helper_spec.rb @@ -2,13 +2,20 @@ require 'puppet/file_serving/terminus_helper' +class Puppet::FileServing::TestHelper + include Puppet::FileServing::TerminusHelper + + attr_reader :model + + def initialize(model) + @model = model + end +end + describe Puppet::FileServing::TerminusHelper do before do - @helper = Object.new - @helper.extend(Puppet::FileServing::TerminusHelper) - @model = double('model') - allow(@helper).to receive(:model).and_return(@model) + @helper = Puppet::FileServing::TestHelper.new(@model) @request = double('request', :key => "url", :options => {}) diff --git a/spec/unit/property_spec.rb b/spec/unit/property_spec.rb index 0d5a673d8e0..4aa3f4853cd 100644 --- a/spec/unit/property_spec.rb +++ b/spec/unit/property_spec.rb @@ -5,6 +5,7 @@ newparam(:name, isnamevar: true) end Puppet::Type.type(:property_test).provide(:property_test) do + attr_accessor :foo end describe Puppet::Property do diff --git a/spec/unit/provider/nameservice_spec.rb b/spec/unit/provider/nameservice_spec.rb index 491ba639598..687919f712d 100644 --- a/spec/unit/provider/nameservice_spec.rb +++ b/spec/unit/provider/nameservice_spec.rb @@ -3,11 +3,28 @@ require 'puppet/etc' require 'puppet_spec/character_encoding' +Puppet::Type.newtype(:nameservice_dummytype) do + newparam(:name) + ensurable + newproperty(:foo) + newproperty(:bar) +end + +Puppet::Type.type(:nameservice_dummytype).provide(:nameservice_dummyprovider, parent: Puppet::Provider::NameService) do + def posixmethod(param) + param + end + + def modifycmd(param, value) + [] + end +end + describe Puppet::Provider::NameService do before :each do - described_class.initvars - described_class.resource_type = faketype + provider.class.initvars + provider.class.resource_type = faketype end # These are values getpwent might give you @@ -41,16 +58,12 @@ # The provider sometimes relies on @resource for valid properties so let's # create a fake type with properties that match our fake struct. let :faketype do - Puppet::Type.newtype(:nameservice_dummytype) do - newparam(:name) - ensurable - newproperty(:foo) - newproperty(:bar) - end + Puppet::Type.type(:nameservice_dummytype) end let :provider do - described_class.new(:name => 'bob', :foo => 'fooval', :bar => 'barval') + Puppet::Type.type(:nameservice_dummytype).provider(:nameservice_dummyprovider) + .new(:name => 'bob', :foo => 'fooval', :bar => 'barval') end let :resource do @@ -91,61 +104,61 @@ describe "#options" do it "should add options for a valid property" do - described_class.options :foo, :key1 => 'val1', :key2 => 'val2' - described_class.options :bar, :key3 => 'val3' - expect(described_class.option(:foo, :key1)).to eq('val1') - expect(described_class.option(:foo, :key2)).to eq('val2') - expect(described_class.option(:bar, :key3)).to eq('val3') + provider.class.options :foo, :key1 => 'val1', :key2 => 'val2' + provider.class.options :bar, :key3 => 'val3' + expect(provider.class.option(:foo, :key1)).to eq('val1') + expect(provider.class.option(:foo, :key2)).to eq('val2') + expect(provider.class.option(:bar, :key3)).to eq('val3') end it "should raise an error for an invalid property" do - expect { described_class.options :baz, :key1 => 'val1' }.to raise_error( + expect { provider.class.options :baz, :key1 => 'val1' }.to raise_error( Puppet::Error, 'baz is not a valid attribute for nameservice_dummytype') end end describe "#option" do it "should return the correct value" do - described_class.options :foo, :key1 => 'val1', :key2 => 'val2' - expect(described_class.option(:foo, :key2)).to eq('val2') + provider.class.options :foo, :key1 => 'val1', :key2 => 'val2' + expect(provider.class.option(:foo, :key2)).to eq('val2') end it "should symbolize the name first" do - described_class.options :foo, :key1 => 'val1', :key2 => 'val2' - expect(described_class.option('foo', :key2)).to eq('val2') + provider.class.options :foo, :key1 => 'val1', :key2 => 'val2' + expect(provider.class.option('foo', :key2)).to eq('val2') end it "should return nil if no option has been specified earlier" do - expect(described_class.option(:foo, :key2)).to be_nil + expect(provider.class.option(:foo, :key2)).to be_nil end it "should return nil if no option for that property has been specified earlier" do - described_class.options :bar, :key2 => 'val2' - expect(described_class.option(:foo, :key2)).to be_nil + provider.class.options :bar, :key2 => 'val2' + expect(provider.class.option(:foo, :key2)).to be_nil end it "should return nil if no matching key can be found for that property" do - described_class.options :foo, :key3 => 'val2' - expect(described_class.option(:foo, :key2)).to be_nil + provider.class.options :foo, :key3 => 'val2' + expect(provider.class.option(:foo, :key2)).to be_nil end end describe "#section" do it "should raise an error if resource_type has not been set" do - expect(described_class).to receive(:resource_type).and_return(nil) - expect { described_class.section }.to raise_error Puppet::Error, 'Cannot determine Etc section without a resource type' + expect(provider.class).to receive(:resource_type).and_return(nil) + expect { provider.class.section }.to raise_error Puppet::Error, 'Cannot determine Etc section without a resource type' end # the return values are hard coded so I am using types that actually make # use of the nameservice provider it "should return pw for users" do - described_class.resource_type = Puppet::Type.type(:user) - expect(described_class.section).to eq('pw') + provider.class.resource_type = Puppet::Type.type(:user) + expect(provider.class.section).to eq('pw') end it "should return gr for groups" do - described_class.resource_type = Puppet::Type.type(:group) - expect(described_class.section).to eq('gr') + provider.class.resource_type = Puppet::Type.type(:group) + expect(provider.class.section).to eq('gr') end end @@ -156,7 +169,7 @@ # encoding allow(Etc).to receive(:getpwent).and_return(*utf_8_mixed_users) result = PuppetSpec::CharacterEncoding.with_external_encoding(Encoding::UTF_8) do - described_class.instances + provider.class.instances end expect(result.map(&:name)).to eq( [ @@ -171,7 +184,7 @@ it "should have object names in their original encoding/bytes if they would not be valid UTF-8" do allow(Etc).to receive(:getpwent).and_return(*latin_1_mixed_users) result = PuppetSpec::CharacterEncoding.with_external_encoding(Encoding::ISO_8859_1) do - described_class.instances + provider.class.instances end expect(result.map(&:name)).to eq( [ @@ -186,40 +199,40 @@ it "should pass the Puppet::Etc :canonical_name Struct member to the constructor" do users = [ Struct::Passwd.new(invalid_utf_8_jose, invalid_utf_8_jose, 1002, 2000), nil ] allow(Etc).to receive(:getpwent).and_return(*users) - expect(described_class).to receive(:new).with(:name => escaped_utf_8_jose, :canonical_name => invalid_utf_8_jose, :ensure => :present) - described_class.instances + expect(provider.class).to receive(:new).with(:name => escaped_utf_8_jose, :canonical_name => invalid_utf_8_jose, :ensure => :present) + provider.class.instances end end describe "validate" do it "should pass if no check is registered at all" do - expect { described_class.validate(:foo, 300) }.to_not raise_error - expect { described_class.validate('foo', 300) }.to_not raise_error + expect { provider.class.validate(:foo, 300) }.to_not raise_error + expect { provider.class.validate('foo', 300) }.to_not raise_error end it "should pass if no check for that property is registered" do - described_class.verify(:bar, 'Must be 100') { |val| val == 100 } - expect { described_class.validate(:foo, 300) }.to_not raise_error - expect { described_class.validate('foo', 300) }.to_not raise_error + provider.class.verify(:bar, 'Must be 100') { |val| val == 100 } + expect { provider.class.validate(:foo, 300) }.to_not raise_error + expect { provider.class.validate('foo', 300) }.to_not raise_error end it "should pass if the value is valid" do - described_class.verify(:foo, 'Must be 100') { |val| val == 100 } - expect { described_class.validate(:foo, 100) }.to_not raise_error - expect { described_class.validate('foo', 100) }.to_not raise_error + provider.class.verify(:foo, 'Must be 100') { |val| val == 100 } + expect { provider.class.validate(:foo, 100) }.to_not raise_error + expect { provider.class.validate('foo', 100) }.to_not raise_error end it "should raise an error if the value is invalid" do - described_class.verify(:foo, 'Must be 100') { |val| val == 100 } - expect { described_class.validate(:foo, 200) }.to raise_error(ArgumentError, 'Invalid value 200: Must be 100') - expect { described_class.validate('foo', 200) }.to raise_error(ArgumentError, 'Invalid value 200: Must be 100') + provider.class.verify(:foo, 'Must be 100') { |val| val == 100 } + expect { provider.class.validate(:foo, 200) }.to raise_error(ArgumentError, 'Invalid value 200: Must be 100') + expect { provider.class.validate('foo', 200) }.to raise_error(ArgumentError, 'Invalid value 200: Must be 100') end end describe "getinfo" do before :each do # with section=foo we'll call Etc.getfoonam instead of getpwnam or getgrnam - allow(described_class).to receive(:section).and_return('foo') + allow(provider.class).to receive(:section).and_return('foo') resource # initialize the resource so our provider has a @resource instance variable end @@ -239,13 +252,13 @@ # overriding to UTF-8, in @canonical_name for querying that state on disk # again if needed it "should use the instance's @canonical_name to query the system" do - provider_instance = described_class.new(:name => 'foo', :canonical_name => 'original_foo', :ensure => :present) + provider_instance = provider.class.new(:name => 'foo', :canonical_name => 'original_foo', :ensure => :present) expect(Puppet::Etc).to receive(:send).with(:getfoonam, 'original_foo') provider_instance.getinfo(true) end it "should use the instance's name instead of canonical_name if not supplied during instantiation" do - provider_instance = described_class.new(:name => 'foo', :ensure => :present) + provider_instance = provider.class.new(:name => 'foo', :ensure => :present) expect(Puppet::Etc).to receive(:send).with(:getfoonam, 'foo') provider_instance.getinfo(true) end @@ -253,16 +266,6 @@ describe "info2hash" do it "should return a hash with all properties" do - # we have to have an implementation of posixmethod which has to - # convert a propertyname (e.g. comment) into a fieldname of our - # Struct (e.g. gecos). I do not want to test posixmethod here so - # let's fake an implementation which does not do any translation. We - # expect two method invocations because info2hash calls the method - # twice if the Struct responds to the propertyname (our fake Struct - # provides values for :foo and :bar) TODO: Fix that - expect(provider).to receive(:posixmethod).with(:foo).and_return(:foo).twice - expect(provider).to receive(:posixmethod).with(:bar).and_return(:bar).twice - expect(provider).to receive(:posixmethod).with(:ensure).and_return(:ensure) expect(provider.info2hash(fakeetcobject)).to eq({ :foo => 'fooval', :bar => 'barval' }) end end @@ -273,7 +276,7 @@ end it "should return the munged value otherwise" do - described_class.options(:foo, :munge => proc { |x| x*2 }) + provider.class.options(:foo, :munge => proc { |x| x*2 }) expect(provider.munge(:foo, 100)).to eq(200) end end @@ -284,7 +287,7 @@ end it "should return the unmunged value otherwise" do - described_class.options(:foo, :unmunge => proc { |x| x/2 }) + provider.class.options(:foo, :unmunge => proc { |x| x/2 }) expect(provider.unmunge(:foo, 200)).to eq(100) end end @@ -302,15 +305,13 @@ end describe "get" do - before(:each) {described_class.resource_type = faketype } - it "should return the correct getinfo value" do expect(provider).to receive(:getinfo).with(false).and_return(:foo => 'fooval', :bar => 'barval') expect(provider.get(:bar)).to eq('barval') end it "should unmunge the value first" do - described_class.options(:bar, :munge => proc { |x| x*2}, :unmunge => proc {|x| x/2}) + provider.class.options(:bar, :munge => proc { |x| x*2}, :unmunge => proc {|x| x/2}) expect(provider).to receive(:getinfo).with(false).and_return(:foo => 200, :bar => 500) expect(provider.get(:bar)).to eq(250) end @@ -325,7 +326,7 @@ describe "set" do before :each do resource # initialize resource so our provider has a @resource object - described_class.verify(:foo, 'Must be 100') { |val| val == 100 } + provider.class.verify(:foo, 'Must be 100') { |val| val == 100 } end it "should raise an error on invalid values" do @@ -339,7 +340,7 @@ end it "should munge the value first" do - described_class.options(:foo, :munge => proc { |x| x*2}, :unmunge => proc {|x| x/2}) + provider.class.options(:foo, :munge => proc { |x| x*2}, :unmunge => proc {|x| x/2}) expect(provider).to receive(:modifycmd).with(:foo, 200).and_return(['/bin/modify', '-f', '200' ]) expect(provider).to receive(:execute).with(['/bin/modify', '-f', '200'], hash_including(custom_environment: {})) provider.set(:foo, 100) diff --git a/spec/unit/provider/package/base_spec.rb b/spec/unit/provider/package/base_spec.rb index 52b744d03c6..64f526563f2 100644 --- a/spec/unit/provider/package/base_spec.rb +++ b/spec/unit/provider/package/base_spec.rb @@ -1,17 +1,18 @@ require 'spec_helper' require 'puppet/provider/package' +Puppet::Type.type(:package).provide(:test_base_provider, parent: Puppet::Provider::Package) do + def query; end +end + describe Puppet::Provider::Package do + let(:provider) { Puppet::Type.type(:package).provider(:test_base_provider).new } + it 'returns absent for uninstalled packages when not purgeable' do - provider = Puppet::Provider::Package.new - expect(provider).to receive(:query).and_return(nil) - expect(provider.class).to receive(:feature?).with(:purgeable).and_return(false) expect(provider.properties[:ensure]).to eq(:absent) end it 'returns purged for uninstalled packages when purgeable' do - provider = Puppet::Provider::Package.new - expect(provider).to receive(:query).and_return(nil) expect(provider.class).to receive(:feature?).with(:purgeable).and_return(true) expect(provider.properties[:ensure]).to eq(:purged) end diff --git a/spec/unit/transaction/additional_resource_generator_spec.rb b/spec/unit/transaction/additional_resource_generator_spec.rb index 7efbbc24139..8bc80303b00 100644 --- a/spec/unit/transaction/additional_resource_generator_spec.rb +++ b/spec/unit/transaction/additional_resource_generator_spec.rb @@ -33,10 +33,6 @@ newparam(:code) - def respond_to?(method_name) - method_name == self[:kind] || super - end - def eval_generate eval_code end @@ -314,13 +310,13 @@ class container { it "sets resources_failed_to_generate to true if resource#eval_generate raises an exception" do catalog = compile_to_ral(<<-MANIFEST) - notify { 'hello': } + generator { thing: } MANIFEST - allow(catalog.resource("Notify[hello]")).to receive(:eval_generate).and_raise(RuntimeError) + allow(catalog.resource("Generator[thing]")).to receive(:eval_generate).and_raise(RuntimeError) relationship_graph = relationship_graph_for(catalog) generator = Puppet::Transaction::AdditionalResourceGenerator.new(catalog, relationship_graph, prioritizer) - generator.eval_generate(catalog.resource("Notify[hello]")) + generator.eval_generate(catalog.resource("Generator[thing]")) expect(generator.resources_failed_to_generate).to be_truthy end diff --git a/spec/unit/type/group_spec.rb b/spec/unit/type/group_spec.rb index 519d0515feb..0ca1cddfbd0 100644 --- a/spec/unit/type/group_spec.rb +++ b/spec/unit/type/group_spec.rb @@ -60,9 +60,12 @@ end it "delegates the existence check to its provider" do - provider = @class.provide(:testing) {} + provider = @class.provide(:testing) do + def exists? + true + end + end provider_instance = provider.new - expect(provider_instance).to receive(:exists?).and_return(true) type = @class.new(:name => "group", :provider => provider_instance) @@ -77,20 +80,24 @@ def members [] end + + def members_insync?(current, should) + current == should + end + + def members_to_s(values) + values.map { |v| "#{v} ()" }.join(', ') + end end end let (:provider_instance) { provider.new } let (:type) { @class.new(:name => "group", :provider => provider_instance, :members => ['user1']) } it "insync? calls members_insync?" do - expect(provider_instance).to receive(:members_insync?).with(['user1'], ['user1']).and_return(true) expect(type.property(:members).insync?(['user1'])).to be_truthy end it "is_to_s and should_to_s call members_to_s" do - expect(provider_instance).to receive(:members_to_s).with(['user1', 'user2']).and_return("user1 (), user2 ()") - expect(provider_instance).to receive(:members_to_s).with(['user1']).and_return("user1 ()") - expect(type.property(:members).is_to_s('user1')).to eq('user1 ()') expect(type.property(:members).should_to_s('user1,user2')).to eq('user1 (), user2 ()') end diff --git a/spec/unit/type/resources_spec.rb b/spec/unit/type/resources_spec.rb index f6e089bdc62..cd17419f2bc 100644 --- a/spec/unit/type/resources_spec.rb +++ b/spec/unit/type/resources_spec.rb @@ -6,6 +6,9 @@ newparam(:name) {} end Puppet::Type.type(:purgeable_test).provide(:purgeable_test) do + def self.instances + [] + end end resources = Puppet::Type.type(:resources) @@ -46,19 +49,16 @@ end it "cannot be set to true for a resource type that does not accept ensure" do - allow(instance.resource_type).to receive(:respond_to?).and_return(true) - allow(instance.resource_type).to receive(:validproperty?).and_return(false) - expect { instance[:purge] = 'yes' }.to raise_error Puppet::Error + allow(instance.resource_type).to receive(:validproperty?).with(:ensure).and_return(false) + expect { instance[:purge] = 'yes' }.to raise_error Puppet::Error, /Purging is only supported on types that accept 'ensure'/ end it "cannot be set to true for a resource type that does not have instances" do - allow(instance.resource_type).to receive(:respond_to?).and_return(false) - allow(instance.resource_type).to receive(:validproperty?).and_return(true) - expect { instance[:purge] = 'yes' }.to raise_error Puppet::Error + allow(instance.resource_type).to receive(:respond_to?).with(:instances).and_return(false) + expect { instance[:purge] = 'yes' }.to raise_error Puppet::Error, /Purging resources of type file is not supported/ end it "can be set to true for a resource type that has instances and can accept ensure" do - allow(instance.resource_type).to receive(:respond_to?).and_return(true) allow(instance.resource_type).to receive(:validproperty?).and_return(true) expect { instance[:purge] = 'yes' }.to_not raise_error end From 981dcfd5ce4bd2d12331a0208c3b7f65d5365be9 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Tue, 10 Nov 2020 16:39:03 -0800 Subject: [PATCH 266/731] (maint) Use builtin yield matchers Use yield_successive_args to ensure the method yields args in a specific order. Switch the execpipe tests so we're testing that the provider.execpipe method behaves as expected. Don't use `send` if we don't need to. --- spec/unit/provider_spec.rb | 14 ++++++-------- spec/unit/util/inifile_spec.rb | 20 ++++++-------------- 2 files changed, 12 insertions(+), 22 deletions(-) diff --git a/spec/unit/provider_spec.rb b/spec/unit/provider_spec.rb index 697a7338821..c79edf41637 100644 --- a/spec/unit/provider_spec.rb +++ b/spec/unit/provider_spec.rb @@ -648,27 +648,25 @@ def existing_command it "delegates instance execute to Puppet::Util::Execution" do expect(Puppet::Util::Execution).to receive(:execute).with("a_command", { :option => "value" }) - provider.new.send(:execute, "a_command", { :option => "value" }) + provider.new.execute("a_command", { :option => "value" }) end it "delegates class execute to Puppet::Util::Execution" do expect(Puppet::Util::Execution).to receive(:execute).with("a_command", { :option => "value" }) - provider.send(:execute, "a_command", { :option => "value" }) + provider.execute("a_command", { :option => "value" }) end it "delegates instance execpipe to Puppet::Util::Execution" do - block = Proc.new { } - expect(Puppet::Util::Execution).to receive(:execpipe).with("a_command", true, block) + allow(Puppet::Util::Execution).to receive(:execpipe).with("a_command", true).and_yield('some output') - provider.new.send(:execpipe, "a_command", true, block) + expect { |b| provider.new.execpipe("a_command", true, &b) }.to yield_with_args('some output') end it "delegates class execpipe to Puppet::Util::Execution" do - block = Proc.new { } - expect(Puppet::Util::Execution).to receive(:execpipe).with("a_command", true, block) + allow(Puppet::Util::Execution).to receive(:execpipe).with("a_command", true).and_yield('some output') - provider.send(:execpipe, "a_command", true, block) + expect { |b| provider.execpipe("a_command", true, &b) }.to yield_with_args('some output') end end diff --git a/spec/unit/util/inifile_spec.rb b/spec/unit/util/inifile_spec.rb index f9c8121cb91..27f2d4d3e1a 100644 --- a/spec/unit/util/inifile_spec.rb +++ b/spec/unit/util/inifile_spec.rb @@ -443,13 +443,9 @@ end it "yields every section from every file" do - [sect_a1, sect_a2, sect_b1, sect_b2].each do |sect| - expect(sect).to receive(:touch).once - end - - subject.each_section do |sect| - sect.touch - end + expect { |b| + subject.each_section(&b) + }.to yield_successive_args(sect_a1, sect_a2, sect_b1, sect_b2) end end @@ -460,13 +456,9 @@ end it "yields the path to every file in the collection" do - seen = [] - subject.each_file do |file| - seen << file - end - - expect(seen).to include(path_a) - expect(seen).to include(path_b) + expect { |b| + subject.each_file(&b) + }.to yield_successive_args(path_a, path_b) end end From fb0a9f94ac7e9acb87649e6c066d065f1ae2fc1f Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Tue, 10 Nov 2020 16:42:47 -0800 Subject: [PATCH 267/731] (maint) Selectively disable partial double verification Puppet features only define the predicate method (Puppet.features.something?) if the feature test succeeds. Since eventlog? and selinux? only succeed in specific platforms, selectively disable partial double verification. Also respond_to? may be called with additional arguments, so ignore them. --- spec/unit/provider/package/pacman_spec.rb | 30 +++-- spec/unit/transaction_spec.rb | 3 + spec/unit/type/service_spec.rb | 2 +- spec/unit/util/log_spec.rb | 12 +- spec/unit/util/selinux_spec.rb | 128 +++++++++++++--------- 5 files changed, 106 insertions(+), 69 deletions(-) diff --git a/spec/unit/provider/package/pacman_spec.rb b/spec/unit/provider/package/pacman_spec.rb index 78e9cba5f9d..f1516ffc269 100644 --- a/spec/unit/provider/package/pacman_spec.rb +++ b/spec/unit/provider/package/pacman_spec.rb @@ -32,10 +32,12 @@ end it "should call yaourt to install the right package quietly when yaourt is installed" do - allow(described_class).to receive(:yaourt?).and_return(true) - args = ['--noconfirm', '--needed', '--noprogressbar', '-S', resource[:name]] - expect(provider).to receive(:yaourt).at_least(:once).with(*args).and_return('') - provider.install + without_partial_double_verification do + allow(described_class).to receive(:yaourt?).and_return(true) + args = ['--noconfirm', '--needed', '--noprogressbar', '-S', resource[:name]] + expect(provider).to receive(:yaourt).at_least(:once).with(*args).and_return('') + provider.install + end end it "should raise an Puppet::Error if the installation failed" do @@ -74,10 +76,12 @@ end it "should call yaourt to install the right package quietly when yaourt is installed" do - expect(described_class).to receive(:yaourt?).and_return(true) - args = ['--noconfirm', '--needed', '--noprogressbar', '-x', '--arg=value', '-S', resource[:name]] - expect(provider).to receive(:yaourt).at_least(:once).with(*args).and_return('') - provider.install + without_partial_double_verification do + expect(described_class).to receive(:yaourt?).and_return(true) + args = ['--noconfirm', '--needed', '--noprogressbar', '-x', '--arg=value', '-S', resource[:name]] + expect(provider).to receive(:yaourt).at_least(:once).with(*args).and_return('') + provider.install + end end end @@ -172,10 +176,12 @@ end it "should call yaourt to remove the right package quietly" do - allow(described_class).to receive(:yaourt?).and_return(true) - args = ["--noconfirm", "--noprogressbar", "-R", resource[:name]] - expect(provider).to receive(:yaourt).with(*args) - provider.uninstall + without_partial_double_verification do + allow(described_class).to receive(:yaourt?).and_return(true) + args = ["--noconfirm", "--noprogressbar", "-R", resource[:name]] + expect(provider).to receive(:yaourt).with(*args) + provider.uninstall + end end it "adds any uninstall_options" do diff --git a/spec/unit/transaction_spec.rb b/spec/unit/transaction_spec.rb index c300d526466..8952430d5de 100644 --- a/spec/unit/transaction_spec.rb +++ b/spec/unit/transaction_spec.rb @@ -758,6 +758,9 @@ module Selinux def self.is_selinux_enabled true end + + def self.matchpathcon_fini + end end end diff --git a/spec/unit/type/service_spec.rb b/spec/unit/type/service_spec.rb index a38a19b926e..2214471b7c6 100644 --- a/spec/unit/type/service_spec.rb +++ b/spec/unit/type/service_spec.rb @@ -488,7 +488,7 @@ def logonpassword=(value) end it "insyncness should be resolved by provider instead of superclass implementation when provider responds to the 'enabled_insync?' method" do allow(@service.provider.class).to receive(:supports_parameter?).and_return(true) @service[:enable] = true - allow(@service.provider).to receive(:respond_to?).with(:enabled_insync?).and_return(true) + allow(@service.provider).to receive(:respond_to?).with(:enabled_insync?, any_args).and_return(true) allow(@service.provider).to receive(:enabled_insync?).and_return(false) expect(@service.property(:enable).insync?(:true)).to eq(false) diff --git a/spec/unit/util/log_spec.rb b/spec/unit/util/log_spec.rb index 2ce86943daf..db7fa780ae8 100644 --- a/spec/unit/util/log_spec.rb +++ b/spec/unit/util/log_spec.rb @@ -111,16 +111,20 @@ def log_notice(message) end it "should fall back to :eventlog" do - allow(Puppet.features).to receive(:syslog?).and_return(false) - allow(Puppet.features).to receive(:eventlog?).and_return(true) + without_partial_double_verification do + allow(Puppet.features).to receive(:syslog?).and_return(false) + allow(Puppet.features).to receive(:eventlog?).and_return(true) + end expect(Puppet::Util::Log).to receive(:newdestination).with(:eventlog) Puppet::Util::Log.setup_default end it "should fall back to :file" do - allow(Puppet.features).to receive(:syslog?).and_return(false) - allow(Puppet.features).to receive(:eventlog?).and_return(false) + without_partial_double_verification do + allow(Puppet.features).to receive(:syslog?).and_return(false) + allow(Puppet.features).to receive(:eventlog?).and_return(false) + end expect(Puppet::Util::Log).to receive(:newdestination).with(Puppet[:puppetdlog]) Puppet::Util::Log.setup_default diff --git a/spec/unit/util/selinux_spec.rb b/spec/unit/util/selinux_spec.rb index 90fe6901d20..3a29dd61948 100644 --- a/spec/unit/util/selinux_spec.rb +++ b/spec/unit/util/selinux_spec.rb @@ -111,15 +111,19 @@ def self.is_selinux_enabled end it "should return a context" do - expect(self).to receive(:selinux_support?).and_return(true) - expect(Selinux).to receive(:lgetfilecon).with("/foo").and_return([0, "user_u:role_r:type_t:s0"]) - expect(get_selinux_current_context("/foo")).to eq("user_u:role_r:type_t:s0") + without_partial_double_verification do + expect(self).to receive(:selinux_support?).and_return(true) + expect(Selinux).to receive(:lgetfilecon).with("/foo").and_return([0, "user_u:role_r:type_t:s0"]) + expect(get_selinux_current_context("/foo")).to eq("user_u:role_r:type_t:s0") + end end it "should return nil if lgetfilecon fails" do - expect(self).to receive(:selinux_support?).and_return(true) - expect(Selinux).to receive(:lgetfilecon).with("/foo").and_return(-1) - expect(get_selinux_current_context("/foo")).to be_nil + without_partial_double_verification do + expect(self).to receive(:selinux_support?).and_return(true) + expect(Selinux).to receive(:lgetfilecon).with("/foo").and_return(-1) + expect(get_selinux_current_context("/foo")).to be_nil + end end end @@ -130,47 +134,57 @@ def self.is_selinux_enabled end it "should return a context if a default context exists" do - expect(self).to receive(:selinux_support?).and_return(true) - fstat = double('File::Stat', :mode => 0) - expect(Puppet::FileSystem).to receive(:lstat).with('/foo').and_return(fstat) - expect(self).to receive(:find_fs).with("/foo").and_return("ext3") - expect(Selinux).to receive(:matchpathcon).with("/foo", 0).and_return([0, "user_u:role_r:type_t:s0"]) - - expect(get_selinux_default_context("/foo")).to eq("user_u:role_r:type_t:s0") + without_partial_double_verification do + expect(self).to receive(:selinux_support?).and_return(true) + fstat = double('File::Stat', :mode => 0) + expect(Puppet::FileSystem).to receive(:lstat).with('/foo').and_return(fstat) + expect(self).to receive(:find_fs).with("/foo").and_return("ext3") + expect(Selinux).to receive(:matchpathcon).with("/foo", 0).and_return([0, "user_u:role_r:type_t:s0"]) + + expect(get_selinux_default_context("/foo")).to eq("user_u:role_r:type_t:s0") + end end it "handles permission denied errors by issuing a warning" do - allow(self).to receive(:selinux_support?).and_return(true) - allow(self).to receive(:selinux_label_support?).and_return(true) - allow(Selinux).to receive(:matchpathcon).with("/root/chuj", 0).and_return(-1) - allow(self).to receive(:file_lstat).with("/root/chuj").and_raise(Errno::EACCES, "/root/chuj") + without_partial_double_verification do + allow(self).to receive(:selinux_support?).and_return(true) + allow(self).to receive(:selinux_label_support?).and_return(true) + allow(Selinux).to receive(:matchpathcon).with("/root/chuj", 0).and_return(-1) + allow(self).to receive(:file_lstat).with("/root/chuj").and_raise(Errno::EACCES, "/root/chuj") - expect(get_selinux_default_context("/root/chuj")).to be_nil + expect(get_selinux_default_context("/root/chuj")).to be_nil + end end it "handles no such file or directory errors by issuing a warning" do - allow(self).to receive(:selinux_support?).and_return(true) - allow(self).to receive(:selinux_label_support?).and_return(true) - allow(Selinux).to receive(:matchpathcon).with("/root/chuj", 0).and_return(-1) - allow(self).to receive(:file_lstat).with("/root/chuj").and_raise(Errno::ENOENT, "/root/chuj") + without_partial_double_verification do + allow(self).to receive(:selinux_support?).and_return(true) + allow(self).to receive(:selinux_label_support?).and_return(true) + allow(Selinux).to receive(:matchpathcon).with("/root/chuj", 0).and_return(-1) + allow(self).to receive(:file_lstat).with("/root/chuj").and_raise(Errno::ENOENT, "/root/chuj") - expect(get_selinux_default_context("/root/chuj")).to be_nil + expect(get_selinux_default_context("/root/chuj")).to be_nil + end end it "should return nil if matchpathcon returns failure" do - expect(self).to receive(:selinux_support?).and_return(true) - fstat = double('File::Stat', :mode => 0) - expect(Puppet::FileSystem).to receive(:lstat).with('/foo').and_return(fstat) - expect(self).to receive(:find_fs).with("/foo").and_return("ext3") - expect(Selinux).to receive(:matchpathcon).with("/foo", 0).and_return(-1) - - expect(get_selinux_default_context("/foo")).to be_nil + without_partial_double_verification do + expect(self).to receive(:selinux_support?).and_return(true) + fstat = double('File::Stat', :mode => 0) + expect(Puppet::FileSystem).to receive(:lstat).with('/foo').and_return(fstat) + expect(self).to receive(:find_fs).with("/foo").and_return("ext3") + expect(Selinux).to receive(:matchpathcon).with("/foo", 0).and_return(-1) + + expect(get_selinux_default_context("/foo")).to be_nil + end end it "should return nil if selinux_label_support returns false" do - expect(self).to receive(:selinux_support?).and_return(true) - expect(self).to receive(:find_fs).with("/foo").and_return("nfs") - expect(get_selinux_default_context("/foo")).to be_nil + without_partial_double_verification do + expect(self).to receive(:selinux_support?).and_return(true) + expect(self).to receive(:find_fs).with("/foo").and_return("nfs") + expect(get_selinux_default_context("/foo")).to be_nil + end end end @@ -261,37 +275,47 @@ def self.is_selinux_enabled end it "should use lsetfilecon to set a context" do - expect(self).to receive(:selinux_support?).and_return(true) - expect(Selinux).to receive(:lsetfilecon).with("/foo", "user_u:role_r:type_t:s0").and_return(0) - expect(set_selinux_context("/foo", "user_u:role_r:type_t:s0")).to be_truthy + without_partial_double_verification do + expect(self).to receive(:selinux_support?).and_return(true) + expect(Selinux).to receive(:lsetfilecon).with("/foo", "user_u:role_r:type_t:s0").and_return(0) + expect(set_selinux_context("/foo", "user_u:role_r:type_t:s0")).to be_truthy + end end it "should use lsetfilecon to set user_u user context" do - expect(self).to receive(:selinux_support?).and_return(true) - expect(Selinux).to receive(:lgetfilecon).with("/foo").and_return([0, "foo:role_r:type_t:s0"]) - expect(Selinux).to receive(:lsetfilecon).with("/foo", "user_u:role_r:type_t:s0").and_return(0) - expect(set_selinux_context("/foo", "user_u", :seluser)).to be_truthy + without_partial_double_verification do + expect(self).to receive(:selinux_support?).and_return(true) + expect(Selinux).to receive(:lgetfilecon).with("/foo").and_return([0, "foo:role_r:type_t:s0"]) + expect(Selinux).to receive(:lsetfilecon).with("/foo", "user_u:role_r:type_t:s0").and_return(0) + expect(set_selinux_context("/foo", "user_u", :seluser)).to be_truthy + end end it "should use lsetfilecon to set role_r role context" do - expect(self).to receive(:selinux_support?).and_return(true) - expect(Selinux).to receive(:lgetfilecon).with("/foo").and_return([0, "user_u:foo:type_t:s0"]) - expect(Selinux).to receive(:lsetfilecon).with("/foo", "user_u:role_r:type_t:s0").and_return(0) - expect(set_selinux_context("/foo", "role_r", :selrole)).to be_truthy + without_partial_double_verification do + expect(self).to receive(:selinux_support?).and_return(true) + expect(Selinux).to receive(:lgetfilecon).with("/foo").and_return([0, "user_u:foo:type_t:s0"]) + expect(Selinux).to receive(:lsetfilecon).with("/foo", "user_u:role_r:type_t:s0").and_return(0) + expect(set_selinux_context("/foo", "role_r", :selrole)).to be_truthy + end end it "should use lsetfilecon to set type_t type context" do - expect(self).to receive(:selinux_support?).and_return(true) - expect(Selinux).to receive(:lgetfilecon).with("/foo").and_return([0, "user_u:role_r:foo:s0"]) - expect(Selinux).to receive(:lsetfilecon).with("/foo", "user_u:role_r:type_t:s0").and_return(0) - expect(set_selinux_context("/foo", "type_t", :seltype)).to be_truthy + without_partial_double_verification do + expect(self).to receive(:selinux_support?).and_return(true) + expect(Selinux).to receive(:lgetfilecon).with("/foo").and_return([0, "user_u:role_r:foo:s0"]) + expect(Selinux).to receive(:lsetfilecon).with("/foo", "user_u:role_r:type_t:s0").and_return(0) + expect(set_selinux_context("/foo", "type_t", :seltype)).to be_truthy + end end it "should use lsetfilecon to set s0:c3,c5 range context" do - expect(self).to receive(:selinux_support?).and_return(true) - expect(Selinux).to receive(:lgetfilecon).with("/foo").and_return([0, "user_u:role_r:type_t:s0"]) - expect(Selinux).to receive(:lsetfilecon).with("/foo", "user_u:role_r:type_t:s0:c3,c5").and_return(0) - expect(set_selinux_context("/foo", "s0:c3,c5", :selrange)).to be_truthy + without_partial_double_verification do + expect(self).to receive(:selinux_support?).and_return(true) + expect(Selinux).to receive(:lgetfilecon).with("/foo").and_return([0, "user_u:role_r:type_t:s0"]) + expect(Selinux).to receive(:lsetfilecon).with("/foo", "user_u:role_r:type_t:s0:c3,c5").and_return(0) + expect(set_selinux_context("/foo", "s0:c3,c5", :selrange)).to be_truthy + end end end From 0d77e853bdffa05b43f1fb3f3fc1cf4e92fed519 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Tue, 10 Nov 2020 16:49:56 -0800 Subject: [PATCH 268/731] (maint) Cleanup indirector tests The tests hid the fact that `save` takes different arguments than other methods, and some methods (like `search`) are not supported for the filebucket :file terminus. --- .../file_bucket_file/selector_spec.rb | 34 ++++++++++++++----- spec/unit/indirector/indirection_spec.rb | 20 +++++------ spec/unit/indirector_spec.rb | 4 +-- 3 files changed, 36 insertions(+), 22 deletions(-) diff --git a/spec/unit/indirector/file_bucket_file/selector_spec.rb b/spec/unit/indirector/file_bucket_file/selector_spec.rb index 963921eff08..951243e4472 100644 --- a/spec/unit/indirector/file_bucket_file/selector_spec.rb +++ b/spec/unit/indirector/file_bucket_file/selector_spec.rb @@ -5,22 +5,40 @@ require 'puppet/indirector/file_bucket_file/rest' describe Puppet::FileBucketFile::Selector do + let(:model) { Puppet::FileBucket::File.new('') } + let(:indirection) { Puppet::FileBucket::File.indirection } + let(:terminus) { indirection.terminus(:selector) } + %w[head find save search destroy].each do |method| describe "##{method}" do it "should proxy to rest terminus for https requests" do - request = double('request', :protocol => 'https') + key = "https://example.com/path/to/file" - expect_any_instance_of(Puppet::FileBucketFile::Rest).to receive(method).with(request) + expect(indirection.terminus(:rest)).to receive(method) - subject.send(method, request) + if method == 'save' + terminus.send(method, indirection.request(method, key, model)) + else + terminus.send(method, indirection.request(method, key, nil)) + end end it "should proxy to file terminus for other requests" do - request = double('request', :protocol => 'file') - - expect_any_instance_of(Puppet::FileBucketFile::File).to receive(method).with(request) - - subject.send(method, request) + key = "file:///path/to/file" + + case method + when 'save' + expect(indirection.terminus(:file)).to receive(method) + terminus.send(method, indirection.request(method, key, model)) + when 'find', 'head' + expect(indirection.terminus(:file)).to receive(method) + terminus.send(method, indirection.request(method, key, nil)) + else + # file terminus doesn't implement search or destroy + expect { + terminus.send(method, indirection.request(method, key, nil)) + }.to raise_error(NoMethodError) + end end end end diff --git a/spec/unit/indirector/indirection_spec.rb b/spec/unit/indirector/indirection_spec.rb index 996c1142fce..85648820a5b 100644 --- a/spec/unit/indirector/indirection_spec.rb +++ b/spec/unit/indirector/indirection_spec.rb @@ -178,29 +178,25 @@ def authorized? describe "creates a request" do it "should create it with its name as the request's indirection name" do - expect(Puppet::Indirector::Request).to receive(:new).with(@indirection.name, anything, anything) - @indirection.request(:funtest, "yayness") + expect(@indirection.request(:funtest, "yayness", nil).indirection_name).to eq(@indirection.name) end it "should require a method and key" do - expect(Puppet::Indirector::Request).to receive(:new).with(anything, :funtest, "yayness") - @indirection.request(:funtest, "yayness") + request = @indirection.request(:funtest, "yayness", nil) + expect(request.method).to eq(:funtest) + expect(request.key).to eq("yayness") end it "should support optional arguments" do - expect(Puppet::Indirector::Request).to receive(:new).with(anything, anything, anything, {:one => :two}) - @indirection.request(:funtest, "yayness", :one => :two) + expect(@indirection.request(:funtest, "yayness", nil, :one => :two).options).to eq(:one => :two) end it "should not pass options if none are supplied" do - expect(Puppet::Indirector::Request).to receive(:new).with(anything, anything, anything) - @indirection.request(:funtest, "yayness") + expect(@indirection.request(:funtest, "yayness", nil).options).to eq({}) end it "should return the request" do - request = double('request') - expect(Puppet::Indirector::Request).to receive(:new).and_return(request) - expect(@indirection.request(:funtest, "yayness")).to equal(request) + expect(@indirection.request(:funtest, "yayness", nil)).to be_a(Puppet::Indirector::Request) end end @@ -833,7 +829,7 @@ def authorized? end it "should not create a terminus instance until one is actually needed" do - expect(Puppet::Indirector).not_to receive(:terminus) + expect(@indirection).not_to receive(:terminus) Puppet::Indirector::Indirection.new(double('model'), :lazytest) end diff --git a/spec/unit/indirector_spec.rb b/spec/unit/indirector_spec.rb index 8c971b2afac..4d5dde10de8 100644 --- a/spec/unit/indirector_spec.rb +++ b/spec/unit/indirector_spec.rb @@ -112,8 +112,8 @@ def initialize(name) end it "should pass any provided options to the indirection during initialization" do - expect(Puppet::Indirector::Indirection).to receive(:new).with(@thingie, :first, {:some => :options, :indirected_class => 'Thingie'}) - @indirection = @thingie.indirects :first, :some => :options + expect(Puppet::Indirector::Indirection).to receive(:new).with(@thingie, :first, {:doc => 'some docs', :indirected_class => 'Thingie'}) + @indirection = @thingie.indirects :first, :doc => 'some docs' end it "should extend the class to handle serialization" do From 60c3acc8320fb200e4988fad5ff9dac04c8b1c10 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Tue, 10 Nov 2020 16:53:14 -0800 Subject: [PATCH 269/731] (maint) Define callback method(s) Define callback methods on the resource so that we can set expectations on them. The test shows that puppet can make use of arbitrary events, but in practice only `refresh` is used. --- spec/unit/transaction/event_manager_spec.rb | 25 ++++++++++++--------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/spec/unit/transaction/event_manager_spec.rb b/spec/unit/transaction/event_manager_spec.rb index 16ecc2ea762..9232ec3a6cd 100644 --- a/spec/unit/transaction/event_manager_spec.rb +++ b/spec/unit/transaction/event_manager_spec.rb @@ -152,6 +152,9 @@ @resource = Puppet::Type.type(:file).new :path => make_absolute("/my/file") @event = Puppet::Transaction::Event.new(:name => :event, :resource => @resource) + + @resource.class.send(:define_method, :callback1) {} + @resource.class.send(:define_method, :callback2) {} end it "should call the required callback once for each set of associated events" do @@ -178,7 +181,7 @@ allow(@resource).to receive(:callback1) - @manager.process_events(@resource) #x + @manager.process_events(@resource) expect(@transaction.resource_status(@resource).events.length).to eq(1) end @@ -211,9 +214,11 @@ @event2 = Puppet::Transaction::Event.new(:name => :event, :resource => @resource) @event2.status = "success" expect(@manager).to receive(:queued_events).with(@resource).and_yield(:callback1, [@event, @event2]) + @resource.class.send(:define_method, :callback1) {} end it "should call the callback" do + expect(@resource).to receive(:callback1) @manager.process_events(@resource) @@ -225,6 +230,7 @@ allow(@event).to receive(:status).and_return("noop") allow(@resource).to receive(:event).and_return(Puppet::Transaction::Event.new) expect(@manager).to receive(:queued_events).with(@resource).and_yield(:callback1, [@event]) + @resource.class.send(:define_method, :callback1) {} end it "should log" do @@ -254,6 +260,7 @@ allow(@resource).to receive(:event).and_return(Puppet::Transaction::Event.new) allow(@resource).to receive(:noop?).and_return(true) expect(@manager).to receive(:queued_events).with(@resource).and_yield(:callback1, [@event]) + @resource.class.send(:define_method, :callback1) {} end it "should log" do @@ -279,7 +286,7 @@ describe "and the callback fails" do before do - expect(@resource).to receive(:callback1).and_raise("a failure") + @resource.class.send(:define_method, :callback1) { raise "a failure" } expect(@manager).to receive(:queued_events).and_yield(:callback1, [@event]) end @@ -323,16 +330,12 @@ describe "when queueing then processing events for a given resource" do before do - @transaction = Puppet::Transaction.new(Puppet::Resource::Catalog.new, nil, nil) - @manager = Puppet::Transaction::EventManager.new(@transaction) + @catalog = Puppet::Resource::Catalog.new + @target = Puppet::Type.type(:exec).new(name: 'target', path: ENV['PATH']) + @resource = Puppet::Type.type(:exec).new(name: 'resource', path: ENV['PATH'], notify: @target) + @catalog.add_resource(@resource, @target) - @resource = Puppet::Type.type(:file).new :path => make_absolute("/my/file") - @target = Puppet::Type.type(:file).new :path => make_absolute("/your/file") - - @graph = allow('graph') - allow(@graph).to receive(:matching_edges).and_return([]) - allow(@graph).to receive(:matching_edges).with(anything, @resource).and_return([double('edge', :target => @target, :callback => :refresh)]) - allow(@manager).to receive(:relationship_graph).and_return(@graph) + @manager = Puppet::Transaction::EventManager.new(Puppet::Transaction.new(@catalog, nil, nil)) @event = Puppet::Transaction::Event.new(:name => :notify, :resource => @target) @event2 = Puppet::Transaction::Event.new(:name => :service_start, :resource => @target, :invalidate_refreshes => true) From 7927f09e2cd8d0cc27552bbbfa22524f99917176 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Tue, 10 Nov 2020 16:55:45 -0800 Subject: [PATCH 270/731] (maint) StringIO doesn't have a path method Just create a temp file and dir. --- spec/unit/forge/module_release_spec.rb | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/spec/unit/forge/module_release_spec.rb b/spec/unit/forge/module_release_spec.rb index 42064b94717..6753ae5407a 100644 --- a/spec/unit/forge/module_release_spec.rb +++ b/spec/unit/forge/module_release_spec.rb @@ -22,13 +22,8 @@ let(:uri) { " "} let(:release) { Puppet::Forge::ModuleRelease.new(ssl_repository, JSON.parse(release_json)) } - let(:mock_file) { - mock_io = StringIO.new - allow(mock_io).to receive(:path).and_return('/dev/null') - mock_io - } - - let(:mock_dir) { '/tmp' } + let(:mock_file) { double('file', path: '/dev/null') } + let(:mock_dir) { tmpdir('dir') } let(:destination) { tmpfile('forge_module_release') } From d489f9712e3823e60fd293e986aba3c7d64d3592 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Tue, 10 Nov 2020 16:57:37 -0800 Subject: [PATCH 271/731] (maint) Don't stub nonexistent compiler methods Each test stubbed out all of the compiler methods except the one it was testing. But many of the methods no longer exist, like `store`. Just remove the stubbing. --- spec/unit/parser/compiler_spec.rb | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/spec/unit/parser/compiler_spec.rb b/spec/unit/parser/compiler_spec.rb index 9fca2902edd..f5d494f860b 100644 --- a/spec/unit/parser/compiler_spec.rb +++ b/spec/unit/parser/compiler_spec.rb @@ -240,20 +240,9 @@ def resource(type, title) end describe "when compiling" do - def compile_methods - [:set_node_parameters, :evaluate_main, :evaluate_ast_node, :evaluate_node_classes, :evaluate_generators, :fail_on_unevaluated, - :finish, :store, :extract, :evaluate_relationships] - end - - # Stub all of the main compile methods except the ones we're specifically interested in. - def compile_stub(*except) - (compile_methods - except).each { |m| allow(@compiler).to receive(m) } - end - it "should set node parameters as variables in the top scope" do params = {"a" => "b", "c" => "d"} allow(@node).to receive(:parameters).and_return(params) - compile_stub(:set_node_parameters) @compiler.compile expect(@compiler.topscope['a']).to eq("b") expect(@compiler.topscope['c']).to eq("d") @@ -262,13 +251,11 @@ def compile_stub(*except) it "should set node parameters that are of Symbol type as String variables in the top scope" do params = {"a" => :b} allow(@node).to receive(:parameters).and_return(params) - compile_stub(:set_node_parameters) @compiler.compile expect(@compiler.topscope['a']).to eq("b") end it "should set the node's environment as a string variable in top scope" do - compile_stub(:set_node_parameters) @node.merge({'wat' => 'this is how the sausage is made'}) @compiler.compile expect(@compiler.topscope['environment']).to eq("testing") @@ -276,7 +263,6 @@ def compile_stub(*except) end it "sets the environment based on node.environment instead of the parameters" do - compile_stub(:set_node_parameters) @node.parameters['environment'] = "Not actually #{@node.environment.name}" @compiler.compile @@ -286,23 +272,21 @@ def compile_stub(*except) it "should set the client and server versions on the catalog" do params = {"clientversion" => "2", "serverversion" => "3"} allow(@node).to receive(:parameters).and_return(params) - compile_stub(:set_node_parameters) @compiler.compile expect(@compiler.catalog.client_version).to eq("2") expect(@compiler.catalog.server_version).to eq("3") end it "should evaluate the main class if it exists" do - compile_stub(:evaluate_main) main_class = @known_resource_types.add Puppet::Resource::Type.new(:hostclass, "") + @compiler.topscope.source = main_class + expect(main_class).to receive(:evaluate_code).with(be_a(Puppet::Parser::Resource)) - expect(@compiler.topscope).to receive(:source=).with(main_class) @compiler.compile end it "should create a new, empty 'main' if no main class exists" do - compile_stub(:evaluate_main) @compiler.compile expect(@known_resource_types.find_hostclass("")).to be_instance_of(Puppet::Resource::Type) end @@ -325,7 +309,7 @@ def compile_stub(*except) @compiler.add_collection(colls[0]) @compiler.add_collection(colls[1]) - compile_stub(:evaluate_generators) + allow(@compiler).to receive(:fail_on_unevaluated) @compiler.compile end From 7862ebe937f119de12256ab2d3653b33cbe59c40 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Tue, 10 Nov 2020 17:09:11 -0800 Subject: [PATCH 272/731] (maint) Handle Puppet.debug with block Puppet::Util::Execute calls the block form of Puppet.debug, so we have to set the logging level for any logging to occur and adjust expectations. --- spec/unit/util/execution_spec.rb | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/spec/unit/util/execution_spec.rb b/spec/unit/util/execution_spec.rb index 5c64cb60e39..5917191e10f 100644 --- a/spec/unit/util/execution_spec.rb +++ b/spec/unit/util/execution_spec.rb @@ -639,6 +639,8 @@ def expect_cwd_to_be(cwd) describe "#execute (debug logging)" do before :each do + Puppet[:log_level] = 'debug' + stub_process_wait(0) if Puppet::Util::Platform.windows? @@ -649,47 +651,47 @@ def expect_cwd_to_be(cwd) end it "should log if no uid or gid specified" do - expect(Puppet::Util::Execution).to receive(:debug).with("Executing: 'echo hello'") + expect(Puppet).to receive(:send_log).with(:debug, "Executing: 'echo hello'") Puppet::Util::Execution.execute('echo hello') end it "should log numeric uid if specified" do - expect(Puppet::Util::Execution).to receive(:debug).with("Executing with uid=100: 'echo hello'") + expect(Puppet).to receive(:send_log).with(:debug, "Executing with uid=100: 'echo hello'") Puppet::Util::Execution.execute('echo hello', {:uid => 100}) end it "should log numeric gid if specified" do - expect(Puppet::Util::Execution).to receive(:debug).with("Executing with gid=500: 'echo hello'") + expect(Puppet).to receive(:send_log).with(:debug, "Executing with gid=500: 'echo hello'") Puppet::Util::Execution.execute('echo hello', {:gid => 500}) end it "should log numeric uid and gid if specified" do - expect(Puppet::Util::Execution).to receive(:debug).with("Executing with uid=100 gid=500: 'echo hello'") + expect(Puppet).to receive(:send_log).with(:debug, "Executing with uid=100 gid=500: 'echo hello'") Puppet::Util::Execution.execute('echo hello', {:uid => 100, :gid => 500}) end it "should log string uid if specified" do - expect(Puppet::Util::Execution).to receive(:debug).with("Executing with uid=myuser: 'echo hello'") + expect(Puppet).to receive(:send_log).with(:debug, "Executing with uid=myuser: 'echo hello'") Puppet::Util::Execution.execute('echo hello', {:uid => 'myuser'}) end it "should log string gid if specified" do - expect(Puppet::Util::Execution).to receive(:debug).with("Executing with gid=mygroup: 'echo hello'") + expect(Puppet).to receive(:send_log).with(:debug, "Executing with gid=mygroup: 'echo hello'") Puppet::Util::Execution.execute('echo hello', {:gid => 'mygroup'}) end it "should log string uid and gid if specified" do - expect(Puppet::Util::Execution).to receive(:debug).with("Executing with uid=myuser gid=mygroup: 'echo hello'") + expect(Puppet).to receive(:send_log).with(:debug, "Executing with uid=myuser gid=mygroup: 'echo hello'") Puppet::Util::Execution.execute('echo hello', {:uid => 'myuser', :gid => 'mygroup'}) end it "should log numeric uid and string gid if specified" do - expect(Puppet::Util::Execution).to receive(:debug).with("Executing with uid=100 gid=mygroup: 'echo hello'") + expect(Puppet).to receive(:send_log).with(:debug, "Executing with uid=100 gid=mygroup: 'echo hello'") Puppet::Util::Execution.execute('echo hello', {:uid => 100, :gid => 'mygroup'}) end it 'should redact commands in debug output when passed sensitive option' do - expect(Puppet::Util::Execution).to receive(:debug).with("Executing: '[redacted]'") + expect(Puppet).to receive(:send_log).with(:debug, "Executing: '[redacted]'") Puppet::Util::Execution.execute('echo hello', {:sensitive => true}) end end @@ -903,14 +905,16 @@ def expect_cwd_to_be(cwd) end it "should print meaningful debug message for string argument" do - expect(Puppet::Util::Execution).to receive(:debug).with("Executing 'echo hello'") + Puppet[:log_level] = 'debug' + expect(Puppet).to receive(:send_log).with(:debug, "Executing 'echo hello'") expect(Puppet::Util::Execution).to receive(:open).with('| echo hello 2>&1').and_return('hello') expect(Puppet::Util::Execution).to receive(:exitstatus).and_return(0) Puppet::Util::Execution.execpipe('echo hello') end it "should print meaningful debug message for array argument" do - expect(Puppet::Util::Execution).to receive(:debug).with("Executing 'echo hello'") + Puppet[:log_level] = 'debug' + expect(Puppet).to receive(:send_log).with(:debug, "Executing 'echo hello'") expect(Puppet::Util::Execution).to receive(:open).with('| echo hello 2>&1').and_return('hello') expect(Puppet::Util::Execution).to receive(:exitstatus).and_return(0) Puppet::Util::Execution.execpipe(['echo','hello']) From a0f0055af817b555e1afcf443acc6eaca2e154e9 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Tue, 17 Nov 2020 15:19:17 -0800 Subject: [PATCH 273/731] (maint) Don't stub nonexistent methods on Windows/JRuby Previously we were stubbing methods that can't work on Windows or JRuby like fork. Update the tests so it's clear what the behavior is. We have to disable partial double verification for ADSI, because the WIN32OLE class relies on method_missing. --- spec/integration/util/windows/adsi_spec.rb | 4 +- .../integration/util/windows/registry_spec.rb | 10 --- spec/unit/file_serving/metadata_spec.rb | 6 +- spec/unit/util/log_spec.rb | 3 - spec/unit/util/suidmanager_spec.rb | 85 ++++++++++--------- spec/unit/util_spec.rb | 11 ++- 6 files changed, 59 insertions(+), 60 deletions(-) diff --git a/spec/integration/util/windows/adsi_spec.rb b/spec/integration/util/windows/adsi_spec.rb index 89e8846a142..d68c1bb6324 100644 --- a/spec/integration/util/windows/adsi_spec.rb +++ b/spec/integration/util/windows/adsi_spec.rb @@ -157,7 +157,9 @@ # touch the native_object member to have it lazily loaded, so COM objects can be stubbed admins.native_object - allow(admins.native_object).to receive(:Members).and_return(members) + without_partial_double_verification do + allow(admins.native_object).to receive(:Members).and_return(members) + end # well-known NULL SID expect(admins.members[0].sid).to eq('S-1-0-0') diff --git a/spec/integration/util/windows/registry_spec.rb b/spec/integration/util/windows/registry_spec.rb index dfb11a14072..5fc3e4d543a 100644 --- a/spec/integration/util/windows/registry_spec.rb +++ b/spec/integration/util/windows/registry_spec.rb @@ -146,16 +146,6 @@ def write_corrupt_dword(reg, valuename) utf_8_bytes = ENDASH_UTF_8 + TM_UTF_8 utf_8_str = utf_8_bytes.pack('c*').force_encoding(Encoding::UTF_8) - # this problematic Ruby codepath triggers a conversion of UTF-16LE to - # a local codepage which can totally break when that codepage has no - # conversion from the given UTF-16LE characters to local codepage - # a prime example is that IBM437 has no conversion from a Unicode en-dash - expect(Win32::Registry).not_to receive(:export_string) - - # also, expect that we're using our variants of keys / values, not Rubys - expect(Win32::Registry).not_to receive(:each_key) - expect(Win32::Registry).not_to receive(:each_value) - hklm.create("#{puppet_key}\\#{subkey_name}", Win32::Registry::KEY_ALL_ACCESS | regsam) do |reg| reg.write("#{guid}", Win32::Registry::REG_SZ, utf_16_str) diff --git a/spec/unit/file_serving/metadata_spec.rb b/spec/unit/file_serving/metadata_spec.rb index edf7e79800e..1eaadd27611 100644 --- a/spec/unit/file_serving/metadata_spec.rb +++ b/spec/unit/file_serving/metadata_spec.rb @@ -266,9 +266,9 @@ path = tmpfile('bar') FileUtils.touch(path) - allow(Puppet::Util::Windows::Security).to receive(:get_owner).with(path, :use).and_raise(invalid_error) - allow(Puppet::Util::Windows::Security).to receive(:get_group).with(path, :use).and_raise(invalid_error) - allow(Puppet::Util::Windows::Security).to receive(:get_mode).with(path, :use).and_raise(invalid_error) + allow(Puppet::Util::Windows::Security).to receive(:get_owner).with(path).and_raise(invalid_error) + allow(Puppet::Util::Windows::Security).to receive(:get_group).with(path).and_raise(invalid_error) + allow(Puppet::Util::Windows::Security).to receive(:get_mode).with(path).and_raise(invalid_error) stat = Puppet::FileSystem.stat(path) diff --git a/spec/unit/util/log_spec.rb b/spec/unit/util/log_spec.rb index db7fa780ae8..12d42b23517 100644 --- a/spec/unit/util/log_spec.rb +++ b/spec/unit/util/log_spec.rb @@ -228,9 +228,6 @@ def log_notice(message) describe Puppet::Util::Log::DestEventlog, :if => Puppet.features.eventlog? do before :each do allow(Puppet::Util::Windows::EventLog).to receive(:open).and_return(double('mylog', :close => nil)) - allow(Puppet::Util::Windows::EventLog).to receive(:report_event) - allow(Puppet::Util::Windows::EventLog).to receive(:close) - allow(Puppet.features).to receive(:eventlog?).and_return(true) end it "should restrict its suitability to Windows" do diff --git a/spec/unit/util/suidmanager_spec.rb b/spec/unit/util/suidmanager_spec.rb index 84a1e637b82..3ed7b707774 100644 --- a/spec/unit/util/suidmanager_spec.rb +++ b/spec/unit/util/suidmanager_spec.rb @@ -14,12 +14,14 @@ pwent = double('pwent', :name => 'fred', :uid => 42, :gid => 42) allow(Etc).to receive(:getpwuid).with(42).and_return(pwent) - [:euid, :egid, :uid, :gid, :groups].each do |id| - allow(Process).to receive("#{id}=") {|value| xids[id] = value} + unless Puppet::Util::Platform.windows? + [:euid, :egid, :uid, :gid, :groups].each do |id| + allow(Process).to receive("#{id}=") {|value| xids[id] = value} + end end end - describe "#initgroups" do + describe "#initgroups", unless: Puppet::Util::Platform.windows? do it "should use the primary group of the user as the 'basegid'" do expect(Process).to receive(:initgroups).with('fred', 42) described_class.initgroups(42) @@ -27,7 +29,7 @@ end describe "#uid" do - it "should allow setting euid/egid" do + it "should allow setting euid/egid", unless: Puppet::Util::Platform.windows? do Puppet::Util::SUIDManager.egid = user[:gid] Puppet::Util::SUIDManager.euid = user[:uid] @@ -37,8 +39,7 @@ end describe "#asuser" do - it "should not get or set euid/egid when not root" do - allow(Puppet::Util::Platform).to receive(:windows?).and_return(false) + it "should not get or set euid/egid when not root", unless: Puppet::Util::Platform.windows? do allow(Process).to receive(:uid).and_return(1) allow(Process).to receive(:egid).and_return(51) @@ -49,13 +50,12 @@ expect(xids).to be_empty end - context "when root and not windows" do + context "when root and not Windows" do before :each do allow(Process).to receive(:uid).and_return(0) - allow(Puppet::Util::Platform).to receive(:windows?).and_return(false) end - it "should set euid/egid" do + it "should set euid/egid", unless: Puppet::Util::Platform.windows? do allow(Process).to receive(:egid).and_return(51, 51, user[:gid]) allow(Process).to receive(:euid).and_return(50, 50, user[:uid]) @@ -79,29 +79,23 @@ end it "should just yield if user and group are nil" do - yielded = false - Puppet::Util::SUIDManager.asuser(nil, nil) { yielded = true } - expect(yielded).to be_truthy + expect { |b| Puppet::Util::SUIDManager.asuser(nil, nil, &b) }.to yield_control expect(xids).to eq({}) end - it "should just change group if only group is given" do - yielded = false - Puppet::Util::SUIDManager.asuser(nil, 42) { yielded = true } - expect(yielded).to be_truthy + it "should just change group if only group is given", unless: Puppet::Util::Platform.windows? do + expect { |b| Puppet::Util::SUIDManager.asuser(nil, 42, &b) }.to yield_control expect(xids).to eq({ :egid => 42 }) end - it "should change gid to the primary group of uid by default" do + it "should change gid to the primary group of uid by default", unless: Puppet::Util::Platform.windows? do allow(Process).to receive(:initgroups) - yielded = false - Puppet::Util::SUIDManager.asuser(42) { yielded = true } - expect(yielded).to be_truthy + expect { |b| Puppet::Util::SUIDManager.asuser(42, nil, &b) }.to yield_control expect(xids).to eq({ :euid => 42, :egid => 42 }) end - it "should change both uid and gid if given" do + it "should change both uid and gid if given", unless: Puppet::Util::Platform.windows? do # I don't like the sequence, but it is the only way to assert on the # internal behaviour in a reliable fashion, given we need multiple # sequenced calls to the same methods. --daniel 2012-02-05 @@ -110,21 +104,23 @@ expect(Puppet::Util::SUIDManager).to receive(:change_group).with(Puppet::Util::SUIDManager.egid, false).ordered() expect(Puppet::Util::SUIDManager).to receive(:change_user).with(Puppet::Util::SUIDManager.euid, false).ordered() - yielded = false - Puppet::Util::SUIDManager.asuser(42, 43) { yielded = true } - expect(yielded).to be_truthy + expect { |b| Puppet::Util::SUIDManager.asuser(42, 43, &b) }.to yield_control end end - it "should not get or set euid/egid on Windows", if: Puppet::Util::Platform.windows? do - Puppet::Util::SUIDManager.asuser(user[:uid], user[:gid]) {} - - expect(xids).to be_empty + it "should just yield on Windows", if: Puppet::Util::Platform.windows? do + expect { |b| Puppet::Util::SUIDManager.asuser(1, 2, &b) }.to yield_control end end describe "#change_group" do - describe "when changing permanently" do + it "raises on Windows", if: Puppet::Util::Platform.windows? do + expect { + Puppet::Util::SUIDManager.change_group(42, true) + }.to raise_error(NotImplementedError, /change_privilege\(\) function is unimplemented/) + end + + describe "when changing permanently", unless: Puppet::Util::Platform.windows? do it "should change_privilege" do expect(Process::GID).to receive(:change_privilege) do |gid| Process.gid = gid @@ -150,7 +146,7 @@ end end - describe "when changing temporarily" do + describe "when changing temporarily", unless: Puppet::Util::Platform.windows? do it "should change only egid" do Puppet::Util::SUIDManager.change_group(42, false) @@ -161,7 +157,13 @@ end describe "#change_user" do - describe "when changing permanently" do + it "raises on Windows", if: Puppet::Util::Platform.windows? do + expect { + Puppet::Util::SUIDManager.change_user(42, true) + }.to raise_error(NotImplementedError, /initgroups\(\) function is unimplemented/) + end + + describe "when changing permanently", unless: Puppet::Util::Platform.windows? do it "should change_privilege" do expect(Process::UID).to receive(:change_privilege) do |uid| Process.uid = uid @@ -191,7 +193,7 @@ end end - describe "when changing temporarily" do + describe "when changing temporarily", unless: Puppet::Util::Platform.windows? do it "should change only euid and groups" do allow(Puppet::Util::SUIDManager).to receive(:initgroups).and_return([]) Puppet::Util::SUIDManager.change_user(42, false) @@ -221,12 +223,7 @@ end describe "#root?" do - describe "on POSIX systems" do - before :each do - allow(Puppet.features).to receive(:posix?).and_return(true) - allow(Puppet::Util::Platform).to receive(:windows?).and_return(false) - end - + describe "on POSIX systems", unless: Puppet::Util::Platform.windows? do it "should be root if uid is 0" do allow(Process).to receive(:uid).and_return(0) @@ -240,7 +237,7 @@ end end - describe "on Microsoft Windows", :if => Puppet::Util::Platform.windows? do + describe "on Windows", :if => Puppet::Util::Platform.windows? do it "should be root if user is privileged" do allow(Puppet::Util::Windows::User).to receive(:admin?).and_return(true) @@ -261,13 +258,19 @@ Puppet::Util::SUIDManager end - it "(#3419) should rescue Errno::EINVAL on OS X" do + it "raises on Windows", if: Puppet::Util::Platform.windows? do + expect { + subject.groups = [] + }.to raise_error(NotImplementedError, /groups=\(\) function is unimplemented/) + end + + it "(#3419) should rescue Errno::EINVAL on OS X", unless: Puppet::Util::Platform.windows? do expect(Process).to receive(:groups=).and_raise(Errno::EINVAL, 'blew up') expect(subject).to receive(:osx_maj_ver).and_return('10.7').twice subject.groups = ['list', 'of', 'groups'] end - it "(#3419) should fail if an Errno::EINVAL is raised NOT on OS X" do + it "(#3419) should fail if an Errno::EINVAL is raised NOT on OS X", unless: Puppet::Util::Platform.windows? do expect(Process).to receive(:groups=).and_raise(Errno::EINVAL, 'blew up') expect(subject).to receive(:osx_maj_ver).and_return(false) expect { subject.groups = ['list', 'of', 'groups'] }.to raise_error(Errno::EINVAL) diff --git a/spec/unit/util_spec.rb b/spec/unit/util_spec.rb index 63a6b36aa1a..87bd9ccdfb1 100644 --- a/spec/unit/util_spec.rb +++ b/spec/unit/util_spec.rb @@ -533,7 +533,6 @@ def withenv_utf8(&block) expect(Puppet::Util.uri_to_path(URI.parse('http://foo/bar%20baz'))).to eq('/bar baz') end - [ "http://foo/A%DB%BF%E1%9A%A0%F0%A0%9C%8E", "http://foo/A%DB%BF%E1%9A%A0%F0%A0%9C%8E".force_encoding(Encoding::ASCII) @@ -583,7 +582,15 @@ def withenv_utf8(&block) end end - describe "safe_posix_fork" do + describe "safe_posix_fork on Windows and JRuby", if: Puppet::Util::Platform.windows? || Puppet::Util::Platform.jruby? do + it "raises not implemented error" do + expect { + Puppet::Util.safe_posix_fork + }.to raise_error(NotImplementedError, /fork/) + end + end + + describe "safe_posix_fork", unless: Puppet::Util::Platform.windows? || Puppet::Util::Platform.jruby? do let(:pid) { 5501 } before :each do From d45a3cd6c0f5307b821634af0b4f7cf6091bdcc7 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Tue, 5 Jan 2021 16:34:03 -0800 Subject: [PATCH 274/731] (maint) Allow additional respond_to arguments Respond_to?(:getgrouplist) is called to determine if the host successfully loaded the getgrouplist function from libc. It may be called with additional arguments, so ignore them. If respond_to?(:getgrouplist) returns false, then a LoadError is raised and rescued, and the error message is logged at debug: Falling back to Puppet::Etc.group: The 'getgrouplist' method is not available Remove extra whitespace. --- lib/puppet/util/posix.rb | 2 +- spec/unit/util/posix_spec.rb | 26 ++++++++++++++++---------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/lib/puppet/util/posix.rb b/lib/puppet/util/posix.rb index f6f0694c7af..d5de9837a7e 100644 --- a/lib/puppet/util/posix.rb +++ b/lib/puppet/util/posix.rb @@ -23,7 +23,7 @@ def groups_of(user) groups << group.name if group.mem.include?(user) end end - + uniq_groups = groups.uniq if uniq_groups != groups Puppet.debug(_('Removing any duplicate group entries')) diff --git a/spec/unit/util/posix_spec.rb b/spec/unit/util/posix_spec.rb index b8a3c7fc860..99dcf1bc1a9 100644 --- a/spec/unit/util/posix_spec.rb +++ b/spec/unit/util/posix_spec.rb @@ -63,7 +63,7 @@ def prepare_user_and_groups_env(user, groups) end before(:each) do - allow(Puppet::FFI::POSIX::Functions).to receive(:respond_to?).with(:getgrouplist).and_return(true) + allow(Puppet::FFI::POSIX::Functions).to receive(:respond_to?).with(:getgrouplist, any_args).and_return(true) end describe 'when it uses FFI function getgrouplist' do @@ -77,7 +77,7 @@ def prepare_user_and_groups_env(user, groups) context 'for user1' do let(:user) { 'user1' } let(:expected_groups) { ['group1', 'group3'] } - + before(:each) do prepare_user_and_groups_env(user, expected_groups) allow(Puppet::FFI::POSIX::Functions).to receive(:getgrouplist).and_return(1) @@ -96,9 +96,10 @@ def prepare_user_and_groups_env(user, groups) context 'for user2' do let(:user) { 'user2' } let(:expected_groups) { ['group1', 'group2', 'group4'] } - + before(:each) do prepare_user_and_groups_env(user, expected_groups) + allow(Puppet::FFI::POSIX::Functions).to receive(:respond_to?).with(:getgrouplist, any_args).and_return(true) allow(Puppet::FFI::POSIX::Functions).to receive(:getgrouplist).and_return(1) end @@ -116,9 +117,10 @@ def prepare_user_and_groups_env(user, groups) describe 'when there are no groups' do let(:user) { 'nomembers' } let(:expected_groups) { [] } - + before(:each) do prepare_user_and_groups_env(user, expected_groups) + allow(Puppet::FFI::POSIX::Functions).to receive(:respond_to?).with(:getgrouplist, any_args).and_return(true) allow(Puppet::FFI::POSIX::Functions).to receive(:getgrouplist).and_return(1) end @@ -138,6 +140,7 @@ def prepare_user_and_groups_env(user, groups) before(:each) do prepare_user_and_groups_env(user, expected_groups) + allow(Puppet::FFI::POSIX::Functions).to receive(:respond_to?).with(:getgrouplist, any_args).and_return(true) allow(Puppet::FFI::POSIX::Functions).to receive(:getgrouplist).and_return(1) end @@ -157,6 +160,7 @@ def prepare_user_and_groups_env(user, groups) before(:each) do prepare_user_and_groups_env(user, expected_groups) + allow(Puppet::FFI::POSIX::Functions).to receive(:respond_to?).with(:getgrouplist, any_args).and_return(true) allow(Puppet::FFI::POSIX::Functions).to receive(:getgrouplist).and_return(1) end @@ -184,6 +188,7 @@ def prepare_user_and_groups_env(user, groups) let(:expected_groups) { ['root'] } before(:each) do + allow(Puppet::FFI::POSIX::Functions).to receive(:respond_to?).with(:getgrouplist, any_args).and_return(true) allow(Puppet::FFI::POSIX::Functions).to receive(:getgrouplist).and_return(1) end @@ -206,6 +211,7 @@ def prepare_user_and_groups_env(user, groups) allow(FFI::MemoryPointer).to receive(:new).with(:uint, Puppet::FFI::POSIX::Constants::MAXIMUM_NUMBER_OF_GROUPS * 2).and_yield(groups_ptr) allow(ngroups_ptr).to receive(:write_int).with(Puppet::FFI::POSIX::Constants::MAXIMUM_NUMBER_OF_GROUPS * 2).and_return(ngroups_ptr) + allow(Puppet::FFI::POSIX::Functions).to receive(:respond_to?).with(:getgrouplist, any_args).and_return(true) allow(Puppet::FFI::POSIX::Functions).to receive(:getgrouplist).and_return(-1, 1) end @@ -233,7 +239,7 @@ def prepare_user_and_groups_env(user, groups) allow(Puppet::Etc).to receive(:getpwnam).with(user).and_raise(ArgumentError, "can't find user for #{user}") allow(Puppet).to receive(:debug) - expect(Puppet::FFI::POSIX::Functions).not_to receive(:getgrouplist) + allow(Puppet::FFI::POSIX::Functions).to receive(:respond_to?).with(:getgrouplist, any_args).and_return(false) end describe 'when there are groups' do @@ -246,7 +252,7 @@ def prepare_user_and_groups_env(user, groups) end it 'logs a debug message' do - expect(Puppet).to receive(:debug).with("Falling back to Puppet::Etc.group: can't find user for #{user}") + expect(Puppet).to receive(:debug).with("Falling back to Puppet::Etc.group: The 'getgrouplist' method is not available") Puppet::Util::POSIX.groups_of(user) end end @@ -260,7 +266,7 @@ def prepare_user_and_groups_env(user, groups) end it 'logs a debug message' do - expect(Puppet).to receive(:debug).with("Falling back to Puppet::Etc.group: can't find user for #{user}") + expect(Puppet).to receive(:debug).with("Falling back to Puppet::Etc.group: The 'getgrouplist' method is not available") Puppet::Util::POSIX.groups_of(user) end end @@ -275,7 +281,7 @@ def prepare_user_and_groups_env(user, groups) end it 'logs a debug message' do - expect(Puppet).to receive(:debug).with("Falling back to Puppet::Etc.group: can't find user for #{user}") + expect(Puppet).to receive(:debug).with("Falling back to Puppet::Etc.group: The 'getgrouplist' method is not available") Puppet::Util::POSIX.groups_of(user) end end @@ -289,7 +295,7 @@ def prepare_user_and_groups_env(user, groups) end it 'logs a debug message' do - expect(Puppet).to receive(:debug).with("Falling back to Puppet::Etc.group: can't find user for #{user}") + expect(Puppet).to receive(:debug).with("Falling back to Puppet::Etc.group: The 'getgrouplist' method is not available") Puppet::Util::POSIX.groups_of(user) end end @@ -303,7 +309,7 @@ def prepare_user_and_groups_env(user, groups) end it 'logs a debug message' do - expect(Puppet).to receive(:debug).with("Falling back to Puppet::Etc.group: can't find user for #{user}") + expect(Puppet).to receive(:debug).with("Falling back to Puppet::Etc.group: The 'getgrouplist' method is not available") Puppet::Util::POSIX.groups_of(user) end end From f326349d155078f727a21f49c625808ce6ad00ee Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Tue, 10 Nov 2020 17:12:22 -0800 Subject: [PATCH 275/731] (maint) Verify partial doubles Verify that an object implements an allowed or expected method. This only affects partial doubles (real objects with a stubbed method), not objects created via `double`. --- spec/spec_helper.rb | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 9c083e4fae6..690b52a17c4 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -84,10 +84,7 @@ module PuppetSpec config.filter_run_when_matching :focus config.mock_with :rspec do |mocks| - # We really should have this on, but it breaks a _lot_ of tests. We'll - # need to go through and fix those tests first before it can be enabled - # for real. - mocks.verify_partial_doubles = false + mocks.verify_partial_doubles = true end tmpdir = Puppet::FileSystem.expand_path(Dir.mktmpdir("rspecrun")) From 30aeffe8d7d5cc40d417e1eed1c07c8a948a9110 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Fri, 8 Jan 2021 08:06:29 +0000 Subject: [PATCH 276/731] (packaging) Updating the puppet.pot file --- locales/puppet.pot | 288 +++++++++++++++++++++++---------------------- 1 file changed, 148 insertions(+), 140 deletions(-) diff --git a/locales/puppet.pot b/locales/puppet.pot index 2ee168d45e8..5e3a3683b5a 100644 --- a/locales/puppet.pot +++ b/locales/puppet.pot @@ -1,16 +1,16 @@ # SOME DESCRIPTIVE TITLE. -# Copyright (C) 2020 Puppet, Inc. +# Copyright (C) 2021 Puppet, Inc. # This file is distributed under the same license as the Puppet automation framework package. -# FIRST AUTHOR , 2020. +# FIRST AUTHOR , 2021. # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Puppet automation framework 6.19.1-404-g6fd33ed69c\n" +"Project-Id-Version: Puppet automation framework 7.1.0-68-gf3289edef9\n" "\n" "Report-Msgid-Bugs-To: https://tickets.puppetlabs.com\n" -"POT-Creation-Date: 2020-10-29 10:41+0000\n" -"PO-Revision-Date: 2020-10-29 10:41+0000\n" +"POT-Creation-Date: 2021-01-08 08:06+0000\n" +"PO-Revision-Date: 2021-01-08 08:06+0000\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -168,11 +168,11 @@ msgstr "" msgid "No valid command or main" msgstr "" -#: ../lib/puppet/application.rb:483 +#: ../lib/puppet/application.rb:486 msgid "Could not set logdest to %{dest}." msgstr "" -#: ../lib/puppet/application.rb:576 +#: ../lib/puppet/application.rb:580 msgid "No help available for puppet %{app_name}" msgstr "" @@ -184,19 +184,19 @@ msgstr "" msgid "The puppet agent daemon" msgstr "" -#: ../lib/puppet/application/agent.rb:414 +#: ../lib/puppet/application/agent.rb:415 msgid "Fingerprint asked but neither the certificate, nor the certificate request have been issued" msgstr "" -#: ../lib/puppet/application/agent.rb:419 +#: ../lib/puppet/application/agent.rb:420 msgid "Failed to generate fingerprint: %{message}" msgstr "" -#: ../lib/puppet/application/agent.rb:442 +#: ../lib/puppet/application/agent.rb:443 msgid "Starting Puppet client version %{version}" msgstr "" -#: ../lib/puppet/application/agent.rb:458 +#: ../lib/puppet/application/agent.rb:459 msgid "The puppet agent command does not take parameters" msgstr "" @@ -206,35 +206,35 @@ msgstr "" #. TRANSLATORS "puppet apply" is a program command and should not be translated #. TRANSLATORS "puppet apply" is a program command and should not be translated -#: ../lib/puppet/application/apply.rb:207 ../lib/puppet/application/apply.rb:320 +#: ../lib/puppet/application/apply.rb:208 ../lib/puppet/application/apply.rb:321 msgid "For puppet apply" msgstr "" -#: ../lib/puppet/application/apply.rb:215 +#: ../lib/puppet/application/apply.rb:216 msgid "%{file} is not readable" msgstr "" -#: ../lib/puppet/application/apply.rb:286 ../lib/puppet/application/script.rb:239 +#: ../lib/puppet/application/apply.rb:287 ../lib/puppet/application/script.rb:240 msgid "Exiting" msgstr "" -#: ../lib/puppet/application/apply.rb:330 +#: ../lib/puppet/application/apply.rb:331 msgid "Could not deserialize catalog from %{format}: %{detail}" msgstr "" -#: ../lib/puppet/application/apply.rb:351 ../lib/puppet/application/script.rb:144 +#: ../lib/puppet/application/apply.rb:352 ../lib/puppet/application/script.rb:145 msgid "Could not find facts for %{node}" msgstr "" -#: ../lib/puppet/application/apply.rb:363 ../lib/puppet/application/script.rb:152 +#: ../lib/puppet/application/apply.rb:364 ../lib/puppet/application/script.rb:153 msgid "Could not find node %{node}" msgstr "" -#: ../lib/puppet/application/apply.rb:376 ../lib/puppet/application/script.rb:137 +#: ../lib/puppet/application/apply.rb:377 ../lib/puppet/application/script.rb:138 msgid "Could not find file %{manifest}" msgstr "" -#: ../lib/puppet/application/apply.rb:377 +#: ../lib/puppet/application/apply.rb:378 msgid "Only one file can be applied per run. Skipping %{files}" msgstr "" @@ -246,47 +246,47 @@ msgstr "" msgid "Manage remote network devices" msgstr "" -#: ../lib/puppet/application/device.rb:230 +#: ../lib/puppet/application/device.rb:231 msgid "resource command requires target" msgstr "" -#: ../lib/puppet/application/device.rb:233 +#: ../lib/puppet/application/device.rb:234 msgid "facts command requires target" msgstr "" -#: ../lib/puppet/application/device.rb:236 +#: ../lib/puppet/application/device.rb:237 msgid "missing argument: --target is required when using --apply" msgstr "" -#: ../lib/puppet/application/device.rb:237 +#: ../lib/puppet/application/device.rb:238 msgid "%{file} does not exist, cannot apply" msgstr "" -#: ../lib/puppet/application/device.rb:255 +#: ../lib/puppet/application/device.rb:256 msgid "Target device / certificate '%{target}' not found in %{config}" msgstr "" -#: ../lib/puppet/application/device.rb:257 +#: ../lib/puppet/application/device.rb:258 msgid "No device found in %{config}" msgstr "" -#: ../lib/puppet/application/device.rb:314 +#: ../lib/puppet/application/device.rb:315 msgid "retrieving resource: %{resource} from %{target} at %{scheme}%{url_host}%{port}%{url_path}" msgstr "" -#: ../lib/puppet/application/device.rb:329 +#: ../lib/puppet/application/device.rb:330 msgid "retrieving facts from %{target} at %{scheme}%{url_host}%{port}%{url_path}" msgstr "" -#: ../lib/puppet/application/device.rb:352 +#: ../lib/puppet/application/device.rb:353 msgid "starting applying configuration to %{target} at %{scheme}%{url_host}%{port}%{url_path}" msgstr "" -#: ../lib/puppet/application/device.rb:388 ../lib/puppet/application/resource.rb:196 +#: ../lib/puppet/application/device.rb:389 ../lib/puppet/application/resource.rb:196 msgid "You must specify the type to display" msgstr "" -#: ../lib/puppet/application/device.rb:389 ../lib/puppet/application/resource.rb:197 +#: ../lib/puppet/application/device.rb:390 ../lib/puppet/application/resource.rb:197 msgid "Could not find type %{type}" msgstr "" @@ -434,11 +434,11 @@ msgstr "" msgid "Run a puppet manifests as a script without compiling a catalog" msgstr "" -#: ../lib/puppet/application/script.rb:124 +#: ../lib/puppet/application/script.rb:125 msgid "Bolt must be installed to use the script application" msgstr "" -#: ../lib/puppet/application/script.rb:138 +#: ../lib/puppet/application/script.rb:139 msgid "Only one file can be used per run. Skipping %{files}" msgstr "" @@ -583,44 +583,44 @@ msgstr "" msgid "Local environment: '%{local_env}' doesn't match server specified environment '%{catalog_env}', restarting agent run with environment '%{catalog_env}'" msgstr "" -#: ../lib/puppet/configurer.rb:421 +#: ../lib/puppet/configurer.rb:424 msgid "Failed to apply catalog: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:450 ../lib/puppet/http/resolver/server_list.rb:63 +#: ../lib/puppet/configurer.rb:453 ../lib/puppet/http/resolver/server_list.rb:63 msgid "Puppet server %{host}:%{port} is unavailable: %{code} %{reason}" msgstr "" #. TRANSLATORS 'server_list' is the name of a setting and should not be translated -#: ../lib/puppet/configurer.rb:454 ../lib/puppet/http/resolver/server_list.rb:66 +#: ../lib/puppet/configurer.rb:457 ../lib/puppet/http/resolver/server_list.rb:66 msgid "Unable to connect to server from server_list setting: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:465 ../lib/puppet/face/report.rb:47 +#: ../lib/puppet/configurer.rb:468 ../lib/puppet/face/report.rb:47 msgid "Could not send report: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:474 +#: ../lib/puppet/configurer.rb:477 msgid "Could not save last run local report: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:493 +#: ../lib/puppet/configurer.rb:496 msgid "Uploading facts for %{node} to %{server}" msgstr "" -#: ../lib/puppet/configurer.rb:501 +#: ../lib/puppet/configurer.rb:504 msgid "Failed to submit facts: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:516 +#: ../lib/puppet/configurer.rb:519 msgid "Could not run command from %{setting}: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:534 +#: ../lib/puppet/configurer.rb:537 msgid "Could not retrieve catalog from cache: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:555 +#: ../lib/puppet/configurer.rb:558 msgid "Could not retrieve catalog from remote server: %{detail}" msgstr "" @@ -688,39 +688,39 @@ msgstr "" msgid "a data type can only have one implementation" msgstr "" -#: ../lib/puppet/defaults.rb:156 +#: ../lib/puppet/defaults.rb:172 msgid "Cannot disable unrecognized warning types '%{invalid}'." msgstr "" -#: ../lib/puppet/defaults.rb:157 +#: ../lib/puppet/defaults.rb:173 msgid "Valid values are '%{values}'." msgstr "" #. TRANSLATORS 'data_binding_terminus' is a setting and should not be translated -#: ../lib/puppet/defaults.rb:522 +#: ../lib/puppet/defaults.rb:538 msgid "Setting 'data_binding_terminus' is deprecated." msgstr "" #. TRANSLATORS 'hiera' should not be translated -#: ../lib/puppet/defaults.rb:524 +#: ../lib/puppet/defaults.rb:540 msgid "Convert custom terminus to hiera 5 API." msgstr "" #. TRANSLATORS 'environment_data_provider' is a setting and should not be translated -#: ../lib/puppet/defaults.rb:717 +#: ../lib/puppet/defaults.rb:733 msgid "Setting 'environment_data_provider' is deprecated." msgstr "" -#: ../lib/puppet/defaults.rb:802 +#: ../lib/puppet/defaults.rb:818 msgid "Certificate names must be lower case" msgstr "" -#: ../lib/puppet/defaults.rb:1053 ../lib/puppet/settings/enum_setting.rb:13 ../lib/puppet/settings/symbolic_enum_setting.rb:14 +#: ../lib/puppet/defaults.rb:1069 ../lib/puppet/settings/enum_setting.rb:13 ../lib/puppet/settings/symbolic_enum_setting.rb:14 msgid "Invalid value '%{value}' for parameter %{name}. Allowed values are '%{allowed_values}'" msgstr "" #. TRANSLATORS 'pluginsync' is a setting and should not be translated -#: ../lib/puppet/defaults.rb:1895 +#: ../lib/puppet/defaults.rb:1906 msgid "Setting 'pluginsync' is deprecated." msgstr "" @@ -832,28 +832,28 @@ msgid "" "https://puppet.com/docs/puppet/latest/configuration.html#environment\n" msgstr "" -#: ../lib/puppet/face/config.rb:176 +#: ../lib/puppet/face/config.rb:186 msgid "Deleted setting from '%{section_name}': '%{setting_string}', and adding it to 'server' section" msgstr "" -#: ../lib/puppet/face/config.rb:191 +#: ../lib/puppet/face/config.rb:201 msgid "Delete a Puppet setting." msgstr "" -#: ../lib/puppet/face/config.rb:192 +#: ../lib/puppet/face/config.rb:202 msgid "" msgstr "" -#: ../lib/puppet/face/config.rb:226 ../lib/puppet/face/config.rb:230 ../lib/puppet/face/config.rb:241 +#: ../lib/puppet/face/config.rb:236 ../lib/puppet/face/config.rb:240 ../lib/puppet/face/config.rb:251 msgid "Deleted setting from '%{section_name}': '%{setting_string}'" msgstr "" -#: ../lib/puppet/face/config.rb:244 +#: ../lib/puppet/face/config.rb:254 msgid "No setting found in configuration file for section '%{section_name}' setting name '%{name}'" msgstr "" #. TRANSLATORS the 'puppet.conf' is a specific file and should not be translated -#: ../lib/puppet/face/config.rb:252 +#: ../lib/puppet/face/config.rb:262 msgid "The puppet.conf file does not exist %{puppet_conf}" msgstr "" @@ -1358,19 +1358,19 @@ msgstr "" msgid "At least one node should be passed" msgstr "" -#: ../lib/puppet/face/node/clean.rb:64 +#: ../lib/puppet/face/node/clean.rb:72 msgid "Not managing %{node} certs as this host is not a CA" msgstr "" -#: ../lib/puppet/face/node/clean.rb:71 +#: ../lib/puppet/face/node/clean.rb:79 msgid "%{node}'s facts removed" msgstr "" -#: ../lib/puppet/face/node/clean.rb:77 +#: ../lib/puppet/face/node/clean.rb:85 msgid "%{node}'s cached node removed" msgstr "" -#: ../lib/puppet/face/node/clean.rb:83 +#: ../lib/puppet/face/node/clean.rb:91 msgid "%{node}'s reports removed" msgstr "" @@ -3190,11 +3190,11 @@ msgstr "" msgid "Resolving dependencies ..." msgstr "" -#: ../lib/puppet/module_tool/applications/installer.rb:162 +#: ../lib/puppet/module_tool/applications/installer.rb:175 msgid "Preparing to install ..." msgstr "" -#: ../lib/puppet/module_tool/applications/installer.rb:165 +#: ../lib/puppet/module_tool/applications/installer.rb:178 msgid "Installing -- do not interrupt ..." msgstr "" @@ -3234,7 +3234,7 @@ msgstr "" msgid "'%{module_name}' (%{version}) requested; '%{module_name}' (%{installed_version}) already installed" msgstr "" -#: ../lib/puppet/module_tool/errors/installer.rb:16 ../lib/puppet/module_tool/errors/installer.rb:54 ../lib/puppet/module_tool/errors/installer.rb:72 ../lib/puppet/module_tool/errors/shared.rb:64 ../lib/puppet/module_tool/errors/shared.rb:106 +#: ../lib/puppet/module_tool/errors/installer.rb:16 ../lib/puppet/module_tool/errors/installer.rb:54 ../lib/puppet/module_tool/errors/installer.rb:72 ../lib/puppet/module_tool/errors/shared.rb:72 ../lib/puppet/module_tool/errors/shared.rb:114 msgid "Could not install module '%{module_name}' (%{version})" msgstr "" @@ -3264,7 +3264,7 @@ msgstr "" msgid "Could not install '%{requested_package}'" msgstr "" -#: ../lib/puppet/module_tool/errors/installer.rb:38 ../lib/puppet/module_tool/errors/shared.rb:43 +#: ../lib/puppet/module_tool/errors/installer.rb:38 ../lib/puppet/module_tool/errors/shared.rb:51 msgid " No releases are available from %{source}" msgstr "" @@ -3309,150 +3309,158 @@ msgstr "" msgid " Package attempted to install file into %{path} under %{directory}." msgstr "" -#: ../lib/puppet/module_tool/errors/shared.rb:11 +#: ../lib/puppet/module_tool/errors/shared.rb:12 msgid "Could not %{action} '%{module_name}' (%{version}); no version satisfies all dependencies" msgstr "" -#: ../lib/puppet/module_tool/errors/shared.rb:16 ../lib/puppet/module_tool/errors/shared.rb:171 ../lib/puppet/module_tool/errors/upgrader.rb:58 +#: ../lib/puppet/module_tool/errors/shared.rb:17 ../lib/puppet/module_tool/errors/shared.rb:179 ../lib/puppet/module_tool/errors/upgrader.rb:58 msgid "Could not %{action} module '%{module_name}' (%{version})" msgstr "" -#: ../lib/puppet/module_tool/errors/shared.rb:17 -msgid " No version of '%{module_name}' can satisfy all dependencies" +#: ../lib/puppet/module_tool/errors/shared.rb:20 +msgid " The requested version cannot satisfy the following dependency: %{name}" +msgstr "" + +#: ../lib/puppet/module_tool/errors/shared.rb:21 +msgid " Installed: %{current_version}, expected: %{constraints}" +msgstr "" + +#: ../lib/puppet/module_tool/errors/shared.rb:23 +msgid " The requested version cannot satisfy all dependencies" msgstr "" #. TRANSLATORS `puppet module %{action} --ignore-dependencies` is a command line and should not be translated -#: ../lib/puppet/module_tool/errors/shared.rb:19 -msgid " Use `puppet module %{action} --ignore-dependencies` to %{action} only this module" +#: ../lib/puppet/module_tool/errors/shared.rb:27 +msgid " Use `puppet module %{action} '%{module_name}' --ignore-dependencies` to %{action} only this module" msgstr "" -#: ../lib/puppet/module_tool/errors/shared.rb:33 +#: ../lib/puppet/module_tool/errors/shared.rb:41 msgid "Could not %{action} '%{module_name}'; no releases are available from %{source}" msgstr "" -#: ../lib/puppet/module_tool/errors/shared.rb:35 +#: ../lib/puppet/module_tool/errors/shared.rb:43 msgid "Could not %{action} '%{module_name}'; no releases matching '%{version}' are available from %{source}" msgstr "" -#: ../lib/puppet/module_tool/errors/shared.rb:41 +#: ../lib/puppet/module_tool/errors/shared.rb:49 msgid "Could not %{action} '%{module_name}' (%{version})" msgstr "" -#: ../lib/puppet/module_tool/errors/shared.rb:44 +#: ../lib/puppet/module_tool/errors/shared.rb:52 msgid " Does '%{module_name}' have at least one published release?" msgstr "" -#: ../lib/puppet/module_tool/errors/shared.rb:46 +#: ../lib/puppet/module_tool/errors/shared.rb:54 msgid " No releases matching '%{requested_version}' are available from %{source}" msgstr "" -#: ../lib/puppet/module_tool/errors/shared.rb:59 +#: ../lib/puppet/module_tool/errors/shared.rb:67 msgid "'%{module_name}' (%{version}) requested; installation conflict" msgstr "" -#: ../lib/puppet/module_tool/errors/shared.rb:67 +#: ../lib/puppet/module_tool/errors/shared.rb:75 msgid " Dependency '%{name}' (%{version}) would overwrite %{directory}" msgstr "" -#: ../lib/puppet/module_tool/errors/shared.rb:69 +#: ../lib/puppet/module_tool/errors/shared.rb:77 msgid " Installation would overwrite %{directory}" msgstr "" -#: ../lib/puppet/module_tool/errors/shared.rb:73 +#: ../lib/puppet/module_tool/errors/shared.rb:81 msgid " Currently, '%{current_name}' (%{current_version}) is installed to that directory" msgstr "" #. TRANSLATORS `puppet module install --ignore-dependencies` is a command line and should not be translated -#: ../lib/puppet/module_tool/errors/shared.rb:78 +#: ../lib/puppet/module_tool/errors/shared.rb:86 msgid " Use `puppet module install --ignore-dependencies` to install only this module" msgstr "" #. TRANSLATORS `puppet module install --force` is a command line and should not be translated #. TRANSLATORS `puppet module install --force` is a command line and should not be translated -#: ../lib/puppet/module_tool/errors/shared.rb:81 ../lib/puppet/module_tool/errors/shared.rb:110 +#: ../lib/puppet/module_tool/errors/shared.rb:89 ../lib/puppet/module_tool/errors/shared.rb:118 msgid " Use `puppet module install --force` to install this module anyway" msgstr "" -#: ../lib/puppet/module_tool/errors/shared.rb:95 +#: ../lib/puppet/module_tool/errors/shared.rb:103 msgid "'%{module_name}' (%{version}) requested; Invalid dependency cycle" msgstr "" -#: ../lib/puppet/module_tool/errors/shared.rb:100 +#: ../lib/puppet/module_tool/errors/shared.rb:108 msgid "You specified '%{name}' (%{version})" msgstr "" #. TRANSLATORS This message repeats as separate lines as a list under the heading "You specified '%{name}' (%{version})\n" -#: ../lib/puppet/module_tool/errors/shared.rb:103 +#: ../lib/puppet/module_tool/errors/shared.rb:111 msgid "This depends on '%{name}' (%{version})" msgstr "" -#: ../lib/puppet/module_tool/errors/shared.rb:107 +#: ../lib/puppet/module_tool/errors/shared.rb:115 msgid " No version of '%{module_name}' will satisfy dependencies" msgstr "" -#: ../lib/puppet/module_tool/errors/shared.rb:120 +#: ../lib/puppet/module_tool/errors/shared.rb:128 msgid "Could not %{action} '%{module_name}'; module is not installed" msgstr "" -#: ../lib/puppet/module_tool/errors/shared.rb:125 ../lib/puppet/module_tool/errors/shared.rb:148 ../lib/puppet/module_tool/errors/shared.rb:189 +#: ../lib/puppet/module_tool/errors/shared.rb:133 ../lib/puppet/module_tool/errors/shared.rb:156 ../lib/puppet/module_tool/errors/shared.rb:197 msgid "Could not %{action} module '%{module_name}'" msgstr "" -#: ../lib/puppet/module_tool/errors/shared.rb:126 +#: ../lib/puppet/module_tool/errors/shared.rb:134 msgid " Module '%{module_name}' is not installed" msgstr "" #. TRANSLATORS `puppet module %{action} %{suggestion}` is a command line and should not be translated -#: ../lib/puppet/module_tool/errors/shared.rb:129 +#: ../lib/puppet/module_tool/errors/shared.rb:137 msgid " You may have meant `puppet module %{action} %{suggestion}`" msgstr "" #. TRANSLATORS `puppet module install` is a command line and should not be translated -#: ../lib/puppet/module_tool/errors/shared.rb:132 +#: ../lib/puppet/module_tool/errors/shared.rb:140 msgid " Use `puppet module install` to install this module" msgstr "" #. TRANSLATORS "module path" refers to a set of directories where modules may be installed -#: ../lib/puppet/module_tool/errors/shared.rb:143 +#: ../lib/puppet/module_tool/errors/shared.rb:151 msgid "Could not %{action} '%{module_name}'; module appears in multiple places in the module path" msgstr "" -#: ../lib/puppet/module_tool/errors/shared.rb:149 +#: ../lib/puppet/module_tool/errors/shared.rb:157 msgid " Module '%{module_name}' appears multiple places in the module path" msgstr "" #. TRANSLATORS This is repeats as separate lines as a list under "Module '%{module_name}' appears multiple places in the module path" -#: ../lib/puppet/module_tool/errors/shared.rb:152 +#: ../lib/puppet/module_tool/errors/shared.rb:160 msgid " '%{module_name}' (%{version}) was found in %{path}" msgstr "" #. TRANSLATORS `--modulepath` is command line option and should not be translated -#: ../lib/puppet/module_tool/errors/shared.rb:155 +#: ../lib/puppet/module_tool/errors/shared.rb:163 msgid " Use the `--modulepath` option to limit the search to specific directories" msgstr "" -#: ../lib/puppet/module_tool/errors/shared.rb:166 +#: ../lib/puppet/module_tool/errors/shared.rb:174 msgid "Could not %{action} '%{module_name}'; module has had changes made locally" msgstr "" -#: ../lib/puppet/module_tool/errors/shared.rb:172 +#: ../lib/puppet/module_tool/errors/shared.rb:180 msgid " Installed module has had changes made locally" msgstr "" #. TRANSLATORS `puppet module %{action} --ignore-changes` is a command line and should not be translated -#: ../lib/puppet/module_tool/errors/shared.rb:174 +#: ../lib/puppet/module_tool/errors/shared.rb:182 msgid " Use `puppet module %{action} --ignore-changes` to %{action} this module anyway" msgstr "" -#: ../lib/puppet/module_tool/errors/shared.rb:184 +#: ../lib/puppet/module_tool/errors/shared.rb:192 msgid "Could not %{action} '%{module_name}'; %{error}" msgstr "" -#: ../lib/puppet/module_tool/errors/shared.rb:190 +#: ../lib/puppet/module_tool/errors/shared.rb:198 msgid " Failure trying to parse metadata" msgstr "" -#: ../lib/puppet/module_tool/errors/shared.rb:191 +#: ../lib/puppet/module_tool/errors/shared.rb:199 msgid " Original message was: %{message}" msgstr "" @@ -3738,15 +3746,15 @@ msgstr "" msgid "Not a valid indirection type" msgstr "" -#: ../lib/puppet/network/http/connection.rb:43 +#: ../lib/puppet/network/http/connection.rb:47 msgid "Unrecognized option(s): %{opts}" msgstr "" -#: ../lib/puppet/network/http/connection.rb:49 +#: ../lib/puppet/network/http/connection.rb:53 msgid "Expected an instance of Puppet::SSL::Verifier but was passed a %{klass}" msgstr "" -#: ../lib/puppet/network/http/connection.rb:272 +#: ../lib/puppet/network/http/connection.rb:276 msgid "Too many HTTP redirections for %{host}:%{port}" msgstr "" @@ -3872,54 +3880,54 @@ msgstr "" #. TRANSLATORS: do not translate the variable names in this error message #. TRANSLATORS: do not translate the variable names in this error message -#: ../lib/puppet/pal/pal_impl.rb:76 ../lib/puppet/pal/pal_impl.rb:174 +#: ../lib/puppet/pal/pal_impl.rb:76 ../lib/puppet/pal/pal_impl.rb:182 msgid "manifest_file or code_string cannot be given when configured_by_env is true" msgstr "" -#: ../lib/puppet/pal/pal_impl.rb:222 +#: ../lib/puppet/pal/pal_impl.rb:238 msgid "temporary environment name" msgstr "" #. TRANSLATORS: do not translate variable name string in these assertions -#: ../lib/puppet/pal/pal_impl.rb:227 +#: ../lib/puppet/pal/pal_impl.rb:243 msgid "A block must be given to 'in_tmp_environment'" msgstr "" #. TRANSLATORS terms in the assertions below are names of terms in code -#: ../lib/puppet/pal/pal_impl.rb:282 +#: ../lib/puppet/pal/pal_impl.rb:298 msgid "A block must be given to 'in_environment'" msgstr "" #. TRANSLATORS 'in_environment' is a name, do not translate -#: ../lib/puppet/pal/pal_impl.rb:287 +#: ../lib/puppet/pal/pal_impl.rb:303 msgid "The environment directory '%{env_dir}' does not exist" msgstr "" -#: ../lib/puppet/pal/pal_impl.rb:310 +#: ../lib/puppet/pal/pal_impl.rb:326 msgid "No directory found for the environment '%{env_name}' on the path '%{envpath}'" msgstr "" -#: ../lib/puppet/pal/pal_impl.rb:364 +#: ../lib/puppet/pal/pal_impl.rb:380 msgid "Given variables must be a hash, got %{type}" msgstr "" -#: ../lib/puppet/pal/pal_impl.rb:370 +#: ../lib/puppet/pal/pal_impl.rb:386 msgid "Given variable '%{varname}' has illegal name" msgstr "" -#: ../lib/puppet/pal/pal_impl.rb:374 +#: ../lib/puppet/pal/pal_impl.rb:390 msgid "Given value for '%{varname}' has illegal type - got: %{type}" msgstr "" -#: ../lib/puppet/pal/pal_impl.rb:511 +#: ../lib/puppet/pal/pal_impl.rb:564 msgid "Puppet Pal: %{what}" msgstr "" -#: ../lib/puppet/pal/pal_impl.rb:525 +#: ../lib/puppet/pal/pal_impl.rb:578 msgid "Cannot use '%{a_term}' and '%{b_term}' at the same time" msgstr "" -#: ../lib/puppet/pal/pal_impl.rb:532 +#: ../lib/puppet/pal/pal_impl.rb:585 msgid "A block must be given" msgstr "" @@ -6326,19 +6334,19 @@ msgstr "" msgid "Mac OS X packages must specify a package source" msgstr "" -#: ../lib/puppet/provider/package/apt.rb:81 +#: ../lib/puppet/provider/package/apt.rb:85 msgid "/etc/apt/sources.list contains a cdrom source; not installing. Use 'allowcdrom' to override this failure." msgstr "" -#: ../lib/puppet/provider/package/apt.rb:163 ../lib/puppet/provider/package/fink.rb:55 +#: ../lib/puppet/provider/package/apt.rb:167 ../lib/puppet/provider/package/fink.rb:55 msgid "Could not find latest version" msgstr "" -#: ../lib/puppet/provider/package/apt.rb:174 ../lib/puppet/provider/package/fink.rb:66 +#: ../lib/puppet/provider/package/apt.rb:178 ../lib/puppet/provider/package/fink.rb:66 msgid "Preseeding %{response} to debconf-set-selections" msgstr "" -#: ../lib/puppet/provider/package/apt.rb:178 ../lib/puppet/provider/package/fink.rb:70 +#: ../lib/puppet/provider/package/apt.rb:182 ../lib/puppet/provider/package/fink.rb:70 msgid "No responsefile specified or non existent, not preseeding anything" msgstr "" @@ -7043,69 +7051,69 @@ msgstr "" msgid "Not attempting to load %{type} %{fqname} as this object was missing during a prior compilation" msgstr "" -#: ../lib/puppet/settings.rb:101 +#: ../lib/puppet/settings.rb:102 msgid "New environment loaders generated from the requested section." msgstr "" -#: ../lib/puppet/settings.rb:303 +#: ../lib/puppet/settings.rb:304 msgid "Attempting to initialize global default settings more than once!" msgstr "" -#: ../lib/puppet/settings.rb:516 +#: ../lib/puppet/settings.rb:504 msgid "Using --configprint is deprecated. Use 'puppet config ' instead." msgstr "" -#: ../lib/puppet/settings.rb:658 +#: ../lib/puppet/settings.rb:646 msgid "Could not load %{file}: %{detail}" msgstr "" -#: ../lib/puppet/settings.rb:766 +#: ../lib/puppet/settings.rb:755 msgid "Invalid setting type '%{type}'" msgstr "" -#: ../lib/puppet/settings.rb:921 +#: ../lib/puppet/settings.rb:910 msgid "Unknown searchpath case: %{source_type} for the %{source} settings path element." msgstr "" -#: ../lib/puppet/settings.rb:994 +#: ../lib/puppet/settings.rb:983 msgid "setting definition for '%{name}' is not a hash!" msgstr "" -#: ../lib/puppet/settings.rb:999 +#: ../lib/puppet/settings.rb:988 msgid "Setting %{name} is already defined" msgstr "" -#: ../lib/puppet/settings.rb:1005 +#: ../lib/puppet/settings.rb:994 msgid "Setting %{name} is already using short name '%{short}'" msgstr "" -#: ../lib/puppet/settings.rb:1276 +#: ../lib/puppet/settings.rb:1265 msgid "Setting %{name} is deprecated." msgstr "" #. TRANSLATORS 'puppet.conf' is a file name and should not be translated -#: ../lib/puppet/settings.rb:1281 +#: ../lib/puppet/settings.rb:1270 msgid "Setting %{name} is deprecated in puppet.conf." msgstr "" -#: ../lib/puppet/settings.rb:1452 +#: ../lib/puppet/settings.rb:1447 msgid "Error converting value for param '%{name}': %{detail}" msgstr "" -#: ../lib/puppet/settings.rb:1476 +#: ../lib/puppet/settings.rb:1471 msgid "Could not find value for %{expression}" msgstr "" #. TRANSLATORS '$environment' is a Puppet specific variable and should not be translated -#: ../lib/puppet/settings.rb:1486 +#: ../lib/puppet/settings.rb:1481 msgid "You cannot interpolate $environment within '%{setting_name}' when using directory environments." msgstr "" -#: ../lib/puppet/settings.rb:1487 +#: ../lib/puppet/settings.rb:1482 msgid "Its value will remain %{value}." msgstr "" -#: ../lib/puppet/settings.rb:1518 +#: ../lib/puppet/settings.rb:1513 msgid "Attempt to assign a value to unknown setting %{name}" msgstr "" @@ -8426,7 +8434,7 @@ msgstr "" msgid "Could not autoload %{name}: %{detail}" msgstr "" -#: ../lib/puppet/util/autoload.rb:184 +#: ../lib/puppet/util/autoload.rb:177 msgid "Autoload paths cannot be fully qualified" msgstr "" @@ -8979,19 +8987,19 @@ msgstr "" msgid "Unable to write the file %{file_path}. %{error}" msgstr "" -#: ../lib/puppet/util/posix.rb:22 +#: ../lib/puppet/util/posix.rb:29 msgid "Removing any duplicate group entries" msgstr "" -#: ../lib/puppet/util/posix.rb:35 +#: ../lib/puppet/util/posix.rb:75 msgid "Did not get id from caller" msgstr "" -#: ../lib/puppet/util/posix.rb:39 ../lib/puppet/util/posix.rb:64 +#: ../lib/puppet/util/posix.rb:79 ../lib/puppet/util/posix.rb:104 msgid "Tried to get %{field} field for silly id %{id}" msgstr "" -#: ../lib/puppet/util/posix.rb:92 ../lib/puppet/util/posix.rb:102 ../lib/puppet/util/posix.rb:112 +#: ../lib/puppet/util/posix.rb:132 ../lib/puppet/util/posix.rb:142 ../lib/puppet/util/posix.rb:152 msgid "Can only handle users and groups" msgstr "" From fdeab5be29364dd7210327ef901eb7d39f7cde35 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Fri, 8 Jan 2021 08:07:46 +0000 Subject: [PATCH 277/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 4 ++-- man/man8/puppet-agent.8 | 2 +- man/man8/puppet-apply.8 | 2 +- man/man8/puppet-device.8 | 2 +- man/man8/puppet-script.8 | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index 26590ae6527..57fd61510de 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -1105,7 +1105,7 @@ crit .IP "" 0 . .SS "logdest" -Where to send log messages\. Choose between \'syslog\' (the POSIX syslog service), \'eventlog\' (the Windows Event Log), \'console\', or the path to a log file\. +Where to send log messages\. Choose between \'syslog\' (the POSIX syslog service), \'eventlog\' (the Windows Event Log), \'console\', or the path to a log file\. Multiple destinations can be set using a comma separated list (eg: \fB/path/file1,console,/path/file2\fR) . .TP \fIDefault\fR: @@ -1141,7 +1141,7 @@ Setting a global value for \fBmanifest\fR in puppet\.conf is not allowed (but it The default port puppet subcommands use to communicate with Puppet Server\. (eg \fBpuppet facts upload\fR, \fBpuppet agent\fR)\. May be overridden by more specific settings (see \fBca_port\fR, \fBreport_port\fR)\. . .IP "\(bu" 4 -\fIDefault\fR: $serverport +\fIDefault\fR: 8140 . .IP "" 0 . diff --git a/man/man8/puppet-agent.8 b/man/man8/puppet-agent.8 index 4de7af737a7..eccaedacda7 100644 --- a/man/man8/puppet-agent.8 +++ b/man/man8/puppet-agent.8 @@ -126,7 +126,7 @@ Disable can also take an optional message that will be reported by the \'puppet \-\-job\-id: Attach the specified job id to the catalog request and the report used for this agent run\. This option only works when \'\-\-onetime\' is used\. When using Puppet Enterprise this flag should not be used as the orchestrator sets the job\-id for you and it must be unique\. . .IP "\(bu" 4 -\-\-logdest: Where to send log messages\. Choose between \'syslog\' (the POSIX syslog service), \'eventlog\' (the Windows Event Log), \'console\', or the path to a log file\. If debugging or verbosity is enabled, this defaults to \'console\'\. Otherwise, it defaults to \'syslog\' on POSIX systems and \'eventlog\' on Windows\. +\-\-logdest: Where to send log messages\. Choose between \'syslog\' (the POSIX syslog service), \'eventlog\' (the Windows Event Log), \'console\', or the path to a log file\. If debugging or verbosity is enabled, this defaults to \'console\'\. Otherwise, it defaults to \'syslog\' on POSIX systems and \'eventlog\' on Windows\. Multiple destinations can be set using a comma separated list (eg: \fB/path/file1,console,/path/file2\fR)" . .IP A path ending with \'\.json\' will receive structured output in JSON format\. The log file will not have an ending \']\' automatically written to it due to the appending nature of logging\. It must be appended manually to make the content valid JSON\. diff --git a/man/man8/puppet-apply.8 b/man/man8/puppet-apply.8 index f9a55e7d433..00664ceab33 100644 --- a/man/man8/puppet-apply.8 +++ b/man/man8/puppet-apply.8 @@ -55,7 +55,7 @@ See the configuration file documentation at https://puppet\.com/docs/puppet/late \-\-loadclasses: Load any stored classes\. \'puppet agent\' caches configured classes (usually at /etc/puppetlabs/puppet/classes\.txt), and setting this option causes all of those classes to be set in your puppet manifest\. . .IP "\(bu" 4 -\-\-logdest: Where to send log messages\. Choose between \'syslog\' (the POSIX syslog service), \'eventlog\' (the Windows Event Log), \'console\', or the path to a log file\. Defaults to \'console\'\. +\-\-logdest: Where to send log messages\. Choose between \'syslog\' (the POSIX syslog service), \'eventlog\' (the Windows Event Log), \'console\', or the path to a log file\. Defaults to \'console\'\. Multiple destinations can be set using a comma separated list (eg: \fB/path/file1,console,/path/file2\fR)" . .IP A path ending with \'\.json\' will receive structured output in JSON format\. The log file will not have an ending \']\' automatically written to it due to the appending nature of logging\. It must be appended manually to make the content valid JSON\. diff --git a/man/man8/puppet-device.8 b/man/man8/puppet-device.8 index f956ec12135..5869d2b45db 100644 --- a/man/man8/puppet-device.8 +++ b/man/man8/puppet-device.8 @@ -56,7 +56,7 @@ Enable full debugging\. . .TP \-\-logdest, \-l -Where to send log messages\. Choose between \'syslog\' (the POSIX syslog service), \'console\', or the path to a log file\. If debugging or verbosity is enabled, this defaults to \'console\'\. Otherwise, it defaults to \'syslog\'\. +Where to send log messages\. Choose between \'syslog\' (the POSIX syslog service), \'console\', or the path to a log file\. If debugging or verbosity is enabled, this defaults to \'console\'\. Otherwise, it defaults to \'syslog\'\. Multiple destinations can be set using a comma separated list (eg: \fB/path/file1,console,/path/file2\fR)" . .IP A path ending with \'\.json\' will receive structured output in JSON format\. The log file will not have an ending \']\' automatically written to it due to the appending nature of logging\. It must be appended manually to make the content valid JSON\. diff --git a/man/man8/puppet-script.8 b/man/man8/puppet-script.8 index 488c8524b44..834dafa7192 100644 --- a/man/man8/puppet-script.8 +++ b/man/man8/puppet-script.8 @@ -34,7 +34,7 @@ Print this help message . .TP \-\-logdest -Where to send log messages\. Choose between \'syslog\' (the POSIX syslog service), \'eventlog\' (the Windows Event Log), \'console\', or the path to a log file\. Defaults to \'console\'\. +Where to send log messages\. Choose between \'syslog\' (the POSIX syslog service), \'eventlog\' (the Windows Event Log), \'console\', or the path to a log file\. Defaults to \'console\'\. Multiple destinations can be set using a comma separated list (eg: \fB/path/file1,console,/path/file2\fR)" . .IP A path ending with \'\.json\' will receive structured output in JSON format\. The log file will not have an ending \']\' automatically written to it due to the appending nature of logging\. It must be appended manually to make the content valid JSON\. From 8d2459a31292dc031a03d2348383b67070e9603b Mon Sep 17 00:00:00 2001 From: Oana Tanasoiu Date: Mon, 11 Jan 2021 17:39:20 +0200 Subject: [PATCH 278/731] (PUP-10850)Add --no-legacy option for puppet facts --- lib/puppet/face/facts.rb | 4 ++-- lib/puppet/indirector/facts/facter.rb | 2 +- spec/unit/indirector/facts/facter_spec.rb | 11 ++++++++++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/lib/puppet/face/facts.rb b/lib/puppet/face/facts.rb index 37e4f27e774..c48e2062a9d 100644 --- a/lib/puppet/face/facts.rb +++ b/lib/puppet/face/facts.rb @@ -124,8 +124,8 @@ summary _("Disable fact caching mechanism.") end - option("--show-legacy") do - summary _("Show legacy facts when querying all facts.") + option("--no-legacy") do + summary _("Disable legacy facts when querying all facts.") end when_invoked do |*args| diff --git a/lib/puppet/indirector/facts/facter.rb b/lib/puppet/indirector/facts/facter.rb index 0d45927e15a..ce0ecb2bcda 100644 --- a/lib/puppet/indirector/facts/facter.rb +++ b/lib/puppet/indirector/facts/facter.rb @@ -100,7 +100,7 @@ def find_with_options(request) options_for_facter = String.new options_for_facter += options[:user_query].join(' ') options_for_facter += " --config #{options[:config_file]}" if options[:config_file] - options_for_facter += " --show-legacy" if options[:show_legacy] + options_for_facter += options[:no_legacy] == false ? " --show-legacy false" : " --show-legacy" options_for_facter += " --no-block" if options[:no_block] == false options_for_facter += " --no-cache" if options[:no_cache] == false diff --git a/spec/unit/indirector/facts/facter_spec.rb b/spec/unit/indirector/facts/facter_spec.rb index 196ab8e23f4..42166ed6ad6 100644 --- a/spec/unit/indirector/facts/facter_spec.rb +++ b/spec/unit/indirector/facts/facter_spec.rb @@ -153,7 +153,7 @@ end describe 'when :resolve_options is true' do - let(:options) { { resolve_options: true, user_query: ["os", "timezone"], show_legacy: true } } + let(:options) { { resolve_options: true, user_query: ["os", "timezone"] } } let(:facts) { Puppet::Node::Facts.new("foo") } before :each do @@ -173,6 +173,15 @@ @facter.find(@request) end + context 'when --no-legacy flag is present' do + let(:options) { { resolve_options: true, user_query: ["os", "timezone"], no_legacy: false } } + + it 'should call Facter.resolve method with show-legacy false' do + expect(Facter).to receive(:resolve).with("os timezone --show-legacy false") + @facter.find(@request) + end + end + describe 'when Facter version is lower than 4.0.40' do before :each do allow(Facter).to receive(:respond_to?).and_return(false) From 01e6b461c02f0446ed606e75f932ead56c3de4a1 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Tue, 12 Jan 2021 11:52:00 +0000 Subject: [PATCH 279/731] (packaging) Updating the puppet.pot file --- locales/puppet.pot | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/locales/puppet.pot b/locales/puppet.pot index 5e3a3683b5a..a506882bfac 100644 --- a/locales/puppet.pot +++ b/locales/puppet.pot @@ -6,11 +6,11 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Puppet automation framework 7.1.0-68-gf3289edef9\n" +"Project-Id-Version: Puppet automation framework 7.1.0-72-g49918bd5cc\n" "\n" "Report-Msgid-Bugs-To: https://tickets.puppetlabs.com\n" -"POT-Creation-Date: 2021-01-08 08:06+0000\n" -"PO-Revision-Date: 2021-01-08 08:06+0000\n" +"POT-Creation-Date: 2021-01-12 11:51+0000\n" +"PO-Revision-Date: 2021-01-12 11:51+0000\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -1056,7 +1056,7 @@ msgid "Disable fact caching mechanism." msgstr "" #: ../lib/puppet/face/facts.rb:128 -msgid "Show legacy facts when querying all facts." +msgid "Disable legacy facts when querying all facts." msgstr "" #: ../lib/puppet/face/generate.rb:9 From 0f9a5d709614c11e27214b84b7ab0f7b9a209fe5 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Tue, 12 Jan 2021 11:53:19 +0000 Subject: [PATCH 280/731] (packaging) Updating manpage file for main --- man/man8/puppet-facts.8 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/man/man8/puppet-facts.8 b/man/man8/puppet-facts.8 index a95cf468716..d00f493824d 100644 --- a/man/man8/puppet-facts.8 +++ b/man/man8/puppet-facts.8 @@ -105,7 +105,7 @@ API only: create or overwrite an object\. As the Faces framework does not curren \fBSYNOPSIS\fR . .IP -puppet facts [\-\-terminus _TERMINUS] [\-\-extra HASH] [\-\-config\-file \fIpath\fR] [\-\-custom\-dir \fIpath\fR] [\-\-external\-dir \fIpath\fR] [\-\-no\-block] [\-\-no\-cache] [\-\-show\-legacy] [\fIfacts\fR] +puppet facts [\-\-terminus _TERMINUS] [\-\-extra HASH] [\-\-config\-file \fIpath\fR] [\-\-custom\-dir \fIpath\fR] [\-\-external\-dir \fIpath\fR] [\-\-no\-block] [\-\-no\-cache] [\-\-no\-legacy] [\fIfacts\fR] . .IP \fBDESCRIPTION\fR @@ -129,7 +129,7 @@ Reads facts from the local system using \fBfacter\fR terminus\. A query can be p \fI\-\-no\-cache\fR \- Disable fact caching mechanism\. . .IP -\fI\-\-show\-legacy\fR \- Show legacy facts when querying all facts\. +\fI\-\-no\-legacy\fR \- Disable legacy facts when querying all facts\. . .IP \fBRETURNS\fR From 2924b410f9dec8234523884fcae70ff7291bd094 Mon Sep 17 00:00:00 2001 From: Oana Tanasoiu Date: Wed, 13 Jan 2021 01:17:28 +0200 Subject: [PATCH 281/731] (maint) Add show legacy option for puppet facts --- lib/puppet/face/facts.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/puppet/face/facts.rb b/lib/puppet/face/facts.rb index c48e2062a9d..2f778e2b2bb 100644 --- a/lib/puppet/face/facts.rb +++ b/lib/puppet/face/facts.rb @@ -128,6 +128,10 @@ summary _("Disable legacy facts when querying all facts.") end + option("--show-legacy") do + summary _("Show legacy facts when querying all facts.") + end + when_invoked do |*args| options = args.pop From c2d8ec873bab1f055f24b9ab6a70fa61f0caba83 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Tue, 12 Jan 2021 23:37:39 +0000 Subject: [PATCH 282/731] (packaging) Updating the puppet.pot file --- locales/puppet.pot | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/locales/puppet.pot b/locales/puppet.pot index a506882bfac..d7da17f8f37 100644 --- a/locales/puppet.pot +++ b/locales/puppet.pot @@ -6,11 +6,11 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Puppet automation framework 7.1.0-72-g49918bd5cc\n" +"Project-Id-Version: Puppet automation framework 7.1.0-76-ga600c40f32\n" "\n" "Report-Msgid-Bugs-To: https://tickets.puppetlabs.com\n" -"POT-Creation-Date: 2021-01-12 11:51+0000\n" -"PO-Revision-Date: 2021-01-12 11:51+0000\n" +"POT-Creation-Date: 2021-01-12 23:37+0000\n" +"PO-Revision-Date: 2021-01-12 23:37+0000\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -1059,6 +1059,10 @@ msgstr "" msgid "Disable legacy facts when querying all facts." msgstr "" +#: ../lib/puppet/face/facts.rb:132 +msgid "Show legacy facts when querying all facts." +msgstr "" + #: ../lib/puppet/face/generate.rb:9 msgid "Generates Puppet code from Ruby definitions." msgstr "" @@ -2833,8 +2837,8 @@ msgstr "" msgid "Option %{option} conflicts with existing option %{conflict} on %{face}" msgstr "" -#. TRANSLATORS 'Puppet.settings' should not be translated #. TRANSLATORS 'Puppet.settings' references to the Puppet settings options and should not be translated +#. TRANSLATORS 'Puppet.settings' should not be translated #: ../lib/puppet/interface/action.rb:315 ../lib/puppet/interface/option_manager.rb:14 msgid "Global option %{option} does not exist in Puppet.settings" msgstr "" From 7cb9179f2fe851c9350c93d016397b864e0f75a8 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Tue, 12 Jan 2021 23:40:04 +0000 Subject: [PATCH 283/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 2 +- man/man8/puppet-facts.8 | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index 57fd61510de..6934c1bd2eb 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -1736,7 +1736,7 @@ The maximum time to delay before an agent\'s first run when \fBsplay\fR is enabl The domain which will be queried to find the SRV records of servers to use\. . .IP "\(bu" 4 -\fIDefault\fR: delivery\.puppetlabs\.net +\fIDefault\fR: ci\-jenkins\-setup\-platform\.svc\.cluster\.local . .IP "" 0 . diff --git a/man/man8/puppet-facts.8 b/man/man8/puppet-facts.8 index d00f493824d..6d6c29768e5 100644 --- a/man/man8/puppet-facts.8 +++ b/man/man8/puppet-facts.8 @@ -105,7 +105,7 @@ API only: create or overwrite an object\. As the Faces framework does not curren \fBSYNOPSIS\fR . .IP -puppet facts [\-\-terminus _TERMINUS] [\-\-extra HASH] [\-\-config\-file \fIpath\fR] [\-\-custom\-dir \fIpath\fR] [\-\-external\-dir \fIpath\fR] [\-\-no\-block] [\-\-no\-cache] [\-\-no\-legacy] [\fIfacts\fR] +puppet facts [\-\-terminus _TERMINUS] [\-\-extra HASH] [\-\-config\-file \fIpath\fR] [\-\-custom\-dir \fIpath\fR] [\-\-external\-dir \fIpath\fR] [\-\-no\-block] [\-\-no\-cache] [\-\-no\-legacy] [\-\-show\-legacy] [\fIfacts\fR] . .IP \fBDESCRIPTION\fR @@ -132,6 +132,9 @@ Reads facts from the local system using \fBfacter\fR terminus\. A query can be p \fI\-\-no\-legacy\fR \- Disable legacy facts when querying all facts\. . .IP +\fI\-\-show\-legacy\fR \- Show legacy facts when querying all facts\. +. +.IP \fBRETURNS\fR . .IP From 4c0bb1da9104b82262044ec2d998b819c417406c Mon Sep 17 00:00:00 2001 From: Oana Tanasoiu Date: Wed, 13 Jan 2021 10:39:31 +0200 Subject: [PATCH 284/731] (PUP-10850)Fix show_legacy option for puppet facts --- lib/puppet/face/facts.rb | 4 ---- lib/puppet/indirector/facts/facter.rb | 2 +- spec/unit/indirector/facts/facter_spec.rb | 10 +++++----- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/lib/puppet/face/facts.rb b/lib/puppet/face/facts.rb index 2f778e2b2bb..37e4f27e774 100644 --- a/lib/puppet/face/facts.rb +++ b/lib/puppet/face/facts.rb @@ -124,10 +124,6 @@ summary _("Disable fact caching mechanism.") end - option("--no-legacy") do - summary _("Disable legacy facts when querying all facts.") - end - option("--show-legacy") do summary _("Show legacy facts when querying all facts.") end diff --git a/lib/puppet/indirector/facts/facter.rb b/lib/puppet/indirector/facts/facter.rb index ce0ecb2bcda..0d45927e15a 100644 --- a/lib/puppet/indirector/facts/facter.rb +++ b/lib/puppet/indirector/facts/facter.rb @@ -100,7 +100,7 @@ def find_with_options(request) options_for_facter = String.new options_for_facter += options[:user_query].join(' ') options_for_facter += " --config #{options[:config_file]}" if options[:config_file] - options_for_facter += options[:no_legacy] == false ? " --show-legacy false" : " --show-legacy" + options_for_facter += " --show-legacy" if options[:show_legacy] options_for_facter += " --no-block" if options[:no_block] == false options_for_facter += " --no-cache" if options[:no_cache] == false diff --git a/spec/unit/indirector/facts/facter_spec.rb b/spec/unit/indirector/facts/facter_spec.rb index 42166ed6ad6..a3096883df7 100644 --- a/spec/unit/indirector/facts/facter_spec.rb +++ b/spec/unit/indirector/facts/facter_spec.rb @@ -163,7 +163,7 @@ end it 'should call Facter.resolve method' do - expect(Facter).to receive(:resolve).with("os timezone --show-legacy") + expect(Facter).to receive(:resolve).with("os timezone") @facter.find(@request) end @@ -173,11 +173,11 @@ @facter.find(@request) end - context 'when --no-legacy flag is present' do - let(:options) { { resolve_options: true, user_query: ["os", "timezone"], no_legacy: false } } + context 'when --show-legacy flag is present' do + let(:options) { { resolve_options: true, user_query: ["os", "timezone"], show_legacy: true } } - it 'should call Facter.resolve method with show-legacy false' do - expect(Facter).to receive(:resolve).with("os timezone --show-legacy false") + it 'should call Facter.resolve method with show-legacy' do + expect(Facter).to receive(:resolve).with("os timezone --show-legacy") @facter.find(@request) end end From fdbcce0212bab85c41f11ff8736c520b041b57ca Mon Sep 17 00:00:00 2001 From: Oana Tanasoiu Date: Wed, 6 Jan 2021 15:27:03 +0200 Subject: [PATCH 285/731] (PUP-10847) Add flat output format --- lib/puppet/face/facts.rb | 16 +++++++- lib/puppet/network/formats.rb | 67 +++++++++++++++++++++++++++++++ spec/unit/network/formats_spec.rb | 41 +++++++++++++++++++ 3 files changed, 123 insertions(+), 1 deletion(-) diff --git a/lib/puppet/face/facts.rb b/lib/puppet/face/facts.rb index 2f778e2b2bb..7ddeca0cdd2 100644 --- a/lib/puppet/face/facts.rb +++ b/lib/puppet/face/facts.rb @@ -131,6 +131,10 @@ option("--show-legacy") do summary _("Show legacy facts when querying all facts.") end + + option("--value-only") do + summary _("Show only the value when the action is called with a single query") + end when_invoked do |*args| options = args.pop @@ -138,12 +142,22 @@ Puppet.settings.preferred_run_mode = :agent Puppet::Node::Facts.indirection.terminus_class = :facter + if options[:value_only] && !args.count.eql?(1) + options[:value_only] = nil + Puppet.warning("Incorrect use of --value-only argument; it can only be used when querying for a single fact!") + end options[:user_query] = args options[:resolve_options] = true result = Puppet::Node::Facts.indirection.find(Puppet.settings[:certname], options) - result.values + facts = result.values + + if options[:value_only] + facts.values.first + else + facts + end end when_rendering :console do |result| diff --git a/lib/puppet/network/formats.rb b/lib/puppet/network/formats.rb index 7bead88a467..757acc16572 100644 --- a/lib/puppet/network/formats.rb +++ b/lib/puppet/network/formats.rb @@ -183,6 +183,73 @@ def render_multiple(data) end end +Puppet::Network::FormatHandler.create(:flat, + :mime => 'text/x-flat-text', + :weight => 0) do + + def flatten_hash(hash) + hash.each_with_object({}) do |(k, v), h| + if v.is_a? Hash + flatten_hash(v).map do |h_k, h_v| + h["#{k}.#{h_k}"] = h_v + end + elsif v.is_a? Array + v.each_with_index do |el, i| + if el.is_a? Hash + flatten_hash(el).map do |el_k, el_v| + h["#{k}.#{i}.#{el_k}"] = el_v + end + else + h["#{k}.#{i}"] = el + end + end + else + h[k] = v + end + end + end + + def flatten_array(array) + a={} + array.each_with_index do |el, i| + if el.is_a? Hash + flatten_hash(el).map do |el_k, el_v| + a["#{i}.#{el_k}"] = el_v + end + else + a["#{i}"] = el + end + end + a + end + + def construct_output(data) + output = '' + data.each do |key, value| + output << "#{key}=#{value}" + output << "\n" + end + output + end + + def render(datum) + return datum if datum.is_a?(String) || datum.is_a?(Numeric) + # Simple hash + if datum.is_a?(Hash) + data = flatten_hash(datum) + return construct_output(data) + elsif datum.is_a?(Array) + data = flatten_array(datum) + return construct_output(data) + end + Puppet::Util::Json.dump(datum, :pretty => true, :quirks_mode => true) + end + def render_multiple(data) + data.collect(&:render).join("\n") + end +end + + Puppet::Network::FormatHandler.create(:rich_data_json, mime: 'application/vnd.puppet.rich+json', charset: Encoding::UTF_8, weight: 30) do def intern(klass, text) Puppet.override({:rich_data => true}) do diff --git a/spec/unit/network/formats_spec.rb b/spec/unit/network/formats_spec.rb index 1d63ab88712..683381d91a4 100644 --- a/spec/unit/network/formats_spec.rb +++ b/spec/unit/network/formats_spec.rb @@ -534,4 +534,45 @@ def self.from_binary(data) end end end + + describe ":flat format" do + let(:flat) { Puppet::Network::FormatHandler.format(:flat) } + + it "should include a flat format" do + expect(flat).to be_an_instance_of Puppet::Network::Format + end + + [:intern, :intern_multiple].each do |method| + it "should not implement #{method}" do + expect { flat.send(method, String, 'blah') }.to raise_error NotImplementedError + end + end + + context "when rendering arrays" do + { + [] => "", + [1, 2] => "0=1\n1=2\n", + ["one"] => "0=one\n", + [{"one" => 1}, {"two" => 2}] => "0.one=1\n1.two=2\n", + [['something', 'for'], ['the', 'test']] => "0=[\"something\", \"for\"]\n1=[\"the\", \"test\"]\n" + }.each_pair do |input, output| + it "should render #{input.inspect} as one item per line" do + expect(flat.render(input)).to eq(output) + end + end + end + + context "when rendering hashes" do + { + {} => "", + {1 => 2} => "1=2\n", + {"one" => "two"} => "one=two\n", + {[1,2] => 3, [2,3] => 5, [3,4] => 7} => "[1, 2]=3\n[2, 3]=5\n[3, 4]=7\n", + }.each_pair do |input, output| + it "should render #{input.inspect}" do + expect(flat.render(input)).to eq(output) + end + end + end + end end From 68a97d490731dbcc36352353e941a4f30467887f Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Wed, 13 Jan 2021 13:07:35 +0000 Subject: [PATCH 286/731] (packaging) Updating the puppet.pot file --- locales/puppet.pot | 92 ++++++++++++++++++++++++---------------------- 1 file changed, 48 insertions(+), 44 deletions(-) diff --git a/locales/puppet.pot b/locales/puppet.pot index d7da17f8f37..aa7835733c3 100644 --- a/locales/puppet.pot +++ b/locales/puppet.pot @@ -6,11 +6,11 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Puppet automation framework 7.1.0-76-ga600c40f32\n" +"Project-Id-Version: Puppet automation framework 7.1.0-84-g5e94a264f9\n" "\n" "Report-Msgid-Bugs-To: https://tickets.puppetlabs.com\n" -"POT-Creation-Date: 2021-01-12 23:37+0000\n" -"PO-Revision-Date: 2021-01-12 23:37+0000\n" +"POT-Creation-Date: 2021-01-13 13:07+0000\n" +"PO-Revision-Date: 2021-01-13 13:07+0000\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -3194,11 +3194,11 @@ msgstr "" msgid "Resolving dependencies ..." msgstr "" -#: ../lib/puppet/module_tool/applications/installer.rb:175 +#: ../lib/puppet/module_tool/applications/installer.rb:208 msgid "Preparing to install ..." msgstr "" -#: ../lib/puppet/module_tool/applications/installer.rb:178 +#: ../lib/puppet/module_tool/applications/installer.rb:211 msgid "Installing -- do not interrupt ..." msgstr "" @@ -3238,7 +3238,7 @@ msgstr "" msgid "'%{module_name}' (%{version}) requested; '%{module_name}' (%{installed_version}) already installed" msgstr "" -#: ../lib/puppet/module_tool/errors/installer.rb:16 ../lib/puppet/module_tool/errors/installer.rb:54 ../lib/puppet/module_tool/errors/installer.rb:72 ../lib/puppet/module_tool/errors/shared.rb:72 ../lib/puppet/module_tool/errors/shared.rb:114 +#: ../lib/puppet/module_tool/errors/installer.rb:16 ../lib/puppet/module_tool/errors/installer.rb:54 ../lib/puppet/module_tool/errors/installer.rb:72 ../lib/puppet/module_tool/errors/shared.rb:79 ../lib/puppet/module_tool/errors/shared.rb:121 msgid "Could not install module '%{module_name}' (%{version})" msgstr "" @@ -3268,7 +3268,7 @@ msgstr "" msgid "Could not install '%{requested_package}'" msgstr "" -#: ../lib/puppet/module_tool/errors/installer.rb:38 ../lib/puppet/module_tool/errors/shared.rb:51 +#: ../lib/puppet/module_tool/errors/installer.rb:38 ../lib/puppet/module_tool/errors/shared.rb:58 msgid " No releases are available from %{source}" msgstr "" @@ -3317,154 +3317,158 @@ msgstr "" msgid "Could not %{action} '%{module_name}' (%{version}); no version satisfies all dependencies" msgstr "" -#: ../lib/puppet/module_tool/errors/shared.rb:17 ../lib/puppet/module_tool/errors/shared.rb:179 ../lib/puppet/module_tool/errors/upgrader.rb:58 +#: ../lib/puppet/module_tool/errors/shared.rb:17 ../lib/puppet/module_tool/errors/shared.rb:186 ../lib/puppet/module_tool/errors/upgrader.rb:58 msgid "Could not %{action} module '%{module_name}' (%{version})" msgstr "" #: ../lib/puppet/module_tool/errors/shared.rb:20 -msgid " The requested version cannot satisfy the following dependency: %{name}" +msgid " The requested version cannot satisfy one or more of the following installed modules:" msgstr "" -#: ../lib/puppet/module_tool/errors/shared.rb:21 -msgid " Installed: %{current_version}, expected: %{constraints}" +#: ../lib/puppet/module_tool/errors/shared.rb:22 +msgid " %{name}, installed: %{current_version}, expected: %{constraints}" msgstr "" -#: ../lib/puppet/module_tool/errors/shared.rb:23 +#: ../lib/puppet/module_tool/errors/shared.rb:25 +msgid " %{mod}, expects '%{name}': %{range}" +msgstr "" + +#: ../lib/puppet/module_tool/errors/shared.rb:30 msgid " The requested version cannot satisfy all dependencies" msgstr "" #. TRANSLATORS `puppet module %{action} --ignore-dependencies` is a command line and should not be translated -#: ../lib/puppet/module_tool/errors/shared.rb:27 -msgid " Use `puppet module %{action} '%{module_name}' --ignore-dependencies` to %{action} only this module" +#: ../lib/puppet/module_tool/errors/shared.rb:34 +msgid " Use `puppet module %{action} '%{module_name}' --ignore-dependencies` to %{action} only this module" msgstr "" -#: ../lib/puppet/module_tool/errors/shared.rb:41 +#: ../lib/puppet/module_tool/errors/shared.rb:48 msgid "Could not %{action} '%{module_name}'; no releases are available from %{source}" msgstr "" -#: ../lib/puppet/module_tool/errors/shared.rb:43 +#: ../lib/puppet/module_tool/errors/shared.rb:50 msgid "Could not %{action} '%{module_name}'; no releases matching '%{version}' are available from %{source}" msgstr "" -#: ../lib/puppet/module_tool/errors/shared.rb:49 +#: ../lib/puppet/module_tool/errors/shared.rb:56 msgid "Could not %{action} '%{module_name}' (%{version})" msgstr "" -#: ../lib/puppet/module_tool/errors/shared.rb:52 +#: ../lib/puppet/module_tool/errors/shared.rb:59 msgid " Does '%{module_name}' have at least one published release?" msgstr "" -#: ../lib/puppet/module_tool/errors/shared.rb:54 +#: ../lib/puppet/module_tool/errors/shared.rb:61 msgid " No releases matching '%{requested_version}' are available from %{source}" msgstr "" -#: ../lib/puppet/module_tool/errors/shared.rb:67 +#: ../lib/puppet/module_tool/errors/shared.rb:74 msgid "'%{module_name}' (%{version}) requested; installation conflict" msgstr "" -#: ../lib/puppet/module_tool/errors/shared.rb:75 +#: ../lib/puppet/module_tool/errors/shared.rb:82 msgid " Dependency '%{name}' (%{version}) would overwrite %{directory}" msgstr "" -#: ../lib/puppet/module_tool/errors/shared.rb:77 +#: ../lib/puppet/module_tool/errors/shared.rb:84 msgid " Installation would overwrite %{directory}" msgstr "" -#: ../lib/puppet/module_tool/errors/shared.rb:81 +#: ../lib/puppet/module_tool/errors/shared.rb:88 msgid " Currently, '%{current_name}' (%{current_version}) is installed to that directory" msgstr "" #. TRANSLATORS `puppet module install --ignore-dependencies` is a command line and should not be translated -#: ../lib/puppet/module_tool/errors/shared.rb:86 +#: ../lib/puppet/module_tool/errors/shared.rb:93 msgid " Use `puppet module install --ignore-dependencies` to install only this module" msgstr "" #. TRANSLATORS `puppet module install --force` is a command line and should not be translated #. TRANSLATORS `puppet module install --force` is a command line and should not be translated -#: ../lib/puppet/module_tool/errors/shared.rb:89 ../lib/puppet/module_tool/errors/shared.rb:118 +#: ../lib/puppet/module_tool/errors/shared.rb:96 ../lib/puppet/module_tool/errors/shared.rb:125 msgid " Use `puppet module install --force` to install this module anyway" msgstr "" -#: ../lib/puppet/module_tool/errors/shared.rb:103 +#: ../lib/puppet/module_tool/errors/shared.rb:110 msgid "'%{module_name}' (%{version}) requested; Invalid dependency cycle" msgstr "" -#: ../lib/puppet/module_tool/errors/shared.rb:108 +#: ../lib/puppet/module_tool/errors/shared.rb:115 msgid "You specified '%{name}' (%{version})" msgstr "" #. TRANSLATORS This message repeats as separate lines as a list under the heading "You specified '%{name}' (%{version})\n" -#: ../lib/puppet/module_tool/errors/shared.rb:111 +#: ../lib/puppet/module_tool/errors/shared.rb:118 msgid "This depends on '%{name}' (%{version})" msgstr "" -#: ../lib/puppet/module_tool/errors/shared.rb:115 +#: ../lib/puppet/module_tool/errors/shared.rb:122 msgid " No version of '%{module_name}' will satisfy dependencies" msgstr "" -#: ../lib/puppet/module_tool/errors/shared.rb:128 +#: ../lib/puppet/module_tool/errors/shared.rb:135 msgid "Could not %{action} '%{module_name}'; module is not installed" msgstr "" -#: ../lib/puppet/module_tool/errors/shared.rb:133 ../lib/puppet/module_tool/errors/shared.rb:156 ../lib/puppet/module_tool/errors/shared.rb:197 +#: ../lib/puppet/module_tool/errors/shared.rb:140 ../lib/puppet/module_tool/errors/shared.rb:163 ../lib/puppet/module_tool/errors/shared.rb:204 msgid "Could not %{action} module '%{module_name}'" msgstr "" -#: ../lib/puppet/module_tool/errors/shared.rb:134 +#: ../lib/puppet/module_tool/errors/shared.rb:141 msgid " Module '%{module_name}' is not installed" msgstr "" #. TRANSLATORS `puppet module %{action} %{suggestion}` is a command line and should not be translated -#: ../lib/puppet/module_tool/errors/shared.rb:137 +#: ../lib/puppet/module_tool/errors/shared.rb:144 msgid " You may have meant `puppet module %{action} %{suggestion}`" msgstr "" #. TRANSLATORS `puppet module install` is a command line and should not be translated -#: ../lib/puppet/module_tool/errors/shared.rb:140 +#: ../lib/puppet/module_tool/errors/shared.rb:147 msgid " Use `puppet module install` to install this module" msgstr "" #. TRANSLATORS "module path" refers to a set of directories where modules may be installed -#: ../lib/puppet/module_tool/errors/shared.rb:151 +#: ../lib/puppet/module_tool/errors/shared.rb:158 msgid "Could not %{action} '%{module_name}'; module appears in multiple places in the module path" msgstr "" -#: ../lib/puppet/module_tool/errors/shared.rb:157 +#: ../lib/puppet/module_tool/errors/shared.rb:164 msgid " Module '%{module_name}' appears multiple places in the module path" msgstr "" #. TRANSLATORS This is repeats as separate lines as a list under "Module '%{module_name}' appears multiple places in the module path" -#: ../lib/puppet/module_tool/errors/shared.rb:160 +#: ../lib/puppet/module_tool/errors/shared.rb:167 msgid " '%{module_name}' (%{version}) was found in %{path}" msgstr "" #. TRANSLATORS `--modulepath` is command line option and should not be translated -#: ../lib/puppet/module_tool/errors/shared.rb:163 +#: ../lib/puppet/module_tool/errors/shared.rb:170 msgid " Use the `--modulepath` option to limit the search to specific directories" msgstr "" -#: ../lib/puppet/module_tool/errors/shared.rb:174 +#: ../lib/puppet/module_tool/errors/shared.rb:181 msgid "Could not %{action} '%{module_name}'; module has had changes made locally" msgstr "" -#: ../lib/puppet/module_tool/errors/shared.rb:180 +#: ../lib/puppet/module_tool/errors/shared.rb:187 msgid " Installed module has had changes made locally" msgstr "" #. TRANSLATORS `puppet module %{action} --ignore-changes` is a command line and should not be translated -#: ../lib/puppet/module_tool/errors/shared.rb:182 +#: ../lib/puppet/module_tool/errors/shared.rb:189 msgid " Use `puppet module %{action} --ignore-changes` to %{action} this module anyway" msgstr "" -#: ../lib/puppet/module_tool/errors/shared.rb:192 +#: ../lib/puppet/module_tool/errors/shared.rb:199 msgid "Could not %{action} '%{module_name}'; %{error}" msgstr "" -#: ../lib/puppet/module_tool/errors/shared.rb:198 +#: ../lib/puppet/module_tool/errors/shared.rb:205 msgid " Failure trying to parse metadata" msgstr "" -#: ../lib/puppet/module_tool/errors/shared.rb:199 +#: ../lib/puppet/module_tool/errors/shared.rb:206 msgid " Original message was: %{message}" msgstr "" From af5279d9577db087db5bff0674a6fe200caf35af Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Wed, 13 Jan 2021 14:37:38 +0000 Subject: [PATCH 287/731] (packaging) Updating the puppet.pot file --- locales/puppet.pot | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/locales/puppet.pot b/locales/puppet.pot index aa7835733c3..ddbdbb0ec24 100644 --- a/locales/puppet.pot +++ b/locales/puppet.pot @@ -6,11 +6,11 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Puppet automation framework 7.1.0-84-g5e94a264f9\n" +"Project-Id-Version: Puppet automation framework 7.1.0-89-g309d69a162\n" "\n" "Report-Msgid-Bugs-To: https://tickets.puppetlabs.com\n" -"POT-Creation-Date: 2021-01-13 13:07+0000\n" -"PO-Revision-Date: 2021-01-13 13:07+0000\n" +"POT-Creation-Date: 2021-01-13 14:37+0000\n" +"PO-Revision-Date: 2021-01-13 14:37+0000\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -1056,11 +1056,11 @@ msgid "Disable fact caching mechanism." msgstr "" #: ../lib/puppet/face/facts.rb:128 -msgid "Disable legacy facts when querying all facts." +msgid "Show legacy facts when querying all facts." msgstr "" #: ../lib/puppet/face/facts.rb:132 -msgid "Show legacy facts when querying all facts." +msgid "Show only the value when the action is called with a single query" msgstr "" #: ../lib/puppet/face/generate.rb:9 From a635df12b9ba7f0787542d0d70e0229249f49482 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Wed, 13 Jan 2021 14:39:50 +0000 Subject: [PATCH 288/731] (packaging) Updating manpage file for main --- man/man8/puppet-facts.8 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/man/man8/puppet-facts.8 b/man/man8/puppet-facts.8 index 6d6c29768e5..6ce84d12130 100644 --- a/man/man8/puppet-facts.8 +++ b/man/man8/puppet-facts.8 @@ -105,7 +105,7 @@ API only: create or overwrite an object\. As the Faces framework does not curren \fBSYNOPSIS\fR . .IP -puppet facts [\-\-terminus _TERMINUS] [\-\-extra HASH] [\-\-config\-file \fIpath\fR] [\-\-custom\-dir \fIpath\fR] [\-\-external\-dir \fIpath\fR] [\-\-no\-block] [\-\-no\-cache] [\-\-no\-legacy] [\-\-show\-legacy] [\fIfacts\fR] +puppet facts [\-\-terminus _TERMINUS] [\-\-extra HASH] [\-\-config\-file \fIpath\fR] [\-\-custom\-dir \fIpath\fR] [\-\-external\-dir \fIpath\fR] [\-\-no\-block] [\-\-no\-cache] [\-\-show\-legacy] [\-\-value\-only] [\fIfacts\fR] . .IP \fBDESCRIPTION\fR @@ -129,10 +129,10 @@ Reads facts from the local system using \fBfacter\fR terminus\. A query can be p \fI\-\-no\-cache\fR \- Disable fact caching mechanism\. . .IP -\fI\-\-no\-legacy\fR \- Disable legacy facts when querying all facts\. +\fI\-\-show\-legacy\fR \- Show legacy facts when querying all facts\. . .IP -\fI\-\-show\-legacy\fR \- Show legacy facts when querying all facts\. +\fI\-\-value\-only\fR \- Show only the value when the action is called with a single query . .IP \fBRETURNS\fR From f88c9b540d087276559269ab5bdb80e36e41438c Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Tue, 12 Jan 2021 17:20:20 -0800 Subject: [PATCH 289/731] (PUP-10851) Omit error when parsing 'allow *' in fileserver.conf Legacy auth was removed in 7, so if we parse an authz rule in fileserver.conf, then we want to alert the user that it will be ignored by puppet. However, `allow *` rules are harmless and match puppet's current behavior, so ignore those, but continue logging an error for other allow/deny rules. --- lib/puppet/file_serving/configuration/parser.rb | 7 +++++-- spec/unit/file_serving/configuration/parser_spec.rb | 8 ++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/puppet/file_serving/configuration/parser.rb b/lib/puppet/file_serving/configuration/parser.rb index 5559a7c50df..cec982ef81d 100644 --- a/lib/puppet/file_serving/configuration/parser.rb +++ b/lib/puppet/file_serving/configuration/parser.rb @@ -33,8 +33,11 @@ def parse when "path" path(mount, value) when "allow", "deny" - error_location_str = Puppet::Util::Errors.error_location(@file.filename, @count) - Puppet.err("Entry '#{line.chomp}' is unsupported and will be ignored at #{error_location_str}") + # ignore `allow *`, otherwise report error + if var != 'allow' || value != '*' + error_location_str = Puppet::Util::Errors.error_location(@file.filename, @count) + Puppet.err("Entry '#{line.chomp}' is unsupported and will be ignored at #{error_location_str}") + end else error_location_str = Puppet::Util::Errors.error_location(@file.filename, @count) raise ArgumentError.new(_("Invalid argument '%{var}' at %{error_location}") % diff --git a/spec/unit/file_serving/configuration/parser_spec.rb b/spec/unit/file_serving/configuration/parser_spec.rb index 8e11f1bb5a2..629861b1fe5 100644 --- a/spec/unit/file_serving/configuration/parser_spec.rb +++ b/spec/unit/file_serving/configuration/parser_spec.rb @@ -121,6 +121,14 @@ def write_config_file(content) end } + it "should not generate an error when parsing 'allow *'" do + write_config_file "[one]\nallow *\n" + + expect(Puppet).to receive(:err).never + + @parser.parse + end + it "should return comprehensible error message, if failed on invalid attribute" do write_config_file "[one]\ndo something\n" From b46b3f997f5975565837d76ea44fd79c4ce17107 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Mon, 18 Jan 2021 08:55:03 +0000 Subject: [PATCH 290/731] (packaging) Bump to version '7.3.0' [no-promote] --- .gemspec | 2 +- lib/puppet/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gemspec b/.gemspec index a71b29d84e8..11f54d41ca4 100644 --- a/.gemspec +++ b/.gemspec @@ -13,7 +13,7 @@ Gem::Specification.new do |s| s.name = "puppet" - version = "7.2.0" + version = "7.3.0" mdata = version.match(/(\d+\.\d+\.\d+)/) s.version = mdata ? mdata[1] : version diff --git a/lib/puppet/version.rb b/lib/puppet/version.rb index 6f1dfbe83b6..7d1f2c9f247 100644 --- a/lib/puppet/version.rb +++ b/lib/puppet/version.rb @@ -6,7 +6,7 @@ # Raketasks and such to set the version based on the output of `git describe` module Puppet - PUPPETVERSION = '7.2.0' + PUPPETVERSION = '7.3.0' ## # version is a public API method intended to always provide a fast and From 3cd9f0a55f7da979da13e9b70d2ac1adda7d0390 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Mon, 18 Jan 2021 09:09:15 +0000 Subject: [PATCH 291/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 2 +- man/man8/puppet.8 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index 6934c1bd2eb..b6f632769fb 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -899,7 +899,7 @@ The time to wait for data to be read from an HTTP connection\. If nothing is rea The HTTP User\-Agent string to send when making network requests\. . .IP "\(bu" 4 -\fIDefault\fR: Puppet/7\.2\.0 Ruby/2\.5\.1\-p57 (x86_64\-linux) +\fIDefault\fR: Puppet/7\.3\.0 Ruby/2\.5\.1\-p57 (x86_64\-linux) . .IP "" 0 . diff --git a/man/man8/puppet.8 b/man/man8/puppet.8 index 555b5d623d0..00394fafa45 100644 --- a/man/man8/puppet.8 +++ b/man/man8/puppet.8 @@ -25,4 +25,4 @@ Specialized: 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 . .P -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\.2\.0 +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\.3\.0 From 48d7ac9d6685ac90821dd91b6831467236a2e47f Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Tue, 19 Jan 2021 09:08:53 +0000 Subject: [PATCH 292/731] (packaging) Bump to version '7.4.0' [no-promote] --- .gemspec | 2 +- lib/puppet/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gemspec b/.gemspec index 11f54d41ca4..9fb4bfe367f 100644 --- a/.gemspec +++ b/.gemspec @@ -13,7 +13,7 @@ Gem::Specification.new do |s| s.name = "puppet" - version = "7.3.0" + version = "7.4.0" mdata = version.match(/(\d+\.\d+\.\d+)/) s.version = mdata ? mdata[1] : version diff --git a/lib/puppet/version.rb b/lib/puppet/version.rb index 7d1f2c9f247..53d7207a8f9 100644 --- a/lib/puppet/version.rb +++ b/lib/puppet/version.rb @@ -6,7 +6,7 @@ # Raketasks and such to set the version based on the output of `git describe` module Puppet - PUPPETVERSION = '7.3.0' + PUPPETVERSION = '7.4.0' ## # version is a public API method intended to always provide a fast and From 438227e5427ed91544af395ab118bb4bff1a07f2 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Tue, 19 Jan 2021 09:39:05 +0000 Subject: [PATCH 293/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 2 +- man/man8/puppet.8 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index b6f632769fb..b5fbe259f22 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -899,7 +899,7 @@ The time to wait for data to be read from an HTTP connection\. If nothing is rea The HTTP User\-Agent string to send when making network requests\. . .IP "\(bu" 4 -\fIDefault\fR: Puppet/7\.3\.0 Ruby/2\.5\.1\-p57 (x86_64\-linux) +\fIDefault\fR: Puppet/7\.4\.0 Ruby/2\.5\.1\-p57 (x86_64\-linux) . .IP "" 0 . diff --git a/man/man8/puppet.8 b/man/man8/puppet.8 index 00394fafa45..62b79c46aa5 100644 --- a/man/man8/puppet.8 +++ b/man/man8/puppet.8 @@ -25,4 +25,4 @@ Specialized: 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 . .P -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\.3\.0 +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\.4\.0 From b36a43b8ffa012e40150e5518f0d90f582acbae8 Mon Sep 17 00:00:00 2001 From: Eric Griswold Date: Tue, 19 Jan 2021 15:36:54 -0800 Subject: [PATCH 294/731] (packaging) (RE-13432) Remove reference to old GPG key More of a formality, but also for clarity: remove the reference to the old GPG signing key. This is normally overridden by the key in the build-data repo. --- ext/build_defaults.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/ext/build_defaults.yaml b/ext/build_defaults.yaml index 08855dc6cbd..2823741e188 100644 --- a/ext/build_defaults.yaml +++ b/ext/build_defaults.yaml @@ -1,6 +1,5 @@ --- packager: 'puppetlabs' -gpg_key: '7F438280EF8D349F' # These are the build targets used by the packaging repo. Uncomment to allow use. #final_mocks: 'pl-el-5-i386 pl-el-6-i386 pl-el-7-x86_64' From c1ad9b2e35b2c37a8f21cac55e69031798d3fe03 Mon Sep 17 00:00:00 2001 From: gimmy Date: Wed, 20 Jan 2021 16:14:07 +0200 Subject: [PATCH 295/731] (PUP-10858) Add `--timing` to puppet facts show --- lib/puppet/face/facts.rb | 6 +++++- lib/puppet/indirector/facts/facter.rb | 1 + spec/unit/indirector/facts/facter_spec.rb | 9 +++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/puppet/face/facts.rb b/lib/puppet/face/facts.rb index 2eb549d5746..57ba05e22ea 100644 --- a/lib/puppet/face/facts.rb +++ b/lib/puppet/face/facts.rb @@ -127,11 +127,15 @@ option("--show-legacy") do summary _("Show legacy facts when querying all facts.") end - + option("--value-only") do summary _("Show only the value when the action is called with a single query") end + option("--timing") do + summary _("Show how much time it took to resolve each fact.") + end + when_invoked do |*args| options = args.pop diff --git a/lib/puppet/indirector/facts/facter.rb b/lib/puppet/indirector/facts/facter.rb index 0d45927e15a..8dbab1bd9eb 100644 --- a/lib/puppet/indirector/facts/facter.rb +++ b/lib/puppet/indirector/facts/facter.rb @@ -103,6 +103,7 @@ def find_with_options(request) options_for_facter += " --show-legacy" if options[:show_legacy] options_for_facter += " --no-block" if options[:no_block] == false options_for_facter += " --no-cache" if options[:no_cache] == false + options_for_facter += " --timing" if options[:timing] Puppet::Node::Facts.new(request.key, Facter.resolve(options_for_facter)) end diff --git a/spec/unit/indirector/facts/facter_spec.rb b/spec/unit/indirector/facts/facter_spec.rb index a3096883df7..02af44af2e1 100644 --- a/spec/unit/indirector/facts/facter_spec.rb +++ b/spec/unit/indirector/facts/facter_spec.rb @@ -182,6 +182,15 @@ end end + context 'when --timing flag is present' do + let(:options) { { resolve_options: true, user_query: ["os", "timezone"], timing: true } } + + it 'calls Facter.resolve with --timing' do + expect(Facter).to receive(:resolve).with("os timezone --timing") + @facter.find(@request) + end + end + describe 'when Facter version is lower than 4.0.40' do before :each do allow(Facter).to receive(:respond_to?).and_return(false) From 28b15dc75d3452d2a837d78c867d619cd7b75e0b Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Thu, 21 Jan 2021 13:07:36 +0000 Subject: [PATCH 296/731] (packaging) Updating the puppet.pot file --- locales/puppet.pot | 50 +++++++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/locales/puppet.pot b/locales/puppet.pot index ddbdbb0ec24..800d83a9dd0 100644 --- a/locales/puppet.pot +++ b/locales/puppet.pot @@ -6,11 +6,11 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Puppet automation framework 7.1.0-89-g309d69a162\n" +"Project-Id-Version: Puppet automation framework 7.3.0-6-g7c55ccd544\n" "\n" "Report-Msgid-Bugs-To: https://tickets.puppetlabs.com\n" -"POT-Creation-Date: 2021-01-13 14:37+0000\n" -"PO-Revision-Date: 2021-01-13 14:37+0000\n" +"POT-Creation-Date: 2021-01-21 13:07+0000\n" +"PO-Revision-Date: 2021-01-21 13:07+0000\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -583,44 +583,44 @@ msgstr "" msgid "Local environment: '%{local_env}' doesn't match server specified environment '%{catalog_env}', restarting agent run with environment '%{catalog_env}'" msgstr "" -#: ../lib/puppet/configurer.rb:424 +#: ../lib/puppet/configurer.rb:434 msgid "Failed to apply catalog: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:453 ../lib/puppet/http/resolver/server_list.rb:63 +#: ../lib/puppet/configurer.rb:463 ../lib/puppet/http/resolver/server_list.rb:63 msgid "Puppet server %{host}:%{port} is unavailable: %{code} %{reason}" msgstr "" #. TRANSLATORS 'server_list' is the name of a setting and should not be translated -#: ../lib/puppet/configurer.rb:457 ../lib/puppet/http/resolver/server_list.rb:66 +#: ../lib/puppet/configurer.rb:467 ../lib/puppet/http/resolver/server_list.rb:66 msgid "Unable to connect to server from server_list setting: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:468 ../lib/puppet/face/report.rb:47 +#: ../lib/puppet/configurer.rb:478 ../lib/puppet/face/report.rb:47 msgid "Could not send report: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:477 +#: ../lib/puppet/configurer.rb:487 msgid "Could not save last run local report: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:496 +#: ../lib/puppet/configurer.rb:506 msgid "Uploading facts for %{node} to %{server}" msgstr "" -#: ../lib/puppet/configurer.rb:504 +#: ../lib/puppet/configurer.rb:514 msgid "Failed to submit facts: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:519 +#: ../lib/puppet/configurer.rb:529 msgid "Could not run command from %{setting}: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:537 +#: ../lib/puppet/configurer.rb:547 msgid "Could not retrieve catalog from cache: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:558 +#: ../lib/puppet/configurer.rb:568 msgid "Could not retrieve catalog from remote server: %{detail}" msgstr "" @@ -1063,6 +1063,10 @@ msgstr "" msgid "Show only the value when the action is called with a single query" msgstr "" +#: ../lib/puppet/face/facts.rb:136 +msgid "Show how much time it took to resolve each fact." +msgstr "" + #: ../lib/puppet/face/generate.rb:9 msgid "Generates Puppet code from Ruby definitions." msgstr "" @@ -1609,23 +1613,23 @@ msgstr "" msgid "Fileserver configuration file does not use '=' as a separator" msgstr "" -#: ../lib/puppet/file_serving/configuration/parser.rb:40 ../lib/puppet/util/network_device/config.rb:101 +#: ../lib/puppet/file_serving/configuration/parser.rb:43 ../lib/puppet/util/network_device/config.rb:101 msgid "Invalid argument '%{var}' at %{error_location}" msgstr "" -#: ../lib/puppet/file_serving/configuration/parser.rb:45 +#: ../lib/puppet/file_serving/configuration/parser.rb:48 msgid "Invalid entry at %{error_location}: '%{file_text}'" msgstr "" -#: ../lib/puppet/file_serving/configuration/parser.rb:70 +#: ../lib/puppet/file_serving/configuration/parser.rb:73 msgid "%{mount} is already mounted at %{name} at %{error_location}" msgstr "" -#: ../lib/puppet/file_serving/configuration/parser.rb:95 +#: ../lib/puppet/file_serving/configuration/parser.rb:98 msgid "Removing mount \"%{mount}\": %{detail}" msgstr "" -#: ../lib/puppet/file_serving/configuration/parser.rb:99 +#: ../lib/puppet/file_serving/configuration/parser.rb:102 msgid "The '%{mount}' module can not have a path. Ignoring attempt to set it" msgstr "" @@ -7104,24 +7108,24 @@ msgstr "" msgid "Setting %{name} is deprecated in puppet.conf." msgstr "" -#: ../lib/puppet/settings.rb:1447 +#: ../lib/puppet/settings.rb:1457 msgid "Error converting value for param '%{name}': %{detail}" msgstr "" -#: ../lib/puppet/settings.rb:1471 +#: ../lib/puppet/settings.rb:1481 msgid "Could not find value for %{expression}" msgstr "" #. TRANSLATORS '$environment' is a Puppet specific variable and should not be translated -#: ../lib/puppet/settings.rb:1481 +#: ../lib/puppet/settings.rb:1491 msgid "You cannot interpolate $environment within '%{setting_name}' when using directory environments." msgstr "" -#: ../lib/puppet/settings.rb:1482 +#: ../lib/puppet/settings.rb:1492 msgid "Its value will remain %{value}." msgstr "" -#: ../lib/puppet/settings.rb:1513 +#: ../lib/puppet/settings.rb:1523 msgid "Attempt to assign a value to unknown setting %{name}" msgstr "" From 5d6412cf5de9ed93d80439c539c1416ecf3216b2 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Thu, 21 Jan 2021 13:11:15 +0000 Subject: [PATCH 297/731] (packaging) Updating manpage file for main --- man/man8/puppet-facts.8 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/man/man8/puppet-facts.8 b/man/man8/puppet-facts.8 index 6ce84d12130..c086b832d92 100644 --- a/man/man8/puppet-facts.8 +++ b/man/man8/puppet-facts.8 @@ -105,7 +105,7 @@ API only: create or overwrite an object\. As the Faces framework does not curren \fBSYNOPSIS\fR . .IP -puppet facts [\-\-terminus _TERMINUS] [\-\-extra HASH] [\-\-config\-file \fIpath\fR] [\-\-custom\-dir \fIpath\fR] [\-\-external\-dir \fIpath\fR] [\-\-no\-block] [\-\-no\-cache] [\-\-show\-legacy] [\-\-value\-only] [\fIfacts\fR] +puppet facts [\-\-terminus _TERMINUS] [\-\-extra HASH] [\-\-config\-file \fIpath\fR] [\-\-custom\-dir \fIpath\fR] [\-\-external\-dir \fIpath\fR] [\-\-no\-block] [\-\-no\-cache] [\-\-show\-legacy] [\-\-value\-only] [\-\-timing] [\fIfacts\fR] . .IP \fBDESCRIPTION\fR @@ -132,6 +132,9 @@ Reads facts from the local system using \fBfacter\fR terminus\. A query can be p \fI\-\-show\-legacy\fR \- Show legacy facts when querying all facts\. . .IP +\fI\-\-timing\fR \- Show how much time it took to resolve each fact\. +. +.IP \fI\-\-value\-only\fR \- Show only the value when the action is called with a single query . .IP From 69b371009ff2a2a7fbd5d75e186c8a32d3d29c19 Mon Sep 17 00:00:00 2001 From: Simon Kissane Date: Thu, 28 Jan 2021 19:59:28 +1100 Subject: [PATCH 298/731] (maint) Correct value of SERVICE_CONFIG_LAUNCH_PROTECTED SERVICE_CONFIG_LAUNCH_PROTECTED was given the value of 0x00000012 but that is incorrect. The value is 12 decimal, which is 0x0C in hexadecimal, not 0x12. 0x12 is actually 18, which is not a documented ChangeServiceConfig2W information level. You can confirm this by checking the Microsoft documentation: https://docs.microsoft.com/en-us/windows/win32/api/winsvc/nf-winsvc-changeserviceconfig2w If you have the Windows SDK installed, you can also check the winsvc.h header, which says: --- lib/puppet/ffi/windows/constants.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/puppet/ffi/windows/constants.rb b/lib/puppet/ffi/windows/constants.rb index 64e69f22c05..1ebfceb2925 100644 --- a/lib/puppet/ffi/windows/constants.rb +++ b/lib/puppet/ffi/windows/constants.rb @@ -375,7 +375,7 @@ module Constants SERVICE_CONFIG_PRESHUTDOWN_INFO = 0x00000007 SERVICE_CONFIG_TRIGGER_INFO = 0x00000008 SERVICE_CONFIG_PREFERRED_NODE = 0x00000009 - SERVICE_CONFIG_LAUNCH_PROTECTED = 0x00000012 + SERVICE_CONFIG_LAUNCH_PROTECTED = 0x0000000C SERVICE_NO_CHANGE = 0xffffffff SERVICE_CONFIG_TYPES = { SERVICE_CONFIG_DESCRIPTION => :SERVICE_CONFIG_DESCRIPTION, From 156eb79e582dcad31ab73fa561950541250fc4da Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Thu, 28 Jan 2021 08:35:38 -0800 Subject: [PATCH 299/731] (PUP-8110) Increase size of private key in CSR tests We set the keylength setting to 512 during tests to reduce the amount of time spent generating RSA private keys. However, the CSR signing tests fail with the following error when using a 512-bit RSA key and digests SHA384 and 512: OpenSSL::X509::RequestError: EVP lib So use 2048-bit keys for those tests. --- spec/unit/ssl/certificate_request_spec.rb | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/spec/unit/ssl/certificate_request_spec.rb b/spec/unit/ssl/certificate_request_spec.rb index 1dc56486b65..a6e9a89d1bf 100644 --- a/spec/unit/ssl/certificate_request_spec.rb +++ b/spec/unit/ssl/certificate_request_spec.rb @@ -320,11 +320,8 @@ expect(csr.verify(key)).to be_truthy end - # Attempts to use SHA512 and SHA384 for signing certificates don't seem to work - # So commenting it out till it is sorted out - # The problem seems to be with the ability to sign a CSR when using either of - # these hash algorithms - pending "should use SHA512 to sign the csr when SHA256 and SHA1 aren't available" do + it "should use SHA512 to sign the csr when SHA256 and SHA1 aren't available" do + key = OpenSSL::PKey::RSA.new(2048) csr = OpenSSL::X509::Request.new expect(OpenSSL::Digest).to receive(:const_defined?).with("SHA256").and_return(false) expect(OpenSSL::Digest).to receive(:const_defined?).with("SHA1").and_return(false) @@ -334,11 +331,8 @@ expect(csr.verify(key)).to be_truthy end - # Attempts to use SHA512 and SHA384 for signing certificates don't seem to work - # So commenting it out till it is sorted out - # The problem seems to be with the ability to sign a CSR when using either of - # these hash algorithms - pending "should use SHA384 to sign the csr when SHA256/SHA1/SHA512 aren't available" do + it "should use SHA384 to sign the csr when SHA256/SHA1/SHA512 aren't available" do + key = OpenSSL::PKey::RSA.new(2048) csr = OpenSSL::X509::Request.new expect(OpenSSL::Digest).to receive(:const_defined?).with("SHA256").and_return(false) expect(OpenSSL::Digest).to receive(:const_defined?).with("SHA1").and_return(false) From 3a8626fdb17db2a27fd0004418c1aa196d222800 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Thu, 28 Jan 2021 12:50:41 -0800 Subject: [PATCH 300/731] (PUP-10861) Use heredoc for readability Use squiggly heredoc so it's clearer what output we're expecting. --- spec/unit/application/facts_spec.rb | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/spec/unit/application/facts_spec.rb b/spec/unit/application/facts_spec.rb index cb07c908304..a12c037255c 100644 --- a/spec/unit/application/facts_spec.rb +++ b/spec/unit/application/facts_spec.rb @@ -52,7 +52,12 @@ end context 'when show action is called' do - let(:expected) { "{\n \"filesystems\": \"apfs,autofs,devfs\",\n \"macaddress\": \"64:52:11:22:03:25\"\n}\n" } + let(:expected) { <<~END } + { + "filesystems": "apfs,autofs,devfs", + "macaddress": "64:52:11:22:03:25" + } + END before :each do Puppet::Node::Facts.indirection.terminus_class = :facter @@ -64,12 +69,17 @@ expect { app.run }.to exit_with(0) - .and output(expected).to_stdout + .and output(expected).to_stdout + end end end context 'when default action is called' do - let(:expected) { "---\nfilesystems: apfs,autofs,devfs\nmacaddress: 64:52:11:22:03:25\n" } + let(:expected) { <<~END } + --- + filesystems: apfs,autofs,devfs + macaddress: 64:52:11:22:03:25 + END before :each do Puppet::Node::Facts.indirection.terminus_class = :facter @@ -81,7 +91,7 @@ expect { app.run }.to exit_with(0) - .and output(expected).to_stdout + .and output(expected).to_stdout expect(app.action.name).to eq(:show) end end From 24a7818187696987d24ba5405cd74739c1ef3435 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Thu, 21 Jan 2021 14:25:52 -0800 Subject: [PATCH 301/731] (maint) Update PSON doc Describe how pson forked from json and was modified to allow arbitrary binary content. Make it clearer how pson differs from json. --- api/docs/pson.md | 82 +++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 68 insertions(+), 14 deletions(-) diff --git a/api/docs/pson.md b/api/docs/pson.md index b35abd7005d..4712034e809 100644 --- a/api/docs/pson.md +++ b/api/docs/pson.md @@ -6,19 +6,28 @@ data to transmit across the network or store on disk. Whereas JSON requires that the serialized form is valid unicode (usually UTF-8), PSON is 8-bit ASCII, which allows it to represent arbitrary byte sequences in strings. +PSON was forked from upstream [pure JSON v1.1.9](https://github.com/flori/json/tree/v1.1.9/lib/json/pure) and patches +were added to [allow binary data](https://github.com/puppetlabs/puppet/commit/3c56705a95c945778674f9792a07b66b879cb48e). + Puppet uses the MIME types "pson" and "text/pson" to refer to PSON. -Differences from JSON ---------------------- +JSON Strings +------------- -PSON does *not differ* from JSON in its representation of objects, arrays, -numbers, booleans, and null values. PSON *does* serialize strings differently -from JSON. +A JSON string is encoded in Unicode. The string must start and end with " (ASCII +0x22). Between these characters, double quote, reverse solidus (backslash) and +control characters (\u0000 - \u001F) must be escaped, all others may be escaped. + +The escape process replaces each code point with "reverse solidus, followed by +the lowercase letter u, followed by four hexadecimal digits that encode the +character's code point." For example, the ASCII record separator character +(\u001F) is serialized in JSON as: -A PSON string is a sequence of 8-bit ASCII encoded data. It must start and end -with " (ASCII 0x22) characters. Between these characters it may contain any -byte sequence. Some individual characters are represented by a sequence of -characters: + 0x5C 0x75 0x30 0x30 0x31 0x45 + +In addition, the double quote, reverse solidus and some printable control +characters are commonly escaped using a shorter form, using a single reverse +solidus: | Byte | ASCII Character | Encoded Sequence | Encoded ASCII Sequence | | ---- | --------------- | ---------------- | ---------------------- | @@ -30,11 +39,47 @@ characters: | 0x0C | Form Feed | 0x5C, 0x66 | \f | | 0x0D | Carriage Return | 0x5C, 0x72 | \r | -In addition, any character between 0x00 and 0x1F, (except the ones listed -above) must be encoded as a six byte sequence of \u followed by four ASCII -digits of the hex number of the desired character. For example the ASCII -Record Separator character (0x1E) is represented as \u001E (0x5C, 0x75, 0x30, -0x30, 0x31, 0x45). +UTF-8/16/32 encodings define a set of rules for how code points are encoded as +bytes. However, there are some byte sequences that are not a valid encoding for +any code point. For example, in UTF-8, 0x80 is used to indicate a two byte +sequence, so the following fails: + + JSON.generate("\x80") + #=> JSON::GeneratorError (source sequence is illegal/malformed utf-8) + +Differences from JSON +--------------------- + +PSON does *not differ* from JSON in its representation of objects, arrays, +numbers, booleans, and null values. PSON *does* serialize strings differently +from JSON. + +PSON shares the same encoding process as JSON, except that a PSON string is a +sequence of 8-bit ASCII values. So the string containing 0x80 can be serialized +*unescaped* as PSON: + + PSON.generate("\x80").bytes.to_a.map { |b| b.to_s(16) } + #=> ["22", "80", "22"] + +One other difference is that PSON *may* produce strings with 8-bit ASCII +encoding, unlike JSON: + + PSON.generate("\u20AC").encoding + #=> # + JSON.generate("\u20AC").encoding + #=> # + +Finally, PSON does not roundtrip values that are not arrays or hashes in the same way as JSON: + + JSON.parse(JSON.generate("\x1E")) + #=> "\u001E" + PSON.parse(PSON.generate("\x1E")) + #=> PSON::ParserError (source '"\u001e"' not in PSON!) + +whereas PSON can roundtrip an array (or hash) containing that value: + + PSON.parse(PSON.generate(["\x1E"])) + #=> ["\u001E"] Decoding PSON Using JSON Parsers -------------------------------- @@ -50,6 +95,10 @@ PSON (the value is an invalid unicode sequence). In bytes the data is: 0x7b 0x22 0x64 0x61 0x74 0x61 0x22 0x3a 0x22 0x5c 0x75 0x30 0x30 0x30 0x37 0x5c 0x62 0xc3 0xc3 0x22 0x7d +which represents: + + { " d a t a " " \ u 0 0 0 7 \ b 0xc3 0xc3 " } + Python Example: >>> import json @@ -60,3 +109,8 @@ Clojure Example: user> (parse-string (slurp "data.pson" :encoding "ISO-8859-1")) {"data" "^G\bÃÃ"} + +Ruby Example: + + irb> JSON.parse(File.read('data.pson', encoding: "ISO-8859-1")) + => {"data"=>"\a\bÃÃ"} From 0de8cfc0e34083e3c3479b0d64099c322044989d Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Thu, 28 Jan 2021 12:51:51 -0800 Subject: [PATCH 302/731] (PUP-10861) Don't JSON.dump single fact values The `puppet facts show --value-only` option prints just the value for a single fact. Previously, the value was pretty printed using JSON.dump, which emitted a quoted string. Now just print the string, so that the value can be parsed via automation, like export OSFAMILY=`puppet facts show os.family --value-only` Also add a test for multiple fact names as the `--value-only` option. --- lib/puppet/face/facts.rb | 16 +++++++---- spec/unit/application/facts_spec.rb | 41 +++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 5 deletions(-) diff --git a/lib/puppet/face/facts.rb b/lib/puppet/face/facts.rb index 57ba05e22ea..9d8805b9751 100644 --- a/lib/puppet/face/facts.rb +++ b/lib/puppet/face/facts.rb @@ -151,17 +151,23 @@ options[:resolve_options] = true result = Puppet::Node::Facts.indirection.find(Puppet.settings[:certname], options) - facts = result.values - if options[:value_only] - facts.values.first + result.values.values.first else - facts + result.values end end when_rendering :console do |result| - Puppet::Util::Json.dump(result, :pretty => true) + # VALID_TYPES = [Integer, Float, TrueClass, FalseClass, NilClass, Symbol, String, Array, Hash].freeze + # from https://github.com/puppetlabs/facter/blob/4.0.49/lib/facter/custom_facts/util/normalization.rb#L8 + + case result + when Array, Hash + Puppet::Util::Json.dump(result, :pretty => true) + else # one of VALID_TYPES above + result + end end end end diff --git a/spec/unit/application/facts_spec.rb b/spec/unit/application/facts_spec.rb index a12c037255c..e23c85afc60 100644 --- a/spec/unit/application/facts_spec.rb +++ b/spec/unit/application/facts_spec.rb @@ -71,6 +71,47 @@ }.to exit_with(0) .and output(expected).to_stdout end + + it 'displays a single fact value' do + app.command_line.args << 'filesystems' << '--value-only' + expect { + app.run + }.to exit_with(0) + .and output("apfs,autofs,devfs\n").to_stdout + end + + it "warns and ignores value-only when multiple fact names are specified" do + app.command_line.args << 'filesystems' << 'macaddress' << '--value-only' + expect { + app.run + }.to exit_with(0) + .and output(expected).to_stdout + .and output(/it can only be used when querying for a single fact/).to_stderr + end + + { + "type_hash" => [{'a' => 2}, "{\n \"a\": 2\n}"], + "type_array" => [[], "[\n\n]"], + "type_string" => ["str", "str"], + "type_int" => [1, "1"], + "type_float" => [1.0, "1.0"], + "type_true" => [true, "true"], + "type_false" => [false, "false"], + "type_nil" => [nil, ""], + "type_sym" => [:sym, "sym"] + }.each_pair do |name, values| + it "renders '#{name}' as '#{values.last}'" do + fact_value = values.first + fact_output = values.last + + allow(Facter).to receive(:resolve).and_return({name => fact_value}) + + app.command_line.args << name << '--value-only' + expect { + app.run + }.to exit_with(0) + .and output("#{fact_output}\n").to_stdout + end end end From 01310f18bd67e252ae55a1ba1f892985f6cff0da Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Tue, 2 Feb 2021 12:24:45 +0000 Subject: [PATCH 303/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 2 +- man/man8/puppet-facts.8 | 2 +- man/man8/puppet-filebucket.8 | 2 +- man/man8/puppet-module.8 | 2 +- man/man8/puppet.8 | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index b5fbe259f22..0c710449b40 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPETCONF" "5" "January 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPETCONF" "5" "February 2021" "Puppet, Inc." "Puppet manual" \fBThis page is autogenerated; any changes will get overwritten\fR . .SH "Configuration settings" diff --git a/man/man8/puppet-facts.8 b/man/man8/puppet-facts.8 index c086b832d92..719913ea01e 100644 --- a/man/man8/puppet-facts.8 +++ b/man/man8/puppet-facts.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-FACTS" "8" "January 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-FACTS" "8" "February 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-facts\fR \- Retrieve and store facts\. diff --git a/man/man8/puppet-filebucket.8 b/man/man8/puppet-filebucket.8 index a3086ae0682..30a0739fd40 100644 --- a/man/man8/puppet-filebucket.8 +++ b/man/man8/puppet-filebucket.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-FILEBUCKET" "8" "January 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-FILEBUCKET" "8" "February 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-filebucket\fR \- Store and retrieve files in a filebucket diff --git a/man/man8/puppet-module.8 b/man/man8/puppet-module.8 index 51c1dd15cbd..3d891b27720 100644 --- a/man/man8/puppet-module.8 +++ b/man/man8/puppet-module.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-MODULE" "8" "January 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-MODULE" "8" "February 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-module\fR \- Creates, installs and searches for modules on the Puppet Forge\. diff --git a/man/man8/puppet.8 b/man/man8/puppet.8 index 62b79c46aa5..be6abf404fe 100644 --- a/man/man8/puppet.8 +++ b/man/man8/puppet.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET" "8" "January 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET" "8" "February 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\fR From c3171b1243c322bf527c2fcc08ba59f4bdadcde0 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Fri, 5 Feb 2021 16:41:58 +0000 Subject: [PATCH 304/731] (packaging) Bump to version '7.5.0' [no-promote] --- .gemspec | 2 +- lib/puppet/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gemspec b/.gemspec index 9fb4bfe367f..d7ba60b6158 100644 --- a/.gemspec +++ b/.gemspec @@ -13,7 +13,7 @@ Gem::Specification.new do |s| s.name = "puppet" - version = "7.4.0" + version = "7.5.0" mdata = version.match(/(\d+\.\d+\.\d+)/) s.version = mdata ? mdata[1] : version diff --git a/lib/puppet/version.rb b/lib/puppet/version.rb index 53d7207a8f9..63564ffcd6f 100644 --- a/lib/puppet/version.rb +++ b/lib/puppet/version.rb @@ -6,7 +6,7 @@ # Raketasks and such to set the version based on the output of `git describe` module Puppet - PUPPETVERSION = '7.4.0' + PUPPETVERSION = '7.5.0' ## # version is a public API method intended to always provide a fast and From f78d858b4e75159ee9de51ade2c00c4d93f1d788 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Fri, 5 Feb 2021 16:53:48 +0000 Subject: [PATCH 305/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 2 +- man/man8/puppet.8 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index 0c710449b40..2d33b3090d9 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -899,7 +899,7 @@ The time to wait for data to be read from an HTTP connection\. If nothing is rea The HTTP User\-Agent string to send when making network requests\. . .IP "\(bu" 4 -\fIDefault\fR: Puppet/7\.4\.0 Ruby/2\.5\.1\-p57 (x86_64\-linux) +\fIDefault\fR: Puppet/7\.5\.0 Ruby/2\.5\.1\-p57 (x86_64\-linux) . .IP "" 0 . diff --git a/man/man8/puppet.8 b/man/man8/puppet.8 index be6abf404fe..596d490dbe0 100644 --- a/man/man8/puppet.8 +++ b/man/man8/puppet.8 @@ -25,4 +25,4 @@ Specialized: 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 . .P -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\.4\.0 +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\.5\.0 From 7c41a0fcf9c8065524a19d60013ec0af91eb826f Mon Sep 17 00:00:00 2001 From: Ciprian Badescu Date: Wed, 10 Feb 2021 17:22:04 +0200 Subject: [PATCH 306/731] (packaging) Bump to version '7.4.1' [no-promote] --- .gemspec | 2 +- lib/puppet/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gemspec b/.gemspec index 9fb4bfe367f..be799c6666a 100644 --- a/.gemspec +++ b/.gemspec @@ -13,7 +13,7 @@ Gem::Specification.new do |s| s.name = "puppet" - version = "7.4.0" + version = "7.4.1" mdata = version.match(/(\d+\.\d+\.\d+)/) s.version = mdata ? mdata[1] : version diff --git a/lib/puppet/version.rb b/lib/puppet/version.rb index 53d7207a8f9..91d90e1cb2c 100644 --- a/lib/puppet/version.rb +++ b/lib/puppet/version.rb @@ -6,7 +6,7 @@ # Raketasks and such to set the version based on the output of `git describe` module Puppet - PUPPETVERSION = '7.4.0' + PUPPETVERSION = '7.4.1' ## # version is a public API method intended to always provide a fast and From cdae4c297b17579590d7590a2faf00832105d271 Mon Sep 17 00:00:00 2001 From: Gabriel Nagy Date: Wed, 10 Feb 2021 18:17:27 +0200 Subject: [PATCH 307/731] (PUP-10896) Fix gid idempotency on user resource This is a regression of #8501 which made `forcelocal` act different when setting the `gid` parameter. Since we were returning the GID of an user as a string, Puppet made the assumption that the GID wasn't a number. This caused issues when setting gid to a string value (like `gid => 'abc'`), which is allowed in Puppet. To fix this, ensure we return the GID as integer after searching `/etc/passwd`. If for some reason it cannot be converted, it is returned as is (highly unlikely as non-numeric GIDs are not allowed in `/etc/passwd`). --- .../tests/resource/user/should_modify_gid.rb | 2 +- .../user/should_modify_gid_forcelocal.rb | 56 +++++++++++++++++++ lib/puppet/provider/user/useradd.rb | 9 ++- spec/unit/provider/user/useradd_spec.rb | 6 +- 4 files changed, 68 insertions(+), 5 deletions(-) create mode 100644 acceptance/tests/resource/user/should_modify_gid_forcelocal.rb diff --git a/acceptance/tests/resource/user/should_modify_gid.rb b/acceptance/tests/resource/user/should_modify_gid.rb index f28a32d37ac..bb2a199889c 100644 --- a/acceptance/tests/resource/user/should_modify_gid.rb +++ b/acceptance/tests/resource/user/should_modify_gid.rb @@ -2,7 +2,7 @@ confine :except, :platform => 'windows' confine :except, :platform => /aix/ # PUP-5358 -tag 'audit:medium', +tag 'audit:high', 'audit:refactor', # Use block style `test_run` 'audit:acceptance' # Could be done as integration tests, but would # require changing the system running the test diff --git a/acceptance/tests/resource/user/should_modify_gid_forcelocal.rb b/acceptance/tests/resource/user/should_modify_gid_forcelocal.rb new file mode 100644 index 00000000000..e2947ec94d3 --- /dev/null +++ b/acceptance/tests/resource/user/should_modify_gid_forcelocal.rb @@ -0,0 +1,56 @@ +test_name "verify that we can modify the gid with forcelocal" do + confine :to, :platform => /el|fedora/ # PUP-5358 + + require 'puppet/acceptance/common_utils' + extend Puppet::Acceptance::PackageUtils + extend Puppet::Acceptance::ManifestUtils + + tag 'audit:high' + + user = "u#{rand(99999).to_i}" + group1 = "#{user}o" + group2 = "#{user}n" + + agents.each do |host| + teardown do + on(host, puppet_resource('user', user, 'ensure=absent')) + on(host, puppet_resource('group', group1, 'ensure=absent')) + on(host, puppet_resource('group', group2, 'ensure=absent')) + end + + step "ensure that the groups both exist" do + on(host, puppet_resource('group', group1, 'ensure=present')) + on(host, puppet_resource('group', group2, 'ensure=present')) + end + + step "ensure the user exists and has the old group" do + apply_manifest_on(agent, resource_manifest('user', user, ensure: 'present', gid: group1, forcelocal: true)) + end + + step "verify that the user has the correct gid" do + group_gid1 = host.group_gid(group1) + host.user_get(user) do |result| + user_gid1 = result.stdout.split(':')[3] + + fail_test "didn't have the expected old GID #{group_gid1}, but got: #{user_gid1}" unless group_gid1 == user_gid1 + end + end + + step "modify the GID of the user" do + apply_manifest_on(agent, resource_manifest('user', user, ensure: 'present', gid: group2, forcelocal: true), expect_changes: true) + end + + step "verify that the user has the updated gid" do + group_gid2 = host.group_gid(group2) + host.user_get(user) do |result| + user_gid2 = result.stdout.split(':')[3] + + fail_test "didn't have the expected old GID #{group_gid}, but got: #{user_gid2}" unless group_gid2 == user_gid2 + end + end + + step "run again for idempotency" do + apply_manifest_on(agent, resource_manifest('user', user, ensure: 'present', gid: group2, forcelocal: true), catch_changes: true) + end + end +end diff --git a/lib/puppet/provider/user/useradd.rb b/lib/puppet/provider/user/useradd.rb index 0f4cc2e5bc8..e7e7f9e4005 100644 --- a/lib/puppet/provider/user/useradd.rb +++ b/lib/puppet/provider/user/useradd.rb @@ -104,7 +104,14 @@ def localuid def localgid user = finduser(:account, resource[:name]) - return user[:gid] if user + if user + begin + return Integer(user[:gid]) + rescue ArgumentError + Puppet.debug("Non-numeric GID found in /etc/passwd for user #{resource[:name]}") + return user[:gid] + end + end false end diff --git a/spec/unit/provider/user/useradd_spec.rb b/spec/unit/provider/user/useradd_spec.rb index a8552c326bf..a8a5ed750d0 100644 --- a/spec/unit/provider/user/useradd_spec.rb +++ b/spec/unit/provider/user/useradd_spec.rb @@ -360,14 +360,14 @@ resource[:forcelocal] = true allow(Puppet::FileSystem).to receive(:exist?).with('/etc/passwd').and_return(true) allow(Puppet::FileSystem).to receive(:each_line).with('/etc/passwd').and_yield(content) - expect(provider.gid).to eq('999') + expect(provider.gid).to eq(999) end it "should fall back to nameservice GID when forcelocal is false" do resource[:forcelocal] = false - allow(provider).to receive(:get).with(:gid).and_return('1234') + allow(provider).to receive(:get).with(:gid).and_return(1234) expect(provider).not_to receive(:localgid) - expect(provider.gid).to eq('1234') + expect(provider.gid).to eq(1234) end end From f75363ea79ad7021328b0f801208fc98f30a30f1 Mon Sep 17 00:00:00 2001 From: Gabriel Nagy Date: Fri, 22 Jan 2021 15:27:43 +0200 Subject: [PATCH 308/731] (PUP-10853) Bump minimum Facter version to 4 As we're moving away from legacy facts we also need to bump the minimum Facter version, since Facter 2 does not have structured facts, and Facter 3 provides no API for accessing them in a dot-notation format. --- .gemspec | 2 +- ext/project_data.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gemspec b/.gemspec index d7ba60b6158..303d686eeb6 100644 --- a/.gemspec +++ b/.gemspec @@ -30,7 +30,7 @@ Gem::Specification.new do |s| s.require_paths = ["lib"] s.summary = "Puppet, an automated configuration management tool" s.specification_version = 3 - s.add_runtime_dependency(%q, [">= 2.4.0", "< 5"]) + s.add_runtime_dependency(%q, [">= 4.0.0", "< 5"]) s.add_runtime_dependency(%q, [">= 3.2.1", "< 4"]) s.add_runtime_dependency(%q, "~> 1.0") s.add_runtime_dependency(%q, "~> 1.1") diff --git a/ext/project_data.yaml b/ext/project_data.yaml index 7027c6349f3..088773a8d33 100644 --- a/ext/project_data.yaml +++ b/ext/project_data.yaml @@ -17,7 +17,7 @@ gem_forge_project: 'puppet' gem_required_ruby_version: '>= 2.5.0' gem_required_rubygems_version: '> 1.3.1' gem_runtime_dependencies: - facter: ['> 2.0.1', '< 5'] + facter: ['>= 4.0.0', '< 5'] hiera: ['>= 3.2.1', '< 4'] semantic_puppet: '~> 1.0' fast_gettext: '~> 1.1' From c8cea4478f0810d8f20cbc2148b7ad37029a7e57 Mon Sep 17 00:00:00 2001 From: Gabriel Nagy Date: Fri, 22 Jan 2021 17:10:50 +0200 Subject: [PATCH 309/731] (PUP-10853) Remove usage of legacy OS facts Use structured facts instead of legacy OS facts. The following mapping applies: operatingsystem => os.name osfamily => os.family operatingsystemrelease => os.release.full operatingsystemmajrelease => os.release.major lsbdistrelease => os.distro.release.full macosx_productversion_major => os.macosx.version.major --- acceptance/tests/aix/nim_package_provider.rb | 2 +- acceptance/tests/language/binary_data_type.rb | 2 +- .../tests/language/sensitive_data_type.rb | 2 +- acceptance/tests/lookup/merge_strategies.rb | 6 +- .../parser_functions/hiera_in_templates.rb | 2 +- .../resource/service/service_enable_linux.rb | 2 +- ...et_5024_systemd_enabling_masked_service.rb | 2 +- acceptance/tests/ticket_15560_managehome.rb | 2 +- .../windows/QA-506_windows_exit_codes_test.rb | 2 +- install.rb | 2 +- lib/puppet/confiner.rb | 2 +- lib/puppet/provider/exec/windows.rb | 4 +- lib/puppet/provider/file/windows.rb | 2 +- lib/puppet/provider/group/aix.rb | 4 +- lib/puppet/provider/group/directoryservice.rb | 4 +- lib/puppet/provider/group/groupadd.rb | 2 +- lib/puppet/provider/group/pw.rb | 4 +- lib/puppet/provider/group/windows_adsi.rb | 4 +- .../provider/nameservice/directoryservice.rb | 6 +- lib/puppet/provider/package/aix.rb | 4 +- lib/puppet/provider/package/appdmg.rb | 4 +- lib/puppet/provider/package/apple.rb | 2 +- lib/puppet/provider/package/apt.rb | 2 +- lib/puppet/provider/package/blastwave.rb | 2 +- lib/puppet/provider/package/dnf.rb | 8 +- lib/puppet/provider/package/freebsd.rb | 2 +- lib/puppet/provider/package/hpux.rb | 4 +- lib/puppet/provider/package/macports.rb | 2 +- lib/puppet/provider/package/openbsd.rb | 4 +- lib/puppet/provider/package/opkg.rb | 4 +- lib/puppet/provider/package/pacman.rb | 4 +- lib/puppet/provider/package/pkg.rb | 6 +- lib/puppet/provider/package/pkgdmg.rb | 4 +- lib/puppet/provider/package/pkgin.rb | 2 +- lib/puppet/provider/package/pkgng.rb | 4 +- lib/puppet/provider/package/pkgutil.rb | 2 +- lib/puppet/provider/package/portage.rb | 4 +- lib/puppet/provider/package/portupgrade.rb | 2 +- lib/puppet/provider/package/rug.rb | 2 +- lib/puppet/provider/package/sun.rb | 4 +- lib/puppet/provider/package/sunfreeware.rb | 2 +- lib/puppet/provider/package/tdnf.rb | 2 +- lib/puppet/provider/package/up2date.rb | 4 +- lib/puppet/provider/package/urpmi.rb | 2 +- lib/puppet/provider/package/windows.rb | 4 +- lib/puppet/provider/package/yum.rb | 6 +- lib/puppet/provider/package/zypper.rb | 4 +- lib/puppet/provider/service/base.rb | 2 +- lib/puppet/provider/service/bsd.rb | 2 +- lib/puppet/provider/service/debian.rb | 6 +- lib/puppet/provider/service/freebsd.rb | 4 +- lib/puppet/provider/service/gentoo.rb | 2 +- lib/puppet/provider/service/init.rb | 10 +- lib/puppet/provider/service/launchd.rb | 8 +- lib/puppet/provider/service/openbsd.rb | 4 +- lib/puppet/provider/service/openrc.rb | 4 +- lib/puppet/provider/service/openwrt.rb | 4 +- lib/puppet/provider/service/rcng.rb | 4 +- lib/puppet/provider/service/redhat.rb | 6 +- lib/puppet/provider/service/smf.rb | 10 +- lib/puppet/provider/service/src.rb | 4 +- lib/puppet/provider/service/systemd.rb | 28 ++--- lib/puppet/provider/service/upstart.rb | 14 +-- lib/puppet/provider/service/windows.rb | 4 +- lib/puppet/provider/user/aix.rb | 4 +- lib/puppet/provider/user/directoryservice.rb | 8 +- lib/puppet/provider/user/hpux.rb | 4 +- lib/puppet/provider/user/openbsd.rb | 4 +- lib/puppet/provider/user/pw.rb | 4 +- lib/puppet/provider/user/user_role_add.rb | 2 +- lib/puppet/provider/user/useradd.rb | 12 +- lib/puppet/provider/user/windows_adsi.rb | 4 +- lib/puppet/type.rb | 2 +- lib/puppet/type/file/source.rb | 2 +- lib/puppet/type/package.rb | 4 +- lib/puppet/type/resources.rb | 2 +- lib/puppet/util/filetype.rb | 4 +- lib/puppet/util/suidmanager.rb | 2 +- .../lib/puppet/provider/a2mod/debian.rb | 2 +- .../jamtur01-apache/manifests/init.pp | 2 +- .../jamtur01-apache/manifests/params.pp | 2 +- .../releases/jamtur01-apache/manifests/ssl.pp | 2 +- .../jamtur01-apache/manifests/vhost.pp | 2 +- spec/integration/type/file_spec.rb | 4 +- spec/integration/type/package_spec.rb | 10 +- spec/shared_examples/rhel_package_provider.rb | 4 +- spec/unit/application/device_spec.rb | 4 +- spec/unit/confine_spec.rb | 12 +- spec/unit/face/epp_face_spec.rb | 4 +- spec/unit/file_bucket/dipper_spec.rb | 4 +- spec/unit/module_tool/tar_spec.rb | 6 +- .../pops/serialization/serialization_spec.rb | 4 +- .../pops/serialization/to_from_hr_spec.rb | 2 +- spec/unit/provider/package/apt_spec.rb | 4 +- spec/unit/provider/package/dnf_spec.rb | 30 ++--- spec/unit/provider/package/dnfmodule_spec.rb | 12 +- spec/unit/provider/package/gem_spec.rb | 4 +- spec/unit/provider/package/pip2_spec.rb | 4 +- spec/unit/provider/package/pip3_spec.rb | 4 +- spec/unit/provider/package/pip_spec.rb | 4 +- spec/unit/provider/package/pkg_spec.rb | 16 +-- spec/unit/provider/package/pkgng_spec.rb | 2 +- spec/unit/provider/package/portage_spec.rb | 4 +- spec/unit/provider/package/puppet_gem_spec.rb | 4 +- .../provider/package/puppetserver_gem_spec.rb | 4 +- spec/unit/provider/package/tdnf_spec.rb | 4 +- spec/unit/provider/package/up2date_spec.rb | 4 +- spec/unit/provider/package/yum_spec.rb | 32 ++--- spec/unit/provider/service/base_spec.rb | 2 +- spec/unit/provider/service/bsd_spec.rb | 4 +- spec/unit/provider/service/debian_spec.rb | 14 +-- spec/unit/provider/service/freebsd_spec.rb | 2 +- spec/unit/provider/service/gentoo_spec.rb | 4 +- spec/unit/provider/service/init_spec.rb | 16 +-- spec/unit/provider/service/openbsd_spec.rb | 4 +- spec/unit/provider/service/openwrt_spec.rb | 2 +- spec/unit/provider/service/rcng_spec.rb | 4 +- spec/unit/provider/service/redhat_spec.rb | 14 +-- spec/unit/provider/service/smf_spec.rb | 16 +-- spec/unit/provider/service/systemd_spec.rb | 114 +++++++++--------- spec/unit/provider/service/upstart_spec.rb | 6 +- .../provider/user/directoryservice_spec.rb | 4 +- spec/unit/provider/user/openbsd_spec.rb | 4 +- spec/unit/provider/user/useradd_spec.rb | 28 ++--- spec/unit/provider_spec.rb | 102 ++++++++-------- spec/unit/type/package_spec.rb | 6 +- spec/unit/type/resources_spec.rb | 4 +- spec/unit/type_spec.rb | 4 +- 128 files changed, 438 insertions(+), 438 deletions(-) diff --git a/acceptance/tests/aix/nim_package_provider.rb b/acceptance/tests/aix/nim_package_provider.rb index fa78a3feb68..c6976a818ea 100644 --- a/acceptance/tests/aix/nim_package_provider.rb +++ b/acceptance/tests/aix/nim_package_provider.rb @@ -8,7 +8,7 @@ version = on(aix, 'puppet --version').stdout version && Gem::Version.new(version) > Gem::Version.new('6.4.0') && - on(aix, 'facter operatingsystemrelease').stdout == '7.2' + on(aix, 'facter os.release.full').stdout == '7.2' end teardown do diff --git a/acceptance/tests/language/binary_data_type.rb b/acceptance/tests/language/binary_data_type.rb index cee0adbf582..85245a724ba 100644 --- a/acceptance/tests/language/binary_data_type.rb +++ b/acceptance/tests/language/binary_data_type.rb @@ -53,7 +53,7 @@ :assertions => { :assert_match => 'Notice: A:\\xF0\\x9F\\x91\\x92' } }, { :type => 'notify', :parameters => { :namevar => "B:${type($bin_file)}" }, :pre_code => '$bin_file=binary_file("empty/blah.txt")', :assertions => { :assert_match => 'Notice: B:Binary' } }, - { :type => 'file', :parameters => { :namevar => "$pup_tmp_filename", :content => "$relaxed" }, :pre_code => "$pup_tmp_filename = if $osfamily == 'windows' { '#{tmp_filename_win}' } else { '#{tmp_filename_else}' }", + { :type => 'file', :parameters => { :namevar => "$pup_tmp_filename", :content => "$relaxed" }, :pre_code => "$pup_tmp_filename = if $facts['os']['family'] == 'windows' { '#{tmp_filename_win}' } else { '#{tmp_filename_else}' }", :assertions => { :assert_match => /#{base64_relaxed}/ } }, ] diff --git a/acceptance/tests/language/sensitive_data_type.rb b/acceptance/tests/language/sensitive_data_type.rb index 9bb34be459a..7fad2d19291 100644 --- a/acceptance/tests/language/sensitive_data_type.rb +++ b/acceptance/tests/language/sensitive_data_type.rb @@ -58,7 +58,7 @@ {:type => 'notify', :parameters => {:namevar => "C:meh", :message => '"C:${$mehC.unwrap |$unwrapped| { "blk_${unwrapped}_blk" } } nonblk_${mehC}_nonblk"'}, :pre_code => '$mehC=Sensitive.new("sekritC")', :assertions => {:assert_match => ["C:blk_sekritC_blk", "nonblk_#{notify_redacted}_nonblk"]}}, # for --show_diff - {:type => 'file', :parameters => {:namevar => "$pup_tmp_filename", :content => "Sensitive.new('sekritD')"}, :pre_code => "$pup_tmp_filename = if $osfamily == 'windows' { '#{tmp_filename_win}' } else { '#{tmp_filename_else}' }", + {:type => 'file', :parameters => {:namevar => "$pup_tmp_filename", :content => "Sensitive.new('sekritD')"}, :pre_code => "$pup_tmp_filename = if $facts['os']['family'] == 'windows' { '#{tmp_filename_win}' } else { '#{tmp_filename_else}' }", :assertions => [{:refute_match => 'sekritD'}, {:assert_match => /#{tmp_environment}\.txt..content. #{file_redacted}/}]}, ] diff --git a/acceptance/tests/lookup/merge_strategies.rb b/acceptance/tests/lookup/merge_strategies.rb index 176a2c2d83f..214ad0dd4c3 100644 --- a/acceptance/tests/lookup/merge_strategies.rb +++ b/acceptance/tests/lookup/merge_strategies.rb @@ -37,9 +37,9 @@ - "host" - "roles" - "profiles" - - "%{::operatingsystem}" - - "%{::osfamily}" - - "%{::kernel}" + - "%{facts.os.name}" + - "%{facts.os.family}" + - "%{facts.kernel}" - "common" :merge_behavior: deeper :deep_merge_options: diff --git a/acceptance/tests/parser_functions/hiera_in_templates.rb b/acceptance/tests/parser_functions/hiera_in_templates.rb index 9940b169dc7..9d3e788424d 100644 --- a/acceptance/tests/parser_functions/hiera_in_templates.rb +++ b/acceptance/tests/parser_functions/hiera_in_templates.rb @@ -271,7 +271,7 @@ class #{@module_name}::mod_fqdn { def find_osfamilies family_hash = {} agents.each do |agent| - res = on(agent, facter("osfamily")) + res = on(agent, facter('os.family')) osf = res.stdout.chomp family_hash[osf] = 1 end diff --git a/acceptance/tests/resource/service/service_enable_linux.rb b/acceptance/tests/resource/service/service_enable_linux.rb index b94e3608887..647cb921560 100644 --- a/acceptance/tests/resource/service/service_enable_linux.rb +++ b/acceptance/tests/resource/service/service_enable_linux.rb @@ -22,7 +22,7 @@ agents.each do |agent| platform = agent.platform.variant osname = on(agent, facter('os.name')).stdout.chomp - majrelease = on(agent, facter('operatingsystemmajrelease')).stdout.chomp.to_i + majrelease = on(agent, facter('os.release.major')).stdout.chomp.to_i init_script_systemd = "/usr/lib/systemd/system/#{package_name[platform]}.service" symlink_systemd = "/etc/systemd/system/multi-user.target.wants/#{package_name[platform]}.service" diff --git a/acceptance/tests/resource/service/ticket_5024_systemd_enabling_masked_service.rb b/acceptance/tests/resource/service/ticket_5024_systemd_enabling_masked_service.rb index 66abb99019e..642bbb0555c 100644 --- a/acceptance/tests/resource/service/ticket_5024_systemd_enabling_masked_service.rb +++ b/acceptance/tests/resource/service/ticket_5024_systemd_enabling_masked_service.rb @@ -43,7 +43,7 @@ package { '#{package_name[platform]}': ensure => present, } - if ($::operatingsystem == 'Fedora') and ($::operatingsystemmajrelease == '23') { + if ($os['name'] == 'Fedora') and ($os['release']['major'] == '23') { package{'libnghttp2': ensure => latest, install_options => '--best', diff --git a/acceptance/tests/ticket_15560_managehome.rb b/acceptance/tests/ticket_15560_managehome.rb index 32ef946d216..f875a1afe11 100644 --- a/acceptance/tests/ticket_15560_managehome.rb +++ b/acceptance/tests/ticket_15560_managehome.rb @@ -30,7 +30,7 @@ deleteable_profile = true - version = on(host, facter('operatingsystemrelease')).stdout.chomp + version = on(host, facter('os.release.full')).stdout.chomp if version =~ /^5\.[012]|2003/ homedir = "C:/Documents and Settings/#{username}" deleteable_profile = false diff --git a/acceptance/tests/windows/QA-506_windows_exit_codes_test.rb b/acceptance/tests/windows/QA-506_windows_exit_codes_test.rb index e68c41c14c6..70f5337fc3f 100644 --- a/acceptance/tests/windows/QA-506_windows_exit_codes_test.rb +++ b/acceptance/tests/windows/QA-506_windows_exit_codes_test.rb @@ -58,7 +58,7 @@ native_modules_path = on(agent, puppet("config print #{module_path_config_property}")).stdout.gsub('C:', '/cygdrive/c').strip #Check to see if we are running on Windows 2003. Do a crazy hack to get around SCP issues. - if (on(agent, facter("find operatingsystemmajrelease")).stdout =~ /2003/) + if (on(agent, facter("find os.release.major")).stdout =~ /2003/) on(agent, "ln -s #{native_modules_path.gsub(/ /, '\ ')} /tmp/puppet_etc") modules_path = '/tmp/puppet_etc' else diff --git a/install.rb b/install.rb index 5d8c2e9952b..7ce9d0ac8b7 100755 --- a/install.rb +++ b/install.rb @@ -242,7 +242,7 @@ def prepare_installation # Otherwise facter won't be guaranteed to be present. if InstallOptions.check_prereqs check_prereqs - $operatingsystem = Facter.value :operatingsystem + $operatingsystem = Facter.value('os.name') end if not InstallOptions.configdir.nil? diff --git a/lib/puppet/confiner.rb b/lib/puppet/confiner.rb index 50282fd9769..39a51d94c4d 100644 --- a/lib/puppet/confiner.rb +++ b/lib/puppet/confiner.rb @@ -16,7 +16,7 @@ module Puppet::Confiner # * `:any` => an array of expressions that will be ORed together # # @example - # confine :operatingsystem => [:redhat, :fedora] + # confine 'os.name' => [:redhat, :fedora] # confine :true { ... } # # @param hash [Hash<{Symbol => Object}>] hash of confines diff --git a/lib/puppet/provider/exec/windows.rb b/lib/puppet/provider/exec/windows.rb index 422fb23bbb9..b6ff52e9557 100644 --- a/lib/puppet/provider/exec/windows.rb +++ b/lib/puppet/provider/exec/windows.rb @@ -2,8 +2,8 @@ Puppet::Type.type(:exec).provide :windows, :parent => Puppet::Provider::Exec do - confine :operatingsystem => :windows - defaultfor :operatingsystem => :windows + confine 'os.name' => :windows + defaultfor 'os.name' => :windows desc <<-'EOT' Execute external binaries on Windows systems. As with the `posix` diff --git a/lib/puppet/provider/file/windows.rb b/lib/puppet/provider/file/windows.rb index 4c2b5261273..634b4e37033 100644 --- a/lib/puppet/provider/file/windows.rb +++ b/lib/puppet/provider/file/windows.rb @@ -1,7 +1,7 @@ Puppet::Type.type(:file).provide :windows do desc "Uses Microsoft Windows functionality to manage file ownership and permissions." - confine :operatingsystem => :windows + confine 'os.name' => :windows has_feature :manages_symlinks if Puppet.features.manages_symlinks? include Puppet::Util::Warnings diff --git a/lib/puppet/provider/group/aix.rb b/lib/puppet/provider/group/aix.rb index 68c5441f9b4..eba84d5a247 100644 --- a/lib/puppet/provider/group/aix.rb +++ b/lib/puppet/provider/group/aix.rb @@ -6,8 +6,8 @@ desc "Group management for AIX." # This will the default provider for this platform - defaultfor :operatingsystem => :aix - confine :operatingsystem => :aix + defaultfor 'os.name' => :aix + confine 'os.name' => :aix # Commands that manage the element commands :list => "/usr/sbin/lsgroup" diff --git a/lib/puppet/provider/group/directoryservice.rb b/lib/puppet/provider/group/directoryservice.rb index 35856b898bc..cbd9d85c605 100644 --- a/lib/puppet/provider/group/directoryservice.rb +++ b/lib/puppet/provider/group/directoryservice.rb @@ -6,8 +6,8 @@ " commands :dscl => "/usr/bin/dscl" - confine :operatingsystem => :darwin - defaultfor :operatingsystem => :darwin + confine 'os.name' => :darwin + defaultfor 'os.name' => :darwin has_feature :manages_members def members_insync?(current, should) diff --git a/lib/puppet/provider/group/groupadd.rb b/lib/puppet/provider/group/groupadd.rb index 38aafd6109e..0843999b106 100644 --- a/lib/puppet/provider/group/groupadd.rb +++ b/lib/puppet/provider/group/groupadd.rb @@ -6,7 +6,7 @@ commands :add => "groupadd", :delete => "groupdel", :modify => "groupmod" - has_feature :system_groups unless %w{HP-UX Solaris}.include? Facter.value(:operatingsystem) + has_feature :system_groups unless %w{HP-UX Solaris}.include? Facter.value('os.name') verify :gid, _("GID must be an integer") do |value| value.is_a? Integer diff --git a/lib/puppet/provider/group/pw.rb b/lib/puppet/provider/group/pw.rb index c9ea39de966..25dbd2dc7a6 100644 --- a/lib/puppet/provider/group/pw.rb +++ b/lib/puppet/provider/group/pw.rb @@ -6,8 +6,8 @@ commands :pw => "pw" has_features :manages_members - defaultfor :operatingsystem => [:freebsd, :dragonfly] - confine :operatingsystem => [:freebsd, :dragonfly] + defaultfor 'os.name' => [:freebsd, :dragonfly] + confine 'os.name' => [:freebsd, :dragonfly] options :members, :flag => "-M", :method => :mem diff --git a/lib/puppet/provider/group/windows_adsi.rb b/lib/puppet/provider/group/windows_adsi.rb index b10b350e9c5..97f529cf011 100644 --- a/lib/puppet/provider/group/windows_adsi.rb +++ b/lib/puppet/provider/group/windows_adsi.rb @@ -4,8 +4,8 @@ desc "Local group management for Windows. Group members can be both users and groups. Additionally, local groups can contain domain users." - defaultfor :operatingsystem => :windows - confine :operatingsystem => :windows + defaultfor 'os.name' => :windows + confine 'os.name' => :windows has_features :manages_members diff --git a/lib/puppet/provider/nameservice/directoryservice.rb b/lib/puppet/provider/nameservice/directoryservice.rb index 1c9c1771e35..69fe57886fc 100644 --- a/lib/puppet/provider/nameservice/directoryservice.rb +++ b/lib/puppet/provider/nameservice/directoryservice.rb @@ -18,9 +18,9 @@ class << self commands :dscl => "/usr/bin/dscl" commands :dseditgroup => "/usr/sbin/dseditgroup" commands :sw_vers => "/usr/bin/sw_vers" - confine :operatingsystem => :darwin - confine :feature => :cfpropertylist - defaultfor :operatingsystem => :darwin + confine 'os.name' => :darwin + confine :feature => :cfpropertylist + defaultfor 'os.name' => :darwin # There is no generalized mechanism for provider cache management, but we can # use post_resource_eval, which will be run for each suitable provider at the diff --git a/lib/puppet/provider/package/aix.rb b/lib/puppet/provider/package/aix.rb index c4f28a4caf9..57a43bad925 100644 --- a/lib/puppet/provider/package/aix.rb +++ b/lib/puppet/provider/package/aix.rb @@ -24,8 +24,8 @@ # AIX supports versionable packages with and without a NIM server has_feature :versionable - confine :operatingsystem => [ :aix ] - defaultfor :operatingsystem => :aix + confine 'os.name' => [ :aix ] + defaultfor 'os.name' => :aix attr_accessor :latest_info diff --git a/lib/puppet/provider/package/appdmg.rb b/lib/puppet/provider/package/appdmg.rb index 487e7c2aa90..6ef11f7bdaa 100644 --- a/lib/puppet/provider/package/appdmg.rb +++ b/lib/puppet/provider/package/appdmg.rb @@ -17,8 +17,8 @@ Puppet::Type.type(:package).provide(:appdmg, :parent => Puppet::Provider::Package) do desc "Package management which copies application bundles to a target." - confine :operatingsystem => :darwin - confine :feature => :cfpropertylist + confine 'os.name' => :darwin + confine :feature => :cfpropertylist commands :hdiutil => "/usr/bin/hdiutil" commands :curl => "/usr/bin/curl" diff --git a/lib/puppet/provider/package/apple.rb b/lib/puppet/provider/package/apple.rb index 1a6cecad720..52bb2bf50bb 100644 --- a/lib/puppet/provider/package/apple.rb +++ b/lib/puppet/provider/package/apple.rb @@ -8,7 +8,7 @@ automatically add the `.pkg` extension, so leave that off when specifying the package name." - confine :operatingsystem => :darwin + confine 'os.name' => :darwin commands :installer => "/usr/sbin/installer" def self.instances diff --git a/lib/puppet/provider/package/apt.rb b/lib/puppet/provider/package/apt.rb index 44967cc0972..4bba7ebcac3 100644 --- a/lib/puppet/provider/package/apt.rb +++ b/lib/puppet/provider/package/apt.rb @@ -19,7 +19,7 @@ commands :aptmark => "/usr/bin/apt-mark" commands :preseed => "/usr/bin/debconf-set-selections" - defaultfor :osfamily => :debian + defaultfor 'os.family' => :debian ENV['DEBIAN_FRONTEND'] = "noninteractive" diff --git a/lib/puppet/provider/package/blastwave.rb b/lib/puppet/provider/package/blastwave.rb index 1ace40fe0e9..15297a3c85f 100644 --- a/lib/puppet/provider/package/blastwave.rb +++ b/lib/puppet/provider/package/blastwave.rb @@ -4,7 +4,7 @@ pkgget = "pkg-get" pkgget = "/opt/csw/bin/pkg-get" if FileTest.executable?("/opt/csw/bin/pkg-get") - confine :osfamily => :solaris + confine 'os.family' => :solaris commands :pkgget => pkgget diff --git a/lib/puppet/provider/package/dnf.rb b/lib/puppet/provider/package/dnf.rb index 16b6a650f3d..8eb9e9ceea8 100644 --- a/lib/puppet/provider/package/dnf.rb +++ b/lib/puppet/provider/package/dnf.rb @@ -28,10 +28,10 @@ end end - defaultfor :operatingsystem => :fedora - notdefaultfor :operatingsystem => :fedora, :operatingsystemmajrelease => (19..21).to_a - defaultfor :osfamily => :redhat - notdefaultfor :osfamily => :redhat, :operatingsystemmajrelease => (4..7).to_a + defaultfor 'os.name' => :fedora + notdefaultfor 'os.name' => :fedora, 'os.release.major' => (19..21).to_a + defaultfor 'os.family' => :redhat + notdefaultfor 'os.family' => :redhat, 'os.release.major' => (4..7).to_a def self.update_command # In DNF, update is deprecated for upgrade diff --git a/lib/puppet/provider/package/freebsd.rb b/lib/puppet/provider/package/freebsd.rb index 305367968fb..dce936f85e7 100644 --- a/lib/puppet/provider/package/freebsd.rb +++ b/lib/puppet/provider/package/freebsd.rb @@ -9,7 +9,7 @@ :pkgadd => "/usr/sbin/pkg_add", :pkgdelete => "/usr/sbin/pkg_delete" - confine :operatingsystem => :freebsd + confine 'os.name' => :freebsd def self.listcmd command(:pkginfo) diff --git a/lib/puppet/provider/package/hpux.rb b/lib/puppet/provider/package/hpux.rb index 4416f010157..d42309523de 100644 --- a/lib/puppet/provider/package/hpux.rb +++ b/lib/puppet/provider/package/hpux.rb @@ -10,9 +10,9 @@ :swlist => "/usr/sbin/swlist", :swremove => "/usr/sbin/swremove" - confine :operatingsystem => "hp-ux" + confine 'os.name' => "hp-ux" - defaultfor :operatingsystem => "hp-ux" + defaultfor 'os.name' => "hp-ux" def self.instances # TODO: This is very hard on HP-UX! diff --git a/lib/puppet/provider/package/macports.rb b/lib/puppet/provider/package/macports.rb index ea8d2ce45dd..f71e401e545 100644 --- a/lib/puppet/provider/package/macports.rb +++ b/lib/puppet/provider/package/macports.rb @@ -12,7 +12,7 @@ Revisions are only used internally for ensuring the latest version/revision of a port. " - confine :operatingsystem => :darwin + confine 'os.name' => :darwin has_command(:port, "/opt/local/bin/port") do environment :HOME => "/opt/local" diff --git a/lib/puppet/provider/package/openbsd.rb b/lib/puppet/provider/package/openbsd.rb index b47a93969bc..fa1cef1b612 100644 --- a/lib/puppet/provider/package/openbsd.rb +++ b/lib/puppet/provider/package/openbsd.rb @@ -13,8 +13,8 @@ :pkgadd => "pkg_add", :pkgdelete => "pkg_delete" - defaultfor :operatingsystem => :openbsd - confine :operatingsystem => :openbsd + defaultfor 'os.name' => :openbsd + confine 'os.name' => :openbsd has_feature :versionable has_feature :install_options diff --git a/lib/puppet/provider/package/opkg.rb b/lib/puppet/provider/package/opkg.rb index 1a110f40384..afb25a3eb0a 100644 --- a/lib/puppet/provider/package/opkg.rb +++ b/lib/puppet/provider/package/opkg.rb @@ -5,8 +5,8 @@ commands :opkg => "opkg" - confine :operatingsystem => :openwrt - defaultfor :operatingsystem => :openwrt + confine 'os.name' => :openwrt + defaultfor 'os.name' => :openwrt def self.instances packages = [] diff --git a/lib/puppet/provider/package/pacman.rb b/lib/puppet/provider/package/pacman.rb index acd3b3ef7ac..61596f96405 100644 --- a/lib/puppet/provider/package/pacman.rb +++ b/lib/puppet/provider/package/pacman.rb @@ -17,8 +17,8 @@ def self.yaourt? # Yaourt is a common AUR helper which, if installed, we can use to query the AUR commands :yaourt => "/usr/bin/yaourt" if yaourt? - confine :operatingsystem => [:archlinux, :manjarolinux] - defaultfor :operatingsystem => [:archlinux, :manjarolinux] + confine 'os.name' => [:archlinux, :manjarolinux] + defaultfor 'os.name' => [:archlinux, :manjarolinux] has_feature :install_options has_feature :uninstall_options has_feature :upgradeable diff --git a/lib/puppet/provider/package/pkg.rb b/lib/puppet/provider/package/pkg.rb index c6777ce5d25..a0e7394ed12 100644 --- a/lib/puppet/provider/package/pkg.rb +++ b/lib/puppet/provider/package/pkg.rb @@ -28,9 +28,9 @@ commands :pkg => "/usr/bin/pkg" - confine :osfamily => :solaris + confine 'os.family' => :solaris - defaultfor :osfamily => :solaris, :kernelrelease => ['5.11', '5.12'] + defaultfor 'os.family' => :solaris, :kernelrelease => ['5.11', '5.12'] def self.instances pkg(:list, '-Hv').split("\n").map{|l| new(parse_line(l))} @@ -221,7 +221,7 @@ def install(nofail = false) command = 'update' end args = ['--accept'] - if Puppet::Util::Package.versioncmp(Facter.value(:operatingsystemrelease), '11.2') >= 0 + if Puppet::Util::Package.versioncmp(Facter.value('os.release.full'), '11.2') >= 0 args.push('--sync-actuators-timeout', '900') end args.concat(join_options(@resource[:install_options])) if @resource[:install_options] diff --git a/lib/puppet/provider/package/pkgdmg.rb b/lib/puppet/provider/package/pkgdmg.rb index c673d443bab..e14a7906063 100644 --- a/lib/puppet/provider/package/pkgdmg.rb +++ b/lib/puppet/provider/package/pkgdmg.rb @@ -35,9 +35,9 @@ whether a package has been installed. Thus, to install new a version of a package, you must create a new DMG with a different filename." - confine :operatingsystem => :darwin + confine 'os.name' => :darwin confine :feature => :cfpropertylist - defaultfor :operatingsystem => :darwin + defaultfor 'os.name' => :darwin commands :installer => "/usr/sbin/installer" commands :hdiutil => "/usr/bin/hdiutil" commands :curl => "/usr/bin/curl" diff --git a/lib/puppet/provider/package/pkgin.rb b/lib/puppet/provider/package/pkgin.rb index 8f2d7ef4911..3d5ee0142bf 100644 --- a/lib/puppet/provider/package/pkgin.rb +++ b/lib/puppet/provider/package/pkgin.rb @@ -5,7 +5,7 @@ commands :pkgin => "pkgin" - defaultfor :operatingsystem => [ :smartos, :netbsd ] + defaultfor 'os.name' => [ :smartos, :netbsd ] has_feature :installable, :uninstallable, :upgradeable, :versionable diff --git a/lib/puppet/provider/package/pkgng.rb b/lib/puppet/provider/package/pkgng.rb index d8e5b0fe91e..6e9e0ee2599 100644 --- a/lib/puppet/provider/package/pkgng.rb +++ b/lib/puppet/provider/package/pkgng.rb @@ -5,9 +5,9 @@ commands :pkg => "/usr/local/sbin/pkg" - confine :operatingsystem => [:freebsd, :dragonfly] + confine 'os.name' => [:freebsd, :dragonfly] - defaultfor :operatingsystem => [:freebsd, :dragonfly] + defaultfor 'os.name' => [:freebsd, :dragonfly] has_feature :versionable has_feature :upgradeable diff --git a/lib/puppet/provider/package/pkgutil.rb b/lib/puppet/provider/package/pkgutil.rb index d0815e0260e..1663e823c0c 100644 --- a/lib/puppet/provider/package/pkgutil.rb +++ b/lib/puppet/provider/package/pkgutil.rb @@ -7,7 +7,7 @@ pkgutil_bin = "/opt/csw/bin/pkgutil" end - confine :osfamily => :solaris + confine 'os.family' => :solaris has_command(:pkguti, pkgutil_bin) do environment :HOME => ENV['HOME'] diff --git a/lib/puppet/provider/package/portage.rb b/lib/puppet/provider/package/portage.rb index 3f463beeda3..a8fd2f88d15 100644 --- a/lib/puppet/provider/package/portage.rb +++ b/lib/puppet/provider/package/portage.rb @@ -20,9 +20,9 @@ end end - confine :osfamily => :gentoo + confine 'os.family' => :gentoo - defaultfor :osfamily => :gentoo + defaultfor 'os.family' => :gentoo def self.instances result_format = self.eix_result_format diff --git a/lib/puppet/provider/package/portupgrade.rb b/lib/puppet/provider/package/portupgrade.rb index 7c1a81cddc4..be5c6f60fba 100644 --- a/lib/puppet/provider/package/portupgrade.rb +++ b/lib/puppet/provider/package/portupgrade.rb @@ -18,7 +18,7 @@ :portinfo => "/usr/sbin/pkg_info" ## Activate this only once approved by someone important. - # defaultfor :operatingsystem => :freebsd + # defaultfor 'os.name' => :freebsd # Remove unwanted environment variables. %w{INTERACTIVE UNAME}.each do |var| diff --git a/lib/puppet/provider/package/rug.rb b/lib/puppet/provider/package/rug.rb index 5cb2945fe0b..aa7e7cc247f 100644 --- a/lib/puppet/provider/package/rug.rb +++ b/lib/puppet/provider/package/rug.rb @@ -5,7 +5,7 @@ commands :rug => "/usr/bin/rug" commands :rpm => "rpm" - confine :operatingsystem => [:suse, :sles] + confine 'os.name' => [:suse, :sles] # Install a package using 'rug'. def install diff --git a/lib/puppet/provider/package/sun.rb b/lib/puppet/provider/package/sun.rb index 20bf708a919..70852cfd210 100644 --- a/lib/puppet/provider/package/sun.rb +++ b/lib/puppet/provider/package/sun.rb @@ -14,8 +14,8 @@ :pkgadd => "/usr/sbin/pkgadd", :pkgrm => "/usr/sbin/pkgrm" - confine :osfamily => :solaris - defaultfor :osfamily => :solaris + confine 'os.family' => :solaris + defaultfor 'os.family' => :solaris has_feature :install_options diff --git a/lib/puppet/provider/package/sunfreeware.rb b/lib/puppet/provider/package/sunfreeware.rb index 118d36b66e9..d4473401851 100644 --- a/lib/puppet/provider/package/sunfreeware.rb +++ b/lib/puppet/provider/package/sunfreeware.rb @@ -5,5 +5,5 @@ has not actually been tested." commands :pkgget => "pkg-get" - confine :osfamily => :solaris + confine 'os.family' => :solaris end diff --git a/lib/puppet/provider/package/tdnf.rb b/lib/puppet/provider/package/tdnf.rb index c633d58bbe5..4c17313c838 100644 --- a/lib/puppet/provider/package/tdnf.rb +++ b/lib/puppet/provider/package/tdnf.rb @@ -24,5 +24,5 @@ end end - defaultfor :operatingsystem => "PhotonOS" + defaultfor 'os.name' => "PhotonOS" end diff --git a/lib/puppet/provider/package/up2date.rb b/lib/puppet/provider/package/up2date.rb index d9eafbe25dc..6c998879c7a 100644 --- a/lib/puppet/provider/package/up2date.rb +++ b/lib/puppet/provider/package/up2date.rb @@ -4,9 +4,9 @@ commands :up2date => "/usr/sbin/up2date-nox" - defaultfor :osfamily => :redhat, :lsbdistrelease => ["2.1", "3", "4"] + defaultfor 'os.family' => :redhat, 'os.distro.release.full' => ["2.1", "3", "4"] - confine :osfamily => :redhat + confine 'os.family' => :redhat # Install a package using 'up2date'. def install diff --git a/lib/puppet/provider/package/urpmi.rb b/lib/puppet/provider/package/urpmi.rb index 32a049582bc..d396c5df02c 100644 --- a/lib/puppet/provider/package/urpmi.rb +++ b/lib/puppet/provider/package/urpmi.rb @@ -2,7 +2,7 @@ desc "Support via `urpmi`." commands :urpmi => "urpmi", :urpmq => "urpmq", :rpm => "rpm", :urpme => "urpme" - defaultfor :operatingsystem => [:mandriva, :mandrake] + defaultfor 'os.name' => [:mandriva, :mandrake] has_feature :versionable diff --git a/lib/puppet/provider/package/windows.rb b/lib/puppet/provider/package/windows.rb index 09de9bd2fe1..19fc155ed38 100644 --- a/lib/puppet/provider/package/windows.rb +++ b/lib/puppet/provider/package/windows.rb @@ -20,8 +20,8 @@ `install_options` or `uninstall_options` attributes, respectively. Puppet will automatically quote any option that contains spaces." - confine :operatingsystem => :windows - defaultfor :operatingsystem => :windows + confine 'os.name' => :windows + defaultfor 'os.name' => :windows has_feature :installable has_feature :uninstallable diff --git a/lib/puppet/provider/package/yum.rb b/lib/puppet/provider/package/yum.rb index e26083f40e0..4fe85b8d8dc 100644 --- a/lib/puppet/provider/package/yum.rb +++ b/lib/puppet/provider/package/yum.rb @@ -32,8 +32,8 @@ end end -defaultfor :operatingsystem => :amazon -defaultfor :osfamily => :redhat, :operatingsystemmajrelease => (4..7).to_a +defaultfor 'os.name' => :amazon +defaultfor 'os.family' => :redhat, 'os.release.major' => (4..7).to_a def insync?(is) return false if [:purged, :absent].include?(is) @@ -298,7 +298,7 @@ def install # Yum on el-4 and el-5 returns exit status 0 when trying to install a package it doesn't recognize; # ensure we capture output to check for errors. - no_debug = if Facter.value(:operatingsystemmajrelease).to_i > 5 then ["-d", "0"] else [] end + no_debug = if Facter.value('os.release.major').to_i > 5 then ["-d", "0"] else [] end command = [command(:cmd)] + no_debug + ["-e", error_level, "-y", install_options, operation, wanted].compact output = execute(command) diff --git a/lib/puppet/provider/package/zypper.rb b/lib/puppet/provider/package/zypper.rb index 5f5d6016d18..0033955b38c 100644 --- a/lib/puppet/provider/package/zypper.rb +++ b/lib/puppet/provider/package/zypper.rb @@ -9,8 +9,8 @@ commands :zypper => "/usr/bin/zypper" - defaultfor :operatingsystem => [:suse, :sles, :sled, :opensuse] - confine :operatingsystem => [:suse, :sles, :sled, :opensuse] + defaultfor 'os.name' => [:suse, :sles, :sled, :opensuse] + confine 'os.name' => [:suse, :sles, :sled, :opensuse] # @api private # Reset the latest version hash to nil diff --git a/lib/puppet/provider/service/base.rb b/lib/puppet/provider/service/base.rb index 9576398597e..a1ca816cc5c 100644 --- a/lib/puppet/provider/service/base.rb +++ b/lib/puppet/provider/service/base.rb @@ -15,7 +15,7 @@ # ported from the facter 2.x implementation, since facter 3.x # is dropping the fact (for which this was the only use) def getps - case Facter.value(:operatingsystem) + case Facter.value('os.name') when 'OpenWrt' 'ps www' when 'FreeBSD', 'NetBSD', 'OpenBSD', 'Darwin', 'DragonFly' diff --git a/lib/puppet/provider/service/bsd.rb b/lib/puppet/provider/service/bsd.rb index 146d048d557..688994531c1 100644 --- a/lib/puppet/provider/service/bsd.rb +++ b/lib/puppet/provider/service/bsd.rb @@ -5,7 +5,7 @@ Uses `rc.conf.d` for service enabling and disabling. EOT - confine :operatingsystem => [:freebsd, :dragonfly] + confine 'os.name' => [:freebsd, :dragonfly] def rcconf_dir '/etc/rc.conf.d' diff --git a/lib/puppet/provider/service/debian.rb b/lib/puppet/provider/service/debian.rb index 9352f3b005a..ce0a448f2f0 100644 --- a/lib/puppet/provider/service/debian.rb +++ b/lib/puppet/provider/service/debian.rb @@ -19,9 +19,9 @@ confine :false => Puppet::FileSystem.exist?('/proc/1/comm') && Puppet::FileSystem.read('/proc/1/comm').include?('systemd') - defaultfor :operatingsystem => :cumuluslinux, :operatingsystemmajrelease => ['1','2'] - defaultfor :operatingsystem => :debian, :operatingsystemmajrelease => ['5','6','7'] - defaultfor :operatingsystem => :devuan + defaultfor 'os.name' => :cumuluslinux, 'os.release.major' => ['1','2'] + defaultfor 'os.name' => :debian, 'os.release.major' => ['5','6','7'] + defaultfor 'os.name' => :devuan # Remove the symlinks def disable diff --git a/lib/puppet/provider/service/freebsd.rb b/lib/puppet/provider/service/freebsd.rb index 9ad46053056..cfc520b2998 100644 --- a/lib/puppet/provider/service/freebsd.rb +++ b/lib/puppet/provider/service/freebsd.rb @@ -2,8 +2,8 @@ desc "Provider for FreeBSD and DragonFly BSD. Uses the `rcvar` argument of init scripts and parses/edits rc files." - confine :operatingsystem => [:freebsd, :dragonfly] - defaultfor :operatingsystem => [:freebsd, :dragonfly] + confine 'os.name' => [:freebsd, :dragonfly] + defaultfor 'os.name' => [:freebsd, :dragonfly] def rcconf() '/etc/rc.conf' end def rcconf_local() '/etc/rc.conf.local' end diff --git a/lib/puppet/provider/service/gentoo.rb b/lib/puppet/provider/service/gentoo.rb index 4fecbde9dac..3f38fc2042c 100644 --- a/lib/puppet/provider/service/gentoo.rb +++ b/lib/puppet/provider/service/gentoo.rb @@ -10,7 +10,7 @@ commands :update => "/sbin/rc-update" - confine :operatingsystem => :gentoo + confine 'os.name' => :gentoo def disable output = update :del, @resource[:name], :default diff --git a/lib/puppet/provider/service/init.rb b/lib/puppet/provider/service/init.rb index 3ab27b33224..b4378825fb9 100644 --- a/lib/puppet/provider/service/init.rb +++ b/lib/puppet/provider/service/init.rb @@ -4,7 +4,7 @@ desc "Standard `init`-style service management." def self.defpath - case Facter.value(:operatingsystem) + case Facter.value('os.name') when "FreeBSD", "DragonFly" ["/etc/rc.d", "/usr/local/etc/rc.d"] when "HP-UX" @@ -21,8 +21,8 @@ def self.defpath # Debian and Ubuntu should use the Debian provider. # RedHat systems should use the RedHat provider. confine :true => begin - os = Facter.value(:operatingsystem).downcase - family = Facter.value(:osfamily).downcase + os = Facter.value('os.name').downcase + family = Facter.value('os.family').downcase !(os == 'debian' || os == 'ubuntu' || family == 'redhat') end @@ -54,7 +54,7 @@ def self.excludes # these excludes were found with grep -r -L start /etc/init.d excludes += %w{rcS module-init-tools} # Prevent puppet failing on unsafe scripts from Yocto Linux - if Facter.value(:osfamily) == "cisco-wrlinux" + if Facter.value('os.family') == "cisco-wrlinux" excludes += %w{banner.sh bootmisc.sh checkroot.sh devpts.sh dmesg.sh hostname.sh mountall.sh mountnfs.sh populate-volatile.sh rmnologin.sh save-rtc.sh sendsigs sysfs.sh umountfs @@ -171,7 +171,7 @@ def restartcmd end def texecute(type, command, fof = true, squelch = false, combine = true) - if type == :start && Facter.value(:osfamily) == "Solaris" + if type == :start && Facter.value('os.family') == "Solaris" command = ["/usr/bin/ctrun -l child", command].flatten.join(" ") end super(type, command, fof, squelch, combine) diff --git a/lib/puppet/provider/service/launchd.rb b/lib/puppet/provider/service/launchd.rb index bde8535cb13..409c60bb4c1 100644 --- a/lib/puppet/provider/service/launchd.rb +++ b/lib/puppet/provider/service/launchd.rb @@ -42,9 +42,9 @@ commands :launchctl => "/bin/launchctl" - defaultfor :operatingsystem => :darwin - confine :operatingsystem => :darwin - confine :feature => :cfpropertylist + defaultfor 'os.name' => :darwin + confine 'os.name' => :darwin + confine :feature => :cfpropertylist has_feature :enableable has_feature :refreshable @@ -70,7 +70,7 @@ def self.launchd_paths # # @api private def self.get_os_version - @os_version ||= Facter.value(:operatingsystemmajrelease).to_i + @os_version ||= Facter.value('os.release.major').to_i end # Defines the path to the overrides plist file where service enabling diff --git a/lib/puppet/provider/service/openbsd.rb b/lib/puppet/provider/service/openbsd.rb index 34a7382d42a..7a4f2c8d50b 100644 --- a/lib/puppet/provider/service/openbsd.rb +++ b/lib/puppet/provider/service/openbsd.rb @@ -4,8 +4,8 @@ commands :rcctl => '/usr/sbin/rcctl' - confine :operatingsystem => :openbsd - defaultfor :operatingsystem => :openbsd + confine 'os.name' => :openbsd + defaultfor 'os.name' => :openbsd has_feature :flaggable def startcmd diff --git a/lib/puppet/provider/service/openrc.rb b/lib/puppet/provider/service/openrc.rb index 8243f651e87..f6c91bfd621 100644 --- a/lib/puppet/provider/service/openrc.rb +++ b/lib/puppet/provider/service/openrc.rb @@ -7,8 +7,8 @@ EOT - defaultfor :operatingsystem => :gentoo - defaultfor :operatingsystem => :funtoo + defaultfor 'os.name' => :gentoo + defaultfor 'os.name' => :funtoo has_command(:rcstatus, '/bin/rc-status') do environment :RC_SVCNAME => nil diff --git a/lib/puppet/provider/service/openwrt.rb b/lib/puppet/provider/service/openwrt.rb index f1171275672..2f8f93db14e 100644 --- a/lib/puppet/provider/service/openwrt.rb +++ b/lib/puppet/provider/service/openwrt.rb @@ -6,8 +6,8 @@ EOT - defaultfor :operatingsystem => :openwrt - confine :operatingsystem => :openwrt + defaultfor 'os.name' => :openwrt + confine 'os.name' => :openwrt has_feature :enableable diff --git a/lib/puppet/provider/service/rcng.rb b/lib/puppet/provider/service/rcng.rb index 5e5d16bde4e..47d914c4828 100644 --- a/lib/puppet/provider/service/rcng.rb +++ b/lib/puppet/provider/service/rcng.rb @@ -3,8 +3,8 @@ RCng service management with rc.d EOT - defaultfor :operatingsystem => [:netbsd, :cargos] - confine :operatingsystem => [:netbsd, :cargos] + defaultfor 'os.name' => [:netbsd, :cargos] + confine 'os.name' => [:netbsd, :cargos] def self.defpath "/etc/rc.d" diff --git a/lib/puppet/provider/service/redhat.rb b/lib/puppet/provider/service/redhat.rb index 20c6afe0e80..bee68750c57 100644 --- a/lib/puppet/provider/service/redhat.rb +++ b/lib/puppet/provider/service/redhat.rb @@ -8,8 +8,8 @@ commands :chkconfig => "/sbin/chkconfig", :service => "/sbin/service" - defaultfor :osfamily => :redhat - defaultfor :osfamily => :suse, :operatingsystemmajrelease => ["10", "11"] + defaultfor 'os.family' => :redhat + defaultfor 'os.family' => :suse, 'os.release.major' => ["10", "11"] # Remove the symlinks def disable @@ -35,7 +35,7 @@ def enabled? # For Suse OS family, chkconfig returns 0 even if the service is disabled or non-existent # Therefore, check the output for ' on' (or ' B for boot services) # to see if it is enabled - return :false unless Facter.value(:osfamily) != 'Suse' || output =~ /^#{name}\s+(on|B)$/ + return :false unless Facter.value('os.family') != 'Suse' || output =~ /^#{name}\s+(on|B)$/ :true end diff --git a/lib/puppet/provider/service/smf.rb b/lib/puppet/provider/service/smf.rb index 50244c91305..bd1009c79df 100644 --- a/lib/puppet/provider/service/smf.rb +++ b/lib/puppet/provider/service/smf.rb @@ -18,9 +18,9 @@ be imported if it does not exist. EOT - defaultfor :osfamily => :solaris + defaultfor 'os.family' => :solaris - confine :osfamily => :solaris + confine 'os.family' => :solaris commands :adm => "/usr/sbin/svcadm", :svcs => "/usr/bin/svcs", @@ -125,14 +125,14 @@ def service_fmri # Returns true if the provider supports incomplete services. def supports_incomplete_services? - Puppet::Util::Package.versioncmp(Facter.value(:operatingsystemrelease), '11.1') >= 0 + Puppet::Util::Package.versioncmp(Facter.value('os.release.full'), '11.1') >= 0 end # Returns true if the service is complete. A complete service is a service that # has the general/complete property defined. def complete_service? unless supports_incomplete_services? - raise Puppet::Error, _("Cannot query if the %{service} service is complete: The concept of complete/incomplete services was introduced in Solaris 11.1. You are on a Solaris %{release} machine.") % { service: @resource[:name], release: Facter.value(:operatingsystemrelease) } + raise Puppet::Error, _("Cannot query if the %{service} service is complete: The concept of complete/incomplete services was introduced in Solaris 11.1. You are on a Solaris %{release} machine.") % { service: @resource[:name], release: Facter.value('os.release.full') } end return @complete_service if @complete_service @@ -162,7 +162,7 @@ def disable end def restartcmd - if Puppet::Util::Package.versioncmp(Facter.value(:operatingsystemrelease), '11.2') >= 0 + if Puppet::Util::Package.versioncmp(Facter.value('os.release.full'), '11.2') >= 0 [command(:adm), :restart, "-s", self.service_fmri] else # Synchronous restart only supported in Solaris 11.2 and above diff --git a/lib/puppet/provider/service/src.rb b/lib/puppet/provider/service/src.rb index 8276598769b..acbf4ceb1f7 100644 --- a/lib/puppet/provider/service/src.rb +++ b/lib/puppet/provider/service/src.rb @@ -13,8 +13,8 @@ is not yet supported. " - defaultfor :operatingsystem => :aix - confine :operatingsystem => :aix + defaultfor 'os.name' => :aix + confine 'os.name' => :aix optional_commands :stopsrc => "/usr/bin/stopsrc", :startsrc => "/usr/bin/startsrc", diff --git a/lib/puppet/provider/service/systemd.rb b/lib/puppet/provider/service/systemd.rb index 6408f8cfb77..0277e882afe 100644 --- a/lib/puppet/provider/service/systemd.rb +++ b/lib/puppet/provider/service/systemd.rb @@ -13,19 +13,19 @@ confine :true => Puppet::FileSystem.exist?('/proc/1/comm') && Puppet::FileSystem.read('/proc/1/comm').include?('systemd') - defaultfor :osfamily => [:archlinux] - defaultfor :osfamily => :redhat, :operatingsystemmajrelease => ["7", "8"] - defaultfor :osfamily => :redhat, :operatingsystem => :fedora - defaultfor :osfamily => :suse - defaultfor :osfamily => :coreos - defaultfor :operatingsystem => :amazon, :operatingsystemmajrelease => ["2"] - defaultfor :operatingsystem => :debian - notdefaultfor :operatingsystem => :debian, :operatingsystemmajrelease => ["5", "6", "7"] # These are using the "debian" method - defaultfor :operatingsystem => :LinuxMint - notdefaultfor :operatingsystem => :LinuxMint, :operatingsystemmajrelease => ["10", "11", "12", "13", "14", "15", "16", "17"] # These are using upstart - defaultfor :operatingsystem => :ubuntu - notdefaultfor :operatingsystem => :ubuntu, :operatingsystemmajrelease => ["10.04", "12.04", "14.04", "14.10"] # These are using upstart - defaultfor :operatingsystem => :cumuluslinux, :operatingsystemmajrelease => ["3", "4"] + defaultfor 'os.family' => [:archlinux] + defaultfor 'os.family' => :redhat, 'os.release.major' => ["7", "8"] + defaultfor 'os.family' => :redhat, 'os.name' => :fedora + defaultfor 'os.family' => :suse + defaultfor 'os.family' => :coreos + defaultfor 'os.name' => :amazon, 'os.release.major' => ["2"] + defaultfor 'os.name' => :debian + notdefaultfor 'os.name' => :debian, 'os.release.major' => ["5", "6", "7"] # These are using the "debian" method + defaultfor 'os.name' => :LinuxMint + notdefaultfor 'os.name' => :LinuxMint, 'os.release.major' => ["10", "11", "12", "13", "14", "15", "16", "17"] # These are using upstart + defaultfor 'os.name' => :ubuntu + notdefaultfor 'os.name' => :ubuntu, 'os.release.major' => ["10.04", "12.04", "14.04", "14.10"] # These are using upstart + defaultfor 'os.name' => :cumuluslinux, 'os.release.major' => ["3", "4"] def self.instances i = [] @@ -105,7 +105,7 @@ def enabled? # The indirect state indicates that the unit is not enabled. return :false if output == 'indirect' return :true if (code == 0) - if (output.empty?) && (code > 0) && (Facter.value(:osfamily).casecmp('debian').zero?) + if (output.empty?) && (code > 0) && (Facter.value('os.family').casecmp('debian').zero?) ret = debian_enabled? return ret if ret end diff --git a/lib/puppet/provider/service/upstart.rb b/lib/puppet/provider/service/upstart.rb index ac781b9ee43..9e0007d8c90 100644 --- a/lib/puppet/provider/service/upstart.rb +++ b/lib/puppet/provider/service/upstart.rb @@ -10,14 +10,14 @@ " confine :any => [ - Facter.value(:operatingsystem) == 'Ubuntu', - (Facter.value(:osfamily) == 'RedHat' and Facter.value(:operatingsystemrelease) =~ /^6\./), - (Facter.value(:operatingsystem) == 'Amazon' and Facter.value(:operatingsystemmajrelease) =~ /\d{4}/), - Facter.value(:operatingsystem) == 'LinuxMint', + Facter.value('os.name') == 'Ubuntu', + (Facter.value('os.family') == 'RedHat' and Facter.value('os.release.full') =~ /^6\./), + (Facter.value('os.name') == 'Amazon' and Facter.value('os.release.major') =~ /\d{4}/), + Facter.value('os.name') == 'LinuxMint', ] - defaultfor :operatingsystem => :ubuntu, :operatingsystemmajrelease => ["10.04", "12.04", "14.04", "14.10"] - defaultfor :operatingsystem => :LinuxMint, :operatingsystemmajrelease => ["10", "11", "12", "13", "14", "15", "16", "17"] + defaultfor 'os.name' => :ubuntu, 'os.release.major' => ["10.04", "12.04", "14.04", "14.10"] + defaultfor 'os.name' => :LinuxMint, 'os.release.major' => ["10", "11", "12", "13", "14", "15", "16", "17"] commands :start => "/sbin/start", :stop => "/sbin/stop", @@ -57,7 +57,7 @@ def self.instances def self.excludes excludes = super - if Facter.value(:osfamily) == 'RedHat' + if Facter.value('os.family') == 'RedHat' # Puppet cannot deal with services that have instances, so we have to # ignore these services using instances on redhat based systems. excludes += %w[serial tty] diff --git a/lib/puppet/provider/service/windows.rb b/lib/puppet/provider/service/windows.rb index 678fd84176b..0dee9ab7889 100644 --- a/lib/puppet/provider/service/windows.rb +++ b/lib/puppet/provider/service/windows.rb @@ -11,8 +11,8 @@ services as a specific user. EOT - defaultfor :operatingsystem => :windows - confine :operatingsystem => :windows + defaultfor 'os.name' => :windows + confine 'os.name' => :windows has_feature :refreshable, :configurable_timeout, :manages_logon_credentials diff --git a/lib/puppet/provider/user/aix.rb b/lib/puppet/provider/user/aix.rb index de2fe9a6869..41c5195b7d9 100644 --- a/lib/puppet/provider/user/aix.rb +++ b/lib/puppet/provider/user/aix.rb @@ -17,8 +17,8 @@ Puppet::Type.type(:user).provide :aix, :parent => Puppet::Provider::AixObject do desc "User management for AIX." - defaultfor :operatingsystem => :aix - confine :operatingsystem => :aix + defaultfor 'os.name' => :aix + confine 'os.name' => :aix # Commands that manage the element commands :list => "/usr/sbin/lsuser" diff --git a/lib/puppet/provider/user/directoryservice.rb b/lib/puppet/provider/user/directoryservice.rb index 65bde4fea37..0ee48e31ae1 100644 --- a/lib/puppet/provider/user/directoryservice.rb +++ b/lib/puppet/provider/user/directoryservice.rb @@ -16,9 +16,9 @@ commands :dscacheutil => '/usr/bin/dscacheutil' # Provider confines and defaults - confine :operatingsystem => :darwin - confine :feature => :cfpropertylist - defaultfor :operatingsystem => :darwin + confine 'os.name' => :darwin + confine :feature => :cfpropertylist + defaultfor 'os.name' => :darwin # Need this to create getter/setter methods automagically # This command creates methods that return @property_hash[:value] @@ -159,7 +159,7 @@ def self.generate_attribute_hash(input_hash) end def self.get_os_version - @os_version ||= Facter.value(:macosx_productversion_major) + @os_version ||= Facter.value('os.macosx.version.major') end # Use dscl to retrieve an array of hashes containing attributes about all diff --git a/lib/puppet/provider/user/hpux.rb b/lib/puppet/provider/user/hpux.rb index 0f1ef29ce8c..13503d0c357 100644 --- a/lib/puppet/provider/user/hpux.rb +++ b/lib/puppet/provider/user/hpux.rb @@ -5,8 +5,8 @@ New functionality provides for changing trusted computing passwords and resetting password expirations under trusted computing." - defaultfor :operatingsystem => "hp-ux" - confine :operatingsystem => "hp-ux" + defaultfor 'os.name' => "hp-ux" + confine 'os.name' => "hp-ux" commands :modify => "/usr/sam/lbin/usermod.sam", :delete => "/usr/sam/lbin/userdel.sam", :add => "/usr/sam/lbin/useradd.sam" options :comment, :method => :gecos diff --git a/lib/puppet/provider/user/openbsd.rb b/lib/puppet/provider/user/openbsd.rb index 1b550226e1a..8205c523824 100644 --- a/lib/puppet/provider/user/openbsd.rb +++ b/lib/puppet/provider/user/openbsd.rb @@ -10,8 +10,8 @@ :modify => "usermod", :password => "passwd" - defaultfor :operatingsystem => :openbsd - confine :operatingsystem => :openbsd + defaultfor 'os.name' => :openbsd + confine 'os.name' => :openbsd options :home, :flag => "-d", :method => :dir options :comment, :method => :gecos diff --git a/lib/puppet/provider/user/pw.rb b/lib/puppet/provider/user/pw.rb index a1706af14f6..8db511ffcc7 100644 --- a/lib/puppet/provider/user/pw.rb +++ b/lib/puppet/provider/user/pw.rb @@ -7,8 +7,8 @@ commands :pw => "pw" has_features :manages_homedir, :allows_duplicates, :manages_passwords, :manages_expiry, :manages_shell - defaultfor :operatingsystem => [:freebsd, :dragonfly] - confine :operatingsystem => [:freebsd, :dragonfly] + defaultfor 'os.name' => [:freebsd, :dragonfly] + confine 'os.name' => [:freebsd, :dragonfly] options :home, :flag => "-d", :method => :dir options :comment, :method => :gecos diff --git a/lib/puppet/provider/user/user_role_add.rb b/lib/puppet/provider/user/user_role_add.rb index 304a512daa7..bc19c131a82 100644 --- a/lib/puppet/provider/user/user_role_add.rb +++ b/lib/puppet/provider/user/user_role_add.rb @@ -6,7 +6,7 @@ desc "User and role management on Solaris, via `useradd` and `roleadd`." - defaultfor :osfamily => :solaris + defaultfor 'os.family' => :solaris commands :add => "useradd", :delete => "userdel", :modify => "usermod", :password => "passwd", :role_add => "roleadd", :role_delete => "roledel", :role_modify => "rolemod" options :home, :flag => "-d", :method => :dir diff --git a/lib/puppet/provider/user/useradd.rb b/lib/puppet/provider/user/useradd.rb index e7e7f9e4005..e9b92cd5685 100644 --- a/lib/puppet/provider/user/useradd.rb +++ b/lib/puppet/provider/user/useradd.rb @@ -21,13 +21,13 @@ options :expiry, :method => :sp_expire, :munge => proc { |value| if value == :absent - if Facter.value(:operatingsystem)=='SLES' && Facter.value(:operatingsystemmajrelease) == "11" + if Facter.value('os.name') == 'SLES' && Facter.value('os.release.major') == "11" -1 else '' end else - case Facter.value(:operatingsystem) + case Facter.value('os.name') when 'Solaris' # Solaris uses %m/%d/%Y for useradd/usermod expiry_year, expiry_month, expiry_day = value.split('-') @@ -161,7 +161,7 @@ def groups=(value) end has_features :manages_homedir, :allows_duplicates, :manages_expiry - has_features :system_users unless %w{HP-UX Solaris}.include? Facter.value(:operatingsystem) + has_features :system_users unless %w{HP-UX Solaris}.include? Facter.value('os.name') has_features :manages_passwords, :manages_password_age if Puppet.features.libshadow? has_features :manages_shell @@ -196,8 +196,8 @@ def check_manage_home # libuser does not implement the -m flag cmd << "-m" unless @resource.forcelocal? else - osfamily = Facter.value(:osfamily) - osversion = Facter.value(:operatingsystemmajrelease).to_i + osfamily = Facter.value('os.family') + osversion = Facter.value('os.release.major').to_i # SLES 11 uses pwdutils instead of shadow, which does not have -M # Solaris and OpenBSD use different useradd flavors unless osfamily =~ /Solaris|OpenBSD/ || osfamily == 'Suse' && osversion <= 11 @@ -293,7 +293,7 @@ def deletecmd cmd = [command(:delete)] end # Solaris `userdel -r` will fail if the homedir does not exist. - if @resource.managehome? && (('Solaris' != Facter.value(:operatingsystem)) || Dir.exist?(Dir.home(@resource[:name]))) + if @resource.managehome? && (('Solaris' != Facter.value('os.name')) || Dir.exist?(Dir.home(@resource[:name]))) cmd << '-r' end cmd << @resource[:name] diff --git a/lib/puppet/provider/user/windows_adsi.rb b/lib/puppet/provider/user/windows_adsi.rb index 00510940664..57092c15628 100644 --- a/lib/puppet/provider/user/windows_adsi.rb +++ b/lib/puppet/provider/user/windows_adsi.rb @@ -3,8 +3,8 @@ Puppet::Type.type(:user).provide :windows_adsi do desc "Local user management for Windows." - defaultfor :operatingsystem => :windows - confine :operatingsystem => :windows + defaultfor 'os.name' => :windows + confine 'os.name' => :windows has_features :manages_homedir, :manages_passwords, :manages_roles diff --git a/lib/puppet/type.rb b/lib/puppet/type.rb index 4e8253ab1dd..277160d70bc 100644 --- a/lib/puppet/type.rb +++ b/lib/puppet/type.rb @@ -1405,7 +1405,7 @@ def properties_to_audit(list) provide a symbolic title and an explicit namevar value: file { 'sshdconfig': - path => $operatingsystem ? { + path => $os['name'] ? { solaris => '/usr/local/etc/ssh/sshd_config', default => '/etc/ssh/sshd_config', }, diff --git a/lib/puppet/type/file/source.rb b/lib/puppet/type/file/source.rb index 8e54bfa5410..8fb7bad6934 100644 --- a/lib/puppet/type/file/source.rb +++ b/lib/puppet/type/file/source.rb @@ -72,7 +72,7 @@ module Puppet file { '/etc/nfs.conf': source => [ "puppet:///modules/nfs/conf.${host}", - "puppet:///modules/nfs/conf.${operatingsystem}", + "puppet:///modules/nfs/conf.${os['name']}", 'puppet:///modules/nfs/conf' ] } diff --git a/lib/puppet/type/package.rb b/lib/puppet/type/package.rb index abddd42a9a4..1929f0863f2 100644 --- a/lib/puppet/type/package.rb +++ b/lib/puppet/type/package.rb @@ -242,7 +242,7 @@ def change_to_s(currentvalue, newvalue) conditionally: # In the 'openssl' class - $ssl = $operatingsystem ? { + $ssl = $os['name'] ? { solaris => SMCossl, default => openssl } @@ -254,7 +254,7 @@ def change_to_s(currentvalue, newvalue) ... - $ssh = $operatingsystem ? { + $ssh = $os['name'] ? { solaris => SMCossh, default => openssh } diff --git a/lib/puppet/type/resources.rb b/lib/puppet/type/resources.rb index 51c102c5f43..2909de6adc0 100644 --- a/lib/puppet/type/resources.rb +++ b/lib/puppet/type/resources.rb @@ -175,7 +175,7 @@ def self.system_users_max_uid end # Otherwise, use a sensible default based on the OS family - @system_users_max_uid ||= case Facter.value(:osfamily) + @system_users_max_uid ||= case Facter.value('os.family') when 'OpenBSD', 'FreeBSD' 999 else diff --git a/lib/puppet/util/filetype.rb b/lib/puppet/util/filetype.rb index 41d5a964765..4c11598cf6f 100644 --- a/lib/puppet/util/filetype.rb +++ b/lib/puppet/util/filetype.rb @@ -215,7 +215,7 @@ def read # Remove a specific @path's cron tab. def remove cmd = "#{cmdbase} -r" - if %w{Darwin FreeBSD DragonFly}.include?(Facter.value("operatingsystem")) + if %w{Darwin FreeBSD DragonFly}.include?(Facter.value('os.name')) cmd = "/bin/echo yes | #{cmd}" end @@ -244,7 +244,7 @@ def write(text) # Only add the -u flag when the @path is different. Fedora apparently # does not think I should be allowed to set the @path to my own user name def cmdbase - if @uid == Puppet::Util::SUIDManager.uid || Facter.value(:operatingsystem) == "HP-UX" + if @uid == Puppet::Util::SUIDManager.uid || Facter.value('os.name') == "HP-UX" return "crontab" else return "crontab -u #{@path}" diff --git a/lib/puppet/util/suidmanager.rb b/lib/puppet/util/suidmanager.rb index 6c3cd818baf..c009750836e 100644 --- a/lib/puppet/util/suidmanager.rb +++ b/lib/puppet/util/suidmanager.rb @@ -18,7 +18,7 @@ module Puppet::Util::SUIDManager def osx_maj_ver return @osx_maj_ver unless @osx_maj_ver.nil? - @osx_maj_ver = Facter.value('macosx_productversion_major') || false + @osx_maj_ver = Facter.value('os.macosx.version.major') || false end module_function :osx_maj_ver diff --git a/spec/fixtures/releases/jamtur01-apache/lib/puppet/provider/a2mod/debian.rb b/spec/fixtures/releases/jamtur01-apache/lib/puppet/provider/a2mod/debian.rb index 9d8c12983f4..a4c5400146f 100644 --- a/spec/fixtures/releases/jamtur01-apache/lib/puppet/provider/a2mod/debian.rb +++ b/spec/fixtures/releases/jamtur01-apache/lib/puppet/provider/a2mod/debian.rb @@ -4,7 +4,7 @@ commands :encmd => "a2enmod" commands :discmd => "a2dismod" - defaultfor :operatingsystem => [:debian, :ubuntu] + defaultfor 'os.name' => [:debian, :ubuntu] def create encmd resource[:name] diff --git a/spec/fixtures/releases/jamtur01-apache/manifests/init.pp b/spec/fixtures/releases/jamtur01-apache/manifests/init.pp index bd3f7bae145..1725650f8c1 100644 --- a/spec/fixtures/releases/jamtur01-apache/manifests/init.pp +++ b/spec/fixtures/releases/jamtur01-apache/manifests/init.pp @@ -21,7 +21,7 @@ 'headers' : ensure => present; 'expires' : ensure => present; } - $vdir = $operatingsystem? { + $vdir = $os['name'] ? { 'ubuntu' => '/etc/apache2/sites-enabled/', default => '/etc/httpd/conf.d', } diff --git a/spec/fixtures/releases/jamtur01-apache/manifests/params.pp b/spec/fixtures/releases/jamtur01-apache/manifests/params.pp index 520eccb448d..9ec205a10bb 100644 --- a/spec/fixtures/releases/jamtur01-apache/manifests/params.pp +++ b/spec/fixtures/releases/jamtur01-apache/manifests/params.pp @@ -2,7 +2,7 @@ $user = 'www-data' $group = 'www-data' - case $operatingsystem { + case $os['name'] { "centos": { $apache_name = httpd $ssl_package = mod_ssl diff --git a/spec/fixtures/releases/jamtur01-apache/manifests/ssl.pp b/spec/fixtures/releases/jamtur01-apache/manifests/ssl.pp index 349f92288a7..a94b7fab548 100644 --- a/spec/fixtures/releases/jamtur01-apache/manifests/ssl.pp +++ b/spec/fixtures/releases/jamtur01-apache/manifests/ssl.pp @@ -2,7 +2,7 @@ include apache - case $operatingsystem { + case $facts['os']['name'] { "centos": { package { $apache::params::ssl_package: require => Package['httpd'], diff --git a/spec/fixtures/releases/jamtur01-apache/manifests/vhost.pp b/spec/fixtures/releases/jamtur01-apache/manifests/vhost.pp index a210f35570f..1a71aad5265 100644 --- a/spec/fixtures/releases/jamtur01-apache/manifests/vhost.pp +++ b/spec/fixtures/releases/jamtur01-apache/manifests/vhost.pp @@ -1,6 +1,6 @@ define apache::vhost( $port, $docroot, $ssl=true, $template='apache/vhost-default.conf.erb', $priority, $serveraliases = '' ) { include apache - $vdir = $operatingsystem? { + $vdir = $os['name']? { 'ubuntu' => '/etc/apache2/sites-enabled/', default => '/etc/httpd/conf.d', } diff --git a/spec/integration/type/file_spec.rb b/spec/integration/type/file_spec.rb index 34f3b1e91a1..07a4ff5bafb 100644 --- a/spec/integration/type/file_spec.rb +++ b/spec/integration/type/file_spec.rb @@ -1710,11 +1710,11 @@ def grant_everyone_full_access(path) describe "when using validate_cmd" do test_cmd = '/bin/test' - if Facter.value(:osfamily) == 'Debian' + if Facter.value('os.family') == 'Debian' test_cmd = '/usr/bin/test' end - if Facter.value(:operatingsystem) == 'Darwin' + if Facter.value('os.name') == 'Darwin' stat_cmd = "stat -f '%Lp'" else stat_cmd = "stat --format=%a" diff --git a/spec/integration/type/package_spec.rb b/spec/integration/type/package_spec.rb index a61bcb86ff0..969d5b8f0f9 100644 --- a/spec/integration/type/package_spec.rb +++ b/spec/integration/type/package_spec.rb @@ -21,19 +21,19 @@ def provider_name(os) when 'Darwin' :pkgdmg when 'RedHat' - if ['2.1', '3', '4'].include?(Facter.value(:lsbdistrelease)) + if ['2.1', '3', '4'].include?(Facter.value('os.distro.release.full')) :up2date else :yum end when 'Fedora' - if Puppet::Util::Package.versioncmp(Facter.value(:operatingsystemmajrelease), '22') >= 0 + if Puppet::Util::Package.versioncmp(Facter.value('os.release.major'), '22') >= 0 :dnf else :yum end when 'Suse' - if Puppet::Util::Package.versioncmp(Facter.value(:operatingsystemmajrelease), '10') >= 0 + if Puppet::Util::Package.versioncmp(Facter.value('os.release.major'), '10') >= 0 :zypper else :rug @@ -54,8 +54,8 @@ def provider_name(os) end it "should choose the correct provider each platform" do - unless default_provider = provider_name(Facter.value(:operatingsystem)) - pending("No default provider specified in this test for #{Facter.value(:operatingsystem)}") + unless default_provider = provider_name(Facter.value('os.name')) + pending("No default provider specified in this test for #{Facter.value('os.name')}") end expect(Puppet::Type.type(:package).defaultprovider.name).to eq(default_provider) end diff --git a/spec/shared_examples/rhel_package_provider.rb b/spec/shared_examples/rhel_package_provider.rb index 06f39e0e2ca..28486b9c729 100644 --- a/spec/shared_examples/rhel_package_provider.rb +++ b/spec/shared_examples/rhel_package_provider.rb @@ -69,7 +69,7 @@ allow(Puppet::Util).to receive(:which).with("rpm").and_return("/bin/rpm") allow(provider).to receive(:which).with("rpm").and_return("/bin/rpm") expect(Puppet::Util::Execution).to receive(:execute).with(["/bin/rpm", "--version"], {:combine => true, :custom_environment => {}, :failonfail => true}).and_return(Puppet::Util::Execution::ProcessOutput.new("4.10.1\n", 0)).at_most(:once) - allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return('6') + allow(Facter).to receive(:value).with('os.release.major').and_return('6') end it "should call #{provider_name} install for :installed" do @@ -81,7 +81,7 @@ if provider_name == 'yum' context 'on el-5' do before(:each) do - allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return('5') + allow(Facter).to receive(:value).with('os.release.major').and_return('5') end it "should catch #{provider_name} install failures when status code is wrong" do diff --git a/spec/unit/application/device_spec.rb b/spec/unit/application/device_spec.rb index e7d339c7193..a26fc470e41 100644 --- a/spec/unit/application/device_spec.rb +++ b/spec/unit/application/device_spec.rb @@ -482,10 +482,10 @@ end it "retrieves facts" do - indirection_fact_values = {"operatingsystem"=>"cisco_ios","clientcert"=>"3750"} + indirection_fact_values = {"os"=> {"name" => "cisco_ios"},"clientcert"=>"3750"} indirection_facts = Puppet::Node::Facts.new("nil", indirection_fact_values) expect(Puppet::Node::Facts.indirection).to receive(:find).with(nil, anything()).and_return(indirection_facts) - expect(device).to receive(:puts).with(/name.*3750.*\n.*values.*\n.*operatingsystem.*cisco_ios/) + expect(device).to receive(:puts).with(/name.*3750.*\n.*values.*\n.*os.*\n.*name.*cisco_ios/) expect { device.main }.to exit_with 0 end end diff --git a/spec/unit/confine_spec.rb b/spec/unit/confine_spec.rb index ddff0fc03bb..1df5bdab000 100644 --- a/spec/unit/confine_spec.rb +++ b/spec/unit/confine_spec.rb @@ -84,16 +84,16 @@ def pass?(value) describe "when requiring" do it "does not cache failed requires when always_retry_plugins is true" do Puppet[:always_retry_plugins] = true - expect(Puppet::Confine).to receive(:require).with('puppet/confine/osfamily').twice.and_raise(LoadError) - Puppet::Confine.test(:osfamily) - Puppet::Confine.test(:osfamily) + expect(Puppet::Confine).to receive(:require).with('puppet/confine/os.family').twice.and_raise(LoadError) + Puppet::Confine.test('os.family') + Puppet::Confine.test('os.family') end it "caches failed requires when always_retry_plugins is false" do Puppet[:always_retry_plugins] = false - expect(Puppet::Confine).to receive(:require).with('puppet/confine/osfamily').once.and_raise(LoadError) - Puppet::Confine.test(:osfamily) - Puppet::Confine.test(:osfamily) + expect(Puppet::Confine).to receive(:require).with('puppet/confine/os.family').once.and_raise(LoadError) + Puppet::Confine.test('os.family') + Puppet::Confine.test('os.family') end end end diff --git a/spec/unit/face/epp_face_spec.rb b/spec/unit/face/epp_face_spec.rb index d7f461df6d6..edaeb07d252 100644 --- a/spec/unit/face/epp_face_spec.rb +++ b/spec/unit/face/epp_face_spec.rb @@ -311,8 +311,8 @@ it "facts can be overridden" do expect(eppface.render({ - :facts => {'operatingsystem' => 'Merwin'}, - :e => '<%= $facts[operatingsystem] %>', + :facts => {'os' => {'name' => 'Merwin'} }, + :e => '<%= $facts[os][name] %>', })).to eql("Merwin") end diff --git a/spec/unit/file_bucket/dipper_spec.rb b/spec/unit/file_bucket/dipper_spec.rb index 584d7dc2bd6..f14d2a5961d 100644 --- a/spec/unit/file_bucket/dipper_spec.rb +++ b/spec/unit/file_bucket/dipper_spec.rb @@ -104,8 +104,8 @@ def make_tmp_file(contents) # Diff without the context # Lines we need to see match 'Content' instead of trimming diff output filter out # surrounding noise...or hard code the check values - if Facter.value(:osfamily) == 'Solaris' && - Puppet::Util::Package.versioncmp(Facter.value(:operatingsystemrelease), '11.0') >= 0 + if Facter.value('os.family') == 'Solaris' && + Puppet::Util::Package.versioncmp(Facter.value('os.release.full'), '11.0') >= 0 # Use gdiff on Solaris diff12 = Puppet::Util::Execution.execute("gdiff -uN #{file1} #{file2}| grep Content") diff21 = Puppet::Util::Execution.execute("gdiff -uN #{file2} #{file1}| grep Content") diff --git a/spec/unit/module_tool/tar_spec.rb b/spec/unit/module_tool/tar_spec.rb index 94fd04927d6..710950a8261 100644 --- a/spec/unit/module_tool/tar_spec.rb +++ b/spec/unit/module_tool/tar_spec.rb @@ -7,7 +7,7 @@ { :name => 'Windows', :win => true } ].each do |os| it "always prefers minitar if it and zlib are present, even with tar available" do - allow(Facter).to receive(:value).with('osfamily').and_return(os[:name]) + allow(Facter).to receive(:value).with('os.family').and_return(os[:name]) allow(Puppet::Util).to receive(:which).with('tar').and_return('/usr/bin/tar') allow(Puppet::Util::Platform).to receive(:windows?).and_return(os[:win]) allow(Puppet).to receive(:features).and_return(double(:minitar? => true, :zlib? => true)) @@ -17,7 +17,7 @@ end it "falls back to tar when minitar not present and not on Windows" do - allow(Facter).to receive(:value).with('osfamily').and_return('ObscureLinuxDistro') + allow(Facter).to receive(:value).with('os.family').and_return('ObscureLinuxDistro') allow(Puppet::Util).to receive(:which).with('tar').and_return('/usr/bin/tar') allow(Puppet::Util::Platform).to receive(:windows?).and_return(false) allow(Puppet).to receive(:features).and_return(double(:minitar? => false)) @@ -26,7 +26,7 @@ end it "fails when there is no possible implementation" do - allow(Facter).to receive(:value).with('osfamily').and_return('Windows') + allow(Facter).to receive(:value).with('os.family').and_return('Windows') allow(Puppet::Util).to receive(:which).with('tar') allow(Puppet::Util::Platform).to receive(:windows?).and_return(true) allow(Puppet).to receive(:features).and_return(double(:minitar? => false, :zlib? => false)) diff --git a/spec/unit/pops/serialization/serialization_spec.rb b/spec/unit/pops/serialization/serialization_spec.rb index 2d54886b826..ddf146b772c 100644 --- a/spec/unit/pops/serialization/serialization_spec.rb +++ b/spec/unit/pops/serialization/serialization_spec.rb @@ -298,7 +298,7 @@ def parse(string) it 'nested Expression' do expr = parse(<<-CODE) - $rootgroup = $osfamily ? { + $rootgroup = $os['family'] ? { 'Solaris' => 'wheel', /(Darwin|FreeBSD)/ => 'wheel', default => 'root', @@ -435,7 +435,7 @@ def _pcore_init_hash it 'can write and read an AST expression' do expr = parse(<<-CODE) - $rootgroup = $osfamily ? { + $rootgroup = $os['family'] ? { 'Solaris' => 'wheel', /(Darwin|FreeBSD)/ => 'wheel', default => 'root', diff --git a/spec/unit/pops/serialization/to_from_hr_spec.rb b/spec/unit/pops/serialization/to_from_hr_spec.rb index 1f803d39944..5ef2777083c 100644 --- a/spec/unit/pops/serialization/to_from_hr_spec.rb +++ b/spec/unit/pops/serialization/to_from_hr_spec.rb @@ -344,7 +344,7 @@ def parse(string) it 'nested Expression' do expr = parse(<<-CODE) - $rootgroup = $osfamily ? { + $rootgroup = $os['family'] ? { 'Solaris' => 'wheel', /(Darwin|FreeBSD)/ => 'wheel', default => 'root', diff --git a/spec/unit/provider/package/apt_spec.rb b/spec/unit/provider/package/apt_spec.rb index bb9e179895c..e731d9b5643 100644 --- a/spec/unit/provider/package/apt_spec.rb +++ b/spec/unit/provider/package/apt_spec.rb @@ -14,8 +14,8 @@ resource.provider end - it "should be the default provider on :osfamily => Debian" do - expect(Facter).to receive(:value).with(:osfamily).and_return("Debian") + it "should be the default provider on 'os.family' => Debian" do + expect(Facter).to receive(:value).with('os.family').and_return("Debian") expect(described_class.default?).to be_truthy end diff --git a/spec/unit/provider/package/dnf_spec.rb b/spec/unit/provider/package/dnf_spec.rb index 9a4e9b8b3c9..a95a6012303 100644 --- a/spec/unit/provider/package/dnf_spec.rb +++ b/spec/unit/provider/package/dnf_spec.rb @@ -6,40 +6,40 @@ context 'default' do (19..21).each do |ver| it "should not be the default provider on fedora#{ver}" do - allow(Facter).to receive(:value).with(:osfamily).and_return(:redhat) - allow(Facter).to receive(:value).with(:operatingsystem).and_return(:fedora) - allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("#{ver}") + allow(Facter).to receive(:value).with('os.family').and_return(:redhat) + allow(Facter).to receive(:value).with('os.name').and_return(:fedora) + allow(Facter).to receive(:value).with('os.release.major').and_return("#{ver}") expect(described_class).to_not be_default end end (22..26).each do |ver| it "should be the default provider on fedora#{ver}" do - allow(Facter).to receive(:value).with(:osfamily).and_return(:redhat) - allow(Facter).to receive(:value).with(:operatingsystem).and_return(:fedora) - allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("#{ver}") + allow(Facter).to receive(:value).with('os.family').and_return(:redhat) + allow(Facter).to receive(:value).with('os.name').and_return(:fedora) + allow(Facter).to receive(:value).with('os.release.major').and_return("#{ver}") expect(described_class).to be_default end end it "should not be the default provider on rhel7" do - allow(Facter).to receive(:value).with(:osfamily).and_return(:redhat) - allow(Facter).to receive(:value).with(:operatingsystem).and_return(:redhat) - allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("7") + allow(Facter).to receive(:value).with('os.family').and_return(:redhat) + allow(Facter).to receive(:value).with('os.name').and_return(:redhat) + allow(Facter).to receive(:value).with('os.release.major').and_return("7") expect(described_class).to_not be_default end it "should be the default provider on some random future fedora" do - allow(Facter).to receive(:value).with(:osfamily).and_return(:redhat) - allow(Facter).to receive(:value).with(:operatingsystem).and_return(:fedora) - allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("8675") + allow(Facter).to receive(:value).with('os.family').and_return(:redhat) + allow(Facter).to receive(:value).with('os.name').and_return(:fedora) + allow(Facter).to receive(:value).with('os.release.major').and_return("8675") expect(described_class).to be_default end it "should be the default provider on rhel8" do - allow(Facter).to receive(:value).with(:osfamily).and_return(:redhat) - allow(Facter).to receive(:value).with(:operatingsystem).and_return(:redhat) - allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("8") + allow(Facter).to receive(:value).with('os.family').and_return(:redhat) + allow(Facter).to receive(:value).with('os.name').and_return(:redhat) + allow(Facter).to receive(:value).with('os.release.major').and_return("8") expect(described_class).to be_default end end diff --git a/spec/unit/provider/package/dnfmodule_spec.rb b/spec/unit/provider/package/dnfmodule_spec.rb index c7386658748..3bfa20893ad 100644 --- a/spec/unit/provider/package/dnfmodule_spec.rb +++ b/spec/unit/provider/package/dnfmodule_spec.rb @@ -24,18 +24,18 @@ before(:each) { allow(Puppet::Util).to receive(:which).with('/usr/bin/dnf').and_return(dnf_path) } it "should have lower specificity" do - allow(Facter).to receive(:value).with(:osfamily).and_return(:redhat) - allow(Facter).to receive(:value).with(:operatingsystem).and_return(:redhat) - allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return('8') + allow(Facter).to receive(:value).with('os.family').and_return(:redhat) + allow(Facter).to receive(:value).with('os.name').and_return(:redhat) + allow(Facter).to receive(:value).with('os.release.major').and_return('8') expect(described_class.specificity).to be < 200 end describe "should be an opt-in provider" do Array(4..8).each do |ver| it "should not be default for redhat #{ver}" do - allow(Facter).to receive(:value).with(:operatingsystem).and_return('redhat') - allow(Facter).to receive(:value).with(:osfamily).and_return('redhat') - allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return(ver.to_s) + allow(Facter).to receive(:value).with('os.name').and_return('redhat') + allow(Facter).to receive(:value).with('os.family').and_return('redhat') + allow(Facter).to receive(:value).with('os.release.major').and_return(ver.to_s) expect(described_class).not_to be_default end end diff --git a/spec/unit/provider/package/gem_spec.rb b/spec/unit/provider/package/gem_spec.rb index ca814cd97d5..bba0456349d 100644 --- a/spec/unit/provider/package/gem_spec.rb +++ b/spec/unit/provider/package/gem_spec.rb @@ -474,9 +474,9 @@ end context 'when is defaultfor' do - let(:os) { Facter.value(:operatingsystem) } + let(:os) { Facter.value('os.name') } subject do - described_class.defaultfor(operatingsystem: os) + described_class.defaultfor('os.name': os) described_class.specificity end it { is_expected.to be > 100 } diff --git a/spec/unit/provider/package/pip2_spec.rb b/spec/unit/provider/package/pip2_spec.rb index 161bdd0b5ae..09e7d197f0d 100644 --- a/spec/unit/provider/package/pip2_spec.rb +++ b/spec/unit/provider/package/pip2_spec.rb @@ -24,9 +24,9 @@ end context 'when is defaultfor' do - let(:os) { Facter.value(:operatingsystem) } + let(:os) { Facter.value('os.name') } subject do - described_class.defaultfor(operatingsystem: os) + described_class.defaultfor('os.name': os) described_class.specificity end it { is_expected.to be > 100 } diff --git a/spec/unit/provider/package/pip3_spec.rb b/spec/unit/provider/package/pip3_spec.rb index 5d6ecf0ec34..ed64234c3b6 100644 --- a/spec/unit/provider/package/pip3_spec.rb +++ b/spec/unit/provider/package/pip3_spec.rb @@ -24,9 +24,9 @@ end context 'when is defaultfor' do - let(:os) { Facter.value(:operatingsystem) } + let(:os) { Facter.value('os.name') } subject do - described_class.defaultfor(operatingsystem: os) + described_class.defaultfor('os.name': os) described_class.specificity end it { is_expected.to be > 100 } diff --git a/spec/unit/provider/package/pip_spec.rb b/spec/unit/provider/package/pip_spec.rb index e0072ae1361..86e90d2e948 100644 --- a/spec/unit/provider/package/pip_spec.rb +++ b/spec/unit/provider/package/pip_spec.rb @@ -454,9 +454,9 @@ end context 'when is defaultfor' do - let(:os) { Facter.value(:operatingsystem) } + let(:os) { Facter.value('os.name') } subject do - described_class.defaultfor(operatingsystem: os) + described_class.defaultfor('os.name': os) described_class.specificity end it { is_expected.to be > 100 } diff --git a/spec/unit/provider/package/pkg_spec.rb b/spec/unit/provider/package/pkg_spec.rb index 3aa6bf26c6e..a9dd0e16497 100644 --- a/spec/unit/provider/package/pkg_spec.rb +++ b/spec/unit/provider/package/pkg_spec.rb @@ -31,20 +31,20 @@ def self.it_should_respond_to(*actions) context 'default' do [ 10 ].each do |ver| it "should not be the default provider on Solaris #{ver}" do - allow(Facter).to receive(:value).with(:osfamily).and_return(:Solaris) + allow(Facter).to receive(:value).with('os.family').and_return(:Solaris) allow(Facter).to receive(:value).with(:kernelrelease).and_return("5.#{ver}") - allow(Facter).to receive(:value).with(:operatingsystem).and_return(:Solaris) - allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("#{ver}") + allow(Facter).to receive(:value).with('os.name').and_return(:Solaris) + allow(Facter).to receive(:value).with('os.release.major').and_return("#{ver}") expect(described_class).to_not be_default end end [ 11, 12 ].each do |ver| it "should be the default provider on Solaris #{ver}" do - allow(Facter).to receive(:value).with(:osfamily).and_return(:Solaris) + allow(Facter).to receive(:value).with('os.family').and_return(:Solaris) allow(Facter).to receive(:value).with(:kernelrelease).and_return("5.#{ver}") - allow(Facter).to receive(:value).with(:operatingsystem).and_return(:Solaris) - allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("#{ver}") + allow(Facter).to receive(:value).with('os.name').and_return(:Solaris) + allow(Facter).to receive(:value).with('os.release.major').and_return("#{ver}") expect(described_class).to be_default end end @@ -254,9 +254,9 @@ def self.it_should_respond_to(*actions) { :osrel => '11.0', :flags => ['--accept'] }, { :osrel => '11.2', :flags => ['--accept', '--sync-actuators-timeout', '900'] }, ].each do |hash| - context "with :operatingsystemrelease #{hash[:osrel]}" do + context "with 'os.release.full' #{hash[:osrel]}" do before :each do - allow(Facter).to receive(:value).with(:operatingsystemrelease).and_return(hash[:osrel]) + allow(Facter).to receive(:value).with('os.release.full').and_return(hash[:osrel]) end it "should support install options" do diff --git a/spec/unit/provider/package/pkgng_spec.rb b/spec/unit/provider/package/pkgng_spec.rb index bacfafe688c..9d9b5d2973e 100644 --- a/spec/unit/provider/package/pkgng_spec.rb +++ b/spec/unit/provider/package/pkgng_spec.rb @@ -220,7 +220,7 @@ def run_in_catalog(*resources) describe "confine" do context "on FreeBSD" do it "should be the default provider" do - expect(Facter).to receive(:value).with(:operatingsystem).at_least(:once).and_return(:freebsd) + expect(Facter).to receive(:value).with('os.name').at_least(:once).and_return(:freebsd) expect(described_class).to be_default end end diff --git a/spec/unit/provider/package/portage_spec.rb b/spec/unit/provider/package/portage_spec.rb index 114546f8a4f..a8c309f93d3 100644 --- a/spec/unit/provider/package/portage_spec.rb +++ b/spec/unit/provider/package/portage_spec.rb @@ -72,8 +72,8 @@ expect(described_class).to be_reinstallable end - it "should be the default provider on :osfamily => Gentoo" do - expect(Facter).to receive(:value).with(:osfamily).and_return("Gentoo") + it "should be the default provider on 'os.family' => Gentoo" do + expect(Facter).to receive(:value).with('os.family').and_return("Gentoo") expect(described_class.default?).to be_truthy end diff --git a/spec/unit/provider/package/puppet_gem_spec.rb b/spec/unit/provider/package/puppet_gem_spec.rb index e9c97c62158..b7ee578c7cf 100644 --- a/spec/unit/provider/package/puppet_gem_spec.rb +++ b/spec/unit/provider/package/puppet_gem_spec.rb @@ -88,9 +88,9 @@ end context 'when is defaultfor' do - let(:os) { Facter.value(:operatingsystem) } + let(:os) { Facter.value('os.name') } subject do - described_class.defaultfor(operatingsystem: os) + described_class.defaultfor('os.name': os) described_class.specificity end it { is_expected.to be > 100 } diff --git a/spec/unit/provider/package/puppetserver_gem_spec.rb b/spec/unit/provider/package/puppetserver_gem_spec.rb index e3cca15dadd..545fe0545e8 100644 --- a/spec/unit/provider/package/puppetserver_gem_spec.rb +++ b/spec/unit/provider/package/puppetserver_gem_spec.rb @@ -125,9 +125,9 @@ end context 'when is defaultfor' do - let(:os) { Facter.value(:operatingsystem) } + let(:os) { Facter.value('os.name') } subject do - described_class.defaultfor(operatingsystem: os) + described_class.defaultfor('os.name': os) described_class.specificity end it { is_expected.to be > 100 } diff --git a/spec/unit/provider/package/tdnf_spec.rb b/spec/unit/provider/package/tdnf_spec.rb index 7f715b163d2..36e08a8425c 100644 --- a/spec/unit/provider/package/tdnf_spec.rb +++ b/spec/unit/provider/package/tdnf_spec.rb @@ -7,8 +7,8 @@ context 'default' do it 'should be the default provider on PhotonOS' do - allow(Facter).to receive(:value).with(:osfamily).and_return(:redhat) - allow(Facter).to receive(:value).with(:operatingsystem).and_return("PhotonOS") + allow(Facter).to receive(:value).with('os.family').and_return(:redhat) + allow(Facter).to receive(:value).with('os.name').and_return("PhotonOS") expect(described_class).to be_default end end diff --git a/spec/unit/provider/package/up2date_spec.rb b/spec/unit/provider/package/up2date_spec.rb index 72bce2f5d28..a23ba9d4b50 100644 --- a/spec/unit/provider/package/up2date_spec.rb +++ b/spec/unit/provider/package/up2date_spec.rb @@ -13,8 +13,8 @@ osfamilies.each do |osfamily| releases.each do |release| it "should be the default provider on #{osfamily} #{release}" do - allow(Facter).to receive(:value).with(:osfamily).and_return(osfamily) - allow(Facter).to receive(:value).with(:lsbdistrelease).and_return(release) + allow(Facter).to receive(:value).with('os.family').and_return(osfamily) + allow(Facter).to receive(:value).with('os.distro.release.full').and_return(release) expect(subject.default?).to be_truthy end end diff --git a/spec/unit/provider/package/yum_spec.rb b/spec/unit/provider/package/yum_spec.rb index 923af403e7e..c4a9d386a23 100644 --- a/spec/unit/provider/package/yum_spec.rb +++ b/spec/unit/provider/package/yum_spec.rb @@ -17,42 +17,42 @@ it_behaves_like 'RHEL package provider', described_class, 'yum' it "should have lower specificity" do - allow(Facter).to receive(:value).with(:osfamily).and_return(:redhat) - allow(Facter).to receive(:value).with(:operatingsystem).and_return(:fedora) - allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("22") + allow(Facter).to receive(:value).with('os.family').and_return(:redhat) + allow(Facter).to receive(:value).with('os.name').and_return(:fedora) + allow(Facter).to receive(:value).with('os.release.major').and_return("22") expect(described_class.specificity).to be < 200 end describe "should have logical defaults" do [2, 2018].each do |ver| it "should be the default provider on Amazon Linux #{ver}" do - allow(Facter).to receive(:value).with(:operatingsystem).and_return('amazon') - allow(Facter).to receive(:value).with(:osfamily).and_return('redhat') - allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return(ver) + allow(Facter).to receive(:value).with('os.name').and_return('amazon') + allow(Facter).to receive(:value).with('os.family').and_return('redhat') + allow(Facter).to receive(:value).with('os.release.major').and_return(ver) expect(described_class).to be_default end end Array(4..7).each do |ver| it "should be default for redhat #{ver}" do - allow(Facter).to receive(:value).with(:operatingsystem).and_return('redhat') - allow(Facter).to receive(:value).with(:osfamily).and_return('redhat') - allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return(ver.to_s) + allow(Facter).to receive(:value).with('os.name').and_return('redhat') + allow(Facter).to receive(:value).with('os.family').and_return('redhat') + allow(Facter).to receive(:value).with('os.release.major').and_return(ver.to_s) expect(described_class).to be_default end end it "should not be default for redhat 8" do - allow(Facter).to receive(:value).with(:operatingsystem).and_return('redhat') - allow(Facter).to receive(:value).with(:osfamily).and_return('redhat') - allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return('8') + allow(Facter).to receive(:value).with('os.name').and_return('redhat') + allow(Facter).to receive(:value).with('os.family').and_return('redhat') + allow(Facter).to receive(:value).with('os.release.major').and_return('8') expect(described_class).not_to be_default end it "should not be default for Ubuntu 16.04" do - allow(Facter).to receive(:value).with(:operatingsystem).and_return('ubuntu') - allow(Facter).to receive(:value).with(:osfamily).and_return('ubuntu') - allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return('16.04') + allow(Facter).to receive(:value).with('os.name').and_return('ubuntu') + allow(Facter).to receive(:value).with('os.family').and_return('ubuntu') + allow(Facter).to receive(:value).with('os.release.major').and_return('16.04') expect(described_class).not_to be_default end end @@ -346,7 +346,7 @@ describe 'install' do before do resource[:ensure] = ensure_value - allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return('7') + allow(Facter).to receive(:value).with('os.release.major').and_return('7') allow(described_class).to receive(:command).with(:cmd).and_return('/usr/bin/yum') allow(provider).to receive(:query).twice.and_return(nil, ensure: '18.3.2') allow(provider).to receive(:insync?).with('18.3.2').and_return(true) diff --git a/spec/unit/provider/service/base_spec.rb b/spec/unit/provider/service/base_spec.rb index 0039f492e46..b0118c18e9a 100644 --- a/spec/unit/provider/service/base_spec.rb +++ b/spec/unit/provider/service/base_spec.rb @@ -98,7 +98,7 @@ def execute_command(command, options) end it "retrieves a PID from the process table" do - allow(Facter).to receive(:value).with(:operatingsystem).and_return("CentOS") + allow(Facter).to receive(:value).with('os.name').and_return("CentOS") ps_output = File.binread(my_fixture("ps_ef.mixed_encoding")).force_encoding(Encoding::UTF_8) expect(executor).to receive(:execute).with("ps -ef").and_return(ps_output) diff --git a/spec/unit/provider/service/bsd_spec.rb b/spec/unit/provider/service/bsd_spec.rb index 7f6236e36d8..b6fff65a11d 100644 --- a/spec/unit/provider/service/bsd_spec.rb +++ b/spec/unit/provider/service/bsd_spec.rb @@ -10,8 +10,8 @@ before :each do allow(Puppet::Type.type(:service)).to receive(:defaultprovider).and_return(provider_class) - allow(Facter).to receive(:value).with(:operatingsystem).and_return(:netbsd) - allow(Facter).to receive(:value).with(:osfamily).and_return('NetBSD') + allow(Facter).to receive(:value).with('os.name').and_return(:netbsd) + allow(Facter).to receive(:value).with('os.family').and_return('NetBSD') allow(provider_class).to receive(:defpath).and_return('/etc/rc.conf.d') @provider = provider_class.new allow(@provider).to receive(:initscript) diff --git a/spec/unit/provider/service/debian_spec.rb b/spec/unit/provider/service/debian_spec.rb index 5aa57a3accf..fb272058bf7 100644 --- a/spec/unit/provider/service/debian_spec.rb +++ b/spec/unit/provider/service/debian_spec.rb @@ -34,20 +34,20 @@ ['1','2'].each do |version| it "should be the default provider on CumulusLinux #{version}" do - expect(Facter).to receive(:value).with(:operatingsystem).at_least(:once).and_return('CumulusLinux') - expect(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return(version) + expect(Facter).to receive(:value).with('os.name').at_least(:once).and_return('CumulusLinux') + expect(Facter).to receive(:value).with('os.release.major').and_return(version) expect(provider_class.default?).to be_truthy end end it "should be the default provider on Devuan" do - expect(Facter).to receive(:value).with(:operatingsystem).at_least(:once).and_return('Devuan') + expect(Facter).to receive(:value).with('os.name').at_least(:once).and_return('Devuan') expect(provider_class.default?).to be_truthy end it "should be the default provider on Debian" do - expect(Facter).to receive(:value).with(:operatingsystem).at_least(:once).and_return('Debian') - expect(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return('7') + expect(Facter).to receive(:value).with('os.name').at_least(:once).and_return('Debian') + expect(Facter).to receive(:value).with('os.release.major').and_return('7') expect(provider_class.default?).to be_truthy end @@ -151,8 +151,8 @@ context "when checking service status" do it "should use the service command" do - allow(Facter).to receive(:value).with(:operatingsystem).and_return('Debian') - allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return('8') + allow(Facter).to receive(:value).with('os.name').and_return('Debian') + allow(Facter).to receive(:value).with('os.release.major').and_return('8') allow(@resource).to receive(:[]).with(:hasstatus).and_return(:true) expect(@provider.statuscmd).to eq(["service", @resource[:name], "status"]) end diff --git a/spec/unit/provider/service/freebsd_spec.rb b/spec/unit/provider/service/freebsd_spec.rb index 7ee52e9e81c..e5dbdc3b436 100644 --- a/spec/unit/provider/service/freebsd_spec.rb +++ b/spec/unit/provider/service/freebsd_spec.rb @@ -7,7 +7,7 @@ before :each do @provider = provider_class.new allow(@provider).to receive(:initscript) - allow(Facter).to receive(:value).with(:osfamily).and_return('FreeBSD') + allow(Facter).to receive(:value).with('os.family').and_return('FreeBSD') end it "should correctly parse rcvar for FreeBSD < 7" do diff --git a/spec/unit/provider/service/gentoo_spec.rb b/spec/unit/provider/service/gentoo_spec.rb index 335dc657af4..4c19d9e321e 100644 --- a/spec/unit/provider/service/gentoo_spec.rb +++ b/spec/unit/provider/service/gentoo_spec.rb @@ -12,8 +12,8 @@ allow(Puppet::Type.type(:service)).to receive(:defaultprovider).and_return(provider_class) allow(FileTest).to receive(:file?).with('/sbin/rc-update').and_return(true) allow(FileTest).to receive(:executable?).with('/sbin/rc-update').and_return(true) - allow(Facter).to receive(:value).with(:operatingsystem).and_return('Gentoo') - allow(Facter).to receive(:value).with(:osfamily).and_return('Gentoo') + allow(Facter).to receive(:value).with('os.name').and_return('Gentoo') + allow(Facter).to receive(:value).with('os.family').and_return('Gentoo') # The initprovider (parent of the gentoo provider) does a stat call # before it even tries to execute an initscript. We use sshd in all the diff --git a/spec/unit/provider/service/init_spec.rb b/spec/unit/provider/service/init_spec.rb index b9525fb1261..853ef05f663 100644 --- a/spec/unit/provider/service/init_spec.rb +++ b/spec/unit/provider/service/init_spec.rb @@ -39,8 +39,8 @@ describe "when running on FreeBSD" do before :each do - allow(Facter).to receive(:value).with(:operatingsystem).and_return('FreeBSD') - allow(Facter).to receive(:value).with(:osfamily).and_return('FreeBSD') + allow(Facter).to receive(:value).with('os.name').and_return('FreeBSD') + allow(Facter).to receive(:value).with('os.family').and_return('FreeBSD') end it "should set its default path to include /etc/rc.d and /usr/local/etc/rc.d" do @@ -50,7 +50,7 @@ describe "when running on HP-UX" do before :each do - allow(Facter).to receive(:value).with(:operatingsystem).and_return('HP-UX') + allow(Facter).to receive(:value).with('os.name').and_return('HP-UX') end it "should set its default path to include /sbin/init.d" do @@ -60,7 +60,7 @@ describe "when running on Archlinux" do before :each do - allow(Facter).to receive(:value).with(:operatingsystem).and_return('Archlinux') + allow(Facter).to receive(:value).with('os.name').and_return('Archlinux') end it "should set its default path to include /etc/rc.d" do @@ -70,7 +70,7 @@ describe "when not running on FreeBSD, HP-UX or Archlinux" do before :each do - allow(Facter).to receive(:value).with(:operatingsystem).and_return('RedHat') + allow(Facter).to receive(:value).with('os.name').and_return('RedHat') end it "should set its default path to include /etc/init.d" do @@ -103,7 +103,7 @@ end it "should omit Yocto services on cisco-wrlinux" do - allow(Facter).to receive(:value).with(:osfamily).and_return('cisco-wrlinux') + allow(Facter).to receive(:value).with('os.family').and_return('cisco-wrlinux') exclude = 'umountfs' expect(provider_class.get_services(provider_class.defpath).map(&:name)).to eq(@services - [exclude]) end @@ -282,7 +282,7 @@ describe "when starting a service on Solaris" do it "should use ctrun" do - allow(Facter).to receive(:value).with(:osfamily).and_return('Solaris') + allow(Facter).to receive(:value).with('os.family').and_return('Solaris') expect(provider).to receive(:execute).with('/usr/bin/ctrun -l child /service/path/myservice start', {:failonfail => true, :override_locale => false, :squelch => false, :combine => true}).and_return("") allow($CHILD_STATUS).to receive(:exitstatus).and_return(0) provider.start @@ -291,7 +291,7 @@ describe "when starting a service on RedHat" do it "should not use ctrun" do - allow(Facter).to receive(:value).with(:osfamily).and_return('RedHat') + allow(Facter).to receive(:value).with('os.family').and_return('RedHat') expect(provider).to receive(:execute).with(['/service/path/myservice', :start], {:failonfail => true, :override_locale => false, :squelch => false, :combine => true}).and_return("") allow($CHILD_STATUS).to receive(:exitstatus).and_return(0) provider.start diff --git a/spec/unit/provider/service/openbsd_spec.rb b/spec/unit/provider/service/openbsd_spec.rb index 90f003b5705..396aa3ea267 100644 --- a/spec/unit/provider/service/openbsd_spec.rb +++ b/spec/unit/provider/service/openbsd_spec.rb @@ -6,8 +6,8 @@ before :each do allow(Puppet::Type.type(:service)).to receive(:defaultprovider).and_return(provider_class) - allow(Facter).to receive(:value).with(:operatingsystem).and_return(:openbsd) - allow(Facter).to receive(:value).with(:osfamily).and_return('OpenBSD') + allow(Facter).to receive(:value).with('os.name').and_return(:openbsd) + allow(Facter).to receive(:value).with('os.family').and_return('OpenBSD') allow(FileTest).to receive(:file?).with('/usr/sbin/rcctl').and_return(true) allow(FileTest).to receive(:executable?).with('/usr/sbin/rcctl').and_return(true) end diff --git a/spec/unit/provider/service/openwrt_spec.rb b/spec/unit/provider/service/openwrt_spec.rb index 3e424fd222b..99d32c9ae26 100644 --- a/spec/unit/provider/service/openwrt_spec.rb +++ b/spec/unit/provider/service/openwrt_spec.rb @@ -38,7 +38,7 @@ operatingsystem = 'openwrt' it "should be the default provider on #{operatingsystem}" do - expect(Facter).to receive(:value).with(:operatingsystem).and_return(operatingsystem) + expect(Facter).to receive(:value).with('os.name').and_return(operatingsystem) expect(provider_class.default?).to be_truthy end diff --git a/spec/unit/provider/service/rcng_spec.rb b/spec/unit/provider/service/rcng_spec.rb index f4e2e7e5103..1898d028de5 100644 --- a/spec/unit/provider/service/rcng_spec.rb +++ b/spec/unit/provider/service/rcng_spec.rb @@ -6,8 +6,8 @@ before :each do allow(Puppet::Type.type(:service)).to receive(:defaultprovider).and_return(provider_class) - allow(Facter).to receive(:value).with(:operatingsystem).and_return(:netbsd) - allow(Facter).to receive(:value).with(:osfamily).and_return('NetBSD') + allow(Facter).to receive(:value).with('os.name').and_return(:netbsd) + allow(Facter).to receive(:value).with('os.family').and_return('NetBSD') allow(provider_class).to receive(:defpath).and_return('/etc/rc.d') @provider = provider_class.new allow(@provider).to receive(:initscript) diff --git a/spec/unit/provider/service/redhat_spec.rb b/spec/unit/provider/service/redhat_spec.rb index 652ca8f97aa..fe7d3f69d95 100644 --- a/spec/unit/provider/service/redhat_spec.rb +++ b/spec/unit/provider/service/redhat_spec.rb @@ -24,23 +24,23 @@ allow(@provider).to receive(:get).with(:hasstatus).and_return(false) allow(FileTest).to receive(:file?).with('/sbin/service').and_return(true) allow(FileTest).to receive(:executable?).with('/sbin/service').and_return(true) - allow(Facter).to receive(:value).with(:operatingsystem).and_return('CentOS') - allow(Facter).to receive(:value).with(:osfamily).and_return('RedHat') + allow(Facter).to receive(:value).with('os.name').and_return('CentOS') + allow(Facter).to receive(:value).with('os.family').and_return('RedHat') end osfamilies = [ 'RedHat' ] osfamilies.each do |osfamily| it "should be the default provider on #{osfamily}" do - expect(Facter).to receive(:value).with(:osfamily).and_return(osfamily) + expect(Facter).to receive(:value).with('os.family').and_return(osfamily) expect(provider_class.default?).to be_truthy end end it "should be the default provider on sles11" do - allow(Facter).to receive(:value).with(:osfamily).and_return(:suse) - allow(Facter).to receive(:value).with(:operatingsystem).and_return(:suse) - allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("11") + allow(Facter).to receive(:value).with('os.family').and_return(:suse) + allow(Facter).to receive(:value).with('os.name').and_return(:suse) + allow(Facter).to receive(:value).with('os.release.major').and_return("11") expect(provider_class.default?).to be_truthy end @@ -87,7 +87,7 @@ context "when checking enabled? on Suse" do before :each do - expect(Facter).to receive(:value).with(:osfamily).and_return('Suse') + expect(Facter).to receive(:value).with('os.family').and_return('Suse') end it "should check for on" do diff --git a/spec/unit/provider/service/smf_spec.rb b/spec/unit/provider/service/smf_spec.rb index 00b58c0c9f9..5d2ca235400 100644 --- a/spec/unit/provider/service/smf_spec.rb +++ b/spec/unit/provider/service/smf_spec.rb @@ -24,9 +24,9 @@ def set_resource_params(params = {}) allow(FileTest).to receive(:executable?).with('/usr/sbin/svcadm').and_return(true) allow(FileTest).to receive(:file?).with('/usr/bin/svcs').and_return(true) allow(FileTest).to receive(:executable?).with('/usr/bin/svcs').and_return(true) - allow(Facter).to receive(:value).with(:operatingsystem).and_return('Solaris') - allow(Facter).to receive(:value).with(:osfamily).and_return('Solaris') - allow(Facter).to receive(:value).with(:operatingsystemrelease).and_return('11.2') + allow(Facter).to receive(:value).with('os.name').and_return('Solaris') + allow(Facter).to receive(:value).with('os.family').and_return('Solaris') + allow(Facter).to receive(:value).with('os.release.full').and_return('11.2') end context ".instances" do it "should have an instances method" do @@ -173,19 +173,19 @@ def set_resource_params(params = {}) end it 'returns the right command for restarting the service for Solaris versions newer than 11.2' do - expect(Facter).to receive(:value).with(:operatingsystemrelease).and_return('11.3') + expect(Facter).to receive(:value).with('os.release.full').and_return('11.3') expect(@provider.restartcmd).to eql([@provider.command(:adm), :restart, '-s', fmri]) end it 'returns the right command for restarting the service on Solaris 11.2' do - expect(Facter).to receive(:value).with(:operatingsystemrelease).and_return('11.2') + expect(Facter).to receive(:value).with('os.release.full').and_return('11.2') expect(@provider.restartcmd).to eql([@provider.command(:adm), :restart, '-s', fmri]) end it 'returns the right command for restarting the service for Solaris versions older than Solaris 11.2' do - expect(Facter).to receive(:value).with(:operatingsystemrelease).and_return('10.3') + expect(Facter).to receive(:value).with('os.release.full').and_return('10.3') expect(@provider.restartcmd).to eql([@provider.command(:adm), :restart, fmri]) end @@ -281,7 +281,7 @@ def transition_service(from, to, tries) before(:each) do allow(@provider).to receive(:service_states).and_return(states) - allow(Facter).to receive(:value).with(:operatingsystemrelease).and_return('10.3') + allow(Facter).to receive(:value).with('os.release.full').and_return('10.3') end it "should run the status command if it's passed in" do @@ -336,7 +336,7 @@ def transition_service(from, to, tries) end it "should return stopped for an incomplete service on Solaris 11" do - allow(Facter).to receive(:value).with(:operatingsystemrelease).and_return('11.3') + allow(Facter).to receive(:value).with('os.release.full').and_return('11.3') allow(@provider).to receive(:complete_service?).and_return(false) expect(@provider.status).to eq(:stopped) end diff --git a/spec/unit/provider/service/systemd_spec.rb b/spec/unit/provider/service/systemd_spec.rb index 33eac8ef9e3..d615c3173d3 100644 --- a/spec/unit/provider/service/systemd_spec.rb +++ b/spec/unit/provider/service/systemd_spec.rb @@ -27,149 +27,149 @@ osfamilies.each do |osfamily| it "should be the default provider on #{osfamily}" do - allow(Facter).to receive(:value).with(:osfamily).and_return(osfamily) - allow(Facter).to receive(:value).with(:operatingsystem).and_return(osfamily) - allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("1234") + allow(Facter).to receive(:value).with('os.family').and_return(osfamily) + allow(Facter).to receive(:value).with('os.name').and_return(osfamily) + allow(Facter).to receive(:value).with('os.release.major').and_return("1234") expect(provider_class).to be_default end end [7, 8].each do |ver| it "should be the default provider on rhel#{ver}" do - allow(Facter).to receive(:value).with(:osfamily).and_return(:redhat) - allow(Facter).to receive(:value).with(:operatingsystem).and_return(:redhat) - allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return(ver.to_s) + allow(Facter).to receive(:value).with('os.family').and_return(:redhat) + allow(Facter).to receive(:value).with('os.name').and_return(:redhat) + allow(Facter).to receive(:value).with('os.release.major').and_return(ver.to_s) expect(provider_class).to be_default end end [ 4, 5, 6 ].each do |ver| it "should not be the default provider on rhel#{ver}" do - allow(Facter).to receive(:value).with(:osfamily).and_return(:redhat) - allow(Facter).to receive(:value).with(:operatingsystem).and_return(:redhat) - allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("#{ver}") + allow(Facter).to receive(:value).with('os.family').and_return(:redhat) + allow(Facter).to receive(:value).with('os.name').and_return(:redhat) + allow(Facter).to receive(:value).with('os.release.major').and_return("#{ver}") expect(provider_class).not_to be_default end end [ 17, 18, 19, 20, 21, 22, 23 ].each do |ver| it "should be the default provider on fedora#{ver}" do - allow(Facter).to receive(:value).with(:osfamily).and_return(:redhat) - allow(Facter).to receive(:value).with(:operatingsystem).and_return(:fedora) - allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("#{ver}") + allow(Facter).to receive(:value).with('os.family').and_return(:redhat) + allow(Facter).to receive(:value).with('os.name').and_return(:fedora) + allow(Facter).to receive(:value).with('os.release.major').and_return("#{ver}") expect(provider_class).to be_default end end it "should be the default provider on Amazon Linux 2.0" do - allow(Facter).to receive(:value).with(:osfamily).and_return(:redhat) - allow(Facter).to receive(:value).with(:operatingsystem).and_return(:amazon) - allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("2") + allow(Facter).to receive(:value).with('os.family').and_return(:redhat) + allow(Facter).to receive(:value).with('os.name').and_return(:amazon) + allow(Facter).to receive(:value).with('os.release.major').and_return("2") expect(provider_class).to be_default end it "should not be the default provider on Amazon Linux 2017.09" do - allow(Facter).to receive(:value).with(:osfamily).and_return(:redhat) - allow(Facter).to receive(:value).with(:operatingsystem).and_return(:amazon) - allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("2017") + allow(Facter).to receive(:value).with('os.family').and_return(:redhat) + allow(Facter).to receive(:value).with('os.name').and_return(:amazon) + allow(Facter).to receive(:value).with('os.release.major').and_return("2017") expect(provider_class).not_to be_default end it "should be the default provider on cumulus3" do - allow(Facter).to receive(:value).with(:osfamily).and_return(:debian) - allow(Facter).to receive(:value).with(:operatingsystem).and_return('CumulusLinux') - allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("3") + allow(Facter).to receive(:value).with('os.family').and_return(:debian) + allow(Facter).to receive(:value).with('os.name').and_return('CumulusLinux') + allow(Facter).to receive(:value).with('os.release.major').and_return("3") expect(provider_class).to be_default end it "should be the default provider on sles12" do - allow(Facter).to receive(:value).with(:osfamily).and_return(:suse) - allow(Facter).to receive(:value).with(:operatingsystem).and_return(:suse) - allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("12") + allow(Facter).to receive(:value).with('os.family').and_return(:suse) + allow(Facter).to receive(:value).with('os.name').and_return(:suse) + allow(Facter).to receive(:value).with('os.release.major').and_return("12") expect(provider_class).to be_default end it "should be the default provider on opensuse13" do - allow(Facter).to receive(:value).with(:osfamily).and_return(:suse) - allow(Facter).to receive(:value).with(:operatingsystem).and_return(:suse) - allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("13") + allow(Facter).to receive(:value).with('os.family').and_return(:suse) + allow(Facter).to receive(:value).with('os.name').and_return(:suse) + allow(Facter).to receive(:value).with('os.release.major').and_return("13") expect(provider_class).to be_default end # tumbleweed is a rolling release with date-based major version numbers it "should be the default provider on tumbleweed" do - allow(Facter).to receive(:value).with(:osfamily).and_return(:suse) - allow(Facter).to receive(:value).with(:operatingsystem).and_return(:suse) - allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("20150829") + allow(Facter).to receive(:value).with('os.family').and_return(:suse) + allow(Facter).to receive(:value).with('os.name').and_return(:suse) + allow(Facter).to receive(:value).with('os.release.major').and_return("20150829") expect(provider_class).to be_default end # leap is the next generation suse release it "should be the default provider on leap" do - allow(Facter).to receive(:value).with(:osfamily).and_return(:suse) - allow(Facter).to receive(:value).with(:operatingsystem).and_return(:leap) - allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("42") + allow(Facter).to receive(:value).with('os.family').and_return(:suse) + allow(Facter).to receive(:value).with('os.name').and_return(:leap) + allow(Facter).to receive(:value).with('os.release.major').and_return("42") expect(provider_class).to be_default end it "should not be the default provider on debian7" do - allow(Facter).to receive(:value).with(:osfamily).and_return(:debian) - allow(Facter).to receive(:value).with(:operatingsystem).and_return(:debian) - allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("7") + allow(Facter).to receive(:value).with('os.family').and_return(:debian) + allow(Facter).to receive(:value).with('os.name').and_return(:debian) + allow(Facter).to receive(:value).with('os.release.major').and_return("7") expect(provider_class).not_to be_default end it "should be the default provider on debian8" do - allow(Facter).to receive(:value).with(:osfamily).and_return(:debian) - allow(Facter).to receive(:value).with(:operatingsystem).and_return(:debian) - allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("8") + allow(Facter).to receive(:value).with('os.family').and_return(:debian) + allow(Facter).to receive(:value).with('os.name').and_return(:debian) + allow(Facter).to receive(:value).with('os.release.major').and_return("8") expect(provider_class).to be_default end it "should be the default provider on debian11" do - allow(Facter).to receive(:value).with(:osfamily).and_return(:debian) - allow(Facter).to receive(:value).with(:operatingsystem).and_return(:debian) - allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("11") + allow(Facter).to receive(:value).with('os.family').and_return(:debian) + allow(Facter).to receive(:value).with('os.name').and_return(:debian) + allow(Facter).to receive(:value).with('os.release.major').and_return("11") expect(provider_class).to be_default end it "should be the default provider on debian bookworm/sid" do - allow(Facter).to receive(:value).with(:osfamily).and_return(:debian) - allow(Facter).to receive(:value).with(:operatingsystem).and_return(:debian) - allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("bookworm/sid") + allow(Facter).to receive(:value).with('os.family').and_return(:debian) + allow(Facter).to receive(:value).with('os.name').and_return(:debian) + allow(Facter).to receive(:value).with('os.release.major').and_return("bookworm/sid") expect(provider_class).to be_default end it "should not be the default provider on ubuntu14.04" do - allow(Facter).to receive(:value).with(:osfamily).and_return(:debian) - allow(Facter).to receive(:value).with(:operatingsystem).and_return(:ubuntu) - allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("14.04") + allow(Facter).to receive(:value).with('os.family').and_return(:debian) + allow(Facter).to receive(:value).with('os.name').and_return(:ubuntu) + allow(Facter).to receive(:value).with('os.release.major').and_return("14.04") expect(provider_class).not_to be_default end [ '15.04', '15.10', '16.04', '16.10', '17.04', '17.10', '18.04' ].each do |ver| it "should be the default provider on ubuntu#{ver}" do - allow(Facter).to receive(:value).with(:osfamily).and_return(:debian) - allow(Facter).to receive(:value).with(:operatingsystem).and_return(:ubuntu) - allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("#{ver}") + allow(Facter).to receive(:value).with('os.family').and_return(:debian) + allow(Facter).to receive(:value).with('os.name').and_return(:ubuntu) + allow(Facter).to receive(:value).with('os.release.major').and_return("#{ver}") expect(provider_class).to be_default end end [ '10', '11', '12', '13', '14', '15', '16', '17' ].each do |ver| it "should not be the default provider on LinuxMint#{ver}" do - allow(Facter).to receive(:value).with(:osfamily).and_return(:debian) - allow(Facter).to receive(:value).with(:operatingsystem).and_return(:LinuxMint) - allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("#{ver}") + allow(Facter).to receive(:value).with('os.family').and_return(:debian) + allow(Facter).to receive(:value).with('os.name').and_return(:LinuxMint) + allow(Facter).to receive(:value).with('os.release.major').and_return("#{ver}") expect(provider_class).not_to be_default end end [ '18', '19' ].each do |ver| it "should be the default provider on LinuxMint#{ver}" do - allow(Facter).to receive(:value).with(:osfamily).and_return(:debian) - allow(Facter).to receive(:value).with(:operatingsystem).and_return(:LinuxMint) - allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("#{ver}") + allow(Facter).to receive(:value).with('os.family').and_return(:debian) + allow(Facter).to receive(:value).with('os.name').and_return(:LinuxMint) + allow(Facter).to receive(:value).with('os.release.major').and_return("#{ver}") expect(provider_class).to be_default end end diff --git a/spec/unit/provider/service/upstart_spec.rb b/spec/unit/provider/service/upstart_spec.rb index 3a4e5a08902..10488c81812 100644 --- a/spec/unit/provider/service/upstart_spec.rb +++ b/spec/unit/provider/service/upstart_spec.rb @@ -26,8 +26,8 @@ def lists_processes_as(output) end it "should be the default provider on Ubuntu" do - expect(Facter).to receive(:value).with(:operatingsystem).and_return("Ubuntu") - expect(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("12.04") + expect(Facter).to receive(:value).with('os.name').and_return("Ubuntu") + expect(Facter).to receive(:value).with('os.release.major').and_return("12.04") expect(provider_class.default?).to be_truthy end @@ -55,7 +55,7 @@ def lists_processes_as(output) describe "excluding services" do it "ignores tty and serial on Redhat systems" do - allow(Facter).to receive(:value).with(:osfamily).and_return('RedHat') + allow(Facter).to receive(:value).with('os.family').and_return('RedHat') expect(provider_class.excludes).to include 'serial' expect(provider_class.excludes).to include 'tty' end diff --git a/spec/unit/provider/user/directoryservice_spec.rb b/spec/unit/provider/user/directoryservice_spec.rb index 882e94f5111..0d9308e5960 100644 --- a/spec/unit/provider/user/directoryservice_spec.rb +++ b/spec/unit/provider/user/directoryservice_spec.rb @@ -1111,9 +1111,9 @@ module Puppet::Util::Plist provider.class.instance_variable_set(:@os_version, nil) if provider.class.instance_variable_defined? :@os_version end - it 'should call Facter.value(:macosx_productversion_major) ONLY ONCE no matter how ' + + it 'should call Facter.value("os.macosx.version.major") ONLY ONCE no matter how ' + 'many times get_os_version() is called' do - expect(Facter).to receive(:value).with(:macosx_productversion_major).once.and_return('10.8') + expect(Facter).to receive(:value).with('os.macosx.version.major').once.and_return('10.8') expect(provider.class.get_os_version).to eq('10.8') expect(provider.class.get_os_version).to eq('10.8') expect(provider.class.get_os_version).to eq('10.8') diff --git a/spec/unit/provider/user/openbsd_spec.rb b/spec/unit/provider/user/openbsd_spec.rb index 0079f357a7a..7a35dd92472 100644 --- a/spec/unit/provider/user/openbsd_spec.rb +++ b/spec/unit/provider/user/openbsd_spec.rb @@ -44,8 +44,8 @@ describe "#addcmd" do it "should return an array with the full command and expiry as MM/DD/YY" do - allow(Facter).to receive(:value).with(:osfamily).and_return('OpenBSD') - allow(Facter).to receive(:value).with(:operatingsystemmajrelease) + allow(Facter).to receive(:value).with('os.family').and_return('OpenBSD') + allow(Facter).to receive(:value).with('os.release.major') resource[:expiry] = "1997-06-01" expect(provider.addcmd).to eq(['/usr/sbin/useradd', '-e', 'June 01 1997', 'myuser']) end diff --git a/spec/unit/provider/user/useradd_spec.rb b/spec/unit/provider/user/useradd_spec.rb index a8a5ed750d0..fa48f3a33a4 100644 --- a/spec/unit/provider/user/useradd_spec.rb +++ b/spec/unit/provider/user/useradd_spec.rb @@ -75,8 +75,8 @@ context "when setting groups" do it "uses -G to set groups" do - allow(Facter).to receive(:value).with(:osfamily).and_return('Solaris') - allow(Facter).to receive(:value).with(:operatingsystemmajrelease) + allow(Facter).to receive(:value).with('os.family').and_return('Solaris') + allow(Facter).to receive(:value).with('os.release.major') resource[:ensure] = :present resource[:groups] = ['group1', 'group2'] expect(provider).to receive(:execute).with(['/usr/sbin/useradd', '-G', 'group1,group2', 'myuser'], kind_of(Hash)) @@ -84,8 +84,8 @@ end it "uses -G to set groups with -M on supported systems" do - allow(Facter).to receive(:value).with(:osfamily).and_return('RedHat') - allow(Facter).to receive(:value).with(:operatingsystemmajrelease) + allow(Facter).to receive(:value).with('os.family').and_return('RedHat') + allow(Facter).to receive(:value).with('os.release.major') resource[:ensure] = :present resource[:groups] = ['group1', 'group2'] expect(provider).to receive(:execute).with(['/usr/sbin/useradd', '-G', 'group1,group2', '-M', 'myuser'], kind_of(Hash)) @@ -303,14 +303,14 @@ describe "#expiry=" do it "should pass expiry to usermod as MM/DD/YY when on Solaris" do - expect(Facter).to receive(:value).with(:operatingsystem).and_return('Solaris') + expect(Facter).to receive(:value).with('os.name').and_return('Solaris') resource[:expiry] = '2012-10-31' expect(provider).to receive(:execute).with(['/usr/sbin/usermod', '-e', '10/31/2012', 'myuser'], hash_including(custom_environment: {})) provider.expiry = '2012-10-31' end it "should pass expiry to usermod as YYYY-MM-DD when not on Solaris" do - expect(Facter).to receive(:value).with(:operatingsystem).and_return('not_solaris') + expect(Facter).to receive(:value).with('os.name').and_return('not_solaris') resource[:expiry] = '2012-10-31' expect(provider).to receive(:execute).with(['/usr/sbin/usermod', '-e', '2012-10-31', 'myuser'], hash_including(custom_environment: {})) provider.expiry = '2012-10-31' @@ -323,8 +323,8 @@ end it "should use -e with -1 when the expiry property is removed on SLES11" do - allow(Facter).to receive(:value).with(:operatingsystem).and_return('SLES') - allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return('11') + allow(Facter).to receive(:value).with('os.name').and_return('SLES') + allow(Facter).to receive(:value).with('os.release.major').and_return('11') resource[:expiry] = :absent expect(provider).to receive(:execute).with(['/usr/sbin/usermod', '-e', -1, 'myuser'], hash_including(custom_environment: {})) provider.expiry = :absent @@ -487,16 +487,16 @@ end it "should use -M flag if home is not managed on a supported system" do - allow(Facter).to receive(:value).with(:osfamily).and_return("RedHat") - allow(Facter).to receive(:value).with(:operatingsystemmajrelease) + allow(Facter).to receive(:value).with('os.family').and_return("RedHat") + allow(Facter).to receive(:value).with('os.release.major') resource[:managehome] = :false expect(provider).to receive(:execute).with(include('-M'), kind_of(Hash)) provider.create end it "should not use -M flag if home is not managed on an unsupported system" do - allow(Facter).to receive(:value).with(:osfamily).and_return("Suse") - allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("11") + allow(Facter).to receive(:value).with('os.family').and_return("Suse") + allow(Facter).to receive(:value).with('os.release.major').and_return("11") resource[:managehome] = :false expect(provider).to receive(:execute).with(excluding('-M'), kind_of(Hash)) provider.create @@ -557,14 +557,14 @@ end it "should return an array with the full command and expiry as MM/DD/YY when on Solaris" do - allow(Facter).to receive(:value).with(:operatingsystem).and_return('Solaris') + allow(Facter).to receive(:value).with('os.name').and_return('Solaris') expect(described_class).to receive(:system_users?).and_return(true) resource[:expiry] = "2012-08-18" expect(provider.addcmd).to eq(['/usr/sbin/useradd', '-e', '08/18/2012', '-G', 'somegroup', '-o', '-m', '-r', 'myuser']) end it "should return an array with the full command and expiry as YYYY-MM-DD when not on Solaris" do - allow(Facter).to receive(:value).with(:operatingsystem).and_return('not_solaris') + allow(Facter).to receive(:value).with('os.name').and_return('not_solaris') expect(described_class).to receive(:system_users?).and_return(true) resource[:expiry] = "2012-08-18" expect(provider.addcmd).to eq(['/usr/sbin/useradd', '-e', '2012-08-18', '-G', 'somegroup', '-o', '-m', '-r', 'myuser']) diff --git a/spec/unit/provider_spec.rb b/spec/unit/provider_spec.rb index c79edf41637..5dd31da76a6 100644 --- a/spec/unit/provider_spec.rb +++ b/spec/unit/provider_spec.rb @@ -222,20 +222,20 @@ def existing_command { :true => false } => false, { :false => false } => true, { :false => true } => false, - { :operatingsystem => Facter.value(:operatingsystem) } => true, - { :operatingsystem => :yayness } => false, + { 'os.name' => Facter.value('os.name') } => true, + { 'os.name' => :yayness } => false, { :nothing => :yayness } => false, { :exists => Puppet::Util.which(existing_command) } => true, { :exists => "/this/file/does/not/exist" } => false, { :true => true, :exists => Puppet::Util.which(existing_command) } => true, { :true => true, :exists => "/this/file/does/not/exist" } => false, - { :operatingsystem => Facter.value(:operatingsystem), + { 'os.name' => Facter.value('os.name'), :exists => Puppet::Util.which(existing_command) } => true, - { :operatingsystem => :yayness, + { 'os.name' => :yayness, :exists => Puppet::Util.which(existing_command) } => false, - { :operatingsystem => Facter.value(:operatingsystem), + { 'os.name' => Facter.value('os.name'), :exists => "/this/file/does/not/exist" } => false, - { :operatingsystem => :yayness, + { 'os.name' => :yayness, :exists => "/this/file/does/not/exist" } => false, }.each do |confines, result| it "should confine #{confines.inspect} to #{result}" do @@ -269,32 +269,32 @@ def existing_command end context "default providers" do - let :os do Facter.value(:operatingsystem) end + let :os do Facter.value('os.name') end it { is_expected.to respond_to :specificity } it "should find the default provider" do type.provide(:nondefault) {} - subject.defaultfor :operatingsystem => os + subject.defaultfor 'os.name' => os expect(subject.name).to eq(type.defaultprovider.name) end describe "regex matches" do it "should match a singular regex" do - expect(Facter).to receive(:value).with(:osfamily).at_least(:once).and_return("solaris") + expect(Facter).to receive(:value).with('os.family').at_least(:once).and_return("solaris") one = type.provide(:one) do - defaultfor :osfamily => /solaris/ + defaultfor 'os.family' => /solaris/ end expect(one).to be_default end it "should not match a non-matching regex " do - expect(Facter).to receive(:value).with(:osfamily).at_least(:once).and_return("redhat") + expect(Facter).to receive(:value).with('os.family').at_least(:once).and_return("redhat") one = type.provide(:one) do - defaultfor :osfamily => /solaris/ + defaultfor 'os.family' => /solaris/ end expect(one).to_not be_default @@ -302,15 +302,15 @@ def existing_command it "should allow a mix of regex and string" do - expect(Facter).to receive(:value).with(:operatingsystem).at_least(:once).and_return("fedora") - expect(Facter).to receive(:value).with(:operatingsystemmajrelease).at_least(:once).and_return("24") + expect(Facter).to receive(:value).with('os.name').at_least(:once).and_return("fedora") + expect(Facter).to receive(:value).with('os.release.major').at_least(:once).and_return("24") one = type.provide(:one) do - defaultfor :operatingsystem => "fedora", :operatingsystemmajrelease => /^2[2-9]$/ + defaultfor 'os.name' => "fedora", 'os.release.major' => /^2[2-9]$/ end two = type.provide(:two) do - defaultfor :operatingsystem => /fedora/, :operatingsystemmajrelease => '24' + defaultfor 'os.name' => /fedora/, 'os.release.major' => '24' end expect(one).to be_default @@ -320,21 +320,21 @@ def existing_command describe "when there are multiple defaultfor's of equal specificity" do before :each do - subject.defaultfor :operatingsystem => :os1 - subject.defaultfor :operatingsystem => :os2 + subject.defaultfor 'os.name' => :os1 + subject.defaultfor 'os.name' => :os2 end let(:alternate) { type.provide(:alternate) {} } it "should be default for the first defaultfor" do - expect(Facter).to receive(:value).with(:operatingsystem).at_least(:once).and_return(:os1) + expect(Facter).to receive(:value).with('os.name').at_least(:once).and_return(:os1) expect(provider).to be_default expect(alternate).not_to be_default end it "should be default for the last defaultfor" do - expect(Facter).to receive(:value).with(:operatingsystem).at_least(:once).and_return(:os2) + expect(Facter).to receive(:value).with('os.name').at_least(:once).and_return(:os2) expect(provider).to be_default expect(alternate).not_to be_default @@ -343,31 +343,31 @@ def existing_command describe "when there are multiple defaultfor's with different specificity" do before :each do - subject.defaultfor :operatingsystem => :os1 - subject.defaultfor :operatingsystem => :os2, :operatingsystemmajrelease => "42" - subject.defaultfor :operatingsystem => :os3, :operatingsystemmajrelease => /^4[2-9]$/ + subject.defaultfor 'os.name' => :os1 + subject.defaultfor 'os.name' => :os2, 'os.release.major' => "42" + subject.defaultfor 'os.name' => :os3, 'os.release.major' => /^4[2-9]$/ end let(:alternate) { type.provide(:alternate) {} } it "should be default for a more specific, but matching, defaultfor" do - expect(Facter).to receive(:value).with(:operatingsystem).at_least(:once).and_return(:os2) - expect(Facter).to receive(:value).with(:operatingsystemmajrelease).at_least(:once).and_return("42") + expect(Facter).to receive(:value).with('os.name').at_least(:once).and_return(:os2) + expect(Facter).to receive(:value).with('os.release.major').at_least(:once).and_return("42") expect(provider).to be_default expect(alternate).not_to be_default end it "should be default for a more specific, but matching, defaultfor with regex" do - expect(Facter).to receive(:value).with(:operatingsystem).at_least(:once).and_return(:os3) - expect(Facter).to receive(:value).with(:operatingsystemmajrelease).at_least(:once).and_return("42") + expect(Facter).to receive(:value).with('os.name').at_least(:once).and_return(:os3) + expect(Facter).to receive(:value).with('os.release.major').at_least(:once).and_return("42") expect(provider).to be_default expect(alternate).not_to be_default end it "should be default for a less specific, but matching, defaultfor" do - expect(Facter).to receive(:value).with(:operatingsystem).at_least(:once).and_return(:os1) + expect(Facter).to receive(:value).with('os.name').at_least(:once).and_return(:os1) expect(provider).to be_default expect(alternate).not_to be_default @@ -377,7 +377,7 @@ def existing_command it "should consider any true value enough to be default" do alternate = type.provide(:alternate) {} - subject.defaultfor :operatingsystem => [:one, :two, :three, os] + subject.defaultfor 'os.name' => [:one, :two, :three, os] expect(subject.name).to eq(type.defaultprovider.name) expect(subject).to be_default @@ -386,29 +386,29 @@ def existing_command it "should not be default if the defaultfor doesn't match" do expect(subject).not_to be_default - subject.defaultfor :operatingsystem => :one + subject.defaultfor 'os.name' => :one expect(subject).not_to be_default end it "should not be default if the notdefaultfor does match" do - expect(Facter).to receive(:value).with(:operatingsystem).at_least(:once).and_return("fedora") - expect(Facter).to receive(:value).with(:operatingsystemmajrelease).at_least(:once).and_return("24") + expect(Facter).to receive(:value).with('os.name').at_least(:once).and_return("fedora") + expect(Facter).to receive(:value).with('os.release.major').at_least(:once).and_return("24") one = type.provide(:one) do - defaultfor :operatingsystem => "fedora" - notdefaultfor :operatingsystem => "fedora", :operatingsystemmajrelease => 24 + defaultfor 'os.name' => "fedora" + notdefaultfor 'os.name' => "fedora", 'os.release.major' => 24 end expect(one).not_to be_default end it "should be default if the notdefaultfor doesn't match" do - expect(Facter).to receive(:value).with(:operatingsystem).at_least(:once).and_return("fedora") - expect(Facter).to receive(:value).with(:operatingsystemmajrelease).at_least(:once).and_return("24") + expect(Facter).to receive(:value).with('os.name').at_least(:once).and_return("fedora") + expect(Facter).to receive(:value).with('os.release.major').at_least(:once).and_return("24") one = type.provide(:one) do - defaultfor :operatingsystem => "fedora" - notdefaultfor :operatingsystem => "fedora", :operatingsystemmajrelease => 42 + defaultfor 'os.name' => "fedora" + notdefaultfor 'os.name' => "fedora", 'os.release.major' => 42 end expect(one).to be_default @@ -519,18 +519,18 @@ def existing_command end it "with the specification: %{spec}" % { spec: thisspec.join(', ') } do - allow(Facter).to receive(:value).with(:osfamily).and_return("redhat") - allow(Facter).to receive(:value).with(:operatingsystem).and_return("centos") - allow(Facter).to receive(:value).with(:operatingsystemrelease).and_return("27") + allow(Facter).to receive(:value).with('os.family').and_return("redhat") + allow(Facter).to receive(:value).with('os.name').and_return("centos") + allow(Facter).to receive(:value).with('os.release.full').and_return("27") one = type.provide(:one) do if defaultforspec[:one].key?(:defaultfor) - defaultfor :osfamily => "redhat" if defaultforspec[:one][:defaultfor] - defaultfor :osfamily => "ubuntu" if !defaultforspec[:one][:defaultfor] + defaultfor 'os.family' => "redhat" if defaultforspec[:one][:defaultfor] + defaultfor 'os.family' => "ubuntu" if !defaultforspec[:one][:defaultfor] end if defaultforspec[:one].key?(:notdefaultfor) - notdefaultfor :operatingsystem => "centos" if defaultforspec[:one][:notdefaultfor] - notdefaultfor :operatingsystem => "ubuntu" if !defaultforspec[:one][:notdefaultfor] + notdefaultfor 'os.name' => "centos" if defaultforspec[:one][:notdefaultfor] + notdefaultfor 'os.name' => "ubuntu" if !defaultforspec[:one][:notdefaultfor] end end @@ -538,14 +538,14 @@ def existing_command provider_options[:parent] = one if defaultforspec[:two][:derived] # :two inherits from one, if spec'd two = type.provide(:two, provider_options) do if defaultforspec[:two].key?(:defaultfor) || defaultforspec[:two].key?(:extradefaultfor) - defaultfor :osfamily => "redhat" if defaultforspec[:two][:defaultfor] - defaultfor :osfamily => "redhat",# defaultforspec[:two][:extradefaultfor] has two parts - :operatingsystem => "centos" if defaultforspec[:two][:extradefaultfor] - defaultfor :osfamily => "ubuntu" if !defaultforspec[:two][:defaultfor] + defaultfor 'os.family' => "redhat" if defaultforspec[:two][:defaultfor] + defaultfor 'os.family' => "redhat",# defaultforspec[:two][:extradefaultfor] has two parts + 'os.name' => "centos" if defaultforspec[:two][:extradefaultfor] + defaultfor 'os.family' => "ubuntu" if !defaultforspec[:two][:defaultfor] end if defaultforspec[:two].key?(:notdefaultfor) - notdefaultfor :operatingsystemrelease => "27" if defaultforspec[:two][:notdefaultfor] - notdefaultfor :operatingsystemrelease => "99" if !defaultforspec[:two][:notdefaultfor] + notdefaultfor 'os.release.full' => "27" if defaultforspec[:two][:notdefaultfor] + notdefaultfor 'os.release.full' => "99" if !defaultforspec[:two][:notdefaultfor] end end diff --git a/spec/unit/type/package_spec.rb b/spec/unit/type/package_spec.rb index 346b9411f74..ca62eeac5a0 100644 --- a/spec/unit/type/package_spec.rb +++ b/spec/unit/type/package_spec.rb @@ -370,9 +370,9 @@ def setprops(properties) it "should select dnf over yum for dnf supported fedora versions" do dnf = Puppet::Type.type(:package).provider(:dnf) yum = Puppet::Type.type(:package).provider(:yum) - allow(Facter).to receive(:value).with(:osfamily).and_return(:redhat) - allow(Facter).to receive(:value).with(:operatingsystem).and_return(:fedora) - allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("22") + allow(Facter).to receive(:value).with('os.family').and_return(:redhat) + allow(Facter).to receive(:value).with('os.name').and_return(:fedora) + allow(Facter).to receive(:value).with('os.release.major').and_return("22") expect(dnf.specificity).to be > yum.specificity end diff --git a/spec/unit/type/resources_spec.rb b/spec/unit/type/resources_spec.rb index cd17419f2bc..6c840e01657 100644 --- a/spec/unit/type/resources_spec.rb +++ b/spec/unit/type/resources_spec.rb @@ -124,8 +124,8 @@ def self.instances context "on #{os}" do before :each do allow(Facter).to receive(:value).with(:kernel).and_return(os) - allow(Facter).to receive(:value).with(:operatingsystem).and_return(os) - allow(Facter).to receive(:value).with(:osfamily).and_return(os) + allow(Facter).to receive(:value).with('os.name').and_return(os) + allow(Facter).to receive(:value).with('os.family').and_return(os) allow(Puppet::FileSystem).to receive(:exist?).with('/etc/login.defs').and_return(false) @res = Puppet::Type.type(:resources).new :name => :user, :purge => true, :unless_system_user => true @res.catalog = Puppet::Resource::Catalog.new diff --git a/spec/unit/type_spec.rb b/spec/unit/type_spec.rb index cc2e637c0fd..bb002aef334 100644 --- a/spec/unit/type_spec.rb +++ b/spec/unit/type_spec.rb @@ -1142,7 +1142,7 @@ def self.title_patterns before :each do type.provide(:default) do - defaultfor :operatingsystem => Facter.value(:operatingsystem) + defaultfor 'os.name' => Facter.value('os.name') mk_resource_methods class << self attr_accessor :params @@ -1172,7 +1172,7 @@ def self.instances context "with a default provider" do before :each do type.provide(:default) do - defaultfor :operatingsystem => Facter.value(:operatingsystem) + defaultfor 'os.name' => Facter.value('os.name') mk_resource_methods class << self attr_accessor :names From 54f3009b71cff4fb1d09b2992af0383928667055 Mon Sep 17 00:00:00 2001 From: Gabriel Nagy Date: Tue, 26 Jan 2021 17:19:44 +0200 Subject: [PATCH 310/731] (PUP-10853) Remove usage of legacy networking facts Use structured facts instead of legacy networking facts. The following mapping applies: fqdn => networking.fqdn domain => networking.domain hostname => networking.hostname ipaddress => networking.ip ipaddress6 => networking.ip6 Change `processorcount` to `processors.count`. --- .../lib/puppet/acceptance/agent_fqdn_utils.rb | 2 +- acceptance/tests/catalog_with_binary_data.rb | 2 +- acceptance/tests/direct_puppet/supports_utf8.rb | 2 +- .../loader/autoload_from_resource_type_decl.rb | 2 +- .../tests/parser_functions/hiera_in_templates.rb | 14 +++++++------- .../reports/corrective_change_new_resource.rb | 2 +- .../reports/corrective_change_outside_puppet.rb | 2 +- .../reports/corrective_change_via_puppet.rb | 2 +- .../file/ticket_6448_file_with_utf8_source.rb | 2 +- acceptance/tests/ssl/certificate_extensions.rb | 16 ++++++++-------- .../windows/QA-506_windows_exit_codes_test.rb | 2 +- install.rb | 2 +- lib/puppet/file_serving/mount/file.rb | 8 ++++---- lib/puppet/indirector/catalog/compiler.rb | 10 +++++----- lib/puppet/settings.rb | 10 +++++----- spec/unit/file_serving/mount/file_spec.rb | 4 ++-- spec/unit/indirector/catalog/compiler_spec.rb | 16 ++++++++-------- tasks/parallel.rake | 2 +- 18 files changed, 50 insertions(+), 50 deletions(-) diff --git a/acceptance/lib/puppet/acceptance/agent_fqdn_utils.rb b/acceptance/lib/puppet/acceptance/agent_fqdn_utils.rb index 84e35ff89f0..0934ed79957 100644 --- a/acceptance/lib/puppet/acceptance/agent_fqdn_utils.rb +++ b/acceptance/lib/puppet/acceptance/agent_fqdn_utils.rb @@ -7,7 +7,7 @@ module AgentFqdnUtils # convert from an Beaker::Host (agent) to the systems fqdn as returned by facter def agent_to_fqdn(agent) unless @@hostname_to_fqdn.has_key?(agent.hostname) - @@hostname_to_fqdn[agent.hostname] = on(agent, facter('fqdn')).stdout.chomp + @@hostname_to_fqdn[agent.hostname] = on(agent, facter('networking.fqdn')).stdout.chomp end @@hostname_to_fqdn[agent.hostname] end diff --git a/acceptance/tests/catalog_with_binary_data.rb b/acceptance/tests/catalog_with_binary_data.rb index 0c7a9d3a266..363d4509445 100644 --- a/acceptance/tests/catalog_with_binary_data.rb +++ b/acceptance/tests/catalog_with_binary_data.rb @@ -34,7 +34,7 @@ manifest = <<-MANIFEST class #{test_num}( ) { - \$test_path = \$::fqdn ? #{agent_tmp_dirs} + \$test_path = \$facts['networking']['fqdn'] ? #{agent_tmp_dirs} file { '#{test_num}': path => "\$test_path/#{test_num}", content => file('#{test_num}/binary_data'), diff --git a/acceptance/tests/direct_puppet/supports_utf8.rb b/acceptance/tests/direct_puppet/supports_utf8.rb index d120c7bca73..cfc5315f90a 100644 --- a/acceptance/tests/direct_puppet/supports_utf8.rb +++ b/acceptance/tests/direct_puppet/supports_utf8.rb @@ -34,7 +34,7 @@ file { '#{environmentpath}/#{tmp_environment}/manifests/site.pp': ensure => file, content => ' -\$test_path = \$::fqdn ? #{tmp_file} +\$test_path = \$facts['networking']['fqdn'] ? #{tmp_file} file { \$test_path: content => @(UTF8) #{file_contents} diff --git a/acceptance/tests/loader/autoload_from_resource_type_decl.rb b/acceptance/tests/loader/autoload_from_resource_type_decl.rb index c2fd7d48694..afb815494c9 100644 --- a/acceptance/tests/loader/autoload_from_resource_type_decl.rb +++ b/acceptance/tests/loader/autoload_from_resource_type_decl.rb @@ -41,7 +41,7 @@ def empty_execution_log_file(host, path) custom_type = <<-END Puppet::Type.newtype(:type_tst) do newparam(:name, :namevar => true) do - fqdn = Facter.value(:fqdn) + fqdn = Facter.value('networking.fqdn') if fqdn == '#{agent_to_fqdn(master)}' File.open("#{execution_log[agent_to_fqdn(master)]}", 'a+') { |f| f.puts("found_type_tst: " + Time.now.to_s) } end diff --git a/acceptance/tests/parser_functions/hiera_in_templates.rb b/acceptance/tests/parser_functions/hiera_in_templates.rb index 9d3e788424d..a7380e7f5e9 100644 --- a/acceptance/tests/parser_functions/hiera_in_templates.rb +++ b/acceptance/tests/parser_functions/hiera_in_templates.rb @@ -100,7 +100,7 @@ def create_environment(osfamilies, tmp_dirs) \\$msgs = hiera_array('message') notify {\\$msgs:} class {'#{@module_name}': - result_dir => hiera('result_dir')[\\$::hostname], + result_dir => hiera('result_dir')[\\$facts['networking']['hostname']], } } ", @@ -188,7 +188,7 @@ class #{@module_name} ( file { "#{moduledir}/manifests/mod_default.pp": content => " class #{@module_name}::mod_default { - \\$result_dir = hiera('result_dir')[\\$::hostname] + \\$result_dir = hiera('result_dir')[\\$facts['networking']['hostname']] notify{\\"module mod_default invoked.\\\\n\\":} file {\\\"\\\${result_dir}/mod_default\\\": ensure => 'file', @@ -202,7 +202,7 @@ class #{@module_name}::mod_default { file { "#{moduledir}/manifests/mod_osfamily.pp": content => " class #{@module_name}::mod_osfamily { - \\$result_dir = hiera('result_dir')[\\$::hostname] + \\$result_dir = hiera('result_dir')[\\$facts['networking']['hostname']] notify{\\"module mod_osfamily invoked.\\\\n\\":} file {\\\"\\\${result_dir}/mod_osfamily\\\": ensure => 'file', @@ -216,7 +216,7 @@ class #{@module_name}::mod_osfamily { file { "#{moduledir}/manifests/mod_production.pp": content => " class #{@module_name}::mod_production { - \\$result_dir = hiera('result_dir')[\\$::hostname] + \\$result_dir = hiera('result_dir')[\\$facts['networking']['hostname']] notify{\\"module mod_production invoked.\\\\n\\":} file {\\\"\\\${result_dir}/mod_production\\\": ensure => 'file', @@ -230,7 +230,7 @@ class #{@module_name}::mod_production { file { "#{moduledir}/manifests/mod_fqdn.pp": content => " class #{@module_name}::mod_fqdn { - \\$result_dir = hiera('result_dir')[\\$::hostname] + \\$result_dir = hiera('result_dir')[\\$facts['networking']['hostname']] notify{\\"module mod_fqdn invoked.\\\\n\\":} file {\\\"\\\${result_dir}/mod_fqdn\\\": ensure => 'file', @@ -282,7 +282,7 @@ def find_tmp_dirs tmp_dirs = "" host_to_result_dir = {} agents.each do |agent| - h = on(agent, facter("hostname")).stdout.chomp + h = on(agent, facter('networking.hostname')).stdout.chomp t = agent.tmpdir("#{@module_name}_results") tmp_dirs += " #{h}: '#{t}'\n" host_to_result_dir[h] = t @@ -304,7 +304,7 @@ def find_tmp_dirs env_manifest = create_environment(find_osfamilies, tmp_dirs) apply_manifest_on(master, env_manifest, :catch_failures => true) agents.each do |agent| - resultdir = host_to_result_dir[on(agent, facter("hostname")).stdout.chomp] + resultdir = host_to_result_dir[on(agent, facter('networking.hostname')).stdout.chomp] step "Applying catalog to agent: #{agent}. result files in #{resultdir}" on( agent, diff --git a/acceptance/tests/reports/corrective_change_new_resource.rb b/acceptance/tests/reports/corrective_change_new_resource.rb index d33556ee051..5641b96321e 100644 --- a/acceptance/tests/reports/corrective_change_new_resource.rb +++ b/acceptance/tests/reports/corrective_change_new_resource.rb @@ -36,7 +36,7 @@ file { '#{environmentpath}/#{tmp_environment}/manifests/site.pp': ensure => file, content => ' - \$test_path = \$::fqdn ? #{tmp_file} + \$test_path = \$facts['networking']['fqdn'] ? #{tmp_file} file { \$test_path: content => @(UTF8) #{file_contents} diff --git a/acceptance/tests/reports/corrective_change_outside_puppet.rb b/acceptance/tests/reports/corrective_change_outside_puppet.rb index 882a03996a6..ddc3dd0c3a5 100644 --- a/acceptance/tests/reports/corrective_change_outside_puppet.rb +++ b/acceptance/tests/reports/corrective_change_outside_puppet.rb @@ -37,7 +37,7 @@ file { '#{environmentpath}/#{tmp_environment}/manifests/site.pp': ensure => file, content => ' - \$test_path = \$::fqdn ? #{tmp_file} + \$test_path = \$facts['networking']['fqdn'] ? #{tmp_file} file { \$test_path: content => @(UTF8) #{file_contents} diff --git a/acceptance/tests/reports/corrective_change_via_puppet.rb b/acceptance/tests/reports/corrective_change_via_puppet.rb index b30e2a6b65c..4097459e141 100644 --- a/acceptance/tests/reports/corrective_change_via_puppet.rb +++ b/acceptance/tests/reports/corrective_change_via_puppet.rb @@ -39,7 +39,7 @@ def create_manifest_for_file_resource(file_resource, file_contents, environment_ file { '#{environmentpath}/#{environment_name}/manifests/site.pp': ensure => file, content => ' - \$test_path = \$::fqdn ? #{file_resource} + \$test_path = \$facts['networking']['fqdn'] ? #{file_resource} file { \$test_path: content => @(UTF8) #{file_contents} diff --git a/acceptance/tests/resource/file/ticket_6448_file_with_utf8_source.rb b/acceptance/tests/resource/file/ticket_6448_file_with_utf8_source.rb index bcb307dfee6..6f060e3feb3 100644 --- a/acceptance/tests/resource/file/ticket_6448_file_with_utf8_source.rb +++ b/acceptance/tests/resource/file/ticket_6448_file_with_utf8_source.rb @@ -49,7 +49,7 @@ step 'create a site.pp on master containing a unicode file resource' do site_pp_contents = <<-SITE_PP - \$test_path = \$::fqdn ? #{agent_tmp_dirs} + \$test_path = \$facts['networking']['fqdn'] ? #{agent_tmp_dirs} file { "\$test_path/\uff72\uff67\u30d5\u30eb": ensure => present, source => "puppet:///modules/utf8_file_module/\u9759\u7684", diff --git a/acceptance/tests/ssl/certificate_extensions.rb b/acceptance/tests/ssl/certificate_extensions.rb index a12fe63fdba..bbb42826daa 100644 --- a/acceptance/tests/ssl/certificate_extensions.rb +++ b/acceptance/tests/ssl/certificate_extensions.rb @@ -11,17 +11,17 @@ initialize_temp_dirs agent_certnames = [] - hostname = master.execute('facter hostname') - fqdn = master.execute('facter fqdn') + hostname = master.execute('facter networking.hostname') + fqdn = master.execute('facter networking.fqdn') teardown do step "Cleanup the test agent certs" - master_config = { + server_config = { 'main' => { 'server' => fqdn }, - 'master' => { 'dns_alt_names' => "puppet,#{hostname},#{fqdn}" } + 'server' => { 'dns_alt_names' => "puppet,#{hostname},#{fqdn}" } } - with_puppet_running_on(master, master_config) do + with_puppet_running_on(master, server_config) do on(master, "puppetserver ca clean --certname #{agent_certnames.join(',')}", :acceptable_exit_codes => [0,24]) @@ -29,11 +29,11 @@ end environments_dir = get_test_file_path(master, "environments") - master_config = { + server_config = { 'main' => { 'environmentpath' => environments_dir, }, - 'master' => { + 'server' => { 'autosign' => true, 'dns_alt_names' => "puppet,#{hostname},#{fqdn}", } @@ -74,7 +74,7 @@ } MANIFEST - with_puppet_running_on(master, master_config) do + with_puppet_running_on(master, server_config) do agents.each do |agent| next if agent == master diff --git a/acceptance/tests/windows/QA-506_windows_exit_codes_test.rb b/acceptance/tests/windows/QA-506_windows_exit_codes_test.rb index 70f5337fc3f..a85e3a09edd 100644 --- a/acceptance/tests/windows/QA-506_windows_exit_codes_test.rb +++ b/acceptance/tests/windows/QA-506_windows_exit_codes_test.rb @@ -58,7 +58,7 @@ native_modules_path = on(agent, puppet("config print #{module_path_config_property}")).stdout.gsub('C:', '/cygdrive/c').strip #Check to see if we are running on Windows 2003. Do a crazy hack to get around SCP issues. - if (on(agent, facter("find os.release.major")).stdout =~ /2003/) + if (on(agent, facter("os.release.major")).stdout =~ /2003/) on(agent, "ln -s #{native_modules_path.gsub(/ /, '\ ')} /tmp/puppet_etc") modules_path = '/tmp/puppet_etc' else diff --git a/install.rb b/install.rb index 7ce9d0ac8b7..484e0e3704e 100755 --- a/install.rb +++ b/install.rb @@ -45,7 +45,7 @@ end PREREQS = %w{openssl facter cgi hiera} -MIN_FACTER_VERSION = 1.5 +MIN_FACTER_VERSION = 4.0 InstallOptions = OpenStruct.new diff --git a/lib/puppet/file_serving/mount/file.rb b/lib/puppet/file_serving/mount/file.rb index 095da55a5ee..9679976d9a3 100644 --- a/lib/puppet/file_serving/mount/file.rb +++ b/lib/puppet/file_serving/mount/file.rb @@ -3,12 +3,12 @@ class Puppet::FileServing::Mount::File < Puppet::FileServing::Mount def self.localmap @localmap ||= { - "h" => Facter.value("hostname"), + "h" => Facter.value('networking.hostname'), "H" => [ - Facter.value("hostname"), - Facter.value("domain") + Facter.value('networking.hostname'), + Facter.value('networking.domain') ].join("."), - "d" => Facter.value("domain") + "d" => Facter.value('networking.domain') } end diff --git a/lib/puppet/indirector/catalog/compiler.rb b/lib/puppet/indirector/catalog/compiler.rb index 85f4a56a37b..3e826f0b0f0 100644 --- a/lib/puppet/indirector/catalog/compiler.rb +++ b/lib/puppet/indirector/catalog/compiler.rb @@ -410,9 +410,9 @@ def set_server_facts @server_facts["serverversion"] = Puppet.version.to_s # And then add the server name and IP - {"servername" => "fqdn", - "serverip" => "ipaddress", - "serverip6" => "ipaddress6" + {"servername" => "networking.fqdn", + "serverip" => "networking.ip", + "serverip6" => "networking.ip6" }.each do |var, fact| value = Facter.value(fact) if !value.nil? @@ -421,10 +421,10 @@ def set_server_facts end if @server_facts["servername"].nil? - host = Facter.value(:hostname) + host = Facter.value('networking.hostname') if host.nil? Puppet.warning _("Could not retrieve fact servername") - elsif domain = Facter.value(:domain) #rubocop:disable Lint/AssignmentInCondition + elsif (domain = Facter.value('networking.domain')) @server_facts["servername"] = [host, domain].join(".") else @server_facts["servername"] = host diff --git a/lib/puppet/settings.rb b/lib/puppet/settings.rb index 3b304801207..e73d79298cc 100644 --- a/lib/puppet/settings.rb +++ b/lib/puppet/settings.rb @@ -66,7 +66,7 @@ def self.app_defaults_for_run_mode(run_mode) } end - def self.default_certname() + def self.default_certname hostname = hostname_fact domain = domain_fact if domain and domain != "" @@ -77,12 +77,12 @@ def self.default_certname() fqdn.to_s.gsub(/\.$/, '') end - def self.hostname_fact() - Facter.value :hostname + def self.hostname_fact + Facter.value('networking.hostname') end - def self.domain_fact() - Facter.value :domain + def self.domain_fact + Facter.value('networking.domain') end def self.default_config_file_name diff --git a/spec/unit/file_serving/mount/file_spec.rb b/spec/unit/file_serving/mount/file_spec.rb index 74a7f7c61f3..312a67f46c3 100644 --- a/spec/unit/file_serving/mount/file_spec.rb +++ b/spec/unit/file_serving/mount/file_spec.rb @@ -3,8 +3,8 @@ module FileServingMountTesting def stub_facter(hostname) - allow(Facter).to receive(:value).with("hostname").and_return(hostname.sub(/\..+/, '')) - allow(Facter).to receive(:value).with("domain").and_return(hostname.sub(/^[^.]+\./, '')) + allow(Facter).to receive(:value).with('networking.hostname').and_return(hostname.sub(/\..+/, '')) + allow(Facter).to receive(:value).with('networking.domain').and_return(hostname.sub(/^[^.]+\./, '')) end end diff --git a/spec/unit/indirector/catalog/compiler_spec.rb b/spec/unit/indirector/catalog/compiler_spec.rb index da8bed128c1..18ac4dac501 100644 --- a/spec/unit/indirector/catalog/compiler_spec.rb +++ b/spec/unit/indirector/catalog/compiler_spec.rb @@ -389,10 +389,10 @@ def a_request_that_contains(facts) before do allow(Puppet).to receive(:version).and_return(1) set_facts({ - 'fqdn' => "my.server.com", - 'ipaddress' => "my.ip.address", - 'ipaddress6' => nil - }) + 'networking.fqdn' => "my.server.com", + 'networking.ip' => "my.ip.address", + 'networking.ip6' => nil + }) @request = Puppet::Indirector::Request.new(:catalog, :find, node_name, nil) allow(compiler).to receive(:compile) allow(Puppet::Node.indirection).to receive(:find).with(node_name, anything).and_return(node) @@ -424,16 +424,16 @@ def a_request_that_contains(facts) before do |example| allow(Puppet).to receive(:version).and_return(1) set_facts({ - 'fqdn' => "my.server.com", - 'ipaddress' => nil, + 'networking.fqdn' => "my.server.com", + 'networking.ip' => nil, }) if example.metadata[:nil_ipv6] set_facts({ - 'ipaddress6' => nil + 'networking.ip6' => nil }) else set_facts({ - 'ipaddress6' => "my.ipv6.address" + 'networking.ip6' => "my.ipv6.address" }) end @request = Puppet::Indirector::Request.new(:catalog, :find, node_name, nil) diff --git a/tasks/parallel.rake b/tasks/parallel.rake index 3982f2249c8..184aa90fcb8 100644 --- a/tasks/parallel.rake +++ b/tasks/parallel.rake @@ -401,7 +401,7 @@ else # Default group size in rspec examples DEFAULT_GROUP_SIZE = 1000 - process_count = [(args[:process_count] || Facter.value("processorcount")).to_i, 1].max + process_count = [(args[:process_count] || Facter.value('processors.count')).to_i, 1].max group_size = [(args[:group_size] || DEFAULT_GROUP_SIZE).to_i, 1].max abort unless Parallel::RSpec::Parallelizer.new(process_count, group_size, color_output?, args.extras).run From b9928512cfc00ad62f2c97bbc4f79f6243f859f9 Mon Sep 17 00:00:00 2001 From: Gabriel Nagy Date: Tue, 23 Feb 2021 15:05:10 +0200 Subject: [PATCH 311/731] (PUP-10853) Use structured facts in the providers report --- lib/puppet/reference/providers.rb | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/puppet/reference/providers.rb b/lib/puppet/reference/providers.rb index 52d6def6ffc..ce2b5f6164c 100644 --- a/lib/puppet/reference/providers.rb +++ b/lib/puppet/reference/providers.rb @@ -13,11 +13,10 @@ ret = "Details about this host:\n\n" # Throw some facts in there, so we know where the report is from. - ["Ruby Version", "Puppet Version", "Operating System", "Operating System Release"].each do |label| - name = label.gsub(/\s+/, '') - value = Facter.value(name) - ret << option(label, value) - end + ret << option('Ruby Version', Facter.value('ruby.version')) + ret << option('Puppet Version', Facter.value('puppetversion')) + ret << option('Operating System', Facter.value('os.name')) + ret << option('Operating System Release', Facter.value('os.release.full')) ret << "\n" count = 1 From 7c9a365bfcb609bc721c5df41210275eafe9320a Mon Sep 17 00:00:00 2001 From: Konrad Weihmann Date: Sat, 13 Feb 2021 16:48:53 +0100 Subject: [PATCH 312/731] (maint) add license metadata to gemspec to make it accessible via e.g. rubygems.org and usable by compliance tooling Signed-off-by: Konrad Weihmann --- .gemspec | 1 + 1 file changed, 1 insertion(+) diff --git a/.gemspec b/.gemspec index d7ba60b6158..e882337ebe8 100644 --- a/.gemspec +++ b/.gemspec @@ -25,6 +25,7 @@ Gem::Specification.new do |s| s.email = "puppet@puppetlabs.com" s.executables = ["puppet"] s.files = ["bin/puppet"] + s.license = "Apache-2.0" s.homepage = "https://puppetlabs.com" s.rdoc_options = ["--title", "Puppet - Configuration Management", "--main", "README", "--line-numbers"] s.require_paths = ["lib"] From e972610daa450d1ff083d159506c5c1275837636 Mon Sep 17 00:00:00 2001 From: Gabriel Nagy Date: Mon, 1 Mar 2021 20:13:51 +0200 Subject: [PATCH 313/731] (PUP-10853) Fix structured facts in acceptance tests --- acceptance/tests/direct_puppet/supports_utf8.rb | 2 +- acceptance/tests/reports/corrective_change_new_resource.rb | 2 +- acceptance/tests/reports/corrective_change_outside_puppet.rb | 2 +- acceptance/tests/reports/corrective_change_via_puppet.rb | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/acceptance/tests/direct_puppet/supports_utf8.rb b/acceptance/tests/direct_puppet/supports_utf8.rb index cfc5315f90a..c5d38408ed4 100644 --- a/acceptance/tests/direct_puppet/supports_utf8.rb +++ b/acceptance/tests/direct_puppet/supports_utf8.rb @@ -34,7 +34,7 @@ file { '#{environmentpath}/#{tmp_environment}/manifests/site.pp': ensure => file, content => ' -\$test_path = \$facts['networking']['fqdn'] ? #{tmp_file} +\$test_path = \$facts["networking"]["fqdn"] ? #{tmp_file} file { \$test_path: content => @(UTF8) #{file_contents} diff --git a/acceptance/tests/reports/corrective_change_new_resource.rb b/acceptance/tests/reports/corrective_change_new_resource.rb index 5641b96321e..67cfd58f17b 100644 --- a/acceptance/tests/reports/corrective_change_new_resource.rb +++ b/acceptance/tests/reports/corrective_change_new_resource.rb @@ -36,7 +36,7 @@ file { '#{environmentpath}/#{tmp_environment}/manifests/site.pp': ensure => file, content => ' - \$test_path = \$facts['networking']['fqdn'] ? #{tmp_file} + \$test_path = \$facts["networking"]["fqdn"] ? #{tmp_file} file { \$test_path: content => @(UTF8) #{file_contents} diff --git a/acceptance/tests/reports/corrective_change_outside_puppet.rb b/acceptance/tests/reports/corrective_change_outside_puppet.rb index ddc3dd0c3a5..8aad9a05cee 100644 --- a/acceptance/tests/reports/corrective_change_outside_puppet.rb +++ b/acceptance/tests/reports/corrective_change_outside_puppet.rb @@ -37,7 +37,7 @@ file { '#{environmentpath}/#{tmp_environment}/manifests/site.pp': ensure => file, content => ' - \$test_path = \$facts['networking']['fqdn'] ? #{tmp_file} + \$test_path = \$facts["networking"]["fqdn"] ? #{tmp_file} file { \$test_path: content => @(UTF8) #{file_contents} diff --git a/acceptance/tests/reports/corrective_change_via_puppet.rb b/acceptance/tests/reports/corrective_change_via_puppet.rb index 4097459e141..33f9b933b2d 100644 --- a/acceptance/tests/reports/corrective_change_via_puppet.rb +++ b/acceptance/tests/reports/corrective_change_via_puppet.rb @@ -39,7 +39,7 @@ def create_manifest_for_file_resource(file_resource, file_contents, environment_ file { '#{environmentpath}/#{environment_name}/manifests/site.pp': ensure => file, content => ' - \$test_path = \$facts['networking']['fqdn'] ? #{file_resource} + \$test_path = \$facts["networking"]["fqdn"] ? #{file_resource} file { \$test_path: content => @(UTF8) #{file_contents} From 63c1afa5f35da387bba0b62bbf0e04ba611d7377 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Mon, 1 Mar 2021 19:09:36 +0000 Subject: [PATCH 314/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 2 +- man/man8/puppet-agent.8 | 2 +- man/man8/puppet-apply.8 | 2 +- man/man8/puppet-catalog.8 | 2 +- man/man8/puppet-config.8 | 2 +- man/man8/puppet-describe.8 | 2 +- man/man8/puppet-device.8 | 2 +- man/man8/puppet-doc.8 | 2 +- man/man8/puppet-epp.8 | 2 +- man/man8/puppet-facts.8 | 2 +- man/man8/puppet-filebucket.8 | 2 +- man/man8/puppet-generate.8 | 2 +- man/man8/puppet-help.8 | 2 +- man/man8/puppet-lookup.8 | 2 +- man/man8/puppet-module.8 | 2 +- man/man8/puppet-node.8 | 2 +- man/man8/puppet-parser.8 | 2 +- man/man8/puppet-plugin.8 | 2 +- man/man8/puppet-report.8 | 2 +- man/man8/puppet-resource.8 | 2 +- man/man8/puppet-script.8 | 2 +- man/man8/puppet-ssl.8 | 2 +- man/man8/puppet.8 | 2 +- 23 files changed, 23 insertions(+), 23 deletions(-) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index 2d33b3090d9..8e551ca3146 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPETCONF" "5" "February 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPETCONF" "5" "March 2021" "Puppet, Inc." "Puppet manual" \fBThis page is autogenerated; any changes will get overwritten\fR . .SH "Configuration settings" diff --git a/man/man8/puppet-agent.8 b/man/man8/puppet-agent.8 index 1527a2ef595..7cd4037a63f 100644 --- a/man/man8/puppet-agent.8 +++ b/man/man8/puppet-agent.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-AGENT" "8" "February 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-AGENT" "8" "March 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-agent\fR \- The puppet agent daemon diff --git a/man/man8/puppet-apply.8 b/man/man8/puppet-apply.8 index 3f821b0afc1..3e03e6f1d93 100644 --- a/man/man8/puppet-apply.8 +++ b/man/man8/puppet-apply.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-APPLY" "8" "February 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-APPLY" "8" "March 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-apply\fR \- Apply Puppet manifests locally diff --git a/man/man8/puppet-catalog.8 b/man/man8/puppet-catalog.8 index f9662aff91b..3acb821759a 100644 --- a/man/man8/puppet-catalog.8 +++ b/man/man8/puppet-catalog.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-CATALOG" "8" "February 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-CATALOG" "8" "March 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-catalog\fR \- Compile, save, view, and convert catalogs\. diff --git a/man/man8/puppet-config.8 b/man/man8/puppet-config.8 index e24d5e33547..bcc425150c2 100644 --- a/man/man8/puppet-config.8 +++ b/man/man8/puppet-config.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-CONFIG" "8" "February 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-CONFIG" "8" "March 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-config\fR \- Interact with Puppet\'s settings\. diff --git a/man/man8/puppet-describe.8 b/man/man8/puppet-describe.8 index ee2277c1972..035961aed3e 100644 --- a/man/man8/puppet-describe.8 +++ b/man/man8/puppet-describe.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-DESCRIBE" "8" "February 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-DESCRIBE" "8" "March 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-describe\fR \- Display help about resource types diff --git a/man/man8/puppet-device.8 b/man/man8/puppet-device.8 index f0e769d1bd3..62b2ae079d5 100644 --- a/man/man8/puppet-device.8 +++ b/man/man8/puppet-device.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-DEVICE" "8" "February 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-DEVICE" "8" "March 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-device\fR \- Manage remote network devices diff --git a/man/man8/puppet-doc.8 b/man/man8/puppet-doc.8 index 85bb167600b..7931183f531 100644 --- a/man/man8/puppet-doc.8 +++ b/man/man8/puppet-doc.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-DOC" "8" "February 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-DOC" "8" "March 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-doc\fR \- Generate Puppet references diff --git a/man/man8/puppet-epp.8 b/man/man8/puppet-epp.8 index b8728a9fe96..a65d69d1569 100644 --- a/man/man8/puppet-epp.8 +++ b/man/man8/puppet-epp.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-EPP" "8" "February 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-EPP" "8" "March 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-epp\fR \- Interact directly with the EPP template parser/renderer\. diff --git a/man/man8/puppet-facts.8 b/man/man8/puppet-facts.8 index 719913ea01e..6acdf200f7e 100644 --- a/man/man8/puppet-facts.8 +++ b/man/man8/puppet-facts.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-FACTS" "8" "February 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-FACTS" "8" "March 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-facts\fR \- Retrieve and store facts\. diff --git a/man/man8/puppet-filebucket.8 b/man/man8/puppet-filebucket.8 index 30a0739fd40..aa3324e3623 100644 --- a/man/man8/puppet-filebucket.8 +++ b/man/man8/puppet-filebucket.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-FILEBUCKET" "8" "February 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-FILEBUCKET" "8" "March 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-filebucket\fR \- Store and retrieve files in a filebucket diff --git a/man/man8/puppet-generate.8 b/man/man8/puppet-generate.8 index 39be95a56be..b0b018e2e14 100644 --- a/man/man8/puppet-generate.8 +++ b/man/man8/puppet-generate.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-GENERATE" "8" "February 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-GENERATE" "8" "March 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-generate\fR \- Generates Puppet code from Ruby definitions\. diff --git a/man/man8/puppet-help.8 b/man/man8/puppet-help.8 index 685ad1fb2d1..531623372aa 100644 --- a/man/man8/puppet-help.8 +++ b/man/man8/puppet-help.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-HELP" "8" "February 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-HELP" "8" "March 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-help\fR \- Display Puppet help\. diff --git a/man/man8/puppet-lookup.8 b/man/man8/puppet-lookup.8 index 1b631946f99..5e2e1cc27fe 100644 --- a/man/man8/puppet-lookup.8 +++ b/man/man8/puppet-lookup.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-LOOKUP" "8" "February 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-LOOKUP" "8" "March 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-lookup\fR \- Interactive Hiera lookup diff --git a/man/man8/puppet-module.8 b/man/man8/puppet-module.8 index 3d891b27720..b2aecd8a65b 100644 --- a/man/man8/puppet-module.8 +++ b/man/man8/puppet-module.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-MODULE" "8" "February 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-MODULE" "8" "March 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-module\fR \- Creates, installs and searches for modules on the Puppet Forge\. diff --git a/man/man8/puppet-node.8 b/man/man8/puppet-node.8 index 9ed13996b2e..28d05cd927a 100644 --- a/man/man8/puppet-node.8 +++ b/man/man8/puppet-node.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-NODE" "8" "February 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-NODE" "8" "March 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-node\fR \- View and manage node definitions\. diff --git a/man/man8/puppet-parser.8 b/man/man8/puppet-parser.8 index 7f09071f24f..18a84a6f01f 100644 --- a/man/man8/puppet-parser.8 +++ b/man/man8/puppet-parser.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-PARSER" "8" "February 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-PARSER" "8" "March 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-parser\fR \- Interact directly with the parser\. diff --git a/man/man8/puppet-plugin.8 b/man/man8/puppet-plugin.8 index 85125f76779..bb16b7b6e7e 100644 --- a/man/man8/puppet-plugin.8 +++ b/man/man8/puppet-plugin.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-PLUGIN" "8" "February 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-PLUGIN" "8" "March 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-plugin\fR \- Interact with the Puppet plugin system\. diff --git a/man/man8/puppet-report.8 b/man/man8/puppet-report.8 index 74a43f88c76..cf364abbdd5 100644 --- a/man/man8/puppet-report.8 +++ b/man/man8/puppet-report.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-REPORT" "8" "February 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-REPORT" "8" "March 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-report\fR \- Create, display, and submit reports\. diff --git a/man/man8/puppet-resource.8 b/man/man8/puppet-resource.8 index aaba27e85a5..a963bd71057 100644 --- a/man/man8/puppet-resource.8 +++ b/man/man8/puppet-resource.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-RESOURCE" "8" "February 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-RESOURCE" "8" "March 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-resource\fR \- The resource abstraction layer shell diff --git a/man/man8/puppet-script.8 b/man/man8/puppet-script.8 index 7f5851e1537..2f8891b529a 100644 --- a/man/man8/puppet-script.8 +++ b/man/man8/puppet-script.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-SCRIPT" "8" "February 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-SCRIPT" "8" "March 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-script\fR \- Run a puppet manifests as a script without compiling a catalog diff --git a/man/man8/puppet-ssl.8 b/man/man8/puppet-ssl.8 index b915ef52e5c..810f1f1c990 100644 --- a/man/man8/puppet-ssl.8 +++ b/man/man8/puppet-ssl.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-SSL" "8" "February 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-SSL" "8" "March 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-ssl\fR \- Manage SSL keys and certificates for puppet SSL clients diff --git a/man/man8/puppet.8 b/man/man8/puppet.8 index 596d490dbe0..4faabd48691 100644 --- a/man/man8/puppet.8 +++ b/man/man8/puppet.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET" "8" "February 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET" "8" "March 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\fR From 2056487938e058294ae1362756fab6107bb68abb Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Tue, 2 Mar 2021 13:56:38 +0000 Subject: [PATCH 315/731] (packaging) Updating manpage file for main --- man/man8/puppet-ssl.8 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/man/man8/puppet-ssl.8 b/man/man8/puppet-ssl.8 index 810f1f1c990..7ad03703d84 100644 --- a/man/man8/puppet-ssl.8 +++ b/man/man8/puppet-ssl.8 @@ -52,4 +52,8 @@ Verify the private key and certificate are present and match, verify the certifi .TP clean Remove the private key and certificate related files for this host\. If \fB\-\-localca\fR is specified, then also remove this host\'s local copy of the CA certificate(s) and CRL bundle\. if \fB\-\-target CERTNAME\fR is specified, then remove the files for the specified device on this host instead of this host\. +. +.TP +show +Print the full\-text version of this host\'s certificate\. From 3df444559245c3fd9e3e78f58ade40e256a756ba Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Wed, 3 Mar 2021 13:39:41 +0000 Subject: [PATCH 316/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index 8e551ca3146..8e5b2482d8f 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -288,6 +288,14 @@ Defaults to the node\'s fully qualified domain name\. . .IP "" 0 . +.SS "ciphers" +The list of ciphersuites for TLS connections initiated by puppet\. The default value is chosen to support TLS 1\.0 and up, but can be made more restrictive if needed\. The ciphersuites must be specified in OpenSSL format, not IANA\. +. +.IP "\(bu" 4 +\fIDefault\fR: ECDHE\-ECDSA\-AES128\-GCM\-SHA256:ECDHE\-RSA\-AES128\-GCM\-SHA256:ECDHE\-ECDSA\-AES256\-GCM\-SHA384:ECDHE\-RSA\-AES256\-GCM\-SHA384:ECDHE\-ECDSA\-CHACHA20\-POLY1305:ECDHE\-RSA\-CHACHA20\-POLY1305:DHE\-RSA\-AES128\-GCM\-SHA256:DHE\-RSA\-AES256\-GCM\-SHA384:DHE\-RSA\-CHACHA20\-POLY1305:ECDHE\-ECDSA\-AES128\-SHA256:ECDHE\-RSA\-AES128\-SHA256:ECDHE\-ECDSA\-AES128\-SHA:ECDHE\-RSA\-AES128\-SHA:ECDHE\-ECDSA\-AES256\-SHA384:ECDHE\-RSA\-AES256\-SHA384:ECDHE\-ECDSA\-AES256\-SHA:ECDHE\-RSA\-AES256\-SHA:DHE\-RSA\-AES128\-SHA256:DHE\-RSA\-AES256\-SHA256:AES128\-GCM\-SHA256:AES256\-GCM\-SHA384:AES128\-SHA256:AES256\-SHA256 +. +.IP "" 0 +. .SS "classfile" The file in which puppet agent stores a list of the classes associated with the retrieved configuration\. Can be loaded in the separate \fBpuppet\fR executable using the \fB\-\-loadclasses\fR option\. . From e7e70a8af8b5d5d92068a6503c7dfb5fa0f84b01 Mon Sep 17 00:00:00 2001 From: Justin Stoller Date: Thu, 4 Mar 2021 10:35:07 -0800 Subject: [PATCH 317/731] (PUP-10945) Rename HTTP APIs from master to server Previously, we updated many 'master' terms to 'server'. However, we did not update all of the "internal" references. Puppet Server is also updating its terminology and loads the HTTP APIs as part of its lifecycle. This updates the Puppet Server used HTTP APIs to prefer 'server' to 'master'. --- lib/puppet/network/http.rb | 7 ++- lib/puppet/network/http/api.rb | 16 ++++--- lib/puppet/network/http/api/master.rb | 5 +- lib/puppet/network/http/api/master/v3.rb | 27 +---------- .../http/api/master/v3/environments.rb | 35 +------------- lib/puppet/network/http/api/server.rb | 10 ++++ lib/puppet/network/http/api/server/v3.rb | 39 +++++++++++++++ .../http/api/server/v3/environments.rb | 48 +++++++++++++++++++ 8 files changed, 119 insertions(+), 68 deletions(-) create mode 100644 lib/puppet/network/http/api/server.rb create mode 100644 lib/puppet/network/http/api/server/v3.rb create mode 100644 lib/puppet/network/http/api/server/v3/environments.rb diff --git a/lib/puppet/network/http.rb b/lib/puppet/network/http.rb index 330ce189711..f86b1e17a6e 100644 --- a/lib/puppet/network/http.rb +++ b/lib/puppet/network/http.rb @@ -3,8 +3,11 @@ module Puppet::Network::HTTP HEADER_ENABLE_PROFILING = "X-Puppet-Profiling" HEADER_PUPPET_VERSION = "X-Puppet-Version" - MASTER_URL_PREFIX = "/puppet" - MASTER_URL_VERSIONS = "v3" + SERVER_URL_PREFIX = "/puppet" + SERVER_URL_VERSIONS = "v3" + + MASTER_URL_PREFIX = SERVER_URL_PREFIX + MASTER_URL_VERSIONS = SERVER_URL_VERSIONS CA_URL_PREFIX = "/puppet-ca" CA_URL_VERSIONS = "v1" diff --git a/lib/puppet/network/http/api.rb b/lib/puppet/network/http/api.rb index c21aa962b4e..f5b7d18d620 100644 --- a/lib/puppet/network/http/api.rb +++ b/lib/puppet/network/http/api.rb @@ -18,18 +18,22 @@ def self.not_found_upgrade "Note that Puppet 3 agents aren't compatible with this version; if you're " + "running Puppet 3, you must either upgrade your agents to match the server " + "or point them to a server running Puppet 3.\n\n" + - "Master Info:\n" + + "Server Info:\n" + " Puppet version: #{Puppet.version}\n" + - " Supported /puppet API versions: #{Puppet::Network::HTTP::MASTER_URL_VERSIONS}\n", + " Supported /puppet API versions: #{Puppet::Network::HTTP::SERVER_URL_VERSIONS}\n", Puppet::Network::HTTP::Issues::HANDLER_NOT_FOUND) end) end - def self.master_routes - master_prefix = Regexp.new("^#{Puppet::Network::HTTP::MASTER_URL_PREFIX}/") - Puppet::Network::HTTP::Route.path(master_prefix). + def self.server_routes + server_prefix = Regexp.new("^#{Puppet::Network::HTTP::SERVER_URL_PREFIX}/") + Puppet::Network::HTTP::Route.path(server_prefix). any. - chain(Puppet::Network::HTTP::API::Master::V3.routes, + chain(Puppet::Network::HTTP::API::Server::V3.routes, Puppet::Network::HTTP::API.not_found) end + + def self.master_routes + server_routes + end end diff --git a/lib/puppet/network/http/api/master.rb b/lib/puppet/network/http/api/master.rb index aecebded226..8ad6323240a 100644 --- a/lib/puppet/network/http/api/master.rb +++ b/lib/puppet/network/http/api/master.rb @@ -1,2 +1,3 @@ -module Puppet::Network::HTTP::API::Master -end +require 'puppet/network/http/api/server' + +Puppet::Network::HTTP::API::Master = Puppet::Network::HTTP::API::Server diff --git a/lib/puppet/network/http/api/master/v3.rb b/lib/puppet/network/http/api/master/v3.rb index 3f7342729f8..2460edbfba4 100644 --- a/lib/puppet/network/http/api/master/v3.rb +++ b/lib/puppet/network/http/api/master/v3.rb @@ -1,26 +1,3 @@ -class Puppet::Network::HTTP::API::Master::V3 - require 'puppet/network/http/api/master/v3/environments' - require 'puppet/network/http/api/indirected_routes' +require 'puppet/network/http/api/master' +require 'puppet/network/http/api/server/v3' - def self.wrap(&block) - lambda do |request, response| - Puppet::Network::Authorization.check_external_authorization(request.method, request.path) - - block.call.call(request, response) - end - end - - INDIRECTED = Puppet::Network::HTTP::Route. - path(/.*/). - any(wrap { Puppet::Network::HTTP::API::IndirectedRoutes.new } ) - - ENVIRONMENTS = Puppet::Network::HTTP::Route. - path(%r{^/environments$}). - get(wrap { Environments.new(Puppet.lookup(:environments)) } ) - - def self.routes - Puppet::Network::HTTP::Route.path(%r{v3}). - any. - chain(ENVIRONMENTS, INDIRECTED) - end -end diff --git a/lib/puppet/network/http/api/master/v3/environments.rb b/lib/puppet/network/http/api/master/v3/environments.rb index 8e1d4715304..86c9677b070 100644 --- a/lib/puppet/network/http/api/master/v3/environments.rb +++ b/lib/puppet/network/http/api/master/v3/environments.rb @@ -1,34 +1,3 @@ -require 'puppet/util/json' +require 'puppet/network/http/api/master' +require 'puppet/network/http/api/server/v3/environments' -class Puppet::Network::HTTP::API::Master::V3::Environments - def initialize(env_loader) - @env_loader = env_loader - end - - def call(request, response) - response.respond_with(200, "application/json", Puppet::Util::Json.dump({ - "search_paths" => @env_loader.search_paths, - "environments" => Hash[@env_loader.list.collect do |env| - [env.name, { - "settings" => { - "modulepath" => env.full_modulepath, - "manifest" => env.manifest, - "environment_timeout" => timeout(env), - "config_version" => env.config_version || '', - } - }] - end] - })) - end - - private - - def timeout(env) - ttl = @env_loader.get_conf(env.name).environment_timeout - if ttl == Float::INFINITY - "unlimited" - else - ttl - end - end -end diff --git a/lib/puppet/network/http/api/server.rb b/lib/puppet/network/http/api/server.rb new file mode 100644 index 00000000000..81820c03af4 --- /dev/null +++ b/lib/puppet/network/http/api/server.rb @@ -0,0 +1,10 @@ +module Puppet + module Network + module HTTP + class API + module Server + end + end + end + end +end diff --git a/lib/puppet/network/http/api/server/v3.rb b/lib/puppet/network/http/api/server/v3.rb new file mode 100644 index 00000000000..c172a61d2b6 --- /dev/null +++ b/lib/puppet/network/http/api/server/v3.rb @@ -0,0 +1,39 @@ +require 'puppet/network/http/api/server/v3/environments' +require 'puppet/network/http/api/indirected_routes' + +module Puppet + module Network + module HTTP + class API + module Server + class V3 + + def self.wrap(&block) + lambda do |request, response| + Puppet::Network::Authorization. + check_external_authorization(request.method, + request.path) + + block.call.call(request, response) + end + end + + INDIRECTED = Puppet::Network::HTTP::Route. + path(/.*/). + any(wrap { Puppet::Network::HTTP::API::IndirectedRoutes.new } ) + + ENVIRONMENTS = Puppet::Network::HTTP::Route. + path(%r{^/environments$}). + get(wrap { Environments.new(Puppet.lookup(:environments)) } ) + + def self.routes + Puppet::Network::HTTP::Route.path(%r{v3}). + any. + chain(ENVIRONMENTS, INDIRECTED) + end + end + end + end + end + end +end diff --git a/lib/puppet/network/http/api/server/v3/environments.rb b/lib/puppet/network/http/api/server/v3/environments.rb new file mode 100644 index 00000000000..2fa3233c573 --- /dev/null +++ b/lib/puppet/network/http/api/server/v3/environments.rb @@ -0,0 +1,48 @@ +require 'puppet/util/json' + +module Puppet + module Network + module HTTP + class API + module Server + class V3 + class Environments + + def initialize(env_loader) + @env_loader = env_loader + end + + def call(request, response) + response.respond_with(200, "application/json", Puppet::Util::Json.dump({ + "search_paths" => @env_loader.search_paths, + "environments" => Hash[@env_loader.list.collect do |env| + [env.name, { + "settings" => { + "modulepath" => env.full_modulepath, + "manifest" => env.manifest, + "environment_timeout" => timeout(env), + "config_version" => env.config_version || '', + } + }] + end] + })) + end + + private + + def timeout(env) + ttl = @env_loader.get_conf(env.name).environment_timeout + if ttl == Float::INFINITY + "unlimited" + else + ttl + end + end + end + end + end + end + end + end +end + From 2dbbc492472f896738a269b8b722f3e2e349c98b Mon Sep 17 00:00:00 2001 From: Justin Stoller Date: Thu, 4 Mar 2021 11:18:21 -0800 Subject: [PATCH 318/731] (PUP-10945) Update HTTP tests for terminology change This commit builds on the previous, changing the call sites to prefer the 'server' implementations to the 'master' ones. This change primarily affects tests. An additional test is provided to show that the old usage is still supported. --- spec/unit/network/http/api/master_spec.rb | 38 +++++++++++++++++++ .../v3/environments_spec.rb | 4 +- .../http/api/{master => server}/v3_spec.rb | 38 +++++++++---------- spec/unit/network/http/api_spec.rb | 22 +++++------ 4 files changed, 70 insertions(+), 32 deletions(-) create mode 100644 spec/unit/network/http/api/master_spec.rb rename spec/unit/network/http/api/{master => server}/v3/environments_spec.rb (92%) rename spec/unit/network/http/api/{master => server}/v3_spec.rb (69%) diff --git a/spec/unit/network/http/api/master_spec.rb b/spec/unit/network/http/api/master_spec.rb new file mode 100644 index 00000000000..6795f802eb0 --- /dev/null +++ b/spec/unit/network/http/api/master_spec.rb @@ -0,0 +1,38 @@ +# Tests the backwards compatibility of our master -> server changes +# in the HTTP API +# This may be removed in Puppet 8 +require 'spec_helper' + +require 'puppet/network/http' +require 'puppet_spec/network' + +describe Puppet::Network::HTTP::API::Master::V3 do + include PuppetSpec::Network + + let(:response) { Puppet::Network::HTTP::MemoryResponse.new } + let(:server_url_prefix) { "#{Puppet::Network::HTTP::MASTER_URL_PREFIX}/v3" } + let(:server_routes) { + Puppet::Network::HTTP::Route. + path(Regexp.new("#{Puppet::Network::HTTP::MASTER_URL_PREFIX}/")). + any. + chain(Puppet::Network::HTTP::API::Master::V3.routes) + } + + # simulate puppetserver registering its authconfigloader class + around :each do |example| + Puppet::Network::Authorization.authconfigloader_class = Object + begin + example.run + ensure + Puppet::Network::Authorization.authconfigloader_class = nil + end + end + + it "mounts the environments endpoint" do + request = Puppet::Network::HTTP::Request.from_hash(:path => "#{server_url_prefix}/environments") + server_routes.process(request, response) + + expect(response.code).to eq(200) + end +end + diff --git a/spec/unit/network/http/api/master/v3/environments_spec.rb b/spec/unit/network/http/api/server/v3/environments_spec.rb similarity index 92% rename from spec/unit/network/http/api/master/v3/environments_spec.rb rename to spec/unit/network/http/api/server/v3/environments_spec.rb index eae3cb103f3..a8e5d33b368 100644 --- a/spec/unit/network/http/api/master/v3/environments_spec.rb +++ b/spec/unit/network/http/api/server/v3/environments_spec.rb @@ -4,12 +4,12 @@ require 'puppet/network/http' require 'matchers/json' -describe Puppet::Network::HTTP::API::Master::V3::Environments do +describe Puppet::Network::HTTP::API::Server::V3::Environments do include JSONMatchers let(:environment) { Puppet::Node::Environment.create(:production, ["/first", "/second"], '/manifests') } let(:loader) { Puppet::Environments::Static.new(environment) } - let(:handler) { Puppet::Network::HTTP::API::Master::V3::Environments.new(loader) } + let(:handler) { Puppet::Network::HTTP::API::Server::V3::Environments.new(loader) } let(:request) { Puppet::Network::HTTP::Request.from_hash(:headers => { 'accept' => 'application/json' }) } let(:response) { Puppet::Network::HTTP::MemoryResponse.new } diff --git a/spec/unit/network/http/api/master/v3_spec.rb b/spec/unit/network/http/api/server/v3_spec.rb similarity index 69% rename from spec/unit/network/http/api/master/v3_spec.rb rename to spec/unit/network/http/api/server/v3_spec.rb index a37f4568514..961bc051178 100644 --- a/spec/unit/network/http/api/master/v3_spec.rb +++ b/spec/unit/network/http/api/server/v3_spec.rb @@ -3,16 +3,16 @@ require 'puppet/network/http' require 'puppet_spec/network' -describe Puppet::Network::HTTP::API::Master::V3 do +describe Puppet::Network::HTTP::API::Server::V3 do include PuppetSpec::Network let(:response) { Puppet::Network::HTTP::MemoryResponse.new } - let(:master_url_prefix) { "#{Puppet::Network::HTTP::MASTER_URL_PREFIX}/v3" } - let(:master_routes) { + let(:server_url_prefix) { "#{Puppet::Network::HTTP::SERVER_URL_PREFIX}/v3" } + let(:server_routes) { Puppet::Network::HTTP::Route. - path(Regexp.new("#{Puppet::Network::HTTP::MASTER_URL_PREFIX}/")). + path(Regexp.new("#{Puppet::Network::HTTP::SERVER_URL_PREFIX}/")). any. - chain(Puppet::Network::HTTP::API::Master::V3.routes) + chain(Puppet::Network::HTTP::API::Server::V3.routes) } # simulate puppetserver registering its authconfigloader class @@ -26,53 +26,53 @@ end it "mounts the environments endpoint" do - request = Puppet::Network::HTTP::Request.from_hash(:path => "#{master_url_prefix}/environments") - master_routes.process(request, response) + request = Puppet::Network::HTTP::Request.from_hash(:path => "#{server_url_prefix}/environments") + server_routes.process(request, response) expect(response.code).to eq(200) end it "matches only complete routes" do - request = Puppet::Network::HTTP::Request.from_hash(:path => "#{master_url_prefix}/foo/environments") - expect { master_routes.process(request, response) }.to raise_error(Puppet::Network::HTTP::Error::HTTPNotFoundError) + request = Puppet::Network::HTTP::Request.from_hash(:path => "#{server_url_prefix}/foo/environments") + expect { server_routes.process(request, response) }.to raise_error(Puppet::Network::HTTP::Error::HTTPNotFoundError) - request = Puppet::Network::HTTP::Request.from_hash(:path => "#{master_url_prefix}/foo/environment/production") - expect { master_routes.process(request, response) }.to raise_error(Puppet::Network::HTTP::Error::HTTPNotFoundError) + request = Puppet::Network::HTTP::Request.from_hash(:path => "#{server_url_prefix}/foo/environment/production") + expect { server_routes.process(request, response) }.to raise_error(Puppet::Network::HTTP::Error::HTTPNotFoundError) end it "mounts indirected routes" do request = Puppet::Network::HTTP::Request. - from_hash(:path => "#{master_url_prefix}/node/foo", + from_hash(:path => "#{server_url_prefix}/node/foo", :params => {:environment => "production"}, :headers => {"accept" => "application/json"}) - master_routes.process(request, response) + server_routes.process(request, response) expect(response.code).to eq(200) end it "responds to unknown paths by raising not_found_error" do - request = Puppet::Network::HTTP::Request.from_hash(:path => "#{master_url_prefix}/unknown") + request = Puppet::Network::HTTP::Request.from_hash(:path => "#{server_url_prefix}/unknown") expect { - master_routes.process(request, response) + server_routes.process(request, response) }.to raise_error(not_found_error) end it "checks authorization for indirected routes" do Puppet::Network::Authorization.authconfigloader_class = nil - request = Puppet::Network::HTTP::Request.from_hash(:path => "#{master_url_prefix}/catalog/foo") + request = Puppet::Network::HTTP::Request.from_hash(:path => "#{server_url_prefix}/catalog/foo") expect { - master_routes.process(request, response) + server_routes.process(request, response) }.to raise_error(Puppet::Network::HTTP::Error::HTTPNotAuthorizedError, %r{Not Authorized: Forbidden request: /puppet/v3/catalog/foo \(method GET\)}) end it "checks authorization for environments" do Puppet::Network::Authorization.authconfigloader_class = nil - request = Puppet::Network::HTTP::Request.from_hash(:path => "#{master_url_prefix}/environments") + request = Puppet::Network::HTTP::Request.from_hash(:path => "#{server_url_prefix}/environments") expect { - master_routes.process(request, response) + server_routes.process(request, response) }.to raise_error(Puppet::Network::HTTP::Error::HTTPNotAuthorizedError, %r{Not Authorized: Forbidden request: /puppet/v3/environments \(method GET\)}) end end diff --git a/spec/unit/network/http/api_spec.rb b/spec/unit/network/http/api_spec.rb index 90e5176b466..471de9ec2fd 100644 --- a/spec/unit/network/http/api_spec.rb +++ b/spec/unit/network/http/api_spec.rb @@ -36,12 +36,12 @@ def respond(text) end describe "Puppet API" do - let(:handler) { PuppetSpec::Handler.new(Puppet::Network::HTTP::API.master_routes, + let(:handler) { PuppetSpec::Handler.new(Puppet::Network::HTTP::API.server_routes, Puppet::Network::HTTP::API.not_found_upgrade) } - let(:master_prefix) { Puppet::Network::HTTP::MASTER_URL_PREFIX } + let(:server_prefix) { Puppet::Network::HTTP::SERVER_URL_PREFIX } - it "raises a not-found error for non-CA or master routes and suggests an upgrade" do + it "raises a not-found error for non-CA or server routes and suggests an upgrade" do req = Puppet::Network::HTTP::Request.from_hash(:path => "/unknown") res = {} handler.process(req, res) @@ -50,13 +50,13 @@ def respond(text) end describe "when processing Puppet 3 routes" do - it "gives an upgrade message for master routes" do + it "gives an upgrade message for server routes" do req = Puppet::Network::HTTP::Request.from_hash(:path => "/production/node/foo") res = {} handler.process(req, res) expect(res[:status]).to eq(404) expect(res[:body]).to include("Puppet version: #{Puppet.version}") - expect(res[:body]).to include("Supported /puppet API versions: #{Puppet::Network::HTTP::MASTER_URL_VERSIONS}") + expect(res[:body]).to include("Supported /puppet API versions: #{Puppet::Network::HTTP::SERVER_URL_VERSIONS}") end it "gives an upgrade message for CA routes" do @@ -65,11 +65,11 @@ def respond(text) handler.process(req, res) expect(res[:status]).to eq(404) expect(res[:body]).to include("Puppet version: #{Puppet.version}") - expect(res[:body]).to include("Supported /puppet API versions: #{Puppet::Network::HTTP::MASTER_URL_VERSIONS}") + expect(res[:body]).to include("Supported /puppet API versions: #{Puppet::Network::HTTP::SERVER_URL_VERSIONS}") end end - describe "when processing master routes" do + describe "when processing server routes" do # simulate puppetserver registering its authconfigloader class around :each do |example| Puppet::Network::Authorization.authconfigloader_class = Object @@ -81,7 +81,7 @@ def respond(text) end it "responds to v3 indirector requests" do - req = Puppet::Network::HTTP::Request.from_hash(:path => "#{master_prefix}/v3/node/foo", + req = Puppet::Network::HTTP::Request.from_hash(:path => "#{server_prefix}/v3/node/foo", :params => {:environment => "production"}, :headers => {'accept' => "application/json"}) res = {} @@ -90,18 +90,18 @@ def respond(text) end it "responds to v3 environments requests" do - req = Puppet::Network::HTTP::Request.from_hash(:path => "#{master_prefix}/v3/environments") + req = Puppet::Network::HTTP::Request.from_hash(:path => "#{server_prefix}/v3/environments") res = {} handler.process(req, res) expect(res[:status]).to eq(200) end it "responds with a not found error to non-v3 requests and does not suggest an upgrade" do - req = Puppet::Network::HTTP::Request.from_hash(:path => "#{master_prefix}/unknown") + req = Puppet::Network::HTTP::Request.from_hash(:path => "#{server_prefix}/unknown") res = {} handler.process(req, res) expect(res[:status]).to eq(404) - expect(res[:body]).to include("No route for GET #{master_prefix}/unknown") + expect(res[:body]).to include("No route for GET #{server_prefix}/unknown") expect(res[:body]).not_to include("Puppet version: #{Puppet.version}") end end From 4afb5f0d32fed100f24dd83d181347564794f71e Mon Sep 17 00:00:00 2001 From: Ciprian Badescu Date: Fri, 5 Mar 2021 14:16:47 +0200 Subject: [PATCH 319/731] (PUP-10929) remove unused orchestrator application keywords * application * consumes * produces * site --- lib/puppet/pops/parser/lexer2.rb | 4 -- spec/unit/pops/parser/lexer2_spec.rb | 4 -- .../pops/parser/parse_application_spec.rb | 13 ---- .../pops/parser/parse_capabilities_spec.rb | 23 ------- spec/unit/pops/parser/parse_site_spec.rb | 43 ------------- spec/unit/pops/validator/validator_spec.rb | 63 ++++++------------- 6 files changed, 20 insertions(+), 130 deletions(-) delete mode 100644 spec/unit/pops/parser/parse_application_spec.rb delete mode 100644 spec/unit/pops/parser/parse_capabilities_spec.rb delete mode 100644 spec/unit/pops/parser/parse_site_spec.rb diff --git a/lib/puppet/pops/parser/lexer2.rb b/lib/puppet/pops/parser/lexer2.rb index c80ad123a76..39edb255670 100644 --- a/lib/puppet/pops/parser/lexer2.rb +++ b/lib/puppet/pops/parser/lexer2.rb @@ -134,10 +134,6 @@ class Lexer2 'type' => [:TYPE, 'type', 4], 'attr' => [:ATTR, 'attr', 4], 'private' => [:PRIVATE, 'private', 7], - 'application' => [:APPLICATION, 'application', 11], # reserved - 'consumes' => [:CONSUMES, 'consumes', 8], # reserved - 'produces' => [:PRODUCES, 'produces', 8], # reserved - 'site' => [:SITE, 'site', 4], # reserved } KEYWORDS.each {|k,v| v[1].freeze; v.freeze } diff --git a/spec/unit/pops/parser/lexer2_spec.rb b/spec/unit/pops/parser/lexer2_spec.rb index b7f34db41f6..fddd649676e 100644 --- a/spec/unit/pops/parser/lexer2_spec.rb +++ b/spec/unit/pops/parser/lexer2_spec.rb @@ -94,10 +94,6 @@ def epp_tokens_scanned_from(s) "private" => :PRIVATE, "type" => :TYPE, "attr" => :ATTR, - "application" => :APPLICATION, - "consumes" => :CONSUMES, - "produces" => :PRODUCES, - "site" => :SITE, }.each do |string, name| it "should lex a keyword from '#{string}'" do expect(tokens_scanned_from(string)).to match_tokens2(name) diff --git a/spec/unit/pops/parser/parse_application_spec.rb b/spec/unit/pops/parser/parse_application_spec.rb deleted file mode 100644 index f17e20f063d..00000000000 --- a/spec/unit/pops/parser/parse_application_spec.rb +++ /dev/null @@ -1,13 +0,0 @@ -require 'spec_helper' -require 'puppet/pops' -require_relative 'parser_rspec_helper' - -describe "egrammar parsing of 'application'" do - include ParserRspecHelper - - it "raises a syntax error" do - expect { - parse("application foo { }") - }.to raise_error(Puppet::ParseErrorWithIssue, /Syntax error at 'application' \(line: 1, column: 1\)/) - end -end diff --git a/spec/unit/pops/parser/parse_capabilities_spec.rb b/spec/unit/pops/parser/parse_capabilities_spec.rb deleted file mode 100644 index 4d6b45793f0..00000000000 --- a/spec/unit/pops/parser/parse_capabilities_spec.rb +++ /dev/null @@ -1,23 +0,0 @@ -require 'spec_helper' -require 'puppet/pops' -require_relative 'parser_rspec_helper' - -describe "egrammar parsing of capability mappings" do - include ParserRspecHelper - - context "when parsing 'produces'" do - it "raises syntax error" do - expect { - parse("Foo produces Sql { name => value }") - }.to raise_error(Puppet::ParseErrorWithIssue, /Syntax error at 'produces' \(line: 1, column: 5\)/) - end - end - - context "when parsing 'consumes'" do - it "raises syntax error" do - expect { - parse("Foo consumes Sql { name => value }") - }.to raise_error(Puppet::ParseErrorWithIssue, /Syntax error at 'consumes' \(line: 1, column: 5\)/) - end - end -end diff --git a/spec/unit/pops/parser/parse_site_spec.rb b/spec/unit/pops/parser/parse_site_spec.rb deleted file mode 100644 index c062576d01e..00000000000 --- a/spec/unit/pops/parser/parse_site_spec.rb +++ /dev/null @@ -1,43 +0,0 @@ -require 'spec_helper' -require 'puppet/pops' -require_relative 'parser_rspec_helper' - -describe "egrammar parsing of site expression" do - include ParserRspecHelper - - context "when parsing 'site'" do - it "raises a syntax error" do - expect { - parse("site { }") - }.to raise_error(Puppet::ParseErrorWithIssue, /Syntax error at 'site' \(line: 1, column: 1\)/) - end - end - - context 'When parsing collections containing application management specific keywords' do - %w(application site produces consumes).each do |keyword| - it "disallows the keyword '#{keyword}' in a list" do - expect { - parse("$a = [#{keyword}]") - }.to raise_error(Puppet::ParseErrorWithIssue, /Syntax error at '#{keyword}' \(line: 1, column: 7\)/) - end - - it "disallows the keyword '#{keyword}' as a key in a hash" do - expect { - parse("$a = {#{keyword}=>'x'}") - }.to raise_error(Puppet::ParseErrorWithIssue, /Syntax error at '#{keyword}' \(line: 1, column: 7\)/) - end - - it "disallows the keyword '#{keyword}' as a value in a hash" do - expect { - parse("$a = {'x'=>#{keyword}}") - }.to raise_error(Puppet::ParseErrorWithIssue, /Syntax error at '#{keyword}' \(line: 1, column: 12\)/) - end - - it "disallows the keyword '#{keyword}' as an attribute name" do - expect { - parse("foo { 'x': #{keyword} => 'value' } ") - }.to raise_error(Puppet::ParseErrorWithIssue, /Syntax error at '#{keyword}' \(line: 1, column: 12\)/) - end - end - end -end diff --git a/spec/unit/pops/validator/validator_spec.rb b/spec/unit/pops/validator/validator_spec.rb index 69922f0e23a..be456bacd13 100644 --- a/spec/unit/pops/validator/validator_spec.rb +++ b/spec/unit/pops/validator/validator_spec.rb @@ -344,18 +344,6 @@ def with_environment(environment, env_params = {}) end end - it 'produces a syntax error for application' do - expect { - parse('application test {}') - }.to raise_error(Puppet::ParseErrorWithIssue, /Syntax error at 'application'/) - end - - it 'produces a syntax error for capability mapping' do - expect { - parse('Foo produces Sql {}') - }.to raise_error(Puppet::ParseErrorWithIssue, /Syntax error at 'produces'/) - end - it 'produces an error for collect expressions with virtual query' do acceptor = validate(parse("User <| title == 'admin' |>")) expect(acceptor.error_count).to eql(1) @@ -410,12 +398,6 @@ def with_environment(environment, env_params = {}) expect(acceptor).to have_issue(Puppet::Pops::Issues::EXPRESSION_NOT_SUPPORTED_WHEN_SCRIPTING) end - it 'produces a syntax error for site definitions' do - expect { - parse('site {}') - }.to raise_error(Puppet::ParseErrorWithIssue, /Syntax error at 'site'/) - end - context 'validating apply() blocks' do it 'allows empty apply() blocks' do acceptor = validate(parse('apply("foo.example.com") { }')) @@ -468,18 +450,6 @@ def with_environment(environment, env_params = {}) expect(acceptor.error_count).to eql(0) end - it 'produces a syntax error for application' do - expect { - parse('apply("foo.example.com") { application test {} }') - }.to raise_error(Puppet::ParseErrorWithIssue, /Syntax error at 'application'/) - end - - it 'produces a syntax error for capability mapping' do - expect { - parse('apply("foo.example.com") { Foo produces Sql {} }') - }.to raise_error(Puppet::ParseErrorWithIssue, /Syntax error at 'produces'/) - end - it 'produces an error for class expressions' do acceptor = validate(parse('apply("foo.example.com") { class test {} }')) expect(acceptor.error_count).to eql(1) @@ -503,12 +473,6 @@ def with_environment(environment, env_params = {}) expect(acceptor).to have_issue(Puppet::Pops::Issues::EXPRESSION_NOT_SUPPORTED_WHEN_SCRIPTING) end - it 'produces an error for site definitions' do - expect { - parse('apply("foo.example.com") { site {} }') - }.to raise_error(Puppet::ParseErrorWithIssue, /Syntax error at 'site'/) - end - it 'produces an error for apply() inside apply()' do acceptor = validate(parse('apply("foo.example.com") { apply("foo.example.com") { } }')) expect(acceptor.error_count).to eql(1) @@ -1010,14 +974,27 @@ class foo {} expect(acceptor.errors[2].source_pos.line).to eql(5) end end - end + [ + "application", + "consumes", + "produces", + "site", + ].each do |kw| + it "allow usage of #{kw} keyword (it was reserved in puppet 6.x)" do + source = <<-SOURCE + class foo ( + $#{kw}, + ) { + notice $#{kw} + } + + class { foo: + #{kw} => 'bar' + } + SOURCE - context "capability annotations" do - ['produces', 'consumes'].each do |word| - it "raises a syntax error in #{word} clauses" do - expect { - parse("foo #{word} Bar {}") - }.to raise_error(Puppet::ParseErrorWithIssue, /Syntax error at '#{word}'/) + acceptor = validate(parse(source, 'path/foo/manifests/init.pp')) + expect(acceptor.error_count).to eql(0) end end end From 9f9808d0780f0981a7554e1b43dab8ff9f01791f Mon Sep 17 00:00:00 2001 From: Dorin Pleava Date: Tue, 9 Mar 2021 12:01:44 +0200 Subject: [PATCH 320/731] (PUP-10943) Puppet read registry until WCHAR_NULL On Windows, it is possible to have a registry that contains corrupted data after the WCHAR_NULL characters, that can break puppet when reading the registy. Part of the fix was done in PUP-10536, but when the WCHAR_NULL from the registry is \u0000 instead of \u0000\u0000, the split did not work. Now WCHAR_NULL is forced encoded to UTF-16LE, meaning `\u000` so puppet will now stop at the WCHAR_NULL char. The initial issue can be reproduced by importing file.reg using `reg import .\file.reg` ----file.reg---- Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\PUP105360000] "DisplayName"="PUP105" "DisplayVersion"=hex(2):32,0,0,0,f3,23,8a,bc,fa,7f,0,0,10,65,74,b9,fa,7f,0,0,90,d8,55,6f,59 --- lib/puppet/ffi/windows/api_types.rb | 2 +- spec/integration/util/windows/registry_spec.rb | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/puppet/ffi/windows/api_types.rb b/lib/puppet/ffi/windows/api_types.rb index dd855442306..1fe48151bc8 100644 --- a/lib/puppet/ffi/windows/api_types.rb +++ b/lib/puppet/ffi/windows/api_types.rb @@ -20,7 +20,7 @@ def attach_function_private(*args) class ::FFI::Pointer NULL_HANDLE = 0 - WCHAR_NULL = "\0\0".encode('UTF-16LE').freeze + WCHAR_NULL = "\0\0".force_encoding('UTF-16LE').freeze def self.from_string_to_wide_string(str, &block) str = Puppet::Util::Windows::String.wide_string(str) diff --git a/spec/integration/util/windows/registry_spec.rb b/spec/integration/util/windows/registry_spec.rb index 5fc3e4d543a..e8925ddc464 100644 --- a/spec/integration/util/windows/registry_spec.rb +++ b/spec/integration/util/windows/registry_spec.rb @@ -263,6 +263,12 @@ def write_corrupt_dword(reg, valuename) type: Win32::Registry::REG_EXPAND_SZ, value: "\0\0\0reg expand string", expected_value: "" + }, + { + name: 'REG_EXPAND_SZ_2', + type: Win32::Registry::REG_EXPAND_SZ, + value: "1\x002\x003\x004\x00\x00\x00\x90\xD8UoY".force_encoding("UTF-16LE"), + expected_value: "1234" } ].each do |pair| it 'reads up to the first wide null' do From 916c5a2e9f2ed92f02ed9bfcc9226d9903089eb9 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Tue, 9 Mar 2021 10:24:34 -0800 Subject: [PATCH 321/731] (PUP-10951) Allow splat operator inside overridden resource collectors Commit 8bdaaecdce removed the `when CapabilityMapping` statement, but didn't remove the corresponding issue. I was thinking of Java switch/case, where multiple cases fall through. This makes it possible to use the splat operator to override attributes for collected resources. --- lib/puppet/pops/validation/checker4_0.rb | 1 - spec/integration/parser/collection_spec.rb | 10 ++++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/puppet/pops/validation/checker4_0.rb b/lib/puppet/pops/validation/checker4_0.rb index 65093eaabe0..008b191105d 100644 --- a/lib/puppet/pops/validation/checker4_0.rb +++ b/lib/puppet/pops/validation/checker4_0.rb @@ -236,7 +236,6 @@ def check_AttributesOperation(o) case p when Model::AbstractResource when Model::CollectExpression - acceptor.accept(Issues::UNSUPPORTED_OPERATOR_IN_CONTEXT, p, :operator=>'* =>') else # protect against just testing a snippet that has no parent, error message will be a bit strange # but it is not for a real program. diff --git a/spec/integration/parser/collection_spec.rb b/spec/integration/parser/collection_spec.rb index 256128765ad..52e69282772 100644 --- a/spec/integration/parser/collection_spec.rb +++ b/spec/integration/parser/collection_spec.rb @@ -235,6 +235,16 @@ class theclass { MANIFEST end + it "splats attributes from a hash" do + expect_the_message_to_be(["overridden message"], <<-MANIFEST) + @notify { "testing": message => "original message" } + + Notify <| |> { + * => { message => "overridden message" } + } + MANIFEST + end + it "collects with override when inside a class (#10963)" do expect_the_message_to_be(["overridden message"], <<-MANIFEST) @notify { "testing": message => "original message" } From fae61382e804aa46522a7dc9aae3c1bb8c18a4f6 Mon Sep 17 00:00:00 2001 From: Gabriel Nagy Date: Wed, 10 Mar 2021 11:27:12 +0200 Subject: [PATCH 322/731] Revert "Merge pull request #8492 from GabrielNagy/PUP-10853/remove-legacy-facts" This reverts commit 8660b32739ada447e32722f1e92e7086ce28737c, reversing changes made to c6412ea369aa1613ca166b10fb819fcf6130814b. This also sneakily reverts e972610daa450d1ff083d159506c5c1275837636 by switching back to using legacy facts. When/If we decide to reintroduce this functionality, it should be enough to revert this revert. --- .gemspec | 2 +- .../lib/puppet/acceptance/agent_fqdn_utils.rb | 2 +- acceptance/tests/aix/nim_package_provider.rb | 2 +- acceptance/tests/catalog_with_binary_data.rb | 2 +- .../tests/direct_puppet/supports_utf8.rb | 2 +- acceptance/tests/language/binary_data_type.rb | 2 +- .../tests/language/sensitive_data_type.rb | 2 +- .../autoload_from_resource_type_decl.rb | 2 +- acceptance/tests/lookup/merge_strategies.rb | 6 +- .../parser_functions/hiera_in_templates.rb | 16 +-- .../reports/corrective_change_new_resource.rb | 2 +- .../corrective_change_outside_puppet.rb | 2 +- .../reports/corrective_change_via_puppet.rb | 2 +- .../file/ticket_6448_file_with_utf8_source.rb | 2 +- .../resource/service/service_enable_linux.rb | 2 +- ...et_5024_systemd_enabling_masked_service.rb | 2 +- .../tests/ssl/certificate_extensions.rb | 16 +-- acceptance/tests/ticket_15560_managehome.rb | 2 +- .../windows/QA-506_windows_exit_codes_test.rb | 2 +- ext/project_data.yaml | 2 +- install.rb | 4 +- lib/puppet/confiner.rb | 2 +- lib/puppet/file_serving/mount/file.rb | 8 +- lib/puppet/indirector/catalog/compiler.rb | 10 +- lib/puppet/provider/exec/windows.rb | 4 +- lib/puppet/provider/file/windows.rb | 2 +- lib/puppet/provider/group/aix.rb | 4 +- lib/puppet/provider/group/directoryservice.rb | 4 +- lib/puppet/provider/group/groupadd.rb | 2 +- lib/puppet/provider/group/pw.rb | 4 +- lib/puppet/provider/group/windows_adsi.rb | 4 +- .../provider/nameservice/directoryservice.rb | 6 +- lib/puppet/provider/package/aix.rb | 4 +- lib/puppet/provider/package/appdmg.rb | 4 +- lib/puppet/provider/package/apple.rb | 2 +- lib/puppet/provider/package/apt.rb | 2 +- lib/puppet/provider/package/blastwave.rb | 2 +- lib/puppet/provider/package/dnf.rb | 8 +- lib/puppet/provider/package/freebsd.rb | 2 +- lib/puppet/provider/package/hpux.rb | 4 +- lib/puppet/provider/package/macports.rb | 2 +- lib/puppet/provider/package/openbsd.rb | 4 +- lib/puppet/provider/package/opkg.rb | 4 +- lib/puppet/provider/package/pacman.rb | 4 +- lib/puppet/provider/package/pkg.rb | 6 +- lib/puppet/provider/package/pkgdmg.rb | 4 +- lib/puppet/provider/package/pkgin.rb | 2 +- lib/puppet/provider/package/pkgng.rb | 4 +- lib/puppet/provider/package/pkgutil.rb | 2 +- lib/puppet/provider/package/portage.rb | 4 +- lib/puppet/provider/package/portupgrade.rb | 2 +- lib/puppet/provider/package/rug.rb | 2 +- lib/puppet/provider/package/sun.rb | 4 +- lib/puppet/provider/package/sunfreeware.rb | 2 +- lib/puppet/provider/package/tdnf.rb | 2 +- lib/puppet/provider/package/up2date.rb | 4 +- lib/puppet/provider/package/urpmi.rb | 2 +- lib/puppet/provider/package/windows.rb | 4 +- lib/puppet/provider/package/yum.rb | 6 +- lib/puppet/provider/package/zypper.rb | 4 +- lib/puppet/provider/service/base.rb | 2 +- lib/puppet/provider/service/bsd.rb | 2 +- lib/puppet/provider/service/debian.rb | 6 +- lib/puppet/provider/service/freebsd.rb | 4 +- lib/puppet/provider/service/gentoo.rb | 2 +- lib/puppet/provider/service/init.rb | 10 +- lib/puppet/provider/service/launchd.rb | 8 +- lib/puppet/provider/service/openbsd.rb | 4 +- lib/puppet/provider/service/openrc.rb | 4 +- lib/puppet/provider/service/openwrt.rb | 4 +- lib/puppet/provider/service/rcng.rb | 4 +- lib/puppet/provider/service/redhat.rb | 6 +- lib/puppet/provider/service/smf.rb | 10 +- lib/puppet/provider/service/src.rb | 4 +- lib/puppet/provider/service/systemd.rb | 28 ++--- lib/puppet/provider/service/upstart.rb | 14 +-- lib/puppet/provider/service/windows.rb | 4 +- lib/puppet/provider/user/aix.rb | 4 +- lib/puppet/provider/user/directoryservice.rb | 8 +- lib/puppet/provider/user/hpux.rb | 4 +- lib/puppet/provider/user/openbsd.rb | 4 +- lib/puppet/provider/user/pw.rb | 4 +- lib/puppet/provider/user/user_role_add.rb | 2 +- lib/puppet/provider/user/useradd.rb | 12 +- lib/puppet/provider/user/windows_adsi.rb | 4 +- lib/puppet/reference/providers.rb | 9 +- lib/puppet/settings.rb | 10 +- lib/puppet/type.rb | 2 +- lib/puppet/type/file/source.rb | 2 +- lib/puppet/type/package.rb | 4 +- lib/puppet/type/resources.rb | 2 +- lib/puppet/util/filetype.rb | 4 +- lib/puppet/util/suidmanager.rb | 2 +- .../lib/puppet/provider/a2mod/debian.rb | 2 +- .../jamtur01-apache/manifests/init.pp | 2 +- .../jamtur01-apache/manifests/params.pp | 2 +- .../releases/jamtur01-apache/manifests/ssl.pp | 2 +- .../jamtur01-apache/manifests/vhost.pp | 2 +- spec/integration/type/file_spec.rb | 4 +- spec/integration/type/package_spec.rb | 10 +- spec/shared_examples/rhel_package_provider.rb | 4 +- spec/unit/application/device_spec.rb | 4 +- spec/unit/confine_spec.rb | 12 +- spec/unit/face/epp_face_spec.rb | 4 +- spec/unit/file_bucket/dipper_spec.rb | 4 +- spec/unit/file_serving/mount/file_spec.rb | 4 +- spec/unit/indirector/catalog/compiler_spec.rb | 16 +-- spec/unit/module_tool/tar_spec.rb | 6 +- .../pops/serialization/serialization_spec.rb | 4 +- .../pops/serialization/to_from_hr_spec.rb | 2 +- spec/unit/provider/package/apt_spec.rb | 4 +- spec/unit/provider/package/dnf_spec.rb | 30 ++--- spec/unit/provider/package/dnfmodule_spec.rb | 12 +- spec/unit/provider/package/gem_spec.rb | 4 +- spec/unit/provider/package/pip2_spec.rb | 4 +- spec/unit/provider/package/pip3_spec.rb | 4 +- spec/unit/provider/package/pip_spec.rb | 4 +- spec/unit/provider/package/pkg_spec.rb | 16 +-- spec/unit/provider/package/pkgng_spec.rb | 2 +- spec/unit/provider/package/portage_spec.rb | 4 +- spec/unit/provider/package/puppet_gem_spec.rb | 4 +- .../provider/package/puppetserver_gem_spec.rb | 4 +- spec/unit/provider/package/tdnf_spec.rb | 4 +- spec/unit/provider/package/up2date_spec.rb | 4 +- spec/unit/provider/package/yum_spec.rb | 32 ++--- spec/unit/provider/service/base_spec.rb | 2 +- spec/unit/provider/service/bsd_spec.rb | 4 +- spec/unit/provider/service/debian_spec.rb | 14 +-- spec/unit/provider/service/freebsd_spec.rb | 2 +- spec/unit/provider/service/gentoo_spec.rb | 4 +- spec/unit/provider/service/init_spec.rb | 16 +-- spec/unit/provider/service/openbsd_spec.rb | 4 +- spec/unit/provider/service/openwrt_spec.rb | 2 +- spec/unit/provider/service/rcng_spec.rb | 4 +- spec/unit/provider/service/redhat_spec.rb | 14 +-- spec/unit/provider/service/smf_spec.rb | 16 +-- spec/unit/provider/service/systemd_spec.rb | 114 +++++++++--------- spec/unit/provider/service/upstart_spec.rb | 6 +- .../provider/user/directoryservice_spec.rb | 4 +- spec/unit/provider/user/openbsd_spec.rb | 4 +- spec/unit/provider/user/useradd_spec.rb | 28 ++--- spec/unit/provider_spec.rb | 102 ++++++++-------- spec/unit/type/package_spec.rb | 6 +- spec/unit/type/resources_spec.rb | 4 +- spec/unit/type_spec.rb | 4 +- tasks/parallel.rake | 2 +- 146 files changed, 494 insertions(+), 493 deletions(-) diff --git a/.gemspec b/.gemspec index 28d56598767..e882337ebe8 100644 --- a/.gemspec +++ b/.gemspec @@ -31,7 +31,7 @@ Gem::Specification.new do |s| s.require_paths = ["lib"] s.summary = "Puppet, an automated configuration management tool" s.specification_version = 3 - s.add_runtime_dependency(%q, [">= 4.0.0", "< 5"]) + s.add_runtime_dependency(%q, [">= 2.4.0", "< 5"]) s.add_runtime_dependency(%q, [">= 3.2.1", "< 4"]) s.add_runtime_dependency(%q, "~> 1.0") s.add_runtime_dependency(%q, "~> 1.1") diff --git a/acceptance/lib/puppet/acceptance/agent_fqdn_utils.rb b/acceptance/lib/puppet/acceptance/agent_fqdn_utils.rb index 0934ed79957..84e35ff89f0 100644 --- a/acceptance/lib/puppet/acceptance/agent_fqdn_utils.rb +++ b/acceptance/lib/puppet/acceptance/agent_fqdn_utils.rb @@ -7,7 +7,7 @@ module AgentFqdnUtils # convert from an Beaker::Host (agent) to the systems fqdn as returned by facter def agent_to_fqdn(agent) unless @@hostname_to_fqdn.has_key?(agent.hostname) - @@hostname_to_fqdn[agent.hostname] = on(agent, facter('networking.fqdn')).stdout.chomp + @@hostname_to_fqdn[agent.hostname] = on(agent, facter('fqdn')).stdout.chomp end @@hostname_to_fqdn[agent.hostname] end diff --git a/acceptance/tests/aix/nim_package_provider.rb b/acceptance/tests/aix/nim_package_provider.rb index c6976a818ea..fa78a3feb68 100644 --- a/acceptance/tests/aix/nim_package_provider.rb +++ b/acceptance/tests/aix/nim_package_provider.rb @@ -8,7 +8,7 @@ version = on(aix, 'puppet --version').stdout version && Gem::Version.new(version) > Gem::Version.new('6.4.0') && - on(aix, 'facter os.release.full').stdout == '7.2' + on(aix, 'facter operatingsystemrelease').stdout == '7.2' end teardown do diff --git a/acceptance/tests/catalog_with_binary_data.rb b/acceptance/tests/catalog_with_binary_data.rb index 363d4509445..0c7a9d3a266 100644 --- a/acceptance/tests/catalog_with_binary_data.rb +++ b/acceptance/tests/catalog_with_binary_data.rb @@ -34,7 +34,7 @@ manifest = <<-MANIFEST class #{test_num}( ) { - \$test_path = \$facts['networking']['fqdn'] ? #{agent_tmp_dirs} + \$test_path = \$::fqdn ? #{agent_tmp_dirs} file { '#{test_num}': path => "\$test_path/#{test_num}", content => file('#{test_num}/binary_data'), diff --git a/acceptance/tests/direct_puppet/supports_utf8.rb b/acceptance/tests/direct_puppet/supports_utf8.rb index c5d38408ed4..d120c7bca73 100644 --- a/acceptance/tests/direct_puppet/supports_utf8.rb +++ b/acceptance/tests/direct_puppet/supports_utf8.rb @@ -34,7 +34,7 @@ file { '#{environmentpath}/#{tmp_environment}/manifests/site.pp': ensure => file, content => ' -\$test_path = \$facts["networking"]["fqdn"] ? #{tmp_file} +\$test_path = \$::fqdn ? #{tmp_file} file { \$test_path: content => @(UTF8) #{file_contents} diff --git a/acceptance/tests/language/binary_data_type.rb b/acceptance/tests/language/binary_data_type.rb index 85245a724ba..cee0adbf582 100644 --- a/acceptance/tests/language/binary_data_type.rb +++ b/acceptance/tests/language/binary_data_type.rb @@ -53,7 +53,7 @@ :assertions => { :assert_match => 'Notice: A:\\xF0\\x9F\\x91\\x92' } }, { :type => 'notify', :parameters => { :namevar => "B:${type($bin_file)}" }, :pre_code => '$bin_file=binary_file("empty/blah.txt")', :assertions => { :assert_match => 'Notice: B:Binary' } }, - { :type => 'file', :parameters => { :namevar => "$pup_tmp_filename", :content => "$relaxed" }, :pre_code => "$pup_tmp_filename = if $facts['os']['family'] == 'windows' { '#{tmp_filename_win}' } else { '#{tmp_filename_else}' }", + { :type => 'file', :parameters => { :namevar => "$pup_tmp_filename", :content => "$relaxed" }, :pre_code => "$pup_tmp_filename = if $osfamily == 'windows' { '#{tmp_filename_win}' } else { '#{tmp_filename_else}' }", :assertions => { :assert_match => /#{base64_relaxed}/ } }, ] diff --git a/acceptance/tests/language/sensitive_data_type.rb b/acceptance/tests/language/sensitive_data_type.rb index 7fad2d19291..9bb34be459a 100644 --- a/acceptance/tests/language/sensitive_data_type.rb +++ b/acceptance/tests/language/sensitive_data_type.rb @@ -58,7 +58,7 @@ {:type => 'notify', :parameters => {:namevar => "C:meh", :message => '"C:${$mehC.unwrap |$unwrapped| { "blk_${unwrapped}_blk" } } nonblk_${mehC}_nonblk"'}, :pre_code => '$mehC=Sensitive.new("sekritC")', :assertions => {:assert_match => ["C:blk_sekritC_blk", "nonblk_#{notify_redacted}_nonblk"]}}, # for --show_diff - {:type => 'file', :parameters => {:namevar => "$pup_tmp_filename", :content => "Sensitive.new('sekritD')"}, :pre_code => "$pup_tmp_filename = if $facts['os']['family'] == 'windows' { '#{tmp_filename_win}' } else { '#{tmp_filename_else}' }", + {:type => 'file', :parameters => {:namevar => "$pup_tmp_filename", :content => "Sensitive.new('sekritD')"}, :pre_code => "$pup_tmp_filename = if $osfamily == 'windows' { '#{tmp_filename_win}' } else { '#{tmp_filename_else}' }", :assertions => [{:refute_match => 'sekritD'}, {:assert_match => /#{tmp_environment}\.txt..content. #{file_redacted}/}]}, ] diff --git a/acceptance/tests/loader/autoload_from_resource_type_decl.rb b/acceptance/tests/loader/autoload_from_resource_type_decl.rb index afb815494c9..c2fd7d48694 100644 --- a/acceptance/tests/loader/autoload_from_resource_type_decl.rb +++ b/acceptance/tests/loader/autoload_from_resource_type_decl.rb @@ -41,7 +41,7 @@ def empty_execution_log_file(host, path) custom_type = <<-END Puppet::Type.newtype(:type_tst) do newparam(:name, :namevar => true) do - fqdn = Facter.value('networking.fqdn') + fqdn = Facter.value(:fqdn) if fqdn == '#{agent_to_fqdn(master)}' File.open("#{execution_log[agent_to_fqdn(master)]}", 'a+') { |f| f.puts("found_type_tst: " + Time.now.to_s) } end diff --git a/acceptance/tests/lookup/merge_strategies.rb b/acceptance/tests/lookup/merge_strategies.rb index 214ad0dd4c3..176a2c2d83f 100644 --- a/acceptance/tests/lookup/merge_strategies.rb +++ b/acceptance/tests/lookup/merge_strategies.rb @@ -37,9 +37,9 @@ - "host" - "roles" - "profiles" - - "%{facts.os.name}" - - "%{facts.os.family}" - - "%{facts.kernel}" + - "%{::operatingsystem}" + - "%{::osfamily}" + - "%{::kernel}" - "common" :merge_behavior: deeper :deep_merge_options: diff --git a/acceptance/tests/parser_functions/hiera_in_templates.rb b/acceptance/tests/parser_functions/hiera_in_templates.rb index a7380e7f5e9..9940b169dc7 100644 --- a/acceptance/tests/parser_functions/hiera_in_templates.rb +++ b/acceptance/tests/parser_functions/hiera_in_templates.rb @@ -100,7 +100,7 @@ def create_environment(osfamilies, tmp_dirs) \\$msgs = hiera_array('message') notify {\\$msgs:} class {'#{@module_name}': - result_dir => hiera('result_dir')[\\$facts['networking']['hostname']], + result_dir => hiera('result_dir')[\\$::hostname], } } ", @@ -188,7 +188,7 @@ class #{@module_name} ( file { "#{moduledir}/manifests/mod_default.pp": content => " class #{@module_name}::mod_default { - \\$result_dir = hiera('result_dir')[\\$facts['networking']['hostname']] + \\$result_dir = hiera('result_dir')[\\$::hostname] notify{\\"module mod_default invoked.\\\\n\\":} file {\\\"\\\${result_dir}/mod_default\\\": ensure => 'file', @@ -202,7 +202,7 @@ class #{@module_name}::mod_default { file { "#{moduledir}/manifests/mod_osfamily.pp": content => " class #{@module_name}::mod_osfamily { - \\$result_dir = hiera('result_dir')[\\$facts['networking']['hostname']] + \\$result_dir = hiera('result_dir')[\\$::hostname] notify{\\"module mod_osfamily invoked.\\\\n\\":} file {\\\"\\\${result_dir}/mod_osfamily\\\": ensure => 'file', @@ -216,7 +216,7 @@ class #{@module_name}::mod_osfamily { file { "#{moduledir}/manifests/mod_production.pp": content => " class #{@module_name}::mod_production { - \\$result_dir = hiera('result_dir')[\\$facts['networking']['hostname']] + \\$result_dir = hiera('result_dir')[\\$::hostname] notify{\\"module mod_production invoked.\\\\n\\":} file {\\\"\\\${result_dir}/mod_production\\\": ensure => 'file', @@ -230,7 +230,7 @@ class #{@module_name}::mod_production { file { "#{moduledir}/manifests/mod_fqdn.pp": content => " class #{@module_name}::mod_fqdn { - \\$result_dir = hiera('result_dir')[\\$facts['networking']['hostname']] + \\$result_dir = hiera('result_dir')[\\$::hostname] notify{\\"module mod_fqdn invoked.\\\\n\\":} file {\\\"\\\${result_dir}/mod_fqdn\\\": ensure => 'file', @@ -271,7 +271,7 @@ class #{@module_name}::mod_fqdn { def find_osfamilies family_hash = {} agents.each do |agent| - res = on(agent, facter('os.family')) + res = on(agent, facter("osfamily")) osf = res.stdout.chomp family_hash[osf] = 1 end @@ -282,7 +282,7 @@ def find_tmp_dirs tmp_dirs = "" host_to_result_dir = {} agents.each do |agent| - h = on(agent, facter('networking.hostname')).stdout.chomp + h = on(agent, facter("hostname")).stdout.chomp t = agent.tmpdir("#{@module_name}_results") tmp_dirs += " #{h}: '#{t}'\n" host_to_result_dir[h] = t @@ -304,7 +304,7 @@ def find_tmp_dirs env_manifest = create_environment(find_osfamilies, tmp_dirs) apply_manifest_on(master, env_manifest, :catch_failures => true) agents.each do |agent| - resultdir = host_to_result_dir[on(agent, facter('networking.hostname')).stdout.chomp] + resultdir = host_to_result_dir[on(agent, facter("hostname")).stdout.chomp] step "Applying catalog to agent: #{agent}. result files in #{resultdir}" on( agent, diff --git a/acceptance/tests/reports/corrective_change_new_resource.rb b/acceptance/tests/reports/corrective_change_new_resource.rb index 67cfd58f17b..d33556ee051 100644 --- a/acceptance/tests/reports/corrective_change_new_resource.rb +++ b/acceptance/tests/reports/corrective_change_new_resource.rb @@ -36,7 +36,7 @@ file { '#{environmentpath}/#{tmp_environment}/manifests/site.pp': ensure => file, content => ' - \$test_path = \$facts["networking"]["fqdn"] ? #{tmp_file} + \$test_path = \$::fqdn ? #{tmp_file} file { \$test_path: content => @(UTF8) #{file_contents} diff --git a/acceptance/tests/reports/corrective_change_outside_puppet.rb b/acceptance/tests/reports/corrective_change_outside_puppet.rb index 8aad9a05cee..882a03996a6 100644 --- a/acceptance/tests/reports/corrective_change_outside_puppet.rb +++ b/acceptance/tests/reports/corrective_change_outside_puppet.rb @@ -37,7 +37,7 @@ file { '#{environmentpath}/#{tmp_environment}/manifests/site.pp': ensure => file, content => ' - \$test_path = \$facts["networking"]["fqdn"] ? #{tmp_file} + \$test_path = \$::fqdn ? #{tmp_file} file { \$test_path: content => @(UTF8) #{file_contents} diff --git a/acceptance/tests/reports/corrective_change_via_puppet.rb b/acceptance/tests/reports/corrective_change_via_puppet.rb index 33f9b933b2d..b30e2a6b65c 100644 --- a/acceptance/tests/reports/corrective_change_via_puppet.rb +++ b/acceptance/tests/reports/corrective_change_via_puppet.rb @@ -39,7 +39,7 @@ def create_manifest_for_file_resource(file_resource, file_contents, environment_ file { '#{environmentpath}/#{environment_name}/manifests/site.pp': ensure => file, content => ' - \$test_path = \$facts["networking"]["fqdn"] ? #{file_resource} + \$test_path = \$::fqdn ? #{file_resource} file { \$test_path: content => @(UTF8) #{file_contents} diff --git a/acceptance/tests/resource/file/ticket_6448_file_with_utf8_source.rb b/acceptance/tests/resource/file/ticket_6448_file_with_utf8_source.rb index 6f060e3feb3..bcb307dfee6 100644 --- a/acceptance/tests/resource/file/ticket_6448_file_with_utf8_source.rb +++ b/acceptance/tests/resource/file/ticket_6448_file_with_utf8_source.rb @@ -49,7 +49,7 @@ step 'create a site.pp on master containing a unicode file resource' do site_pp_contents = <<-SITE_PP - \$test_path = \$facts['networking']['fqdn'] ? #{agent_tmp_dirs} + \$test_path = \$::fqdn ? #{agent_tmp_dirs} file { "\$test_path/\uff72\uff67\u30d5\u30eb": ensure => present, source => "puppet:///modules/utf8_file_module/\u9759\u7684", diff --git a/acceptance/tests/resource/service/service_enable_linux.rb b/acceptance/tests/resource/service/service_enable_linux.rb index 647cb921560..b94e3608887 100644 --- a/acceptance/tests/resource/service/service_enable_linux.rb +++ b/acceptance/tests/resource/service/service_enable_linux.rb @@ -22,7 +22,7 @@ agents.each do |agent| platform = agent.platform.variant osname = on(agent, facter('os.name')).stdout.chomp - majrelease = on(agent, facter('os.release.major')).stdout.chomp.to_i + majrelease = on(agent, facter('operatingsystemmajrelease')).stdout.chomp.to_i init_script_systemd = "/usr/lib/systemd/system/#{package_name[platform]}.service" symlink_systemd = "/etc/systemd/system/multi-user.target.wants/#{package_name[platform]}.service" diff --git a/acceptance/tests/resource/service/ticket_5024_systemd_enabling_masked_service.rb b/acceptance/tests/resource/service/ticket_5024_systemd_enabling_masked_service.rb index 642bbb0555c..66abb99019e 100644 --- a/acceptance/tests/resource/service/ticket_5024_systemd_enabling_masked_service.rb +++ b/acceptance/tests/resource/service/ticket_5024_systemd_enabling_masked_service.rb @@ -43,7 +43,7 @@ package { '#{package_name[platform]}': ensure => present, } - if ($os['name'] == 'Fedora') and ($os['release']['major'] == '23') { + if ($::operatingsystem == 'Fedora') and ($::operatingsystemmajrelease == '23') { package{'libnghttp2': ensure => latest, install_options => '--best', diff --git a/acceptance/tests/ssl/certificate_extensions.rb b/acceptance/tests/ssl/certificate_extensions.rb index bbb42826daa..a12fe63fdba 100644 --- a/acceptance/tests/ssl/certificate_extensions.rb +++ b/acceptance/tests/ssl/certificate_extensions.rb @@ -11,17 +11,17 @@ initialize_temp_dirs agent_certnames = [] - hostname = master.execute('facter networking.hostname') - fqdn = master.execute('facter networking.fqdn') + hostname = master.execute('facter hostname') + fqdn = master.execute('facter fqdn') teardown do step "Cleanup the test agent certs" - server_config = { + master_config = { 'main' => { 'server' => fqdn }, - 'server' => { 'dns_alt_names' => "puppet,#{hostname},#{fqdn}" } + 'master' => { 'dns_alt_names' => "puppet,#{hostname},#{fqdn}" } } - with_puppet_running_on(master, server_config) do + with_puppet_running_on(master, master_config) do on(master, "puppetserver ca clean --certname #{agent_certnames.join(',')}", :acceptable_exit_codes => [0,24]) @@ -29,11 +29,11 @@ end environments_dir = get_test_file_path(master, "environments") - server_config = { + master_config = { 'main' => { 'environmentpath' => environments_dir, }, - 'server' => { + 'master' => { 'autosign' => true, 'dns_alt_names' => "puppet,#{hostname},#{fqdn}", } @@ -74,7 +74,7 @@ } MANIFEST - with_puppet_running_on(master, server_config) do + with_puppet_running_on(master, master_config) do agents.each do |agent| next if agent == master diff --git a/acceptance/tests/ticket_15560_managehome.rb b/acceptance/tests/ticket_15560_managehome.rb index f875a1afe11..32ef946d216 100644 --- a/acceptance/tests/ticket_15560_managehome.rb +++ b/acceptance/tests/ticket_15560_managehome.rb @@ -30,7 +30,7 @@ deleteable_profile = true - version = on(host, facter('os.release.full')).stdout.chomp + version = on(host, facter('operatingsystemrelease')).stdout.chomp if version =~ /^5\.[012]|2003/ homedir = "C:/Documents and Settings/#{username}" deleteable_profile = false diff --git a/acceptance/tests/windows/QA-506_windows_exit_codes_test.rb b/acceptance/tests/windows/QA-506_windows_exit_codes_test.rb index a85e3a09edd..e68c41c14c6 100644 --- a/acceptance/tests/windows/QA-506_windows_exit_codes_test.rb +++ b/acceptance/tests/windows/QA-506_windows_exit_codes_test.rb @@ -58,7 +58,7 @@ native_modules_path = on(agent, puppet("config print #{module_path_config_property}")).stdout.gsub('C:', '/cygdrive/c').strip #Check to see if we are running on Windows 2003. Do a crazy hack to get around SCP issues. - if (on(agent, facter("os.release.major")).stdout =~ /2003/) + if (on(agent, facter("find operatingsystemmajrelease")).stdout =~ /2003/) on(agent, "ln -s #{native_modules_path.gsub(/ /, '\ ')} /tmp/puppet_etc") modules_path = '/tmp/puppet_etc' else diff --git a/ext/project_data.yaml b/ext/project_data.yaml index 088773a8d33..7027c6349f3 100644 --- a/ext/project_data.yaml +++ b/ext/project_data.yaml @@ -17,7 +17,7 @@ gem_forge_project: 'puppet' gem_required_ruby_version: '>= 2.5.0' gem_required_rubygems_version: '> 1.3.1' gem_runtime_dependencies: - facter: ['>= 4.0.0', '< 5'] + facter: ['> 2.0.1', '< 5'] hiera: ['>= 3.2.1', '< 4'] semantic_puppet: '~> 1.0' fast_gettext: '~> 1.1' diff --git a/install.rb b/install.rb index 484e0e3704e..5d8c2e9952b 100755 --- a/install.rb +++ b/install.rb @@ -45,7 +45,7 @@ end PREREQS = %w{openssl facter cgi hiera} -MIN_FACTER_VERSION = 4.0 +MIN_FACTER_VERSION = 1.5 InstallOptions = OpenStruct.new @@ -242,7 +242,7 @@ def prepare_installation # Otherwise facter won't be guaranteed to be present. if InstallOptions.check_prereqs check_prereqs - $operatingsystem = Facter.value('os.name') + $operatingsystem = Facter.value :operatingsystem end if not InstallOptions.configdir.nil? diff --git a/lib/puppet/confiner.rb b/lib/puppet/confiner.rb index 39a51d94c4d..50282fd9769 100644 --- a/lib/puppet/confiner.rb +++ b/lib/puppet/confiner.rb @@ -16,7 +16,7 @@ module Puppet::Confiner # * `:any` => an array of expressions that will be ORed together # # @example - # confine 'os.name' => [:redhat, :fedora] + # confine :operatingsystem => [:redhat, :fedora] # confine :true { ... } # # @param hash [Hash<{Symbol => Object}>] hash of confines diff --git a/lib/puppet/file_serving/mount/file.rb b/lib/puppet/file_serving/mount/file.rb index 9679976d9a3..095da55a5ee 100644 --- a/lib/puppet/file_serving/mount/file.rb +++ b/lib/puppet/file_serving/mount/file.rb @@ -3,12 +3,12 @@ class Puppet::FileServing::Mount::File < Puppet::FileServing::Mount def self.localmap @localmap ||= { - "h" => Facter.value('networking.hostname'), + "h" => Facter.value("hostname"), "H" => [ - Facter.value('networking.hostname'), - Facter.value('networking.domain') + Facter.value("hostname"), + Facter.value("domain") ].join("."), - "d" => Facter.value('networking.domain') + "d" => Facter.value("domain") } end diff --git a/lib/puppet/indirector/catalog/compiler.rb b/lib/puppet/indirector/catalog/compiler.rb index 3e826f0b0f0..85f4a56a37b 100644 --- a/lib/puppet/indirector/catalog/compiler.rb +++ b/lib/puppet/indirector/catalog/compiler.rb @@ -410,9 +410,9 @@ def set_server_facts @server_facts["serverversion"] = Puppet.version.to_s # And then add the server name and IP - {"servername" => "networking.fqdn", - "serverip" => "networking.ip", - "serverip6" => "networking.ip6" + {"servername" => "fqdn", + "serverip" => "ipaddress", + "serverip6" => "ipaddress6" }.each do |var, fact| value = Facter.value(fact) if !value.nil? @@ -421,10 +421,10 @@ def set_server_facts end if @server_facts["servername"].nil? - host = Facter.value('networking.hostname') + host = Facter.value(:hostname) if host.nil? Puppet.warning _("Could not retrieve fact servername") - elsif (domain = Facter.value('networking.domain')) + elsif domain = Facter.value(:domain) #rubocop:disable Lint/AssignmentInCondition @server_facts["servername"] = [host, domain].join(".") else @server_facts["servername"] = host diff --git a/lib/puppet/provider/exec/windows.rb b/lib/puppet/provider/exec/windows.rb index b6ff52e9557..422fb23bbb9 100644 --- a/lib/puppet/provider/exec/windows.rb +++ b/lib/puppet/provider/exec/windows.rb @@ -2,8 +2,8 @@ Puppet::Type.type(:exec).provide :windows, :parent => Puppet::Provider::Exec do - confine 'os.name' => :windows - defaultfor 'os.name' => :windows + confine :operatingsystem => :windows + defaultfor :operatingsystem => :windows desc <<-'EOT' Execute external binaries on Windows systems. As with the `posix` diff --git a/lib/puppet/provider/file/windows.rb b/lib/puppet/provider/file/windows.rb index 634b4e37033..4c2b5261273 100644 --- a/lib/puppet/provider/file/windows.rb +++ b/lib/puppet/provider/file/windows.rb @@ -1,7 +1,7 @@ Puppet::Type.type(:file).provide :windows do desc "Uses Microsoft Windows functionality to manage file ownership and permissions." - confine 'os.name' => :windows + confine :operatingsystem => :windows has_feature :manages_symlinks if Puppet.features.manages_symlinks? include Puppet::Util::Warnings diff --git a/lib/puppet/provider/group/aix.rb b/lib/puppet/provider/group/aix.rb index eba84d5a247..68c5441f9b4 100644 --- a/lib/puppet/provider/group/aix.rb +++ b/lib/puppet/provider/group/aix.rb @@ -6,8 +6,8 @@ desc "Group management for AIX." # This will the default provider for this platform - defaultfor 'os.name' => :aix - confine 'os.name' => :aix + defaultfor :operatingsystem => :aix + confine :operatingsystem => :aix # Commands that manage the element commands :list => "/usr/sbin/lsgroup" diff --git a/lib/puppet/provider/group/directoryservice.rb b/lib/puppet/provider/group/directoryservice.rb index cbd9d85c605..35856b898bc 100644 --- a/lib/puppet/provider/group/directoryservice.rb +++ b/lib/puppet/provider/group/directoryservice.rb @@ -6,8 +6,8 @@ " commands :dscl => "/usr/bin/dscl" - confine 'os.name' => :darwin - defaultfor 'os.name' => :darwin + confine :operatingsystem => :darwin + defaultfor :operatingsystem => :darwin has_feature :manages_members def members_insync?(current, should) diff --git a/lib/puppet/provider/group/groupadd.rb b/lib/puppet/provider/group/groupadd.rb index 0843999b106..38aafd6109e 100644 --- a/lib/puppet/provider/group/groupadd.rb +++ b/lib/puppet/provider/group/groupadd.rb @@ -6,7 +6,7 @@ commands :add => "groupadd", :delete => "groupdel", :modify => "groupmod" - has_feature :system_groups unless %w{HP-UX Solaris}.include? Facter.value('os.name') + has_feature :system_groups unless %w{HP-UX Solaris}.include? Facter.value(:operatingsystem) verify :gid, _("GID must be an integer") do |value| value.is_a? Integer diff --git a/lib/puppet/provider/group/pw.rb b/lib/puppet/provider/group/pw.rb index 25dbd2dc7a6..c9ea39de966 100644 --- a/lib/puppet/provider/group/pw.rb +++ b/lib/puppet/provider/group/pw.rb @@ -6,8 +6,8 @@ commands :pw => "pw" has_features :manages_members - defaultfor 'os.name' => [:freebsd, :dragonfly] - confine 'os.name' => [:freebsd, :dragonfly] + defaultfor :operatingsystem => [:freebsd, :dragonfly] + confine :operatingsystem => [:freebsd, :dragonfly] options :members, :flag => "-M", :method => :mem diff --git a/lib/puppet/provider/group/windows_adsi.rb b/lib/puppet/provider/group/windows_adsi.rb index 97f529cf011..b10b350e9c5 100644 --- a/lib/puppet/provider/group/windows_adsi.rb +++ b/lib/puppet/provider/group/windows_adsi.rb @@ -4,8 +4,8 @@ desc "Local group management for Windows. Group members can be both users and groups. Additionally, local groups can contain domain users." - defaultfor 'os.name' => :windows - confine 'os.name' => :windows + defaultfor :operatingsystem => :windows + confine :operatingsystem => :windows has_features :manages_members diff --git a/lib/puppet/provider/nameservice/directoryservice.rb b/lib/puppet/provider/nameservice/directoryservice.rb index 69fe57886fc..1c9c1771e35 100644 --- a/lib/puppet/provider/nameservice/directoryservice.rb +++ b/lib/puppet/provider/nameservice/directoryservice.rb @@ -18,9 +18,9 @@ class << self commands :dscl => "/usr/bin/dscl" commands :dseditgroup => "/usr/sbin/dseditgroup" commands :sw_vers => "/usr/bin/sw_vers" - confine 'os.name' => :darwin - confine :feature => :cfpropertylist - defaultfor 'os.name' => :darwin + confine :operatingsystem => :darwin + confine :feature => :cfpropertylist + defaultfor :operatingsystem => :darwin # There is no generalized mechanism for provider cache management, but we can # use post_resource_eval, which will be run for each suitable provider at the diff --git a/lib/puppet/provider/package/aix.rb b/lib/puppet/provider/package/aix.rb index 57a43bad925..c4f28a4caf9 100644 --- a/lib/puppet/provider/package/aix.rb +++ b/lib/puppet/provider/package/aix.rb @@ -24,8 +24,8 @@ # AIX supports versionable packages with and without a NIM server has_feature :versionable - confine 'os.name' => [ :aix ] - defaultfor 'os.name' => :aix + confine :operatingsystem => [ :aix ] + defaultfor :operatingsystem => :aix attr_accessor :latest_info diff --git a/lib/puppet/provider/package/appdmg.rb b/lib/puppet/provider/package/appdmg.rb index 6ef11f7bdaa..487e7c2aa90 100644 --- a/lib/puppet/provider/package/appdmg.rb +++ b/lib/puppet/provider/package/appdmg.rb @@ -17,8 +17,8 @@ Puppet::Type.type(:package).provide(:appdmg, :parent => Puppet::Provider::Package) do desc "Package management which copies application bundles to a target." - confine 'os.name' => :darwin - confine :feature => :cfpropertylist + confine :operatingsystem => :darwin + confine :feature => :cfpropertylist commands :hdiutil => "/usr/bin/hdiutil" commands :curl => "/usr/bin/curl" diff --git a/lib/puppet/provider/package/apple.rb b/lib/puppet/provider/package/apple.rb index 52bb2bf50bb..1a6cecad720 100644 --- a/lib/puppet/provider/package/apple.rb +++ b/lib/puppet/provider/package/apple.rb @@ -8,7 +8,7 @@ automatically add the `.pkg` extension, so leave that off when specifying the package name." - confine 'os.name' => :darwin + confine :operatingsystem => :darwin commands :installer => "/usr/sbin/installer" def self.instances diff --git a/lib/puppet/provider/package/apt.rb b/lib/puppet/provider/package/apt.rb index 4bba7ebcac3..44967cc0972 100644 --- a/lib/puppet/provider/package/apt.rb +++ b/lib/puppet/provider/package/apt.rb @@ -19,7 +19,7 @@ commands :aptmark => "/usr/bin/apt-mark" commands :preseed => "/usr/bin/debconf-set-selections" - defaultfor 'os.family' => :debian + defaultfor :osfamily => :debian ENV['DEBIAN_FRONTEND'] = "noninteractive" diff --git a/lib/puppet/provider/package/blastwave.rb b/lib/puppet/provider/package/blastwave.rb index 15297a3c85f..1ace40fe0e9 100644 --- a/lib/puppet/provider/package/blastwave.rb +++ b/lib/puppet/provider/package/blastwave.rb @@ -4,7 +4,7 @@ pkgget = "pkg-get" pkgget = "/opt/csw/bin/pkg-get" if FileTest.executable?("/opt/csw/bin/pkg-get") - confine 'os.family' => :solaris + confine :osfamily => :solaris commands :pkgget => pkgget diff --git a/lib/puppet/provider/package/dnf.rb b/lib/puppet/provider/package/dnf.rb index 8eb9e9ceea8..16b6a650f3d 100644 --- a/lib/puppet/provider/package/dnf.rb +++ b/lib/puppet/provider/package/dnf.rb @@ -28,10 +28,10 @@ end end - defaultfor 'os.name' => :fedora - notdefaultfor 'os.name' => :fedora, 'os.release.major' => (19..21).to_a - defaultfor 'os.family' => :redhat - notdefaultfor 'os.family' => :redhat, 'os.release.major' => (4..7).to_a + defaultfor :operatingsystem => :fedora + notdefaultfor :operatingsystem => :fedora, :operatingsystemmajrelease => (19..21).to_a + defaultfor :osfamily => :redhat + notdefaultfor :osfamily => :redhat, :operatingsystemmajrelease => (4..7).to_a def self.update_command # In DNF, update is deprecated for upgrade diff --git a/lib/puppet/provider/package/freebsd.rb b/lib/puppet/provider/package/freebsd.rb index dce936f85e7..305367968fb 100644 --- a/lib/puppet/provider/package/freebsd.rb +++ b/lib/puppet/provider/package/freebsd.rb @@ -9,7 +9,7 @@ :pkgadd => "/usr/sbin/pkg_add", :pkgdelete => "/usr/sbin/pkg_delete" - confine 'os.name' => :freebsd + confine :operatingsystem => :freebsd def self.listcmd command(:pkginfo) diff --git a/lib/puppet/provider/package/hpux.rb b/lib/puppet/provider/package/hpux.rb index d42309523de..4416f010157 100644 --- a/lib/puppet/provider/package/hpux.rb +++ b/lib/puppet/provider/package/hpux.rb @@ -10,9 +10,9 @@ :swlist => "/usr/sbin/swlist", :swremove => "/usr/sbin/swremove" - confine 'os.name' => "hp-ux" + confine :operatingsystem => "hp-ux" - defaultfor 'os.name' => "hp-ux" + defaultfor :operatingsystem => "hp-ux" def self.instances # TODO: This is very hard on HP-UX! diff --git a/lib/puppet/provider/package/macports.rb b/lib/puppet/provider/package/macports.rb index f71e401e545..ea8d2ce45dd 100644 --- a/lib/puppet/provider/package/macports.rb +++ b/lib/puppet/provider/package/macports.rb @@ -12,7 +12,7 @@ Revisions are only used internally for ensuring the latest version/revision of a port. " - confine 'os.name' => :darwin + confine :operatingsystem => :darwin has_command(:port, "/opt/local/bin/port") do environment :HOME => "/opt/local" diff --git a/lib/puppet/provider/package/openbsd.rb b/lib/puppet/provider/package/openbsd.rb index fa1cef1b612..b47a93969bc 100644 --- a/lib/puppet/provider/package/openbsd.rb +++ b/lib/puppet/provider/package/openbsd.rb @@ -13,8 +13,8 @@ :pkgadd => "pkg_add", :pkgdelete => "pkg_delete" - defaultfor 'os.name' => :openbsd - confine 'os.name' => :openbsd + defaultfor :operatingsystem => :openbsd + confine :operatingsystem => :openbsd has_feature :versionable has_feature :install_options diff --git a/lib/puppet/provider/package/opkg.rb b/lib/puppet/provider/package/opkg.rb index afb25a3eb0a..1a110f40384 100644 --- a/lib/puppet/provider/package/opkg.rb +++ b/lib/puppet/provider/package/opkg.rb @@ -5,8 +5,8 @@ commands :opkg => "opkg" - confine 'os.name' => :openwrt - defaultfor 'os.name' => :openwrt + confine :operatingsystem => :openwrt + defaultfor :operatingsystem => :openwrt def self.instances packages = [] diff --git a/lib/puppet/provider/package/pacman.rb b/lib/puppet/provider/package/pacman.rb index 61596f96405..acd3b3ef7ac 100644 --- a/lib/puppet/provider/package/pacman.rb +++ b/lib/puppet/provider/package/pacman.rb @@ -17,8 +17,8 @@ def self.yaourt? # Yaourt is a common AUR helper which, if installed, we can use to query the AUR commands :yaourt => "/usr/bin/yaourt" if yaourt? - confine 'os.name' => [:archlinux, :manjarolinux] - defaultfor 'os.name' => [:archlinux, :manjarolinux] + confine :operatingsystem => [:archlinux, :manjarolinux] + defaultfor :operatingsystem => [:archlinux, :manjarolinux] has_feature :install_options has_feature :uninstall_options has_feature :upgradeable diff --git a/lib/puppet/provider/package/pkg.rb b/lib/puppet/provider/package/pkg.rb index a0e7394ed12..c6777ce5d25 100644 --- a/lib/puppet/provider/package/pkg.rb +++ b/lib/puppet/provider/package/pkg.rb @@ -28,9 +28,9 @@ commands :pkg => "/usr/bin/pkg" - confine 'os.family' => :solaris + confine :osfamily => :solaris - defaultfor 'os.family' => :solaris, :kernelrelease => ['5.11', '5.12'] + defaultfor :osfamily => :solaris, :kernelrelease => ['5.11', '5.12'] def self.instances pkg(:list, '-Hv').split("\n").map{|l| new(parse_line(l))} @@ -221,7 +221,7 @@ def install(nofail = false) command = 'update' end args = ['--accept'] - if Puppet::Util::Package.versioncmp(Facter.value('os.release.full'), '11.2') >= 0 + if Puppet::Util::Package.versioncmp(Facter.value(:operatingsystemrelease), '11.2') >= 0 args.push('--sync-actuators-timeout', '900') end args.concat(join_options(@resource[:install_options])) if @resource[:install_options] diff --git a/lib/puppet/provider/package/pkgdmg.rb b/lib/puppet/provider/package/pkgdmg.rb index e14a7906063..c673d443bab 100644 --- a/lib/puppet/provider/package/pkgdmg.rb +++ b/lib/puppet/provider/package/pkgdmg.rb @@ -35,9 +35,9 @@ whether a package has been installed. Thus, to install new a version of a package, you must create a new DMG with a different filename." - confine 'os.name' => :darwin + confine :operatingsystem => :darwin confine :feature => :cfpropertylist - defaultfor 'os.name' => :darwin + defaultfor :operatingsystem => :darwin commands :installer => "/usr/sbin/installer" commands :hdiutil => "/usr/bin/hdiutil" commands :curl => "/usr/bin/curl" diff --git a/lib/puppet/provider/package/pkgin.rb b/lib/puppet/provider/package/pkgin.rb index 3d5ee0142bf..8f2d7ef4911 100644 --- a/lib/puppet/provider/package/pkgin.rb +++ b/lib/puppet/provider/package/pkgin.rb @@ -5,7 +5,7 @@ commands :pkgin => "pkgin" - defaultfor 'os.name' => [ :smartos, :netbsd ] + defaultfor :operatingsystem => [ :smartos, :netbsd ] has_feature :installable, :uninstallable, :upgradeable, :versionable diff --git a/lib/puppet/provider/package/pkgng.rb b/lib/puppet/provider/package/pkgng.rb index 6e9e0ee2599..d8e5b0fe91e 100644 --- a/lib/puppet/provider/package/pkgng.rb +++ b/lib/puppet/provider/package/pkgng.rb @@ -5,9 +5,9 @@ commands :pkg => "/usr/local/sbin/pkg" - confine 'os.name' => [:freebsd, :dragonfly] + confine :operatingsystem => [:freebsd, :dragonfly] - defaultfor 'os.name' => [:freebsd, :dragonfly] + defaultfor :operatingsystem => [:freebsd, :dragonfly] has_feature :versionable has_feature :upgradeable diff --git a/lib/puppet/provider/package/pkgutil.rb b/lib/puppet/provider/package/pkgutil.rb index 1663e823c0c..d0815e0260e 100644 --- a/lib/puppet/provider/package/pkgutil.rb +++ b/lib/puppet/provider/package/pkgutil.rb @@ -7,7 +7,7 @@ pkgutil_bin = "/opt/csw/bin/pkgutil" end - confine 'os.family' => :solaris + confine :osfamily => :solaris has_command(:pkguti, pkgutil_bin) do environment :HOME => ENV['HOME'] diff --git a/lib/puppet/provider/package/portage.rb b/lib/puppet/provider/package/portage.rb index a8fd2f88d15..3f463beeda3 100644 --- a/lib/puppet/provider/package/portage.rb +++ b/lib/puppet/provider/package/portage.rb @@ -20,9 +20,9 @@ end end - confine 'os.family' => :gentoo + confine :osfamily => :gentoo - defaultfor 'os.family' => :gentoo + defaultfor :osfamily => :gentoo def self.instances result_format = self.eix_result_format diff --git a/lib/puppet/provider/package/portupgrade.rb b/lib/puppet/provider/package/portupgrade.rb index be5c6f60fba..7c1a81cddc4 100644 --- a/lib/puppet/provider/package/portupgrade.rb +++ b/lib/puppet/provider/package/portupgrade.rb @@ -18,7 +18,7 @@ :portinfo => "/usr/sbin/pkg_info" ## Activate this only once approved by someone important. - # defaultfor 'os.name' => :freebsd + # defaultfor :operatingsystem => :freebsd # Remove unwanted environment variables. %w{INTERACTIVE UNAME}.each do |var| diff --git a/lib/puppet/provider/package/rug.rb b/lib/puppet/provider/package/rug.rb index aa7e7cc247f..5cb2945fe0b 100644 --- a/lib/puppet/provider/package/rug.rb +++ b/lib/puppet/provider/package/rug.rb @@ -5,7 +5,7 @@ commands :rug => "/usr/bin/rug" commands :rpm => "rpm" - confine 'os.name' => [:suse, :sles] + confine :operatingsystem => [:suse, :sles] # Install a package using 'rug'. def install diff --git a/lib/puppet/provider/package/sun.rb b/lib/puppet/provider/package/sun.rb index 70852cfd210..20bf708a919 100644 --- a/lib/puppet/provider/package/sun.rb +++ b/lib/puppet/provider/package/sun.rb @@ -14,8 +14,8 @@ :pkgadd => "/usr/sbin/pkgadd", :pkgrm => "/usr/sbin/pkgrm" - confine 'os.family' => :solaris - defaultfor 'os.family' => :solaris + confine :osfamily => :solaris + defaultfor :osfamily => :solaris has_feature :install_options diff --git a/lib/puppet/provider/package/sunfreeware.rb b/lib/puppet/provider/package/sunfreeware.rb index d4473401851..118d36b66e9 100644 --- a/lib/puppet/provider/package/sunfreeware.rb +++ b/lib/puppet/provider/package/sunfreeware.rb @@ -5,5 +5,5 @@ has not actually been tested." commands :pkgget => "pkg-get" - confine 'os.family' => :solaris + confine :osfamily => :solaris end diff --git a/lib/puppet/provider/package/tdnf.rb b/lib/puppet/provider/package/tdnf.rb index 4c17313c838..c633d58bbe5 100644 --- a/lib/puppet/provider/package/tdnf.rb +++ b/lib/puppet/provider/package/tdnf.rb @@ -24,5 +24,5 @@ end end - defaultfor 'os.name' => "PhotonOS" + defaultfor :operatingsystem => "PhotonOS" end diff --git a/lib/puppet/provider/package/up2date.rb b/lib/puppet/provider/package/up2date.rb index 6c998879c7a..d9eafbe25dc 100644 --- a/lib/puppet/provider/package/up2date.rb +++ b/lib/puppet/provider/package/up2date.rb @@ -4,9 +4,9 @@ commands :up2date => "/usr/sbin/up2date-nox" - defaultfor 'os.family' => :redhat, 'os.distro.release.full' => ["2.1", "3", "4"] + defaultfor :osfamily => :redhat, :lsbdistrelease => ["2.1", "3", "4"] - confine 'os.family' => :redhat + confine :osfamily => :redhat # Install a package using 'up2date'. def install diff --git a/lib/puppet/provider/package/urpmi.rb b/lib/puppet/provider/package/urpmi.rb index d396c5df02c..32a049582bc 100644 --- a/lib/puppet/provider/package/urpmi.rb +++ b/lib/puppet/provider/package/urpmi.rb @@ -2,7 +2,7 @@ desc "Support via `urpmi`." commands :urpmi => "urpmi", :urpmq => "urpmq", :rpm => "rpm", :urpme => "urpme" - defaultfor 'os.name' => [:mandriva, :mandrake] + defaultfor :operatingsystem => [:mandriva, :mandrake] has_feature :versionable diff --git a/lib/puppet/provider/package/windows.rb b/lib/puppet/provider/package/windows.rb index 19fc155ed38..09de9bd2fe1 100644 --- a/lib/puppet/provider/package/windows.rb +++ b/lib/puppet/provider/package/windows.rb @@ -20,8 +20,8 @@ `install_options` or `uninstall_options` attributes, respectively. Puppet will automatically quote any option that contains spaces." - confine 'os.name' => :windows - defaultfor 'os.name' => :windows + confine :operatingsystem => :windows + defaultfor :operatingsystem => :windows has_feature :installable has_feature :uninstallable diff --git a/lib/puppet/provider/package/yum.rb b/lib/puppet/provider/package/yum.rb index 4fe85b8d8dc..e26083f40e0 100644 --- a/lib/puppet/provider/package/yum.rb +++ b/lib/puppet/provider/package/yum.rb @@ -32,8 +32,8 @@ end end -defaultfor 'os.name' => :amazon -defaultfor 'os.family' => :redhat, 'os.release.major' => (4..7).to_a +defaultfor :operatingsystem => :amazon +defaultfor :osfamily => :redhat, :operatingsystemmajrelease => (4..7).to_a def insync?(is) return false if [:purged, :absent].include?(is) @@ -298,7 +298,7 @@ def install # Yum on el-4 and el-5 returns exit status 0 when trying to install a package it doesn't recognize; # ensure we capture output to check for errors. - no_debug = if Facter.value('os.release.major').to_i > 5 then ["-d", "0"] else [] end + no_debug = if Facter.value(:operatingsystemmajrelease).to_i > 5 then ["-d", "0"] else [] end command = [command(:cmd)] + no_debug + ["-e", error_level, "-y", install_options, operation, wanted].compact output = execute(command) diff --git a/lib/puppet/provider/package/zypper.rb b/lib/puppet/provider/package/zypper.rb index 0033955b38c..5f5d6016d18 100644 --- a/lib/puppet/provider/package/zypper.rb +++ b/lib/puppet/provider/package/zypper.rb @@ -9,8 +9,8 @@ commands :zypper => "/usr/bin/zypper" - defaultfor 'os.name' => [:suse, :sles, :sled, :opensuse] - confine 'os.name' => [:suse, :sles, :sled, :opensuse] + defaultfor :operatingsystem => [:suse, :sles, :sled, :opensuse] + confine :operatingsystem => [:suse, :sles, :sled, :opensuse] # @api private # Reset the latest version hash to nil diff --git a/lib/puppet/provider/service/base.rb b/lib/puppet/provider/service/base.rb index a1ca816cc5c..9576398597e 100644 --- a/lib/puppet/provider/service/base.rb +++ b/lib/puppet/provider/service/base.rb @@ -15,7 +15,7 @@ # ported from the facter 2.x implementation, since facter 3.x # is dropping the fact (for which this was the only use) def getps - case Facter.value('os.name') + case Facter.value(:operatingsystem) when 'OpenWrt' 'ps www' when 'FreeBSD', 'NetBSD', 'OpenBSD', 'Darwin', 'DragonFly' diff --git a/lib/puppet/provider/service/bsd.rb b/lib/puppet/provider/service/bsd.rb index 688994531c1..146d048d557 100644 --- a/lib/puppet/provider/service/bsd.rb +++ b/lib/puppet/provider/service/bsd.rb @@ -5,7 +5,7 @@ Uses `rc.conf.d` for service enabling and disabling. EOT - confine 'os.name' => [:freebsd, :dragonfly] + confine :operatingsystem => [:freebsd, :dragonfly] def rcconf_dir '/etc/rc.conf.d' diff --git a/lib/puppet/provider/service/debian.rb b/lib/puppet/provider/service/debian.rb index ce0a448f2f0..9352f3b005a 100644 --- a/lib/puppet/provider/service/debian.rb +++ b/lib/puppet/provider/service/debian.rb @@ -19,9 +19,9 @@ confine :false => Puppet::FileSystem.exist?('/proc/1/comm') && Puppet::FileSystem.read('/proc/1/comm').include?('systemd') - defaultfor 'os.name' => :cumuluslinux, 'os.release.major' => ['1','2'] - defaultfor 'os.name' => :debian, 'os.release.major' => ['5','6','7'] - defaultfor 'os.name' => :devuan + defaultfor :operatingsystem => :cumuluslinux, :operatingsystemmajrelease => ['1','2'] + defaultfor :operatingsystem => :debian, :operatingsystemmajrelease => ['5','6','7'] + defaultfor :operatingsystem => :devuan # Remove the symlinks def disable diff --git a/lib/puppet/provider/service/freebsd.rb b/lib/puppet/provider/service/freebsd.rb index cfc520b2998..9ad46053056 100644 --- a/lib/puppet/provider/service/freebsd.rb +++ b/lib/puppet/provider/service/freebsd.rb @@ -2,8 +2,8 @@ desc "Provider for FreeBSD and DragonFly BSD. Uses the `rcvar` argument of init scripts and parses/edits rc files." - confine 'os.name' => [:freebsd, :dragonfly] - defaultfor 'os.name' => [:freebsd, :dragonfly] + confine :operatingsystem => [:freebsd, :dragonfly] + defaultfor :operatingsystem => [:freebsd, :dragonfly] def rcconf() '/etc/rc.conf' end def rcconf_local() '/etc/rc.conf.local' end diff --git a/lib/puppet/provider/service/gentoo.rb b/lib/puppet/provider/service/gentoo.rb index 3f38fc2042c..4fecbde9dac 100644 --- a/lib/puppet/provider/service/gentoo.rb +++ b/lib/puppet/provider/service/gentoo.rb @@ -10,7 +10,7 @@ commands :update => "/sbin/rc-update" - confine 'os.name' => :gentoo + confine :operatingsystem => :gentoo def disable output = update :del, @resource[:name], :default diff --git a/lib/puppet/provider/service/init.rb b/lib/puppet/provider/service/init.rb index b4378825fb9..3ab27b33224 100644 --- a/lib/puppet/provider/service/init.rb +++ b/lib/puppet/provider/service/init.rb @@ -4,7 +4,7 @@ desc "Standard `init`-style service management." def self.defpath - case Facter.value('os.name') + case Facter.value(:operatingsystem) when "FreeBSD", "DragonFly" ["/etc/rc.d", "/usr/local/etc/rc.d"] when "HP-UX" @@ -21,8 +21,8 @@ def self.defpath # Debian and Ubuntu should use the Debian provider. # RedHat systems should use the RedHat provider. confine :true => begin - os = Facter.value('os.name').downcase - family = Facter.value('os.family').downcase + os = Facter.value(:operatingsystem).downcase + family = Facter.value(:osfamily).downcase !(os == 'debian' || os == 'ubuntu' || family == 'redhat') end @@ -54,7 +54,7 @@ def self.excludes # these excludes were found with grep -r -L start /etc/init.d excludes += %w{rcS module-init-tools} # Prevent puppet failing on unsafe scripts from Yocto Linux - if Facter.value('os.family') == "cisco-wrlinux" + if Facter.value(:osfamily) == "cisco-wrlinux" excludes += %w{banner.sh bootmisc.sh checkroot.sh devpts.sh dmesg.sh hostname.sh mountall.sh mountnfs.sh populate-volatile.sh rmnologin.sh save-rtc.sh sendsigs sysfs.sh umountfs @@ -171,7 +171,7 @@ def restartcmd end def texecute(type, command, fof = true, squelch = false, combine = true) - if type == :start && Facter.value('os.family') == "Solaris" + if type == :start && Facter.value(:osfamily) == "Solaris" command = ["/usr/bin/ctrun -l child", command].flatten.join(" ") end super(type, command, fof, squelch, combine) diff --git a/lib/puppet/provider/service/launchd.rb b/lib/puppet/provider/service/launchd.rb index 409c60bb4c1..bde8535cb13 100644 --- a/lib/puppet/provider/service/launchd.rb +++ b/lib/puppet/provider/service/launchd.rb @@ -42,9 +42,9 @@ commands :launchctl => "/bin/launchctl" - defaultfor 'os.name' => :darwin - confine 'os.name' => :darwin - confine :feature => :cfpropertylist + defaultfor :operatingsystem => :darwin + confine :operatingsystem => :darwin + confine :feature => :cfpropertylist has_feature :enableable has_feature :refreshable @@ -70,7 +70,7 @@ def self.launchd_paths # # @api private def self.get_os_version - @os_version ||= Facter.value('os.release.major').to_i + @os_version ||= Facter.value(:operatingsystemmajrelease).to_i end # Defines the path to the overrides plist file where service enabling diff --git a/lib/puppet/provider/service/openbsd.rb b/lib/puppet/provider/service/openbsd.rb index 7a4f2c8d50b..34a7382d42a 100644 --- a/lib/puppet/provider/service/openbsd.rb +++ b/lib/puppet/provider/service/openbsd.rb @@ -4,8 +4,8 @@ commands :rcctl => '/usr/sbin/rcctl' - confine 'os.name' => :openbsd - defaultfor 'os.name' => :openbsd + confine :operatingsystem => :openbsd + defaultfor :operatingsystem => :openbsd has_feature :flaggable def startcmd diff --git a/lib/puppet/provider/service/openrc.rb b/lib/puppet/provider/service/openrc.rb index f6c91bfd621..8243f651e87 100644 --- a/lib/puppet/provider/service/openrc.rb +++ b/lib/puppet/provider/service/openrc.rb @@ -7,8 +7,8 @@ EOT - defaultfor 'os.name' => :gentoo - defaultfor 'os.name' => :funtoo + defaultfor :operatingsystem => :gentoo + defaultfor :operatingsystem => :funtoo has_command(:rcstatus, '/bin/rc-status') do environment :RC_SVCNAME => nil diff --git a/lib/puppet/provider/service/openwrt.rb b/lib/puppet/provider/service/openwrt.rb index 2f8f93db14e..f1171275672 100644 --- a/lib/puppet/provider/service/openwrt.rb +++ b/lib/puppet/provider/service/openwrt.rb @@ -6,8 +6,8 @@ EOT - defaultfor 'os.name' => :openwrt - confine 'os.name' => :openwrt + defaultfor :operatingsystem => :openwrt + confine :operatingsystem => :openwrt has_feature :enableable diff --git a/lib/puppet/provider/service/rcng.rb b/lib/puppet/provider/service/rcng.rb index 47d914c4828..5e5d16bde4e 100644 --- a/lib/puppet/provider/service/rcng.rb +++ b/lib/puppet/provider/service/rcng.rb @@ -3,8 +3,8 @@ RCng service management with rc.d EOT - defaultfor 'os.name' => [:netbsd, :cargos] - confine 'os.name' => [:netbsd, :cargos] + defaultfor :operatingsystem => [:netbsd, :cargos] + confine :operatingsystem => [:netbsd, :cargos] def self.defpath "/etc/rc.d" diff --git a/lib/puppet/provider/service/redhat.rb b/lib/puppet/provider/service/redhat.rb index bee68750c57..20c6afe0e80 100644 --- a/lib/puppet/provider/service/redhat.rb +++ b/lib/puppet/provider/service/redhat.rb @@ -8,8 +8,8 @@ commands :chkconfig => "/sbin/chkconfig", :service => "/sbin/service" - defaultfor 'os.family' => :redhat - defaultfor 'os.family' => :suse, 'os.release.major' => ["10", "11"] + defaultfor :osfamily => :redhat + defaultfor :osfamily => :suse, :operatingsystemmajrelease => ["10", "11"] # Remove the symlinks def disable @@ -35,7 +35,7 @@ def enabled? # For Suse OS family, chkconfig returns 0 even if the service is disabled or non-existent # Therefore, check the output for ' on' (or ' B for boot services) # to see if it is enabled - return :false unless Facter.value('os.family') != 'Suse' || output =~ /^#{name}\s+(on|B)$/ + return :false unless Facter.value(:osfamily) != 'Suse' || output =~ /^#{name}\s+(on|B)$/ :true end diff --git a/lib/puppet/provider/service/smf.rb b/lib/puppet/provider/service/smf.rb index bd1009c79df..50244c91305 100644 --- a/lib/puppet/provider/service/smf.rb +++ b/lib/puppet/provider/service/smf.rb @@ -18,9 +18,9 @@ be imported if it does not exist. EOT - defaultfor 'os.family' => :solaris + defaultfor :osfamily => :solaris - confine 'os.family' => :solaris + confine :osfamily => :solaris commands :adm => "/usr/sbin/svcadm", :svcs => "/usr/bin/svcs", @@ -125,14 +125,14 @@ def service_fmri # Returns true if the provider supports incomplete services. def supports_incomplete_services? - Puppet::Util::Package.versioncmp(Facter.value('os.release.full'), '11.1') >= 0 + Puppet::Util::Package.versioncmp(Facter.value(:operatingsystemrelease), '11.1') >= 0 end # Returns true if the service is complete. A complete service is a service that # has the general/complete property defined. def complete_service? unless supports_incomplete_services? - raise Puppet::Error, _("Cannot query if the %{service} service is complete: The concept of complete/incomplete services was introduced in Solaris 11.1. You are on a Solaris %{release} machine.") % { service: @resource[:name], release: Facter.value('os.release.full') } + raise Puppet::Error, _("Cannot query if the %{service} service is complete: The concept of complete/incomplete services was introduced in Solaris 11.1. You are on a Solaris %{release} machine.") % { service: @resource[:name], release: Facter.value(:operatingsystemrelease) } end return @complete_service if @complete_service @@ -162,7 +162,7 @@ def disable end def restartcmd - if Puppet::Util::Package.versioncmp(Facter.value('os.release.full'), '11.2') >= 0 + if Puppet::Util::Package.versioncmp(Facter.value(:operatingsystemrelease), '11.2') >= 0 [command(:adm), :restart, "-s", self.service_fmri] else # Synchronous restart only supported in Solaris 11.2 and above diff --git a/lib/puppet/provider/service/src.rb b/lib/puppet/provider/service/src.rb index acbf4ceb1f7..8276598769b 100644 --- a/lib/puppet/provider/service/src.rb +++ b/lib/puppet/provider/service/src.rb @@ -13,8 +13,8 @@ is not yet supported. " - defaultfor 'os.name' => :aix - confine 'os.name' => :aix + defaultfor :operatingsystem => :aix + confine :operatingsystem => :aix optional_commands :stopsrc => "/usr/bin/stopsrc", :startsrc => "/usr/bin/startsrc", diff --git a/lib/puppet/provider/service/systemd.rb b/lib/puppet/provider/service/systemd.rb index 0277e882afe..6408f8cfb77 100644 --- a/lib/puppet/provider/service/systemd.rb +++ b/lib/puppet/provider/service/systemd.rb @@ -13,19 +13,19 @@ confine :true => Puppet::FileSystem.exist?('/proc/1/comm') && Puppet::FileSystem.read('/proc/1/comm').include?('systemd') - defaultfor 'os.family' => [:archlinux] - defaultfor 'os.family' => :redhat, 'os.release.major' => ["7", "8"] - defaultfor 'os.family' => :redhat, 'os.name' => :fedora - defaultfor 'os.family' => :suse - defaultfor 'os.family' => :coreos - defaultfor 'os.name' => :amazon, 'os.release.major' => ["2"] - defaultfor 'os.name' => :debian - notdefaultfor 'os.name' => :debian, 'os.release.major' => ["5", "6", "7"] # These are using the "debian" method - defaultfor 'os.name' => :LinuxMint - notdefaultfor 'os.name' => :LinuxMint, 'os.release.major' => ["10", "11", "12", "13", "14", "15", "16", "17"] # These are using upstart - defaultfor 'os.name' => :ubuntu - notdefaultfor 'os.name' => :ubuntu, 'os.release.major' => ["10.04", "12.04", "14.04", "14.10"] # These are using upstart - defaultfor 'os.name' => :cumuluslinux, 'os.release.major' => ["3", "4"] + defaultfor :osfamily => [:archlinux] + defaultfor :osfamily => :redhat, :operatingsystemmajrelease => ["7", "8"] + defaultfor :osfamily => :redhat, :operatingsystem => :fedora + defaultfor :osfamily => :suse + defaultfor :osfamily => :coreos + defaultfor :operatingsystem => :amazon, :operatingsystemmajrelease => ["2"] + defaultfor :operatingsystem => :debian + notdefaultfor :operatingsystem => :debian, :operatingsystemmajrelease => ["5", "6", "7"] # These are using the "debian" method + defaultfor :operatingsystem => :LinuxMint + notdefaultfor :operatingsystem => :LinuxMint, :operatingsystemmajrelease => ["10", "11", "12", "13", "14", "15", "16", "17"] # These are using upstart + defaultfor :operatingsystem => :ubuntu + notdefaultfor :operatingsystem => :ubuntu, :operatingsystemmajrelease => ["10.04", "12.04", "14.04", "14.10"] # These are using upstart + defaultfor :operatingsystem => :cumuluslinux, :operatingsystemmajrelease => ["3", "4"] def self.instances i = [] @@ -105,7 +105,7 @@ def enabled? # The indirect state indicates that the unit is not enabled. return :false if output == 'indirect' return :true if (code == 0) - if (output.empty?) && (code > 0) && (Facter.value('os.family').casecmp('debian').zero?) + if (output.empty?) && (code > 0) && (Facter.value(:osfamily).casecmp('debian').zero?) ret = debian_enabled? return ret if ret end diff --git a/lib/puppet/provider/service/upstart.rb b/lib/puppet/provider/service/upstart.rb index 9e0007d8c90..ac781b9ee43 100644 --- a/lib/puppet/provider/service/upstart.rb +++ b/lib/puppet/provider/service/upstart.rb @@ -10,14 +10,14 @@ " confine :any => [ - Facter.value('os.name') == 'Ubuntu', - (Facter.value('os.family') == 'RedHat' and Facter.value('os.release.full') =~ /^6\./), - (Facter.value('os.name') == 'Amazon' and Facter.value('os.release.major') =~ /\d{4}/), - Facter.value('os.name') == 'LinuxMint', + Facter.value(:operatingsystem) == 'Ubuntu', + (Facter.value(:osfamily) == 'RedHat' and Facter.value(:operatingsystemrelease) =~ /^6\./), + (Facter.value(:operatingsystem) == 'Amazon' and Facter.value(:operatingsystemmajrelease) =~ /\d{4}/), + Facter.value(:operatingsystem) == 'LinuxMint', ] - defaultfor 'os.name' => :ubuntu, 'os.release.major' => ["10.04", "12.04", "14.04", "14.10"] - defaultfor 'os.name' => :LinuxMint, 'os.release.major' => ["10", "11", "12", "13", "14", "15", "16", "17"] + defaultfor :operatingsystem => :ubuntu, :operatingsystemmajrelease => ["10.04", "12.04", "14.04", "14.10"] + defaultfor :operatingsystem => :LinuxMint, :operatingsystemmajrelease => ["10", "11", "12", "13", "14", "15", "16", "17"] commands :start => "/sbin/start", :stop => "/sbin/stop", @@ -57,7 +57,7 @@ def self.instances def self.excludes excludes = super - if Facter.value('os.family') == 'RedHat' + if Facter.value(:osfamily) == 'RedHat' # Puppet cannot deal with services that have instances, so we have to # ignore these services using instances on redhat based systems. excludes += %w[serial tty] diff --git a/lib/puppet/provider/service/windows.rb b/lib/puppet/provider/service/windows.rb index 0dee9ab7889..678fd84176b 100644 --- a/lib/puppet/provider/service/windows.rb +++ b/lib/puppet/provider/service/windows.rb @@ -11,8 +11,8 @@ services as a specific user. EOT - defaultfor 'os.name' => :windows - confine 'os.name' => :windows + defaultfor :operatingsystem => :windows + confine :operatingsystem => :windows has_feature :refreshable, :configurable_timeout, :manages_logon_credentials diff --git a/lib/puppet/provider/user/aix.rb b/lib/puppet/provider/user/aix.rb index 41c5195b7d9..de2fe9a6869 100644 --- a/lib/puppet/provider/user/aix.rb +++ b/lib/puppet/provider/user/aix.rb @@ -17,8 +17,8 @@ Puppet::Type.type(:user).provide :aix, :parent => Puppet::Provider::AixObject do desc "User management for AIX." - defaultfor 'os.name' => :aix - confine 'os.name' => :aix + defaultfor :operatingsystem => :aix + confine :operatingsystem => :aix # Commands that manage the element commands :list => "/usr/sbin/lsuser" diff --git a/lib/puppet/provider/user/directoryservice.rb b/lib/puppet/provider/user/directoryservice.rb index 0ee48e31ae1..65bde4fea37 100644 --- a/lib/puppet/provider/user/directoryservice.rb +++ b/lib/puppet/provider/user/directoryservice.rb @@ -16,9 +16,9 @@ commands :dscacheutil => '/usr/bin/dscacheutil' # Provider confines and defaults - confine 'os.name' => :darwin - confine :feature => :cfpropertylist - defaultfor 'os.name' => :darwin + confine :operatingsystem => :darwin + confine :feature => :cfpropertylist + defaultfor :operatingsystem => :darwin # Need this to create getter/setter methods automagically # This command creates methods that return @property_hash[:value] @@ -159,7 +159,7 @@ def self.generate_attribute_hash(input_hash) end def self.get_os_version - @os_version ||= Facter.value('os.macosx.version.major') + @os_version ||= Facter.value(:macosx_productversion_major) end # Use dscl to retrieve an array of hashes containing attributes about all diff --git a/lib/puppet/provider/user/hpux.rb b/lib/puppet/provider/user/hpux.rb index 13503d0c357..0f1ef29ce8c 100644 --- a/lib/puppet/provider/user/hpux.rb +++ b/lib/puppet/provider/user/hpux.rb @@ -5,8 +5,8 @@ New functionality provides for changing trusted computing passwords and resetting password expirations under trusted computing." - defaultfor 'os.name' => "hp-ux" - confine 'os.name' => "hp-ux" + defaultfor :operatingsystem => "hp-ux" + confine :operatingsystem => "hp-ux" commands :modify => "/usr/sam/lbin/usermod.sam", :delete => "/usr/sam/lbin/userdel.sam", :add => "/usr/sam/lbin/useradd.sam" options :comment, :method => :gecos diff --git a/lib/puppet/provider/user/openbsd.rb b/lib/puppet/provider/user/openbsd.rb index 8205c523824..1b550226e1a 100644 --- a/lib/puppet/provider/user/openbsd.rb +++ b/lib/puppet/provider/user/openbsd.rb @@ -10,8 +10,8 @@ :modify => "usermod", :password => "passwd" - defaultfor 'os.name' => :openbsd - confine 'os.name' => :openbsd + defaultfor :operatingsystem => :openbsd + confine :operatingsystem => :openbsd options :home, :flag => "-d", :method => :dir options :comment, :method => :gecos diff --git a/lib/puppet/provider/user/pw.rb b/lib/puppet/provider/user/pw.rb index 8db511ffcc7..a1706af14f6 100644 --- a/lib/puppet/provider/user/pw.rb +++ b/lib/puppet/provider/user/pw.rb @@ -7,8 +7,8 @@ commands :pw => "pw" has_features :manages_homedir, :allows_duplicates, :manages_passwords, :manages_expiry, :manages_shell - defaultfor 'os.name' => [:freebsd, :dragonfly] - confine 'os.name' => [:freebsd, :dragonfly] + defaultfor :operatingsystem => [:freebsd, :dragonfly] + confine :operatingsystem => [:freebsd, :dragonfly] options :home, :flag => "-d", :method => :dir options :comment, :method => :gecos diff --git a/lib/puppet/provider/user/user_role_add.rb b/lib/puppet/provider/user/user_role_add.rb index bc19c131a82..304a512daa7 100644 --- a/lib/puppet/provider/user/user_role_add.rb +++ b/lib/puppet/provider/user/user_role_add.rb @@ -6,7 +6,7 @@ desc "User and role management on Solaris, via `useradd` and `roleadd`." - defaultfor 'os.family' => :solaris + defaultfor :osfamily => :solaris commands :add => "useradd", :delete => "userdel", :modify => "usermod", :password => "passwd", :role_add => "roleadd", :role_delete => "roledel", :role_modify => "rolemod" options :home, :flag => "-d", :method => :dir diff --git a/lib/puppet/provider/user/useradd.rb b/lib/puppet/provider/user/useradd.rb index e9b92cd5685..e7e7f9e4005 100644 --- a/lib/puppet/provider/user/useradd.rb +++ b/lib/puppet/provider/user/useradd.rb @@ -21,13 +21,13 @@ options :expiry, :method => :sp_expire, :munge => proc { |value| if value == :absent - if Facter.value('os.name') == 'SLES' && Facter.value('os.release.major') == "11" + if Facter.value(:operatingsystem)=='SLES' && Facter.value(:operatingsystemmajrelease) == "11" -1 else '' end else - case Facter.value('os.name') + case Facter.value(:operatingsystem) when 'Solaris' # Solaris uses %m/%d/%Y for useradd/usermod expiry_year, expiry_month, expiry_day = value.split('-') @@ -161,7 +161,7 @@ def groups=(value) end has_features :manages_homedir, :allows_duplicates, :manages_expiry - has_features :system_users unless %w{HP-UX Solaris}.include? Facter.value('os.name') + has_features :system_users unless %w{HP-UX Solaris}.include? Facter.value(:operatingsystem) has_features :manages_passwords, :manages_password_age if Puppet.features.libshadow? has_features :manages_shell @@ -196,8 +196,8 @@ def check_manage_home # libuser does not implement the -m flag cmd << "-m" unless @resource.forcelocal? else - osfamily = Facter.value('os.family') - osversion = Facter.value('os.release.major').to_i + osfamily = Facter.value(:osfamily) + osversion = Facter.value(:operatingsystemmajrelease).to_i # SLES 11 uses pwdutils instead of shadow, which does not have -M # Solaris and OpenBSD use different useradd flavors unless osfamily =~ /Solaris|OpenBSD/ || osfamily == 'Suse' && osversion <= 11 @@ -293,7 +293,7 @@ def deletecmd cmd = [command(:delete)] end # Solaris `userdel -r` will fail if the homedir does not exist. - if @resource.managehome? && (('Solaris' != Facter.value('os.name')) || Dir.exist?(Dir.home(@resource[:name]))) + if @resource.managehome? && (('Solaris' != Facter.value(:operatingsystem)) || Dir.exist?(Dir.home(@resource[:name]))) cmd << '-r' end cmd << @resource[:name] diff --git a/lib/puppet/provider/user/windows_adsi.rb b/lib/puppet/provider/user/windows_adsi.rb index 57092c15628..00510940664 100644 --- a/lib/puppet/provider/user/windows_adsi.rb +++ b/lib/puppet/provider/user/windows_adsi.rb @@ -3,8 +3,8 @@ Puppet::Type.type(:user).provide :windows_adsi do desc "Local user management for Windows." - defaultfor 'os.name' => :windows - confine 'os.name' => :windows + defaultfor :operatingsystem => :windows + confine :operatingsystem => :windows has_features :manages_homedir, :manages_passwords, :manages_roles diff --git a/lib/puppet/reference/providers.rb b/lib/puppet/reference/providers.rb index ce2b5f6164c..52d6def6ffc 100644 --- a/lib/puppet/reference/providers.rb +++ b/lib/puppet/reference/providers.rb @@ -13,10 +13,11 @@ ret = "Details about this host:\n\n" # Throw some facts in there, so we know where the report is from. - ret << option('Ruby Version', Facter.value('ruby.version')) - ret << option('Puppet Version', Facter.value('puppetversion')) - ret << option('Operating System', Facter.value('os.name')) - ret << option('Operating System Release', Facter.value('os.release.full')) + ["Ruby Version", "Puppet Version", "Operating System", "Operating System Release"].each do |label| + name = label.gsub(/\s+/, '') + value = Facter.value(name) + ret << option(label, value) + end ret << "\n" count = 1 diff --git a/lib/puppet/settings.rb b/lib/puppet/settings.rb index e73d79298cc..3b304801207 100644 --- a/lib/puppet/settings.rb +++ b/lib/puppet/settings.rb @@ -66,7 +66,7 @@ def self.app_defaults_for_run_mode(run_mode) } end - def self.default_certname + def self.default_certname() hostname = hostname_fact domain = domain_fact if domain and domain != "" @@ -77,12 +77,12 @@ def self.default_certname fqdn.to_s.gsub(/\.$/, '') end - def self.hostname_fact - Facter.value('networking.hostname') + def self.hostname_fact() + Facter.value :hostname end - def self.domain_fact - Facter.value('networking.domain') + def self.domain_fact() + Facter.value :domain end def self.default_config_file_name diff --git a/lib/puppet/type.rb b/lib/puppet/type.rb index 277160d70bc..4e8253ab1dd 100644 --- a/lib/puppet/type.rb +++ b/lib/puppet/type.rb @@ -1405,7 +1405,7 @@ def properties_to_audit(list) provide a symbolic title and an explicit namevar value: file { 'sshdconfig': - path => $os['name'] ? { + path => $operatingsystem ? { solaris => '/usr/local/etc/ssh/sshd_config', default => '/etc/ssh/sshd_config', }, diff --git a/lib/puppet/type/file/source.rb b/lib/puppet/type/file/source.rb index 8fb7bad6934..8e54bfa5410 100644 --- a/lib/puppet/type/file/source.rb +++ b/lib/puppet/type/file/source.rb @@ -72,7 +72,7 @@ module Puppet file { '/etc/nfs.conf': source => [ "puppet:///modules/nfs/conf.${host}", - "puppet:///modules/nfs/conf.${os['name']}", + "puppet:///modules/nfs/conf.${operatingsystem}", 'puppet:///modules/nfs/conf' ] } diff --git a/lib/puppet/type/package.rb b/lib/puppet/type/package.rb index 1929f0863f2..abddd42a9a4 100644 --- a/lib/puppet/type/package.rb +++ b/lib/puppet/type/package.rb @@ -242,7 +242,7 @@ def change_to_s(currentvalue, newvalue) conditionally: # In the 'openssl' class - $ssl = $os['name'] ? { + $ssl = $operatingsystem ? { solaris => SMCossl, default => openssl } @@ -254,7 +254,7 @@ def change_to_s(currentvalue, newvalue) ... - $ssh = $os['name'] ? { + $ssh = $operatingsystem ? { solaris => SMCossh, default => openssh } diff --git a/lib/puppet/type/resources.rb b/lib/puppet/type/resources.rb index 2909de6adc0..51c102c5f43 100644 --- a/lib/puppet/type/resources.rb +++ b/lib/puppet/type/resources.rb @@ -175,7 +175,7 @@ def self.system_users_max_uid end # Otherwise, use a sensible default based on the OS family - @system_users_max_uid ||= case Facter.value('os.family') + @system_users_max_uid ||= case Facter.value(:osfamily) when 'OpenBSD', 'FreeBSD' 999 else diff --git a/lib/puppet/util/filetype.rb b/lib/puppet/util/filetype.rb index 4c11598cf6f..41d5a964765 100644 --- a/lib/puppet/util/filetype.rb +++ b/lib/puppet/util/filetype.rb @@ -215,7 +215,7 @@ def read # Remove a specific @path's cron tab. def remove cmd = "#{cmdbase} -r" - if %w{Darwin FreeBSD DragonFly}.include?(Facter.value('os.name')) + if %w{Darwin FreeBSD DragonFly}.include?(Facter.value("operatingsystem")) cmd = "/bin/echo yes | #{cmd}" end @@ -244,7 +244,7 @@ def write(text) # Only add the -u flag when the @path is different. Fedora apparently # does not think I should be allowed to set the @path to my own user name def cmdbase - if @uid == Puppet::Util::SUIDManager.uid || Facter.value('os.name') == "HP-UX" + if @uid == Puppet::Util::SUIDManager.uid || Facter.value(:operatingsystem) == "HP-UX" return "crontab" else return "crontab -u #{@path}" diff --git a/lib/puppet/util/suidmanager.rb b/lib/puppet/util/suidmanager.rb index c009750836e..6c3cd818baf 100644 --- a/lib/puppet/util/suidmanager.rb +++ b/lib/puppet/util/suidmanager.rb @@ -18,7 +18,7 @@ module Puppet::Util::SUIDManager def osx_maj_ver return @osx_maj_ver unless @osx_maj_ver.nil? - @osx_maj_ver = Facter.value('os.macosx.version.major') || false + @osx_maj_ver = Facter.value('macosx_productversion_major') || false end module_function :osx_maj_ver diff --git a/spec/fixtures/releases/jamtur01-apache/lib/puppet/provider/a2mod/debian.rb b/spec/fixtures/releases/jamtur01-apache/lib/puppet/provider/a2mod/debian.rb index a4c5400146f..9d8c12983f4 100644 --- a/spec/fixtures/releases/jamtur01-apache/lib/puppet/provider/a2mod/debian.rb +++ b/spec/fixtures/releases/jamtur01-apache/lib/puppet/provider/a2mod/debian.rb @@ -4,7 +4,7 @@ commands :encmd => "a2enmod" commands :discmd => "a2dismod" - defaultfor 'os.name' => [:debian, :ubuntu] + defaultfor :operatingsystem => [:debian, :ubuntu] def create encmd resource[:name] diff --git a/spec/fixtures/releases/jamtur01-apache/manifests/init.pp b/spec/fixtures/releases/jamtur01-apache/manifests/init.pp index 1725650f8c1..bd3f7bae145 100644 --- a/spec/fixtures/releases/jamtur01-apache/manifests/init.pp +++ b/spec/fixtures/releases/jamtur01-apache/manifests/init.pp @@ -21,7 +21,7 @@ 'headers' : ensure => present; 'expires' : ensure => present; } - $vdir = $os['name'] ? { + $vdir = $operatingsystem? { 'ubuntu' => '/etc/apache2/sites-enabled/', default => '/etc/httpd/conf.d', } diff --git a/spec/fixtures/releases/jamtur01-apache/manifests/params.pp b/spec/fixtures/releases/jamtur01-apache/manifests/params.pp index 9ec205a10bb..520eccb448d 100644 --- a/spec/fixtures/releases/jamtur01-apache/manifests/params.pp +++ b/spec/fixtures/releases/jamtur01-apache/manifests/params.pp @@ -2,7 +2,7 @@ $user = 'www-data' $group = 'www-data' - case $os['name'] { + case $operatingsystem { "centos": { $apache_name = httpd $ssl_package = mod_ssl diff --git a/spec/fixtures/releases/jamtur01-apache/manifests/ssl.pp b/spec/fixtures/releases/jamtur01-apache/manifests/ssl.pp index a94b7fab548..349f92288a7 100644 --- a/spec/fixtures/releases/jamtur01-apache/manifests/ssl.pp +++ b/spec/fixtures/releases/jamtur01-apache/manifests/ssl.pp @@ -2,7 +2,7 @@ include apache - case $facts['os']['name'] { + case $operatingsystem { "centos": { package { $apache::params::ssl_package: require => Package['httpd'], diff --git a/spec/fixtures/releases/jamtur01-apache/manifests/vhost.pp b/spec/fixtures/releases/jamtur01-apache/manifests/vhost.pp index 1a71aad5265..a210f35570f 100644 --- a/spec/fixtures/releases/jamtur01-apache/manifests/vhost.pp +++ b/spec/fixtures/releases/jamtur01-apache/manifests/vhost.pp @@ -1,6 +1,6 @@ define apache::vhost( $port, $docroot, $ssl=true, $template='apache/vhost-default.conf.erb', $priority, $serveraliases = '' ) { include apache - $vdir = $os['name']? { + $vdir = $operatingsystem? { 'ubuntu' => '/etc/apache2/sites-enabled/', default => '/etc/httpd/conf.d', } diff --git a/spec/integration/type/file_spec.rb b/spec/integration/type/file_spec.rb index 07a4ff5bafb..34f3b1e91a1 100644 --- a/spec/integration/type/file_spec.rb +++ b/spec/integration/type/file_spec.rb @@ -1710,11 +1710,11 @@ def grant_everyone_full_access(path) describe "when using validate_cmd" do test_cmd = '/bin/test' - if Facter.value('os.family') == 'Debian' + if Facter.value(:osfamily) == 'Debian' test_cmd = '/usr/bin/test' end - if Facter.value('os.name') == 'Darwin' + if Facter.value(:operatingsystem) == 'Darwin' stat_cmd = "stat -f '%Lp'" else stat_cmd = "stat --format=%a" diff --git a/spec/integration/type/package_spec.rb b/spec/integration/type/package_spec.rb index 969d5b8f0f9..a61bcb86ff0 100644 --- a/spec/integration/type/package_spec.rb +++ b/spec/integration/type/package_spec.rb @@ -21,19 +21,19 @@ def provider_name(os) when 'Darwin' :pkgdmg when 'RedHat' - if ['2.1', '3', '4'].include?(Facter.value('os.distro.release.full')) + if ['2.1', '3', '4'].include?(Facter.value(:lsbdistrelease)) :up2date else :yum end when 'Fedora' - if Puppet::Util::Package.versioncmp(Facter.value('os.release.major'), '22') >= 0 + if Puppet::Util::Package.versioncmp(Facter.value(:operatingsystemmajrelease), '22') >= 0 :dnf else :yum end when 'Suse' - if Puppet::Util::Package.versioncmp(Facter.value('os.release.major'), '10') >= 0 + if Puppet::Util::Package.versioncmp(Facter.value(:operatingsystemmajrelease), '10') >= 0 :zypper else :rug @@ -54,8 +54,8 @@ def provider_name(os) end it "should choose the correct provider each platform" do - unless default_provider = provider_name(Facter.value('os.name')) - pending("No default provider specified in this test for #{Facter.value('os.name')}") + unless default_provider = provider_name(Facter.value(:operatingsystem)) + pending("No default provider specified in this test for #{Facter.value(:operatingsystem)}") end expect(Puppet::Type.type(:package).defaultprovider.name).to eq(default_provider) end diff --git a/spec/shared_examples/rhel_package_provider.rb b/spec/shared_examples/rhel_package_provider.rb index 28486b9c729..06f39e0e2ca 100644 --- a/spec/shared_examples/rhel_package_provider.rb +++ b/spec/shared_examples/rhel_package_provider.rb @@ -69,7 +69,7 @@ allow(Puppet::Util).to receive(:which).with("rpm").and_return("/bin/rpm") allow(provider).to receive(:which).with("rpm").and_return("/bin/rpm") expect(Puppet::Util::Execution).to receive(:execute).with(["/bin/rpm", "--version"], {:combine => true, :custom_environment => {}, :failonfail => true}).and_return(Puppet::Util::Execution::ProcessOutput.new("4.10.1\n", 0)).at_most(:once) - allow(Facter).to receive(:value).with('os.release.major').and_return('6') + allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return('6') end it "should call #{provider_name} install for :installed" do @@ -81,7 +81,7 @@ if provider_name == 'yum' context 'on el-5' do before(:each) do - allow(Facter).to receive(:value).with('os.release.major').and_return('5') + allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return('5') end it "should catch #{provider_name} install failures when status code is wrong" do diff --git a/spec/unit/application/device_spec.rb b/spec/unit/application/device_spec.rb index a26fc470e41..e7d339c7193 100644 --- a/spec/unit/application/device_spec.rb +++ b/spec/unit/application/device_spec.rb @@ -482,10 +482,10 @@ end it "retrieves facts" do - indirection_fact_values = {"os"=> {"name" => "cisco_ios"},"clientcert"=>"3750"} + indirection_fact_values = {"operatingsystem"=>"cisco_ios","clientcert"=>"3750"} indirection_facts = Puppet::Node::Facts.new("nil", indirection_fact_values) expect(Puppet::Node::Facts.indirection).to receive(:find).with(nil, anything()).and_return(indirection_facts) - expect(device).to receive(:puts).with(/name.*3750.*\n.*values.*\n.*os.*\n.*name.*cisco_ios/) + expect(device).to receive(:puts).with(/name.*3750.*\n.*values.*\n.*operatingsystem.*cisco_ios/) expect { device.main }.to exit_with 0 end end diff --git a/spec/unit/confine_spec.rb b/spec/unit/confine_spec.rb index 1df5bdab000..ddff0fc03bb 100644 --- a/spec/unit/confine_spec.rb +++ b/spec/unit/confine_spec.rb @@ -84,16 +84,16 @@ def pass?(value) describe "when requiring" do it "does not cache failed requires when always_retry_plugins is true" do Puppet[:always_retry_plugins] = true - expect(Puppet::Confine).to receive(:require).with('puppet/confine/os.family').twice.and_raise(LoadError) - Puppet::Confine.test('os.family') - Puppet::Confine.test('os.family') + expect(Puppet::Confine).to receive(:require).with('puppet/confine/osfamily').twice.and_raise(LoadError) + Puppet::Confine.test(:osfamily) + Puppet::Confine.test(:osfamily) end it "caches failed requires when always_retry_plugins is false" do Puppet[:always_retry_plugins] = false - expect(Puppet::Confine).to receive(:require).with('puppet/confine/os.family').once.and_raise(LoadError) - Puppet::Confine.test('os.family') - Puppet::Confine.test('os.family') + expect(Puppet::Confine).to receive(:require).with('puppet/confine/osfamily').once.and_raise(LoadError) + Puppet::Confine.test(:osfamily) + Puppet::Confine.test(:osfamily) end end end diff --git a/spec/unit/face/epp_face_spec.rb b/spec/unit/face/epp_face_spec.rb index edaeb07d252..d7f461df6d6 100644 --- a/spec/unit/face/epp_face_spec.rb +++ b/spec/unit/face/epp_face_spec.rb @@ -311,8 +311,8 @@ it "facts can be overridden" do expect(eppface.render({ - :facts => {'os' => {'name' => 'Merwin'} }, - :e => '<%= $facts[os][name] %>', + :facts => {'operatingsystem' => 'Merwin'}, + :e => '<%= $facts[operatingsystem] %>', })).to eql("Merwin") end diff --git a/spec/unit/file_bucket/dipper_spec.rb b/spec/unit/file_bucket/dipper_spec.rb index f14d2a5961d..584d7dc2bd6 100644 --- a/spec/unit/file_bucket/dipper_spec.rb +++ b/spec/unit/file_bucket/dipper_spec.rb @@ -104,8 +104,8 @@ def make_tmp_file(contents) # Diff without the context # Lines we need to see match 'Content' instead of trimming diff output filter out # surrounding noise...or hard code the check values - if Facter.value('os.family') == 'Solaris' && - Puppet::Util::Package.versioncmp(Facter.value('os.release.full'), '11.0') >= 0 + if Facter.value(:osfamily) == 'Solaris' && + Puppet::Util::Package.versioncmp(Facter.value(:operatingsystemrelease), '11.0') >= 0 # Use gdiff on Solaris diff12 = Puppet::Util::Execution.execute("gdiff -uN #{file1} #{file2}| grep Content") diff21 = Puppet::Util::Execution.execute("gdiff -uN #{file2} #{file1}| grep Content") diff --git a/spec/unit/file_serving/mount/file_spec.rb b/spec/unit/file_serving/mount/file_spec.rb index 312a67f46c3..74a7f7c61f3 100644 --- a/spec/unit/file_serving/mount/file_spec.rb +++ b/spec/unit/file_serving/mount/file_spec.rb @@ -3,8 +3,8 @@ module FileServingMountTesting def stub_facter(hostname) - allow(Facter).to receive(:value).with('networking.hostname').and_return(hostname.sub(/\..+/, '')) - allow(Facter).to receive(:value).with('networking.domain').and_return(hostname.sub(/^[^.]+\./, '')) + allow(Facter).to receive(:value).with("hostname").and_return(hostname.sub(/\..+/, '')) + allow(Facter).to receive(:value).with("domain").and_return(hostname.sub(/^[^.]+\./, '')) end end diff --git a/spec/unit/indirector/catalog/compiler_spec.rb b/spec/unit/indirector/catalog/compiler_spec.rb index 18ac4dac501..da8bed128c1 100644 --- a/spec/unit/indirector/catalog/compiler_spec.rb +++ b/spec/unit/indirector/catalog/compiler_spec.rb @@ -389,10 +389,10 @@ def a_request_that_contains(facts) before do allow(Puppet).to receive(:version).and_return(1) set_facts({ - 'networking.fqdn' => "my.server.com", - 'networking.ip' => "my.ip.address", - 'networking.ip6' => nil - }) + 'fqdn' => "my.server.com", + 'ipaddress' => "my.ip.address", + 'ipaddress6' => nil + }) @request = Puppet::Indirector::Request.new(:catalog, :find, node_name, nil) allow(compiler).to receive(:compile) allow(Puppet::Node.indirection).to receive(:find).with(node_name, anything).and_return(node) @@ -424,16 +424,16 @@ def a_request_that_contains(facts) before do |example| allow(Puppet).to receive(:version).and_return(1) set_facts({ - 'networking.fqdn' => "my.server.com", - 'networking.ip' => nil, + 'fqdn' => "my.server.com", + 'ipaddress' => nil, }) if example.metadata[:nil_ipv6] set_facts({ - 'networking.ip6' => nil + 'ipaddress6' => nil }) else set_facts({ - 'networking.ip6' => "my.ipv6.address" + 'ipaddress6' => "my.ipv6.address" }) end @request = Puppet::Indirector::Request.new(:catalog, :find, node_name, nil) diff --git a/spec/unit/module_tool/tar_spec.rb b/spec/unit/module_tool/tar_spec.rb index 710950a8261..94fd04927d6 100644 --- a/spec/unit/module_tool/tar_spec.rb +++ b/spec/unit/module_tool/tar_spec.rb @@ -7,7 +7,7 @@ { :name => 'Windows', :win => true } ].each do |os| it "always prefers minitar if it and zlib are present, even with tar available" do - allow(Facter).to receive(:value).with('os.family').and_return(os[:name]) + allow(Facter).to receive(:value).with('osfamily').and_return(os[:name]) allow(Puppet::Util).to receive(:which).with('tar').and_return('/usr/bin/tar') allow(Puppet::Util::Platform).to receive(:windows?).and_return(os[:win]) allow(Puppet).to receive(:features).and_return(double(:minitar? => true, :zlib? => true)) @@ -17,7 +17,7 @@ end it "falls back to tar when minitar not present and not on Windows" do - allow(Facter).to receive(:value).with('os.family').and_return('ObscureLinuxDistro') + allow(Facter).to receive(:value).with('osfamily').and_return('ObscureLinuxDistro') allow(Puppet::Util).to receive(:which).with('tar').and_return('/usr/bin/tar') allow(Puppet::Util::Platform).to receive(:windows?).and_return(false) allow(Puppet).to receive(:features).and_return(double(:minitar? => false)) @@ -26,7 +26,7 @@ end it "fails when there is no possible implementation" do - allow(Facter).to receive(:value).with('os.family').and_return('Windows') + allow(Facter).to receive(:value).with('osfamily').and_return('Windows') allow(Puppet::Util).to receive(:which).with('tar') allow(Puppet::Util::Platform).to receive(:windows?).and_return(true) allow(Puppet).to receive(:features).and_return(double(:minitar? => false, :zlib? => false)) diff --git a/spec/unit/pops/serialization/serialization_spec.rb b/spec/unit/pops/serialization/serialization_spec.rb index ddf146b772c..2d54886b826 100644 --- a/spec/unit/pops/serialization/serialization_spec.rb +++ b/spec/unit/pops/serialization/serialization_spec.rb @@ -298,7 +298,7 @@ def parse(string) it 'nested Expression' do expr = parse(<<-CODE) - $rootgroup = $os['family'] ? { + $rootgroup = $osfamily ? { 'Solaris' => 'wheel', /(Darwin|FreeBSD)/ => 'wheel', default => 'root', @@ -435,7 +435,7 @@ def _pcore_init_hash it 'can write and read an AST expression' do expr = parse(<<-CODE) - $rootgroup = $os['family'] ? { + $rootgroup = $osfamily ? { 'Solaris' => 'wheel', /(Darwin|FreeBSD)/ => 'wheel', default => 'root', diff --git a/spec/unit/pops/serialization/to_from_hr_spec.rb b/spec/unit/pops/serialization/to_from_hr_spec.rb index 5ef2777083c..1f803d39944 100644 --- a/spec/unit/pops/serialization/to_from_hr_spec.rb +++ b/spec/unit/pops/serialization/to_from_hr_spec.rb @@ -344,7 +344,7 @@ def parse(string) it 'nested Expression' do expr = parse(<<-CODE) - $rootgroup = $os['family'] ? { + $rootgroup = $osfamily ? { 'Solaris' => 'wheel', /(Darwin|FreeBSD)/ => 'wheel', default => 'root', diff --git a/spec/unit/provider/package/apt_spec.rb b/spec/unit/provider/package/apt_spec.rb index e731d9b5643..bb9e179895c 100644 --- a/spec/unit/provider/package/apt_spec.rb +++ b/spec/unit/provider/package/apt_spec.rb @@ -14,8 +14,8 @@ resource.provider end - it "should be the default provider on 'os.family' => Debian" do - expect(Facter).to receive(:value).with('os.family').and_return("Debian") + it "should be the default provider on :osfamily => Debian" do + expect(Facter).to receive(:value).with(:osfamily).and_return("Debian") expect(described_class.default?).to be_truthy end diff --git a/spec/unit/provider/package/dnf_spec.rb b/spec/unit/provider/package/dnf_spec.rb index a95a6012303..9a4e9b8b3c9 100644 --- a/spec/unit/provider/package/dnf_spec.rb +++ b/spec/unit/provider/package/dnf_spec.rb @@ -6,40 +6,40 @@ context 'default' do (19..21).each do |ver| it "should not be the default provider on fedora#{ver}" do - allow(Facter).to receive(:value).with('os.family').and_return(:redhat) - allow(Facter).to receive(:value).with('os.name').and_return(:fedora) - allow(Facter).to receive(:value).with('os.release.major').and_return("#{ver}") + allow(Facter).to receive(:value).with(:osfamily).and_return(:redhat) + allow(Facter).to receive(:value).with(:operatingsystem).and_return(:fedora) + allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("#{ver}") expect(described_class).to_not be_default end end (22..26).each do |ver| it "should be the default provider on fedora#{ver}" do - allow(Facter).to receive(:value).with('os.family').and_return(:redhat) - allow(Facter).to receive(:value).with('os.name').and_return(:fedora) - allow(Facter).to receive(:value).with('os.release.major').and_return("#{ver}") + allow(Facter).to receive(:value).with(:osfamily).and_return(:redhat) + allow(Facter).to receive(:value).with(:operatingsystem).and_return(:fedora) + allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("#{ver}") expect(described_class).to be_default end end it "should not be the default provider on rhel7" do - allow(Facter).to receive(:value).with('os.family').and_return(:redhat) - allow(Facter).to receive(:value).with('os.name').and_return(:redhat) - allow(Facter).to receive(:value).with('os.release.major').and_return("7") + allow(Facter).to receive(:value).with(:osfamily).and_return(:redhat) + allow(Facter).to receive(:value).with(:operatingsystem).and_return(:redhat) + allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("7") expect(described_class).to_not be_default end it "should be the default provider on some random future fedora" do - allow(Facter).to receive(:value).with('os.family').and_return(:redhat) - allow(Facter).to receive(:value).with('os.name').and_return(:fedora) - allow(Facter).to receive(:value).with('os.release.major').and_return("8675") + allow(Facter).to receive(:value).with(:osfamily).and_return(:redhat) + allow(Facter).to receive(:value).with(:operatingsystem).and_return(:fedora) + allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("8675") expect(described_class).to be_default end it "should be the default provider on rhel8" do - allow(Facter).to receive(:value).with('os.family').and_return(:redhat) - allow(Facter).to receive(:value).with('os.name').and_return(:redhat) - allow(Facter).to receive(:value).with('os.release.major').and_return("8") + allow(Facter).to receive(:value).with(:osfamily).and_return(:redhat) + allow(Facter).to receive(:value).with(:operatingsystem).and_return(:redhat) + allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("8") expect(described_class).to be_default end end diff --git a/spec/unit/provider/package/dnfmodule_spec.rb b/spec/unit/provider/package/dnfmodule_spec.rb index 3bfa20893ad..c7386658748 100644 --- a/spec/unit/provider/package/dnfmodule_spec.rb +++ b/spec/unit/provider/package/dnfmodule_spec.rb @@ -24,18 +24,18 @@ before(:each) { allow(Puppet::Util).to receive(:which).with('/usr/bin/dnf').and_return(dnf_path) } it "should have lower specificity" do - allow(Facter).to receive(:value).with('os.family').and_return(:redhat) - allow(Facter).to receive(:value).with('os.name').and_return(:redhat) - allow(Facter).to receive(:value).with('os.release.major').and_return('8') + allow(Facter).to receive(:value).with(:osfamily).and_return(:redhat) + allow(Facter).to receive(:value).with(:operatingsystem).and_return(:redhat) + allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return('8') expect(described_class.specificity).to be < 200 end describe "should be an opt-in provider" do Array(4..8).each do |ver| it "should not be default for redhat #{ver}" do - allow(Facter).to receive(:value).with('os.name').and_return('redhat') - allow(Facter).to receive(:value).with('os.family').and_return('redhat') - allow(Facter).to receive(:value).with('os.release.major').and_return(ver.to_s) + allow(Facter).to receive(:value).with(:operatingsystem).and_return('redhat') + allow(Facter).to receive(:value).with(:osfamily).and_return('redhat') + allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return(ver.to_s) expect(described_class).not_to be_default end end diff --git a/spec/unit/provider/package/gem_spec.rb b/spec/unit/provider/package/gem_spec.rb index bba0456349d..ca814cd97d5 100644 --- a/spec/unit/provider/package/gem_spec.rb +++ b/spec/unit/provider/package/gem_spec.rb @@ -474,9 +474,9 @@ end context 'when is defaultfor' do - let(:os) { Facter.value('os.name') } + let(:os) { Facter.value(:operatingsystem) } subject do - described_class.defaultfor('os.name': os) + described_class.defaultfor(operatingsystem: os) described_class.specificity end it { is_expected.to be > 100 } diff --git a/spec/unit/provider/package/pip2_spec.rb b/spec/unit/provider/package/pip2_spec.rb index 09e7d197f0d..161bdd0b5ae 100644 --- a/spec/unit/provider/package/pip2_spec.rb +++ b/spec/unit/provider/package/pip2_spec.rb @@ -24,9 +24,9 @@ end context 'when is defaultfor' do - let(:os) { Facter.value('os.name') } + let(:os) { Facter.value(:operatingsystem) } subject do - described_class.defaultfor('os.name': os) + described_class.defaultfor(operatingsystem: os) described_class.specificity end it { is_expected.to be > 100 } diff --git a/spec/unit/provider/package/pip3_spec.rb b/spec/unit/provider/package/pip3_spec.rb index ed64234c3b6..5d6ecf0ec34 100644 --- a/spec/unit/provider/package/pip3_spec.rb +++ b/spec/unit/provider/package/pip3_spec.rb @@ -24,9 +24,9 @@ end context 'when is defaultfor' do - let(:os) { Facter.value('os.name') } + let(:os) { Facter.value(:operatingsystem) } subject do - described_class.defaultfor('os.name': os) + described_class.defaultfor(operatingsystem: os) described_class.specificity end it { is_expected.to be > 100 } diff --git a/spec/unit/provider/package/pip_spec.rb b/spec/unit/provider/package/pip_spec.rb index 86e90d2e948..e0072ae1361 100644 --- a/spec/unit/provider/package/pip_spec.rb +++ b/spec/unit/provider/package/pip_spec.rb @@ -454,9 +454,9 @@ end context 'when is defaultfor' do - let(:os) { Facter.value('os.name') } + let(:os) { Facter.value(:operatingsystem) } subject do - described_class.defaultfor('os.name': os) + described_class.defaultfor(operatingsystem: os) described_class.specificity end it { is_expected.to be > 100 } diff --git a/spec/unit/provider/package/pkg_spec.rb b/spec/unit/provider/package/pkg_spec.rb index a9dd0e16497..3aa6bf26c6e 100644 --- a/spec/unit/provider/package/pkg_spec.rb +++ b/spec/unit/provider/package/pkg_spec.rb @@ -31,20 +31,20 @@ def self.it_should_respond_to(*actions) context 'default' do [ 10 ].each do |ver| it "should not be the default provider on Solaris #{ver}" do - allow(Facter).to receive(:value).with('os.family').and_return(:Solaris) + allow(Facter).to receive(:value).with(:osfamily).and_return(:Solaris) allow(Facter).to receive(:value).with(:kernelrelease).and_return("5.#{ver}") - allow(Facter).to receive(:value).with('os.name').and_return(:Solaris) - allow(Facter).to receive(:value).with('os.release.major').and_return("#{ver}") + allow(Facter).to receive(:value).with(:operatingsystem).and_return(:Solaris) + allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("#{ver}") expect(described_class).to_not be_default end end [ 11, 12 ].each do |ver| it "should be the default provider on Solaris #{ver}" do - allow(Facter).to receive(:value).with('os.family').and_return(:Solaris) + allow(Facter).to receive(:value).with(:osfamily).and_return(:Solaris) allow(Facter).to receive(:value).with(:kernelrelease).and_return("5.#{ver}") - allow(Facter).to receive(:value).with('os.name').and_return(:Solaris) - allow(Facter).to receive(:value).with('os.release.major').and_return("#{ver}") + allow(Facter).to receive(:value).with(:operatingsystem).and_return(:Solaris) + allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("#{ver}") expect(described_class).to be_default end end @@ -254,9 +254,9 @@ def self.it_should_respond_to(*actions) { :osrel => '11.0', :flags => ['--accept'] }, { :osrel => '11.2', :flags => ['--accept', '--sync-actuators-timeout', '900'] }, ].each do |hash| - context "with 'os.release.full' #{hash[:osrel]}" do + context "with :operatingsystemrelease #{hash[:osrel]}" do before :each do - allow(Facter).to receive(:value).with('os.release.full').and_return(hash[:osrel]) + allow(Facter).to receive(:value).with(:operatingsystemrelease).and_return(hash[:osrel]) end it "should support install options" do diff --git a/spec/unit/provider/package/pkgng_spec.rb b/spec/unit/provider/package/pkgng_spec.rb index 9d9b5d2973e..bacfafe688c 100644 --- a/spec/unit/provider/package/pkgng_spec.rb +++ b/spec/unit/provider/package/pkgng_spec.rb @@ -220,7 +220,7 @@ def run_in_catalog(*resources) describe "confine" do context "on FreeBSD" do it "should be the default provider" do - expect(Facter).to receive(:value).with('os.name').at_least(:once).and_return(:freebsd) + expect(Facter).to receive(:value).with(:operatingsystem).at_least(:once).and_return(:freebsd) expect(described_class).to be_default end end diff --git a/spec/unit/provider/package/portage_spec.rb b/spec/unit/provider/package/portage_spec.rb index a8c309f93d3..114546f8a4f 100644 --- a/spec/unit/provider/package/portage_spec.rb +++ b/spec/unit/provider/package/portage_spec.rb @@ -72,8 +72,8 @@ expect(described_class).to be_reinstallable end - it "should be the default provider on 'os.family' => Gentoo" do - expect(Facter).to receive(:value).with('os.family').and_return("Gentoo") + it "should be the default provider on :osfamily => Gentoo" do + expect(Facter).to receive(:value).with(:osfamily).and_return("Gentoo") expect(described_class.default?).to be_truthy end diff --git a/spec/unit/provider/package/puppet_gem_spec.rb b/spec/unit/provider/package/puppet_gem_spec.rb index b7ee578c7cf..e9c97c62158 100644 --- a/spec/unit/provider/package/puppet_gem_spec.rb +++ b/spec/unit/provider/package/puppet_gem_spec.rb @@ -88,9 +88,9 @@ end context 'when is defaultfor' do - let(:os) { Facter.value('os.name') } + let(:os) { Facter.value(:operatingsystem) } subject do - described_class.defaultfor('os.name': os) + described_class.defaultfor(operatingsystem: os) described_class.specificity end it { is_expected.to be > 100 } diff --git a/spec/unit/provider/package/puppetserver_gem_spec.rb b/spec/unit/provider/package/puppetserver_gem_spec.rb index 545fe0545e8..e3cca15dadd 100644 --- a/spec/unit/provider/package/puppetserver_gem_spec.rb +++ b/spec/unit/provider/package/puppetserver_gem_spec.rb @@ -125,9 +125,9 @@ end context 'when is defaultfor' do - let(:os) { Facter.value('os.name') } + let(:os) { Facter.value(:operatingsystem) } subject do - described_class.defaultfor('os.name': os) + described_class.defaultfor(operatingsystem: os) described_class.specificity end it { is_expected.to be > 100 } diff --git a/spec/unit/provider/package/tdnf_spec.rb b/spec/unit/provider/package/tdnf_spec.rb index 36e08a8425c..7f715b163d2 100644 --- a/spec/unit/provider/package/tdnf_spec.rb +++ b/spec/unit/provider/package/tdnf_spec.rb @@ -7,8 +7,8 @@ context 'default' do it 'should be the default provider on PhotonOS' do - allow(Facter).to receive(:value).with('os.family').and_return(:redhat) - allow(Facter).to receive(:value).with('os.name').and_return("PhotonOS") + allow(Facter).to receive(:value).with(:osfamily).and_return(:redhat) + allow(Facter).to receive(:value).with(:operatingsystem).and_return("PhotonOS") expect(described_class).to be_default end end diff --git a/spec/unit/provider/package/up2date_spec.rb b/spec/unit/provider/package/up2date_spec.rb index a23ba9d4b50..72bce2f5d28 100644 --- a/spec/unit/provider/package/up2date_spec.rb +++ b/spec/unit/provider/package/up2date_spec.rb @@ -13,8 +13,8 @@ osfamilies.each do |osfamily| releases.each do |release| it "should be the default provider on #{osfamily} #{release}" do - allow(Facter).to receive(:value).with('os.family').and_return(osfamily) - allow(Facter).to receive(:value).with('os.distro.release.full').and_return(release) + allow(Facter).to receive(:value).with(:osfamily).and_return(osfamily) + allow(Facter).to receive(:value).with(:lsbdistrelease).and_return(release) expect(subject.default?).to be_truthy end end diff --git a/spec/unit/provider/package/yum_spec.rb b/spec/unit/provider/package/yum_spec.rb index c4a9d386a23..923af403e7e 100644 --- a/spec/unit/provider/package/yum_spec.rb +++ b/spec/unit/provider/package/yum_spec.rb @@ -17,42 +17,42 @@ it_behaves_like 'RHEL package provider', described_class, 'yum' it "should have lower specificity" do - allow(Facter).to receive(:value).with('os.family').and_return(:redhat) - allow(Facter).to receive(:value).with('os.name').and_return(:fedora) - allow(Facter).to receive(:value).with('os.release.major').and_return("22") + allow(Facter).to receive(:value).with(:osfamily).and_return(:redhat) + allow(Facter).to receive(:value).with(:operatingsystem).and_return(:fedora) + allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("22") expect(described_class.specificity).to be < 200 end describe "should have logical defaults" do [2, 2018].each do |ver| it "should be the default provider on Amazon Linux #{ver}" do - allow(Facter).to receive(:value).with('os.name').and_return('amazon') - allow(Facter).to receive(:value).with('os.family').and_return('redhat') - allow(Facter).to receive(:value).with('os.release.major').and_return(ver) + allow(Facter).to receive(:value).with(:operatingsystem).and_return('amazon') + allow(Facter).to receive(:value).with(:osfamily).and_return('redhat') + allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return(ver) expect(described_class).to be_default end end Array(4..7).each do |ver| it "should be default for redhat #{ver}" do - allow(Facter).to receive(:value).with('os.name').and_return('redhat') - allow(Facter).to receive(:value).with('os.family').and_return('redhat') - allow(Facter).to receive(:value).with('os.release.major').and_return(ver.to_s) + allow(Facter).to receive(:value).with(:operatingsystem).and_return('redhat') + allow(Facter).to receive(:value).with(:osfamily).and_return('redhat') + allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return(ver.to_s) expect(described_class).to be_default end end it "should not be default for redhat 8" do - allow(Facter).to receive(:value).with('os.name').and_return('redhat') - allow(Facter).to receive(:value).with('os.family').and_return('redhat') - allow(Facter).to receive(:value).with('os.release.major').and_return('8') + allow(Facter).to receive(:value).with(:operatingsystem).and_return('redhat') + allow(Facter).to receive(:value).with(:osfamily).and_return('redhat') + allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return('8') expect(described_class).not_to be_default end it "should not be default for Ubuntu 16.04" do - allow(Facter).to receive(:value).with('os.name').and_return('ubuntu') - allow(Facter).to receive(:value).with('os.family').and_return('ubuntu') - allow(Facter).to receive(:value).with('os.release.major').and_return('16.04') + allow(Facter).to receive(:value).with(:operatingsystem).and_return('ubuntu') + allow(Facter).to receive(:value).with(:osfamily).and_return('ubuntu') + allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return('16.04') expect(described_class).not_to be_default end end @@ -346,7 +346,7 @@ describe 'install' do before do resource[:ensure] = ensure_value - allow(Facter).to receive(:value).with('os.release.major').and_return('7') + allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return('7') allow(described_class).to receive(:command).with(:cmd).and_return('/usr/bin/yum') allow(provider).to receive(:query).twice.and_return(nil, ensure: '18.3.2') allow(provider).to receive(:insync?).with('18.3.2').and_return(true) diff --git a/spec/unit/provider/service/base_spec.rb b/spec/unit/provider/service/base_spec.rb index b0118c18e9a..0039f492e46 100644 --- a/spec/unit/provider/service/base_spec.rb +++ b/spec/unit/provider/service/base_spec.rb @@ -98,7 +98,7 @@ def execute_command(command, options) end it "retrieves a PID from the process table" do - allow(Facter).to receive(:value).with('os.name').and_return("CentOS") + allow(Facter).to receive(:value).with(:operatingsystem).and_return("CentOS") ps_output = File.binread(my_fixture("ps_ef.mixed_encoding")).force_encoding(Encoding::UTF_8) expect(executor).to receive(:execute).with("ps -ef").and_return(ps_output) diff --git a/spec/unit/provider/service/bsd_spec.rb b/spec/unit/provider/service/bsd_spec.rb index b6fff65a11d..7f6236e36d8 100644 --- a/spec/unit/provider/service/bsd_spec.rb +++ b/spec/unit/provider/service/bsd_spec.rb @@ -10,8 +10,8 @@ before :each do allow(Puppet::Type.type(:service)).to receive(:defaultprovider).and_return(provider_class) - allow(Facter).to receive(:value).with('os.name').and_return(:netbsd) - allow(Facter).to receive(:value).with('os.family').and_return('NetBSD') + allow(Facter).to receive(:value).with(:operatingsystem).and_return(:netbsd) + allow(Facter).to receive(:value).with(:osfamily).and_return('NetBSD') allow(provider_class).to receive(:defpath).and_return('/etc/rc.conf.d') @provider = provider_class.new allow(@provider).to receive(:initscript) diff --git a/spec/unit/provider/service/debian_spec.rb b/spec/unit/provider/service/debian_spec.rb index fb272058bf7..5aa57a3accf 100644 --- a/spec/unit/provider/service/debian_spec.rb +++ b/spec/unit/provider/service/debian_spec.rb @@ -34,20 +34,20 @@ ['1','2'].each do |version| it "should be the default provider on CumulusLinux #{version}" do - expect(Facter).to receive(:value).with('os.name').at_least(:once).and_return('CumulusLinux') - expect(Facter).to receive(:value).with('os.release.major').and_return(version) + expect(Facter).to receive(:value).with(:operatingsystem).at_least(:once).and_return('CumulusLinux') + expect(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return(version) expect(provider_class.default?).to be_truthy end end it "should be the default provider on Devuan" do - expect(Facter).to receive(:value).with('os.name').at_least(:once).and_return('Devuan') + expect(Facter).to receive(:value).with(:operatingsystem).at_least(:once).and_return('Devuan') expect(provider_class.default?).to be_truthy end it "should be the default provider on Debian" do - expect(Facter).to receive(:value).with('os.name').at_least(:once).and_return('Debian') - expect(Facter).to receive(:value).with('os.release.major').and_return('7') + expect(Facter).to receive(:value).with(:operatingsystem).at_least(:once).and_return('Debian') + expect(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return('7') expect(provider_class.default?).to be_truthy end @@ -151,8 +151,8 @@ context "when checking service status" do it "should use the service command" do - allow(Facter).to receive(:value).with('os.name').and_return('Debian') - allow(Facter).to receive(:value).with('os.release.major').and_return('8') + allow(Facter).to receive(:value).with(:operatingsystem).and_return('Debian') + allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return('8') allow(@resource).to receive(:[]).with(:hasstatus).and_return(:true) expect(@provider.statuscmd).to eq(["service", @resource[:name], "status"]) end diff --git a/spec/unit/provider/service/freebsd_spec.rb b/spec/unit/provider/service/freebsd_spec.rb index e5dbdc3b436..7ee52e9e81c 100644 --- a/spec/unit/provider/service/freebsd_spec.rb +++ b/spec/unit/provider/service/freebsd_spec.rb @@ -7,7 +7,7 @@ before :each do @provider = provider_class.new allow(@provider).to receive(:initscript) - allow(Facter).to receive(:value).with('os.family').and_return('FreeBSD') + allow(Facter).to receive(:value).with(:osfamily).and_return('FreeBSD') end it "should correctly parse rcvar for FreeBSD < 7" do diff --git a/spec/unit/provider/service/gentoo_spec.rb b/spec/unit/provider/service/gentoo_spec.rb index 4c19d9e321e..335dc657af4 100644 --- a/spec/unit/provider/service/gentoo_spec.rb +++ b/spec/unit/provider/service/gentoo_spec.rb @@ -12,8 +12,8 @@ allow(Puppet::Type.type(:service)).to receive(:defaultprovider).and_return(provider_class) allow(FileTest).to receive(:file?).with('/sbin/rc-update').and_return(true) allow(FileTest).to receive(:executable?).with('/sbin/rc-update').and_return(true) - allow(Facter).to receive(:value).with('os.name').and_return('Gentoo') - allow(Facter).to receive(:value).with('os.family').and_return('Gentoo') + allow(Facter).to receive(:value).with(:operatingsystem).and_return('Gentoo') + allow(Facter).to receive(:value).with(:osfamily).and_return('Gentoo') # The initprovider (parent of the gentoo provider) does a stat call # before it even tries to execute an initscript. We use sshd in all the diff --git a/spec/unit/provider/service/init_spec.rb b/spec/unit/provider/service/init_spec.rb index 853ef05f663..b9525fb1261 100644 --- a/spec/unit/provider/service/init_spec.rb +++ b/spec/unit/provider/service/init_spec.rb @@ -39,8 +39,8 @@ describe "when running on FreeBSD" do before :each do - allow(Facter).to receive(:value).with('os.name').and_return('FreeBSD') - allow(Facter).to receive(:value).with('os.family').and_return('FreeBSD') + allow(Facter).to receive(:value).with(:operatingsystem).and_return('FreeBSD') + allow(Facter).to receive(:value).with(:osfamily).and_return('FreeBSD') end it "should set its default path to include /etc/rc.d and /usr/local/etc/rc.d" do @@ -50,7 +50,7 @@ describe "when running on HP-UX" do before :each do - allow(Facter).to receive(:value).with('os.name').and_return('HP-UX') + allow(Facter).to receive(:value).with(:operatingsystem).and_return('HP-UX') end it "should set its default path to include /sbin/init.d" do @@ -60,7 +60,7 @@ describe "when running on Archlinux" do before :each do - allow(Facter).to receive(:value).with('os.name').and_return('Archlinux') + allow(Facter).to receive(:value).with(:operatingsystem).and_return('Archlinux') end it "should set its default path to include /etc/rc.d" do @@ -70,7 +70,7 @@ describe "when not running on FreeBSD, HP-UX or Archlinux" do before :each do - allow(Facter).to receive(:value).with('os.name').and_return('RedHat') + allow(Facter).to receive(:value).with(:operatingsystem).and_return('RedHat') end it "should set its default path to include /etc/init.d" do @@ -103,7 +103,7 @@ end it "should omit Yocto services on cisco-wrlinux" do - allow(Facter).to receive(:value).with('os.family').and_return('cisco-wrlinux') + allow(Facter).to receive(:value).with(:osfamily).and_return('cisco-wrlinux') exclude = 'umountfs' expect(provider_class.get_services(provider_class.defpath).map(&:name)).to eq(@services - [exclude]) end @@ -282,7 +282,7 @@ describe "when starting a service on Solaris" do it "should use ctrun" do - allow(Facter).to receive(:value).with('os.family').and_return('Solaris') + allow(Facter).to receive(:value).with(:osfamily).and_return('Solaris') expect(provider).to receive(:execute).with('/usr/bin/ctrun -l child /service/path/myservice start', {:failonfail => true, :override_locale => false, :squelch => false, :combine => true}).and_return("") allow($CHILD_STATUS).to receive(:exitstatus).and_return(0) provider.start @@ -291,7 +291,7 @@ describe "when starting a service on RedHat" do it "should not use ctrun" do - allow(Facter).to receive(:value).with('os.family').and_return('RedHat') + allow(Facter).to receive(:value).with(:osfamily).and_return('RedHat') expect(provider).to receive(:execute).with(['/service/path/myservice', :start], {:failonfail => true, :override_locale => false, :squelch => false, :combine => true}).and_return("") allow($CHILD_STATUS).to receive(:exitstatus).and_return(0) provider.start diff --git a/spec/unit/provider/service/openbsd_spec.rb b/spec/unit/provider/service/openbsd_spec.rb index 396aa3ea267..90f003b5705 100644 --- a/spec/unit/provider/service/openbsd_spec.rb +++ b/spec/unit/provider/service/openbsd_spec.rb @@ -6,8 +6,8 @@ before :each do allow(Puppet::Type.type(:service)).to receive(:defaultprovider).and_return(provider_class) - allow(Facter).to receive(:value).with('os.name').and_return(:openbsd) - allow(Facter).to receive(:value).with('os.family').and_return('OpenBSD') + allow(Facter).to receive(:value).with(:operatingsystem).and_return(:openbsd) + allow(Facter).to receive(:value).with(:osfamily).and_return('OpenBSD') allow(FileTest).to receive(:file?).with('/usr/sbin/rcctl').and_return(true) allow(FileTest).to receive(:executable?).with('/usr/sbin/rcctl').and_return(true) end diff --git a/spec/unit/provider/service/openwrt_spec.rb b/spec/unit/provider/service/openwrt_spec.rb index 99d32c9ae26..3e424fd222b 100644 --- a/spec/unit/provider/service/openwrt_spec.rb +++ b/spec/unit/provider/service/openwrt_spec.rb @@ -38,7 +38,7 @@ operatingsystem = 'openwrt' it "should be the default provider on #{operatingsystem}" do - expect(Facter).to receive(:value).with('os.name').and_return(operatingsystem) + expect(Facter).to receive(:value).with(:operatingsystem).and_return(operatingsystem) expect(provider_class.default?).to be_truthy end diff --git a/spec/unit/provider/service/rcng_spec.rb b/spec/unit/provider/service/rcng_spec.rb index 1898d028de5..f4e2e7e5103 100644 --- a/spec/unit/provider/service/rcng_spec.rb +++ b/spec/unit/provider/service/rcng_spec.rb @@ -6,8 +6,8 @@ before :each do allow(Puppet::Type.type(:service)).to receive(:defaultprovider).and_return(provider_class) - allow(Facter).to receive(:value).with('os.name').and_return(:netbsd) - allow(Facter).to receive(:value).with('os.family').and_return('NetBSD') + allow(Facter).to receive(:value).with(:operatingsystem).and_return(:netbsd) + allow(Facter).to receive(:value).with(:osfamily).and_return('NetBSD') allow(provider_class).to receive(:defpath).and_return('/etc/rc.d') @provider = provider_class.new allow(@provider).to receive(:initscript) diff --git a/spec/unit/provider/service/redhat_spec.rb b/spec/unit/provider/service/redhat_spec.rb index fe7d3f69d95..652ca8f97aa 100644 --- a/spec/unit/provider/service/redhat_spec.rb +++ b/spec/unit/provider/service/redhat_spec.rb @@ -24,23 +24,23 @@ allow(@provider).to receive(:get).with(:hasstatus).and_return(false) allow(FileTest).to receive(:file?).with('/sbin/service').and_return(true) allow(FileTest).to receive(:executable?).with('/sbin/service').and_return(true) - allow(Facter).to receive(:value).with('os.name').and_return('CentOS') - allow(Facter).to receive(:value).with('os.family').and_return('RedHat') + allow(Facter).to receive(:value).with(:operatingsystem).and_return('CentOS') + allow(Facter).to receive(:value).with(:osfamily).and_return('RedHat') end osfamilies = [ 'RedHat' ] osfamilies.each do |osfamily| it "should be the default provider on #{osfamily}" do - expect(Facter).to receive(:value).with('os.family').and_return(osfamily) + expect(Facter).to receive(:value).with(:osfamily).and_return(osfamily) expect(provider_class.default?).to be_truthy end end it "should be the default provider on sles11" do - allow(Facter).to receive(:value).with('os.family').and_return(:suse) - allow(Facter).to receive(:value).with('os.name').and_return(:suse) - allow(Facter).to receive(:value).with('os.release.major').and_return("11") + allow(Facter).to receive(:value).with(:osfamily).and_return(:suse) + allow(Facter).to receive(:value).with(:operatingsystem).and_return(:suse) + allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("11") expect(provider_class.default?).to be_truthy end @@ -87,7 +87,7 @@ context "when checking enabled? on Suse" do before :each do - expect(Facter).to receive(:value).with('os.family').and_return('Suse') + expect(Facter).to receive(:value).with(:osfamily).and_return('Suse') end it "should check for on" do diff --git a/spec/unit/provider/service/smf_spec.rb b/spec/unit/provider/service/smf_spec.rb index 5d2ca235400..00b58c0c9f9 100644 --- a/spec/unit/provider/service/smf_spec.rb +++ b/spec/unit/provider/service/smf_spec.rb @@ -24,9 +24,9 @@ def set_resource_params(params = {}) allow(FileTest).to receive(:executable?).with('/usr/sbin/svcadm').and_return(true) allow(FileTest).to receive(:file?).with('/usr/bin/svcs').and_return(true) allow(FileTest).to receive(:executable?).with('/usr/bin/svcs').and_return(true) - allow(Facter).to receive(:value).with('os.name').and_return('Solaris') - allow(Facter).to receive(:value).with('os.family').and_return('Solaris') - allow(Facter).to receive(:value).with('os.release.full').and_return('11.2') + allow(Facter).to receive(:value).with(:operatingsystem).and_return('Solaris') + allow(Facter).to receive(:value).with(:osfamily).and_return('Solaris') + allow(Facter).to receive(:value).with(:operatingsystemrelease).and_return('11.2') end context ".instances" do it "should have an instances method" do @@ -173,19 +173,19 @@ def set_resource_params(params = {}) end it 'returns the right command for restarting the service for Solaris versions newer than 11.2' do - expect(Facter).to receive(:value).with('os.release.full').and_return('11.3') + expect(Facter).to receive(:value).with(:operatingsystemrelease).and_return('11.3') expect(@provider.restartcmd).to eql([@provider.command(:adm), :restart, '-s', fmri]) end it 'returns the right command for restarting the service on Solaris 11.2' do - expect(Facter).to receive(:value).with('os.release.full').and_return('11.2') + expect(Facter).to receive(:value).with(:operatingsystemrelease).and_return('11.2') expect(@provider.restartcmd).to eql([@provider.command(:adm), :restart, '-s', fmri]) end it 'returns the right command for restarting the service for Solaris versions older than Solaris 11.2' do - expect(Facter).to receive(:value).with('os.release.full').and_return('10.3') + expect(Facter).to receive(:value).with(:operatingsystemrelease).and_return('10.3') expect(@provider.restartcmd).to eql([@provider.command(:adm), :restart, fmri]) end @@ -281,7 +281,7 @@ def transition_service(from, to, tries) before(:each) do allow(@provider).to receive(:service_states).and_return(states) - allow(Facter).to receive(:value).with('os.release.full').and_return('10.3') + allow(Facter).to receive(:value).with(:operatingsystemrelease).and_return('10.3') end it "should run the status command if it's passed in" do @@ -336,7 +336,7 @@ def transition_service(from, to, tries) end it "should return stopped for an incomplete service on Solaris 11" do - allow(Facter).to receive(:value).with('os.release.full').and_return('11.3') + allow(Facter).to receive(:value).with(:operatingsystemrelease).and_return('11.3') allow(@provider).to receive(:complete_service?).and_return(false) expect(@provider.status).to eq(:stopped) end diff --git a/spec/unit/provider/service/systemd_spec.rb b/spec/unit/provider/service/systemd_spec.rb index d615c3173d3..33eac8ef9e3 100644 --- a/spec/unit/provider/service/systemd_spec.rb +++ b/spec/unit/provider/service/systemd_spec.rb @@ -27,149 +27,149 @@ osfamilies.each do |osfamily| it "should be the default provider on #{osfamily}" do - allow(Facter).to receive(:value).with('os.family').and_return(osfamily) - allow(Facter).to receive(:value).with('os.name').and_return(osfamily) - allow(Facter).to receive(:value).with('os.release.major').and_return("1234") + allow(Facter).to receive(:value).with(:osfamily).and_return(osfamily) + allow(Facter).to receive(:value).with(:operatingsystem).and_return(osfamily) + allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("1234") expect(provider_class).to be_default end end [7, 8].each do |ver| it "should be the default provider on rhel#{ver}" do - allow(Facter).to receive(:value).with('os.family').and_return(:redhat) - allow(Facter).to receive(:value).with('os.name').and_return(:redhat) - allow(Facter).to receive(:value).with('os.release.major').and_return(ver.to_s) + allow(Facter).to receive(:value).with(:osfamily).and_return(:redhat) + allow(Facter).to receive(:value).with(:operatingsystem).and_return(:redhat) + allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return(ver.to_s) expect(provider_class).to be_default end end [ 4, 5, 6 ].each do |ver| it "should not be the default provider on rhel#{ver}" do - allow(Facter).to receive(:value).with('os.family').and_return(:redhat) - allow(Facter).to receive(:value).with('os.name').and_return(:redhat) - allow(Facter).to receive(:value).with('os.release.major').and_return("#{ver}") + allow(Facter).to receive(:value).with(:osfamily).and_return(:redhat) + allow(Facter).to receive(:value).with(:operatingsystem).and_return(:redhat) + allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("#{ver}") expect(provider_class).not_to be_default end end [ 17, 18, 19, 20, 21, 22, 23 ].each do |ver| it "should be the default provider on fedora#{ver}" do - allow(Facter).to receive(:value).with('os.family').and_return(:redhat) - allow(Facter).to receive(:value).with('os.name').and_return(:fedora) - allow(Facter).to receive(:value).with('os.release.major').and_return("#{ver}") + allow(Facter).to receive(:value).with(:osfamily).and_return(:redhat) + allow(Facter).to receive(:value).with(:operatingsystem).and_return(:fedora) + allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("#{ver}") expect(provider_class).to be_default end end it "should be the default provider on Amazon Linux 2.0" do - allow(Facter).to receive(:value).with('os.family').and_return(:redhat) - allow(Facter).to receive(:value).with('os.name').and_return(:amazon) - allow(Facter).to receive(:value).with('os.release.major').and_return("2") + allow(Facter).to receive(:value).with(:osfamily).and_return(:redhat) + allow(Facter).to receive(:value).with(:operatingsystem).and_return(:amazon) + allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("2") expect(provider_class).to be_default end it "should not be the default provider on Amazon Linux 2017.09" do - allow(Facter).to receive(:value).with('os.family').and_return(:redhat) - allow(Facter).to receive(:value).with('os.name').and_return(:amazon) - allow(Facter).to receive(:value).with('os.release.major').and_return("2017") + allow(Facter).to receive(:value).with(:osfamily).and_return(:redhat) + allow(Facter).to receive(:value).with(:operatingsystem).and_return(:amazon) + allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("2017") expect(provider_class).not_to be_default end it "should be the default provider on cumulus3" do - allow(Facter).to receive(:value).with('os.family').and_return(:debian) - allow(Facter).to receive(:value).with('os.name').and_return('CumulusLinux') - allow(Facter).to receive(:value).with('os.release.major').and_return("3") + allow(Facter).to receive(:value).with(:osfamily).and_return(:debian) + allow(Facter).to receive(:value).with(:operatingsystem).and_return('CumulusLinux') + allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("3") expect(provider_class).to be_default end it "should be the default provider on sles12" do - allow(Facter).to receive(:value).with('os.family').and_return(:suse) - allow(Facter).to receive(:value).with('os.name').and_return(:suse) - allow(Facter).to receive(:value).with('os.release.major').and_return("12") + allow(Facter).to receive(:value).with(:osfamily).and_return(:suse) + allow(Facter).to receive(:value).with(:operatingsystem).and_return(:suse) + allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("12") expect(provider_class).to be_default end it "should be the default provider on opensuse13" do - allow(Facter).to receive(:value).with('os.family').and_return(:suse) - allow(Facter).to receive(:value).with('os.name').and_return(:suse) - allow(Facter).to receive(:value).with('os.release.major').and_return("13") + allow(Facter).to receive(:value).with(:osfamily).and_return(:suse) + allow(Facter).to receive(:value).with(:operatingsystem).and_return(:suse) + allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("13") expect(provider_class).to be_default end # tumbleweed is a rolling release with date-based major version numbers it "should be the default provider on tumbleweed" do - allow(Facter).to receive(:value).with('os.family').and_return(:suse) - allow(Facter).to receive(:value).with('os.name').and_return(:suse) - allow(Facter).to receive(:value).with('os.release.major').and_return("20150829") + allow(Facter).to receive(:value).with(:osfamily).and_return(:suse) + allow(Facter).to receive(:value).with(:operatingsystem).and_return(:suse) + allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("20150829") expect(provider_class).to be_default end # leap is the next generation suse release it "should be the default provider on leap" do - allow(Facter).to receive(:value).with('os.family').and_return(:suse) - allow(Facter).to receive(:value).with('os.name').and_return(:leap) - allow(Facter).to receive(:value).with('os.release.major').and_return("42") + allow(Facter).to receive(:value).with(:osfamily).and_return(:suse) + allow(Facter).to receive(:value).with(:operatingsystem).and_return(:leap) + allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("42") expect(provider_class).to be_default end it "should not be the default provider on debian7" do - allow(Facter).to receive(:value).with('os.family').and_return(:debian) - allow(Facter).to receive(:value).with('os.name').and_return(:debian) - allow(Facter).to receive(:value).with('os.release.major').and_return("7") + allow(Facter).to receive(:value).with(:osfamily).and_return(:debian) + allow(Facter).to receive(:value).with(:operatingsystem).and_return(:debian) + allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("7") expect(provider_class).not_to be_default end it "should be the default provider on debian8" do - allow(Facter).to receive(:value).with('os.family').and_return(:debian) - allow(Facter).to receive(:value).with('os.name').and_return(:debian) - allow(Facter).to receive(:value).with('os.release.major').and_return("8") + allow(Facter).to receive(:value).with(:osfamily).and_return(:debian) + allow(Facter).to receive(:value).with(:operatingsystem).and_return(:debian) + allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("8") expect(provider_class).to be_default end it "should be the default provider on debian11" do - allow(Facter).to receive(:value).with('os.family').and_return(:debian) - allow(Facter).to receive(:value).with('os.name').and_return(:debian) - allow(Facter).to receive(:value).with('os.release.major').and_return("11") + allow(Facter).to receive(:value).with(:osfamily).and_return(:debian) + allow(Facter).to receive(:value).with(:operatingsystem).and_return(:debian) + allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("11") expect(provider_class).to be_default end it "should be the default provider on debian bookworm/sid" do - allow(Facter).to receive(:value).with('os.family').and_return(:debian) - allow(Facter).to receive(:value).with('os.name').and_return(:debian) - allow(Facter).to receive(:value).with('os.release.major').and_return("bookworm/sid") + allow(Facter).to receive(:value).with(:osfamily).and_return(:debian) + allow(Facter).to receive(:value).with(:operatingsystem).and_return(:debian) + allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("bookworm/sid") expect(provider_class).to be_default end it "should not be the default provider on ubuntu14.04" do - allow(Facter).to receive(:value).with('os.family').and_return(:debian) - allow(Facter).to receive(:value).with('os.name').and_return(:ubuntu) - allow(Facter).to receive(:value).with('os.release.major').and_return("14.04") + allow(Facter).to receive(:value).with(:osfamily).and_return(:debian) + allow(Facter).to receive(:value).with(:operatingsystem).and_return(:ubuntu) + allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("14.04") expect(provider_class).not_to be_default end [ '15.04', '15.10', '16.04', '16.10', '17.04', '17.10', '18.04' ].each do |ver| it "should be the default provider on ubuntu#{ver}" do - allow(Facter).to receive(:value).with('os.family').and_return(:debian) - allow(Facter).to receive(:value).with('os.name').and_return(:ubuntu) - allow(Facter).to receive(:value).with('os.release.major').and_return("#{ver}") + allow(Facter).to receive(:value).with(:osfamily).and_return(:debian) + allow(Facter).to receive(:value).with(:operatingsystem).and_return(:ubuntu) + allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("#{ver}") expect(provider_class).to be_default end end [ '10', '11', '12', '13', '14', '15', '16', '17' ].each do |ver| it "should not be the default provider on LinuxMint#{ver}" do - allow(Facter).to receive(:value).with('os.family').and_return(:debian) - allow(Facter).to receive(:value).with('os.name').and_return(:LinuxMint) - allow(Facter).to receive(:value).with('os.release.major').and_return("#{ver}") + allow(Facter).to receive(:value).with(:osfamily).and_return(:debian) + allow(Facter).to receive(:value).with(:operatingsystem).and_return(:LinuxMint) + allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("#{ver}") expect(provider_class).not_to be_default end end [ '18', '19' ].each do |ver| it "should be the default provider on LinuxMint#{ver}" do - allow(Facter).to receive(:value).with('os.family').and_return(:debian) - allow(Facter).to receive(:value).with('os.name').and_return(:LinuxMint) - allow(Facter).to receive(:value).with('os.release.major').and_return("#{ver}") + allow(Facter).to receive(:value).with(:osfamily).and_return(:debian) + allow(Facter).to receive(:value).with(:operatingsystem).and_return(:LinuxMint) + allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("#{ver}") expect(provider_class).to be_default end end diff --git a/spec/unit/provider/service/upstart_spec.rb b/spec/unit/provider/service/upstart_spec.rb index 10488c81812..3a4e5a08902 100644 --- a/spec/unit/provider/service/upstart_spec.rb +++ b/spec/unit/provider/service/upstart_spec.rb @@ -26,8 +26,8 @@ def lists_processes_as(output) end it "should be the default provider on Ubuntu" do - expect(Facter).to receive(:value).with('os.name').and_return("Ubuntu") - expect(Facter).to receive(:value).with('os.release.major').and_return("12.04") + expect(Facter).to receive(:value).with(:operatingsystem).and_return("Ubuntu") + expect(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("12.04") expect(provider_class.default?).to be_truthy end @@ -55,7 +55,7 @@ def lists_processes_as(output) describe "excluding services" do it "ignores tty and serial on Redhat systems" do - allow(Facter).to receive(:value).with('os.family').and_return('RedHat') + allow(Facter).to receive(:value).with(:osfamily).and_return('RedHat') expect(provider_class.excludes).to include 'serial' expect(provider_class.excludes).to include 'tty' end diff --git a/spec/unit/provider/user/directoryservice_spec.rb b/spec/unit/provider/user/directoryservice_spec.rb index 0d9308e5960..882e94f5111 100644 --- a/spec/unit/provider/user/directoryservice_spec.rb +++ b/spec/unit/provider/user/directoryservice_spec.rb @@ -1111,9 +1111,9 @@ module Puppet::Util::Plist provider.class.instance_variable_set(:@os_version, nil) if provider.class.instance_variable_defined? :@os_version end - it 'should call Facter.value("os.macosx.version.major") ONLY ONCE no matter how ' + + it 'should call Facter.value(:macosx_productversion_major) ONLY ONCE no matter how ' + 'many times get_os_version() is called' do - expect(Facter).to receive(:value).with('os.macosx.version.major').once.and_return('10.8') + expect(Facter).to receive(:value).with(:macosx_productversion_major).once.and_return('10.8') expect(provider.class.get_os_version).to eq('10.8') expect(provider.class.get_os_version).to eq('10.8') expect(provider.class.get_os_version).to eq('10.8') diff --git a/spec/unit/provider/user/openbsd_spec.rb b/spec/unit/provider/user/openbsd_spec.rb index 7a35dd92472..0079f357a7a 100644 --- a/spec/unit/provider/user/openbsd_spec.rb +++ b/spec/unit/provider/user/openbsd_spec.rb @@ -44,8 +44,8 @@ describe "#addcmd" do it "should return an array with the full command and expiry as MM/DD/YY" do - allow(Facter).to receive(:value).with('os.family').and_return('OpenBSD') - allow(Facter).to receive(:value).with('os.release.major') + allow(Facter).to receive(:value).with(:osfamily).and_return('OpenBSD') + allow(Facter).to receive(:value).with(:operatingsystemmajrelease) resource[:expiry] = "1997-06-01" expect(provider.addcmd).to eq(['/usr/sbin/useradd', '-e', 'June 01 1997', 'myuser']) end diff --git a/spec/unit/provider/user/useradd_spec.rb b/spec/unit/provider/user/useradd_spec.rb index fa48f3a33a4..a8a5ed750d0 100644 --- a/spec/unit/provider/user/useradd_spec.rb +++ b/spec/unit/provider/user/useradd_spec.rb @@ -75,8 +75,8 @@ context "when setting groups" do it "uses -G to set groups" do - allow(Facter).to receive(:value).with('os.family').and_return('Solaris') - allow(Facter).to receive(:value).with('os.release.major') + allow(Facter).to receive(:value).with(:osfamily).and_return('Solaris') + allow(Facter).to receive(:value).with(:operatingsystemmajrelease) resource[:ensure] = :present resource[:groups] = ['group1', 'group2'] expect(provider).to receive(:execute).with(['/usr/sbin/useradd', '-G', 'group1,group2', 'myuser'], kind_of(Hash)) @@ -84,8 +84,8 @@ end it "uses -G to set groups with -M on supported systems" do - allow(Facter).to receive(:value).with('os.family').and_return('RedHat') - allow(Facter).to receive(:value).with('os.release.major') + allow(Facter).to receive(:value).with(:osfamily).and_return('RedHat') + allow(Facter).to receive(:value).with(:operatingsystemmajrelease) resource[:ensure] = :present resource[:groups] = ['group1', 'group2'] expect(provider).to receive(:execute).with(['/usr/sbin/useradd', '-G', 'group1,group2', '-M', 'myuser'], kind_of(Hash)) @@ -303,14 +303,14 @@ describe "#expiry=" do it "should pass expiry to usermod as MM/DD/YY when on Solaris" do - expect(Facter).to receive(:value).with('os.name').and_return('Solaris') + expect(Facter).to receive(:value).with(:operatingsystem).and_return('Solaris') resource[:expiry] = '2012-10-31' expect(provider).to receive(:execute).with(['/usr/sbin/usermod', '-e', '10/31/2012', 'myuser'], hash_including(custom_environment: {})) provider.expiry = '2012-10-31' end it "should pass expiry to usermod as YYYY-MM-DD when not on Solaris" do - expect(Facter).to receive(:value).with('os.name').and_return('not_solaris') + expect(Facter).to receive(:value).with(:operatingsystem).and_return('not_solaris') resource[:expiry] = '2012-10-31' expect(provider).to receive(:execute).with(['/usr/sbin/usermod', '-e', '2012-10-31', 'myuser'], hash_including(custom_environment: {})) provider.expiry = '2012-10-31' @@ -323,8 +323,8 @@ end it "should use -e with -1 when the expiry property is removed on SLES11" do - allow(Facter).to receive(:value).with('os.name').and_return('SLES') - allow(Facter).to receive(:value).with('os.release.major').and_return('11') + allow(Facter).to receive(:value).with(:operatingsystem).and_return('SLES') + allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return('11') resource[:expiry] = :absent expect(provider).to receive(:execute).with(['/usr/sbin/usermod', '-e', -1, 'myuser'], hash_including(custom_environment: {})) provider.expiry = :absent @@ -487,16 +487,16 @@ end it "should use -M flag if home is not managed on a supported system" do - allow(Facter).to receive(:value).with('os.family').and_return("RedHat") - allow(Facter).to receive(:value).with('os.release.major') + allow(Facter).to receive(:value).with(:osfamily).and_return("RedHat") + allow(Facter).to receive(:value).with(:operatingsystemmajrelease) resource[:managehome] = :false expect(provider).to receive(:execute).with(include('-M'), kind_of(Hash)) provider.create end it "should not use -M flag if home is not managed on an unsupported system" do - allow(Facter).to receive(:value).with('os.family').and_return("Suse") - allow(Facter).to receive(:value).with('os.release.major').and_return("11") + allow(Facter).to receive(:value).with(:osfamily).and_return("Suse") + allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("11") resource[:managehome] = :false expect(provider).to receive(:execute).with(excluding('-M'), kind_of(Hash)) provider.create @@ -557,14 +557,14 @@ end it "should return an array with the full command and expiry as MM/DD/YY when on Solaris" do - allow(Facter).to receive(:value).with('os.name').and_return('Solaris') + allow(Facter).to receive(:value).with(:operatingsystem).and_return('Solaris') expect(described_class).to receive(:system_users?).and_return(true) resource[:expiry] = "2012-08-18" expect(provider.addcmd).to eq(['/usr/sbin/useradd', '-e', '08/18/2012', '-G', 'somegroup', '-o', '-m', '-r', 'myuser']) end it "should return an array with the full command and expiry as YYYY-MM-DD when not on Solaris" do - allow(Facter).to receive(:value).with('os.name').and_return('not_solaris') + allow(Facter).to receive(:value).with(:operatingsystem).and_return('not_solaris') expect(described_class).to receive(:system_users?).and_return(true) resource[:expiry] = "2012-08-18" expect(provider.addcmd).to eq(['/usr/sbin/useradd', '-e', '2012-08-18', '-G', 'somegroup', '-o', '-m', '-r', 'myuser']) diff --git a/spec/unit/provider_spec.rb b/spec/unit/provider_spec.rb index 5dd31da76a6..c79edf41637 100644 --- a/spec/unit/provider_spec.rb +++ b/spec/unit/provider_spec.rb @@ -222,20 +222,20 @@ def existing_command { :true => false } => false, { :false => false } => true, { :false => true } => false, - { 'os.name' => Facter.value('os.name') } => true, - { 'os.name' => :yayness } => false, + { :operatingsystem => Facter.value(:operatingsystem) } => true, + { :operatingsystem => :yayness } => false, { :nothing => :yayness } => false, { :exists => Puppet::Util.which(existing_command) } => true, { :exists => "/this/file/does/not/exist" } => false, { :true => true, :exists => Puppet::Util.which(existing_command) } => true, { :true => true, :exists => "/this/file/does/not/exist" } => false, - { 'os.name' => Facter.value('os.name'), + { :operatingsystem => Facter.value(:operatingsystem), :exists => Puppet::Util.which(existing_command) } => true, - { 'os.name' => :yayness, + { :operatingsystem => :yayness, :exists => Puppet::Util.which(existing_command) } => false, - { 'os.name' => Facter.value('os.name'), + { :operatingsystem => Facter.value(:operatingsystem), :exists => "/this/file/does/not/exist" } => false, - { 'os.name' => :yayness, + { :operatingsystem => :yayness, :exists => "/this/file/does/not/exist" } => false, }.each do |confines, result| it "should confine #{confines.inspect} to #{result}" do @@ -269,32 +269,32 @@ def existing_command end context "default providers" do - let :os do Facter.value('os.name') end + let :os do Facter.value(:operatingsystem) end it { is_expected.to respond_to :specificity } it "should find the default provider" do type.provide(:nondefault) {} - subject.defaultfor 'os.name' => os + subject.defaultfor :operatingsystem => os expect(subject.name).to eq(type.defaultprovider.name) end describe "regex matches" do it "should match a singular regex" do - expect(Facter).to receive(:value).with('os.family').at_least(:once).and_return("solaris") + expect(Facter).to receive(:value).with(:osfamily).at_least(:once).and_return("solaris") one = type.provide(:one) do - defaultfor 'os.family' => /solaris/ + defaultfor :osfamily => /solaris/ end expect(one).to be_default end it "should not match a non-matching regex " do - expect(Facter).to receive(:value).with('os.family').at_least(:once).and_return("redhat") + expect(Facter).to receive(:value).with(:osfamily).at_least(:once).and_return("redhat") one = type.provide(:one) do - defaultfor 'os.family' => /solaris/ + defaultfor :osfamily => /solaris/ end expect(one).to_not be_default @@ -302,15 +302,15 @@ def existing_command it "should allow a mix of regex and string" do - expect(Facter).to receive(:value).with('os.name').at_least(:once).and_return("fedora") - expect(Facter).to receive(:value).with('os.release.major').at_least(:once).and_return("24") + expect(Facter).to receive(:value).with(:operatingsystem).at_least(:once).and_return("fedora") + expect(Facter).to receive(:value).with(:operatingsystemmajrelease).at_least(:once).and_return("24") one = type.provide(:one) do - defaultfor 'os.name' => "fedora", 'os.release.major' => /^2[2-9]$/ + defaultfor :operatingsystem => "fedora", :operatingsystemmajrelease => /^2[2-9]$/ end two = type.provide(:two) do - defaultfor 'os.name' => /fedora/, 'os.release.major' => '24' + defaultfor :operatingsystem => /fedora/, :operatingsystemmajrelease => '24' end expect(one).to be_default @@ -320,21 +320,21 @@ def existing_command describe "when there are multiple defaultfor's of equal specificity" do before :each do - subject.defaultfor 'os.name' => :os1 - subject.defaultfor 'os.name' => :os2 + subject.defaultfor :operatingsystem => :os1 + subject.defaultfor :operatingsystem => :os2 end let(:alternate) { type.provide(:alternate) {} } it "should be default for the first defaultfor" do - expect(Facter).to receive(:value).with('os.name').at_least(:once).and_return(:os1) + expect(Facter).to receive(:value).with(:operatingsystem).at_least(:once).and_return(:os1) expect(provider).to be_default expect(alternate).not_to be_default end it "should be default for the last defaultfor" do - expect(Facter).to receive(:value).with('os.name').at_least(:once).and_return(:os2) + expect(Facter).to receive(:value).with(:operatingsystem).at_least(:once).and_return(:os2) expect(provider).to be_default expect(alternate).not_to be_default @@ -343,31 +343,31 @@ def existing_command describe "when there are multiple defaultfor's with different specificity" do before :each do - subject.defaultfor 'os.name' => :os1 - subject.defaultfor 'os.name' => :os2, 'os.release.major' => "42" - subject.defaultfor 'os.name' => :os3, 'os.release.major' => /^4[2-9]$/ + subject.defaultfor :operatingsystem => :os1 + subject.defaultfor :operatingsystem => :os2, :operatingsystemmajrelease => "42" + subject.defaultfor :operatingsystem => :os3, :operatingsystemmajrelease => /^4[2-9]$/ end let(:alternate) { type.provide(:alternate) {} } it "should be default for a more specific, but matching, defaultfor" do - expect(Facter).to receive(:value).with('os.name').at_least(:once).and_return(:os2) - expect(Facter).to receive(:value).with('os.release.major').at_least(:once).and_return("42") + expect(Facter).to receive(:value).with(:operatingsystem).at_least(:once).and_return(:os2) + expect(Facter).to receive(:value).with(:operatingsystemmajrelease).at_least(:once).and_return("42") expect(provider).to be_default expect(alternate).not_to be_default end it "should be default for a more specific, but matching, defaultfor with regex" do - expect(Facter).to receive(:value).with('os.name').at_least(:once).and_return(:os3) - expect(Facter).to receive(:value).with('os.release.major').at_least(:once).and_return("42") + expect(Facter).to receive(:value).with(:operatingsystem).at_least(:once).and_return(:os3) + expect(Facter).to receive(:value).with(:operatingsystemmajrelease).at_least(:once).and_return("42") expect(provider).to be_default expect(alternate).not_to be_default end it "should be default for a less specific, but matching, defaultfor" do - expect(Facter).to receive(:value).with('os.name').at_least(:once).and_return(:os1) + expect(Facter).to receive(:value).with(:operatingsystem).at_least(:once).and_return(:os1) expect(provider).to be_default expect(alternate).not_to be_default @@ -377,7 +377,7 @@ def existing_command it "should consider any true value enough to be default" do alternate = type.provide(:alternate) {} - subject.defaultfor 'os.name' => [:one, :two, :three, os] + subject.defaultfor :operatingsystem => [:one, :two, :three, os] expect(subject.name).to eq(type.defaultprovider.name) expect(subject).to be_default @@ -386,29 +386,29 @@ def existing_command it "should not be default if the defaultfor doesn't match" do expect(subject).not_to be_default - subject.defaultfor 'os.name' => :one + subject.defaultfor :operatingsystem => :one expect(subject).not_to be_default end it "should not be default if the notdefaultfor does match" do - expect(Facter).to receive(:value).with('os.name').at_least(:once).and_return("fedora") - expect(Facter).to receive(:value).with('os.release.major').at_least(:once).and_return("24") + expect(Facter).to receive(:value).with(:operatingsystem).at_least(:once).and_return("fedora") + expect(Facter).to receive(:value).with(:operatingsystemmajrelease).at_least(:once).and_return("24") one = type.provide(:one) do - defaultfor 'os.name' => "fedora" - notdefaultfor 'os.name' => "fedora", 'os.release.major' => 24 + defaultfor :operatingsystem => "fedora" + notdefaultfor :operatingsystem => "fedora", :operatingsystemmajrelease => 24 end expect(one).not_to be_default end it "should be default if the notdefaultfor doesn't match" do - expect(Facter).to receive(:value).with('os.name').at_least(:once).and_return("fedora") - expect(Facter).to receive(:value).with('os.release.major').at_least(:once).and_return("24") + expect(Facter).to receive(:value).with(:operatingsystem).at_least(:once).and_return("fedora") + expect(Facter).to receive(:value).with(:operatingsystemmajrelease).at_least(:once).and_return("24") one = type.provide(:one) do - defaultfor 'os.name' => "fedora" - notdefaultfor 'os.name' => "fedora", 'os.release.major' => 42 + defaultfor :operatingsystem => "fedora" + notdefaultfor :operatingsystem => "fedora", :operatingsystemmajrelease => 42 end expect(one).to be_default @@ -519,18 +519,18 @@ def existing_command end it "with the specification: %{spec}" % { spec: thisspec.join(', ') } do - allow(Facter).to receive(:value).with('os.family').and_return("redhat") - allow(Facter).to receive(:value).with('os.name').and_return("centos") - allow(Facter).to receive(:value).with('os.release.full').and_return("27") + allow(Facter).to receive(:value).with(:osfamily).and_return("redhat") + allow(Facter).to receive(:value).with(:operatingsystem).and_return("centos") + allow(Facter).to receive(:value).with(:operatingsystemrelease).and_return("27") one = type.provide(:one) do if defaultforspec[:one].key?(:defaultfor) - defaultfor 'os.family' => "redhat" if defaultforspec[:one][:defaultfor] - defaultfor 'os.family' => "ubuntu" if !defaultforspec[:one][:defaultfor] + defaultfor :osfamily => "redhat" if defaultforspec[:one][:defaultfor] + defaultfor :osfamily => "ubuntu" if !defaultforspec[:one][:defaultfor] end if defaultforspec[:one].key?(:notdefaultfor) - notdefaultfor 'os.name' => "centos" if defaultforspec[:one][:notdefaultfor] - notdefaultfor 'os.name' => "ubuntu" if !defaultforspec[:one][:notdefaultfor] + notdefaultfor :operatingsystem => "centos" if defaultforspec[:one][:notdefaultfor] + notdefaultfor :operatingsystem => "ubuntu" if !defaultforspec[:one][:notdefaultfor] end end @@ -538,14 +538,14 @@ def existing_command provider_options[:parent] = one if defaultforspec[:two][:derived] # :two inherits from one, if spec'd two = type.provide(:two, provider_options) do if defaultforspec[:two].key?(:defaultfor) || defaultforspec[:two].key?(:extradefaultfor) - defaultfor 'os.family' => "redhat" if defaultforspec[:two][:defaultfor] - defaultfor 'os.family' => "redhat",# defaultforspec[:two][:extradefaultfor] has two parts - 'os.name' => "centos" if defaultforspec[:two][:extradefaultfor] - defaultfor 'os.family' => "ubuntu" if !defaultforspec[:two][:defaultfor] + defaultfor :osfamily => "redhat" if defaultforspec[:two][:defaultfor] + defaultfor :osfamily => "redhat",# defaultforspec[:two][:extradefaultfor] has two parts + :operatingsystem => "centos" if defaultforspec[:two][:extradefaultfor] + defaultfor :osfamily => "ubuntu" if !defaultforspec[:two][:defaultfor] end if defaultforspec[:two].key?(:notdefaultfor) - notdefaultfor 'os.release.full' => "27" if defaultforspec[:two][:notdefaultfor] - notdefaultfor 'os.release.full' => "99" if !defaultforspec[:two][:notdefaultfor] + notdefaultfor :operatingsystemrelease => "27" if defaultforspec[:two][:notdefaultfor] + notdefaultfor :operatingsystemrelease => "99" if !defaultforspec[:two][:notdefaultfor] end end diff --git a/spec/unit/type/package_spec.rb b/spec/unit/type/package_spec.rb index ca62eeac5a0..346b9411f74 100644 --- a/spec/unit/type/package_spec.rb +++ b/spec/unit/type/package_spec.rb @@ -370,9 +370,9 @@ def setprops(properties) it "should select dnf over yum for dnf supported fedora versions" do dnf = Puppet::Type.type(:package).provider(:dnf) yum = Puppet::Type.type(:package).provider(:yum) - allow(Facter).to receive(:value).with('os.family').and_return(:redhat) - allow(Facter).to receive(:value).with('os.name').and_return(:fedora) - allow(Facter).to receive(:value).with('os.release.major').and_return("22") + allow(Facter).to receive(:value).with(:osfamily).and_return(:redhat) + allow(Facter).to receive(:value).with(:operatingsystem).and_return(:fedora) + allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return("22") expect(dnf.specificity).to be > yum.specificity end diff --git a/spec/unit/type/resources_spec.rb b/spec/unit/type/resources_spec.rb index 6c840e01657..cd17419f2bc 100644 --- a/spec/unit/type/resources_spec.rb +++ b/spec/unit/type/resources_spec.rb @@ -124,8 +124,8 @@ def self.instances context "on #{os}" do before :each do allow(Facter).to receive(:value).with(:kernel).and_return(os) - allow(Facter).to receive(:value).with('os.name').and_return(os) - allow(Facter).to receive(:value).with('os.family').and_return(os) + allow(Facter).to receive(:value).with(:operatingsystem).and_return(os) + allow(Facter).to receive(:value).with(:osfamily).and_return(os) allow(Puppet::FileSystem).to receive(:exist?).with('/etc/login.defs').and_return(false) @res = Puppet::Type.type(:resources).new :name => :user, :purge => true, :unless_system_user => true @res.catalog = Puppet::Resource::Catalog.new diff --git a/spec/unit/type_spec.rb b/spec/unit/type_spec.rb index bb002aef334..cc2e637c0fd 100644 --- a/spec/unit/type_spec.rb +++ b/spec/unit/type_spec.rb @@ -1142,7 +1142,7 @@ def self.title_patterns before :each do type.provide(:default) do - defaultfor 'os.name' => Facter.value('os.name') + defaultfor :operatingsystem => Facter.value(:operatingsystem) mk_resource_methods class << self attr_accessor :params @@ -1172,7 +1172,7 @@ def self.instances context "with a default provider" do before :each do type.provide(:default) do - defaultfor 'os.name' => Facter.value('os.name') + defaultfor :operatingsystem => Facter.value(:operatingsystem) mk_resource_methods class << self attr_accessor :names diff --git a/tasks/parallel.rake b/tasks/parallel.rake index 184aa90fcb8..3982f2249c8 100644 --- a/tasks/parallel.rake +++ b/tasks/parallel.rake @@ -401,7 +401,7 @@ else # Default group size in rspec examples DEFAULT_GROUP_SIZE = 1000 - process_count = [(args[:process_count] || Facter.value('processors.count')).to_i, 1].max + process_count = [(args[:process_count] || Facter.value("processorcount")).to_i, 1].max group_size = [(args[:group_size] || DEFAULT_GROUP_SIZE).to_i, 1].max abort unless Parallel::RSpec::Parallelizer.new(process_count, group_size, color_output?, args.extras).run From 8aebdce361b2e8847b511c6d5e207cd5b17c2482 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Fri, 12 Mar 2021 10:03:01 +0000 Subject: [PATCH 323/731] (packaging) Bump to version '7.6.0' [no-promote] --- .gemspec | 2 +- lib/puppet/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gemspec b/.gemspec index e882337ebe8..108d0f07013 100644 --- a/.gemspec +++ b/.gemspec @@ -13,7 +13,7 @@ Gem::Specification.new do |s| s.name = "puppet" - version = "7.5.0" + version = "7.6.0" mdata = version.match(/(\d+\.\d+\.\d+)/) s.version = mdata ? mdata[1] : version diff --git a/lib/puppet/version.rb b/lib/puppet/version.rb index 63564ffcd6f..68656edc341 100644 --- a/lib/puppet/version.rb +++ b/lib/puppet/version.rb @@ -6,7 +6,7 @@ # Raketasks and such to set the version based on the output of `git describe` module Puppet - PUPPETVERSION = '7.5.0' + PUPPETVERSION = '7.6.0' ## # version is a public API method intended to always provide a fast and From abdd67b2fa5de3280855fde1e369d5ea3f0a5fe3 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Mon, 15 Mar 2021 06:59:27 +0000 Subject: [PATCH 324/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 2 +- man/man8/puppet.8 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index 8e5b2482d8f..5abb483c1fe 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -907,7 +907,7 @@ The time to wait for data to be read from an HTTP connection\. If nothing is rea The HTTP User\-Agent string to send when making network requests\. . .IP "\(bu" 4 -\fIDefault\fR: Puppet/7\.5\.0 Ruby/2\.5\.1\-p57 (x86_64\-linux) +\fIDefault\fR: Puppet/7\.6\.0 Ruby/2\.5\.1\-p57 (x86_64\-linux) . .IP "" 0 . diff --git a/man/man8/puppet.8 b/man/man8/puppet.8 index 4faabd48691..abc2bf756ec 100644 --- a/man/man8/puppet.8 +++ b/man/man8/puppet.8 @@ -25,4 +25,4 @@ Specialized: 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 . .P -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\.5\.0 +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\.6\.0 From 9ba0b9fec1ca55bd87a559641fe4b26375657f11 Mon Sep 17 00:00:00 2001 From: Gabriel Nagy Date: Tue, 9 Mar 2021 16:11:25 +0200 Subject: [PATCH 325/731] (PUP-10923) Fix acceptance tests on main branch - common_package_name_in_different_providers Not really sure why the error message changed between 6.x and 7.x, but apart from this the functionality appears to be the same. - ticket_1334_clientbucket_corrupted.rb This failed due to PUP-10583 which changed the default digest algorithm to SHA256 for Puppet 7 --- .../package/common_package_name_in_different_providers.rb | 4 ++-- acceptance/tests/ticket_1334_clientbucket_corrupted.rb | 6 +----- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/acceptance/tests/resource/package/common_package_name_in_different_providers.rb b/acceptance/tests/resource/package/common_package_name_in_different_providers.rb index 9cbd195db50..0732afdf935 100644 --- a/acceptance/tests/resource/package/common_package_name_in_different_providers.rb +++ b/acceptance/tests/resource/package/common_package_name_in_different_providers.rb @@ -84,7 +84,7 @@ def verify_absent(hosts, pkg) MANIFEST apply_manifest_on(agents, collide1_manifest, :acceptable_exit_codes => [1]) do |result| - assert_match(/Error while evaluating a Resource Statement, Cannot alias Package\[other-guid\] to \["guid", nil\]/, "#{result.host}: #{result.stderr}") + assert_match(/Error while evaluating a Resource Statement, Cannot alias Package\[other-guid\] to \[nil, "guid", nil\]/, "#{result.host}: #{result.stderr}") end verify_absent agents, 'guid' @@ -96,7 +96,7 @@ def verify_absent(hosts, pkg) MANIFEST apply_manifest_on(agents, collide2_manifest, :acceptable_exit_codes => [1]) do |result| - assert_match(/Error while evaluating a Resource Statement, Cannot alias Package\[other-guid\] to \["guid", "#{gem_provider}"\]/, "#{result.host}: #{result.stderr}") + assert_match(/Error while evaluating a Resource Statement, Cannot alias Package\[other-guid\] to \[nil, "guid", "#{gem_provider}"\]/, "#{result.host}: #{result.stderr}") end verify_absent agents, 'guid' diff --git a/acceptance/tests/ticket_1334_clientbucket_corrupted.rb b/acceptance/tests/ticket_1334_clientbucket_corrupted.rb index 155353647d7..79826a43858 100644 --- a/acceptance/tests/ticket_1334_clientbucket_corrupted.rb +++ b/acceptance/tests/ticket_1334_clientbucket_corrupted.rb @@ -7,11 +7,7 @@ tmpfile = agent.tmpfile('c99977file') unmanaged_content = "unmanaged\n" - if on(agent, facter("fips_enabled")).stdout =~ /true/ - unmanaged_sha = Digest::SHA256.hexdigest(unmanaged_content) - else - unmanaged_sha = Digest::MD5.hexdigest(unmanaged_content) - end + unmanaged_sha = Digest::SHA256.hexdigest(unmanaged_content) managed_content = "managed\n" manifest = "file { '#{tmpfile}': content => '#{managed_content}', backup => 'puppet' }" From 4d09f891a7b30244d5efaf1d5e8ddd993b3a125f Mon Sep 17 00:00:00 2001 From: gimmy Date: Wed, 17 Mar 2021 11:30:17 +0200 Subject: [PATCH 326/731] (maint) stub Facter request to external services We added an Azure Metadata fact in Facter 4.0.52, and GH Actions VMs are running on Azure, so there's an additional http call being made which needs to be stubbed. Stub EC2 requests. --- spec/spec_helper.rb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 690b52a17c4..7c904562d7d 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -162,10 +162,20 @@ module PuppetSpec PUPPET_FACTER_2_GCE_URL = %r{^http://metadata/computeMetadata/v1(beta1)?}.freeze PUPPET_FACTER_3_GCE_URL = "http://metadata.google.internal/computeMetadata/v1/?recursive=true&alt=json".freeze + # Facter azure metadata endpoint + PUPPET_FACTER_AZ_URL = "http://169.254.169.254/metadata/instance?api-version=2020-09-01" + + # Facter EC2 endpoint + PUPPET_FACTER_EC2_METADATA = 'http://169.254.169.254/latest/meta-data/' + PUPPET_FACTER_EC2_USERDATA = 'http://169.254.169.254/latest/user-data/' + config.around :each do |example| - # Ignore requests from Facter GCE fact in Travis + # Ignore requests from Facter to external services stub_request(:get, PUPPET_FACTER_2_GCE_URL) stub_request(:get, PUPPET_FACTER_3_GCE_URL) + stub_request(:get, PUPPET_FACTER_AZ_URL) + stub_request(:get, PUPPET_FACTER_EC2_METADATA) + stub_request(:get, PUPPET_FACTER_EC2_USERDATA) # Enable VCR if the example is tagged with `:vcr` metadata. if example.metadata[:vcr] From 19adfc724067247bef83f94b788bbe08214eccbf Mon Sep 17 00:00:00 2001 From: Gabriel Nagy Date: Wed, 17 Mar 2021 13:57:32 +0200 Subject: [PATCH 327/731] (PUP-10923) Fix aix acceptance test An unwanted change from the following commit https://github.com/puppetlabs/puppet/commit/2dd43150b3596b872e82141a6b1be515dd805809#diff-8605333114f5da06990288c0de42387d8b1e0e694eb670498efa0fa5fc0597e3R63-R68 got in main, which breaks the AIX service tests as the call to `run_nonexistent_service_tests` was changed, but the method signature was not changed. To fix this, revert to the 6.x version of the AIX test. --- acceptance/tests/resource/service/AIX_service_provider.rb | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/acceptance/tests/resource/service/AIX_service_provider.rb b/acceptance/tests/resource/service/AIX_service_provider.rb index 7d5ac13ae04..410f2269399 100644 --- a/acceptance/tests/resource/service/AIX_service_provider.rb +++ b/acceptance/tests/resource/service/AIX_service_provider.rb @@ -60,12 +60,7 @@ def lssrc_assert_status(host, service, expected_status) agents.each do |agent| - ## Setup - run_nonexistent_service_tests( - 'sloth_daemon', - /The sloth_daemon Subsystem is not on file/, - { 'starting' => 'ensure => running' } - ) + run_nonexistent_service_tests('nonexistent_service') step "Setup on #{agent}" sloth_daemon_path = agent.tmpfile("sloth_daemon.sh") From 156810e89cf073ec7b2a0db76f9a02f3965dfd4a Mon Sep 17 00:00:00 2001 From: Gabriel Nagy Date: Wed, 17 Mar 2021 15:22:00 +0200 Subject: [PATCH 328/731] (maint) Increase timeout for puppet service test Bump the timeout until we fix FACT-2988. --- acceptance/tests/resource/service/puppet_service_runs_puppet.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/acceptance/tests/resource/service/puppet_service_runs_puppet.rb b/acceptance/tests/resource/service/puppet_service_runs_puppet.rb index a8a591cac81..fb58b55bf4a 100644 --- a/acceptance/tests/resource/service/puppet_service_runs_puppet.rb +++ b/acceptance/tests/resource/service/puppet_service_runs_puppet.rb @@ -30,7 +30,7 @@ assert_service_status_on_host(agent, 'puppet', {'ensure' => 'running'}) end - retry_params = {:max_retries => 15, + retry_params = {:max_retries => 30, :retry_interval => 2} step 'Ensure last_run_report.yaml is created' do From bc416192bfa24f24c636c2026fe3b3835bcad8ca Mon Sep 17 00:00:00 2001 From: mihaibuzgau Date: Fri, 19 Mar 2021 12:36:22 +0200 Subject: [PATCH 329/731] (maint) skip ciphersuite test if openssl is < 1.1.1f --- spec/integration/http/client_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/integration/http/client_spec.rb b/spec/integration/http/client_spec.rb index 3b6a2ea38f4..34e6ba5030d 100644 --- a/spec/integration/http/client_spec.rb +++ b/spec/integration/http/client_spec.rb @@ -153,7 +153,7 @@ end context 'ciphersuites' do - it "does not connect when using an SSLv3 ciphersuite" do + it "does not connect when using an SSLv3 ciphersuite", :if => Puppet::Util::Package.versioncmp(OpenSSL::OPENSSL_LIBRARY_VERSION.split[1], '1.1.1e') > 0 do Puppet[:ciphers] = "DES-CBC3-SHA" https_server.start_server do |port| From 40a6a15aa3e994d0da89af4430117dda230478c1 Mon Sep 17 00:00:00 2001 From: Maggie Dreyer Date: Tue, 23 Mar 2021 11:43:13 -0700 Subject: [PATCH 330/731] (PUP-10952) Respect `rich_data` setting without rereading env conf This commit removes the on-write hook from the rich data setting, instead updating environments to read the current value from settings directly when queried, if not overwritten in the environment conf. The env conf is read once and its rich_data setting (or lack thereof) is cached, so we don't read the file over and over. --- lib/puppet/defaults.rb | 4 ---- lib/puppet/node/environment.rb | 17 ++++++++++++----- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb index ff3293f128f..9e710df94d0 100644 --- a/lib/puppet/defaults.rb +++ b/lib/puppet/defaults.rb @@ -2157,10 +2157,6 @@ def self.initialize_default_settings!(settings) :rich_data => { :default => true, :type => :boolean, - :hook => proc do |value| - envs = Puppet.lookup(:environments) { nil } - envs.clear_all unless envs.nil? - end, :desc => <<-'EOT' Enables having extended data in the catalog by storing them as a hash with the special key `__ptype`. When enabled, resource containing values of the data types `Binary`, `Regexp`, diff --git a/lib/puppet/node/environment.rb b/lib/puppet/node/environment.rb index 1e8f49d5f79..c178f2791ff 100644 --- a/lib/puppet/node/environment.rb +++ b/lib/puppet/node/environment.rb @@ -214,15 +214,22 @@ def validation_errors errors end + def rich_data_from_env_conf + unless @checked_conf_for_rich_data + environment_conf = Puppet.lookup(:environments).get_conf(name) + @rich_data_from_conf = environment_conf&.rich_data + @checked_conf_for_rich_data = true + end + @rich_data_from_conf + end + # Checks if this environment permits use of rich data types in the catalog + # Checks the environment conf for an override on first query, then going forward + # either uses that, or if unset, uses the current value of the `rich_data` setting. # @return [Boolean] `true` if rich data is permitted. # @api private def rich_data? - if @rich_data.nil? - environment_conf = Puppet.lookup(:environments).get_conf(name) - @rich_data = (environment_conf.nil? ? Puppet[:rich_data] : environment_conf.rich_data) - end - @rich_data + @rich_data = rich_data_from_env_conf.nil? ? Puppet[:rich_data] : rich_data_from_env_conf end # Return an environment-specific Puppet setting. From b3f11438bfc6666cb5f65cd357c7d49495f71288 Mon Sep 17 00:00:00 2001 From: Lucy Wyman Date: Fri, 26 Mar 2021 12:35:35 -0700 Subject: [PATCH 331/731] (PUP-10996) Enabled loading scripts from a `scripts` directory This adds a new subdirectory to the `Module` class `scripts/` which automatically generates the functions `scripts?()`, `scripts()`, and `script()` on the class for retrieving available scripts. This is part of the [scripts milestone](https://github.com/puppetlabs/bolt/issues?q=is%3Aopen+is%3Aissue+milestone%3AScripts) for Bolt, which aims to eventually standardize on more specific file loading from either the `files/` directory or `scripts/` directory in a module. This doesn't need a file serving endpoint (at least for now) as we don't plan to support this in Puppetserver - users who want to use scripts with file resources should use the files directory rather than scripts. --- lib/puppet/module.rb | 1 + spec/unit/module_spec.rb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/puppet/module.rb b/lib/puppet/module.rb index 3b13ba843e4..92c19141104 100644 --- a/lib/puppet/module.rb +++ b/lib/puppet/module.rb @@ -25,6 +25,7 @@ class InvalidFilePattern < Error; end "plugins" => "lib", "pluginfacts" => "facts.d", "locales" => "locales", + "scripts" => "scripts", } # Find and return the +module+ that +path+ belongs to. If +path+ is diff --git a/spec/unit/module_spec.rb b/spec/unit/module_spec.rb index 71bc459ffaf..d12554037f2 100644 --- a/spec/unit/module_spec.rb +++ b/spec/unit/module_spec.rb @@ -478,7 +478,7 @@ end end - [:plugins, :pluginfacts, :templates, :files, :manifests].each do |filetype| + [:plugins, :pluginfacts, :templates, :files, :manifests, :scripts].each do |filetype| case filetype when :plugins dirname = "lib" From 653407e2558c47d7531df957b0f390d229c8a199 Mon Sep 17 00:00:00 2001 From: Maggie Dreyer Date: Mon, 29 Mar 2021 13:14:55 -0700 Subject: [PATCH 332/731] (maint) Target Rubocop at Ruby 2.4 to allow safe call operator --- .rubocop.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.rubocop.yml b/.rubocop.yml index 58196318a05..0c8d319a03d 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -2,6 +2,7 @@ require: rubocop-i18n AllCops: + TargetRubyVersion: 2.4 Include: - 'lib/**/*.rb' - 'ext/**/*.rb' @@ -543,6 +544,9 @@ Style/ParallelAssignment: Performance/RedundantBlockCall: Enabled: false +Performance/RegexpMatch: + Enabled: false + Style/IdenticalConditionalBranches: Enabled: false From 1b568483446eafedc68b4bc3ad675a33f96c3ec7 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Thu, 1 Apr 2021 09:09:24 +0000 Subject: [PATCH 333/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 2 +- man/man8/puppet-agent.8 | 2 +- man/man8/puppet-apply.8 | 2 +- man/man8/puppet-catalog.8 | 2 +- man/man8/puppet-config.8 | 2 +- man/man8/puppet-describe.8 | 2 +- man/man8/puppet-device.8 | 2 +- man/man8/puppet-doc.8 | 2 +- man/man8/puppet-epp.8 | 2 +- man/man8/puppet-facts.8 | 2 +- man/man8/puppet-filebucket.8 | 2 +- man/man8/puppet-generate.8 | 2 +- man/man8/puppet-help.8 | 2 +- man/man8/puppet-lookup.8 | 2 +- man/man8/puppet-module.8 | 2 +- man/man8/puppet-node.8 | 2 +- man/man8/puppet-parser.8 | 2 +- man/man8/puppet-plugin.8 | 2 +- man/man8/puppet-report.8 | 2 +- man/man8/puppet-resource.8 | 2 +- man/man8/puppet-script.8 | 2 +- man/man8/puppet-ssl.8 | 2 +- man/man8/puppet.8 | 2 +- 23 files changed, 23 insertions(+), 23 deletions(-) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index 5abb483c1fe..b1e65eb62aa 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPETCONF" "5" "March 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPETCONF" "5" "April 2021" "Puppet, Inc." "Puppet manual" \fBThis page is autogenerated; any changes will get overwritten\fR . .SH "Configuration settings" diff --git a/man/man8/puppet-agent.8 b/man/man8/puppet-agent.8 index 7cd4037a63f..d3e3e132e9a 100644 --- a/man/man8/puppet-agent.8 +++ b/man/man8/puppet-agent.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-AGENT" "8" "March 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-AGENT" "8" "April 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-agent\fR \- The puppet agent daemon diff --git a/man/man8/puppet-apply.8 b/man/man8/puppet-apply.8 index 3e03e6f1d93..b3b2fe10c26 100644 --- a/man/man8/puppet-apply.8 +++ b/man/man8/puppet-apply.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-APPLY" "8" "March 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-APPLY" "8" "April 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-apply\fR \- Apply Puppet manifests locally diff --git a/man/man8/puppet-catalog.8 b/man/man8/puppet-catalog.8 index 3acb821759a..36e92fd7f6c 100644 --- a/man/man8/puppet-catalog.8 +++ b/man/man8/puppet-catalog.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-CATALOG" "8" "March 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-CATALOG" "8" "April 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-catalog\fR \- Compile, save, view, and convert catalogs\. diff --git a/man/man8/puppet-config.8 b/man/man8/puppet-config.8 index bcc425150c2..8edfefd8aea 100644 --- a/man/man8/puppet-config.8 +++ b/man/man8/puppet-config.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-CONFIG" "8" "March 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-CONFIG" "8" "April 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-config\fR \- Interact with Puppet\'s settings\. diff --git a/man/man8/puppet-describe.8 b/man/man8/puppet-describe.8 index 035961aed3e..4e1e1f083ab 100644 --- a/man/man8/puppet-describe.8 +++ b/man/man8/puppet-describe.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-DESCRIBE" "8" "March 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-DESCRIBE" "8" "April 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-describe\fR \- Display help about resource types diff --git a/man/man8/puppet-device.8 b/man/man8/puppet-device.8 index 62b2ae079d5..c49f8ecf6ad 100644 --- a/man/man8/puppet-device.8 +++ b/man/man8/puppet-device.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-DEVICE" "8" "March 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-DEVICE" "8" "April 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-device\fR \- Manage remote network devices diff --git a/man/man8/puppet-doc.8 b/man/man8/puppet-doc.8 index 7931183f531..57b607c2a5f 100644 --- a/man/man8/puppet-doc.8 +++ b/man/man8/puppet-doc.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-DOC" "8" "March 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-DOC" "8" "April 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-doc\fR \- Generate Puppet references diff --git a/man/man8/puppet-epp.8 b/man/man8/puppet-epp.8 index a65d69d1569..12e9e2a60f3 100644 --- a/man/man8/puppet-epp.8 +++ b/man/man8/puppet-epp.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-EPP" "8" "March 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-EPP" "8" "April 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-epp\fR \- Interact directly with the EPP template parser/renderer\. diff --git a/man/man8/puppet-facts.8 b/man/man8/puppet-facts.8 index 6acdf200f7e..6e46902301f 100644 --- a/man/man8/puppet-facts.8 +++ b/man/man8/puppet-facts.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-FACTS" "8" "March 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-FACTS" "8" "April 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-facts\fR \- Retrieve and store facts\. diff --git a/man/man8/puppet-filebucket.8 b/man/man8/puppet-filebucket.8 index aa3324e3623..b7b32160f8f 100644 --- a/man/man8/puppet-filebucket.8 +++ b/man/man8/puppet-filebucket.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-FILEBUCKET" "8" "March 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-FILEBUCKET" "8" "April 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-filebucket\fR \- Store and retrieve files in a filebucket diff --git a/man/man8/puppet-generate.8 b/man/man8/puppet-generate.8 index b0b018e2e14..02b74c6e01a 100644 --- a/man/man8/puppet-generate.8 +++ b/man/man8/puppet-generate.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-GENERATE" "8" "March 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-GENERATE" "8" "April 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-generate\fR \- Generates Puppet code from Ruby definitions\. diff --git a/man/man8/puppet-help.8 b/man/man8/puppet-help.8 index 531623372aa..bab2feb3162 100644 --- a/man/man8/puppet-help.8 +++ b/man/man8/puppet-help.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-HELP" "8" "March 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-HELP" "8" "April 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-help\fR \- Display Puppet help\. diff --git a/man/man8/puppet-lookup.8 b/man/man8/puppet-lookup.8 index 5e2e1cc27fe..883110553be 100644 --- a/man/man8/puppet-lookup.8 +++ b/man/man8/puppet-lookup.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-LOOKUP" "8" "March 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-LOOKUP" "8" "April 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-lookup\fR \- Interactive Hiera lookup diff --git a/man/man8/puppet-module.8 b/man/man8/puppet-module.8 index b2aecd8a65b..a0075386332 100644 --- a/man/man8/puppet-module.8 +++ b/man/man8/puppet-module.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-MODULE" "8" "March 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-MODULE" "8" "April 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-module\fR \- Creates, installs and searches for modules on the Puppet Forge\. diff --git a/man/man8/puppet-node.8 b/man/man8/puppet-node.8 index 28d05cd927a..3982cfbd021 100644 --- a/man/man8/puppet-node.8 +++ b/man/man8/puppet-node.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-NODE" "8" "March 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-NODE" "8" "April 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-node\fR \- View and manage node definitions\. diff --git a/man/man8/puppet-parser.8 b/man/man8/puppet-parser.8 index 18a84a6f01f..2e02705187b 100644 --- a/man/man8/puppet-parser.8 +++ b/man/man8/puppet-parser.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-PARSER" "8" "March 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-PARSER" "8" "April 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-parser\fR \- Interact directly with the parser\. diff --git a/man/man8/puppet-plugin.8 b/man/man8/puppet-plugin.8 index bb16b7b6e7e..7ea1afd69ff 100644 --- a/man/man8/puppet-plugin.8 +++ b/man/man8/puppet-plugin.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-PLUGIN" "8" "March 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-PLUGIN" "8" "April 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-plugin\fR \- Interact with the Puppet plugin system\. diff --git a/man/man8/puppet-report.8 b/man/man8/puppet-report.8 index cf364abbdd5..ee2dbf2316a 100644 --- a/man/man8/puppet-report.8 +++ b/man/man8/puppet-report.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-REPORT" "8" "March 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-REPORT" "8" "April 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-report\fR \- Create, display, and submit reports\. diff --git a/man/man8/puppet-resource.8 b/man/man8/puppet-resource.8 index a963bd71057..aa9c7635b1b 100644 --- a/man/man8/puppet-resource.8 +++ b/man/man8/puppet-resource.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-RESOURCE" "8" "March 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-RESOURCE" "8" "April 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-resource\fR \- The resource abstraction layer shell diff --git a/man/man8/puppet-script.8 b/man/man8/puppet-script.8 index 2f8891b529a..dc39870aa4c 100644 --- a/man/man8/puppet-script.8 +++ b/man/man8/puppet-script.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-SCRIPT" "8" "March 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-SCRIPT" "8" "April 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-script\fR \- Run a puppet manifests as a script without compiling a catalog diff --git a/man/man8/puppet-ssl.8 b/man/man8/puppet-ssl.8 index 7ad03703d84..34426de34a6 100644 --- a/man/man8/puppet-ssl.8 +++ b/man/man8/puppet-ssl.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-SSL" "8" "March 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-SSL" "8" "April 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-ssl\fR \- Manage SSL keys and certificates for puppet SSL clients diff --git a/man/man8/puppet.8 b/man/man8/puppet.8 index abc2bf756ec..cb39f861d5f 100644 --- a/man/man8/puppet.8 +++ b/man/man8/puppet.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET" "8" "March 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET" "8" "April 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\fR From 63814d6f3c458cfad5c7c91f379a6fb1495a25a9 Mon Sep 17 00:00:00 2001 From: gimmy Date: Tue, 23 Mar 2021 11:40:38 +0200 Subject: [PATCH 334/731] (PUP-10964) fix puppet_gem command on Windows When puppet is used as a library, environment.bat is not sourced and this leads to `PUPPET_DIR` to not be set. Because `puppet_gem` is relying on that to build the `gem.bat` path, it will end-up using a non-existing path, making this provider not suitable. This has been noticed when using the `puppet_gem` with the package task in PE. This commit updates the `puppet_gem` provider to use `Gem.default_bindir` to determine the location of the execatables. To avoid accidental usage of `puppet_gem` provider with system ruby, a confine to the existence of `aio_agent_version` facts has been added. --- lib/puppet/provider/package/puppet_gem.rb | 13 ++++++++- spec/unit/provider/package/puppet_gem_spec.rb | 28 +++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/lib/puppet/provider/package/puppet_gem.rb b/lib/puppet/provider/package/puppet_gem.rb index f06a3e70dd0..745b212f30d 100644 --- a/lib/puppet/provider/package/puppet_gem.rb +++ b/lib/puppet/provider/package/puppet_gem.rb @@ -4,8 +4,19 @@ has_feature :versionable, :install_options, :uninstall_options + confine :true => Facter.value(:aio_agent_version) + + def self.windows_gemcmd + puppet_dir = Puppet::Util.get_env('PUPPET_DIR') + if puppet_dir + File.join(Puppet::Util.get_env('PUPPET_DIR').to_s, 'bin', 'gem.bat') + else + File.join(Gem.default_bindir, 'gem.bat') + end + end + if Puppet::Util::Platform.windows? - commands :gemcmd => File.join(Puppet::Util.get_env('PUPPET_DIR').to_s, 'bin', 'gem.bat') + commands :gemcmd => windows_gemcmd else commands :gemcmd => "/opt/puppetlabs/puppet/bin/gem" end diff --git a/spec/unit/provider/package/puppet_gem_spec.rb b/spec/unit/provider/package/puppet_gem_spec.rb index e9c97c62158..3553c1cf2ac 100644 --- a/spec/unit/provider/package/puppet_gem_spec.rb +++ b/spec/unit/provider/package/puppet_gem_spec.rb @@ -31,6 +31,34 @@ allow(Puppet::Util::Platform).to receive(:windows?).and_return(false) end + + describe '.windows_gemcmd' do + context 'when PUPPET_DIR is not set' do + before do + allow(Puppet::Util).to receive(:get_env).and_call_original + allow(Puppet::Util).to receive(:get_env).with('PUPPET_DIR').and_return(nil) + allow(Gem).to receive(:default_bindir).and_return('default_gem_bin') + end + + it 'uses Gem.default_bindir' do + expected_path = File.join('default_gem_bin', 'gem.bat') + expect(described_class.windows_gemcmd).to eql(expected_path) + end + end + + context 'when PUPPET_DIR is set' do + before do + allow(Puppet::Util).to receive(:get_env).and_call_original + allow(Puppet::Util).to receive(:get_env).with('PUPPET_DIR').and_return('puppet_dir') + end + + it 'uses Gem.default_bindir' do + expected_path = File.join('puppet_dir', 'bin', 'gem.bat') + expect(described_class.windows_gemcmd).to eql(expected_path) + end + end + end + context "when installing" do before :each do allow(provider).to receive(:rubygem_version).and_return('1.9.9') From 2efb087f322cf57231b302ebc1a078ef55202415 Mon Sep 17 00:00:00 2001 From: Patrick Carlisle Date: Mon, 5 Apr 2021 15:38:48 -0700 Subject: [PATCH 335/731] (PUP-10959) Tie loaders to an environment So that we can lock the loading hierarchy for the whole environment, make sure every loader has its environment. --- lib/puppet/functions.rb | 2 +- lib/puppet/loaders.rb | 4 ---- lib/puppet/pops/loader/base_loader.rb | 4 ++-- lib/puppet/pops/loader/dependency_loader.rb | 4 ++-- lib/puppet/pops/loader/loader.rb | 5 +++-- lib/puppet/pops/loader/module_loaders.rb | 16 ++++++++-------- lib/puppet/pops/loader/runtime3_type_loader.rb | 2 +- lib/puppet/pops/loaders.rb | 8 ++++---- lib/puppet/pops/types/p_type_set_type.rb | 2 +- spec/unit/pops/loaders/dependency_loader_spec.rb | 2 +- spec/unit/pops/types/type_parser_spec.rb | 3 ++- 11 files changed, 25 insertions(+), 27 deletions(-) diff --git a/lib/puppet/functions.rb b/lib/puppet/functions.rb index 43b3cd368f9..c74bfa80fb4 100644 --- a/lib/puppet/functions.rb +++ b/lib/puppet/functions.rb @@ -606,7 +606,7 @@ class LocalTypeAliasesBuilder attr_reader :local_types, :parser, :loader def initialize(loader, name) - @loader = Puppet::Pops::Loader::PredefinedLoader.new(loader, :"local_function_#{name}") + @loader = Puppet::Pops::Loader::PredefinedLoader.new(loader, :"local_function_#{name}", loader.environment) @local_types = [] # get the shared parser used by puppet's compiler @parser = Puppet::Pops::Parser::EvaluatingParser.singleton() diff --git a/lib/puppet/loaders.rb b/lib/puppet/loaders.rb index bab451fc857..d527d49d286 100644 --- a/lib/puppet/loaders.rb +++ b/lib/puppet/loaders.rb @@ -24,10 +24,6 @@ module Loader require 'puppet/pops/loader/predefined_loader' require 'puppet/pops/loader/generic_plan_instantiator' require 'puppet/pops/loader/puppet_plan_instantiator' - - # The implementation of synchronized applies it to all subclasses so we - # want to add it to be base class after any subclasses are created - Loader.include Puppet::Concurrent::Synchronized end end diff --git a/lib/puppet/pops/loader/base_loader.rb b/lib/puppet/pops/loader/base_loader.rb index d3c80b63e7d..7693f61a566 100644 --- a/lib/puppet/pops/loader/base_loader.rb +++ b/lib/puppet/pops/loader/base_loader.rb @@ -13,8 +13,8 @@ class BaseLoader < Loader # The parent loader attr_reader :parent - def initialize(parent_loader, loader_name) - super(loader_name) + def initialize(parent_loader, loader_name, environment) + super(loader_name, environment) @parent = parent_loader # the higher priority loader to consult @named_values = {} # hash name => NamedEntry @last_result = nil # the value of the last name (optimization) diff --git a/lib/puppet/pops/loader/dependency_loader.rb b/lib/puppet/pops/loader/dependency_loader.rb index e0e6060ee79..9d1ca2d3698 100644 --- a/lib/puppet/pops/loader/dependency_loader.rb +++ b/lib/puppet/pops/loader/dependency_loader.rb @@ -18,8 +18,8 @@ class Puppet::Pops::Loader::DependencyLoader < Puppet::Pops::Loader::BaseLoader # @param name [String] the name of the dependency-loader (used for debugging and tracing only) # @param dependency_loaders [Array] array of loaders for modules this module depends on # - def initialize(parent_loader, name, dependency_loaders) - super parent_loader, name + def initialize(parent_loader, name, dependency_loaders, environment) + super(parent_loader, name, environment) @dependency_loaders = dependency_loaders end diff --git a/lib/puppet/pops/loader/loader.rb b/lib/puppet/pops/loader/loader.rb index 7d17bdd9548..46b877c100b 100644 --- a/lib/puppet/pops/loader/loader.rb +++ b/lib/puppet/pops/loader/loader.rb @@ -26,14 +26,15 @@ module Loader ENVIRONMENT_PRIVATE = 'environment private'.freeze class Loader - attr_reader :loader_name + attr_reader :environment, :loader_name # Describes the kinds of things that loaders can load LOADABLE_KINDS = [:func_4x, :func_4xpp, :func_3x, :datatype, :type_pp, :resource_type_pp, :plan, :task].freeze # @param [String] name the name of the loader. Must be unique among all loaders maintained by a {Loader} instance - def initialize(loader_name) + def initialize(loader_name, environment) @loader_name = loader_name.freeze + @environment = environment end # Search all places where this loader would find values of a given type and return a list the diff --git a/lib/puppet/pops/loader/module_loaders.rb b/lib/puppet/pops/loader/module_loaders.rb index a87015d7f3f..477fb7c21d8 100644 --- a/lib/puppet/pops/loader/module_loaders.rb +++ b/lib/puppet/pops/loader/module_loaders.rb @@ -45,17 +45,17 @@ def self.system_loader_from(parent_loader, loaders) # puppet_lib = File.realpath(File.join(File.dirname(__FILE__), '../../..')) LibRootedFileBased.new(parent_loader, - loaders, - nil, - puppet_lib, # may or may not have a 'lib' above 'puppet' - 'puppet_system', - [:func_4x, :func_3x, :datatype] # only load ruby functions and types from "puppet" - ) + loaders, + nil, + puppet_lib, # may or may not have a 'lib' above 'puppet' + 'puppet_system', + [:func_4x, :func_3x, :datatype] # only load ruby functions and types from "puppet" + ) end def self.environment_loader_from(parent_loader, loaders, env_path) if env_path.nil? || env_path.empty? - EmptyLoader.new(parent_loader, ENVIRONMENT) + EmptyLoader.new(parent_loader, ENVIRONMENT, loaders.environment) else FileBased.new(parent_loader, loaders, @@ -125,7 +125,7 @@ class AbstractPathBasedModuleLoader < BaseLoader # @param loader_name [String] a name that is used for human identification (useful when module_name is nil) # def initialize(parent_loader, loaders, module_name, path, loader_name, loadables) - super parent_loader, loader_name + super(parent_loader, loader_name, loaders.environment) raise ArgumentError, 'path based loader cannot be instantiated without a path' if path.nil? || path.empty? diff --git a/lib/puppet/pops/loader/runtime3_type_loader.rb b/lib/puppet/pops/loader/runtime3_type_loader.rb index 2fbe0e3f3f2..2b52c597c6f 100644 --- a/lib/puppet/pops/loader/runtime3_type_loader.rb +++ b/lib/puppet/pops/loader/runtime3_type_loader.rb @@ -10,7 +10,7 @@ class Runtime3TypeLoader < BaseLoader attr_reader :resource_3x_loader def initialize(parent_loader, loaders, environment, resource_3x_loader) - super(parent_loader, environment.name) + super(parent_loader, environment.name, environment) @environment = environment @resource_3x_loader = resource_3x_loader end diff --git a/lib/puppet/pops/loaders.rb b/lib/puppet/pops/loaders.rb index 9cb59164e40..531f3c71cb4 100644 --- a/lib/puppet/pops/loaders.rb +++ b/lib/puppet/pops/loaders.rb @@ -398,7 +398,7 @@ def create_environment_loader(environment, parent_loader, load_from_pcore = true if env_path.nil? # Not a real directory environment, cannot work as a module TODO: Drop when legacy env are dropped? - loader = add_loader_by_name(Loader::SimpleEnvironmentLoader.new(@runtime3_type_loader, Loader::ENVIRONMENT)) + loader = add_loader_by_name(Loader::SimpleEnvironmentLoader.new(@runtime3_type_loader, Loader::ENVIRONMENT, environment)) else # View the environment as a module to allow loading from it - this module is always called 'environment' loader = Loader::ModuleLoaders.environment_loader_from(@runtime3_type_loader, self, env_path) @@ -413,7 +413,7 @@ def create_environment_loader(environment, parent_loader, load_from_pcore = true # Code in the environment gets to see all modules (since there is no metadata for the environment) # but since this is not given to the module loaders, they can not load global code (since they can not # have prior knowledge about this - loader = add_loader_by_name(Loader::DependencyLoader.new(loader, Loader::ENVIRONMENT_PRIVATE, @module_resolver.all_module_loaders())) + loader = add_loader_by_name(Loader::DependencyLoader.new(loader, Loader::ENVIRONMENT_PRIVATE, @module_resolver.all_module_loaders(), environment)) # The module loader gets the private loader via a lazy operation to look up the module's private loader. # This does not work for an environment since it is not resolved the same way. @@ -529,13 +529,13 @@ def resolve(module_data) private def create_loader_with_all_modules_visible(from_module_data) - @loaders.add_loader_by_name(Loader::DependencyLoader.new(from_module_data.public_loader, "#{from_module_data.name} private", all_module_loaders())) + @loaders.add_loader_by_name(Loader::DependencyLoader.new(from_module_data.public_loader, "#{from_module_data.name} private", all_module_loaders(), @loaders.environment)) end def create_loader_with_dependencies_first(from_module_data) dependency_loaders = from_module_data.dependency_names.collect { |name| @index[name].public_loader } visible_loaders = dependency_loaders + (all_module_loaders() - dependency_loaders) - @loaders.add_loader_by_name(Loader::DependencyLoader.new(from_module_data.public_loader, "#{from_module_data.name} private", visible_loaders)) + @loaders.add_loader_by_name(Loader::DependencyLoader.new(from_module_data.public_loader, "#{from_module_data.name} private", visible_loaders, @loaders.environment)) end end end diff --git a/lib/puppet/pops/types/p_type_set_type.rb b/lib/puppet/pops/types/p_type_set_type.rb index 30d2aa5410e..40c78424df7 100644 --- a/lib/puppet/pops/types/p_type_set_type.rb +++ b/lib/puppet/pops/types/p_type_set_type.rb @@ -15,7 +15,7 @@ class PTypeSetType < PMetaType # @api private class TypeSetLoader < Loader::BaseLoader def initialize(type_set, parent) - super(parent, "(TypeSetFirstLoader '#{type_set.name}')") + super(parent, "(TypeSetFirstLoader '#{type_set.name}')", parent.environment) @type_set = type_set end diff --git a/spec/unit/pops/loaders/dependency_loader_spec.rb b/spec/unit/pops/loaders/dependency_loader_spec.rb index 5092cb56bcc..08fd8204de5 100644 --- a/spec/unit/pops/loaders/dependency_loader_spec.rb +++ b/spec/unit/pops/loaders/dependency_loader_spec.rb @@ -122,7 +122,7 @@ def foo def loader_for(name, dir) module_loader = Puppet::Pops::Loader::ModuleLoaders.module_loader_from(static_loader, loaders, name, dir) - Puppet::Pops::Loader::DependencyLoader.new(static_loader, 'test-dep', [module_loader]) + Puppet::Pops::Loader::DependencyLoader.new(static_loader, 'test-dep', [module_loader], loaders.environment) end def typed_name(type, name) diff --git a/spec/unit/pops/types/type_parser_spec.rb b/spec/unit/pops/types/type_parser_spec.rb index cea5019eb2f..c4fbdefaffa 100644 --- a/spec/unit/pops/types/type_parser_spec.rb +++ b/spec/unit/pops/types/type_parser_spec.rb @@ -210,7 +210,8 @@ module Types end context 'with loader context' do - let(:loader) { Puppet::Pops::Loader::BaseLoader.new(nil, "type_parser_unit_test_loader") } + let(:environment) { Puppet::Node::Environment.create(:testing, []) } + let(:loader) { Puppet::Pops::Loader::BaseLoader.new(nil, "type_parser_unit_test_loader", environment) } it 'interprets anything that is not found by the loader to be a type reference' do expect(loader).to receive(:load).with(:type, 'nonesuch').and_return(nil) From ec319d778150eade0b6128c2ddd11cbf3926183b Mon Sep 17 00:00:00 2001 From: Patrick Carlisle Date: Mon, 5 Apr 2021 16:49:58 -0700 Subject: [PATCH 336/731] (PUP-10959) Lock on environment when loading resources --- lib/puppet/pops/loader/loader.rb | 15 ++++++++++++--- lib/puppet/pops/loader/predefined_loader.rb | 4 ++++ lib/puppet/pops/loader/static_loader.rb | 4 ++++ 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/lib/puppet/pops/loader/loader.rb b/lib/puppet/pops/loader/loader.rb index 46b877c100b..ff29978fa6b 100644 --- a/lib/puppet/pops/loader/loader.rb +++ b/lib/puppet/pops/loader/loader.rb @@ -70,9 +70,11 @@ def discover(type, error_collector = nil, name_authority = Pcore::RUNTIME_NAME_A # @api public # def load(type, name) - result = load_typed(TypedName.new(type, name.to_s)) - if result - result.value + synchronize do + result = load_typed(TypedName.new(type, name.to_s)) + if result + result.value + end end end @@ -144,6 +146,13 @@ def private_loader self end + # Lock around a block + # This exists so some subclasses that are set up statically and don't actually + # load can override it + def synchronize(&block) + @environment.lock.synchronize(&block) + end + # Binds a value to a name. The name should not start with '::', but may contain multiple segments. # # @param type [:Symbol] the type of the entity being set diff --git a/lib/puppet/pops/loader/predefined_loader.rb b/lib/puppet/pops/loader/predefined_loader.rb index b306e59dfd2..489de634622 100644 --- a/lib/puppet/pops/loader/predefined_loader.rb +++ b/lib/puppet/pops/loader/predefined_loader.rb @@ -19,6 +19,10 @@ def to_s() def allow_shadowing? true end + + def synchronize(&block) + yield + end end end diff --git a/lib/puppet/pops/loader/static_loader.rb b/lib/puppet/pops/loader/static_loader.rb index 3e6b78ce4cc..f8ee4c8ff07 100644 --- a/lib/puppet/pops/loader/static_loader.rb +++ b/lib/puppet/pops/loader/static_loader.rb @@ -122,6 +122,10 @@ def add_type(name, type) def create_resource_type_reference(name) add_type(name, Types::TypeFactory.resource(name)) end + + def synchronize(&block) + yield + end end end end From dce12a06b957c86170cc4d2f475e2372e927ff62 Mon Sep 17 00:00:00 2001 From: Patrick Carlisle Date: Mon, 5 Apr 2021 17:56:30 -0700 Subject: [PATCH 337/731] (PUP-10959) Fix hash corruption in settings cache Since we write cached values to the global settings it's possible to have some corruption here. Use the concurrent thread-safe hash (which defaults to the normal ruby Hash on MRI). --- lib/puppet/settings.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/puppet/settings.rb b/lib/puppet/settings.rb index 3b304801207..0763aabb455 100644 --- a/lib/puppet/settings.rb +++ b/lib/puppet/settings.rb @@ -4,6 +4,7 @@ require 'puppet/util/command_line/puppet_option_parser' require 'forwardable' require 'fileutils' +require 'concurrent' # The class for handling configuration files. class Puppet::Settings @@ -146,8 +147,8 @@ def initialize @configuration_file = nil # And keep a per-environment cache - @cache = Hash.new { |hash, key| hash[key] = {} } - @values = Hash.new { |hash, key| hash[key] = {} } + @cache = Concurrent::Hash.new { |hash, key| hash[key] = Concurrent::Hash.new } + @values = Concurrent::Hash.new { |hash, key| hash[key] = Concurrent::Hash.new } # The list of sections we've used. @used = [] From 1da130523181e088bf1a36e771fcacf71043ff57 Mon Sep 17 00:00:00 2001 From: Patrick Carlisle Date: Tue, 6 Apr 2021 11:52:58 -0700 Subject: [PATCH 338/731] (PUP-10959) Synchronize more loader methods Some of these are used internally to puppet but from unsynchronized places (ie not from `load`). --- lib/puppet/pops/loader/base_loader.rb | 70 +++++++++++++++------------ 1 file changed, 40 insertions(+), 30 deletions(-) diff --git a/lib/puppet/pops/loader/base_loader.rb b/lib/puppet/pops/loader/base_loader.rb index 7693f61a566..8ecb11cdeab 100644 --- a/lib/puppet/pops/loader/base_loader.rb +++ b/lib/puppet/pops/loader/base_loader.rb @@ -38,22 +38,26 @@ def load_typed(typed_name) # These modules are typically parented by the same # loader as the one initiating the search. It is inefficient to again try to search the same loader for # the same name. - if @last_result.nil? || typed_name != @last_result.typed_name - @last_result = internal_load(typed_name) - else - @last_result + synchronize do + if @last_result.nil? || typed_name != @last_result.typed_name + @last_result = internal_load(typed_name) + else + @last_result + end end end # @api public # def loaded_entry(typed_name, check_dependencies = false) - if @named_values.has_key?(typed_name) - @named_values[typed_name] - elsif parent - parent.loaded_entry(typed_name, check_dependencies) - else - nil + synchronize do + if @named_values.has_key?(typed_name) + @named_values[typed_name] + elsif parent + parent.loaded_entry(typed_name, check_dependencies) + else + nil + end end end @@ -68,23 +72,25 @@ def get_entry(typed_name) # @api private # def set_entry(typed_name, value, origin = nil) - # It is never ok to redefine in the very same loader unless redefining a 'not found' - entry = @named_values[typed_name] - if entry - fail_redefine(entry) unless entry.value.nil? - end - - # Check if new entry shadows existing entry and fail - # (unless special loader allows shadowing) - if typed_name.type == :type && !allow_shadowing? - entry = loaded_entry(typed_name) + synchronize do + # It is never ok to redefine in the very same loader unless redefining a 'not found' + entry = @named_values[typed_name] if entry - fail_redefine(entry) unless entry.value.nil? #|| entry.value == value + fail_redefine(entry) unless entry.value.nil? + end + + # Check if new entry shadows existing entry and fail + # (unless special loader allows shadowing) + if typed_name.type == :type && !allow_shadowing? + entry = loaded_entry(typed_name) + if entry + fail_redefine(entry) unless entry.value.nil? #|| entry.value == value + end end - end - @last_result = Loader::NamedEntry.new(typed_name, value, origin) - @named_values[typed_name] = @last_result + @last_result = Loader::NamedEntry.new(typed_name, value, origin) + @named_values[typed_name] = @last_result + end end # @api private @@ -96,8 +102,10 @@ def add_entry(type, name, value, origin) # @api private # def remove_entry(typed_name) - unless @named_values.delete(typed_name).nil? - @last_result = nil unless @last_result.nil? || typed_name != @last_result.typed_name + synchronize do + unless @named_values.delete(typed_name).nil? + @last_result = nil unless @last_result.nil? || typed_name != @last_result.typed_name + end end end @@ -106,10 +114,12 @@ def remove_entry(typed_name) # @api private # def promote_entry(named_entry) - typed_name = named_entry.typed_name - entry = @named_values[typed_name] - if entry then fail_redefine(entry); end - @named_values[typed_name] = named_entry + synchronize do + typed_name = named_entry.typed_name + entry = @named_values[typed_name] + if entry then fail_redefine(entry); end + @named_values[typed_name] = named_entry + end end protected From 3df685a39a5d2b06d4edd8ffb7475656962d5d53 Mon Sep 17 00:00:00 2001 From: Ciprian Badescu Date: Wed, 14 Apr 2021 10:20:43 +0300 Subject: [PATCH 339/731] (PUP-11024) enable dnfmodule with no default profile on newer dnf When trying to install a module without default profile, newer `dnf` versions (eg. 4.2.23) show a different error message. This commit adapts the `dnf` error message expected in dnfmodule provider. --- lib/puppet/provider/package/dnfmodule.rb | 2 +- spec/unit/provider/package/dnfmodule_spec.rb | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/puppet/provider/package/dnfmodule.rb b/lib/puppet/provider/package/dnfmodule.rb index 99e284b050f..265de0a282d 100644 --- a/lib/puppet/provider/package/dnfmodule.rb +++ b/lib/puppet/provider/package/dnfmodule.rb @@ -93,7 +93,7 @@ def install # module has no default profile and no profile was requested, so just enable the stream # DNF versions prior to 4.2.8 do not need this workaround # see https://bugzilla.redhat.com/show_bug.cgi?id=1669527 - if @resource[:flavor] == nil && e.message =~ /^missing groups or modules: #{Regexp.quote(@resource[:name])}$/ + if @resource[:flavor] == nil && e.message =~ /^(?:missing|broken) groups or modules: #{Regexp.quote(@resource[:name])}$/ enable(args) else raise diff --git a/spec/unit/provider/package/dnfmodule_spec.rb b/spec/unit/provider/package/dnfmodule_spec.rb index c7386658748..8b3a1a31076 100644 --- a/spec/unit/provider/package/dnfmodule_spec.rb +++ b/spec/unit/provider/package/dnfmodule_spec.rb @@ -123,7 +123,7 @@ provider.install end - it "should just enable the module if it has no default profile" do + it "should just enable the module if it has no default profile(missing groups or modules)" do dnf_exception = Puppet::ExecutionFailure.new("Error: Problems in request:\nmissing groups or modules: #{resource[:name]}") allow(provider).to receive(:execute).with(array_including('install')).and_raise(dnf_exception) resource[:ensure] = :present @@ -132,6 +132,15 @@ provider.install end + it "should just enable the module if it has no default profile(broken groups or modules)" do + dnf_exception = Puppet::ExecutionFailure.new("Error: Problems in request:\nbroken groups or modules: #{resource[:name]}") + allow(provider).to receive(:execute).with(array_including('install')).and_raise(dnf_exception) + resource[:ensure] = :present + expect(provider).to receive(:execute).with(array_including('install')).ordered + expect(provider).to receive(:execute).with(array_including('enable')).ordered + provider.install + end + it "should just enable the module if enable_only = true" do resource[:ensure] = :present resource[:enable_only] = true From f95e9f2e2d426a1862022fcd070ff211502dfc03 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Wed, 14 Apr 2021 12:33:51 +0000 Subject: [PATCH 340/731] (packaging) Bump to version '7.7.0' [no-promote] --- .gemspec | 2 +- lib/puppet/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gemspec b/.gemspec index 108d0f07013..63fa8a94385 100644 --- a/.gemspec +++ b/.gemspec @@ -13,7 +13,7 @@ Gem::Specification.new do |s| s.name = "puppet" - version = "7.6.0" + version = "7.7.0" mdata = version.match(/(\d+\.\d+\.\d+)/) s.version = mdata ? mdata[1] : version diff --git a/lib/puppet/version.rb b/lib/puppet/version.rb index 68656edc341..c3756ac3713 100644 --- a/lib/puppet/version.rb +++ b/lib/puppet/version.rb @@ -6,7 +6,7 @@ # Raketasks and such to set the version based on the output of `git describe` module Puppet - PUPPETVERSION = '7.6.0' + PUPPETVERSION = '7.7.0' ## # version is a public API method intended to always provide a fast and From 67ad21b64237eb4f808844bdaa3c2b0e4cdef95c Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Wed, 14 Apr 2021 12:40:59 +0000 Subject: [PATCH 341/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 2 +- man/man8/puppet.8 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index b1e65eb62aa..0848abfbbc4 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -907,7 +907,7 @@ The time to wait for data to be read from an HTTP connection\. If nothing is rea The HTTP User\-Agent string to send when making network requests\. . .IP "\(bu" 4 -\fIDefault\fR: Puppet/7\.6\.0 Ruby/2\.5\.1\-p57 (x86_64\-linux) +\fIDefault\fR: Puppet/7\.7\.0 Ruby/2\.5\.1\-p57 (x86_64\-linux) . .IP "" 0 . diff --git a/man/man8/puppet.8 b/man/man8/puppet.8 index cb39f861d5f..f6240747f7d 100644 --- a/man/man8/puppet.8 +++ b/man/man8/puppet.8 @@ -25,4 +25,4 @@ Specialized: 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 . .P -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\.6\.0 +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\.7\.0 From a1d5af9c4b64b9a2ac959b4bff99d94df29b987b Mon Sep 17 00:00:00 2001 From: mihaibuzgau Date: Wed, 21 Apr 2021 14:25:18 +0300 Subject: [PATCH 342/731] (packaging) Bump to version '7.6.1' [no-promote] --- .gemspec | 2 +- lib/puppet/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gemspec b/.gemspec index 108d0f07013..4434195e8f5 100644 --- a/.gemspec +++ b/.gemspec @@ -13,7 +13,7 @@ Gem::Specification.new do |s| s.name = "puppet" - version = "7.6.0" + version = "7.6.1" mdata = version.match(/(\d+\.\d+\.\d+)/) s.version = mdata ? mdata[1] : version diff --git a/lib/puppet/version.rb b/lib/puppet/version.rb index 68656edc341..1aa45d7074e 100644 --- a/lib/puppet/version.rb +++ b/lib/puppet/version.rb @@ -6,7 +6,7 @@ # Raketasks and such to set the version based on the output of `git describe` module Puppet - PUPPETVERSION = '7.6.0' + PUPPETVERSION = '7.6.1' ## # version is a public API method intended to always provide a fast and From 435306f9a3895cba7587ec8fe10c93fb4ec5a7f3 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Tue, 27 Apr 2021 09:23:02 +0000 Subject: [PATCH 343/731] (packaging) Updating the puppet.pot file --- locales/puppet.pot | 166 +++++++++++++++++++++++---------------------- 1 file changed, 85 insertions(+), 81 deletions(-) diff --git a/locales/puppet.pot b/locales/puppet.pot index 800d83a9dd0..54d8fb1f47d 100644 --- a/locales/puppet.pot +++ b/locales/puppet.pot @@ -6,11 +6,11 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Puppet automation framework 7.3.0-6-g7c55ccd544\n" +"Project-Id-Version: Puppet automation framework 7.6.1-42-gfd6f890632\n" "\n" "Report-Msgid-Bugs-To: https://tickets.puppetlabs.com\n" -"POT-Creation-Date: 2021-01-21 13:07+0000\n" -"PO-Revision-Date: 2021-01-21 13:07+0000\n" +"POT-Creation-Date: 2021-04-27 09:22+0000\n" +"PO-Revision-Date: 2021-04-27 09:22+0000\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -446,59 +446,59 @@ msgstr "" msgid "Manage SSL keys and certificates for puppet SSL clients" msgstr "" -#: ../lib/puppet/application/ssl.rb:103 +#: ../lib/puppet/application/ssl.rb:106 msgid "An action must be specified." msgstr "" -#: ../lib/puppet/application/ssl.rb:126 ../lib/puppet/application/ssl.rb:133 +#: ../lib/puppet/application/ssl.rb:129 ../lib/puppet/application/ssl.rb:136 msgid "The certificate for '%{name}' has not yet been signed" msgstr "" -#: ../lib/puppet/application/ssl.rb:144 +#: ../lib/puppet/application/ssl.rb:147 msgid "Completed SSL initialization" msgstr "" -#: ../lib/puppet/application/ssl.rb:146 +#: ../lib/puppet/application/ssl.rb:151 msgid "Unknown action '%{action}'" msgstr "" -#: ../lib/puppet/application/ssl.rb:154 ../lib/puppet/ssl/state_machine.rb:180 +#: ../lib/puppet/application/ssl.rb:165 ../lib/puppet/ssl/state_machine.rb:180 msgid "Creating a new EC SSL key for %{name} using curve %{curve}" msgstr "" -#: ../lib/puppet/application/ssl.rb:157 +#: ../lib/puppet/application/ssl.rb:168 msgid "Creating a new SSL key for %{name}" msgstr "" -#: ../lib/puppet/application/ssl.rb:167 +#: ../lib/puppet/application/ssl.rb:178 msgid "Submitted certificate request for '%{name}' to %{url}" msgstr "" -#: ../lib/puppet/application/ssl.rb:170 +#: ../lib/puppet/application/ssl.rb:181 msgid "Could not submit certificate request for '%{name}' to %{url} due to a conflict on the server" msgstr "" -#: ../lib/puppet/application/ssl.rb:172 ../lib/puppet/application/ssl.rb:175 +#: ../lib/puppet/application/ssl.rb:183 ../lib/puppet/application/ssl.rb:186 msgid "Failed to submit certificate request: %{message}" msgstr "" -#: ../lib/puppet/application/ssl.rb:183 +#: ../lib/puppet/application/ssl.rb:194 msgid "Downloading certificate '%{name}' from %{url}" msgstr "" -#: ../lib/puppet/application/ssl.rb:187 +#: ../lib/puppet/application/ssl.rb:198 msgid "Downloaded certificate '%{name}' with fingerprint %{fingerprint}" msgstr "" -#: ../lib/puppet/application/ssl.rb:200 ../lib/puppet/application/ssl.rb:203 +#: ../lib/puppet/application/ssl.rb:211 ../lib/puppet/application/ssl.rb:214 msgid "Failed to download certificate: %{message}" msgstr "" -#: ../lib/puppet/application/ssl.rb:232 ../lib/puppet/application/ssl.rb:235 +#: ../lib/puppet/application/ssl.rb:243 ../lib/puppet/application/ssl.rb:246 msgid "Failed to connect to the CA to determine if certificate %{certname} has been cleaned" msgstr "" -#: ../lib/puppet/application/ssl.rb:239 +#: ../lib/puppet/application/ssl.rb:250 msgid "" "The certificate %{certname} must be cleaned from the CA first. To fix this,\n" "run the following commands on the CA:\n" @@ -506,7 +506,7 @@ msgid "" " puppet ssl clean\n" msgstr "" -#: ../lib/puppet/application/ssl.rb:262 +#: ../lib/puppet/application/ssl.rb:273 msgid "Removed %{label} %{path}" msgstr "" @@ -587,12 +587,12 @@ msgstr "" msgid "Failed to apply catalog: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:463 ../lib/puppet/http/resolver/server_list.rb:63 +#: ../lib/puppet/configurer.rb:463 ../lib/puppet/http/resolver/server_list.rb:64 ../lib/puppet/http/resolver/server_list.rb:68 msgid "Puppet server %{host}:%{port} is unavailable: %{code} %{reason}" msgstr "" #. TRANSLATORS 'server_list' is the name of a setting and should not be translated -#: ../lib/puppet/configurer.rb:467 ../lib/puppet/http/resolver/server_list.rb:66 +#: ../lib/puppet/configurer.rb:467 ../lib/puppet/http/resolver/server_list.rb:73 ../lib/puppet/http/resolver/server_list.rb:76 msgid "Unable to connect to server from server_list setting: %{detail}" msgstr "" @@ -715,12 +715,12 @@ msgstr "" msgid "Certificate names must be lower case" msgstr "" -#: ../lib/puppet/defaults.rb:1069 ../lib/puppet/settings/enum_setting.rb:13 ../lib/puppet/settings/symbolic_enum_setting.rb:14 +#: ../lib/puppet/defaults.rb:1077 ../lib/puppet/settings/enum_setting.rb:13 ../lib/puppet/settings/symbolic_enum_setting.rb:14 msgid "Invalid value '%{value}' for parameter %{name}. Allowed values are '%{allowed_values}'" msgstr "" #. TRANSLATORS 'pluginsync' is a setting and should not be translated -#: ../lib/puppet/defaults.rb:1906 +#: ../lib/puppet/defaults.rb:1914 msgid "Setting 'pluginsync' is deprecated." msgstr "" @@ -1783,11 +1783,11 @@ msgstr "" msgid "%{dest} already exists and the :force option was not specified" msgstr "" -#: ../lib/puppet/file_system/windows.rb:202 +#: ../lib/puppet/file_system/windows.rb:204 msgid "This version of Windows does not support symlinks. Windows Vista / 2008 or higher is required." msgstr "" -#: ../lib/puppet/file_system/windows.rb:207 +#: ../lib/puppet/file_system/windows.rb:209 msgid "The current user does not have the necessary permission to manage symlinks." msgstr "" @@ -2231,6 +2231,10 @@ msgstr "" msgid "Location URI is invalid: %{detail}" msgstr "" +#: ../lib/puppet/http/resolver/server_list.rb:66 ../lib/puppet/http/resolver/server_list.rb:74 +msgid "Trying with next server from server_list." +msgstr "" + #: ../lib/puppet/http/retry_after_handler.rb:74 msgid "Failed to parse Retry-After header '%{retry_after}' as an integer or RFC 2822 date" msgstr "" @@ -3067,11 +3071,11 @@ msgid "Loaded puppet/type/%{name} but no class was created" msgstr "" #. TRANSLATORS 'metadata.json' is a specific file name and should not be translated. -#: ../lib/puppet/module.rb:221 +#: ../lib/puppet/module.rb:222 msgid "%{name} has an invalid and unparsable metadata.json file. The parse error: %{error}" msgstr "" -#: ../lib/puppet/module.rb:467 +#: ../lib/puppet/module.rb:468 msgid "" " Invalid module name '%{name}'; module names must match either:\n" " An installed module name (ex. modulename) matching the expression /^[a-z][a-z0-9_]*$/ -or-\n" @@ -3860,7 +3864,7 @@ msgstr "" msgid "The 'disable_per_environment_manifest' setting is true, and the '%{env_name}' environment has an environment.conf manifest that conflicts with the 'default_manifest' setting." msgstr "" -#: ../lib/puppet/node/environment.rb:568 ../lib/puppet/pops/loaders.rb:301 +#: ../lib/puppet/node/environment.rb:575 ../lib/puppet/pops/loaders.rb:301 msgid "Could not parse for environment %{env}: %{detail}" msgstr "" @@ -5315,15 +5319,15 @@ msgstr "" msgid "<%{string}> does not appear to contain a word" msgstr "" -#: ../lib/puppet/pops/loader/base_loader.rb:124 +#: ../lib/puppet/pops/loader/base_loader.rb:134 msgid "Originally set %{original}." msgstr "" -#: ../lib/puppet/pops/loader/base_loader.rb:124 +#: ../lib/puppet/pops/loader/base_loader.rb:134 msgid "Set at unknown location" msgstr "" -#: ../lib/puppet/pops/loader/base_loader.rb:125 +#: ../lib/puppet/pops/loader/base_loader.rb:135 msgid "Attempt to redefine entity '%{name}'. %{origin_info}" msgstr "" @@ -6346,26 +6350,30 @@ msgstr "" msgid "Mac OS X packages must specify a package source" msgstr "" -#: ../lib/puppet/provider/package/apt.rb:85 +#: ../lib/puppet/provider/package/apt.rb:89 msgid "/etc/apt/sources.list contains a cdrom source; not installing. Use 'allowcdrom' to override this failure." msgstr "" -#: ../lib/puppet/provider/package/apt.rb:167 ../lib/puppet/provider/package/fink.rb:55 +#: ../lib/puppet/provider/package/apt.rb:172 ../lib/puppet/provider/package/aptitude.rb:21 ../lib/puppet/provider/package/ports.rb:20 ../lib/puppet/provider/package/portupgrade.rb:94 ../lib/puppet/provider/package/portupgrade.rb:152 ../lib/puppet/provider/package/rug.rb:28 ../lib/puppet/provider/package/up2date.rb:17 ../lib/puppet/provider/package/yum.rb:312 ../lib/puppet/provider/package/zypper.rb:146 +msgid "Could not find package %{name}" +msgstr "" + +#: ../lib/puppet/provider/package/apt.rb:176 ../lib/puppet/provider/package/yum.rb:317 +msgid "Failed to update to version %{should}, got version %{version} instead" +msgstr "" + +#: ../lib/puppet/provider/package/apt.rb:189 ../lib/puppet/provider/package/fink.rb:55 msgid "Could not find latest version" msgstr "" -#: ../lib/puppet/provider/package/apt.rb:178 ../lib/puppet/provider/package/fink.rb:66 +#: ../lib/puppet/provider/package/apt.rb:200 ../lib/puppet/provider/package/fink.rb:66 msgid "Preseeding %{response} to debconf-set-selections" msgstr "" -#: ../lib/puppet/provider/package/apt.rb:182 ../lib/puppet/provider/package/fink.rb:70 +#: ../lib/puppet/provider/package/apt.rb:204 ../lib/puppet/provider/package/fink.rb:70 msgid "No responsefile specified or non existent, not preseeding anything" msgstr "" -#: ../lib/puppet/provider/package/aptitude.rb:21 ../lib/puppet/provider/package/ports.rb:20 ../lib/puppet/provider/package/portupgrade.rb:94 ../lib/puppet/provider/package/portupgrade.rb:152 ../lib/puppet/provider/package/rug.rb:28 ../lib/puppet/provider/package/up2date.rb:17 ../lib/puppet/provider/package/yum.rb:312 ../lib/puppet/provider/package/zypper.rb:146 -msgid "Could not find package %{name}" -msgstr "" - #: ../lib/puppet/provider/package/aptrpm.rb:53 msgid "Could not match version '%{version}'" msgstr "" @@ -6701,10 +6709,6 @@ msgstr "" msgid "Could not find package %{wanted}" msgstr "" -#: ../lib/puppet/provider/package/yum.rb:317 -msgid "Failed to update to version %{should}, got version %{version} instead" -msgstr "" - #: ../lib/puppet/provider/package_targetable.rb:56 msgid "Provider %{name} package command is not functional on this host" msgstr "" @@ -7063,69 +7067,69 @@ msgstr "" msgid "Not attempting to load %{type} %{fqname} as this object was missing during a prior compilation" msgstr "" -#: ../lib/puppet/settings.rb:102 +#: ../lib/puppet/settings.rb:103 msgid "New environment loaders generated from the requested section." msgstr "" -#: ../lib/puppet/settings.rb:304 +#: ../lib/puppet/settings.rb:305 msgid "Attempting to initialize global default settings more than once!" msgstr "" -#: ../lib/puppet/settings.rb:504 +#: ../lib/puppet/settings.rb:505 msgid "Using --configprint is deprecated. Use 'puppet config ' instead." msgstr "" -#: ../lib/puppet/settings.rb:646 +#: ../lib/puppet/settings.rb:647 msgid "Could not load %{file}: %{detail}" msgstr "" -#: ../lib/puppet/settings.rb:755 +#: ../lib/puppet/settings.rb:756 msgid "Invalid setting type '%{type}'" msgstr "" -#: ../lib/puppet/settings.rb:910 +#: ../lib/puppet/settings.rb:911 msgid "Unknown searchpath case: %{source_type} for the %{source} settings path element." msgstr "" -#: ../lib/puppet/settings.rb:983 +#: ../lib/puppet/settings.rb:984 msgid "setting definition for '%{name}' is not a hash!" msgstr "" -#: ../lib/puppet/settings.rb:988 +#: ../lib/puppet/settings.rb:989 msgid "Setting %{name} is already defined" msgstr "" -#: ../lib/puppet/settings.rb:994 +#: ../lib/puppet/settings.rb:995 msgid "Setting %{name} is already using short name '%{short}'" msgstr "" -#: ../lib/puppet/settings.rb:1265 +#: ../lib/puppet/settings.rb:1266 msgid "Setting %{name} is deprecated." msgstr "" #. TRANSLATORS 'puppet.conf' is a file name and should not be translated -#: ../lib/puppet/settings.rb:1270 +#: ../lib/puppet/settings.rb:1271 msgid "Setting %{name} is deprecated in puppet.conf." msgstr "" -#: ../lib/puppet/settings.rb:1457 +#: ../lib/puppet/settings.rb:1458 msgid "Error converting value for param '%{name}': %{detail}" msgstr "" -#: ../lib/puppet/settings.rb:1481 +#: ../lib/puppet/settings.rb:1482 msgid "Could not find value for %{expression}" msgstr "" #. TRANSLATORS '$environment' is a Puppet specific variable and should not be translated -#: ../lib/puppet/settings.rb:1491 +#: ../lib/puppet/settings.rb:1492 msgid "You cannot interpolate $environment within '%{setting_name}' when using directory environments." msgstr "" -#: ../lib/puppet/settings.rb:1492 +#: ../lib/puppet/settings.rb:1493 msgid "Its value will remain %{value}." msgstr "" -#: ../lib/puppet/settings.rb:1523 +#: ../lib/puppet/settings.rb:1524 msgid "Attempt to assign a value to unknown setting %{name}" msgstr "" @@ -7219,19 +7223,19 @@ msgid "Invalid duration format '%{value}' for parameter: %{name}" msgstr "" #. TRANSLATORS 'disable_per_environment_manifest' is a setting and 'environment.conf' is a file name and should not be translated -#: ../lib/puppet/settings/environment_conf.rb:69 +#: ../lib/puppet/settings/environment_conf.rb:70 msgid "The 'disable_per_environment_manifest' setting is true, but the environment located at %{path_to_env} has a manifest setting in its environment.conf of '%{environment_conf}' which does not match the default_manifest setting '%{puppet_conf}'." msgstr "" -#: ../lib/puppet/settings/environment_conf.rb:71 +#: ../lib/puppet/settings/environment_conf.rb:72 msgid "If this environment is expecting to find modules in '%{environment_conf}', they will not be available!" msgstr "" -#: ../lib/puppet/settings/environment_conf.rb:141 +#: ../lib/puppet/settings/environment_conf.rb:142 msgid "Invalid sections in environment.conf at '%{path_to_conf_file}'. Environment conf may not have sections. The following sections are being ignored: '%{sections}'" msgstr "" -#: ../lib/puppet/settings/environment_conf.rb:153 +#: ../lib/puppet/settings/environment_conf.rb:154 msgid "Invalid settings in environment.conf at '%{path_to_conf_file}'. The following unknown setting(s) are being ignored: %{ignored_settings}" msgstr "" @@ -9071,31 +9075,31 @@ msgstr "" msgid "Caught exception %{klass}:%{error} retrying" msgstr "" -#: ../lib/puppet/util/selinux.rb:71 +#: ../lib/puppet/util/selinux.rb:81 msgid "Invalid context to parse: %{context}" msgstr "" -#: ../lib/puppet/util/selinux.rb:83 +#: ../lib/puppet/util/selinux.rb:93 msgid "Invalid SELinux parameter type" msgstr "" -#: ../lib/puppet/util/selinux.rb:104 +#: ../lib/puppet/util/selinux.rb:114 msgid "Can't set SELinux context on file unless the file already has some kind of context" msgstr "" -#: ../lib/puppet/util/selinux.rb:118 +#: ../lib/puppet/util/selinux.rb:128 msgid "set_selinux_context component must be one of :seluser, :selrole, :seltype, or :selrange" msgstr "" -#: ../lib/puppet/util/selinux.rb:129 +#: ../lib/puppet/util/selinux.rb:139 msgid "Failed to set SELinux context %{context} on %{file}" msgstr "" -#: ../lib/puppet/util/selinux.rb:180 +#: ../lib/puppet/util/selinux.rb:190 msgid "Could not open SELinux category translation file %{path}." msgstr "" -#: ../lib/puppet/util/selinux.rb:250 +#: ../lib/puppet/util/selinux.rb:276 msgid "got a relative path in SELinux find_fs: %{path}" msgstr "" @@ -9219,15 +9223,15 @@ msgstr "" msgid "Unrecognized ADS UserFlags: %{unrecognized_flags}" msgstr "" -#: ../lib/puppet/util/windows/adsi.rb:497 +#: ../lib/puppet/util/windows/adsi.rb:497 ../lib/puppet/util/windows/adsi.rb:530 msgid "Failed to get user name" msgstr "" -#: ../lib/puppet/util/windows/adsi.rb:534 +#: ../lib/puppet/util/windows/adsi.rb:580 msgid "Cannot delete user profile for '%{sid}' prior to Vista SP1" msgstr "" -#: ../lib/puppet/util/windows/adsi.rb:552 +#: ../lib/puppet/util/windows/adsi.rb:598 msgid "Cannot create group if user '%{name}' exists." msgstr "" @@ -9282,20 +9286,20 @@ msgstr "" msgid "Failed to call GetLongPathName" msgstr "" -#: ../lib/puppet/util/windows/principal.rb:67 ../lib/puppet/util/windows/principal.rb:74 +#: ../lib/puppet/util/windows/principal.rb:68 ../lib/puppet/util/windows/principal.rb:75 msgid "Failed to call LookupAccountNameW with account: %{account_name}" msgstr "" #. TRANSLATORS `lookup_account_sid` is a variable name and should not be translated -#: ../lib/puppet/util/windows/principal.rb:97 +#: ../lib/puppet/util/windows/principal.rb:98 msgid "Byte array for lookup_account_sid must not be nil and must be at least 1 byte long" msgstr "" -#: ../lib/puppet/util/windows/principal.rb:114 +#: ../lib/puppet/util/windows/principal.rb:115 msgid "Byte array for lookup_account_sid is invalid: %{sid_bytes}" msgstr "" -#: ../lib/puppet/util/windows/principal.rb:122 ../lib/puppet/util/windows/principal.rb:129 +#: ../lib/puppet/util/windows/principal.rb:123 ../lib/puppet/util/windows/principal.rb:130 msgid "Failed to call LookupAccountSidW with bytes: %{sid_bytes}" msgstr "" @@ -9405,7 +9409,7 @@ msgstr "" msgid "An attempt to set mode %{mode} on item %{path} would result in the group, SYSTEM, to have less than Full Control rights. This attempt has been corrected to Full Control" msgstr "" -#: ../lib/puppet/util/windows/security.rb:433 ../lib/puppet/util/windows/security.rb:450 ../lib/puppet/util/windows/sid.rb:155 ../lib/puppet/util/windows/sid.rb:217 ../lib/puppet/util/windows/user.rb:59 +#: ../lib/puppet/util/windows/security.rb:433 ../lib/puppet/util/windows/security.rb:450 ../lib/puppet/util/windows/sid.rb:157 ../lib/puppet/util/windows/sid.rb:219 ../lib/puppet/util/windows/user.rb:59 msgid "Invalid SID" msgstr "" @@ -9561,19 +9565,19 @@ msgstr "" msgid "Timed out while waiting for the pending transition from %{pending_state} to %{final_state} to finish. The current state is %{current_state}." msgstr "" -#: ../lib/puppet/util/windows/sid.rb:94 +#: ../lib/puppet/util/windows/sid.rb:96 msgid "Octet string must be an array of bytes" msgstr "" -#: ../lib/puppet/util/windows/sid.rb:161 +#: ../lib/puppet/util/windows/sid.rb:163 msgid "Failed to convert binary SID" msgstr "" -#: ../lib/puppet/util/windows/sid.rb:166 +#: ../lib/puppet/util/windows/sid.rb:168 msgid "ConvertSidToStringSidW failed to allocate buffer for sid" msgstr "" -#: ../lib/puppet/util/windows/sid.rb:186 +#: ../lib/puppet/util/windows/sid.rb:188 msgid "Failed to convert string SID: %{string_sid}" msgstr "" From cec4acba7b59c18b9ce49522523c3e0da2b81b23 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Tue, 27 Apr 2021 23:47:04 -0700 Subject: [PATCH 344/731] (maint) Update server_list tests for terminology changes in main Update the specs in main to match the new behavior. --- spec/unit/configurer_spec.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/spec/unit/configurer_spec.rb b/spec/unit/configurer_spec.rb index d1e54cc8a22..2e16c020947 100644 --- a/spec/unit/configurer_spec.rb +++ b/spec/unit/configurer_spec.rb @@ -1079,10 +1079,10 @@ def expects_neither_new_or_cached_catalog Puppet.settings[:server_list] = "mybadserver1:123,mybadserver2:123,mygoodserver" Puppet[:usecacheonfailure] = false - stub_request(:get, 'https://mybadserver1:123/status/v1/simple/master').and_raise(Puppet::HTTP::HTTPError) - stub_request(:get, 'https://mybadserver2:123/status/v1/simple/master').and_raise(Puppet::HTTP::HTTPError) - stub_request(:get, 'https://mygoodserver:8140/status/v1/simple/master').to_return(status: 200) - + stub_request(:get, 'https://mybadserver1:123/status/v1/simple/server').and_raise(Puppet::HTTP::HTTPError) + stub_request(:get, 'https://mybadserver2:123/status/v1/simple/server').and_raise(Puppet::HTTP::HTTPError) + stub_request(:get, 'https://mygoodserver:8140/status/v1/simple/server').to_return(status: 200) + expect(Puppet).to receive(:warning).with(/^Unable to connect to server from server_list setting:.*Trying with next server from server_list.$/).twice configurer.run end @@ -1091,8 +1091,8 @@ def expects_neither_new_or_cached_catalog Puppet.settings[:server_list] = "mybadserver:123,someotherservername" Puppet[:usecacheonfailure] = false - stub_request(:get, 'https://mybadserver:123/status/v1/simple/master').to_return(status: 400) - stub_request(:get, 'https://someotherservername:8140/status/v1/simple/master').to_return(status: 200) + stub_request(:get, 'https://mybadserver:123/status/v1/simple/server').to_return(status: 400) + stub_request(:get, 'https://someotherservername:8140/status/v1/simple/server').to_return(status: 200) expect(Puppet).to receive(:warning).with(/^Puppet server mybadserver:123 is unavailable: 400 Trying with next server from server_list.$/) configurer.run From fd4ee88e1e41abd037e8ebab3a2c0ec63d74bd1f Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Tue, 27 Apr 2021 22:01:12 -0700 Subject: [PATCH 345/731] (PUP-11045) Ruby 3 returns V_ERR_HOSTNAME_MISMATCH Previously, puppet on ruby 3 raised a generic CertVerifyError if the hostname was mismatched rather than the more specific CertMismatchError. This is because Ruby 3 changed the StoreContext#error from V_ERR_OK to V_ERR_HOSTNAME_MISMATCH. This was fixed in ruby-openssl#2.2.0 first released in ruby 3. [1] https://github.com/ruby/openssl/commit/035a04ece237105ba3c91a8db8f81dc81d2dc452 --- lib/puppet/ssl/verifier.rb | 4 ++++ lib/puppet/util/monkey_patches.rb | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/lib/puppet/ssl/verifier.rb b/lib/puppet/ssl/verifier.rb index a3df7b5a463..db39d311b57 100644 --- a/lib/puppet/ssl/verifier.rb +++ b/lib/puppet/ssl/verifier.rb @@ -117,6 +117,10 @@ def call(preverify_ok, store_context) return false end + when OpenSSL::X509::V_ERR_HOSTNAME_MISMATCH # new in ruby-openssl 2.2.0/ruby 3.0 + @last_error = Puppet::SSL::CertMismatchError.new(peer_cert, @hostname) + return false + when OpenSSL::X509::V_ERR_CRL_NOT_YET_VALID crl = store_context.current_crl if crl && crl.last_update && crl.last_update < Time.now + FIVE_MINUTES_AS_SECONDS diff --git a/lib/puppet/util/monkey_patches.rb b/lib/puppet/util/monkey_patches.rb index b429557f1a5..7435f300bee 100644 --- a/lib/puppet/util/monkey_patches.rb +++ b/lib/puppet/util/monkey_patches.rb @@ -90,6 +90,10 @@ def set_default_paths end unless Puppet::Util::Platform.jruby_fips? + unless OpenSSL::X509.const_defined?(:V_ERR_HOSTNAME_MISMATCH) + OpenSSL::X509.const_set(:V_ERR_HOSTNAME_MISMATCH, 62) + end + unless OpenSSL::X509::Name.instance_methods.include?(:to_utf8) class OpenSSL::X509::Name # https://github.com/openssl/openssl/blob/OpenSSL_1_1_0j/include/openssl/asn1.h#L362 From 41dcae71c7d10b9cc3c190897d02c5082ddd2076 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Tue, 27 Apr 2021 11:27:27 -0700 Subject: [PATCH 346/731] (PUP-11046) Implement RFC2396 style escape/unescape URI.escape/unescape was removed in Ruby 3, because it implements RFC 2396 escape/unescape with updates for RFCs 2732 and 2373, and those have been superseded by RFC 3986. To maintain 100% compatibility while supporting Ruby 3, implement the escape/unescape methods in puppet[1]. In the future we can look at using Addressable or using the newer URI parser in ruby. [1] https://github.com/ruby/ruby/blob/v2_7_3/lib/uri/rfc2396_parser.rb#L24-L46 --- lib/puppet/util.rb | 43 ++++++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/lib/puppet/util.rb b/lib/puppet/util.rb index db1aa640062..6986550755d 100644 --- a/lib/puppet/util.rb +++ b/lib/puppet/util.rb @@ -466,17 +466,7 @@ def uri_encode(path, opts = { :allow_fragment => false }) # URI::parse and URI::Generic.build don't like paths encoded with CGI.escape # URI.escape does not change / to %2F and : to %3A like CGI.escape # - # URI.escape is obsolete in Ruby 2.7. Ignore this error until we're able to - # switch to a different escape mechanism. If this is JRuby, we can't mask - # the error message, because this isn't thread safe. JRuby shouldn't be - # using Ruby 2.7 or raising the warning anyway. - orig_verbose = $VERBOSE - $VERBOSE = nil unless Puppet::Util::Platform.jruby? - begin - encoded += URI.escape(parts[:path]) unless parts[:path].nil? - ensure - $VERBOSE = orig_verbose unless Puppet::Util::Platform.jruby? - end + encoded += rfc2396_escape(parts[:path]) unless parts[:path].nil? # each query parameter if !parts[:query].nil? @@ -495,12 +485,31 @@ def uri_encode(path, opts = { :allow_fragment => false }) end module_function :uri_encode - def uri_unescape(path) - orig_verbose = $VERBOSE - $VERBOSE = nil unless Puppet::Util::Platform.jruby? - return URI.unescape(path) - ensure - $VERBOSE = orig_verbose unless Puppet::Util::Platform.jruby? + # From https://github.com/ruby/ruby/blob/v2_7_3/lib/uri/rfc2396_parser.rb#L24-L46 + ALPHA = "a-zA-Z".freeze + ALNUM = "#{ALPHA}\\d".freeze + UNRESERVED = "\\-_.!~*'()#{ALNUM}".freeze + RESERVED = ";/?:@&=+$,\\[\\]".freeze + UNSAFE = Regexp.new("[^#{UNRESERVED}#{RESERVED}]").freeze + + HEX = "a-fA-F\\d".freeze + ESCAPED = Regexp.new("%[#{HEX}]{2}").freeze + + def rfc2396_escape(str) + str.gsub(UNSAFE) do |match| + tmp = '' + match.each_byte do |uc| + tmp << sprintf('%%%02X', uc) + end + tmp + end.force_encoding(Encoding::US_ASCII) + end + module_function :rfc2396_escape + + def uri_unescape(str) + enc = str.encoding + enc = Encoding::UTF_8 if enc == Encoding::US_ASCII + str.gsub(ESCAPED) { [$&[1, 2]].pack('H2').force_encoding(enc) } end module_function :uri_unescape From ab7ac0b9aa353366563276578626ca012e24c794 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Wed, 28 Apr 2021 16:33:35 -0700 Subject: [PATCH 347/731] (PUP-11048) Use execution API instead of system The systemd and debian providers were written before the execution API returned a ProcessOutput containing the output and exit status. Call the execution API and use the exit status instead of relying on $CHILD_STATUS. --- lib/puppet/provider/service/debian.rb | 8 +++--- lib/puppet/provider/service/systemd.rb | 6 ++--- spec/unit/provider/service/debian_spec.rb | 20 ++++++--------- spec/unit/provider/service/systemd_spec.rb | 29 ++++++++++++++-------- 4 files changed, 31 insertions(+), 32 deletions(-) diff --git a/lib/puppet/provider/service/debian.rb b/lib/puppet/provider/service/debian.rb index 9352f3b005a..8cbacc9b992 100644 --- a/lib/puppet/provider/service/debian.rb +++ b/lib/puppet/provider/service/debian.rb @@ -34,16 +34,14 @@ def disable end def enabled? - # TODO: Replace system call when Puppet::Util::Execution.execute gives us a way - # to determine exit status. https://projects.puppetlabs.com/issues/2538 - system("/usr/sbin/invoke-rc.d", "--quiet", "--query", @resource[:name], "start") + status = execute("/usr/sbin/invoke-rc.d", "--quiet", "--query", @resource[:name], "start") # 104 is the exit status when you query start an enabled service. # 106 is the exit status when the policy layer supplies a fallback action # See x-man-page://invoke-rc.d - if [104, 106].include?($CHILD_STATUS.exitstatus) + if [104, 106].include?(status.exitstatus) return :true - elsif [101, 105].include?($CHILD_STATUS.exitstatus) + elsif [101, 105].include?(status.exitstatus) # 101 is action not allowed, which means we have to do the check manually. # 105 is unknown, which generally means the initscript does not support query # The debian policy states that the initscript should support methods of query diff --git a/lib/puppet/provider/service/systemd.rb b/lib/puppet/provider/service/systemd.rb index d0bfb85e5a6..3d118af105e 100644 --- a/lib/puppet/provider/service/systemd.rb +++ b/lib/puppet/provider/service/systemd.rb @@ -119,10 +119,10 @@ def enabled? # whether it is enabled or not. See PUP-5016 for more details. # def debian_enabled? - system("/usr/sbin/invoke-rc.d", "--quiet", "--query", @resource[:name], "start") - if [104, 106].include?($CHILD_STATUS.exitstatus) + status = execute("/usr/sbin/invoke-rc.d", "--quiet", "--query", @resource[:name], "start") + if [104, 106].include?(status.exitstatus) return :true - elsif [101, 105].include?($CHILD_STATUS.exitstatus) + elsif [101, 105].include?(status.exitstatus) # 101 is action not allowed, which means we have to do the check manually. # 105 is unknown, which generally means the initscript does not support query # The debian policy states that the initscript should support methods of query diff --git a/spec/unit/provider/service/debian_spec.rb b/spec/unit/provider/service/debian_spec.rb index 5aa57a3accf..2a46adcd22f 100644 --- a/spec/unit/provider/service/debian_spec.rb +++ b/spec/unit/provider/service/debian_spec.rb @@ -90,34 +90,29 @@ end context "when checking whether it is enabled" do - it "should call Kernel.system() with the appropriate parameters" do - expect(@provider).to receive(:system).with("/usr/sbin/invoke-rc.d", "--quiet", "--query", @resource[:name], "start").once - allow($CHILD_STATUS).to receive(:exitstatus).and_return(0) + it "should execute the query command" do + expect(@provider).to receive(:execute).with("/usr/sbin/invoke-rc.d", "--quiet", "--query", @resource[:name], "start").and_return(Puppet::Util::Execution::ProcessOutput.new('', 0)) @provider.enabled? end it "should return true when invoke-rc.d exits with 104 status" do - allow(@provider).to receive(:system) - allow($CHILD_STATUS).to receive(:exitstatus).and_return(104) + expect(@provider).to receive(:execute).and_return(Puppet::Util::Execution::ProcessOutput.new('', 104)) expect(@provider.enabled?).to eq(:true) end it "should return true when invoke-rc.d exits with 106 status" do - allow(@provider).to receive(:system) - allow($CHILD_STATUS).to receive(:exitstatus).and_return(106) + expect(@provider).to receive(:execute).and_return(Puppet::Util::Execution::ProcessOutput.new('', 106)) expect(@provider.enabled?).to eq(:true) end shared_examples "manually queries service status" do |status| it "links count is 4" do - allow(@provider).to receive(:system) - allow($CHILD_STATUS).to receive(:exitstatus).and_return(status) + allow(@provider).to receive(:execute).and_return(Puppet::Util::Execution::ProcessOutput.new('', status)) allow(@provider).to receive(:get_start_link_count).and_return(4) expect(@provider.enabled?).to eq(:true) end it "links count is less than 4" do - allow(@provider).to receive(:system) - allow($CHILD_STATUS).to receive(:exitstatus).and_return(status) + allow(@provider).to receive(:execute).and_return(Puppet::Util::Execution::ProcessOutput.new('', status)) allow(@provider).to receive(:get_start_link_count).and_return(3) expect(@provider.enabled?).to eq(:false) end @@ -142,8 +137,7 @@ # pick a range of non-[104.106] numbers, strings and booleans to test with. [-100, -1, 0, 1, 100, "foo", "", :true, :false].each do |exitstatus| it "should return false when invoke-rc.d exits with #{exitstatus} status" do - allow(@provider).to receive(:system) - allow($CHILD_STATUS).to receive(:exitstatus).and_return(exitstatus) + allow(@provider).to receive(:execute).and_return(Puppet::Util::Execution::ProcessOutput.new('', exitstatus)) expect(@provider.enabled?).to eq(:false) end end diff --git a/spec/unit/provider/service/systemd_spec.rb b/spec/unit/provider/service/systemd_spec.rb index 6b6e381c398..d4edf44018f 100644 --- a/spec/unit/provider/service/systemd_spec.rb +++ b/spec/unit/provider/service/systemd_spec.rb @@ -23,6 +23,10 @@ provider_class.new(:name => 'sshd.service') end + let :process_output do + Puppet::Util::Execution::ProcessOutput.new('', 0) + end + osfamilies = [ 'archlinux', 'coreos' ] osfamilies.each do |osfamily| @@ -369,17 +373,21 @@ # Note: systemd provider does not care about hasstatus or a custom status # command. I just assume that it does not make sense for systemd. describe "#status" do - it "should return running if if the command returns 0" do + it "should return running if the command returns 0" do provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd.service')) - expect(provider).to receive(:execute).with(['/bin/systemctl','is-active', '--', 'sshd.service'], :failonfail => false, :override_locale => false, :squelch => false, :combine => true).and_return("active\n") - allow($CHILD_STATUS).to receive(:exitstatus).and_return(0) + expect(provider).to receive(:execute) + .with(['/bin/systemctl','is-active', '--', 'sshd.service'], :failonfail => false, :override_locale => false, :squelch => false, :combine => true) + .and_return(Puppet::Util::Execution::ProcessOutput.new("active\n", 0)) expect(provider.status).to eq(:running) end [-10,-1,3,10].each { |ec| it "should return stopped if the command returns something non-0" do provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd.service')) - expect(provider).to receive(:execute).with(['/bin/systemctl','is-active', '--', 'sshd.service'], :failonfail => false, :override_locale => false, :squelch => false, :combine => true).and_return("inactive\n") + expect(provider).to receive(:execute) + .with(['/bin/systemctl','is-active', '--', 'sshd.service'], :failonfail => false, :override_locale => false, :squelch => false, :combine => true) + .and_return(Puppet::Util::Execution::ProcessOutput.new("inactive\n", ec)) + # Base#status still uses CHILD_STATUS allow($CHILD_STATUS).to receive(:exitstatus).and_return(ec) expect(provider.status).to eq(:stopped) end @@ -387,7 +395,9 @@ it "should use the supplied status command if specified" do provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd.service', :status => '/bin/foo')) - expect(provider).to receive(:execute).with(['/bin/foo'], :failonfail => false, :override_locale => false, :squelch => false, :combine => true) + expect(provider).to receive(:execute) + .with(['/bin/foo'], :failonfail => false, :override_locale => false, :squelch => false, :combine => true) + .and_return(process_output) provider.status end end @@ -430,8 +440,7 @@ [104, 106].each do |status| it "should return true when invoke-rc.d returns #{status}" do provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd.service')) - allow(provider).to receive(:system) - expect($CHILD_STATUS).to receive(:exitstatus).and_return(status) + allow(provider).to receive(:execute).and_return(Puppet::Util::Execution::ProcessOutput.new('', status)) expect(provider.debian_enabled?).to eq(:true) end end @@ -439,17 +448,15 @@ [101, 105].each do |status| it "should return true when status is #{status} and there are at least 4 start links" do provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd.service')) - allow(provider).to receive(:system) + allow(provider).to receive(:execute).and_return(Puppet::Util::Execution::ProcessOutput.new('', status)) expect(provider).to receive(:get_start_link_count).and_return(4) - expect($CHILD_STATUS).to receive(:exitstatus).twice.and_return(status) expect(provider.debian_enabled?).to eq(:true) end it "should return false when status is #{status} and there are less than 4 start links" do provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd.service')) - allow(provider).to receive(:system) + allow(provider).to receive(:execute).and_return(Puppet::Util::Execution::ProcessOutput.new('', status)) expect(provider).to receive(:get_start_link_count).and_return(1) - expect($CHILD_STATUS).to receive(:exitstatus).twice.and_return(status) expect(provider.debian_enabled?).to eq(:false) end end From e98e502246cae7bc2d7d95e27bf48fd16e468099 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Wed, 28 Apr 2021 16:49:18 -0700 Subject: [PATCH 348/731] (PUP-11048) Create service methods that return process output The existing texecute and ucommand methods return nil on success. Create separate methods that return the ProcessOutput so that we don't break compatibility with 3rd party providers. --- lib/puppet/provider/service/service.rb | 28 ++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/lib/puppet/provider/service/service.rb b/lib/puppet/provider/service/service.rb index 2d3747f9dde..b777b5a7a5c 100644 --- a/lib/puppet/provider/service/service.rb +++ b/lib/puppet/provider/service/service.rb @@ -19,7 +19,7 @@ def restart def restartcmd end - # A simple wrapper so execution failures are a bit more informative. + # @deprecated because the exit status is not returned, use service_execute instead def texecute(type, command, fof = true, squelch = false, combine = true) begin execute(command, :failonfail => fof, :override_locale => false, :squelch => squelch, :combine => combine) @@ -29,7 +29,7 @@ def texecute(type, command, fof = true, squelch = false, combine = true) nil end - # Use either a specified command or the default for our provider. + # @deprecated because the exitstatus is not returned, use service_command instead def ucommand(type, fof = true) c = @resource[type] if c @@ -39,5 +39,29 @@ def ucommand(type, fof = true) end texecute(type, cmd, fof) end + + # Execute a command, failing the resource if the command fails. + # + # @return [Puppet::Util::Execution::ProcessOutput] + def service_execute(type, command, fof = true, squelch = false, combine = true) + begin + execute(command, :failonfail => fof, :override_locale => false, :squelch => squelch, :combine => combine) + rescue Puppet::ExecutionFailure => detail + @resource.fail Puppet::Error, "Could not #{type} #{@resource.ref}: #{detail}", detail + end + end + + # Use either a specified command or the default for our provider. + # + # @return [Puppet::Util::Execution::ProcessOutput] + def service_command(type, fof = true) + c = @resource[type] + if c + cmd = [c] + else + cmd = [send("#{type}cmd")].flatten + end + service_execute(type, cmd, fof) + end end From ee03a77b3d476be6f6915cbb6d2624ca2f527efb Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Wed, 28 Apr 2021 17:49:25 -0700 Subject: [PATCH 349/731] (PUP-11048) Don't stub texecute and ucommand The texecute and ucommand methods are implemented in the base service class and overridden in some subclasses, which is what we're testing. So stub at the execution API layer instead. --- spec/unit/provider/service/daemontools_spec.rb | 2 +- spec/unit/provider/service/init_spec.rb | 10 +++++----- spec/unit/provider/service/launchd_spec.rb | 8 ++++---- spec/unit/provider/service/openbsd_spec.rb | 12 ++++++------ spec/unit/provider/service/redhat_spec.rb | 10 +++++----- spec/unit/provider/service/smf_spec.rb | 13 ++++++++----- 6 files changed, 29 insertions(+), 26 deletions(-) diff --git a/spec/unit/provider/service/daemontools_spec.rb b/spec/unit/provider/service/daemontools_spec.rb index 9e1645740ab..f1110333724 100644 --- a/spec/unit/provider/service/daemontools_spec.rb +++ b/spec/unit/provider/service/daemontools_spec.rb @@ -109,7 +109,7 @@ path = File.join(@servicedir,"myservice") expect(Puppet::FileSystem).to receive(:symlink?).with(path).and_return(true) expect(Puppet::FileSystem).to receive(:unlink).with(path) - allow(@provider).to receive(:texecute).and_return("") + allow(@provider).to receive(:execute).and_return("") @provider.disable end diff --git a/spec/unit/provider/service/init_spec.rb b/spec/unit/provider/service/init_spec.rb index bdb8c3a6c9d..7622f8053b3 100644 --- a/spec/unit/provider/service/init_spec.rb +++ b/spec/unit/provider/service/init_spec.rb @@ -231,20 +231,20 @@ end it "should execute the command" do - expect(provider).to receive(:texecute).with(:status, ['/service/path/myservice', :status], false).and_return("") + expect(provider).to receive(:execute).with(['/service/path/myservice', :status], hash_including(failonfail: false)).and_return("") allow($CHILD_STATUS).to receive(:exitstatus).and_return(0) provider.status end it "should consider the process running if the command returns 0" do - expect(provider).to receive(:texecute).with(:status, ['/service/path/myservice', :status], false).and_return("") + expect(provider).to receive(:execute).with(['/service/path/myservice', :status], hash_including(failonfail: false)).and_return("") allow($CHILD_STATUS).to receive(:exitstatus).and_return(0) expect(provider.status).to eq(:running) end [-10,-1,1,10].each { |ec| it "should consider the process stopped if the command returns something non-0" do - expect(provider).to receive(:texecute).with(:status, ['/service/path/myservice', :status], false).and_return("") + expect(provider).to receive(:execute).with(['/service/path/myservice', :status], hash_including(failonfail: false)).and_return("") allow($CHILD_STATUS).to receive(:exitstatus).and_return(ec) expect(provider.status).to eq(:stopped) end @@ -274,8 +274,8 @@ end it "should stop and restart the process" do - expect(provider).to receive(:texecute).with(:stop, ['/service/path/myservice', :stop ], true).and_return("") - expect(provider).to receive(:texecute).with(:start, ['/service/path/myservice', :start], true).and_return("") + expect(provider).to receive(:execute).with(['/service/path/myservice', :stop], hash_including(failonfail: true)).and_return("") + expect(provider).to receive(:execute).with(['/service/path/myservice', :start], hash_including(failonfail: true)).and_return("") allow($CHILD_STATUS).to receive(:exitstatus).and_return(0) provider.restart end diff --git a/spec/unit/provider/service/launchd_spec.rb b/spec/unit/provider/service/launchd_spec.rb index 83687f1979d..644080e4462 100644 --- a/spec/unit/provider/service/launchd_spec.rb +++ b/spec/unit/provider/service/launchd_spec.rb @@ -52,14 +52,14 @@ it "should use the user-provided status command if present and return running if true" do resource[:status] = '/bin/true' - expect(subject).to receive(:texecute).with(:status, ["/bin/true"], false).and_return(0) + expect(subject).to receive(:execute).with(["/bin/true"], hash_including(failonfail: false)).and_return("") allow($CHILD_STATUS).to receive(:exitstatus).and_return(0) expect(subject.status).to eq(:running) end it "should use the user-provided status command if present and return stopped if false" do resource[:status] = '/bin/false' - expect(subject).to receive(:texecute).with(:status, ["/bin/false"], false).and_return(nil) + expect(subject).to receive(:execute).with(["/bin/false"], hash_including(failonfail: false)).and_return("") allow($CHILD_STATUS).to receive(:exitstatus).and_return(1) expect(subject.status).to eq(:stopped) end @@ -130,7 +130,7 @@ it "should call any explicit 'start' command" do resource[:start] = "/bin/false" - expect(subject).to receive(:texecute).with(:start, ["/bin/false"], true) + expect(subject).to receive(:execute).with(["/bin/false"], hash_including(failonfail: true)) subject.start end @@ -184,7 +184,7 @@ describe "when stopping the service" do it "should call any explicit 'stop' command" do resource[:stop] = "/bin/false" - expect(subject).to receive(:texecute).with(:stop, ["/bin/false"], true) + expect(subject).to receive(:execute).with(["/bin/false"], hash_including(failonfail: true)) subject.stop end diff --git a/spec/unit/provider/service/openbsd_spec.rb b/spec/unit/provider/service/openbsd_spec.rb index 90f003b5705..42edc4a0064 100644 --- a/spec/unit/provider/service/openbsd_spec.rb +++ b/spec/unit/provider/service/openbsd_spec.rb @@ -43,7 +43,7 @@ it "should start the service otherwise" do provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd')) - expect(provider).to receive(:texecute).with(:start, ['/usr/sbin/rcctl', '-f', :start, 'sshd'], true) + expect(provider).to receive(:execute).with(['/usr/sbin/rcctl', '-f', :start, 'sshd'], hash_including(failonfail: true)) provider.start end end @@ -57,7 +57,7 @@ it "should stop the service otherwise" do provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd')) - expect(provider).to receive(:texecute).with(:stop, ['/usr/sbin/rcctl', :stop, 'sshd'], true) + expect(provider).to receive(:execute).with(['/usr/sbin/rcctl', :stop, 'sshd'], hash_including(failonfail: true)) provider.stop end end @@ -97,15 +97,15 @@ it "should restart the service with rcctl restart if hasrestart is true" do provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :hasrestart => true)) - expect(provider).to receive(:texecute).with(:restart, ['/usr/sbin/rcctl', '-f', :restart, 'sshd'], true) + expect(provider).to receive(:execute).with(['/usr/sbin/rcctl', '-f', :restart, 'sshd'], hash_including(failonfail: true)) provider.restart end it "should restart the service with rcctl stop/start if hasrestart is false" do provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :hasrestart => false)) - expect(provider).not_to receive(:texecute).with(:restart, ['/usr/sbin/rcctl', '-f', :restart, 'sshd'], true) - expect(provider).to receive(:texecute).with(:stop, ['/usr/sbin/rcctl', :stop, 'sshd'], true) - expect(provider).to receive(:texecute).with(:start, ['/usr/sbin/rcctl', '-f', :start, 'sshd'], true) + expect(provider).not_to receive(:execute).with(['/usr/sbin/rcctl', '-f', :restart, 'sshd'], any_args) + expect(provider).to receive(:execute).with(['/usr/sbin/rcctl', :stop, 'sshd'], hash_including(failonfail: true)) + expect(provider).to receive(:execute).with(['/usr/sbin/rcctl', '-f', :start, 'sshd'], hash_including(failonfail: true)) provider.restart end end diff --git a/spec/unit/provider/service/redhat_spec.rb b/spec/unit/provider/service/redhat_spec.rb index 652ca8f97aa..a70f2e5b914 100644 --- a/spec/unit/provider/service/redhat_spec.rb +++ b/spec/unit/provider/service/redhat_spec.rb @@ -146,19 +146,19 @@ end it "should execute the service script with fail_on_failure false" do - expect(@provider).to receive(:texecute).with(:status, ['/sbin/service', 'myservice', 'status'], false) + expect(@provider).to receive(:execute).with(['/sbin/service', 'myservice', 'status'], any_args) @provider.status end it "should consider the process running if the command returns 0" do - expect(@provider).to receive(:texecute).with(:status, ['/sbin/service', 'myservice', 'status'], false) + expect(@provider).to receive(:execute).with(['/sbin/service', 'myservice', 'status'], hash_including(failonfail: false)) allow($CHILD_STATUS).to receive(:exitstatus).and_return(0) expect(@provider.status).to eq(:running) end [-10,-1,1,10].each { |ec| it "should consider the process stopped if the command returns something non-0" do - expect(@provider).to receive(:texecute).with(:status, ['/sbin/service', 'myservice', 'status'], false) + expect(@provider).to receive(:execute).with(['/sbin/service', 'myservice', 'status'], hash_including(failonfail: false)) allow($CHILD_STATUS).to receive(:exitstatus).and_return(ec) expect(@provider.status).to eq(:stopped) end @@ -180,8 +180,8 @@ context "when restarting and hasrestart is not :true" do it "should stop and restart the process with the server script" do - expect(@provider).to receive(:texecute).with(:stop, ['/sbin/service', 'myservice', 'stop'], true) - expect(@provider).to receive(:texecute).with(:start, ['/sbin/service', 'myservice', 'start'], true) + expect(@provider).to receive(:execute).with(['/sbin/service', 'myservice', 'stop'], hash_including(failonfail: true)) + expect(@provider).to receive(:execute).with(['/sbin/service', 'myservice', 'start'], hash_including(failonfail: true)) @provider.restart end end diff --git a/spec/unit/provider/service/smf_spec.rb b/spec/unit/provider/service/smf_spec.rb index 00b58c0c9f9..4cc772d3022 100644 --- a/spec/unit/provider/service/smf_spec.rb +++ b/spec/unit/provider/service/smf_spec.rb @@ -4,6 +4,10 @@ unless: Puppet::Util::Platform.windows? || Puppet::Util::Platform.jruby? do let(:provider_class) { Puppet::Type.type(:service).provider(:smf) } + before(:all) do + `exit 0` + end + def set_resource_params(params = {}) params.each do |param, value| if value.nil? @@ -255,12 +259,12 @@ def transition_service(from, to, tries) before(:each) do allow(@provider).to receive(:service_fmri).and_return(fmri) - allow(@provider).to receive(:texecute) + allow(@provider).to receive(:execute) allow(@provider).to receive(:wait) end it 'should restart the service' do - expect(@provider).to receive(:texecute) + expect(@provider).to receive(:execute) @provider.restart end @@ -286,9 +290,8 @@ def transition_service(from, to, tries) it "should run the status command if it's passed in" do set_resource_params({ :status => 'status_cmd' }) - expect(@provider).to receive(:ucommand).with(:status, false) do |_, _| - expect($CHILD_STATUS).to receive(:exitstatus).and_return(0) - end + expect(@provider).to receive(:execute).with(["status_cmd"], hash_including(failonfail: false)) + expect($CHILD_STATUS).to receive(:exitstatus).and_return(0) expect(@provider).not_to receive(:service_states) expect(@provider.status).to eql(:running) From 208633ccc2e0e9382144bbcc7d98ef89a73e8720 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Wed, 28 Apr 2021 18:46:56 -0700 Subject: [PATCH 350/731] (PUP-11048) Refactor service execution The texecute and ucommand methods return nil if the child process returns 0 or if failonfail is false, so the actual exit code must be retrieved via $CHILD_STATUS, which can't be stubbed in ruby 3. This commit changes service providers to call service_execute and service_command instead, which return a ProcessOutput object containing the child's exitstatus. In order to maintain compatibility, methods like Base#start continue to return nil instead of ProcessOutput. --- lib/puppet/provider/service/base.rb | 8 +++++--- lib/puppet/provider/service/daemontools.rb | 1 - lib/puppet/provider/service/init.rb | 2 +- lib/puppet/provider/service/launchd.rb | 10 ++++++++-- lib/puppet/provider/service/service.rb | 3 ++- 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/lib/puppet/provider/service/base.rb b/lib/puppet/provider/service/base.rb index 9576398597e..10e16d0e10d 100644 --- a/lib/puppet/provider/service/base.rb +++ b/lib/puppet/provider/service/base.rb @@ -68,7 +68,7 @@ def getpid def status if @resource[:status] or statuscmd # Don't fail when the exit status is not 0. - ucommand(:status, false) + status = service_command(:status, false) # Explicitly calling exitstatus to facilitate testing if $CHILD_STATUS.exitstatus == 0 @@ -93,7 +93,8 @@ def statuscmd # Run the 'start' parameter command, or the specified 'startcmd'. def start - ucommand(:start) + service_command(:start) + nil end # The command used to start. Generated if the 'binary' argument @@ -114,7 +115,8 @@ def startcmd # This method will generally not be overridden by submodules. def stop if @resource[:stop] or stopcmd - ucommand(:stop) + service_command(:stop) + nil else pid = getpid unless pid diff --git a/lib/puppet/provider/service/daemontools.rb b/lib/puppet/provider/service/daemontools.rb index b493c4bae41..3ce7de63d71 100644 --- a/lib/puppet/provider/service/daemontools.rb +++ b/lib/puppet/provider/service/daemontools.rb @@ -128,7 +128,6 @@ def setupservice if resource[:manifest] Puppet.notice "Configuring #{resource[:name]}" command = [ resource[:manifest], resource[:name] ] - #texecute("setupservice", command) system("#{command}") end rescue Puppet::ExecutionFailure => detail diff --git a/lib/puppet/provider/service/init.rb b/lib/puppet/provider/service/init.rb index 3ab27b33224..2ed9ff8dd6e 100644 --- a/lib/puppet/provider/service/init.rb +++ b/lib/puppet/provider/service/init.rb @@ -170,7 +170,7 @@ def restartcmd (@resource[:hasrestart] == :true) && [initscript, :restart] end - def texecute(type, command, fof = true, squelch = false, combine = true) + def service_execute(type, command, fof = true, squelch = false, combine = true) if type == :start && Facter.value(:osfamily) == "Solaris" command = ["/usr/bin/ctrun -l child", command].flatten.join(" ") end diff --git a/lib/puppet/provider/service/launchd.rb b/lib/puppet/provider/service/launchd.rb index bde8535cb13..6717a5dfb28 100644 --- a/lib/puppet/provider/service/launchd.rb +++ b/lib/puppet/provider/service/launchd.rb @@ -262,7 +262,10 @@ def status # conditionally enable at load, then disable by modifying the plist file # directly. def start - return ucommand(:start) if resource[:start] + if resource[:start] + service_command(:start) + return nil + end job_path, _ = plist_from_label(resource[:name]) did_enable_job = false cmds = [] @@ -285,7 +288,10 @@ def start def stop - return ucommand(:stop) if resource[:stop] + if resource[:stop] + service_command(:stop) + return nil + end job_path, _ = plist_from_label(resource[:name]) did_disable_job = false cmds = [] diff --git a/lib/puppet/provider/service/service.rb b/lib/puppet/provider/service/service.rb index b777b5a7a5c..a31d751bd5e 100644 --- a/lib/puppet/provider/service/service.rb +++ b/lib/puppet/provider/service/service.rb @@ -8,7 +8,8 @@ def self.instances # How to restart the process. def restart if @resource[:restart] or restartcmd - ucommand(:restart) + service_command(:restart) + nil else self.stop self.start From 92f8887d9bb297d12ef2d5a18d274454d0545377 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Wed, 28 Apr 2021 19:43:11 -0700 Subject: [PATCH 351/731] (PUP-11048) Remove usages of CHILD_STATUS from services Update service provider tests to return a ProcessOutput with the expected exitstatus instead of stubbing CHILD_STATUS. It is also necessary to modify the `Base#status` method to not rely on CHILD_STATUS, as that method gets called by each of the subclasses. --- lib/puppet/provider/service/base.rb | 2 +- lib/puppet/provider/service/src.rb | 4 +- spec/unit/provider/service/base_spec.rb | 11 ++++-- spec/unit/provider/service/gentoo_spec.rb | 29 +++++++++----- spec/unit/provider/service/init_spec.rb | 44 ++++++++++++++-------- spec/unit/provider/service/launchd_spec.rb | 10 +++-- spec/unit/provider/service/openbsd_spec.rb | 18 ++++++--- spec/unit/provider/service/openrc_spec.rb | 25 +++++++----- spec/unit/provider/service/redhat_spec.rb | 26 +++++++++---- spec/unit/provider/service/smf_spec.rb | 5 ++- spec/unit/provider/service/src_spec.rb | 11 +++--- spec/unit/provider/service/systemd_spec.rb | 2 - spec/unit/provider/service/upstart_spec.rb | 41 ++++++++++++-------- 13 files changed, 141 insertions(+), 87 deletions(-) diff --git a/lib/puppet/provider/service/base.rb b/lib/puppet/provider/service/base.rb index 10e16d0e10d..3cd87f6fc1a 100644 --- a/lib/puppet/provider/service/base.rb +++ b/lib/puppet/provider/service/base.rb @@ -71,7 +71,7 @@ def status status = service_command(:status, false) # Explicitly calling exitstatus to facilitate testing - if $CHILD_STATUS.exitstatus == 0 + if status.exitstatus == 0 return :running else return :stopped diff --git a/lib/puppet/provider/service/src.rb b/lib/puppet/provider/service/src.rb index 8276598769b..d8d4619772c 100644 --- a/lib/puppet/provider/service/src.rb +++ b/lib/puppet/provider/service/src.rb @@ -53,8 +53,8 @@ def default_action end def enabled? - execute([command(:lsitab), @resource[:name]], {:failonfail => false, :combine => true}) - $CHILD_STATUS.exitstatus == 0 ? :true : :false + output = execute([command(:lsitab), @resource[:name]], {:failonfail => false, :combine => true}) + output.exitstatus == 0 ? :true : :false end def enable diff --git a/spec/unit/provider/service/base_spec.rb b/spec/unit/provider/service/base_spec.rb index 0039f492e46..73ffa3399f7 100644 --- a/spec/unit/provider/service/base_spec.rb +++ b/spec/unit/provider/service/base_spec.rb @@ -35,16 +35,19 @@ def execute_command(command, options) expect(options[:failonfail]).to eq(true) raise(Puppet::ExecutionFailure, 'failed to start') if @running @running = true - return 'started' + Puppet::Util::Execution::ProcessOutput.new('started', 0) when status_command expect(options[:failonfail]).to eq(false) - allow($CHILD_STATUS).to receive(:exitstatus) {@running ? 0 : 1} - return @running ? 'running' : 'not running' + if @running + Puppet::Util::Execution::ProcessOutput.new('running', 0) + else + Puppet::Util::Execution::ProcessOutput.new('not running', 1) + end when stop_command expect(options[:failonfail]).to eq(true) raise(Puppet::ExecutionFailure, 'failed to stop') unless @running @running = false - return 'stopped' + Puppet::Util::Execution::ProcessOutput.new('stopped', 0) else raise "unexpected command execution: #{command}" end diff --git a/spec/unit/provider/service/gentoo_spec.rb b/spec/unit/provider/service/gentoo_spec.rb index 335dc657af4..4b6c19dc561 100644 --- a/spec/unit/provider/service/gentoo_spec.rb +++ b/spec/unit/provider/service/gentoo_spec.rb @@ -46,6 +46,10 @@ ] end + let :process_output do + Puppet::Util::Execution::ProcessOutput.new('', 0) + end + describe ".instances" do it "should have an instances method" do expect(provider_class).to respond_to(:instances) @@ -160,24 +164,27 @@ it "should use the status command from the resource" do provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :status => '/bin/foo')) expect(provider).not_to receive(:execute).with(['/etc/init.d/sshd',:status], :failonfail => false, :override_locale => false, :squelch => false, :combine => true) - expect(provider).to receive(:execute).with(['/bin/foo'], :failonfail => false, :override_locale => false, :squelch => false, :combine => true) - allow($CHILD_STATUS).to receive(:exitstatus).and_return(0) + expect(provider).to receive(:execute) + .with(['/bin/foo'], :failonfail => false, :override_locale => false, :squelch => false, :combine => true) + .and_return(process_output) provider.status end it "should return :stopped when the status command returns with a non-zero exitcode" do provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :status => '/bin/foo')) expect(provider).not_to receive(:execute).with(['/etc/init.d/sshd',:status], :failonfail => false, :override_locale => false, :squelch => false, :combine => true) - expect(provider).to receive(:execute).with(['/bin/foo'], :failonfail => false, :override_locale => false, :squelch => false, :combine => true) - allow($CHILD_STATUS).to receive(:exitstatus).and_return(3) + expect(provider).to receive(:execute) + .with(['/bin/foo'], :failonfail => false, :override_locale => false, :squelch => false, :combine => true) + .and_return(Puppet::Util::Execution::ProcessOutput.new('', 3)) expect(provider.status).to eq(:stopped) end it "should return :running when the status command returns with a zero exitcode" do provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :status => '/bin/foo')) expect(provider).not_to receive(:execute).with(['/etc/init.d/sshd',:status], :failonfail => false, :override_locale => false, :squelch => false, :combine => true) - expect(provider).to receive(:execute).with(['/bin/foo'], :failonfail => false, :override_locale => false, :squelch => false, :combine => true) - allow($CHILD_STATUS).to receive(:exitstatus).and_return(0) + expect(provider).to receive(:execute) + .with(['/bin/foo'], :failonfail => false, :override_locale => false, :squelch => false, :combine => true) + .and_return(process_output) expect(provider.status).to eq(:running) end end @@ -202,16 +209,18 @@ it "should return running if status exits with a zero exitcode" do provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :hasstatus => true)) expect(provider).to receive(:search).with('sshd').and_return('/etc/init.d/sshd') - expect(provider).to receive(:execute).with(['/etc/init.d/sshd',:status], :failonfail => false, :override_locale => false, :squelch => false, :combine => true) - allow($CHILD_STATUS).to receive(:exitstatus).and_return(0) + expect(provider).to receive(:execute) + .with(['/etc/init.d/sshd',:status], :failonfail => false, :override_locale => false, :squelch => false, :combine => true) + .and_return(process_output) expect(provider.status).to eq(:running) end it "should return stopped if status exits with a non-zero exitcode" do provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :hasstatus => true)) expect(provider).to receive(:search).with('sshd').and_return('/etc/init.d/sshd') - expect(provider).to receive(:execute).with(['/etc/init.d/sshd',:status], :failonfail => false, :override_locale => false, :squelch => false, :combine => true) - allow($CHILD_STATUS).to receive(:exitstatus).and_return(3) + expect(provider).to receive(:execute) + .with(['/etc/init.d/sshd',:status], :failonfail => false, :override_locale => false, :squelch => false, :combine => true) + .and_return(Puppet::Util::Execution::ProcessOutput.new('', 3)) expect(provider.status).to eq(:stopped) end end diff --git a/spec/unit/provider/service/init_spec.rb b/spec/unit/provider/service/init_spec.rb index 7622f8053b3..157e9e80c0e 100644 --- a/spec/unit/provider/service/init_spec.rb +++ b/spec/unit/provider/service/init_spec.rb @@ -37,6 +37,10 @@ %w{functions.sh reboot.sh shutdown.sh functions halt killall single linuxconf reboot boot wait-for-state rcS module-init-tools} end + let :process_output do + Puppet::Util::Execution::ProcessOutput.new('', 0) + end + describe "when running on FreeBSD" do before :each do allow(Facter).to receive(:value).with(:operatingsystem).and_return('FreeBSD') @@ -204,12 +208,12 @@ describe "when running #{method}" do before :each do - allow($CHILD_STATUS).to receive(:exitstatus).and_return(0) + allow(provider).to receive(:execute).and_return(process_output) end it "should use any provided explicit command" do resource[method] = "/user/specified/command" - expect(provider).to receive(:execute).with(["/user/specified/command"], any_args) + expect(provider).to receive(:execute).with(["/user/specified/command"], any_args).and_return(process_output) provider.send(method) end @@ -217,7 +221,7 @@ it "should pass #{method} to the init script when no explicit command is provided" do resource[:hasrestart] = :true resource[:hasstatus] = :true - expect(provider).to receive(:execute).with(["/service/path/myservice", method], any_args) + expect(provider).to receive(:execute).with(["/service/path/myservice", method], any_args).and_return(process_output) provider.send(method) end @@ -231,21 +235,24 @@ end it "should execute the command" do - expect(provider).to receive(:execute).with(['/service/path/myservice', :status], hash_including(failonfail: false)).and_return("") - allow($CHILD_STATUS).to receive(:exitstatus).and_return(0) + expect(provider).to receive(:execute) + .with(['/service/path/myservice', :status], hash_including(failonfail: false)) + .and_return(process_output) provider.status end it "should consider the process running if the command returns 0" do - expect(provider).to receive(:execute).with(['/service/path/myservice', :status], hash_including(failonfail: false)).and_return("") - allow($CHILD_STATUS).to receive(:exitstatus).and_return(0) + expect(provider).to receive(:execute) + .with(['/service/path/myservice', :status], hash_including(failonfail: false)) + .and_return(process_output) expect(provider.status).to eq(:running) end [-10,-1,1,10].each { |ec| it "should consider the process stopped if the command returns something non-0" do - expect(provider).to receive(:execute).with(['/service/path/myservice', :status], hash_including(failonfail: false)).and_return("") - allow($CHILD_STATUS).to receive(:exitstatus).and_return(ec) + expect(provider).to receive(:execute) + .with(['/service/path/myservice', :status], hash_including(failonfail: false)) + .and_return(Puppet::Util::Execution::ProcessOutput.new('', ec)) expect(provider.status).to eq(:stopped) end } @@ -274,9 +281,12 @@ end it "should stop and restart the process" do - expect(provider).to receive(:execute).with(['/service/path/myservice', :stop], hash_including(failonfail: true)).and_return("") - expect(provider).to receive(:execute).with(['/service/path/myservice', :start], hash_including(failonfail: true)).and_return("") - allow($CHILD_STATUS).to receive(:exitstatus).and_return(0) + expect(provider).to receive(:execute) + .with(['/service/path/myservice', :stop], hash_including(failonfail: true)) + .and_return(process_output) + expect(provider).to receive(:execute) + .with(['/service/path/myservice', :start], hash_including(failonfail: true)) + .and_return(process_output) provider.restart end end @@ -284,8 +294,9 @@ describe "when starting a service on Solaris" do it "should use ctrun" do allow(Facter).to receive(:value).with(:osfamily).and_return('Solaris') - expect(provider).to receive(:execute).with('/usr/bin/ctrun -l child /service/path/myservice start', {:failonfail => true, :override_locale => false, :squelch => false, :combine => true}).and_return("") - allow($CHILD_STATUS).to receive(:exitstatus).and_return(0) + expect(provider).to receive(:execute) + .with('/usr/bin/ctrun -l child /service/path/myservice start', {:failonfail => true, :override_locale => false, :squelch => false, :combine => true}) + .and_return(process_output) provider.start end end @@ -293,8 +304,9 @@ describe "when starting a service on RedHat" do it "should not use ctrun" do allow(Facter).to receive(:value).with(:osfamily).and_return('RedHat') - expect(provider).to receive(:execute).with(['/service/path/myservice', :start], {:failonfail => true, :override_locale => false, :squelch => false, :combine => true}).and_return("") - allow($CHILD_STATUS).to receive(:exitstatus).and_return(0) + expect(provider).to receive(:execute) + .with(['/service/path/myservice', :start], {:failonfail => true, :override_locale => false, :squelch => false, :combine => true}) + .and_return(process_output) provider.start end end diff --git a/spec/unit/provider/service/launchd_spec.rb b/spec/unit/provider/service/launchd_spec.rb index 644080e4462..eab8ed7eb45 100644 --- a/spec/unit/provider/service/launchd_spec.rb +++ b/spec/unit/provider/service/launchd_spec.rb @@ -52,15 +52,17 @@ it "should use the user-provided status command if present and return running if true" do resource[:status] = '/bin/true' - expect(subject).to receive(:execute).with(["/bin/true"], hash_including(failonfail: false)).and_return("") - allow($CHILD_STATUS).to receive(:exitstatus).and_return(0) + expect(subject).to receive(:execute) + .with(["/bin/true"], hash_including(failonfail: false)) + .and_return(Puppet::Util::Execution::ProcessOutput.new('', 0)) expect(subject.status).to eq(:running) end it "should use the user-provided status command if present and return stopped if false" do resource[:status] = '/bin/false' - expect(subject).to receive(:execute).with(["/bin/false"], hash_including(failonfail: false)).and_return("") - allow($CHILD_STATUS).to receive(:exitstatus).and_return(1) + expect(subject).to receive(:execute) + .with(["/bin/false"], hash_including(failonfail: false)) + .and_return(Puppet::Util::Execution::ProcessOutput.new('', 1)) expect(subject.status).to eq(:stopped) end diff --git a/spec/unit/provider/service/openbsd_spec.rb b/spec/unit/provider/service/openbsd_spec.rb index 42edc4a0064..cee709ca7fa 100644 --- a/spec/unit/provider/service/openbsd_spec.rb +++ b/spec/unit/provider/service/openbsd_spec.rb @@ -66,23 +66,27 @@ it "should use the status command from the resource" do provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :status => '/bin/foo')) expect(provider).not_to receive(:execute).with(['/usr/sbin/rcctl', :get, 'sshd', :status], :failonfail => true, :override_locale => false, :squelch => false, :combine => true) - expect(provider).to receive(:execute).with(['/bin/foo'], :failonfail => false, :override_locale => false, :squelch => false, :combine => true) + expect(provider).to receive(:execute) + .with(['/bin/foo'], :failonfail => false, :override_locale => false, :squelch => false, :combine => true) + .and_return(Puppet::Util::Execution::ProcessOutput.new('', 0)) provider.status end it "should return :stopped when status command returns with a non-zero exitcode" do provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :status => '/bin/foo')) expect(provider).not_to receive(:execute).with(['/usr/sbin/rcctl', :get, 'sshd', :status], :failonfail => true, :override_locale => false, :squelch => false, :combine => true) - expect(provider).to receive(:execute).with(['/bin/foo'], :failonfail => false, :override_locale => false, :squelch => false, :combine => true) - allow($CHILD_STATUS).to receive(:exitstatus).and_return(3) + expect(provider).to receive(:execute) + .with(['/bin/foo'], :failonfail => false, :override_locale => false, :squelch => false, :combine => true) + .and_return(Puppet::Util::Execution::ProcessOutput.new('', 3)) expect(provider.status).to eq(:stopped) end it "should return :running when status command returns with a zero exitcode" do provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :status => '/bin/foo')) expect(provider).not_to receive(:execute).with(['/usr/sbin/rcctl', :get, 'sshd', :status], :failonfail => true, :override_locale => false, :squelch => false, :combine => true) - expect(provider).to receive(:execute).with(['/bin/foo'], :failonfail => false, :override_locale => false, :squelch => false, :combine => true) - allow($CHILD_STATUS).to receive(:exitstatus).and_return(0) + expect(provider).to receive(:execute) + .with(['/bin/foo'], :failonfail => false, :override_locale => false, :squelch => false, :combine => true) + .and_return(Puppet::Util::Execution::ProcessOutput.new('', 0)) expect(provider.status).to eq(:running) end end @@ -91,7 +95,9 @@ it "should use the supplied restart command if specified" do provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :restart => '/bin/foo')) expect(provider).not_to receive(:execute).with(['/usr/sbin/rcctl', '-f', :restart, 'sshd'], :failonfail => true, :override_locale => false, :squelch => false, :combine => true) - expect(provider).to receive(:execute).with(['/bin/foo'], :failonfail => true, :override_locale => false, :squelch => false, :combine => true) + expect(provider).to receive(:execute) + .with(['/bin/foo'], :failonfail => true, :override_locale => false, :squelch => false, :combine => true) + .and_return(Puppet::Util::Execution::ProcessOutput.new('', 0)) provider.restart end diff --git a/spec/unit/provider/service/openrc_spec.rb b/spec/unit/provider/service/openrc_spec.rb index 1dd56749142..829190bf941 100644 --- a/spec/unit/provider/service/openrc_spec.rb +++ b/spec/unit/provider/service/openrc_spec.rb @@ -150,24 +150,27 @@ it "should use the status command from the resource" do provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :status => '/bin/foo')) expect(provider).not_to receive(:execute).with(['/sbin/rc-service','sshd',:status], :failonfail => false, :override_locale => false, :squelch => false, :combine => true) - expect(provider).to receive(:execute).with(['/bin/foo'], :failonfail => false, :override_locale => false, :squelch => false, :combine => true) - allow($CHILD_STATUS).to receive(:exitstatus).and_return(0) + expect(provider).to receive(:execute) + .with(['/bin/foo'], :failonfail => false, :override_locale => false, :squelch => false, :combine => true) + .and_return(Puppet::Util::Execution::ProcessOutput.new('', 0)) provider.status end it "should return :stopped when status command returns with a non-zero exitcode" do provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :status => '/bin/foo')) expect(provider).not_to receive(:execute).with(['/sbin/rc-service','sshd',:status], :failonfail => false, :override_locale => false, :squelch => false, :combine => true) - expect(provider).to receive(:execute).with(['/bin/foo'], :failonfail => false, :override_locale => false, :squelch => false, :combine => true) - allow($CHILD_STATUS).to receive(:exitstatus).and_return(3) + expect(provider).to receive(:execute) + .with(['/bin/foo'], :failonfail => false, :override_locale => false, :squelch => false, :combine => true) + .and_return(Puppet::Util::Execution::ProcessOutput.new('', 3)) expect(provider.status).to eq(:stopped) end it "should return :running when status command returns with a zero exitcode" do provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :status => '/bin/foo')) expect(provider).not_to receive(:execute).with(['/sbin/rc-service','sshd',:status], :failonfail => false, :override_locale => false, :squelch => false, :combine => true) - expect(provider).to receive(:execute).with(['/bin/foo'], :failonfail => false, :override_locale => false, :squelch => false, :combine => true) - allow($CHILD_STATUS).to receive(:exitstatus).and_return(0) + expect(provider).to receive(:execute) + .with(['/bin/foo'], :failonfail => false, :override_locale => false, :squelch => false, :combine => true) + .and_return(Puppet::Util::Execution::ProcessOutput.new('', 0)) expect(provider.status).to eq(:running) end end @@ -191,15 +194,17 @@ describe "when hasstatus is true" do it "should return running if rc-service status exits with a zero exitcode" do provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :hasstatus => true)) - expect(provider).to receive(:execute).with(['/sbin/rc-service','sshd',:status], :failonfail => false, :override_locale => false, :squelch => false, :combine => true) - allow($CHILD_STATUS).to receive(:exitstatus).and_return(0) + expect(provider).to receive(:execute) + .with(['/sbin/rc-service','sshd',:status], :failonfail => false, :override_locale => false, :squelch => false, :combine => true) + .and_return(Puppet::Util::Execution::ProcessOutput.new('', 0)) expect(provider.status).to eq(:running) end it "should return stopped if rc-service status exits with a non-zero exitcode" do provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :hasstatus => true)) - expect(provider).to receive(:execute).with(['/sbin/rc-service','sshd',:status], :failonfail => false, :override_locale => false, :squelch => false, :combine => true) - allow($CHILD_STATUS).to receive(:exitstatus).and_return(3) + expect(provider).to receive(:execute) + .with(['/sbin/rc-service','sshd',:status], :failonfail => false, :override_locale => false, :squelch => false, :combine => true) + .and_return(Puppet::Util::Execution::ProcessOutput.new('', 3)) expect(provider.status).to eq(:stopped) end end diff --git a/spec/unit/provider/service/redhat_spec.rb b/spec/unit/provider/service/redhat_spec.rb index a70f2e5b914..cb89c538746 100644 --- a/spec/unit/provider/service/redhat_spec.rb +++ b/spec/unit/provider/service/redhat_spec.rb @@ -65,7 +65,9 @@ it "should call service status when initialized from provider" do allow(@resource).to receive(:[]).with(:status).and_return(nil) allow(@provider).to receive(:get).with(:hasstatus).and_return(true) - expect(@provider).to receive(:execute).with(['/sbin/service', 'myservice', 'status'], any_args) + expect(@provider).to receive(:execute) + .with(['/sbin/service', 'myservice', 'status'], any_args) + .and_return(Puppet::Util::Execution::ProcessOutput.new('', 0)) @provider.send(:status) end end @@ -127,13 +129,17 @@ describe "when running #{method}" do it "should use any provided explicit command" do allow(@resource).to receive(:[]).with(method).and_return("/user/specified/command") - expect(@provider).to receive(:execute).with(["/user/specified/command"], any_args) + expect(@provider).to receive(:execute) + .with(["/user/specified/command"], any_args) + .and_return(Puppet::Util::Execution::ProcessOutput.new('', 0)) @provider.send(method) end it "should execute the service script with #{method} when no explicit command is provided" do allow(@resource).to receive(:[]).with("has#{method}".intern).and_return(:true) - expect(@provider).to receive(:execute).with(['/sbin/service', 'myservice', method.to_s], any_args) + expect(@provider).to receive(:execute) + .with(['/sbin/service', 'myservice', method.to_s], any_args) + .and_return(Puppet::Util::Execution::ProcessOutput.new('', 0)) @provider.send(method) end end @@ -146,20 +152,24 @@ end it "should execute the service script with fail_on_failure false" do - expect(@provider).to receive(:execute).with(['/sbin/service', 'myservice', 'status'], any_args) + expect(@provider).to receive(:execute) + .with(['/sbin/service', 'myservice', 'status'], any_args) + .and_return(Puppet::Util::Execution::ProcessOutput.new('', 0)) @provider.status end it "should consider the process running if the command returns 0" do - expect(@provider).to receive(:execute).with(['/sbin/service', 'myservice', 'status'], hash_including(failonfail: false)) - allow($CHILD_STATUS).to receive(:exitstatus).and_return(0) + expect(@provider).to receive(:execute) + .with(['/sbin/service', 'myservice', 'status'], hash_including(failonfail: false)) + .and_return(Puppet::Util::Execution::ProcessOutput.new('', 0)) expect(@provider.status).to eq(:running) end [-10,-1,1,10].each { |ec| it "should consider the process stopped if the command returns something non-0" do - expect(@provider).to receive(:execute).with(['/sbin/service', 'myservice', 'status'], hash_including(failonfail: false)) - allow($CHILD_STATUS).to receive(:exitstatus).and_return(ec) + expect(@provider).to receive(:execute) + .with(['/sbin/service', 'myservice', 'status'], hash_including(failonfail: false)) + .and_return(Puppet::Util::Execution::ProcessOutput.new('', ec)) expect(@provider.status).to eq(:stopped) end } diff --git a/spec/unit/provider/service/smf_spec.rb b/spec/unit/provider/service/smf_spec.rb index 4cc772d3022..dca2012ac77 100644 --- a/spec/unit/provider/service/smf_spec.rb +++ b/spec/unit/provider/service/smf_spec.rb @@ -290,8 +290,9 @@ def transition_service(from, to, tries) it "should run the status command if it's passed in" do set_resource_params({ :status => 'status_cmd' }) - expect(@provider).to receive(:execute).with(["status_cmd"], hash_including(failonfail: false)) - expect($CHILD_STATUS).to receive(:exitstatus).and_return(0) + expect(@provider).to receive(:execute) + .with(["status_cmd"], hash_including(failonfail: false)) + .and_return(Puppet::Util::Execution::ProcessOutput.new('', 0)) expect(@provider).not_to receive(:service_states) expect(@provider.status).to eql(:running) diff --git a/spec/unit/provider/service/src_spec.rb b/spec/unit/provider/service/src_spec.rb index 73e2adc9013..cf5ebe5466e 100644 --- a/spec/unit/provider/service/src_spec.rb +++ b/spec/unit/provider/service/src_spec.rb @@ -110,20 +110,19 @@ context "when checking if it is enabled" do it "should execute the lsitab command" do - expect(@provider).to receive(:execute).with(['/usr/sbin/lsitab', 'myservice'], {:combine => true, :failonfail => false}) - allow($CHILD_STATUS).to receive(:exitstatus).and_return(0) + expect(@provider).to receive(:execute) + .with(['/usr/sbin/lsitab', 'myservice'], {:combine => true, :failonfail => false}) + .and_return(Puppet::Util::Execution::ProcessOutput.new('', 0)) @provider.enabled? end it "should return false when lsitab returns non-zero" do - allow(@provider).to receive(:execute) - allow($CHILD_STATUS).to receive(:exitstatus).and_return(1) + expect(@provider).to receive(:execute).and_return(Puppet::Util::Execution::ProcessOutput.new('', 1)) expect(@provider.enabled?).to eq(:false) end it "should return true when lsitab returns zero" do - allow(@provider).to receive(:execute) - allow($CHILD_STATUS).to receive(:exitstatus).and_return(0) + allow(@provider).to receive(:execute).and_return(Puppet::Util::Execution::ProcessOutput.new('', 0)) expect(@provider.enabled?).to eq(:true) end end diff --git a/spec/unit/provider/service/systemd_spec.rb b/spec/unit/provider/service/systemd_spec.rb index d4edf44018f..92ed8352c57 100644 --- a/spec/unit/provider/service/systemd_spec.rb +++ b/spec/unit/provider/service/systemd_spec.rb @@ -387,8 +387,6 @@ expect(provider).to receive(:execute) .with(['/bin/systemctl','is-active', '--', 'sshd.service'], :failonfail => false, :override_locale => false, :squelch => false, :combine => true) .and_return(Puppet::Util::Execution::ProcessOutput.new("inactive\n", ec)) - # Base#status still uses CHILD_STATUS - allow($CHILD_STATUS).to receive(:exitstatus).and_return(ec) expect(provider.status).to eq(:stopped) end } diff --git a/spec/unit/provider/service/upstart_spec.rb b/spec/unit/provider/service/upstart_spec.rb index 3a4e5a08902..6e2466860ea 100644 --- a/spec/unit/provider/service/upstart_spec.rb +++ b/spec/unit/provider/service/upstart_spec.rb @@ -5,6 +5,7 @@ let(:manual) { "\nmanual" } let(:start_on_default_runlevels) { "\nstart on runlevel [2,3,4,5]" } let!(:provider_class) { Puppet::Type.type(:service).provider(:upstart) } + let(:process_output) { Puppet::Util::Execution::ProcessOutput.new('', 0) } before :each do `exit 0` @@ -121,8 +122,9 @@ def lists_processes_as(output) provider = provider_class.new(resource) allow(provider).to receive(:is_upstart?).and_return(true) - expect(provider).to receive(:status_exec).with(["foo"]).and_return("foo start/running, process 1000") - allow_any_instance_of(Process::Status).to receive(:exitstatus).and_return(0) + expect(provider).to receive(:status_exec) + .with(["foo"]) + .and_return(Puppet::Util::Execution::ProcessOutput.new("foo start/running, process 1000", 0)) expect(provider.status).to eq(:running) end @@ -133,8 +135,9 @@ def lists_processes_as(output) allow(provider).to receive(:is_upstart?).and_return(true) expect(provider).not_to receive(:status_exec).with(['foo']) - expect(provider).to receive(:execute).with(['/bin/foo'], :failonfail => false, :override_locale => false, :squelch => false, :combine => true) - allow_any_instance_of(Process::Status).to receive(:exitstatus).and_return(0) + expect(provider).to receive(:execute) + .with(['/bin/foo'], :failonfail => false, :override_locale => false, :squelch => false, :combine => true) + .and_return(process_output) provider.status end @@ -144,8 +147,9 @@ def lists_processes_as(output) allow(provider).to receive(:is_upstart?).and_return(true) expect(provider).not_to receive(:status_exec).with(['foo']) - expect(provider).to receive(:execute).with(['/bin/foo'], :failonfail => false, :override_locale => false, :squelch => false, :combine => true) - allow($CHILD_STATUS).to receive(:exitstatus).and_return(1) + expect(provider).to receive(:execute) + .with(['/bin/foo'], :failonfail => false, :override_locale => false, :squelch => false, :combine => true) + .and_return(Puppet::Util::Execution::ProcessOutput.new('', 1)) expect(provider.status).to eq(:stopped) end @@ -155,8 +159,9 @@ def lists_processes_as(output) allow(provider).to receive(:is_upstart?).and_return(true) expect(provider).not_to receive(:status_exec).with(['foo']) - expect(provider).to receive(:execute).with(['/bin/foo'], :failonfail => false, :override_locale => false, :squelch => false, :combine => true) - allow($CHILD_STATUS).to receive(:exitstatus).and_return(0) + expect(provider).to receive(:execute) + .with(['/bin/foo'], :failonfail => false, :override_locale => false, :squelch => false, :combine => true) + .and_return(process_output) expect(provider.status).to eq(:running) end end @@ -190,8 +195,9 @@ def lists_processes_as(output) allow(provider).to receive(:is_upstart?).and_return(true) expect(provider).not_to receive(:status_exec).with(['foo']) - expect(provider).to receive(:execute).with(['/bin/foo'], :failonfail => false, :override_locale => false, :squelch => false, :combine => true) - allow_any_instance_of(Process::Status).to receive(:exitstatus).and_return(0) + expect(provider).to receive(:execute) + .with(['/bin/foo'], :failonfail => false, :override_locale => false, :squelch => false, :combine => true) + .and_return(process_output) provider.status end @@ -201,8 +207,9 @@ def lists_processes_as(output) allow(provider).to receive(:is_upstart?).and_return(true) expect(provider).not_to receive(:status_exec).with(['foo']) - expect(provider).to receive(:execute).with(['/bin/foo'], :failonfail => false, :override_locale => false, :squelch => false, :combine => true) - allow($CHILD_STATUS).to receive(:exitstatus).and_return(1) + expect(provider).to receive(:execute) + .with(['/bin/foo'], :failonfail => false, :override_locale => false, :squelch => false, :combine => true) + .and_return(Puppet::Util::Execution::ProcessOutput.new('', 1)) expect(provider.status).to eq(:stopped) end @@ -212,8 +219,9 @@ def lists_processes_as(output) allow(provider).to receive(:is_upstart?).and_return(true) expect(provider).not_to receive(:status_exec).with(['foo']) - expect(provider).to receive(:execute).with(['/bin/foo'], :failonfail => false, :override_locale => false, :squelch => false, :combine => true) - allow($CHILD_STATUS).to receive(:exitstatus).and_return(0) + expect(provider).to receive(:execute) + .with(['/bin/foo'], :failonfail => false, :override_locale => false, :squelch => false, :combine => true) + .and_return(process_output) expect(provider.status).to eq(:running) end end @@ -245,8 +253,9 @@ def lists_processes_as(output) provider = provider_class.new(resource) allow(provider).to receive(:is_upstart?).and_return(true) - expect(provider).to receive(:status_exec).with(["foostartbar"]).and_return("foostartbar stop/waiting") - allow_any_instance_of(Process::Status).to receive(:exitstatus).and_return(0) + expect(provider).to receive(:status_exec) + .with(["foostartbar"]).and_return("foostartbar stop/waiting") + .and_return(process_output) expect(provider.status).to eq(:stopped) end end From 6fc16a0daed20060741192052cde7436188cbe99 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Tue, 27 Apr 2021 18:47:59 -0700 Subject: [PATCH 352/731] (PUP-11048) Remove usages of CHILD_STATUS from packages Also fix order dependent test failure as not all tests were clearing `@current_version`. --- lib/puppet/provider/package/pkg.rb | 2 +- spec/unit/provider/package/dnfmodule_spec.rb | 6 +- spec/unit/provider/package/pkg_spec.rb | 78 +++++++++++--------- 3 files changed, 48 insertions(+), 38 deletions(-) diff --git a/lib/puppet/provider/package/pkg.rb b/lib/puppet/provider/package/pkg.rb index c6777ce5d25..75d9b6441cf 100644 --- a/lib/puppet/provider/package/pkg.rb +++ b/lib/puppet/provider/package/pkg.rb @@ -273,6 +273,6 @@ def query def exec_cmd(*cmd) output = Puppet::Util::Execution.execute(cmd, :failonfail => false, :combine => true) - {:out => output, :exit => $CHILD_STATUS.exitstatus} + {:out => output, :exit => output.exitstatus} end end diff --git a/spec/unit/provider/package/dnfmodule_spec.rb b/spec/unit/provider/package/dnfmodule_spec.rb index 8b3a1a31076..cdb90e7550a 100644 --- a/spec/unit/provider/package/dnfmodule_spec.rb +++ b/spec/unit/provider/package/dnfmodule_spec.rb @@ -45,12 +45,14 @@ before(:each) do expect(Puppet::Type::Package::ProviderDnfmodule).to receive(:execute) .with(["/usr/bin/dnf", "--version"]) - .and_return(dnf_version).at_most(:once) + .and_return(Puppet::Util::Execution::ProcessOutput.new(dnf_version, 0)).at_most(:once) expect(Puppet::Util::Execution).to receive(:execute) .with(["/usr/bin/dnf", "--version"], execute_options) .and_return(Puppet::Util::Execution::ProcessOutput.new(dnf_version, 0)) end + before(:each) { described_class.instance_variable_set("@current_version", nil) } + describe "with a supported dnf version" do it "correctly parses the version" do expect(described_class.current_version).to eq('4.0.9') @@ -69,8 +71,6 @@ DNF_OUTPUT end - before(:each) { described_class.instance_variable_set("@current_version", nil) } - it "correctly parses the version" do expect(described_class.current_version).to eq('2.7.5') end diff --git a/spec/unit/provider/package/pkg_spec.rb b/spec/unit/provider/package/pkg_spec.rb index 3aa6bf26c6e..5cf24f677fa 100644 --- a/spec/unit/provider/package/pkg_spec.rb +++ b/spec/unit/provider/package/pkg_spec.rb @@ -120,7 +120,6 @@ def self.it_should_respond_to(*actions) expect(Puppet::Util::Execution).to receive(:execute) .with(['/bin/pkg', 'update', '-n', 'dummy'], {:failonfail => false, :combine => true}) .and_return(Puppet::Util::Execution::ProcessOutput.new('', 0)) - allow($CHILD_STATUS).to receive(:exitstatus).and_return(0) expect(described_class).to receive(:pkg).with(:list,'-Hvn','dummy').and_return(File.read(my_fixture('dummy_solaris11.known'))) expect(provider.latest).to eq('1.0.6,5.11-0.175.0.0.0.2.537:20131230T130000Z') @@ -132,8 +131,9 @@ def self.it_should_respond_to(*actions) end it "should work correctly for ensure latest on solaris 11(known IFO)" do - expect(Puppet::Util::Execution).to receive(:execute).with(['/bin/pkg', 'update', '-n', 'dummy'], {:failonfail => false, :combine => true}).and_return('') - allow($CHILD_STATUS).to receive(:exitstatus).and_return(0) + expect(Puppet::Util::Execution).to receive(:execute) + .with(['/bin/pkg', 'update', '-n', 'dummy'], {:failonfail => false, :combine => true}) + .and_return(Puppet::Util::Execution::ProcessOutput.new('', 0)) expect(described_class).to receive(:pkg).with(:list,'-Hvn','dummy').and_return(File.read(my_fixture('dummy_solaris11.ifo.known'))) expect(provider.latest).to eq('1.0.6,5.11-0.175.0.0.0.2.537:20131230T130000Z') @@ -158,7 +158,8 @@ def self.it_should_respond_to(*actions) resource[:install_options] = ['--foo', {'--bar' => 'baz'}] expect(described_class).to receive(:pkg).with(:list,'-Hvn','dummy').and_return(File.read(my_fixture('dummy_solaris11.known'))) expect(Puppet::Util::Execution).to receive(:execute) - .with(['/bin/pkg', 'update', '-n', '--foo', '--bar=baz', 'dummy'], {failonfail: false, combine: true}) + .with(['/bin/pkg', 'update', '-n', '--foo', '--bar=baz', 'dummy'], {failonfail: false, combine: true}) + .and_return(Puppet::Util::Execution::ProcessOutput.new('', 0)) provider.latest end end @@ -195,7 +196,6 @@ def self.it_should_respond_to(*actions) expect(Puppet::Util::Execution).to receive(:execute) .with(['/bin/pkg', 'list', '-Hv', 'dummy'], {:failonfail => false, :combine => true}) .and_return(Puppet::Util::Execution::ProcessOutput.new(File.read(my_fixture('dummy_solaris10')), 0)) - allow($CHILD_STATUS).to receive(:exitstatus).and_return(0) expect(provider.query).to eq({ :name => 'dummy', :ensure => '2.5.5,5.10-0.111:20131230T130000Z', @@ -208,15 +208,13 @@ def self.it_should_respond_to(*actions) it "should return :absent when the package is not found" do expect(Puppet::Util::Execution).to receive(:execute) .with(['/bin/pkg', 'list', '-Hv', 'dummy'], {:failonfail => false, :combine => true}) - .and_return(Puppet::Util::Execution::ProcessOutput.new('', 0)) - allow($CHILD_STATUS).to receive(:exitstatus).and_return(1) + .and_return(Puppet::Util::Execution::ProcessOutput.new('', 1)) expect(provider.query).to eq({:ensure => :absent, :name => "dummy"}) end end context "on solaris 11" do it "should find the package" do - allow($CHILD_STATUS).to receive(:exitstatus).and_return(0) expect(Puppet::Util::Execution).to receive(:execute) .with(['/bin/pkg', 'list', '-Hv', 'dummy'], {:failonfail => false, :combine => true}) .and_return(Puppet::Util::Execution::ProcessOutput.new(File.read(my_fixture('dummy_solaris11.installed')), 0)) @@ -232,8 +230,7 @@ def self.it_should_respond_to(*actions) it "should return :absent when the package is not found" do expect(Puppet::Util::Execution).to receive(:execute) .with(['/bin/pkg', 'list', '-Hv', 'dummy'], {:failonfail => false, :combine => true}) - .and_return(Puppet::Util::Execution::ProcessOutput.new('', 0)) - allow($CHILD_STATUS).to receive(:exitstatus).and_return(1) + .and_return(Puppet::Util::Execution::ProcessOutput.new('', 1)) expect(provider.query).to eq({:ensure => :absent, :name => "dummy"}) end end @@ -242,7 +239,6 @@ def self.it_should_respond_to(*actions) expect(Puppet::Util::Execution).to receive(:execute) .with(['/bin/pkg', 'list', '-Hv', 'dummy'], {:failonfail => false, :combine => true}) .and_return(Puppet::Util::Execution::ProcessOutput.new(File.read(my_fixture('incomplete')), 0)) - allow($CHILD_STATUS).to receive(:exitstatus).and_return(0) expect { provider.query }.to raise_error(ArgumentError, /Unknown line format/) @@ -266,7 +262,7 @@ def self.it_should_respond_to(*actions) expect(provider).to receive(:unhold) expect(Puppet::Util::Execution).to receive(:execute) .with(['/bin/pkg', 'install', *hash[:flags], '--foo', '--bar=baz', 'dummy'], {:failonfail => false, :combine => true}) - allow($CHILD_STATUS).to receive(:exitstatus).and_return(0) + .and_return(Puppet::Util::Execution::ProcessOutput.new('', 0)) provider.install end @@ -279,16 +275,16 @@ def self.it_should_respond_to(*actions) expect(Puppet::Util::Execution).to receive(:execute) .with(['/bin/pkg', 'unfreeze', 'dummy'], {:failonfail => false, :combine => true}) .and_return(Puppet::Util::Execution::ProcessOutput.new('', 0)) - allow($CHILD_STATUS).to receive(:exitstatus).and_return(0) provider.install end it "should install specific version(1)" do # Should install also check if the version installed is the same version we are asked to install? or should we rely on puppet for that? resource[:ensure] = '0.0.7,5.11-0.151006:20131230T130000Z' - allow($CHILD_STATUS).to receive(:exitstatus).and_return(0) expect(provider).to receive(:properties).and_return({:mark => :hold}) - expect(Puppet::Util::Execution).to receive(:execute).with(['/bin/pkg', 'unfreeze', 'dummy'], {:failonfail => false, :combine => true}) + expect(Puppet::Util::Execution).to receive(:execute) + .with(['/bin/pkg', 'unfreeze', 'dummy'], {:failonfail => false, :combine => true}) + .and_return(Puppet::Util::Execution::ProcessOutput.new('', 0)) expect(Puppet::Util::Execution).to receive(:execute) .with(['/bin/pkg', 'list', '-Hv', 'dummy'], {:failonfail => false, :combine => true}) .and_return(Puppet::Util::Execution::ProcessOutput.new('pkg://foo/dummy@0.0.6,5.11-0.151006:20131230T130000Z installed -----', 0)) @@ -301,14 +297,15 @@ def self.it_should_respond_to(*actions) it "should install specific version(2)" do resource[:ensure] = '0.0.8' expect(provider).to receive(:properties).and_return({:mark => :hold}) - expect(Puppet::Util::Execution).to receive(:execute).with(['/bin/pkg', 'unfreeze', 'dummy'], {:failonfail => false, :combine => true}) + expect(Puppet::Util::Execution).to receive(:execute) + .with(['/bin/pkg', 'unfreeze', 'dummy'], {:failonfail => false, :combine => true}) + .and_return(Puppet::Util::Execution::ProcessOutput.new('', 0)) expect(Puppet::Util::Execution).to receive(:execute) .with(['/bin/pkg', 'list', '-Hv', 'dummy'], {:failonfail => false, :combine => true}) .and_return(Puppet::Util::Execution::ProcessOutput.new('pkg://foo/dummy@0.0.7,5.11-0.151006:20131230T130000Z installed -----', 0)) expect(Puppet::Util::Execution).to receive(:execute) .with(['/bin/pkg', 'update', *hash[:flags], 'dummy@0.0.8'], {:failonfail => false, :combine => true}) .and_return(Puppet::Util::Execution::ProcessOutput.new('', 0)) - allow($CHILD_STATUS).to receive(:exitstatus).and_return(0) provider.install end @@ -316,8 +313,9 @@ def self.it_should_respond_to(*actions) resource[:ensure] = '0.0.7' expect(provider).to receive(:properties).and_return({:mark => :hold}) expect(provider).to receive(:query).with(no_args).and_return({:ensure => '0.0.8,5.11-0.151106:20131230T130000Z'}) - allow($CHILD_STATUS).to receive(:exitstatus).and_return(0) - expect(Puppet::Util::Execution).to receive(:execute).with(['/bin/pkg', 'unfreeze', 'dummy'], {:failonfail => false, :combine => true}) + expect(Puppet::Util::Execution).to receive(:execute) + .with(['/bin/pkg', 'unfreeze', 'dummy'], {:failonfail => false, :combine => true}) + .and_return(Puppet::Util::Execution::ProcessOutput.new('', 0)) expect(Puppet::Util::Execution).to receive(:execute) .with(['/bin/pkg', 'update', *hash[:flags], 'dummy@0.0.7'], {:failonfail => false, :combine => true}) .and_return(Puppet::Util::Execution::ProcessOutput.new('', 0)) @@ -331,8 +329,9 @@ def self.it_should_respond_to(*actions) expect(Puppet::Util::Execution).to receive(:execute) .with(['/bin/pkg', 'install', *hash[:flags], 'dummy'], {:failonfail => false, :combine => true}) .and_return(Puppet::Util::Execution::ProcessOutput.new('', 0)) - expect(Puppet::Util::Execution).to receive(:execute).with(['/bin/pkg', 'unfreeze', 'dummy'], {:failonfail => false, :combine => true}) - allow($CHILD_STATUS).to receive(:exitstatus).and_return(0) + expect(Puppet::Util::Execution).to receive(:execute) + .with(['/bin/pkg', 'unfreeze', 'dummy'], {:failonfail => false, :combine => true}) + .and_return(Puppet::Util::Execution::ProcessOutput.new('', 0)) provider.install end @@ -340,11 +339,12 @@ def self.it_should_respond_to(*actions) resource[:ensure] = '0.0.7' expect(provider).to receive(:properties).and_return({:mark => :hold}) expect(provider).to receive(:query).with(no_args).and_return({:ensure => :absent}) - expect(Puppet::Util::Execution).to receive(:execute).with(['/bin/pkg', 'unfreeze', 'dummy'], {:failonfail => false, :combine => true}) + expect(Puppet::Util::Execution).to receive(:execute) + .with(['/bin/pkg', 'unfreeze', 'dummy'], {:failonfail => false, :combine => true}) + .and_return(Puppet::Util::Execution::ProcessOutput.new('', 0)) expect(Puppet::Util::Execution).to receive(:execute) .with(['/bin/pkg', 'install', *hash[:flags], 'dummy@0.0.7'], {:failonfail => false, :combine => true}) .and_return(Puppet::Util::Execution::ProcessOutput.new('', 0)) - allow($CHILD_STATUS).to receive(:exitstatus).and_return(0) provider.install end @@ -356,10 +356,13 @@ def self.it_should_respond_to(*actions) expect(described_class).to receive(:pkg) .with(:list, '-Hvfa', 'dummy@1.0-0.151006') .and_return(Puppet::Util::Execution::ProcessOutput.new(File.read(my_fixture('dummy_implicit_version')), 0)) - expect(Puppet::Util::Execution).to receive(:execute).with(['/bin/pkg', 'install', '-n', 'dummy@1.0,5.11-0.151006:20140220T084443Z'], {:failonfail => false, :combine => true}) + expect(Puppet::Util::Execution).to receive(:execute) + .with(['/bin/pkg', 'install', '-n', 'dummy@1.0,5.11-0.151006:20140220T084443Z'], {:failonfail => false, :combine => true}) + .and_return(Puppet::Util::Execution::ProcessOutput.new('', 0)) expect(provider).to receive(:unhold).with(no_args) - expect(Puppet::Util::Execution).to receive(:execute).with(['/bin/pkg', 'install', *hash[:flags], 'dummy@1.0,5.11-0.151006:20140220T084443Z'], {:failonfail => false, :combine => true}) - allow($CHILD_STATUS).to receive(:exitstatus).and_return(0) + expect(Puppet::Util::Execution).to receive(:execute) + .with(['/bin/pkg', 'install', *hash[:flags], 'dummy@1.0,5.11-0.151006:20140220T084443Z'], {:failonfail => false, :combine => true}) + .and_return(Puppet::Util::Execution::ProcessOutput.new('', 0)) provider.insync?(is) provider.install end @@ -370,10 +373,13 @@ def self.it_should_respond_to(*actions) expect(provider).to receive(:query).with(no_args).and_return({:ensure => is}) expect(provider).to receive(:properties).and_return({:mark => :hold}) expect(described_class).to receive(:pkg).with(:list, '-Hvfa', 'dummy@1.0-0.151006').and_return(File.read(my_fixture('dummy_implicit_version'))) - expect(Puppet::Util::Execution).to receive(:execute).with(['/bin/pkg', 'update', '-n', 'dummy@1.0,5.11-0.151006:20140220T084443Z'], {:failonfail => false, :combine => true}) + expect(Puppet::Util::Execution).to receive(:execute) + .with(['/bin/pkg', 'update', '-n', 'dummy@1.0,5.11-0.151006:20140220T084443Z'], {:failonfail => false, :combine => true}) + .and_return(Puppet::Util::Execution::ProcessOutput.new('', 0)) expect(provider).to receive(:unhold).with(no_args) - expect(Puppet::Util::Execution).to receive(:execute).with(['/bin/pkg', 'update', *hash[:flags], 'dummy@1.0,5.11-0.151006:20140220T084443Z'], {:failonfail => false, :combine => true}) - allow($CHILD_STATUS).to receive(:exitstatus).and_return(0) + expect(Puppet::Util::Execution).to receive(:execute) + .with(['/bin/pkg', 'update', *hash[:flags], 'dummy@1.0,5.11-0.151006:20140220T084443Z'], {:failonfail => false, :combine => true}) + .and_return(Puppet::Util::Execution::ProcessOutput.new('', 0)) provider.insync?(is) provider.install end @@ -385,8 +391,9 @@ def self.it_should_respond_to(*actions) expect(described_class).to receive(:pkg) .with(:list, '-Hvfa', 'dummy@1.0-0.151006') .and_return(Puppet::Util::Execution::ProcessOutput.new(File.read(my_fixture('dummy_implicit_version')), 0)) - expect(Puppet::Util::Execution).to receive(:execute).with(['/bin/pkg', 'update', '-n', 'dummy@1.0,5.11-0.151006:20140220T084443Z'], {:failonfail => false, :combine => true}) - allow($CHILD_STATUS).to receive(:exitstatus).and_return(4) + expect(Puppet::Util::Execution).to receive(:execute) + .with(['/bin/pkg', 'update', '-n', 'dummy@1.0,5.11-0.151006:20140220T084443Z'], {:failonfail => false, :combine => true}) + .and_return(Puppet::Util::Execution::ProcessOutput.new('', 4)) provider.insync?(is) end @@ -395,9 +402,12 @@ def self.it_should_respond_to(*actions) is = :absent expect(provider).to receive(:warning).with("Implicit version 1.0-0.151006 has 3 possible matches") expect(provider).to receive(:warning).with("Selecting version '1.0,5.11-0.151006:20140220T084443Z' for implicit '1.0-0.151006'") - expect(described_class).to receive(:pkg).with(:list, '-Hvfa', 'dummy@1.0-0.151006').and_return(File.read(my_fixture('dummy_implicit_version'))) - expect(Puppet::Util::Execution).to receive(:execute).with(['/bin/pkg', 'install', '-n', 'dummy@1.0,5.11-0.151006:20140220T084443Z'], {:failonfail => false, :combine => true}) - allow($CHILD_STATUS).to receive(:exitstatus).and_return(0) + expect(described_class).to receive(:pkg) + .with(:list, '-Hvfa', 'dummy@1.0-0.151006') + .and_return(Puppet::Util::Execution::ProcessOutput.new(File.read(my_fixture('dummy_implicit_version')), 0)) + expect(Puppet::Util::Execution).to receive(:execute) + .with(['/bin/pkg', 'install', '-n', 'dummy@1.0,5.11-0.151006:20140220T084443Z'], {:failonfail => false, :combine => true}) + .and_return(Puppet::Util::Execution::ProcessOutput.new('', 0)) provider.insync?(is) end end From 92cdd56681ba43f3f27a490f50a81456d41b93ae Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Wed, 28 Apr 2021 20:02:51 -0700 Subject: [PATCH 353/731] (PUP-11048) Remove unneeded stubbing in openbsd service The "allow(provider_class).to receive(:rcctl)" stubs were never used and were redundant with the "expect(provider).to receive(:execute)" expects that followed. Also fix some cases where rcctl *was* being executed. --- spec/unit/provider/service/openbsd_spec.rb | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/spec/unit/provider/service/openbsd_spec.rb b/spec/unit/provider/service/openbsd_spec.rb index cee709ca7fa..775af1615b6 100644 --- a/spec/unit/provider/service/openbsd_spec.rb +++ b/spec/unit/provider/service/openbsd_spec.rb @@ -119,15 +119,13 @@ context "#enabled?" do it "should return :true if the service is enabled" do provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd')) - allow(provider_class).to receive(:rcctl).with(:get, 'sshd', :status) expect(provider).to receive(:execute).with(['/usr/sbin/rcctl', 'get', 'sshd', 'status'], :failonfail => false, :combine => false, :squelch => false).and_return(double(:exitstatus => 0)) expect(provider.enabled?).to eq(:true) end it "should return :false if the service is disabled" do provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd')) - allow(provider_class).to receive(:rcctl).with(:get, 'sshd', :status).and_return('NO') - expect(provider).to receive(:execute).with(['/usr/sbin/rcctl', 'get', 'sshd', 'status'], :failonfail => false, :combine => false, :squelch => false).and_return(double(:exitstatus => 1)) + expect(provider).to receive(:execute).with(['/usr/sbin/rcctl', 'get', 'sshd', 'status'], :failonfail => false, :combine => false, :squelch => false).and_return(Puppet::Util::Execution::ProcessOutput.new('NO', 1)) expect(provider.enabled?).to eq(:false) end end @@ -135,15 +133,12 @@ context "#enable" do it "should run rcctl enable to enable the service" do provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd')) - allow(provider_class).to receive(:rcctl).with(:enable, 'sshd').and_return('') expect(provider).to receive(:rcctl).with(:enable, 'sshd') provider.enable end it "should run rcctl enable with flags if provided" do provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :flags => '-6')) - allow(provider_class).to receive(:rcctl).with(:enable, 'sshd').and_return('') - allow(provider_class).to receive(:rcctl).with(:set, 'sshd', :flags, '-6').and_return('') expect(provider).to receive(:rcctl).with(:enable, 'sshd') expect(provider).to receive(:rcctl).with(:set, 'sshd', :flags, '-6') provider.enable @@ -153,7 +148,6 @@ context "#disable" do it "should run rcctl disable to disable the service" do provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd')) - allow(provider_class).to receive(:rcctl).with(:disable, 'sshd').and_return('') expect(provider).to receive(:rcctl).with(:disable, 'sshd') provider.disable end @@ -162,21 +156,18 @@ context "#running?" do it "should run rcctl check to check the service" do provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd')) - allow(provider_class).to receive(:rcctl).with(:check, 'sshd').and_return('sshd(ok)') expect(provider).to receive(:execute).with(['/usr/sbin/rcctl', 'check', 'sshd'], :failonfail => false, :combine => false, :squelch => false).and_return('sshd(ok)') expect(provider.running?).to be_truthy end it "should return true if the service is running" do provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd')) - allow(provider_class).to receive(:rcctl).with(:check, 'sshd').and_return('sshd(ok)') expect(provider).to receive(:execute).with(['/usr/sbin/rcctl', 'check', 'sshd'], :failonfail => false, :combine => false, :squelch => false).and_return('sshd(ok)') expect(provider.running?).to be_truthy end it "should return nil if the service is not running" do provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd')) - allow(provider_class).to receive(:rcctl).with(:check, 'sshd').and_return('sshd(failed)') expect(provider).to receive(:execute).with(['/usr/sbin/rcctl', 'check', 'sshd'], :failonfail => false, :combine => false, :squelch => false).and_return('sshd(failed)') expect(provider.running?).to be_nil end @@ -185,21 +176,18 @@ context "#flags" do it "should return flags when set" do provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :flags => '-6')) - allow(provider_class).to receive(:rcctl).with('get', 'sshd', 'flags').and_return('-6') expect(provider).to receive(:execute).with(['/usr/sbin/rcctl', 'get', 'sshd', 'flags'], :failonfail => false, :combine => false, :squelch => false).and_return('-6') provider.flags end it "should return empty flags" do provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd')) - allow(provider_class).to receive(:rcctl).with('get', 'sshd', 'flags').and_return('') expect(provider).to receive(:execute).with(['/usr/sbin/rcctl', 'get', 'sshd', 'flags'], :failonfail => false, :combine => false, :squelch => false).and_return('') provider.flags end it "should return flags for special services" do provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'pf')) - allow(provider_class).to receive(:rcctl).with('get', 'pf', 'flags').and_return('YES') expect(provider).to receive(:execute).with(['/usr/sbin/rcctl', 'get', 'pf', 'flags'], :failonfail => false, :combine => false, :squelch => false).and_return('YES') provider.flags end @@ -208,8 +196,9 @@ context "#flags=" do it "should run rcctl to set flags", unless: Puppet::Util::Platform.windows? || RUBY_PLATFORM == 'java' do provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd')) - allow(provider_class).to receive(:rcctl).with(:set, 'sshd', :flags, '-4').and_return('') + expect(provider).to receive(:execute).with(['/usr/sbin/rcctl', 'get', 'sshd', 'flags'], any_args).and_return('') expect(provider).to receive(:rcctl).with(:set, 'sshd', :flags, '-4') + expect(provider).to receive(:execute).with(['/usr/sbin/rcctl', 'check', 'sshd'], any_args).and_return('') provider.flags = '-4' end end From 071cd7301b4a475c6da867985c0e505c3a3c9c51 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Thu, 29 Apr 2021 09:04:33 -0700 Subject: [PATCH 354/731] (PUP-11048) Remove duplicate service_fmri method There were two versions of the file. I kept the latter version, which overwrites the first one and prints all matching service instances. Also add missing stub so we don't try to execute `svcs -l ` --- lib/puppet/provider/service/smf.rb | 24 ------------------------ spec/unit/provider/service/smf_spec.rb | 1 + 2 files changed, 1 insertion(+), 24 deletions(-) diff --git a/lib/puppet/provider/service/smf.rb b/lib/puppet/provider/service/smf.rb index 50244c91305..c7f3f464bd0 100644 --- a/lib/puppet/provider/service/smf.rb +++ b/lib/puppet/provider/service/smf.rb @@ -77,30 +77,6 @@ def setup_service raise Puppet::Error.new( "Cannot config #{@resource[:name]} to enable it: #{detail}", detail ) end - # Returns the service's FMRI. We fail if multiple FMRIs correspond to - # @resource[:name]. - # - # If the service does not exist or we fail to get any FMRIs from svcs, - # this method will raise a Puppet::ExecutionFailure - def service_fmri - return @fmri if @fmri - - # `svcs -l` is better to use because we can detect service instances - # that have not yet been activated or enabled (i.e. it lets us detect - # services that svcadm has not yet touched). `svcs -H -o fmri` is a bit - # more limited. - lines = svcs("-l", @resource[:name]).chomp.lines.to_a - lines.select! { |line| line =~ /^fmri/ } - fmris = lines.map! { |line| line.split(' ')[-1].chomp } - unless fmris.length == 1 - raise Puppet::Error.new( - "Failed to get #{@resource[:name]}'s FMRI: The pattern '#{@resource[:name]}' matches multiple FMRIs! These are the FMRIs it matches: #{fmris.join(', ')}" - ) - end - - @fmri = fmris.first - end - # Returns the service's FMRI. We fail if multiple FMRIs correspond to # @resource[:name]. # diff --git a/spec/unit/provider/service/smf_spec.rb b/spec/unit/provider/service/smf_spec.rb index dca2012ac77..8253fe3f9e4 100644 --- a/spec/unit/provider/service/smf_spec.rb +++ b/spec/unit/provider/service/smf_spec.rb @@ -342,6 +342,7 @@ def transition_service(from, to, tries) it "should return stopped for an incomplete service on Solaris 11" do allow(Facter).to receive(:value).with(:operatingsystemrelease).and_return('11.3') allow(@provider).to receive(:complete_service?).and_return(false) + allow(@provider).to receive(:svcs).with('-l', @provider.resource[:name]).and_return(File.read(my_fixture('svcs_fmri.out'))) expect(@provider.status).to eq(:stopped) end end From 5390e255b09a3f8e37b1404ceb58a19d9470b879 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Tue, 27 Apr 2021 15:24:47 -0700 Subject: [PATCH 355/731] (PUP-11048) Fix order dependent test failures Running base_spec or launch_spec in isolation failed. Ensure facter values other than operatingsystem can be resolved and clear @job_list state. --- spec/unit/provider/service/base_spec.rb | 1 + spec/unit/provider/service/launchd_spec.rb | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/spec/unit/provider/service/base_spec.rb b/spec/unit/provider/service/base_spec.rb index 73ffa3399f7..90fbe60ced2 100644 --- a/spec/unit/provider/service/base_spec.rb +++ b/spec/unit/provider/service/base_spec.rb @@ -101,6 +101,7 @@ def execute_command(command, options) end it "retrieves a PID from the process table" do + allow(Facter).to receive(:value).and_call_original allow(Facter).to receive(:value).with(:operatingsystem).and_return("CentOS") ps_output = File.binread(my_fixture("ps_ef.mixed_encoding")).force_encoding(Encoding::UTF_8) diff --git a/spec/unit/provider/service/launchd_spec.rb b/spec/unit/provider/service/launchd_spec.rb index eab8ed7eb45..b3e09dc60cd 100644 --- a/spec/unit/provider/service/launchd_spec.rb +++ b/spec/unit/provider/service/launchd_spec.rb @@ -16,6 +16,10 @@ `exit 0` end + after :each do + provider.instance_variable_set(:@job_list, nil) + end + describe "the type interface" do %w{ start stop enabled? enable disable status}.each do |method| it { is_expected.to respond_to method.to_sym } @@ -41,10 +45,6 @@ expect(provider.prefetch({}).last.status).to eq(:running) end - after :each do - provider.instance_variable_set(:@job_list, nil) - end - describe "when hasstatus is set to false" do before :each do resource[:hasstatus] = :false From ded52053a18f6b134c6f914f37a1a693bf005e35 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Tue, 27 Apr 2021 15:23:21 -0700 Subject: [PATCH 356/731] (PUP-11048) Remove unneeded 'exit 0' Since we're now longer using CHILD_STATUS, we don't need to execute `exit 0`. --- spec/unit/provider/package/pkg_spec.rb | 10 ---------- spec/unit/provider/service/base_spec.rb | 4 ---- spec/unit/provider/service/bsd_spec.rb | 4 ---- spec/unit/provider/service/debian_spec.rb | 4 ---- spec/unit/provider/service/gentoo_spec.rb | 4 ---- spec/unit/provider/service/init_spec.rb | 4 ---- spec/unit/provider/service/launchd_spec.rb | 4 ---- spec/unit/provider/service/openbsd_spec.rb | 9 --------- spec/unit/provider/service/openrc_spec.rb | 4 ---- spec/unit/provider/service/redhat_spec.rb | 9 --------- spec/unit/provider/service/smf_spec.rb | 4 ---- spec/unit/provider/service/src_spec.rb | 4 ---- spec/unit/provider/service/systemd_spec.rb | 9 --------- spec/unit/provider/service/upstart_spec.rb | 4 ---- 14 files changed, 77 deletions(-) diff --git a/spec/unit/provider/package/pkg_spec.rb b/spec/unit/provider/package/pkg_spec.rb index 5cf24f677fa..c706d61352d 100644 --- a/spec/unit/provider/package/pkg_spec.rb +++ b/spec/unit/provider/package/pkg_spec.rb @@ -4,16 +4,6 @@ let (:resource) { Puppet::Resource.new(:package, 'dummy', :parameters => {:name => 'dummy', :ensure => :latest}) } let (:provider) { described_class.new(resource) } - before(:all) do - if Puppet::Util::Platform.windows? - # Get a pid for $CHILD_STATUS to latch on to - command = "cmd.exe /c \"exit 0\"" - Puppet::Util::Execution.execute(command, {:failonfail => false}) - else - Puppet::Util::Execution.execute('exit 0', {:failonfail => false}) - end - end - before :each do allow(described_class).to receive(:command).with(:pkg).and_return('/bin/pkg') end diff --git a/spec/unit/provider/service/base_spec.rb b/spec/unit/provider/service/base_spec.rb index 90fbe60ced2..b7d2cfb6ed5 100644 --- a/spec/unit/provider/service/base_spec.rb +++ b/spec/unit/provider/service/base_spec.rb @@ -14,10 +14,6 @@ subject { provider } - before(:all) do - `exit 0` - end - context "basic operations" do subject do type.new( diff --git a/spec/unit/provider/service/bsd_spec.rb b/spec/unit/provider/service/bsd_spec.rb index 7f6236e36d8..73151fee853 100644 --- a/spec/unit/provider/service/bsd_spec.rb +++ b/spec/unit/provider/service/bsd_spec.rb @@ -4,10 +4,6 @@ unless: Puppet::Util::Platform.windows? || Puppet::Util::Platform.jruby? do let(:provider_class) { Puppet::Type.type(:service).provider(:bsd) } - before(:all) do - `exit 0` - end - before :each do allow(Puppet::Type.type(:service)).to receive(:defaultprovider).and_return(provider_class) allow(Facter).to receive(:value).with(:operatingsystem).and_return(:netbsd) diff --git a/spec/unit/provider/service/debian_spec.rb b/spec/unit/provider/service/debian_spec.rb index 2a46adcd22f..303850b3a46 100644 --- a/spec/unit/provider/service/debian_spec.rb +++ b/spec/unit/provider/service/debian_spec.rb @@ -4,10 +4,6 @@ unless: Puppet::Util::Platform.jruby? || Puppet::Util::Platform.windows? do let(:provider_class) { Puppet::Type.type(:service).provider(:debian) } - before(:all) do - `exit 0` - end - before(:each) do # Create a mock resource @resource = double('resource') diff --git a/spec/unit/provider/service/gentoo_spec.rb b/spec/unit/provider/service/gentoo_spec.rb index 4b6c19dc561..7bd783095ee 100644 --- a/spec/unit/provider/service/gentoo_spec.rb +++ b/spec/unit/provider/service/gentoo_spec.rb @@ -4,10 +4,6 @@ unless: Puppet::Util::Platform.windows? || Puppet::Util::Platform.jruby? do let(:provider_class) { Puppet::Type.type(:service).provider(:gentoo) } - before(:all) do - `exit 0` - end - before :each do allow(Puppet::Type.type(:service)).to receive(:defaultprovider).and_return(provider_class) allow(FileTest).to receive(:file?).with('/sbin/rc-update').and_return(true) diff --git a/spec/unit/provider/service/init_spec.rb b/spec/unit/provider/service/init_spec.rb index 157e9e80c0e..f44b60054b3 100644 --- a/spec/unit/provider/service/init_spec.rb +++ b/spec/unit/provider/service/init_spec.rb @@ -4,10 +4,6 @@ unless: Puppet::Util::Platform.windows? || Puppet::Util::Platform.jruby? do let(:provider_class) { Puppet::Type.type(:service).provider(:init) } - before :all do - `exit 0` - end - before do Puppet::Type.type(:service).defaultprovider = provider_class end diff --git a/spec/unit/provider/service/launchd_spec.rb b/spec/unit/provider/service/launchd_spec.rb index b3e09dc60cd..8624d8b179e 100644 --- a/spec/unit/provider/service/launchd_spec.rb +++ b/spec/unit/provider/service/launchd_spec.rb @@ -12,10 +12,6 @@ subject { resource.provider } - before :all do - `exit 0` - end - after :each do provider.instance_variable_set(:@job_list, nil) end diff --git a/spec/unit/provider/service/openbsd_spec.rb b/spec/unit/provider/service/openbsd_spec.rb index 775af1615b6..d4a91c89448 100644 --- a/spec/unit/provider/service/openbsd_spec.rb +++ b/spec/unit/provider/service/openbsd_spec.rb @@ -12,15 +12,6 @@ allow(FileTest).to receive(:executable?).with('/usr/sbin/rcctl').and_return(true) end - # `execute` and `texecute` start a new process, consequently setting $CHILD_STATUS to a Process::Status instance, - # but because they are mocked, an external process is never executed and $CHILD_STATUS remain nil. - # In order to execute some parts of the code under test and to mock $CHILD_STATUS, we need this variable to be a - # Process::Status instance. We can achieve this by starting a process that does nothing (exit 0). By doing this, - # $CHILD_STATUS will be initialised with a instance of Process::Status and we will be able to mock it. - before(:all) do - `exit 0` - end - context "#instances" do it "should have an instances method" do expect(provider_class).to respond_to :instances diff --git a/spec/unit/provider/service/openrc_spec.rb b/spec/unit/provider/service/openrc_spec.rb index 829190bf941..b056a9ae86d 100644 --- a/spec/unit/provider/service/openrc_spec.rb +++ b/spec/unit/provider/service/openrc_spec.rb @@ -4,10 +4,6 @@ unless: Puppet::Util::Platform.windows? || Puppet::Util::Platform.jruby? do let(:provider_class) { Puppet::Type.type(:service).provider(:openrc) } - before :all do - `exit 0` - end - before :each do allow(Puppet::Type.type(:service)).to receive(:defaultprovider).and_return(provider_class) ['/sbin/rc-service', '/bin/rc-status', '/sbin/rc-update'].each do |command| diff --git a/spec/unit/provider/service/redhat_spec.rb b/spec/unit/provider/service/redhat_spec.rb index cb89c538746..ff292189139 100644 --- a/spec/unit/provider/service/redhat_spec.rb +++ b/spec/unit/provider/service/redhat_spec.rb @@ -4,15 +4,6 @@ unless: Puppet::Util::Platform.windows? || Puppet::Util::Platform.jruby? do let(:provider_class) { Puppet::Type.type(:service).provider(:redhat) } - # `execute` and `texecute` start a new process, consequently setting $CHILD_STATUS to a Process::Status instance, - # but because they are mocked, an external process is never executed and $CHILD_STATUS remain nil. - # In order to execute some parts of the code under test and to mock $CHILD_STATUS, we need this variable to be a - # Process::Status instance. We can achieve this by starting a process that does nothing (exit 0). By doing this, - # $CHILD_STATUS will be initialised with a instance of Process::Status and we will be able to mock it. - before(:all) do - `exit 0` - end - before :each do @class = Puppet::Type.type(:service).provider(:redhat) @resource = double('resource') diff --git a/spec/unit/provider/service/smf_spec.rb b/spec/unit/provider/service/smf_spec.rb index 8253fe3f9e4..753c3cffffd 100644 --- a/spec/unit/provider/service/smf_spec.rb +++ b/spec/unit/provider/service/smf_spec.rb @@ -4,10 +4,6 @@ unless: Puppet::Util::Platform.windows? || Puppet::Util::Platform.jruby? do let(:provider_class) { Puppet::Type.type(:service).provider(:smf) } - before(:all) do - `exit 0` - end - def set_resource_params(params = {}) params.each do |param, value| if value.nil? diff --git a/spec/unit/provider/service/src_spec.rb b/spec/unit/provider/service/src_spec.rb index cf5ebe5466e..1f71f512cbe 100644 --- a/spec/unit/provider/service/src_spec.rb +++ b/spec/unit/provider/service/src_spec.rb @@ -4,10 +4,6 @@ unless: Puppet::Util::Platform.windows? || Puppet::Util::Platform.jruby? do let(:provider_class) { Puppet::Type.type(:service).provider(:src) } - before :all do - `exit 0` - end - before :each do @resource = double('resource') allow(@resource).to receive(:[]).and_return(nil) diff --git a/spec/unit/provider/service/systemd_spec.rb b/spec/unit/provider/service/systemd_spec.rb index 92ed8352c57..886254b269a 100644 --- a/spec/unit/provider/service/systemd_spec.rb +++ b/spec/unit/provider/service/systemd_spec.rb @@ -10,15 +10,6 @@ allow(provider_class).to receive(:which).with('systemctl').and_return('/bin/systemctl') end - # `execute` and `texecute` start a new process, consequently setting $CHILD_STATUS to a Process::Status instance, - # but because they are mocked, an external process is never executed and $CHILD_STATUS remain nil. - # In order to execute some parts of the code under test and to mock $CHILD_STATUS, we need this variable to be a - # Process::Status instance. We can achieve this by starting a process that does nothing (exit 0). By doing this, - # $CHILD_STATUS will be initialised with a instance of Process::Status and we will be able to mock it. - before(:all) do - `exit 0` - end - let :provider do provider_class.new(:name => 'sshd.service') end diff --git a/spec/unit/provider/service/upstart_spec.rb b/spec/unit/provider/service/upstart_spec.rb index 6e2466860ea..b9093dd0370 100644 --- a/spec/unit/provider/service/upstart_spec.rb +++ b/spec/unit/provider/service/upstart_spec.rb @@ -7,10 +7,6 @@ let!(:provider_class) { Puppet::Type.type(:service).provider(:upstart) } let(:process_output) { Puppet::Util::Execution::ProcessOutput.new('', 0) } - before :each do - `exit 0` - end - def given_contents_of(file, content) File.open(file, 'w') do |f| f.write(content) From 6320a48883b7e058586304fa72d635ec55694a74 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Tue, 27 Apr 2021 18:48:10 -0700 Subject: [PATCH 357/731] (PUP-11048) Remove executable bit --- lib/puppet/provider/package/puppetserver_gem.rb | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 lib/puppet/provider/package/puppetserver_gem.rb diff --git a/lib/puppet/provider/package/puppetserver_gem.rb b/lib/puppet/provider/package/puppetserver_gem.rb old mode 100755 new mode 100644 From 532ccd5e2592500bb782bfda2fcd4c4cb5a4193d Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Tue, 27 Apr 2021 21:20:39 -0700 Subject: [PATCH 358/731] (PUP-11048) Clear/restore provider defaults global state These tests had order dependent failures because the provider's class variables @defaults and @notdefaults used to determine specificity are not cleared and restored between tests, causing order dependent test failures if the `defaultfor` case is run before the `notdefaultfor` case. This adds a shared context to do that. --- spec/shared_contexts/provider.rb | 16 ++++++++++++++++ spec/unit/provider/package/gem_spec.rb | 4 +++- spec/unit/provider/package/pip2_spec.rb | 4 +++- spec/unit/provider/package/pip3_spec.rb | 4 +++- spec/unit/provider/package/pip_spec.rb | 4 +++- spec/unit/provider/package/puppet_gem_spec.rb | 4 +++- .../provider/package/puppetserver_gem_spec.rb | 2 ++ 7 files changed, 33 insertions(+), 5 deletions(-) create mode 100644 spec/shared_contexts/provider.rb diff --git a/spec/shared_contexts/provider.rb b/spec/shared_contexts/provider.rb new file mode 100644 index 00000000000..eb1748392e2 --- /dev/null +++ b/spec/shared_contexts/provider.rb @@ -0,0 +1,16 @@ +require 'spec_helper' + +RSpec.shared_context('provider specificity') do + around do |example| + old_defaults = described_class.instance_variable_get(:@defaults) + old_notdefaults = described_class.instance_variable_get(:@notdefaults) + begin + described_class.instance_variable_set(:@defaults, []) + described_class.instance_variable_set(:@notdefaults, []) + example.run + ensure + described_class.instance_variable_set(:@defaults, old_defaults) + described_class.instance_variable_set(:@notdefaults, old_notdefaults) + end + end +end diff --git a/spec/unit/provider/package/gem_spec.rb b/spec/unit/provider/package/gem_spec.rb index ca814cd97d5..3bcb0da705f 100644 --- a/spec/unit/provider/package/gem_spec.rb +++ b/spec/unit/provider/package/gem_spec.rb @@ -468,13 +468,15 @@ end context 'calculated specificity' do + include_context 'provider specificity' + context 'when is not defaultfor' do subject { described_class.specificity } it { is_expected.to eql 1 } end context 'when is defaultfor' do - let(:os) { Facter.value(:operatingsystem) } + let(:os) { Facter.value(:operatingsystem) } subject do described_class.defaultfor(operatingsystem: os) described_class.specificity diff --git a/spec/unit/provider/package/pip2_spec.rb b/spec/unit/provider/package/pip2_spec.rb index 161bdd0b5ae..209a5ecf1f6 100644 --- a/spec/unit/provider/package/pip2_spec.rb +++ b/spec/unit/provider/package/pip2_spec.rb @@ -18,13 +18,15 @@ end context 'calculated specificity' do + include_context 'provider specificity' + context 'when is not defaultfor' do subject { described_class.specificity } it { is_expected.to eql 1 } end context 'when is defaultfor' do - let(:os) { Facter.value(:operatingsystem) } + let(:os) { Facter.value(:operatingsystem) } subject do described_class.defaultfor(operatingsystem: os) described_class.specificity diff --git a/spec/unit/provider/package/pip3_spec.rb b/spec/unit/provider/package/pip3_spec.rb index 5d6ecf0ec34..5fa54fdcd7e 100644 --- a/spec/unit/provider/package/pip3_spec.rb +++ b/spec/unit/provider/package/pip3_spec.rb @@ -18,13 +18,15 @@ end context 'calculated specificity' do + include_context 'provider specificity' + context 'when is not defaultfor' do subject { described_class.specificity } it { is_expected.to eql 1 } end context 'when is defaultfor' do - let(:os) { Facter.value(:operatingsystem) } + let(:os) { Facter.value(:operatingsystem) } subject do described_class.defaultfor(operatingsystem: os) described_class.specificity diff --git a/spec/unit/provider/package/pip_spec.rb b/spec/unit/provider/package/pip_spec.rb index e0072ae1361..773c9ec8d1f 100644 --- a/spec/unit/provider/package/pip_spec.rb +++ b/spec/unit/provider/package/pip_spec.rb @@ -448,13 +448,15 @@ end context 'calculated specificity' do + include_context 'provider specificity' + context 'when is not defaultfor' do subject { described_class.specificity } it { is_expected.to eql 1 } end context 'when is defaultfor' do - let(:os) { Facter.value(:operatingsystem) } + let(:os) { Facter.value(:operatingsystem) } subject do described_class.defaultfor(operatingsystem: os) described_class.specificity diff --git a/spec/unit/provider/package/puppet_gem_spec.rb b/spec/unit/provider/package/puppet_gem_spec.rb index 3553c1cf2ac..76a59b4f55f 100644 --- a/spec/unit/provider/package/puppet_gem_spec.rb +++ b/spec/unit/provider/package/puppet_gem_spec.rb @@ -110,13 +110,15 @@ end context 'calculated specificity' do + include_context 'provider specificity' + context 'when is not defaultfor' do subject { described_class.specificity } it { is_expected.to eql 1 } end context 'when is defaultfor' do - let(:os) { Facter.value(:operatingsystem) } + let(:os) { Facter.value(:operatingsystem) } subject do described_class.defaultfor(operatingsystem: os) described_class.specificity diff --git a/spec/unit/provider/package/puppetserver_gem_spec.rb b/spec/unit/provider/package/puppetserver_gem_spec.rb index e3cca15dadd..550ca254632 100644 --- a/spec/unit/provider/package/puppetserver_gem_spec.rb +++ b/spec/unit/provider/package/puppetserver_gem_spec.rb @@ -119,6 +119,8 @@ end context 'calculated specificity' do + include_context 'provider specificity' + context 'when is not defaultfor' do subject { described_class.specificity } it { is_expected.to eql 1 } From 99160d01105a47ecfa65ca5586b0d2a8b6f294bd Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Fri, 30 Apr 2021 13:29:20 +0200 Subject: [PATCH 359/731] (PUP-11050) Use keyword arguments for FileUtils This is the correct way to pass additional arguments in Ruby 3 and also works in Ruby 2.4. --- install.rb | 22 +++++++++++----------- spec/integration/type/file_spec.rb | 10 +++++----- spec/lib/puppet_spec/files.rb | 2 +- spec/unit/file_bucket/dipper_spec.rb | 2 +- spec/unit/pops/lookup/context_spec.rb | 2 +- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/install.rb b/install.rb index 5d8c2e9952b..869c33a2af1 100755 --- a/install.rb +++ b/install.rb @@ -60,7 +60,7 @@ def do_configs(configs, target, strip = 'conf/') Dir.mkdir(target) unless File.directory? target configs.each do |cf| ocf = File.join(InstallOptions.config_dir, cf.gsub(/#{strip}/, '')) - FileUtils.install(cf, ocf, {:mode => 0644, :preserve => true, :verbose => true}) + FileUtils.install(cf, ocf, mode: 0644, preserve: true, verbose: true) end end @@ -77,9 +77,9 @@ def do_libs(libs, strip = 'lib/') next if File.directory? lf olf = File.join(InstallOptions.site_dir, lf.sub(/^#{strip}/, '')) op = File.dirname(olf) - FileUtils.makedirs(op, {:mode => 0755, :verbose => true}) + FileUtils.makedirs(op, mode: 0755, verbose: true) FileUtils.chmod(0755, op) - FileUtils.install(lf, olf, {:mode => 0644, :preserve => true, :verbose => true}) + FileUtils.install(lf, olf, mode: 0644, preserve: true, verbose: true) end end @@ -87,9 +87,9 @@ def do_man(man, strip = 'man/') man.each do |mf| omf = File.join(InstallOptions.man_dir, mf.gsub(/#{strip}/, '')) om = File.dirname(omf) - FileUtils.makedirs(om, {:mode => 0755, :verbose => true}) + FileUtils.makedirs(om, mode: 0755, verbose: true) FileUtils.chmod(0755, om) - FileUtils.install(mf, omf, {:mode => 0644, :preserve => true, :verbose => true}) + FileUtils.install(mf, omf, mode: 0644, preserve: true, verbose: true) # Solaris does not support gzipped man pages. When called with # --no-check-prereqs/without facter the default gzip behavior still applies unless $operatingsystem == "Solaris" @@ -105,9 +105,9 @@ def do_locales(locale, strip = 'locales/') next if File.directory? lf olf = File.join(InstallOptions.locale_dir, lf.sub(/^#{strip}/, '')) op = File.dirname(olf) - FileUtils.makedirs(op, {:mode => 0755, :verbose => true}) + FileUtils.makedirs(op, mode: 0755, verbose: true) FileUtils.chmod(0755, op) - FileUtils.install(lf, olf, {:mode => 0644, :preserve => true, :verbose => true}) + FileUtils.install(lf, olf, mode: 0644, preserve: true, verbose: true) end end @@ -443,12 +443,12 @@ def install_binfile(from, op_file, target) unless File.extname(from) =~ /\.(cmd|bat)/ if File.exist?("#{from}.bat") - FileUtils.install("#{from}.bat", File.join(target, "#{op_file}.bat"), :mode => 0755, :preserve => true, :verbose => true) + FileUtils.install("#{from}.bat", File.join(target, "#{op_file}.bat"), mode: 0755, preserve: true, verbose: true) installed_wrapper = true end if File.exist?("#{from}.cmd") - FileUtils.install("#{from}.cmd", File.join(target, "#{op_file}.cmd"), :mode => 0755, :preserve => true, :verbose => true) + FileUtils.install("#{from}.cmd", File.join(target, "#{op_file}.cmd"), mode: 0755, preserve: true, verbose: true) installed_wrapper = true end @@ -465,13 +465,13 @@ def install_binfile(from, op_file, target) ruby.exe -S -- puppet %* EOS File.open(tmp_file2.path, "w") { |cw| cw.puts cwv } - FileUtils.install(tmp_file2.path, File.join(target, "#{op_file}.bat"), :mode => 0755, :preserve => true, :verbose => true) + FileUtils.install(tmp_file2.path, File.join(target, "#{op_file}.bat"), mode: 0755, preserve: true, verbose: true) tmp_file2.unlink end end end - FileUtils.install(tmp_file.path, File.join(target, op_file), :mode => 0755, :preserve => true, :verbose => true) + FileUtils.install(tmp_file.path, File.join(target, op_file), mode: 0755, preserve: true, verbose: true) tmp_file.unlink end diff --git a/spec/integration/type/file_spec.rb b/spec/integration/type/file_spec.rb index 34f3b1e91a1..652cd21de4b 100644 --- a/spec/integration/type/file_spec.rb +++ b/spec/integration/type/file_spec.rb @@ -895,7 +895,7 @@ def build_path(dir) # Change the source file. File.open(checksum_file, "wb") { |f| f.write "some content" } - FileUtils.touch target_file, :mtime => Time.now - 20 + FileUtils.touch target_file, mtime: Time.now - 20 # The 2nd time should update the resource. second_catalog.add_resource Puppet::Type.send(:newfile, @options) @@ -1399,7 +1399,7 @@ def build_path(dir) it "should fetch if no header specified" do File.open(httppath, "wb") { |f| f.puts "Content originally on disk\n" } # make sure the mtime is not "right now", lest we get a race - FileUtils.touch httppath, :mtime => Time.parse("Sun, 22 Mar 2015 22:57:43 GMT") + FileUtils.touch httppath, mtime: Time.parse("Sun, 22 Mar 2015 22:57:43 GMT") catalog.add_resource resource catalog.apply expect(Puppet::FileSystem.exist?(httppath)).to be_truthy @@ -1409,7 +1409,7 @@ def build_path(dir) it "should fetch if mtime is older on disk" do File.open(httppath, "wb") { |f| f.puts "Content originally on disk\n" } # fixture has Last-Modified: Sun, 22 Mar 2015 22:25:34 GMT - FileUtils.touch httppath, :mtime => Time.parse("Sun, 22 Mar 2015 22:22:34 GMT") + FileUtils.touch httppath, mtime: Time.parse("Sun, 22 Mar 2015 22:22:34 GMT") catalog.add_resource resource catalog.apply expect(Puppet::FileSystem.exist?(httppath)).to be_truthy @@ -1455,7 +1455,7 @@ def build_path(dir) it "should not update if content on disk is up-to-date" do File.open(httppath, "wb") { |f| f.puts "Content via HTTP\n" } disk_mtime = Time.parse("Sun, 22 Mar 2015 22:22:34 GMT") - FileUtils.touch httppath, :mtime => disk_mtime + FileUtils.touch httppath, mtime: disk_mtime catalog.add_resource resource catalog.apply expect(Puppet::FileSystem.exist?(httppath)).to be_truthy @@ -2002,7 +2002,7 @@ def verify_file(transaction) it "should not update mtime on an old directory" do disk_mtime = Time.parse("Sun, 22 Mar 2015 22:22:34 GMT") FileUtils.mkdir_p path - FileUtils.touch path, :mtime => disk_mtime + FileUtils.touch path, mtime: disk_mtime status = catalog.apply.report.resource_statuses["File[#{path}]"] expect(status).to be_nil expect(Puppet::FileSystem).to be_directory(path) diff --git a/spec/lib/puppet_spec/files.rb b/spec/lib/puppet_spec/files.rb index 32bba810b6d..fc589e25deb 100644 --- a/spec/lib/puppet_spec/files.rb +++ b/spec/lib/puppet_spec/files.rb @@ -9,7 +9,7 @@ def self.cleanup $global_tempfiles ||= [] while path = $global_tempfiles.pop do begin - FileUtils.rm_rf path, :secure => true + FileUtils.rm_rf path, secure: true rescue Errno::ENOENT # nothing to do end diff --git a/spec/unit/file_bucket/dipper_spec.rb b/spec/unit/file_bucket/dipper_spec.rb index 584d7dc2bd6..755a0db3232 100644 --- a/spec/unit/file_bucket/dipper_spec.rb +++ b/spec/unit/file_bucket/dipper_spec.rb @@ -225,7 +225,7 @@ def make_tmp_file(contents) # Modify mtime of the second file to be an hour ago onehourago = Time.now - onehour bucketed_paths_file = Dir.glob("#{file_bucket}/**/#{checksum}/paths") - FileUtils.touch(bucketed_paths_file, :mtime => onehourago) + FileUtils.touch(bucketed_paths_file, mtime: onehourago) expected_list2 = /#{checksum} \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} #{real_path}\n/ now = Time.now diff --git a/spec/unit/pops/lookup/context_spec.rb b/spec/unit/pops/lookup/context_spec.rb index 1103f7ab659..426cb21e2f7 100644 --- a/spec/unit/pops/lookup/context_spec.rb +++ b/spec/unit/pops/lookup/context_spec.rb @@ -243,7 +243,7 @@ module Lookup File.write(data_path, "a: value b\n") # Ensure mtime is at least 1 second ahead - FileUtils.touch(data_path, :mtime => old_mtime + 1) + FileUtils.touch(data_path, mtime: old_mtime + 1) Puppet::Parser::Compiler.compile(node) end From 3d4da684efb9da5a6e4cf00eadfe0c298bb8772e Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Tue, 4 May 2021 20:09:21 +0000 Subject: [PATCH 360/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 2 +- man/man8/puppet-agent.8 | 2 +- man/man8/puppet-apply.8 | 2 +- man/man8/puppet-catalog.8 | 2 +- man/man8/puppet-config.8 | 2 +- man/man8/puppet-describe.8 | 2 +- man/man8/puppet-device.8 | 2 +- man/man8/puppet-doc.8 | 2 +- man/man8/puppet-epp.8 | 2 +- man/man8/puppet-facts.8 | 2 +- man/man8/puppet-filebucket.8 | 2 +- man/man8/puppet-generate.8 | 2 +- man/man8/puppet-help.8 | 2 +- man/man8/puppet-lookup.8 | 2 +- man/man8/puppet-module.8 | 2 +- man/man8/puppet-node.8 | 2 +- man/man8/puppet-parser.8 | 2 +- man/man8/puppet-plugin.8 | 2 +- man/man8/puppet-report.8 | 2 +- man/man8/puppet-resource.8 | 2 +- man/man8/puppet-script.8 | 2 +- man/man8/puppet-ssl.8 | 2 +- man/man8/puppet.8 | 2 +- 23 files changed, 23 insertions(+), 23 deletions(-) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index 0848abfbbc4..018960d262c 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPETCONF" "5" "April 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPETCONF" "5" "May 2021" "Puppet, Inc." "Puppet manual" \fBThis page is autogenerated; any changes will get overwritten\fR . .SH "Configuration settings" diff --git a/man/man8/puppet-agent.8 b/man/man8/puppet-agent.8 index d3e3e132e9a..edfe3ee0e62 100644 --- a/man/man8/puppet-agent.8 +++ b/man/man8/puppet-agent.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-AGENT" "8" "April 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-AGENT" "8" "May 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-agent\fR \- The puppet agent daemon diff --git a/man/man8/puppet-apply.8 b/man/man8/puppet-apply.8 index b3b2fe10c26..fe405ee56eb 100644 --- a/man/man8/puppet-apply.8 +++ b/man/man8/puppet-apply.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-APPLY" "8" "April 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-APPLY" "8" "May 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-apply\fR \- Apply Puppet manifests locally diff --git a/man/man8/puppet-catalog.8 b/man/man8/puppet-catalog.8 index 36e92fd7f6c..8ca781fa6b9 100644 --- a/man/man8/puppet-catalog.8 +++ b/man/man8/puppet-catalog.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-CATALOG" "8" "April 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-CATALOG" "8" "May 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-catalog\fR \- Compile, save, view, and convert catalogs\. diff --git a/man/man8/puppet-config.8 b/man/man8/puppet-config.8 index 8edfefd8aea..1c9b3caaaf3 100644 --- a/man/man8/puppet-config.8 +++ b/man/man8/puppet-config.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-CONFIG" "8" "April 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-CONFIG" "8" "May 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-config\fR \- Interact with Puppet\'s settings\. diff --git a/man/man8/puppet-describe.8 b/man/man8/puppet-describe.8 index 4e1e1f083ab..8f84e924f36 100644 --- a/man/man8/puppet-describe.8 +++ b/man/man8/puppet-describe.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-DESCRIBE" "8" "April 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-DESCRIBE" "8" "May 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-describe\fR \- Display help about resource types diff --git a/man/man8/puppet-device.8 b/man/man8/puppet-device.8 index c49f8ecf6ad..0f0fb868906 100644 --- a/man/man8/puppet-device.8 +++ b/man/man8/puppet-device.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-DEVICE" "8" "April 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-DEVICE" "8" "May 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-device\fR \- Manage remote network devices diff --git a/man/man8/puppet-doc.8 b/man/man8/puppet-doc.8 index 57b607c2a5f..1a5598f6ade 100644 --- a/man/man8/puppet-doc.8 +++ b/man/man8/puppet-doc.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-DOC" "8" "April 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-DOC" "8" "May 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-doc\fR \- Generate Puppet references diff --git a/man/man8/puppet-epp.8 b/man/man8/puppet-epp.8 index 12e9e2a60f3..451b6db6a0d 100644 --- a/man/man8/puppet-epp.8 +++ b/man/man8/puppet-epp.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-EPP" "8" "April 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-EPP" "8" "May 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-epp\fR \- Interact directly with the EPP template parser/renderer\. diff --git a/man/man8/puppet-facts.8 b/man/man8/puppet-facts.8 index 6e46902301f..e48d30c506b 100644 --- a/man/man8/puppet-facts.8 +++ b/man/man8/puppet-facts.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-FACTS" "8" "April 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-FACTS" "8" "May 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-facts\fR \- Retrieve and store facts\. diff --git a/man/man8/puppet-filebucket.8 b/man/man8/puppet-filebucket.8 index b7b32160f8f..a4b699a7fb5 100644 --- a/man/man8/puppet-filebucket.8 +++ b/man/man8/puppet-filebucket.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-FILEBUCKET" "8" "April 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-FILEBUCKET" "8" "May 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-filebucket\fR \- Store and retrieve files in a filebucket diff --git a/man/man8/puppet-generate.8 b/man/man8/puppet-generate.8 index 02b74c6e01a..bbc3f89e95c 100644 --- a/man/man8/puppet-generate.8 +++ b/man/man8/puppet-generate.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-GENERATE" "8" "April 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-GENERATE" "8" "May 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-generate\fR \- Generates Puppet code from Ruby definitions\. diff --git a/man/man8/puppet-help.8 b/man/man8/puppet-help.8 index bab2feb3162..b35c5ee48a3 100644 --- a/man/man8/puppet-help.8 +++ b/man/man8/puppet-help.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-HELP" "8" "April 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-HELP" "8" "May 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-help\fR \- Display Puppet help\. diff --git a/man/man8/puppet-lookup.8 b/man/man8/puppet-lookup.8 index 883110553be..37128c663de 100644 --- a/man/man8/puppet-lookup.8 +++ b/man/man8/puppet-lookup.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-LOOKUP" "8" "April 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-LOOKUP" "8" "May 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-lookup\fR \- Interactive Hiera lookup diff --git a/man/man8/puppet-module.8 b/man/man8/puppet-module.8 index a0075386332..90d0c11daa4 100644 --- a/man/man8/puppet-module.8 +++ b/man/man8/puppet-module.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-MODULE" "8" "April 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-MODULE" "8" "May 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-module\fR \- Creates, installs and searches for modules on the Puppet Forge\. diff --git a/man/man8/puppet-node.8 b/man/man8/puppet-node.8 index 3982cfbd021..85f859730f2 100644 --- a/man/man8/puppet-node.8 +++ b/man/man8/puppet-node.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-NODE" "8" "April 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-NODE" "8" "May 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-node\fR \- View and manage node definitions\. diff --git a/man/man8/puppet-parser.8 b/man/man8/puppet-parser.8 index 2e02705187b..2d563f6b57b 100644 --- a/man/man8/puppet-parser.8 +++ b/man/man8/puppet-parser.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-PARSER" "8" "April 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-PARSER" "8" "May 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-parser\fR \- Interact directly with the parser\. diff --git a/man/man8/puppet-plugin.8 b/man/man8/puppet-plugin.8 index 7ea1afd69ff..467432bfab9 100644 --- a/man/man8/puppet-plugin.8 +++ b/man/man8/puppet-plugin.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-PLUGIN" "8" "April 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-PLUGIN" "8" "May 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-plugin\fR \- Interact with the Puppet plugin system\. diff --git a/man/man8/puppet-report.8 b/man/man8/puppet-report.8 index ee2dbf2316a..ad9690f003c 100644 --- a/man/man8/puppet-report.8 +++ b/man/man8/puppet-report.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-REPORT" "8" "April 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-REPORT" "8" "May 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-report\fR \- Create, display, and submit reports\. diff --git a/man/man8/puppet-resource.8 b/man/man8/puppet-resource.8 index aa9c7635b1b..7b065f5b66b 100644 --- a/man/man8/puppet-resource.8 +++ b/man/man8/puppet-resource.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-RESOURCE" "8" "April 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-RESOURCE" "8" "May 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-resource\fR \- The resource abstraction layer shell diff --git a/man/man8/puppet-script.8 b/man/man8/puppet-script.8 index dc39870aa4c..1bf11d42838 100644 --- a/man/man8/puppet-script.8 +++ b/man/man8/puppet-script.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-SCRIPT" "8" "April 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-SCRIPT" "8" "May 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-script\fR \- Run a puppet manifests as a script without compiling a catalog diff --git a/man/man8/puppet-ssl.8 b/man/man8/puppet-ssl.8 index 34426de34a6..031c94b4163 100644 --- a/man/man8/puppet-ssl.8 +++ b/man/man8/puppet-ssl.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-SSL" "8" "April 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-SSL" "8" "May 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-ssl\fR \- Manage SSL keys and certificates for puppet SSL clients diff --git a/man/man8/puppet.8 b/man/man8/puppet.8 index f6240747f7d..30c6ed5902f 100644 --- a/man/man8/puppet.8 +++ b/man/man8/puppet.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET" "8" "April 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET" "8" "May 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\fR From 4142539019233df8a4c2d95fa1c6b41ab338535a Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Wed, 5 May 2021 08:07:43 +0000 Subject: [PATCH 361/731] (packaging) Updating the puppet.pot file --- locales/puppet.pot | 110 ++++++++++++++++++++++++--------------------- 1 file changed, 59 insertions(+), 51 deletions(-) diff --git a/locales/puppet.pot b/locales/puppet.pot index 54d8fb1f47d..d4bf225d79c 100644 --- a/locales/puppet.pot +++ b/locales/puppet.pot @@ -6,11 +6,11 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Puppet automation framework 7.6.1-42-gfd6f890632\n" +"Project-Id-Version: Puppet automation framework 7.6.1-59-g0ccaccd84e\n" "\n" "Report-Msgid-Bugs-To: https://tickets.puppetlabs.com\n" -"POT-Creation-Date: 2021-04-27 09:22+0000\n" -"PO-Revision-Date: 2021-04-27 09:22+0000\n" +"POT-Creation-Date: 2021-05-05 08:07+0000\n" +"PO-Revision-Date: 2021-05-05 08:07+0000\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -1641,21 +1641,29 @@ msgstr "" msgid "Fileset paths must be fully qualified: %{path}" msgstr "" -#: ../lib/puppet/file_serving/fileset.rb:50 +#: ../lib/puppet/file_serving/fileset.rb:51 msgid "Fileset paths must exist" msgstr "" #. TRANSLATORS "recurse" and "recurselimit" are parameter names and should not be translated -#: ../lib/puppet/file_serving/fileset.rb:52 +#: ../lib/puppet/file_serving/fileset.rb:53 msgid "Fileset recurse parameter must not be a number anymore, please use recurselimit" msgstr "" +#: ../lib/puppet/file_serving/fileset.rb:65 +msgid "The directory '%{path}' contains %{entries} entries, which exceeds the limit of %{max_files} specified by the max_files parameter for this resource. The limit may be increased, but be aware that large number of file resources can result in excessive resource consumption and degraded performance. Consider using an alternate method to manage large directory trees" +msgstr "" + +#: ../lib/puppet/file_serving/fileset.rb:67 +msgid "The directory '%{path}' contains %{entries} entries, which exceeds the default soft limit %{max_files} and may cause excessive resource consumption and degraded performance. To remove this warning set a value for `max_files` parameter or consider using an alternate method to manage large directory trees" +msgstr "" + #. TRANSLATORS ":links" is a parameter name and should not be translated -#: ../lib/puppet/file_serving/fileset.rb:80 +#: ../lib/puppet/file_serving/fileset.rb:88 msgid "Invalid :links value '%{links}'" msgstr "" -#: ../lib/puppet/file_serving/fileset.rb:93 +#: ../lib/puppet/file_serving/fileset.rb:101 msgid "Invalid option '%{option}'" msgstr "" @@ -2309,87 +2317,87 @@ msgstr "" msgid "Inlining file metadata" msgstr "" -#: ../lib/puppet/indirector/catalog/compiler.rb:259 +#: ../lib/puppet/indirector/catalog/compiler.rb:260 msgid "Could not get metadata for %{resource}" msgstr "" -#: ../lib/puppet/indirector/catalog/compiler.rb:280 +#: ../lib/puppet/indirector/catalog/compiler.rb:281 msgid "Unable to find a common checksum type between agent '%{agent_type}' and master '%{master_type}'." msgstr "" -#: ../lib/puppet/indirector/catalog/compiler.rb:287 +#: ../lib/puppet/indirector/catalog/compiler.rb:288 msgid "Compiled static catalog for %{node} in environment %{environment} in %%{seconds} seconds" msgstr "" -#: ../lib/puppet/indirector/catalog/compiler.rb:288 +#: ../lib/puppet/indirector/catalog/compiler.rb:289 msgid "Compiled static catalog for %{node} in environment %{environment}" msgstr "" -#: ../lib/puppet/indirector/catalog/compiler.rb:290 +#: ../lib/puppet/indirector/catalog/compiler.rb:291 msgid "Compiled static catalog for %{node} in %%{seconds} seconds" msgstr "" -#: ../lib/puppet/indirector/catalog/compiler.rb:291 +#: ../lib/puppet/indirector/catalog/compiler.rb:292 msgid "Compiled static catalog for %{node}" msgstr "" -#: ../lib/puppet/indirector/catalog/compiler.rb:296 +#: ../lib/puppet/indirector/catalog/compiler.rb:297 msgid "Compiled catalog for %{node} in environment %{environment} in %%{seconds} seconds" msgstr "" -#: ../lib/puppet/indirector/catalog/compiler.rb:297 +#: ../lib/puppet/indirector/catalog/compiler.rb:298 msgid "Compiled catalog for %{node} in environment %{environment}" msgstr "" -#: ../lib/puppet/indirector/catalog/compiler.rb:299 +#: ../lib/puppet/indirector/catalog/compiler.rb:300 msgid "Compiled catalog for %{node} in %%{seconds} seconds" msgstr "" -#: ../lib/puppet/indirector/catalog/compiler.rb:300 +#: ../lib/puppet/indirector/catalog/compiler.rb:301 msgid "Compiled catalog for %{node}" msgstr "" #. TRANSLATORS Inlined refers to adding additional metadata -#: ../lib/puppet/indirector/catalog/compiler.rb:322 +#: ../lib/puppet/indirector/catalog/compiler.rb:323 msgid "Inlined resource metadata into static catalog for %{node} in environment %{environment} in %%{seconds} seconds" msgstr "" #. TRANSLATORS Inlined refers to adding additional metadata -#: ../lib/puppet/indirector/catalog/compiler.rb:324 +#: ../lib/puppet/indirector/catalog/compiler.rb:325 msgid "Inlined resource metadata into static catalog for %{node} in environment %{environment}" msgstr "" #. TRANSLATORS Inlined refers to adding additional metadata -#: ../lib/puppet/indirector/catalog/compiler.rb:327 +#: ../lib/puppet/indirector/catalog/compiler.rb:328 msgid "Inlined resource metadata into static catalog for %{node} in %%{seconds} seconds" msgstr "" #. TRANSLATORS Inlined refers to adding additional metadata -#: ../lib/puppet/indirector/catalog/compiler.rb:329 +#: ../lib/puppet/indirector/catalog/compiler.rb:330 msgid "Inlined resource metadata into static catalog for %{node}" msgstr "" -#: ../lib/puppet/indirector/catalog/compiler.rb:346 +#: ../lib/puppet/indirector/catalog/compiler.rb:347 msgid "Found node information" msgstr "" -#: ../lib/puppet/indirector/catalog/compiler.rb:354 +#: ../lib/puppet/indirector/catalog/compiler.rb:355 msgid "Failed when searching for node %{name}: %{detail}" msgstr "" -#: ../lib/puppet/indirector/catalog/compiler.rb:374 +#: ../lib/puppet/indirector/catalog/compiler.rb:375 msgid "Invalid option use_node for a remote request" msgstr "" -#: ../lib/puppet/indirector/catalog/compiler.rb:393 +#: ../lib/puppet/indirector/catalog/compiler.rb:394 msgid "Could not find node '%{name}'; cannot compile" msgstr "" -#: ../lib/puppet/indirector/catalog/compiler.rb:426 +#: ../lib/puppet/indirector/catalog/compiler.rb:427 msgid "Could not retrieve fact servername" msgstr "" -#: ../lib/puppet/indirector/catalog/compiler.rb:435 +#: ../lib/puppet/indirector/catalog/compiler.rb:436 msgid "Could not retrieve either serverip or serverip6 fact" msgstr "" @@ -8009,74 +8017,74 @@ msgstr "" msgid "Invalid recurselimit value %{value}" msgstr "" -#: ../lib/puppet/type/file.rb:416 +#: ../lib/puppet/type/file.rb:432 msgid "You cannot specify more than one of %{creators}" msgstr "" -#: ../lib/puppet/type/file.rb:418 +#: ../lib/puppet/type/file.rb:434 msgid "You cannot specify a remote recursion without a source" msgstr "" -#: ../lib/puppet/type/file.rb:420 +#: ../lib/puppet/type/file.rb:436 msgid "You cannot specify source when using checksum 'none'" msgstr "" -#: ../lib/puppet/type/file.rb:423 +#: ../lib/puppet/type/file.rb:439 msgid "You cannot specify content when using checksum '%{checksum_type}'" msgstr "" -#: ../lib/puppet/type/file.rb:426 +#: ../lib/puppet/type/file.rb:442 msgid "Possible error: recurselimit is set but not recurse, no recursion will happen" msgstr "" -#: ../lib/puppet/type/file.rb:434 +#: ../lib/puppet/type/file.rb:450 msgid "Checksum value '%{value}' is not a valid checksum type %{checksum}" msgstr "" -#: ../lib/puppet/type/file.rb:437 +#: ../lib/puppet/type/file.rb:453 msgid "Checksum value is ignored unless content or source are specified" msgstr "" -#: ../lib/puppet/type/file.rb:475 +#: ../lib/puppet/type/file.rb:491 msgid "Can not find filebucket for backups without a catalog" msgstr "" -#: ../lib/puppet/type/file.rb:480 +#: ../lib/puppet/type/file.rb:496 msgid "Could not find filebucket %{backup} specified in backup" msgstr "" -#: ../lib/puppet/type/file.rb:778 +#: ../lib/puppet/type/file.rb:795 msgid "Could not back up file of type %{current_type}" msgstr "" -#: ../lib/puppet/type/file.rb:793 +#: ../lib/puppet/type/file.rb:810 msgid "Could not remove files of type %{current_type}" msgstr "" #. TRANSLATORS "source_permissions => ignore" should not be translated -#: ../lib/puppet/type/file.rb:804 +#: ../lib/puppet/type/file.rb:821 msgid "Copying owner/mode/group from the source file on Windows is not supported; use source_permissions => ignore." msgstr "" #. TRANSLATORS "stat" is a program name and should not be translated -#: ../lib/puppet/type/file.rb:885 ../lib/puppet/type/tidy.rb:352 +#: ../lib/puppet/type/file.rb:902 ../lib/puppet/type/tidy.rb:371 msgid "Could not stat; permission denied" msgstr "" -#: ../lib/puppet/type/file.rb:888 +#: ../lib/puppet/type/file.rb:905 msgid "Could not stat; invalid pathname" msgstr "" -#: ../lib/puppet/type/file.rb:1016 +#: ../lib/puppet/type/file.rb:1033 msgid "Not removing directory; use 'force' to override" msgstr "" #. TRANSLATORS refers to a file which could not be backed up -#: ../lib/puppet/type/file.rb:1041 +#: ../lib/puppet/type/file.rb:1058 msgid "Could not back up; will not remove" msgstr "" -#: ../lib/puppet/type/file.rb:1056 +#: ../lib/puppet/type/file.rb:1073 msgid "File written to disk did not match desired checksum; discarding changes (%{content_checksum} vs %{desired_checksum})" msgstr "" @@ -8242,34 +8250,34 @@ msgstr "" msgid "\"%{value}\" is not a positive integer: the timeout parameter must be specified as a positive integer" msgstr "" -#: ../lib/puppet/type/tidy.rb:85 +#: ../lib/puppet/type/tidy.rb:101 msgid "Tidy can't use matches with recurse 0, false, or undef" msgstr "" -#: ../lib/puppet/type/tidy.rb:125 +#: ../lib/puppet/type/tidy.rb:141 msgid "Invalid age unit '%{unit}'" msgstr "" #. TRANSLATORS tidy is the name of a program and should not be translated -#: ../lib/puppet/type/tidy.rb:145 +#: ../lib/puppet/type/tidy.rb:161 msgid "Invalid tidy age %{age}" msgstr "" -#: ../lib/puppet/type/tidy.rb:167 +#: ../lib/puppet/type/tidy.rb:183 msgid "Invalid size unit '%{unit}'" msgstr "" #. TRANSLATORS tidy is the name of a program and should not be translated -#: ../lib/puppet/type/tidy.rb:185 +#: ../lib/puppet/type/tidy.rb:201 msgid "Invalid tidy size %{age}" msgstr "" #. TRANSLATORS "Tidy" is a program name and should not be translated -#: ../lib/puppet/type/tidy.rb:275 +#: ../lib/puppet/type/tidy.rb:294 msgid "Tidying %{count} files" msgstr "" -#: ../lib/puppet/type/tidy.rb:348 +#: ../lib/puppet/type/tidy.rb:367 msgid "File does not exist" msgstr "" From 1458b167ce315ca6340a0fcf0f9ef225bfb7daaf Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Mon, 7 Dec 2020 17:12:24 -0800 Subject: [PATCH 362/731] (PUP-11055) Replace double with single quotes Only use double quotes if we plan on interpolating the path, so it's clear those cannot be converted to relative_require. The remaining cases are: $ git grep 'require "' lib lib/puppet/confine.rb: require "puppet/confine/#{name}" lib/puppet/pops/lookup/data_dig_function_provider.rb: require "hiera/backend/#{backend_name.downcase}_backend" lib/puppet/util/network_device.rb: require "puppet/util/network_device/#{device.provider}/device" --- lib/puppet.rb | 2 +- lib/puppet/provider/package/pkgin.rb | 2 +- lib/puppet/util/command_line.rb | 4 ++-- lib/puppet/util/command_line/puppet_option_parser.rb | 2 +- lib/puppet/util/rdoc/parser.rb | 12 ++++++------ 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/puppet.rb b/lib/puppet.rb index 44cb3de3701..493e2eb99c8 100644 --- a/lib/puppet.rb +++ b/lib/puppet.rb @@ -208,7 +208,7 @@ def self.initialize_facts # Load vendored (setup paths, and load what is needed upfront). # See the Vendor class for how to add additional vendored gems/code - require "puppet/vendor" + require 'puppet/vendor' Puppet::Vendor.load_vendored # The bindings used for initialization of puppet diff --git a/lib/puppet/provider/package/pkgin.rb b/lib/puppet/provider/package/pkgin.rb index 8f2d7ef4911..5121a847690 100644 --- a/lib/puppet/provider/package/pkgin.rb +++ b/lib/puppet/provider/package/pkgin.rb @@ -1,4 +1,4 @@ -require "puppet/provider/package" +require 'puppet/provider/package' Puppet::Type.type(:package).provide :pkgin, :parent => Puppet::Provider::Package do desc "Package management using pkgin, a binary package manager for pkgsrc." diff --git a/lib/puppet/util/command_line.rb b/lib/puppet/util/command_line.rb index e1e07766339..1b77f3d88b2 100644 --- a/lib/puppet/util/command_line.rb +++ b/lib/puppet/util/command_line.rb @@ -11,8 +11,8 @@ require 'puppet' require 'puppet/util' -require "puppet/util/rubygems" -require "puppet/util/limits" +require 'puppet/util/rubygems' +require 'puppet/util/limits' require 'puppet/util/colors' require 'puppet/gettext/module_translations' diff --git a/lib/puppet/util/command_line/puppet_option_parser.rb b/lib/puppet/util/command_line/puppet_option_parser.rb index e6287fd4dbf..160de891f35 100644 --- a/lib/puppet/util/command_line/puppet_option_parser.rb +++ b/lib/puppet/util/command_line/puppet_option_parser.rb @@ -16,7 +16,7 @@ class TrollopCommandlineError < Puppet::Util::CommandLine::Trollop::CommandlineE class PuppetOptionParser def initialize(usage_msg = nil) - require "puppet/util/command_line/trollop" + require 'puppet/util/command_line/trollop' @create_default_short_options = false diff --git a/lib/puppet/util/rdoc/parser.rb b/lib/puppet/util/rdoc/parser.rb index 9fecc2f5501..beafb295eb2 100644 --- a/lib/puppet/util/rdoc/parser.rb +++ b/lib/puppet/util/rdoc/parser.rb @@ -4,9 +4,9 @@ # either custom facts or puppet plugins (functions, types...) # rdoc2 includes -require "rdoc/code_objects" -require "puppet/util/rdoc/code_objects" -require "rdoc/token_stream" -require "rdoc/markup/pre_process" -require "rdoc/parser" -require "puppet/util/rdoc/parser/puppet_parser_rdoc2.rb" +require 'rdoc/code_objects' +require 'puppet/util/rdoc/code_objects' +require 'rdoc/token_stream' +require 'rdoc/markup/pre_process' +require 'rdoc/parser' +require 'puppet/util/rdoc/parser/puppet_parser_rdoc2.rb' From f199de16222d6222881c504abb55953f6e30690a Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Wed, 5 May 2021 10:53:31 -0700 Subject: [PATCH 363/731] (PUP-11055) Require file directly There's only one catalog validator now. --- lib/puppet/parser.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/puppet/parser.rb b/lib/puppet/parser.rb index dea9cca7ce3..e5374bd51c7 100644 --- a/lib/puppet/parser.rb +++ b/lib/puppet/parser.rb @@ -14,7 +14,7 @@ module Puppet::Parser; end require 'puppet/resource/type' require 'monitor' -Dir[File.dirname(__FILE__) + '/parser/compiler/catalog_validator/*.rb'].each { |f| require f } +require 'puppet/parser/compiler/catalog_validator/relationship_validator.rb' # PUP-3274 This should probably go someplace else class Puppet::LexError < RuntimeError; end From b6eab5983e14399366ba0e02db09346bb89bf811 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Wed, 5 May 2021 11:42:03 -0700 Subject: [PATCH 364/731] (PUP-11055) Convert AtFork and POSIX to require_relative The code and tests are sensitive to require vs require_relative, so manually convert to require_relative. fixup with atfork --- lib/puppet/util/at_fork.rb | 6 +++--- lib/puppet/util/at_fork/solaris.rb | 2 +- lib/puppet/util/posix.rb | 2 +- spec/unit/util/at_fork_spec.rb | 18 +++++++++--------- spec/unit/util/posix_spec.rb | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/lib/puppet/util/at_fork.rb b/lib/puppet/util/at_fork.rb index 9fe27fc1b06..8a7fb47663d 100644 --- a/lib/puppet/util/at_fork.rb +++ b/lib/puppet/util/at_fork.rb @@ -1,4 +1,4 @@ -require 'puppet' +require_relative '../../puppet' # A module for building AtFork handlers. These handlers are objects providing # pre/post fork callbacks modeled after those registered by the `pthread_atfork` @@ -15,7 +15,7 @@ module Puppet::Util::AtFork @handler_class = loop do if Puppet::Util::Platform.solaris? begin - require 'puppet/util/at_fork/solaris' + require_relative 'at_fork/solaris' # using break to return a value from the loop block break Puppet::Util::AtFork::Solaris rescue LoadError => detail @@ -24,7 +24,7 @@ module Puppet::Util::AtFork end end - require 'puppet/util/at_fork/noop' + require_relative 'at_fork/noop' # using break to return a value from the loop block break Puppet::Util::AtFork::Noop end diff --git a/lib/puppet/util/at_fork/solaris.rb b/lib/puppet/util/at_fork/solaris.rb index 0734177fb24..07f4baa150f 100644 --- a/lib/puppet/util/at_fork/solaris.rb +++ b/lib/puppet/util/at_fork/solaris.rb @@ -1,4 +1,4 @@ -require 'puppet' +require_relative '../../../puppet' require 'fiddle' # Early versions of Fiddle relied on the deprecated DL module and used diff --git a/lib/puppet/util/posix.rb b/lib/puppet/util/posix.rb index d5de9837a7e..86856d8e06a 100644 --- a/lib/puppet/util/posix.rb +++ b/lib/puppet/util/posix.rb @@ -13,7 +13,7 @@ class << self # Returns an array of all the groups that the user's a member of. def groups_of(user) begin - require 'puppet/ffi/posix' + require_relative '../../puppet/ffi/posix' groups = get_groups_list(user) rescue StandardError, LoadError => e Puppet.debug("Falling back to Puppet::Etc.group: #{e.message}") diff --git a/spec/unit/util/at_fork_spec.rb b/spec/unit/util/at_fork_spec.rb index 478bb381ca5..bdf7b5f1e58 100644 --- a/spec/unit/util/at_fork_spec.rb +++ b/spec/unit/util/at_fork_spec.rb @@ -29,11 +29,11 @@ end def stub_solaris_handler(stub_noop_too = false) - allow(Puppet::Util::AtFork).to receive(:require).with(anything) do |lib| - if lib == 'puppet/util/at_fork/solaris' - load lib + '.rb' + allow(Puppet::Util::AtFork).to receive(:require_relative).with(anything) do |lib| + if lib == 'at_fork/solaris' + load 'puppet/util/at_fork/solaris.rb' true - elsif stub_noop_too && lib == 'puppet/util/at_fork/noop' + elsif stub_noop_too && lib == 'at_fork/noop' Puppet::Util::AtFork.class_exec do const_set(:Noop, Class.new) end @@ -67,8 +67,8 @@ def stub_solaris_handler(stub_noop_too = false) end it %q(should return the Solaris specific AtFork handler) do - allow(Puppet::Util::AtFork).to receive(:require).with(anything) do |lib| - if lib == 'puppet/util/at_fork/solaris' + allow(Puppet::Util::AtFork).to receive(:require_relative).with(anything) do |lib| + if lib == 'at_fork/solaris' Puppet::Util::AtFork.class_exec do const_set(:Solaris, Class.new) end @@ -118,14 +118,14 @@ def stub_solaris_handler(stub_noop_too = false) end def stub_noop_handler(namespace_only = false) - allow(Puppet::Util::AtFork).to receive(:require).with(anything) do |lib| - if lib == 'puppet/util/at_fork/noop' + allow(Puppet::Util::AtFork).to receive(:require_relative).with(anything) do |lib| + if lib == 'at_fork/noop' if namespace_only Puppet::Util::AtFork.class_exec do const_set(:Noop, Class.new) end else - load lib + '.rb' + load 'puppet/util/at_fork/noop.rb' end true else diff --git a/spec/unit/util/posix_spec.rb b/spec/unit/util/posix_spec.rb index 99dcf1bc1a9..2b3b23817a9 100644 --- a/spec/unit/util/posix_spec.rb +++ b/spec/unit/util/posix_spec.rb @@ -338,7 +338,7 @@ def prepare_user_and_groups_env(user, groups) let(:expected_groups) { ['group1', 'group3'] } before(:each) do - allow(Puppet::Util::POSIX).to receive(:require).with('puppet/ffi/posix').and_raise(LoadError, 'cannot load such file -- ffi') + allow(Puppet::Util::POSIX).to receive(:require_relative).with('../../puppet/ffi/posix').and_raise(LoadError, 'cannot load such file -- ffi') end it "should return the groups" do From b76eaeb47cc98ed3362a0f81ddb303ed0f6a3c5d Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Wed, 5 May 2021 10:55:09 -0700 Subject: [PATCH 365/731] (PUP-11055) Relativize paths Automatically converted using: bundle exec relativize --name puppet --path ~/work/puppet This reduces the number of openat calls from ~40k to ~30k on Redhat 8: Before: $ strace -fc -e trace=file bundle exec puppet --version 7.7.0 % time seconds usecs/call calls errors syscall ------ ----------- ----------- --------- --------- ---------------- 75.14 0.069757 1 39598 36509 openat 23.16 0.021499 1 15353 3 lstat 0.91 0.000846 0 1058 603 stat 0.64 0.000591 6 90 68 execve 0.11 0.000100 0 113 22 access 0.03 0.000026 1 15 getcwd 0.02 0.000021 1 12 chdir 0.00 0.000002 1 2 newfstatat 0.00 0.000000 0 1 1 readlink 0.00 0.000000 0 1 faccessat ------ ----------- ----------- --------- --------- ---------------- 100.00 0.092842 56243 37206 total After: $ strace -fc -e trace=file bundle exec puppet --version 7.7.0 % time seconds usecs/call calls errors syscall ------ ----------- ----------- --------- --------- ---------------- 69.26 0.055875 1 30703 27665 openat 26.17 0.021114 1 15353 3 lstat 2.39 0.001926 1 1058 603 stat 1.95 0.001574 17 90 68 execve 0.19 0.000152 1 113 22 access 0.02 0.000016 1 15 getcwd 0.02 0.000014 1 12 chdir 0.01 0.000008 8 1 faccessat 0.00 0.000000 0 1 1 readlink 0.00 0.000000 0 2 newfstatat ------ ----------- ----------- --------- --------- ---------------- 100.00 0.080679 47348 28362 total --- lib/hiera_puppet.rb | 2 +- lib/puppet.rb | 74 ++++++------ lib/puppet/agent.rb | 12 +- lib/puppet/agent/disabler.rb | 2 +- lib/puppet/agent/locker.rb | 4 +- lib/puppet/application.rb | 12 +- lib/puppet/application/agent.rb | 12 +- lib/puppet/application/apply.rb | 8 +- lib/puppet/application/catalog.rb | 2 +- lib/puppet/application/config.rb | 2 +- lib/puppet/application/describe.rb | 2 +- lib/puppet/application/device.rb | 12 +- lib/puppet/application/doc.rb | 14 +-- lib/puppet/application/epp.rb | 4 +- lib/puppet/application/face_base.rb | 4 +- lib/puppet/application/facts.rb | 2 +- lib/puppet/application/filebucket.rb | 4 +- lib/puppet/application/generate.rb | 2 +- lib/puppet/application/help.rb | 2 +- lib/puppet/application/indirection_base.rb | 2 +- lib/puppet/application/lookup.rb | 12 +- lib/puppet/application/module.rb | 2 +- lib/puppet/application/node.rb | 2 +- lib/puppet/application/parser.rb | 4 +- lib/puppet/application/plugin.rb | 2 +- lib/puppet/application/report.rb | 2 +- lib/puppet/application/resource.rb | 2 +- lib/puppet/application/script.rb | 8 +- lib/puppet/application/ssl.rb | 4 +- lib/puppet/application_support.rb | 8 +- lib/puppet/compilable_resource_type.rb | 2 +- lib/puppet/concurrent/lock.rb | 2 +- lib/puppet/configurer.rb | 8 +- lib/puppet/configurer/downloader.rb | 4 +- lib/puppet/configurer/fact_handler.rb | 6 +- lib/puppet/configurer/plugin_handler.rb | 2 +- lib/puppet/confine.rb | 2 +- lib/puppet/confine/boolean.rb | 2 +- lib/puppet/confine/exists.rb | 2 +- lib/puppet/confine/false.rb | 2 +- lib/puppet/confine/feature.rb | 2 +- lib/puppet/confine/true.rb | 2 +- lib/puppet/confine/variable.rb | 2 +- lib/puppet/confine_collection.rb | 2 +- lib/puppet/confiner.rb | 2 +- lib/puppet/context.rb | 4 +- lib/puppet/context/trusted_information.rb | 2 +- lib/puppet/daemon.rb | 4 +- lib/puppet/data_binding.rb | 2 +- lib/puppet/datatypes/error.rb | 2 +- lib/puppet/defaults.rb | 8 +- lib/puppet/environments.rb | 2 +- lib/puppet/etc.rb | 2 +- lib/puppet/external/pson/common.rb | 2 +- lib/puppet/external/pson/pure.rb | 6 +- lib/puppet/face.rb | 2 +- lib/puppet/face/catalog.rb | 2 +- lib/puppet/face/config.rb | 4 +- lib/puppet/face/epp.rb | 12 +- lib/puppet/face/facts.rb | 4 +- lib/puppet/face/generate.rb | 4 +- lib/puppet/face/help.rb | 6 +- lib/puppet/face/module.rb | 6 +- lib/puppet/face/module/install.rb | 4 +- lib/puppet/face/node.rb | 2 +- lib/puppet/face/parser.rb | 8 +- lib/puppet/face/plugin.rb | 4 +- lib/puppet/face/report.rb | 2 +- lib/puppet/face/resource.rb | 2 +- lib/puppet/feature/base.rb | 4 +- lib/puppet/feature/bolt.rb | 2 +- lib/puppet/feature/cfpropertylist.rb | 2 +- lib/puppet/feature/eventlog.rb | 2 +- lib/puppet/feature/hiera_eyaml.rb | 2 +- lib/puppet/feature/hocon.rb | 2 +- lib/puppet/feature/libuser.rb | 4 +- lib/puppet/feature/msgpack.rb | 2 +- lib/puppet/feature/pe_license.rb | 2 +- lib/puppet/feature/selinux.rb | 2 +- lib/puppet/feature/ssh.rb | 2 +- lib/puppet/feature/telnet.rb | 2 +- lib/puppet/feature/zlib.rb | 2 +- lib/puppet/ffi/posix.rb | 4 +- lib/puppet/ffi/posix/constants.rb | 2 +- lib/puppet/ffi/posix/functions.rb | 2 +- lib/puppet/ffi/windows.rb | 8 +- lib/puppet/ffi/windows/api_types.rb | 4 +- lib/puppet/ffi/windows/constants.rb | 2 +- lib/puppet/ffi/windows/functions.rb | 2 +- lib/puppet/ffi/windows/structs.rb | 2 +- lib/puppet/file_bucket/dipper.rb | 8 +- lib/puppet/file_bucket/file.rb | 6 +- lib/puppet/file_serving/base.rb | 4 +- lib/puppet/file_serving/configuration.rb | 20 +-- .../file_serving/configuration/parser.rb | 4 +- lib/puppet/file_serving/content.rb | 6 +- lib/puppet/file_serving/fileset.rb | 4 +- lib/puppet/file_serving/http_metadata.rb | 2 +- lib/puppet/file_serving/metadata.rb | 12 +- lib/puppet/file_serving/mount.rb | 8 +- lib/puppet/file_serving/mount/file.rb | 2 +- lib/puppet/file_serving/mount/locales.rb | 2 +- lib/puppet/file_serving/mount/modules.rb | 2 +- lib/puppet/file_serving/mount/pluginfacts.rb | 2 +- lib/puppet/file_serving/mount/plugins.rb | 2 +- lib/puppet/file_serving/mount/tasks.rb | 2 +- lib/puppet/file_serving/terminus_helper.rb | 4 +- lib/puppet/file_serving/terminus_selector.rb | 2 +- lib/puppet/file_system.rb | 18 +-- lib/puppet/file_system/jruby.rb | 2 +- lib/puppet/file_system/path_pattern.rb | 2 +- lib/puppet/file_system/uniquefile.rb | 2 +- lib/puppet/file_system/windows.rb | 4 +- lib/puppet/forge.rb | 10 +- lib/puppet/forge/cache.rb | 2 +- lib/puppet/forge/errors.rb | 6 +- lib/puppet/forge/repository.rb | 8 +- lib/puppet/functions/versioncmp.rb | 2 +- lib/puppet/generate/models/type/type.rb | 2 +- lib/puppet/generate/type.rb | 4 +- lib/puppet/gettext/config.rb | 6 +- lib/puppet/gettext/module_translations.rb | 2 +- lib/puppet/graph.rb | 12 +- lib/puppet/graph/simple_graph.rb | 4 +- lib/puppet/http.rb | 52 ++++---- lib/puppet/http/factory.rb | 4 +- lib/puppet/http/proxy.rb | 2 +- lib/puppet/http/service/file_server.rb | 2 +- lib/puppet/indirector.rb | 10 +- lib/puppet/indirector/catalog/compiler.rb | 12 +- lib/puppet/indirector/catalog/json.rb | 4 +- lib/puppet/indirector/catalog/msgpack.rb | 4 +- lib/puppet/indirector/catalog/rest.rb | 4 +- .../indirector/catalog/store_configs.rb | 4 +- lib/puppet/indirector/catalog/yaml.rb | 4 +- lib/puppet/indirector/code.rb | 2 +- lib/puppet/indirector/data_binding/hiera.rb | 2 +- lib/puppet/indirector/data_binding/none.rb | 2 +- lib/puppet/indirector/direct_file_server.rb | 4 +- lib/puppet/indirector/envelope.rb | 2 +- lib/puppet/indirector/errors.rb | 2 +- lib/puppet/indirector/exec.rb | 4 +- lib/puppet/indirector/face.rb | 2 +- lib/puppet/indirector/facts/facter.rb | 4 +- lib/puppet/indirector/facts/json.rb | 6 +- lib/puppet/indirector/facts/memory.rb | 4 +- lib/puppet/indirector/facts/network_device.rb | 4 +- lib/puppet/indirector/facts/rest.rb | 4 +- lib/puppet/indirector/facts/store_configs.rb | 4 +- lib/puppet/indirector/facts/yaml.rb | 6 +- .../indirector/file_bucket_file/file.rb | 8 +- .../indirector/file_bucket_file/rest.rb | 4 +- .../indirector/file_bucket_file/selector.rb | 2 +- lib/puppet/indirector/file_content.rb | 2 +- lib/puppet/indirector/file_content/file.rb | 6 +- .../indirector/file_content/file_server.rb | 6 +- lib/puppet/indirector/file_content/rest.rb | 6 +- .../indirector/file_content/selector.rb | 8 +- lib/puppet/indirector/file_metadata.rb | 2 +- lib/puppet/indirector/file_metadata/file.rb | 6 +- .../indirector/file_metadata/file_server.rb | 6 +- lib/puppet/indirector/file_metadata/http.rb | 6 +- lib/puppet/indirector/file_metadata/rest.rb | 6 +- .../indirector/file_metadata/selector.rb | 8 +- lib/puppet/indirector/file_server.rb | 8 +- lib/puppet/indirector/generic_http.rb | 2 +- lib/puppet/indirector/hiera.rb | 2 +- lib/puppet/indirector/indirection.rb | 10 +- lib/puppet/indirector/json.rb | 4 +- lib/puppet/indirector/memory.rb | 2 +- lib/puppet/indirector/msgpack.rb | 4 +- lib/puppet/indirector/node/exec.rb | 4 +- lib/puppet/indirector/node/json.rb | 4 +- lib/puppet/indirector/node/memory.rb | 4 +- lib/puppet/indirector/node/msgpack.rb | 4 +- lib/puppet/indirector/node/plain.rb | 4 +- lib/puppet/indirector/node/rest.rb | 4 +- lib/puppet/indirector/node/store_configs.rb | 4 +- lib/puppet/indirector/node/yaml.rb | 4 +- lib/puppet/indirector/none.rb | 2 +- lib/puppet/indirector/plain.rb | 2 +- lib/puppet/indirector/report/json.rb | 4 +- lib/puppet/indirector/report/msgpack.rb | 4 +- lib/puppet/indirector/report/processor.rb | 6 +- lib/puppet/indirector/report/rest.rb | 2 +- lib/puppet/indirector/report/yaml.rb | 4 +- lib/puppet/indirector/request.rb | 6 +- lib/puppet/indirector/resource/ral.rb | 2 +- .../indirector/resource/store_configs.rb | 4 +- lib/puppet/indirector/terminus.rb | 10 +- lib/puppet/indirector/yaml.rb | 4 +- lib/puppet/info_service.rb | 6 +- .../info_service/class_information_service.rb | 6 +- .../info_service/plan_information_service.rb | 2 +- .../info_service/task_information_service.rb | 2 +- lib/puppet/interface.rb | 20 +-- lib/puppet/interface/documentation.rb | 2 +- lib/puppet/loaders.rb | 42 +++---- lib/puppet/metatype/manager.rb | 6 +- lib/puppet/module.rb | 8 +- lib/puppet/module/plan.rb | 2 +- lib/puppet/module/task.rb | 2 +- lib/puppet/module_tool.rb | 20 +-- lib/puppet/module_tool/applications.rb | 14 +-- .../module_tool/applications/application.rb | 4 +- .../module_tool/applications/checksummer.rb | 4 +- .../module_tool/applications/installer.rb | 14 +-- .../module_tool/applications/unpacker.rb | 4 +- .../module_tool/applications/upgrader.rb | 10 +- lib/puppet/module_tool/checksums.rb | 2 +- .../module_tool/contents_description.rb | 2 +- lib/puppet/module_tool/dependency.rb | 4 +- lib/puppet/module_tool/errors.rb | 12 +- lib/puppet/module_tool/install_directory.rb | 4 +- lib/puppet/module_tool/installed_modules.rb | 4 +- lib/puppet/module_tool/local_tarball.rb | 4 +- lib/puppet/module_tool/metadata.rb | 6 +- lib/puppet/module_tool/tar.rb | 8 +- lib/puppet/network/format.rb | 2 +- lib/puppet/network/format_handler.rb | 6 +- lib/puppet/network/format_support.rb | 2 +- lib/puppet/network/formats.rb | 4 +- lib/puppet/network/http.rb | 24 ++-- lib/puppet/network/http/api.rb | 2 +- .../network/http/api/indirected_routes.rb | 2 +- lib/puppet/network/http/api/master.rb | 2 +- lib/puppet/network/http/api/master/v3.rb | 4 +- .../http/api/master/v3/environments.rb | 4 +- lib/puppet/network/http/api/server/v3.rb | 4 +- .../http/api/server/v3/environments.rb | 2 +- lib/puppet/network/http/connection.rb | 2 +- lib/puppet/network/http/error.rb | 2 +- lib/puppet/network/http/handler.rb | 6 +- lib/puppet/network/http_pool.rb | 2 +- lib/puppet/node.rb | 6 +- lib/puppet/node/environment.rb | 6 +- lib/puppet/node/facts.rb | 6 +- lib/puppet/pal/pal_api.rb | 20 +-- lib/puppet/pal/pal_impl.rb | 6 +- lib/puppet/parameter.rb | 8 +- lib/puppet/parameter/boolean.rb | 2 +- lib/puppet/parameter/package_options.rb | 2 +- lib/puppet/parameter/path.rb | 2 +- lib/puppet/parameter/value.rb | 2 +- lib/puppet/parameter/value_collection.rb | 2 +- lib/puppet/parser.rb | 20 +-- lib/puppet/parser/ast.rb | 16 +-- lib/puppet/parser/ast/hostclass.rb | 2 +- lib/puppet/parser/ast/pops_bridge.rb | 4 +- lib/puppet/parser/catalog_compiler.rb | 4 +- lib/puppet/parser/compiler.rb | 10 +- lib/puppet/parser/e4_parser_adapter.rb | 2 +- lib/puppet/parser/functions.rb | 8 +- lib/puppet/parser/functions/digest.rb | 2 +- lib/puppet/parser/functions/file.rb | 2 +- lib/puppet/parser/functions/versioncmp.rb | 2 +- lib/puppet/parser/parser_factory.rb | 4 +- lib/puppet/parser/resource.rb | 6 +- lib/puppet/parser/scope.rb | 6 +- lib/puppet/parser/script_compiler.rb | 4 +- lib/puppet/parser/templatewrapper.rb | 4 +- lib/puppet/parser/type_loader.rb | 2 +- lib/puppet/plugins/configuration.rb | 10 +- lib/puppet/pops.rb | 114 +++++++++--------- .../pops/evaluator/deferred_resolver.rb | 2 +- lib/puppet/pops/evaluator/evaluator_impl.rb | 14 +-- .../pops/evaluator/external_syntax_support.rb | 2 +- lib/puppet/pops/loader/task_instantiator.rb | 2 +- lib/puppet/pops/lookup/invocation.rb | 2 +- lib/puppet/pops/model/ast_transformer.rb | 2 +- lib/puppet/pops/model/pn_transformer.rb | 2 +- lib/puppet/pops/parser/eparser.rb | 4 +- lib/puppet/pops/parser/evaluating_parser.rb | 2 +- lib/puppet/pops/parser/lexer2.rb | 10 +- lib/puppet/pops/parser/lexer_support.rb | 2 +- lib/puppet/pops/parser/parser_support.rb | 8 +- lib/puppet/pops/puppet_stack.rb | 2 +- lib/puppet/pops/serialization/json.rb | 2 +- lib/puppet/pops/serialization/json_path.rb | 2 +- lib/puppet/pops/time/timespan.rb | 2 +- lib/puppet/pops/types/string_converter.rb | 2 +- lib/puppet/pops/types/type_calculator.rb | 2 +- lib/puppet/pops/types/type_formatter.rb | 2 +- lib/puppet/pops/types/type_parser.rb | 2 +- lib/puppet/pops/types/types.rb | 2 +- lib/puppet/pops/validation/checker4_0.rb | 2 +- lib/puppet/property.rb | 6 +- lib/puppet/property/boolean.rb | 2 +- lib/puppet/property/ensure.rb | 2 +- lib/puppet/property/keyvalue.rb | 2 +- lib/puppet/property/list.rb | 2 +- lib/puppet/property/ordered_list.rb | 2 +- lib/puppet/provider.rb | 4 +- lib/puppet/provider/confine.rb | 4 +- lib/puppet/provider/exec.rb | 4 +- lib/puppet/provider/exec/posix.rb | 2 +- lib/puppet/provider/exec/windows.rb | 2 +- lib/puppet/provider/file/posix.rb | 2 +- lib/puppet/provider/file/windows.rb | 2 +- lib/puppet/provider/group/aix.rb | 2 +- lib/puppet/provider/group/directoryservice.rb | 2 +- lib/puppet/provider/group/groupadd.rb | 4 +- lib/puppet/provider/group/ldap.rb | 2 +- lib/puppet/provider/group/pw.rb | 2 +- lib/puppet/provider/group/windows_adsi.rb | 2 +- lib/puppet/provider/ldap.rb | 4 +- lib/puppet/provider/nameservice.rb | 2 +- .../provider/nameservice/directoryservice.rb | 6 +- lib/puppet/provider/nameservice/objectadd.rb | 2 +- lib/puppet/provider/nameservice/pw.rb | 2 +- lib/puppet/provider/package.rb | 2 +- lib/puppet/provider/package/aix.rb | 4 +- lib/puppet/provider/package/appdmg.rb | 4 +- lib/puppet/provider/package/apple.rb | 2 +- lib/puppet/provider/package/apt.rb | 4 +- lib/puppet/provider/package/dnfmodule.rb | 2 +- lib/puppet/provider/package/dpkg.rb | 2 +- lib/puppet/provider/package/gem.rb | 6 +- lib/puppet/provider/package/hpux.rb | 2 +- lib/puppet/provider/package/macports.rb | 4 +- lib/puppet/provider/package/nim.rb | 4 +- lib/puppet/provider/package/openbsd.rb | 2 +- lib/puppet/provider/package/opkg.rb | 2 +- lib/puppet/provider/package/pacman.rb | 2 +- lib/puppet/provider/package/pip.rb | 6 +- lib/puppet/provider/package/pkg.rb | 2 +- lib/puppet/provider/package/pkgdmg.rb | 6 +- lib/puppet/provider/package/pkgin.rb | 2 +- lib/puppet/provider/package/pkgng.rb | 2 +- lib/puppet/provider/package/portage.rb | 2 +- lib/puppet/provider/package/portupgrade.rb | 2 +- lib/puppet/provider/package/rpm.rb | 4 +- lib/puppet/provider/package/sun.rb | 2 +- lib/puppet/provider/package/windows.rb | 6 +- .../provider/package/windows/exe_package.rb | 2 +- .../provider/package/windows/msi_package.rb | 2 +- .../provider/package/windows/package.rb | 8 +- lib/puppet/provider/package/yum.rb | 6 +- lib/puppet/provider/package_targetable.rb | 2 +- lib/puppet/provider/parsedfile.rb | 6 +- lib/puppet/provider/service/launchd.rb | 2 +- lib/puppet/provider/service/systemd.rb | 2 +- lib/puppet/provider/user/aix.rb | 4 +- lib/puppet/provider/user/directoryservice.rb | 4 +- lib/puppet/provider/user/ldap.rb | 2 +- lib/puppet/provider/user/openbsd.rb | 2 +- lib/puppet/provider/user/pw.rb | 2 +- lib/puppet/provider/user/user_role_add.rb | 4 +- lib/puppet/provider/user/useradd.rb | 6 +- lib/puppet/provider/user/windows_adsi.rb | 2 +- lib/puppet/reference/indirection.rb | 8 +- lib/puppet/reference/report.rb | 2 +- lib/puppet/reports.rb | 2 +- lib/puppet/reports/http.rb | 4 +- lib/puppet/reports/log.rb | 2 +- lib/puppet/reports/store.rb | 4 +- lib/puppet/resource.rb | 8 +- lib/puppet/resource/catalog.rb | 10 +- lib/puppet/resource/status.rb | 4 +- lib/puppet/resource/type.rb | 8 +- lib/puppet/resource/type_collection.rb | 8 +- lib/puppet/runtime.rb | 2 +- lib/puppet/scheduler.rb | 8 +- lib/puppet/settings.rb | 56 ++++----- lib/puppet/settings/autosign_setting.rb | 2 +- lib/puppet/settings/base_setting.rb | 4 +- .../certificate_revocation_setting.rb | 2 +- lib/puppet/settings/config_file.rb | 2 +- lib/puppet/settings/errors.rb | 2 +- lib/puppet/settings/priority_setting.rb | 6 +- lib/puppet/ssl.rb | 22 ++-- lib/puppet/ssl/base.rb | 6 +- lib/puppet/ssl/certificate.rb | 2 +- lib/puppet/ssl/certificate_request.rb | 4 +- .../ssl/certificate_request_attributes.rb | 4 +- lib/puppet/ssl/oids.rb | 2 +- lib/puppet/ssl/openssl_loader.rb | 2 +- lib/puppet/ssl/ssl_context.rb | 2 +- lib/puppet/ssl/ssl_provider.rb | 2 +- lib/puppet/ssl/state_machine.rb | 4 +- lib/puppet/ssl/verifier.rb | 2 +- lib/puppet/syntax_checkers/base64.rb | 2 +- lib/puppet/syntax_checkers/epp.rb | 2 +- lib/puppet/syntax_checkers/json.rb | 2 +- lib/puppet/syntax_checkers/pp.rb | 2 +- lib/puppet/transaction.rb | 22 ++-- lib/puppet/transaction/event.rb | 8 +- lib/puppet/transaction/event_manager.rb | 2 +- lib/puppet/transaction/persistence.rb | 2 +- lib/puppet/transaction/report.rb | 4 +- lib/puppet/transaction/resource_harness.rb | 2 +- lib/puppet/type.rb | 28 ++--- lib/puppet/type/component.rb | 6 +- lib/puppet/type/file.rb | 36 +++--- lib/puppet/type/file/checksum.rb | 2 +- lib/puppet/type/file/checksum_value.rb | 4 +- lib/puppet/type/file/content.rb | 4 +- lib/puppet/type/file/data_sync.rb | 4 +- lib/puppet/type/file/ensure.rb | 2 +- lib/puppet/type/file/group.rb | 2 +- lib/puppet/type/file/mode.rb | 2 +- lib/puppet/type/file/selcontext.rb | 2 +- lib/puppet/type/file/source.rb | 8 +- lib/puppet/type/filebucket.rb | 2 +- lib/puppet/type/group.rb | 4 +- lib/puppet/type/package.rb | 4 +- lib/puppet/type/resources.rb | 4 +- lib/puppet/type/tidy.rb | 6 +- lib/puppet/type/user.rb | 8 +- lib/puppet/util.rb | 34 +++--- lib/puppet/util/autoload.rb | 8 +- lib/puppet/util/checksums.rb | 6 +- lib/puppet/util/colors.rb | 2 +- lib/puppet/util/command_line.rb | 12 +- .../util/command_line/puppet_option_parser.rb | 4 +- lib/puppet/util/execution.rb | 4 +- lib/puppet/util/feature.rb | 4 +- lib/puppet/util/filetype.rb | 2 +- lib/puppet/util/http_proxy.rb | 2 +- lib/puppet/util/inifile.rb | 4 +- lib/puppet/util/instance_loader.rb | 6 +- lib/puppet/util/json_lockfile.rb | 2 +- lib/puppet/util/ldap/connection.rb | 2 +- lib/puppet/util/ldap/generator.rb | 2 +- lib/puppet/util/ldap/manager.rb | 6 +- lib/puppet/util/limits.rb | 2 +- lib/puppet/util/log.rb | 12 +- lib/puppet/util/log/destinations.rb | 2 +- lib/puppet/util/logging.rb | 4 +- lib/puppet/util/metric.rb | 4 +- lib/puppet/util/monkey_patches.rb | 6 +- lib/puppet/util/network_device/base.rb | 6 +- lib/puppet/util/network_device/config.rb | 4 +- lib/puppet/util/network_device/transport.rb | 2 +- .../util/network_device/transport/base.rb | 4 +- lib/puppet/util/package/version/range.rb | 12 +- lib/puppet/util/package/version/range/eq.rb | 2 +- lib/puppet/util/package/version/range/gt.rb | 2 +- .../util/package/version/range/gt_eq.rb | 2 +- lib/puppet/util/package/version/range/lt.rb | 2 +- .../util/package/version/range/lt_eq.rb | 2 +- .../util/package/version/range/min_max.rb | 2 +- .../util/package/version/range/simple.rb | 2 +- lib/puppet/util/package/version/rpm.rb | 2 +- lib/puppet/util/pidlock.rb | 2 +- lib/puppet/util/plist.rb | 2 +- lib/puppet/util/profiler.rb | 6 +- lib/puppet/util/profiler/aggregate.rb | 4 +- lib/puppet/util/profiler/object_counts.rb | 2 +- lib/puppet/util/profiler/wall_clock.rb | 2 +- lib/puppet/util/provider_features.rb | 4 +- lib/puppet/util/rdoc.rb | 4 +- .../util/rdoc/generators/puppet_generator.rb | 4 +- lib/puppet/util/rdoc/parser.rb | 4 +- .../util/rdoc/parser/puppet_parser_rdoc2.rb | 2 +- lib/puppet/util/reference.rb | 2 +- lib/puppet/util/resource_template.rb | 4 +- lib/puppet/util/rubygems.rb | 2 +- lib/puppet/util/skip_tags.rb | 2 +- lib/puppet/util/storage.rb | 2 +- lib/puppet/util/suidmanager.rb | 4 +- lib/puppet/util/symbolic_file_mode.rb | 2 +- lib/puppet/util/tag_set.rb | 2 +- lib/puppet/util/tagging.rb | 2 +- lib/puppet/util/watched_file.rb | 2 +- lib/puppet/util/watcher.rb | 6 +- lib/puppet/util/windows.rb | 40 +++--- .../util/windows/access_control_entry.rb | 2 +- lib/puppet/util/windows/adsi.rb | 2 +- lib/puppet/util/windows/daemon.rb | 2 +- lib/puppet/util/windows/error.rb | 4 +- lib/puppet/util/windows/file.rb | 2 +- .../util/windows/monkey_patches/process.rb | 4 +- lib/puppet/util/windows/principal.rb | 2 +- lib/puppet/util/windows/process.rb | 4 +- lib/puppet/util/windows/registry.rb | 2 +- lib/puppet/util/windows/root_certs.rb | 4 +- lib/puppet/util/windows/security.rb | 2 +- .../util/windows/security_descriptor.rb | 2 +- lib/puppet/util/windows/service.rb | 2 +- lib/puppet/util/windows/sid.rb | 2 +- lib/puppet/util/windows/user.rb | 2 +- lib/puppet/vendor.rb | 2 +- lib/puppet/x509.rb | 8 +- lib/puppet/x509/cert_provider.rb | 2 +- lib/puppet/x509/pem_store.rb | 2 +- lib/puppet_pal.rb | 4 +- 487 files changed, 1243 insertions(+), 1243 deletions(-) diff --git a/lib/hiera_puppet.rb b/lib/hiera_puppet.rb index 9b1e3581995..c9f08c85737 100644 --- a/lib/hiera_puppet.rb +++ b/lib/hiera_puppet.rb @@ -1,6 +1,6 @@ require 'hiera' require 'hiera/scope' -require 'puppet' +require_relative 'puppet' module HieraPuppet module_function diff --git a/lib/puppet.rb b/lib/puppet.rb index 493e2eb99c8..e73ad092076 100644 --- a/lib/puppet.rb +++ b/lib/puppet.rb @@ -1,5 +1,5 @@ -require 'puppet/version' -require 'puppet/concurrent/synchronized' +require_relative 'puppet/version' +require_relative 'puppet/concurrent/synchronized' if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new("2.5.0") raise LoadError, "Puppet #{Puppet.version} requires Ruby 2.5.0 or greater, found Ruby #{RUBY_VERSION.dup}." @@ -13,19 +13,19 @@ # Also see the new Vendor support - towards the end # require 'facter' -require 'puppet/error' -require 'puppet/util' -require 'puppet/util/autoload' -require 'puppet/settings' -require 'puppet/util/feature' -require 'puppet/util/suidmanager' -require 'puppet/util/run_mode' +require_relative 'puppet/error' +require_relative 'puppet/util' +require_relative 'puppet/util/autoload' +require_relative 'puppet/settings' +require_relative 'puppet/util/feature' +require_relative 'puppet/util/suidmanager' +require_relative 'puppet/util/run_mode' # PSON is deprecated, use JSON instead -require 'puppet/external/pson/common' -require 'puppet/external/pson/version' -require 'puppet/external/pson/pure' -require 'puppet/gettext/config' -require 'puppet/defaults' +require_relative 'puppet/external/pson/common' +require_relative 'puppet/external/pson/version' +require_relative 'puppet/external/pson/pure' +require_relative 'puppet/gettext/config' +require_relative 'puppet/defaults' # Defines the `Puppet` module. There are different entry points into Puppet # depending on your use case. @@ -40,10 +40,10 @@ # # @api public module Puppet - require 'puppet/file_system' - require 'puppet/etc' - require 'puppet/context' - require 'puppet/environments' + require_relative 'puppet/file_system' + require_relative 'puppet/etc' + require_relative 'puppet/context' + require_relative 'puppet/environments' class << self Puppet::GettextConfig.setup_locale @@ -85,7 +85,7 @@ def self.[](param) end end - require 'puppet/util/logging' + require_relative 'puppet/util/logging' extend Puppet::Util::Logging # Setup facter's logging @@ -95,7 +95,7 @@ def self.[](param) @features = Puppet::Util::Feature.new('puppet/feature') # Load the base features. - require 'puppet/feature/base' + require_relative 'puppet/feature/base' # setting access and stuff def self.[]=(param,value) @@ -208,7 +208,7 @@ def self.initialize_facts # Load vendored (setup paths, and load what is needed upfront). # See the Vendor class for how to add additional vendored gems/code - require 'puppet/vendor' + require_relative 'puppet/vendor' Puppet::Vendor.load_vendored # The bindings used for initialization of puppet @@ -332,12 +332,12 @@ def self.runtime @runtime end - require 'puppet/node' + require_relative 'puppet/node' # The single instance used for normal operation @context = Puppet::Context.new(bootstrap_context) - require 'puppet/runtime' + require_relative 'puppet/runtime' @runtime = Puppet::Runtime.instance end @@ -345,17 +345,17 @@ def self.runtime # anywhere besides the very top of a file. That would not be possible at the moment without a great deal of # effort, but I think we should strive for it and revisit this at some point. --cprice 2012-03-16 -require 'puppet/indirector' -require 'puppet/compilable_resource_type' -require 'puppet/type' -require 'puppet/resource' -require 'puppet/parser' -require 'puppet/network' -require 'puppet/x509' -require 'puppet/ssl' -require 'puppet/module' -require 'puppet/data_binding' -require 'puppet/util/storage' -require 'puppet/file_bucket/file' -require 'puppet/plugins/configuration' -require 'puppet/pal/pal_api' +require_relative 'puppet/indirector' +require_relative 'puppet/compilable_resource_type' +require_relative 'puppet/type' +require_relative 'puppet/resource' +require_relative 'puppet/parser' +require_relative 'puppet/network' +require_relative 'puppet/x509' +require_relative 'puppet/ssl' +require_relative 'puppet/module' +require_relative 'puppet/data_binding' +require_relative 'puppet/util/storage' +require_relative 'puppet/file_bucket/file' +require_relative 'puppet/plugins/configuration' +require_relative 'puppet/pal/pal_api' diff --git a/lib/puppet/agent.rb b/lib/puppet/agent.rb index 4f4f3dc9e1f..e927f9109fd 100644 --- a/lib/puppet/agent.rb +++ b/lib/puppet/agent.rb @@ -1,19 +1,19 @@ -require 'puppet/application' -require 'puppet/error' -require 'puppet/util/at_fork' +require_relative '../puppet/application' +require_relative '../puppet/error' +require_relative '../puppet/util/at_fork' require 'timeout' # A general class for triggering a run of another # class. class Puppet::Agent - require 'puppet/agent/locker' + require_relative 'agent/locker' include Puppet::Agent::Locker - require 'puppet/agent/disabler' + require_relative 'agent/disabler' include Puppet::Agent::Disabler - require 'puppet/util/splayer' + require_relative '../puppet/util/splayer' include Puppet::Util::Splayer # Special exception class used to signal an agent run has timed out. diff --git a/lib/puppet/agent/disabler.rb b/lib/puppet/agent/disabler.rb index 3afb64b5aca..b74baa49822 100644 --- a/lib/puppet/agent/disabler.rb +++ b/lib/puppet/agent/disabler.rb @@ -1,4 +1,4 @@ -require 'puppet/util/json_lockfile' +require_relative '../../puppet/util/json_lockfile' # This module is responsible for encapsulating the logic for # "disabling" the puppet agent during a run; in other words, diff --git a/lib/puppet/agent/locker.rb b/lib/puppet/agent/locker.rb index 282cc669e8f..f180a7317ca 100644 --- a/lib/puppet/agent/locker.rb +++ b/lib/puppet/agent/locker.rb @@ -1,5 +1,5 @@ -require 'puppet/util/pidlock' -require 'puppet/error' +require_relative '../../puppet/util/pidlock' +require_relative '../../puppet/error' # This module is responsible for encapsulating the logic for "locking" the # puppet agent during a catalog run; in other words, keeping track of enough diff --git a/lib/puppet/application.rb b/lib/puppet/application.rb index 63db26a6e82..4f0782c411b 100644 --- a/lib/puppet/application.rb +++ b/lib/puppet/application.rb @@ -1,8 +1,8 @@ require 'optparse' -require 'puppet/util/command_line' -require 'puppet/util/constant_inflector' -require 'puppet/error' -require 'puppet/application_support' +require_relative '../puppet/util/command_line' +require_relative '../puppet/util/constant_inflector' +require_relative '../puppet/error' +require_relative '../puppet/application_support' module Puppet @@ -105,7 +105,7 @@ module Puppet # @abstract # @api public class Application - require 'puppet/util' + require_relative '../puppet/util' include Puppet::Util DOCPATTERN = ::File.expand_path(::File.dirname(__FILE__) + "/util/command_line/*" ) @@ -284,7 +284,7 @@ def run_mode(mode_name = nil) return @run_mode if @run_mode and not mode_name - require 'puppet/util/run_mode' + require_relative '../puppet/util/run_mode' @run_mode = Puppet::Util::RunMode[ mode_name || Puppet.settings.preferred_run_mode ] end diff --git a/lib/puppet/application/agent.rb b/lib/puppet/application/agent.rb index ca3f8bee8c7..ae377e0206a 100644 --- a/lib/puppet/application/agent.rb +++ b/lib/puppet/application/agent.rb @@ -1,9 +1,9 @@ -require 'puppet/application' -require 'puppet/daemon' -require 'puppet/util/pidlock' -require 'puppet/agent' -require 'puppet/configurer' -require 'puppet/ssl/oids' +require_relative '../../puppet/application' +require_relative '../../puppet/daemon' +require_relative '../../puppet/util/pidlock' +require_relative '../../puppet/agent' +require_relative '../../puppet/configurer' +require_relative '../../puppet/ssl/oids' class Puppet::Application::Agent < Puppet::Application diff --git a/lib/puppet/application/apply.rb b/lib/puppet/application/apply.rb index 3628241766b..ee59b98318f 100644 --- a/lib/puppet/application/apply.rb +++ b/lib/puppet/application/apply.rb @@ -1,9 +1,9 @@ -require 'puppet/application' -require 'puppet/configurer' -require 'puppet/util/profiler/aggregate' +require_relative '../../puppet/application' +require_relative '../../puppet/configurer' +require_relative '../../puppet/util/profiler/aggregate' class Puppet::Application::Apply < Puppet::Application - require 'puppet/util/splayer' + require_relative '../../puppet/util/splayer' include Puppet::Util::Splayer option("--debug","-d") diff --git a/lib/puppet/application/catalog.rb b/lib/puppet/application/catalog.rb index 10ce05be7ff..b4bb43b5813 100644 --- a/lib/puppet/application/catalog.rb +++ b/lib/puppet/application/catalog.rb @@ -1,4 +1,4 @@ -require 'puppet/application/indirection_base' +require_relative '../../puppet/application/indirection_base' class Puppet::Application::Catalog < Puppet::Application::IndirectionBase end diff --git a/lib/puppet/application/config.rb b/lib/puppet/application/config.rb index 7fef031f6dc..ae673cb2c01 100644 --- a/lib/puppet/application/config.rb +++ b/lib/puppet/application/config.rb @@ -1,4 +1,4 @@ -require 'puppet/application/face_base' +require_relative '../../puppet/application/face_base' class Puppet::Application::Config < Puppet::Application::FaceBase environment_mode :not_required diff --git a/lib/puppet/application/describe.rb b/lib/puppet/application/describe.rb index fb320943196..f16c81ce035 100644 --- a/lib/puppet/application/describe.rb +++ b/lib/puppet/application/describe.rb @@ -1,4 +1,4 @@ -require 'puppet/application' +require_relative '../../puppet/application' class Formatter diff --git a/lib/puppet/application/device.rb b/lib/puppet/application/device.rb index b0da4a29642..034c4e676c5 100644 --- a/lib/puppet/application/device.rb +++ b/lib/puppet/application/device.rb @@ -1,7 +1,7 @@ -require 'puppet/application' -require 'puppet/configurer' -require 'puppet/util/network_device' -require 'puppet/ssl/oids' +require_relative '../../puppet/application' +require_relative '../../puppet/configurer' +require_relative '../../puppet/util/network_device' +require_relative '../../puppet/ssl/oids' class Puppet::Application::Device < Puppet::Application @@ -246,7 +246,7 @@ def main env = Puppet::Node::Environment.remote(Puppet[:environment]) returns = Puppet.override(:current_environment => env, :loaders => Puppet::Pops::Loaders.new(env)) do # find device list - require 'puppet/util/network_device/config' + require_relative '../../puppet/util/network_device/config' devices = Puppet::Util::NetworkDevice::Config.devices.dup if options[:target] devices.select! { |key, value| key == options[:target] } @@ -339,7 +339,7 @@ def main Puppet::Transaction::Report.indirection.terminus_class = :yaml Puppet::Resource::Catalog.indirection.cache_class = nil - require 'puppet/application/apply' + require_relative '../../puppet/application/apply' begin Puppet[:node_terminus] = :plain Puppet[:catalog_terminus] = :compiler diff --git a/lib/puppet/application/doc.rb b/lib/puppet/application/doc.rb index 75f037d8adc..9c3a95beeb9 100644 --- a/lib/puppet/application/doc.rb +++ b/lib/puppet/application/doc.rb @@ -1,4 +1,4 @@ -require 'puppet/application' +require_relative '../../puppet/application' class Puppet::Application::Doc < Puppet::Application run_mode :server @@ -21,7 +21,7 @@ def preinit option("--format FORMAT", "-f") do |arg| method = "to_#{arg}" - require 'puppet/util/reference' + require_relative '../../puppet/util/reference' if Puppet::Util::Reference.method_defined?(method) options[:format] = method else @@ -30,7 +30,7 @@ def preinit end option("--mode MODE", "-m") do |arg| - require 'puppet/util/reference' + require_relative '../../puppet/util/reference' if Puppet::Util::Reference.modes.include?(arg) or arg.intern==:rdoc options[:mode] = arg.intern else @@ -39,7 +39,7 @@ def preinit end option("--list", "-l") do |arg| - require 'puppet/util/reference' + require_relative '../../puppet/util/reference' refs = Puppet::Util::Reference.references(Puppet.lookup(:current_environment)) puts refs.collect { |r| Puppet::Util::Reference.reference(r).doc }.join("\n") exit(0) @@ -136,7 +136,7 @@ def rdoc Puppet.settings[:document_all] = options[:all] || false begin - require 'puppet/util/rdoc' + require_relative '../../puppet/util/rdoc' if @manifest Puppet::Util::RDoc.manifestdoc(files) else @@ -154,7 +154,7 @@ def other text = "" with_contents = options[:references].length <= 1 exit_code = 0 - require 'puppet/util/reference' + require_relative '../../puppet/util/reference' options[:references].sort_by(&:to_s).each do |name| section = Puppet::Util::Reference.reference(name) raise _("Could not find reference %{name}") % { name: name } unless section @@ -199,7 +199,7 @@ def setup def setup_reference if options[:all] # Don't add dynamic references to the "all" list. - require 'puppet/util/reference' + require_relative '../../puppet/util/reference' refs = Puppet::Util::Reference.references(Puppet.lookup(:current_environment)) options[:references] = refs.reject do |ref| Puppet::Util::Reference.reference(ref).dynamic? diff --git a/lib/puppet/application/epp.rb b/lib/puppet/application/epp.rb index 2f492ff64e9..be9225f72d2 100644 --- a/lib/puppet/application/epp.rb +++ b/lib/puppet/application/epp.rb @@ -1,5 +1,5 @@ -require 'puppet/application/face_base' -require 'puppet/face' +require_relative '../../puppet/application/face_base' +require_relative '../../puppet/face' class Puppet::Application::Epp < Puppet::Application::FaceBase end diff --git a/lib/puppet/application/face_base.rb b/lib/puppet/application/face_base.rb index c763e27657e..ee9e3c1cc2b 100644 --- a/lib/puppet/application/face_base.rb +++ b/lib/puppet/application/face_base.rb @@ -1,5 +1,5 @@ -require 'puppet/application' -require 'puppet/face' +require_relative '../../puppet/application' +require_relative '../../puppet/face' require 'optparse' require 'pp' diff --git a/lib/puppet/application/facts.rb b/lib/puppet/application/facts.rb index f080b82f613..749a083ab83 100644 --- a/lib/puppet/application/facts.rb +++ b/lib/puppet/application/facts.rb @@ -1,4 +1,4 @@ -require 'puppet/application/indirection_base' +require_relative '../../puppet/application/indirection_base' class Puppet::Application::Facts < Puppet::Application::IndirectionBase # Allows `puppet facts` actions to be run against environments that diff --git a/lib/puppet/application/filebucket.rb b/lib/puppet/application/filebucket.rb index 12856cbffb9..238c08590b0 100644 --- a/lib/puppet/application/filebucket.rb +++ b/lib/puppet/application/filebucket.rb @@ -1,4 +1,4 @@ -require 'puppet/application' +require_relative '../../puppet/application' class Puppet::Application::Filebucket < Puppet::Application @@ -298,7 +298,7 @@ def setup exit(Puppet.settings.print_configs ? 0 : 1) if Puppet.settings.print_configs? - require 'puppet/file_bucket/dipper' + require_relative '../../puppet/file_bucket/dipper' begin if options[:local] or options[:bucket] path = options[:bucket] || Puppet[:clientbucketdir] diff --git a/lib/puppet/application/generate.rb b/lib/puppet/application/generate.rb index 038eb01b7d1..32cb21980ed 100644 --- a/lib/puppet/application/generate.rb +++ b/lib/puppet/application/generate.rb @@ -1,4 +1,4 @@ -require 'puppet/application/face_base' +require_relative '../../puppet/application/face_base' # The Generate application. class Puppet::Application::Generate < Puppet::Application::FaceBase diff --git a/lib/puppet/application/help.rb b/lib/puppet/application/help.rb index 185086f2140..98358b2bb55 100644 --- a/lib/puppet/application/help.rb +++ b/lib/puppet/application/help.rb @@ -1,4 +1,4 @@ -require 'puppet/application/face_base' +require_relative '../../puppet/application/face_base' class Puppet::Application::Help < Puppet::Application::FaceBase environment_mode :not_required diff --git a/lib/puppet/application/indirection_base.rb b/lib/puppet/application/indirection_base.rb index 580a0999a7b..44bb347b8a6 100644 --- a/lib/puppet/application/indirection_base.rb +++ b/lib/puppet/application/indirection_base.rb @@ -1,4 +1,4 @@ -require 'puppet/application/face_base' +require_relative '../../puppet/application/face_base' class Puppet::Application::IndirectionBase < Puppet::Application::FaceBase end diff --git a/lib/puppet/application/lookup.rb b/lib/puppet/application/lookup.rb index 3faa8563986..75b2a9a8a10 100644 --- a/lib/puppet/application/lookup.rb +++ b/lib/puppet/application/lookup.rb @@ -1,7 +1,7 @@ -require 'puppet/application' -require 'puppet/pops' -require 'puppet/node' -require 'puppet/parser/compiler' +require_relative '../../puppet/application' +require_relative '../../puppet/pops' +require_relative '../../puppet/node' +require_relative '../../puppet/parser/compiler' class Puppet::Application::Lookup < Puppet::Application @@ -76,8 +76,8 @@ def setup_logs end def setup_terminuses - require 'puppet/file_serving/content' - require 'puppet/file_serving/metadata' + require_relative '../../puppet/file_serving/content' + require_relative '../../puppet/file_serving/metadata' Puppet::FileServing::Content.indirection.terminus_class = :file_server Puppet::FileServing::Metadata.indirection.terminus_class = :file_server diff --git a/lib/puppet/application/module.rb b/lib/puppet/application/module.rb index 8526974bc7d..7525cdffee3 100644 --- a/lib/puppet/application/module.rb +++ b/lib/puppet/application/module.rb @@ -1,4 +1,4 @@ -require 'puppet/application/face_base' +require_relative '../../puppet/application/face_base' class Puppet::Application::Module < Puppet::Application::FaceBase end diff --git a/lib/puppet/application/node.rb b/lib/puppet/application/node.rb index 38c1f861053..4931bf94bf1 100644 --- a/lib/puppet/application/node.rb +++ b/lib/puppet/application/node.rb @@ -1,4 +1,4 @@ -require 'puppet/application/indirection_base' +require_relative '../../puppet/application/indirection_base' class Puppet::Application::Node < Puppet::Application::IndirectionBase end diff --git a/lib/puppet/application/parser.rb b/lib/puppet/application/parser.rb index b6ec3c185b1..3d16e737f54 100644 --- a/lib/puppet/application/parser.rb +++ b/lib/puppet/application/parser.rb @@ -1,5 +1,5 @@ -require 'puppet/application/face_base' -require 'puppet/face' +require_relative '../../puppet/application/face_base' +require_relative '../../puppet/face' class Puppet::Application::Parser < Puppet::Application::FaceBase end diff --git a/lib/puppet/application/plugin.rb b/lib/puppet/application/plugin.rb index 06beb9eabfd..81c5c331bf0 100644 --- a/lib/puppet/application/plugin.rb +++ b/lib/puppet/application/plugin.rb @@ -1,4 +1,4 @@ -require 'puppet/application/face_base' +require_relative '../../puppet/application/face_base' class Puppet::Application::Plugin < Puppet::Application::FaceBase environment_mode :not_required end diff --git a/lib/puppet/application/report.rb b/lib/puppet/application/report.rb index f7f961eddf1..85bb5dca730 100644 --- a/lib/puppet/application/report.rb +++ b/lib/puppet/application/report.rb @@ -1,4 +1,4 @@ -require 'puppet/application/indirection_base' +require_relative '../../puppet/application/indirection_base' class Puppet::Application::Report < Puppet::Application::IndirectionBase end diff --git a/lib/puppet/application/resource.rb b/lib/puppet/application/resource.rb index 8d08807bcee..37067e87df3 100644 --- a/lib/puppet/application/resource.rb +++ b/lib/puppet/application/resource.rb @@ -1,4 +1,4 @@ -require 'puppet/application' +require_relative '../../puppet/application' class Puppet::Application::Resource < Puppet::Application diff --git a/lib/puppet/application/script.rb b/lib/puppet/application/script.rb index 50be28d0d67..8f0d409a7a6 100644 --- a/lib/puppet/application/script.rb +++ b/lib/puppet/application/script.rb @@ -1,7 +1,7 @@ -require 'puppet/application' -require 'puppet/configurer' -require 'puppet/util/profiler/aggregate' -require 'puppet/parser/script_compiler' +require_relative '../../puppet/application' +require_relative '../../puppet/configurer' +require_relative '../../puppet/util/profiler/aggregate' +require_relative '../../puppet/parser/script_compiler' class Puppet::Application::Script < Puppet::Application diff --git a/lib/puppet/application/ssl.rb b/lib/puppet/application/ssl.rb index 90a9e99bcc0..809d88ede75 100644 --- a/lib/puppet/application/ssl.rb +++ b/lib/puppet/application/ssl.rb @@ -1,5 +1,5 @@ -require 'puppet/application' -require 'puppet/ssl/oids' +require_relative '../../puppet/application' +require_relative '../../puppet/ssl/oids' class Puppet::Application::Ssl < Puppet::Application diff --git a/lib/puppet/application_support.rb b/lib/puppet/application_support.rb index b3f8a7e09bf..16c2877bdde 100644 --- a/lib/puppet/application_support.rb +++ b/lib/puppet/application_support.rb @@ -1,9 +1,9 @@ require 'yaml' -require 'puppet' -require 'puppet/node/environment' -require 'puppet/file_system' -require 'puppet/indirector' +require_relative '../puppet' +require_relative '../puppet/node/environment' +require_relative '../puppet/file_system' +require_relative '../puppet/indirector' module Puppet module ApplicationSupport diff --git a/lib/puppet/compilable_resource_type.rb b/lib/puppet/compilable_resource_type.rb index 7dd9fdcf025..c2ce6f233fb 100644 --- a/lib/puppet/compilable_resource_type.rb +++ b/lib/puppet/compilable_resource_type.rb @@ -1,4 +1,4 @@ -require 'puppet' +require_relative '../puppet' # The CompilableResourceType module should be either included in a class or used as a class extension # to mark that the instance used as the 'resource type' of a resource instance # is an object that is compatible with Puppet::Type's API wrt. compiling. diff --git a/lib/puppet/concurrent/lock.rb b/lib/puppet/concurrent/lock.rb index c815406e6b3..65fd072c191 100644 --- a/lib/puppet/concurrent/lock.rb +++ b/lib/puppet/concurrent/lock.rb @@ -1,4 +1,4 @@ -require 'puppet/concurrent/synchronized' +require_relative '../../puppet/concurrent/synchronized' module Puppet module Concurrent diff --git a/lib/puppet/configurer.rb b/lib/puppet/configurer.rb index e6c4596f360..712eb841df5 100644 --- a/lib/puppet/configurer.rb +++ b/lib/puppet/configurer.rb @@ -1,13 +1,13 @@ # The client for interacting with the puppetmaster config server. require 'timeout' -require 'puppet/util' +require_relative '../puppet/util' require 'securerandom' #require 'puppet/parser/script_compiler' -require 'puppet/pops/evaluator/deferred_resolver' +require_relative '../puppet/pops/evaluator/deferred_resolver' class Puppet::Configurer - require 'puppet/configurer/fact_handler' - require 'puppet/configurer/plugin_handler' + require_relative 'configurer/fact_handler' + require_relative 'configurer/plugin_handler' include Puppet::Configurer::FactHandler diff --git a/lib/puppet/configurer/downloader.rb b/lib/puppet/configurer/downloader.rb index debe079348a..bf00a4ef5e4 100644 --- a/lib/puppet/configurer/downloader.rb +++ b/lib/puppet/configurer/downloader.rb @@ -1,5 +1,5 @@ -require 'puppet/configurer' -require 'puppet/resource/catalog' +require_relative '../../puppet/configurer' +require_relative '../../puppet/resource/catalog' class Puppet::Configurer::Downloader attr_reader :name, :path, :source, :ignore diff --git a/lib/puppet/configurer/fact_handler.rb b/lib/puppet/configurer/fact_handler.rb index b865fc88e02..672ac63d342 100644 --- a/lib/puppet/configurer/fact_handler.rb +++ b/lib/puppet/configurer/fact_handler.rb @@ -1,7 +1,7 @@ -require 'puppet/indirector/facts/facter' +require_relative '../../puppet/indirector/facts/facter' -require 'puppet/configurer' -require 'puppet/configurer/downloader' +require_relative '../../puppet/configurer' +require_relative '../../puppet/configurer/downloader' # Break out the code related to facts. This module is # just included into the agent, but having it here makes it diff --git a/lib/puppet/configurer/plugin_handler.rb b/lib/puppet/configurer/plugin_handler.rb index f04cc02de6d..c869f8d77c1 100644 --- a/lib/puppet/configurer/plugin_handler.rb +++ b/lib/puppet/configurer/plugin_handler.rb @@ -1,7 +1,7 @@ # Break out the code related to plugins. This module is # just included into the agent, but having it here makes it # easier to test. -require 'puppet/configurer' +require_relative '../../puppet/configurer' class Puppet::Configurer::PluginHandler SUPPORTED_LOCALES_MOUNT_AGENT_VERSION = Gem::Version.new("5.3.4") diff --git a/lib/puppet/confine.rb b/lib/puppet/confine.rb index f4fc7c56cfb..c635a1c0651 100644 --- a/lib/puppet/confine.rb +++ b/lib/puppet/confine.rb @@ -1,6 +1,6 @@ # The class that handles testing whether our providers # actually work or not. -require 'puppet/util' +require_relative '../puppet/util' class Puppet::Confine include Puppet::Util diff --git a/lib/puppet/confine/boolean.rb b/lib/puppet/confine/boolean.rb index 571c3bde1e0..17085c8b75b 100644 --- a/lib/puppet/confine/boolean.rb +++ b/lib/puppet/confine/boolean.rb @@ -1,4 +1,4 @@ -require 'puppet/confine' +require_relative '../../puppet/confine' # Common module for the Boolean confines. It currently # contains just enough code to implement PUP-9336. diff --git a/lib/puppet/confine/exists.rb b/lib/puppet/confine/exists.rb index 6e29022fba9..c70c46a3e4c 100644 --- a/lib/puppet/confine/exists.rb +++ b/lib/puppet/confine/exists.rb @@ -1,4 +1,4 @@ -require 'puppet/confine' +require_relative '../../puppet/confine' class Puppet::Confine::Exists < Puppet::Confine def self.summarize(confines) diff --git a/lib/puppet/confine/false.rb b/lib/puppet/confine/false.rb index 7e9c056334f..f30f7dc94aa 100644 --- a/lib/puppet/confine/false.rb +++ b/lib/puppet/confine/false.rb @@ -1,4 +1,4 @@ -require 'puppet/confine/boolean' +require_relative '../../puppet/confine/boolean' class Puppet::Confine::False < Puppet::Confine include Puppet::Confine::Boolean diff --git a/lib/puppet/confine/feature.rb b/lib/puppet/confine/feature.rb index 5aff48a90c4..37d0b94b287 100644 --- a/lib/puppet/confine/feature.rb +++ b/lib/puppet/confine/feature.rb @@ -1,4 +1,4 @@ -require 'puppet/confine' +require_relative '../../puppet/confine' class Puppet::Confine::Feature < Puppet::Confine def self.summarize(confines) diff --git a/lib/puppet/confine/true.rb b/lib/puppet/confine/true.rb index aa1a441e12e..d00a30b1943 100644 --- a/lib/puppet/confine/true.rb +++ b/lib/puppet/confine/true.rb @@ -1,4 +1,4 @@ -require 'puppet/confine/boolean' +require_relative '../../puppet/confine/boolean' class Puppet::Confine::True < Puppet::Confine include Puppet::Confine::Boolean diff --git a/lib/puppet/confine/variable.rb b/lib/puppet/confine/variable.rb index 9102d4577b0..f228f208429 100644 --- a/lib/puppet/confine/variable.rb +++ b/lib/puppet/confine/variable.rb @@ -1,4 +1,4 @@ -require 'puppet/confine' +require_relative '../../puppet/confine' # Require a specific value for a variable, either a Puppet setting # or a Facter value. This class is a bit weird because the name diff --git a/lib/puppet/confine_collection.rb b/lib/puppet/confine_collection.rb index daa24f36064..f5943346d76 100644 --- a/lib/puppet/confine_collection.rb +++ b/lib/puppet/confine_collection.rb @@ -1,6 +1,6 @@ # Manage a collection of confines, returning a boolean or # helpful information. -require 'puppet/confine' +require_relative '../puppet/confine' class Puppet::ConfineCollection def confine(hash) diff --git a/lib/puppet/confiner.rb b/lib/puppet/confiner.rb index 50282fd9769..08dd56f84fc 100644 --- a/lib/puppet/confiner.rb +++ b/lib/puppet/confiner.rb @@ -1,4 +1,4 @@ -require 'puppet/confine_collection' +require_relative '../puppet/confine_collection' # The Confiner module contains methods for managing a Provider's confinement (suitability under given # conditions). The intent is to include this module in an object where confinement management is wanted. diff --git a/lib/puppet/context.rb b/lib/puppet/context.rb index 4839619f782..4df55acb163 100644 --- a/lib/puppet/context.rb +++ b/lib/puppet/context.rb @@ -1,4 +1,4 @@ -require 'puppet/thread_local' +require_relative '../puppet/thread_local' # Puppet::Context is a system for tracking services and contextual information # that puppet needs to be able to run. Values are "bound" in a context when it is created @@ -11,7 +11,7 @@ # # @api private class Puppet::Context - require 'puppet/context/trusted_information' + require_relative 'context/trusted_information' class UndefinedBindingError < Puppet::Error; end class StackUnderflow < Puppet::Error; end diff --git a/lib/puppet/context/trusted_information.rb b/lib/puppet/context/trusted_information.rb index e011f1c2f1c..19f49d0f07f 100644 --- a/lib/puppet/context/trusted_information.rb +++ b/lib/puppet/context/trusted_information.rb @@ -1,4 +1,4 @@ -require 'puppet/trusted_external' +require_relative '../../puppet/trusted_external' # @api private class Puppet::Context::TrustedInformation diff --git a/lib/puppet/daemon.rb b/lib/puppet/daemon.rb index d3229433036..2f7458e13d4 100644 --- a/lib/puppet/daemon.rb +++ b/lib/puppet/daemon.rb @@ -1,5 +1,5 @@ -require 'puppet/application' -require 'puppet/scheduler' +require_relative '../puppet/application' +require_relative '../puppet/scheduler' # Run periodic actions in a daemonized process. # diff --git a/lib/puppet/data_binding.rb b/lib/puppet/data_binding.rb index 62cc10db937..4bfbfc908bf 100644 --- a/lib/puppet/data_binding.rb +++ b/lib/puppet/data_binding.rb @@ -1,4 +1,4 @@ -require 'puppet/indirector' +require_relative '../puppet/indirector' # A class for managing data lookups class Puppet::DataBinding diff --git a/lib/puppet/datatypes/error.rb b/lib/puppet/datatypes/error.rb index c2e96d19ff0..28e4c87901a 100644 --- a/lib/puppet/datatypes/error.rb +++ b/lib/puppet/datatypes/error.rb @@ -15,7 +15,7 @@ } PUPPET - require 'puppet/datatypes/impl/error' + require_relative '../../puppet/datatypes/impl/error' implementation_class Puppet::DataTypes::Error end diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb index e8b8b6c4a81..2d080cb801c 100644 --- a/lib/puppet/defaults.rb +++ b/lib/puppet/defaults.rb @@ -1,4 +1,4 @@ -require 'puppet/util/platform' +require_relative '../puppet/util/platform' module Puppet @@ -219,7 +219,7 @@ def self.initialize_default_settings!(settings) as well as any translations in the report and CLI.", :hook => proc do |value| if value - require 'puppet/gettext/stubs' + require_relative '../puppet/gettext/stubs' Puppet::GettextConfig.disable_gettext end end @@ -2082,8 +2082,8 @@ def self.initialize_default_settings!(settings) # Call our hook with the default value, so we always get the libdir set. :call_hook => :on_initialize_and_write, :hook => proc do |value| - require 'puppet/node' - require 'puppet/node/facts' + require_relative '../puppet/node' + require_relative '../puppet/node/facts' if value Puppet::Resource::Catalog.indirection.set_global_setting(:cache_class, :store_configs) settings.override_default(:catalog_cache_terminus, :store_configs) diff --git a/lib/puppet/environments.rb b/lib/puppet/environments.rb index 65a12ba8a63..e10a080de5a 100644 --- a/lib/puppet/environments.rb +++ b/lib/puppet/environments.rb @@ -1,4 +1,4 @@ -require 'puppet/concurrent/synchronized' +require_relative '../puppet/concurrent/synchronized' # @api private module Puppet::Environments diff --git a/lib/puppet/etc.rb b/lib/puppet/etc.rb index 30973c7ee5d..18b5396e74d 100644 --- a/lib/puppet/etc.rb +++ b/lib/puppet/etc.rb @@ -1,4 +1,4 @@ -require 'puppet/util/character_encoding' +require_relative '../puppet/util/character_encoding' # Wrapper around Ruby Etc module allowing us to manage encoding in a single # place. # This represents a subset of Ruby's Etc module, only the methods required by Puppet. diff --git a/lib/puppet/external/pson/common.rb b/lib/puppet/external/pson/common.rb index eba6c9c60dc..2da61012315 100644 --- a/lib/puppet/external/pson/common.rb +++ b/lib/puppet/external/pson/common.rb @@ -1,4 +1,4 @@ -require 'puppet/external/pson/version' +require_relative '../../../puppet/external/pson/version' # PSON is a vendored version of pure_json v1.1.9 plus puppet patches. It # is deprecated and should not be used for future work. Use JSON instead. diff --git a/lib/puppet/external/pson/pure.rb b/lib/puppet/external/pson/pure.rb index c2afc50435f..cd6991c984a 100644 --- a/lib/puppet/external/pson/pure.rb +++ b/lib/puppet/external/pson/pure.rb @@ -1,6 +1,6 @@ -require 'puppet/external/pson/common' -require 'puppet/external/pson/pure/parser' -require 'puppet/external/pson/pure/generator' +require_relative '../../../puppet/external/pson/common' +require_relative 'pure/parser' +require_relative 'pure/generator' module PSON # This module holds all the modules/classes that implement PSON's diff --git a/lib/puppet/face.rb b/lib/puppet/face.rb index f73b2fc3b9d..ac729bfa0d6 100644 --- a/lib/puppet/face.rb +++ b/lib/puppet/face.rb @@ -8,5 +8,5 @@ # # It isn't hidden to gratuitously hide things, just to make it easier to # separate out the interests people will have. --daniel 2011-04-07 -require 'puppet/interface' +require_relative '../puppet/interface' Puppet::Face = Puppet::Interface diff --git a/lib/puppet/face/catalog.rb b/lib/puppet/face/catalog.rb index 9707d41d983..226a4762ac0 100644 --- a/lib/puppet/face/catalog.rb +++ b/lib/puppet/face/catalog.rb @@ -1,4 +1,4 @@ -require 'puppet/indirector/face' +require_relative '../../puppet/indirector/face' Puppet::Indirector::Face.define(:catalog, '0.0.1') do copyright "Puppet Inc.", 2011 diff --git a/lib/puppet/face/config.rb b/lib/puppet/face/config.rb index 052de552a14..cfcc7f78c3f 100644 --- a/lib/puppet/face/config.rb +++ b/lib/puppet/face/config.rb @@ -1,5 +1,5 @@ -require 'puppet/face' -require 'puppet/settings/ini_file' +require_relative '../../puppet/face' +require_relative '../../puppet/settings/ini_file' Puppet::Face.define(:config, '0.0.1') do extend Puppet::Util::Colors diff --git a/lib/puppet/face/epp.rb b/lib/puppet/face/epp.rb index a3d519cf612..ae861ffccc4 100644 --- a/lib/puppet/face/epp.rb +++ b/lib/puppet/face/epp.rb @@ -1,7 +1,7 @@ -require 'puppet/face' -require 'puppet/pops' -require 'puppet/parser/files' -require 'puppet/file_system' +require_relative '../../puppet/face' +require_relative '../../puppet/pops' +require_relative '../../puppet/parser/files' +require_relative '../../puppet/file_system' Puppet::Face.define(:epp, '0.0.1') do copyright "Puppet Inc.", 2014 @@ -156,7 +156,7 @@ end when_invoked do |*args| - require 'puppet/pops' + require_relative '../../puppet/pops' options = args.pop # pass a dummy node, as facts are not needed for dump options[:node] = Puppet::Node.new("testnode", :facts => Puppet::Node::Facts.new("facts", {})) @@ -382,7 +382,7 @@ def dump_parse(source, filename, options, show_filename = true) if fmt.nil? || fmt == 'old' output << Puppet::Pops::Model::ModelTreeDumper.new.dump(parse_result) << "\n" else - require 'puppet/pops/pn' + require_relative '../../puppet/pops/pn' pn = Puppet::Pops::Model::PNTransformer.transform(parse_result) case fmt when 'json' diff --git a/lib/puppet/face/facts.rb b/lib/puppet/face/facts.rb index 9d8805b9751..1c16905ac48 100644 --- a/lib/puppet/face/facts.rb +++ b/lib/puppet/face/facts.rb @@ -1,5 +1,5 @@ -require 'puppet/indirector/face' -require 'puppet/node/facts' +require_relative '../../puppet/indirector/face' +require_relative '../../puppet/node/facts' Puppet::Indirector::Face.define(:facts, '0.0.1') do copyright "Puppet Inc.", 2011 diff --git a/lib/puppet/face/generate.rb b/lib/puppet/face/generate.rb index 87967b4a2c5..d760eb79254 100644 --- a/lib/puppet/face/generate.rb +++ b/lib/puppet/face/generate.rb @@ -1,5 +1,5 @@ -require 'puppet/face' -require 'puppet/generate/type' +require_relative '../../puppet/face' +require_relative '../../puppet/generate/type' # Create the Generate face Puppet::Face.define(:generate, '0.1.0') do diff --git a/lib/puppet/face/help.rb b/lib/puppet/face/help.rb index fead1c8e213..362094094f3 100644 --- a/lib/puppet/face/help.rb +++ b/lib/puppet/face/help.rb @@ -1,6 +1,6 @@ -require 'puppet/face' -require 'puppet/application/face_base' -require 'puppet/util/constant_inflector' +require_relative '../../puppet/face' +require_relative '../../puppet/application/face_base' +require_relative '../../puppet/util/constant_inflector' require 'pathname' require 'erb' diff --git a/lib/puppet/face/module.rb b/lib/puppet/face/module.rb index 517585cfebe..dce25e2c022 100644 --- a/lib/puppet/face/module.rb +++ b/lib/puppet/face/module.rb @@ -1,6 +1,6 @@ -require 'puppet/face' -require 'puppet/module_tool' -require 'puppet/util/colors' +require_relative '../../puppet/face' +require_relative '../../puppet/module_tool' +require_relative '../../puppet/util/colors' Puppet::Face.define(:module, '1.0.0') do extend Puppet::Util::Colors diff --git a/lib/puppet/face/module/install.rb b/lib/puppet/face/module/install.rb index 62068a570c0..ad35aef1916 100644 --- a/lib/puppet/face/module/install.rb +++ b/lib/puppet/face/module/install.rb @@ -1,6 +1,6 @@ # encoding: UTF-8 -require 'puppet/forge' -require 'puppet/module_tool/install_directory' +require_relative '../../../puppet/forge' +require_relative '../../../puppet/module_tool/install_directory' require 'pathname' Puppet::Face.define(:module, '1.0.0') do diff --git a/lib/puppet/face/node.rb b/lib/puppet/face/node.rb index d2615c278fe..7610a337ace 100644 --- a/lib/puppet/face/node.rb +++ b/lib/puppet/face/node.rb @@ -1,4 +1,4 @@ -require 'puppet/indirector/face' +require_relative '../../puppet/indirector/face' Puppet::Indirector::Face.define(:node, '0.0.1') do copyright "Puppet Inc.", 2011 license _("Apache 2 license; see COPYING") diff --git a/lib/puppet/face/parser.rb b/lib/puppet/face/parser.rb index ab7dc4ff85e..e952344167b 100644 --- a/lib/puppet/face/parser.rb +++ b/lib/puppet/face/parser.rb @@ -1,5 +1,5 @@ -require 'puppet/face' -require 'puppet/parser' +require_relative '../../puppet/face' +require_relative '../../puppet/parser' Puppet::Face.define(:parser, '0.0.1') do copyright "Puppet Inc.", 2014 @@ -142,7 +142,7 @@ end when_invoked do |*args| - require 'puppet/pops' + require_relative '../../puppet/pops' options = args.pop if options[:e] dump_parse(options[:e], 'command-line-string', options, false) @@ -189,7 +189,7 @@ def dump_parse(source, filename, options, show_filename = true) if fmt.nil? || fmt == 'old' output << Puppet::Pops::Model::ModelTreeDumper.new.dump(parse_result) << "\n" else - require 'puppet/pops/pn' + require_relative '../../puppet/pops/pn' pn = Puppet::Pops::Model::PNTransformer.transform(parse_result) case fmt when 'json' diff --git a/lib/puppet/face/plugin.rb b/lib/puppet/face/plugin.rb index 562b2e4093d..4626e43b195 100644 --- a/lib/puppet/face/plugin.rb +++ b/lib/puppet/face/plugin.rb @@ -1,5 +1,5 @@ -require 'puppet/face' -require 'puppet/configurer/plugin_handler' +require_relative '../../puppet/face' +require_relative '../../puppet/configurer/plugin_handler' Puppet::Face.define(:plugin, '0.0.1') do copyright "Puppet Inc.", 2011 diff --git a/lib/puppet/face/report.rb b/lib/puppet/face/report.rb index aacc6c854d3..f6b3a884a82 100644 --- a/lib/puppet/face/report.rb +++ b/lib/puppet/face/report.rb @@ -1,4 +1,4 @@ -require 'puppet/indirector/face' +require_relative '../../puppet/indirector/face' Puppet::Indirector::Face.define(:report, '0.0.1') do copyright "Puppet Inc.", 2011 diff --git a/lib/puppet/face/resource.rb b/lib/puppet/face/resource.rb index 9b957750d81..f39bae5b74f 100644 --- a/lib/puppet/face/resource.rb +++ b/lib/puppet/face/resource.rb @@ -1,4 +1,4 @@ -require 'puppet/indirector/face' +require_relative '../../puppet/indirector/face' Puppet::Indirector::Face.define(:resource, '0.0.1') do copyright "Puppet Inc.", 2011 diff --git a/lib/puppet/feature/base.rb b/lib/puppet/feature/base.rb index dac1f6d3a08..bb3dbc0a809 100644 --- a/lib/puppet/feature/base.rb +++ b/lib/puppet/feature/base.rb @@ -1,4 +1,4 @@ -require 'puppet/util/feature' +require_relative '../../puppet/util/feature' # Add the simple features, all in one file. @@ -29,7 +29,7 @@ # We're running as root. Puppet.features.add(:root) do - require 'puppet/util/suidmanager' + require_relative '../../puppet/util/suidmanager' Puppet::Util::SUIDManager.root? end diff --git a/lib/puppet/feature/bolt.rb b/lib/puppet/feature/bolt.rb index d6e3668b847..24d2bdef354 100644 --- a/lib/puppet/feature/bolt.rb +++ b/lib/puppet/feature/bolt.rb @@ -1,3 +1,3 @@ -require 'puppet/util/feature' +require_relative '../../puppet/util/feature' Puppet.features.add(:bolt, :libs => ['bolt']) diff --git a/lib/puppet/feature/cfpropertylist.rb b/lib/puppet/feature/cfpropertylist.rb index 6ce9f4c34fc..c3dd95d6cfb 100644 --- a/lib/puppet/feature/cfpropertylist.rb +++ b/lib/puppet/feature/cfpropertylist.rb @@ -1,3 +1,3 @@ -require 'puppet/util/feature' +require_relative '../../puppet/util/feature' Puppet.features.add(:cfpropertylist, :libs => ['cfpropertylist']) diff --git a/lib/puppet/feature/eventlog.rb b/lib/puppet/feature/eventlog.rb index c8ac25d11e0..83b5a22850a 100644 --- a/lib/puppet/feature/eventlog.rb +++ b/lib/puppet/feature/eventlog.rb @@ -1,4 +1,4 @@ -require 'puppet/util/feature' +require_relative '../../puppet/util/feature' if Puppet::Util::Platform.windows? Puppet.features.add(:eventlog) diff --git a/lib/puppet/feature/hiera_eyaml.rb b/lib/puppet/feature/hiera_eyaml.rb index 512e138b27d..2e7946383b4 100644 --- a/lib/puppet/feature/hiera_eyaml.rb +++ b/lib/puppet/feature/hiera_eyaml.rb @@ -1,3 +1,3 @@ -require 'puppet/util/feature' +require_relative '../../puppet/util/feature' Puppet.features.add(:hiera_eyaml, :libs => ['hiera/backend/eyaml/parser/parser']) diff --git a/lib/puppet/feature/hocon.rb b/lib/puppet/feature/hocon.rb index 4d873283d1d..52ace0618a6 100644 --- a/lib/puppet/feature/hocon.rb +++ b/lib/puppet/feature/hocon.rb @@ -1,3 +1,3 @@ -require 'puppet/util/feature' +require_relative '../../puppet/util/feature' Puppet.features.add(:hocon, :libs => ['hocon']) diff --git a/lib/puppet/feature/libuser.rb b/lib/puppet/feature/libuser.rb index 5d8f8685d57..9004b6457f0 100644 --- a/lib/puppet/feature/libuser.rb +++ b/lib/puppet/feature/libuser.rb @@ -1,5 +1,5 @@ -require 'puppet/util/feature' -require 'puppet/util/libuser' +require_relative '../../puppet/util/feature' +require_relative '../../puppet/util/libuser' Puppet.features.add(:libuser) { File.executable?("/usr/sbin/lgroupadd") and diff --git a/lib/puppet/feature/msgpack.rb b/lib/puppet/feature/msgpack.rb index 3971a5e5b46..1c6bd39196a 100644 --- a/lib/puppet/feature/msgpack.rb +++ b/lib/puppet/feature/msgpack.rb @@ -1,3 +1,3 @@ -require 'puppet/util/feature' +require_relative '../../puppet/util/feature' Puppet.features.add(:msgpack, :libs => ["msgpack"]) diff --git a/lib/puppet/feature/pe_license.rb b/lib/puppet/feature/pe_license.rb index cdb66c19bef..867bbe62ac4 100644 --- a/lib/puppet/feature/pe_license.rb +++ b/lib/puppet/feature/pe_license.rb @@ -1,4 +1,4 @@ -require 'puppet/util/feature' +require_relative '../../puppet/util/feature' #Is the pe license library installed providing the ability to read licenses. Puppet.features.add(:pe_license, :libs => %{pe_license}) diff --git a/lib/puppet/feature/selinux.rb b/lib/puppet/feature/selinux.rb index 84be239fc38..59f95be72dc 100644 --- a/lib/puppet/feature/selinux.rb +++ b/lib/puppet/feature/selinux.rb @@ -1,3 +1,3 @@ -require 'puppet/util/feature' +require_relative '../../puppet/util/feature' Puppet.features.add(:selinux, :libs => ["selinux"]) diff --git a/lib/puppet/feature/ssh.rb b/lib/puppet/feature/ssh.rb index ab2cc1d6b5c..3bb7e3627bb 100644 --- a/lib/puppet/feature/ssh.rb +++ b/lib/puppet/feature/ssh.rb @@ -1,3 +1,3 @@ -require 'puppet/util/feature' +require_relative '../../puppet/util/feature' Puppet.features.add(:ssh, :libs => %{net/ssh}) diff --git a/lib/puppet/feature/telnet.rb b/lib/puppet/feature/telnet.rb index e50ebaf381d..bf60a63d6f5 100644 --- a/lib/puppet/feature/telnet.rb +++ b/lib/puppet/feature/telnet.rb @@ -1,4 +1,4 @@ -require 'puppet/util/feature' +require_relative '../../puppet/util/feature' Puppet.features.add :telnet do begin diff --git a/lib/puppet/feature/zlib.rb b/lib/puppet/feature/zlib.rb index 0366e21926c..1032821863f 100644 --- a/lib/puppet/feature/zlib.rb +++ b/lib/puppet/feature/zlib.rb @@ -1,4 +1,4 @@ -require 'puppet/util/feature' +require_relative '../../puppet/util/feature' # We want this to load if possible, but it's not automatically # required. diff --git a/lib/puppet/ffi/posix.rb b/lib/puppet/ffi/posix.rb index 1a1641d2dc8..8dbd927c903 100644 --- a/lib/puppet/ffi/posix.rb +++ b/lib/puppet/ffi/posix.rb @@ -3,8 +3,8 @@ module Puppet module FFI module POSIX - require 'puppet/ffi/posix/functions' - require 'puppet/ffi/posix/constants' + require_relative 'posix/functions' + require_relative 'posix/constants' end end end diff --git a/lib/puppet/ffi/posix/constants.rb b/lib/puppet/ffi/posix/constants.rb index ab1dc9c2138..5fc40e520bd 100644 --- a/lib/puppet/ffi/posix/constants.rb +++ b/lib/puppet/ffi/posix/constants.rb @@ -1,4 +1,4 @@ -require 'puppet/ffi/posix' +require_relative '../../../puppet/ffi/posix' module Puppet::FFI::POSIX module Constants diff --git a/lib/puppet/ffi/posix/functions.rb b/lib/puppet/ffi/posix/functions.rb index 6d7bbd06a9a..8ae85759224 100644 --- a/lib/puppet/ffi/posix/functions.rb +++ b/lib/puppet/ffi/posix/functions.rb @@ -1,4 +1,4 @@ -require 'puppet/ffi/posix' +require_relative '../../../puppet/ffi/posix' module Puppet::FFI::POSIX module Functions diff --git a/lib/puppet/ffi/windows.rb b/lib/puppet/ffi/windows.rb index c3fe12e9381..7cffed2b2e7 100644 --- a/lib/puppet/ffi/windows.rb +++ b/lib/puppet/ffi/windows.rb @@ -3,10 +3,10 @@ module Puppet module FFI module Windows - require 'puppet/ffi/windows/api_types' - require 'puppet/ffi/windows/constants' - require 'puppet/ffi/windows/structs' - require 'puppet/ffi/windows/functions' + require_relative 'windows/api_types' + require_relative 'windows/constants' + require_relative 'windows/structs' + require_relative 'windows/functions' end end end diff --git a/lib/puppet/ffi/windows/api_types.rb b/lib/puppet/ffi/windows/api_types.rb index 1fe48151bc8..2728dd9bfdb 100644 --- a/lib/puppet/ffi/windows/api_types.rb +++ b/lib/puppet/ffi/windows/api_types.rb @@ -1,5 +1,5 @@ -require 'puppet/ffi/windows' -require 'puppet/util/windows/string' +require_relative '../../../puppet/ffi/windows' +require_relative '../../../puppet/util/windows/string' module Puppet::FFI::Windows module APITypes diff --git a/lib/puppet/ffi/windows/constants.rb b/lib/puppet/ffi/windows/constants.rb index 1ebfceb2925..ee561880b34 100644 --- a/lib/puppet/ffi/windows/constants.rb +++ b/lib/puppet/ffi/windows/constants.rb @@ -1,4 +1,4 @@ -require 'puppet/ffi/windows' +require_relative '../../../puppet/ffi/windows' module Puppet::FFI::Windows module Constants diff --git a/lib/puppet/ffi/windows/functions.rb b/lib/puppet/ffi/windows/functions.rb index 12534142985..a3495b6c2ec 100644 --- a/lib/puppet/ffi/windows/functions.rb +++ b/lib/puppet/ffi/windows/functions.rb @@ -1,4 +1,4 @@ -require 'puppet/ffi/windows' +require_relative '../../../puppet/ffi/windows' module Puppet::FFI::Windows module Functions diff --git a/lib/puppet/ffi/windows/structs.rb b/lib/puppet/ffi/windows/structs.rb index be9b382f43d..00adc542695 100644 --- a/lib/puppet/ffi/windows/structs.rb +++ b/lib/puppet/ffi/windows/structs.rb @@ -1,5 +1,5 @@ # coding: utf-8 -require 'puppet/ffi/windows' +require_relative '../../../puppet/ffi/windows' module Puppet::FFI::Windows module Structs diff --git a/lib/puppet/file_bucket/dipper.rb b/lib/puppet/file_bucket/dipper.rb index 54eecf25c7f..102452e4494 100644 --- a/lib/puppet/file_bucket/dipper.rb +++ b/lib/puppet/file_bucket/dipper.rb @@ -1,8 +1,8 @@ require 'pathname' -require 'puppet/file_bucket' -require 'puppet/file_bucket/file' -require 'puppet/indirector/request' -require 'puppet/util/diff' +require_relative '../../puppet/file_bucket' +require_relative '../../puppet/file_bucket/file' +require_relative '../../puppet/indirector/request' +require_relative '../../puppet/util/diff' require 'tempfile' class Puppet::FileBucket::Dipper diff --git a/lib/puppet/file_bucket/file.rb b/lib/puppet/file_bucket/file.rb index b529b9d0f0e..d5dfe52904b 100644 --- a/lib/puppet/file_bucket/file.rb +++ b/lib/puppet/file_bucket/file.rb @@ -1,6 +1,6 @@ -require 'puppet/file_bucket' -require 'puppet/indirector' -require 'puppet/util/checksums' +require_relative '../../puppet/file_bucket' +require_relative '../../puppet/indirector' +require_relative '../../puppet/util/checksums' require 'digest/md5' require 'stringio' diff --git a/lib/puppet/file_serving/base.rb b/lib/puppet/file_serving/base.rb index e2683d152b4..0cf8e071a94 100644 --- a/lib/puppet/file_serving/base.rb +++ b/lib/puppet/file_serving/base.rb @@ -1,5 +1,5 @@ -require 'puppet/file_serving' -require 'puppet/util' +require_relative '../../puppet/file_serving' +require_relative '../../puppet/util' # The base class for Content and Metadata; provides common # functionality like the behaviour around links. diff --git a/lib/puppet/file_serving/configuration.rb b/lib/puppet/file_serving/configuration.rb index fd26057f8f8..18f9cf65006 100644 --- a/lib/puppet/file_serving/configuration.rb +++ b/lib/puppet/file_serving/configuration.rb @@ -1,15 +1,15 @@ -require 'puppet' -require 'puppet/file_serving' -require 'puppet/file_serving/mount' -require 'puppet/file_serving/mount/file' -require 'puppet/file_serving/mount/modules' -require 'puppet/file_serving/mount/plugins' -require 'puppet/file_serving/mount/locales' -require 'puppet/file_serving/mount/pluginfacts' -require 'puppet/file_serving/mount/tasks' +require_relative '../../puppet' +require_relative '../../puppet/file_serving' +require_relative '../../puppet/file_serving/mount' +require_relative '../../puppet/file_serving/mount/file' +require_relative '../../puppet/file_serving/mount/modules' +require_relative '../../puppet/file_serving/mount/plugins' +require_relative '../../puppet/file_serving/mount/locales' +require_relative '../../puppet/file_serving/mount/pluginfacts' +require_relative '../../puppet/file_serving/mount/tasks' class Puppet::FileServing::Configuration - require 'puppet/file_serving/configuration/parser' + require_relative 'configuration/parser' def self.configuration @configuration ||= new diff --git a/lib/puppet/file_serving/configuration/parser.rb b/lib/puppet/file_serving/configuration/parser.rb index cec982ef81d..5488ea35599 100644 --- a/lib/puppet/file_serving/configuration/parser.rb +++ b/lib/puppet/file_serving/configuration/parser.rb @@ -1,5 +1,5 @@ -require 'puppet/file_serving/configuration' -require 'puppet/util/watched_file' +require_relative '../../../puppet/file_serving/configuration' +require_relative '../../../puppet/util/watched_file' class Puppet::FileServing::Configuration::Parser Mount = Puppet::FileServing::Mount diff --git a/lib/puppet/file_serving/content.rb b/lib/puppet/file_serving/content.rb index 6fe1efd9616..af8198cd298 100644 --- a/lib/puppet/file_serving/content.rb +++ b/lib/puppet/file_serving/content.rb @@ -1,6 +1,6 @@ -require 'puppet/indirector' -require 'puppet/file_serving' -require 'puppet/file_serving/base' +require_relative '../../puppet/indirector' +require_relative '../../puppet/file_serving' +require_relative '../../puppet/file_serving/base' # A class that handles retrieving file contents. # It only reads the file when its content is specifically diff --git a/lib/puppet/file_serving/fileset.rb b/lib/puppet/file_serving/fileset.rb index cbfcc751732..adfab091b2b 100644 --- a/lib/puppet/file_serving/fileset.rb +++ b/lib/puppet/file_serving/fileset.rb @@ -1,6 +1,6 @@ require 'find' -require 'puppet/file_serving' -require 'puppet/file_serving/metadata' +require_relative '../../puppet/file_serving' +require_relative '../../puppet/file_serving/metadata' # Operate recursively on a path, returning a set of file paths. class Puppet::FileServing::Fileset diff --git a/lib/puppet/file_serving/http_metadata.rb b/lib/puppet/file_serving/http_metadata.rb index 2aa5f62941f..ee92523f5e9 100644 --- a/lib/puppet/file_serving/http_metadata.rb +++ b/lib/puppet/file_serving/http_metadata.rb @@ -1,4 +1,4 @@ -require 'puppet/file_serving/metadata' +require_relative '../../puppet/file_serving/metadata' # Simplified metadata representation, suitable for the information # that is available from HTTP headers. diff --git a/lib/puppet/file_serving/metadata.rb b/lib/puppet/file_serving/metadata.rb index 61368dbb430..9858c742780 100644 --- a/lib/puppet/file_serving/metadata.rb +++ b/lib/puppet/file_serving/metadata.rb @@ -1,8 +1,8 @@ -require 'puppet' -require 'puppet/indirector' -require 'puppet/file_serving' -require 'puppet/file_serving/base' -require 'puppet/util/checksums' +require_relative '../../puppet' +require_relative '../../puppet/indirector' +require_relative '../../puppet/file_serving' +require_relative '../../puppet/file_serving/base' +require_relative '../../puppet/util/checksums' require 'uri' # A class that handles retrieving file metadata. @@ -66,7 +66,7 @@ def mode class WindowsStat < MetaStat if Puppet::Util::Platform.windows? - require 'puppet/util/windows/security' + require_relative '../../puppet/util/windows/security' end def initialize(stat, path, source_permissions) diff --git a/lib/puppet/file_serving/mount.rb b/lib/puppet/file_serving/mount.rb index 74a145e5e72..a5568d4226a 100644 --- a/lib/puppet/file_serving/mount.rb +++ b/lib/puppet/file_serving/mount.rb @@ -1,7 +1,7 @@ -require 'puppet/util/logging' -require 'puppet/file_serving' -require 'puppet/file_serving/metadata' -require 'puppet/file_serving/content' +require_relative '../../puppet/util/logging' +require_relative '../../puppet/file_serving' +require_relative '../../puppet/file_serving/metadata' +require_relative '../../puppet/file_serving/content' # Broker access to the filesystem, converting local URIs into metadata # or content objects. diff --git a/lib/puppet/file_serving/mount/file.rb b/lib/puppet/file_serving/mount/file.rb index 095da55a5ee..e919ee2febc 100644 --- a/lib/puppet/file_serving/mount/file.rb +++ b/lib/puppet/file_serving/mount/file.rb @@ -1,4 +1,4 @@ -require 'puppet/file_serving/mount' +require_relative '../../../puppet/file_serving/mount' class Puppet::FileServing::Mount::File < Puppet::FileServing::Mount def self.localmap diff --git a/lib/puppet/file_serving/mount/locales.rb b/lib/puppet/file_serving/mount/locales.rb index 73f95874bba..32b4c7238b8 100644 --- a/lib/puppet/file_serving/mount/locales.rb +++ b/lib/puppet/file_serving/mount/locales.rb @@ -1,4 +1,4 @@ -require 'puppet/file_serving/mount' +require_relative '../../../puppet/file_serving/mount' # Find files in the modules' locales directories. # This is a very strange mount because it merges diff --git a/lib/puppet/file_serving/mount/modules.rb b/lib/puppet/file_serving/mount/modules.rb index c2ebdd5d5df..2efcbd171d1 100644 --- a/lib/puppet/file_serving/mount/modules.rb +++ b/lib/puppet/file_serving/mount/modules.rb @@ -1,4 +1,4 @@ -require 'puppet/file_serving/mount' +require_relative '../../../puppet/file_serving/mount' # This is the modules-specific mount: it knows how to search through # modules for files. Yay. diff --git a/lib/puppet/file_serving/mount/pluginfacts.rb b/lib/puppet/file_serving/mount/pluginfacts.rb index b77da03aecd..3ec4456986f 100644 --- a/lib/puppet/file_serving/mount/pluginfacts.rb +++ b/lib/puppet/file_serving/mount/pluginfacts.rb @@ -1,4 +1,4 @@ -require 'puppet/file_serving/mount' +require_relative '../../../puppet/file_serving/mount' # Find files in the modules' pluginfacts directories. # This is a very strange mount because it merges diff --git a/lib/puppet/file_serving/mount/plugins.rb b/lib/puppet/file_serving/mount/plugins.rb index a16fb522999..cc705b1f43b 100644 --- a/lib/puppet/file_serving/mount/plugins.rb +++ b/lib/puppet/file_serving/mount/plugins.rb @@ -1,4 +1,4 @@ -require 'puppet/file_serving/mount' +require_relative '../../../puppet/file_serving/mount' # Find files in the modules' plugins directories. # This is a very strange mount because it merges diff --git a/lib/puppet/file_serving/mount/tasks.rb b/lib/puppet/file_serving/mount/tasks.rb index e296fa79609..99667faa2d0 100644 --- a/lib/puppet/file_serving/mount/tasks.rb +++ b/lib/puppet/file_serving/mount/tasks.rb @@ -1,4 +1,4 @@ -require 'puppet/file_serving/mount' +require_relative '../../../puppet/file_serving/mount' class Puppet::FileServing::Mount::Tasks < Puppet::FileServing::Mount def find(path, request) diff --git a/lib/puppet/file_serving/terminus_helper.rb b/lib/puppet/file_serving/terminus_helper.rb index 767d6b369d6..986b8f01dc2 100644 --- a/lib/puppet/file_serving/terminus_helper.rb +++ b/lib/puppet/file_serving/terminus_helper.rb @@ -1,5 +1,5 @@ -require 'puppet/file_serving' -require 'puppet/file_serving/fileset' +require_relative '../../puppet/file_serving' +require_relative '../../puppet/file_serving/fileset' # Define some common methods for FileServing termini. diff --git a/lib/puppet/file_serving/terminus_selector.rb b/lib/puppet/file_serving/terminus_selector.rb index 0d517eb20ad..19efd1ae141 100644 --- a/lib/puppet/file_serving/terminus_selector.rb +++ b/lib/puppet/file_serving/terminus_selector.rb @@ -1,4 +1,4 @@ -require 'puppet/file_serving' +require_relative '../../puppet/file_serving' # This module is used to pick the appropriate terminus # in file-serving indirections. This is necessary because diff --git a/lib/puppet/file_system.rb b/lib/puppet/file_system.rb index e55ef16fc8f..b3676ee7aca 100644 --- a/lib/puppet/file_system.rb +++ b/lib/puppet/file_system.rb @@ -1,20 +1,20 @@ module Puppet::FileSystem - require 'puppet/util' - require 'puppet/file_system/path_pattern' - require 'puppet/file_system/file_impl' - require 'puppet/file_system/memory_file' - require 'puppet/file_system/memory_impl' - require 'puppet/file_system/uniquefile' + require_relative '../puppet/util' + require_relative 'file_system/path_pattern' + require_relative 'file_system/file_impl' + require_relative 'file_system/memory_file' + require_relative 'file_system/memory_impl' + require_relative 'file_system/uniquefile' # create instance of the file system implementation to use for the current platform @impl = if Puppet::Util::Platform.windows? - require 'puppet/file_system/windows' + require_relative 'file_system/windows' Puppet::FileSystem::Windows elsif Puppet::Util::Platform.jruby? - require 'puppet/file_system/jruby' + require_relative 'file_system/jruby' Puppet::FileSystem::JRuby else - require 'puppet/file_system/posix' + require_relative 'file_system/posix' Puppet::FileSystem::Posix end.new() diff --git a/lib/puppet/file_system/jruby.rb b/lib/puppet/file_system/jruby.rb index 5973e72cc3a..b4af3370391 100644 --- a/lib/puppet/file_system/jruby.rb +++ b/lib/puppet/file_system/jruby.rb @@ -1,4 +1,4 @@ -require 'puppet/file_system/posix' +require_relative '../../puppet/file_system/posix' class Puppet::FileSystem::JRuby < Puppet::FileSystem::Posix def unlink(*paths) diff --git a/lib/puppet/file_system/path_pattern.rb b/lib/puppet/file_system/path_pattern.rb index ab46429dfff..c7f0efcc76f 100644 --- a/lib/puppet/file_system/path_pattern.rb +++ b/lib/puppet/file_system/path_pattern.rb @@ -1,5 +1,5 @@ require 'pathname' -require 'puppet/error' +require_relative '../../puppet/error' module Puppet::FileSystem class PathPattern diff --git a/lib/puppet/file_system/uniquefile.rb b/lib/puppet/file_system/uniquefile.rb index 594711a63f7..b7616eb935c 100644 --- a/lib/puppet/file_system/uniquefile.rb +++ b/lib/puppet/file_system/uniquefile.rb @@ -1,4 +1,4 @@ -require 'puppet/file_system' +require_relative '../../puppet/file_system' require 'delegate' require 'tmpdir' diff --git a/lib/puppet/file_system/windows.rb b/lib/puppet/file_system/windows.rb index 1d5e9f95b42..006165a2037 100644 --- a/lib/puppet/file_system/windows.rb +++ b/lib/puppet/file_system/windows.rb @@ -1,5 +1,5 @@ -require 'puppet/file_system/posix' -require 'puppet/util/windows' +require_relative '../../puppet/file_system/posix' +require_relative '../../puppet/util/windows' class Puppet::FileSystem::Windows < Puppet::FileSystem::Posix FULL_CONTROL = Puppet::Util::Windows::File::FILE_ALL_ACCESS diff --git a/lib/puppet/forge.rb b/lib/puppet/forge.rb index bc162ae46a2..efca513d2ce 100644 --- a/lib/puppet/forge.rb +++ b/lib/puppet/forge.rb @@ -1,17 +1,17 @@ -require 'puppet/vendor' +require_relative '../puppet/vendor' Puppet::Vendor.load_vendored require 'net/http' require 'tempfile' require 'uri' require 'pathname' -require 'puppet/util/json' +require_relative '../puppet/util/json' require 'semantic_puppet' class Puppet::Forge < SemanticPuppet::Dependency::Source - require 'puppet/forge/cache' - require 'puppet/forge/repository' - require 'puppet/forge/errors' + require_relative 'forge/cache' + require_relative 'forge/repository' + require_relative 'forge/errors' include Puppet::Forge::Errors diff --git a/lib/puppet/forge/cache.rb b/lib/puppet/forge/cache.rb index 8c283f117fe..69b58937926 100644 --- a/lib/puppet/forge/cache.rb +++ b/lib/puppet/forge/cache.rb @@ -1,6 +1,6 @@ require 'uri' -require 'puppet/forge' +require_relative '../../puppet/forge' class Puppet::Forge # = Cache diff --git a/lib/puppet/forge/errors.rb b/lib/puppet/forge/errors.rb index 038e9165cc7..78594d1d9fb 100644 --- a/lib/puppet/forge/errors.rb +++ b/lib/puppet/forge/errors.rb @@ -1,6 +1,6 @@ -require 'puppet/util/json' -require 'puppet/error' -require 'puppet/forge' +require_relative '../../puppet/util/json' +require_relative '../../puppet/error' +require_relative '../../puppet/forge' # Puppet::Forge specific exceptions module Puppet::Forge::Errors diff --git a/lib/puppet/forge/repository.rb b/lib/puppet/forge/repository.rb index 50a91ba96b1..47fe775aa4f 100644 --- a/lib/puppet/forge/repository.rb +++ b/lib/puppet/forge/repository.rb @@ -1,9 +1,9 @@ -require 'puppet/ssl/openssl_loader' +require_relative '../../puppet/ssl/openssl_loader' require 'digest/sha1' require 'uri' -require 'puppet/forge' -require 'puppet/forge/errors' -require 'puppet/network/http' +require_relative '../../puppet/forge' +require_relative '../../puppet/forge/errors' +require_relative '../../puppet/network/http' class Puppet::Forge # = Repository diff --git a/lib/puppet/functions/versioncmp.rb b/lib/puppet/functions/versioncmp.rb index 95a047fd836..fbd73df7299 100644 --- a/lib/puppet/functions/versioncmp.rb +++ b/lib/puppet/functions/versioncmp.rb @@ -1,4 +1,4 @@ -require 'puppet/util/package' +require_relative '../../puppet/util/package' # Compares two version numbers. # diff --git a/lib/puppet/generate/models/type/type.rb b/lib/puppet/generate/models/type/type.rb index 245b9b13a06..51740b35463 100644 --- a/lib/puppet/generate/models/type/type.rb +++ b/lib/puppet/generate/models/type/type.rb @@ -1,4 +1,4 @@ -require 'puppet/generate/models/type/property' +require_relative '../../../../puppet/generate/models/type/property' module Puppet module Generate diff --git a/lib/puppet/generate/type.rb b/lib/puppet/generate/type.rb index 8dded6bde29..9d71aae07c6 100644 --- a/lib/puppet/generate/type.rb +++ b/lib/puppet/generate/type.rb @@ -1,7 +1,7 @@ require 'erb' require 'fileutils' -require 'puppet/util/autoload' -require 'puppet/generate/models/type/type' +require_relative '../../puppet/util/autoload' +require_relative '../../puppet/generate/models/type/type' module Puppet module Generate diff --git a/lib/puppet/gettext/config.rb b/lib/puppet/gettext/config.rb index 4dd7502e8e9..604e38571b4 100644 --- a/lib/puppet/gettext/config.rb +++ b/lib/puppet/gettext/config.rb @@ -1,5 +1,5 @@ -require 'puppet/util/platform' -require 'puppet/file_system' +require_relative '../../puppet/util/platform' +require_relative '../../puppet/file_system' module Puppet::GettextConfig LOCAL_PATH = File.absolute_path('../../../locales', File.dirname(__FILE__)) @@ -24,7 +24,7 @@ class ::Object rescue LoadError # Stub out gettext's `_` and `n_()` methods, which attempt to load translations, # with versions that do nothing - require 'puppet/gettext/stubs' + require_relative '../../puppet/gettext/stubs' @gettext_loaded = false end diff --git a/lib/puppet/gettext/module_translations.rb b/lib/puppet/gettext/module_translations.rb index 4767f28232e..6a26091ed18 100644 --- a/lib/puppet/gettext/module_translations.rb +++ b/lib/puppet/gettext/module_translations.rb @@ -1,4 +1,4 @@ -require 'puppet/gettext/config' +require_relative '../../puppet/gettext/config' module Puppet::ModuleTranslations diff --git a/lib/puppet/graph.rb b/lib/puppet/graph.rb index c3d05258e48..7a1d29a8c0a 100644 --- a/lib/puppet/graph.rb +++ b/lib/puppet/graph.rb @@ -1,9 +1,9 @@ module Puppet::Graph - require 'puppet/graph/prioritizer' - require 'puppet/graph/sequential_prioritizer' + require_relative 'graph/prioritizer' + require_relative 'graph/sequential_prioritizer' - require 'puppet/graph/simple_graph' - require 'puppet/graph/rb_tree_map' - require 'puppet/graph/key' - require 'puppet/graph/relationship_graph' + require_relative 'graph/simple_graph' + require_relative 'graph/rb_tree_map' + require_relative 'graph/key' + require_relative 'graph/relationship_graph' end diff --git a/lib/puppet/graph/simple_graph.rb b/lib/puppet/graph/simple_graph.rb index 28cca8bd4b1..9b416736d36 100644 --- a/lib/puppet/graph/simple_graph.rb +++ b/lib/puppet/graph/simple_graph.rb @@ -1,5 +1,5 @@ -require 'puppet/external/dot' -require 'puppet/relationship' +require_relative '../../puppet/external/dot' +require_relative '../../puppet/relationship' require 'set' # A hopefully-faster graph class to replace the use of GRATR. diff --git a/lib/puppet/http.rb b/lib/puppet/http.rb index d4e9cb3a1e9..e87a91485ca 100644 --- a/lib/puppet/http.rb +++ b/lib/puppet/http.rb @@ -10,37 +10,37 @@ module HTTP ACCEPT_ENCODING = "gzip;q=1.0,deflate;q=0.6,identity;q=0.3".freeze HEADER_PUPPET_VERSION = "X-Puppet-Version".freeze - require 'puppet/http/errors' - require 'puppet/http/site' - require 'puppet/http/pool_entry' - require 'puppet/http/proxy' - require 'puppet/http/factory' - require 'puppet/http/pool' - require 'puppet/http/dns' - require 'puppet/http/response' - require 'puppet/http/response_converter' - require 'puppet/http/response_net_http' - require 'puppet/http/service' - require 'puppet/http/service/ca' - require 'puppet/http/service/compiler' - require 'puppet/http/service/file_server' - require 'puppet/http/service/puppetserver' - require 'puppet/http/service/report' - require 'puppet/http/session' - require 'puppet/http/resolver' - require 'puppet/http/resolver/server_list' - require 'puppet/http/resolver/settings' - require 'puppet/http/resolver/srv' - require 'puppet/http/client' - require 'puppet/http/redirector' - require 'puppet/http/retry_after_handler' - require 'puppet/http/external_client' + require_relative 'http/errors' + require_relative 'http/site' + require_relative 'http/pool_entry' + require_relative 'http/proxy' + require_relative 'http/factory' + require_relative 'http/pool' + require_relative 'http/dns' + require_relative 'http/response' + require_relative 'http/response_converter' + require_relative 'http/response_net_http' + require_relative 'http/service' + require_relative 'http/service/ca' + require_relative 'http/service/compiler' + require_relative 'http/service/file_server' + require_relative 'http/service/puppetserver' + require_relative 'http/service/report' + require_relative 'http/session' + require_relative 'http/resolver' + require_relative 'http/resolver/server_list' + require_relative 'http/resolver/settings' + require_relative 'http/resolver/srv' + require_relative 'http/client' + require_relative 'http/redirector' + require_relative 'http/retry_after_handler' + require_relative 'http/external_client' end # Legacy HTTP API module Network module HTTP - require 'puppet/network/http_pool' + require_relative '../puppet/network/http_pool' end end end diff --git a/lib/puppet/http/factory.rb b/lib/puppet/http/factory.rb index 296d8dcc7e1..92b215fc5ff 100644 --- a/lib/puppet/http/factory.rb +++ b/lib/puppet/http/factory.rb @@ -1,6 +1,6 @@ -require 'puppet/ssl/openssl_loader' +require_relative '../../puppet/ssl/openssl_loader' require 'net/http' -require 'puppet/http' +require_relative '../../puppet/http' # Factory for `Net::HTTP` objects. # diff --git a/lib/puppet/http/proxy.rb b/lib/puppet/http/proxy.rb index d3fdaa7ca09..51b8ca7933c 100644 --- a/lib/puppet/http/proxy.rb +++ b/lib/puppet/http/proxy.rb @@ -1,5 +1,5 @@ require 'uri' -require 'puppet/ssl/openssl_loader' +require_relative '../../puppet/ssl/openssl_loader' module Puppet::HTTP::Proxy def self.proxy(uri) diff --git a/lib/puppet/http/service/file_server.rb b/lib/puppet/http/service/file_server.rb index 6c0084ee8ae..e946fc56736 100644 --- a/lib/puppet/http/service/file_server.rb +++ b/lib/puppet/http/service/file_server.rb @@ -1,4 +1,4 @@ -require 'puppet/file_serving/metadata' +require_relative '../../../puppet/file_serving/metadata' # The FileServer service is used to retrieve file metadata and content. # diff --git a/lib/puppet/indirector.rb b/lib/puppet/indirector.rb index 26dbe0b41c0..07d5696f6d0 100644 --- a/lib/puppet/indirector.rb +++ b/lib/puppet/indirector.rb @@ -7,11 +7,11 @@ module Puppet::Indirector # LAK:FIXME We need to figure out how to handle documentation for the # different indirection types. - require 'puppet/indirector/indirection' - require 'puppet/indirector/terminus' - require 'puppet/indirector/code' - require 'puppet/indirector/envelope' - require 'puppet/network/format_support' + require_relative 'indirector/indirection' + require_relative 'indirector/terminus' + require_relative 'indirector/code' + require_relative 'indirector/envelope' + require_relative '../puppet/network/format_support' def self.configure_routes(application_routes) application_routes.each do |indirection_name, termini| diff --git a/lib/puppet/indirector/catalog/compiler.rb b/lib/puppet/indirector/catalog/compiler.rb index 85f4a56a37b..def196946fe 100644 --- a/lib/puppet/indirector/catalog/compiler.rb +++ b/lib/puppet/indirector/catalog/compiler.rb @@ -1,9 +1,9 @@ -require 'puppet/environments' -require 'puppet/node' -require 'puppet/resource/catalog' -require 'puppet/indirector/code' -require 'puppet/util/profiler' -require 'puppet/util/checksums' +require_relative '../../../puppet/environments' +require_relative '../../../puppet/node' +require_relative '../../../puppet/resource/catalog' +require_relative '../../../puppet/indirector/code' +require_relative '../../../puppet/util/profiler' +require_relative '../../../puppet/util/checksums' require 'yaml' require 'uri' diff --git a/lib/puppet/indirector/catalog/json.rb b/lib/puppet/indirector/catalog/json.rb index 5f3817a23a8..659a2f9b144 100644 --- a/lib/puppet/indirector/catalog/json.rb +++ b/lib/puppet/indirector/catalog/json.rb @@ -1,5 +1,5 @@ -require 'puppet/resource/catalog' -require 'puppet/indirector/json' +require_relative '../../../puppet/resource/catalog' +require_relative '../../../puppet/indirector/json' class Puppet::Resource::Catalog::Json < Puppet::Indirector::JSON desc "Store catalogs as flat files, serialized using JSON." diff --git a/lib/puppet/indirector/catalog/msgpack.rb b/lib/puppet/indirector/catalog/msgpack.rb index a0e5bfd7622..e80816a34fc 100644 --- a/lib/puppet/indirector/catalog/msgpack.rb +++ b/lib/puppet/indirector/catalog/msgpack.rb @@ -1,5 +1,5 @@ -require 'puppet/resource/catalog' -require 'puppet/indirector/msgpack' +require_relative '../../../puppet/resource/catalog' +require_relative '../../../puppet/indirector/msgpack' class Puppet::Resource::Catalog::Msgpack < Puppet::Indirector::Msgpack desc "Store catalogs as flat files, serialized using MessagePack." diff --git a/lib/puppet/indirector/catalog/rest.rb b/lib/puppet/indirector/catalog/rest.rb index 00681f7f0d1..12c05f9163c 100644 --- a/lib/puppet/indirector/catalog/rest.rb +++ b/lib/puppet/indirector/catalog/rest.rb @@ -1,5 +1,5 @@ -require 'puppet/resource/catalog' -require 'puppet/indirector/rest' +require_relative '../../../puppet/resource/catalog' +require_relative '../../../puppet/indirector/rest' class Puppet::Resource::Catalog::Rest < Puppet::Indirector::REST desc "Find resource catalogs over HTTP via REST." diff --git a/lib/puppet/indirector/catalog/store_configs.rb b/lib/puppet/indirector/catalog/store_configs.rb index e2921b20d66..29606e7fe1f 100644 --- a/lib/puppet/indirector/catalog/store_configs.rb +++ b/lib/puppet/indirector/catalog/store_configs.rb @@ -1,5 +1,5 @@ -require 'puppet/indirector/store_configs' -require 'puppet/resource/catalog' +require_relative '../../../puppet/indirector/store_configs' +require_relative '../../../puppet/resource/catalog' class Puppet::Resource::Catalog::StoreConfigs < Puppet::Indirector::StoreConfigs diff --git a/lib/puppet/indirector/catalog/yaml.rb b/lib/puppet/indirector/catalog/yaml.rb index 702cffb5471..36d734d4324 100644 --- a/lib/puppet/indirector/catalog/yaml.rb +++ b/lib/puppet/indirector/catalog/yaml.rb @@ -1,5 +1,5 @@ -require 'puppet/resource/catalog' -require 'puppet/indirector/yaml' +require_relative '../../../puppet/resource/catalog' +require_relative '../../../puppet/indirector/yaml' class Puppet::Resource::Catalog::Yaml < Puppet::Indirector::Yaml desc "Store catalogs as flat files, serialized using YAML." diff --git a/lib/puppet/indirector/code.rb b/lib/puppet/indirector/code.rb index 0c0ee146bfa..a7365c4c76c 100644 --- a/lib/puppet/indirector/code.rb +++ b/lib/puppet/indirector/code.rb @@ -1,4 +1,4 @@ -require 'puppet/indirector/terminus' +require_relative '../../puppet/indirector/terminus' # Do nothing, requiring that the back-end terminus do all # of the work. diff --git a/lib/puppet/indirector/data_binding/hiera.rb b/lib/puppet/indirector/data_binding/hiera.rb index e6e609d557e..24c39103322 100644 --- a/lib/puppet/indirector/data_binding/hiera.rb +++ b/lib/puppet/indirector/data_binding/hiera.rb @@ -1,4 +1,4 @@ -require 'puppet/indirector/hiera' +require_relative '../../../puppet/indirector/hiera' require 'hiera/scope' class Puppet::DataBinding::Hiera < Puppet::Indirector::Hiera diff --git a/lib/puppet/indirector/data_binding/none.rb b/lib/puppet/indirector/data_binding/none.rb index 75d4056cc45..e4021328685 100644 --- a/lib/puppet/indirector/data_binding/none.rb +++ b/lib/puppet/indirector/data_binding/none.rb @@ -1,4 +1,4 @@ -require 'puppet/indirector/none' +require_relative '../../../puppet/indirector/none' class Puppet::DataBinding::None < Puppet::Indirector::None desc "A Dummy terminus that always throws :no_such_key for data lookups." diff --git a/lib/puppet/indirector/direct_file_server.rb b/lib/puppet/indirector/direct_file_server.rb index c919c759a01..982e1c7f448 100644 --- a/lib/puppet/indirector/direct_file_server.rb +++ b/lib/puppet/indirector/direct_file_server.rb @@ -1,5 +1,5 @@ -require 'puppet/file_serving/terminus_helper' -require 'puppet/indirector/terminus' +require_relative '../../puppet/file_serving/terminus_helper' +require_relative '../../puppet/indirector/terminus' class Puppet::Indirector::DirectFileServer < Puppet::Indirector::Terminus diff --git a/lib/puppet/indirector/envelope.rb b/lib/puppet/indirector/envelope.rb index 73c33e9d45d..a6b7f3006a0 100644 --- a/lib/puppet/indirector/envelope.rb +++ b/lib/puppet/indirector/envelope.rb @@ -1,4 +1,4 @@ -require 'puppet/indirector' +require_relative '../../puppet/indirector' # Provide any attributes or functionality needed for indirected # instances. diff --git a/lib/puppet/indirector/errors.rb b/lib/puppet/indirector/errors.rb index 6b599b8d007..fd508af339d 100644 --- a/lib/puppet/indirector/errors.rb +++ b/lib/puppet/indirector/errors.rb @@ -1,4 +1,4 @@ -require 'puppet/error' +require_relative '../../puppet/error' module Puppet::Indirector class ValidationError < Puppet::Error; end diff --git a/lib/puppet/indirector/exec.rb b/lib/puppet/indirector/exec.rb index 78c07dccee2..d9c8eddbd75 100644 --- a/lib/puppet/indirector/exec.rb +++ b/lib/puppet/indirector/exec.rb @@ -1,5 +1,5 @@ -require 'puppet/indirector/terminus' -require 'puppet/util' +require_relative '../../puppet/indirector/terminus' +require_relative '../../puppet/util' class Puppet::Indirector::Exec < Puppet::Indirector::Terminus # Look for external node definitions. diff --git a/lib/puppet/indirector/face.rb b/lib/puppet/indirector/face.rb index 6e6d1d443d2..2585857775c 100644 --- a/lib/puppet/indirector/face.rb +++ b/lib/puppet/indirector/face.rb @@ -1,4 +1,4 @@ -require 'puppet/face' +require_relative '../../puppet/face' class Puppet::Indirector::Face < Puppet::Face option "--terminus _" + _("TERMINUS") do diff --git a/lib/puppet/indirector/facts/facter.rb b/lib/puppet/indirector/facts/facter.rb index 8dbab1bd9eb..165e344b85a 100644 --- a/lib/puppet/indirector/facts/facter.rb +++ b/lib/puppet/indirector/facts/facter.rb @@ -1,5 +1,5 @@ -require 'puppet/node/facts' -require 'puppet/indirector/code' +require_relative '../../../puppet/node/facts' +require_relative '../../../puppet/indirector/code' class Puppet::Node::Facts::Facter < Puppet::Indirector::Code desc "Retrieve facts from Facter. This provides a somewhat abstract interface diff --git a/lib/puppet/indirector/facts/json.rb b/lib/puppet/indirector/facts/json.rb index 038e45fb2c8..db5c5537a81 100644 --- a/lib/puppet/indirector/facts/json.rb +++ b/lib/puppet/indirector/facts/json.rb @@ -1,6 +1,6 @@ -require 'puppet/node/facts' -require 'puppet/indirector/json' -require 'puppet/indirector/fact_search' +require_relative '../../../puppet/node/facts' +require_relative '../../../puppet/indirector/json' +require_relative '../../../puppet/indirector/fact_search' class Puppet::Node::Facts::Json < Puppet::Indirector::JSON desc "Store client facts as flat files, serialized using JSON, or diff --git a/lib/puppet/indirector/facts/memory.rb b/lib/puppet/indirector/facts/memory.rb index 93682f45632..af17215d2eb 100644 --- a/lib/puppet/indirector/facts/memory.rb +++ b/lib/puppet/indirector/facts/memory.rb @@ -1,5 +1,5 @@ -require 'puppet/node/facts' -require 'puppet/indirector/memory' +require_relative '../../../puppet/node/facts' +require_relative '../../../puppet/indirector/memory' class Puppet::Node::Facts::Memory < Puppet::Indirector::Memory desc "Keep track of facts in memory but nowhere else. This is used for diff --git a/lib/puppet/indirector/facts/network_device.rb b/lib/puppet/indirector/facts/network_device.rb index 4d833212b12..d27431c327c 100644 --- a/lib/puppet/indirector/facts/network_device.rb +++ b/lib/puppet/indirector/facts/network_device.rb @@ -1,5 +1,5 @@ -require 'puppet/node/facts' -require 'puppet/indirector/code' +require_relative '../../../puppet/node/facts' +require_relative '../../../puppet/indirector/code' class Puppet::Node::Facts::NetworkDevice < Puppet::Indirector::Code desc "Retrieve facts from a network device." diff --git a/lib/puppet/indirector/facts/rest.rb b/lib/puppet/indirector/facts/rest.rb index 15f5d83164e..7ec28478230 100644 --- a/lib/puppet/indirector/facts/rest.rb +++ b/lib/puppet/indirector/facts/rest.rb @@ -1,5 +1,5 @@ -require 'puppet/node/facts' -require 'puppet/indirector/rest' +require_relative '../../../puppet/node/facts' +require_relative '../../../puppet/indirector/rest' class Puppet::Node::Facts::Rest < Puppet::Indirector::REST desc "Find and save facts about nodes over HTTP via REST." diff --git a/lib/puppet/indirector/facts/store_configs.rb b/lib/puppet/indirector/facts/store_configs.rb index 1bc631689f9..c18af0b3fac 100644 --- a/lib/puppet/indirector/facts/store_configs.rb +++ b/lib/puppet/indirector/facts/store_configs.rb @@ -1,5 +1,5 @@ -require 'puppet/node/facts' -require 'puppet/indirector/store_configs' +require_relative '../../../puppet/node/facts' +require_relative '../../../puppet/indirector/store_configs' class Puppet::Node::Facts::StoreConfigs < Puppet::Indirector::StoreConfigs diff --git a/lib/puppet/indirector/facts/yaml.rb b/lib/puppet/indirector/facts/yaml.rb index 6a5f0693113..ebdacd31d6c 100644 --- a/lib/puppet/indirector/facts/yaml.rb +++ b/lib/puppet/indirector/facts/yaml.rb @@ -1,6 +1,6 @@ -require 'puppet/node/facts' -require 'puppet/indirector/yaml' -require 'puppet/indirector/fact_search' +require_relative '../../../puppet/node/facts' +require_relative '../../../puppet/indirector/yaml' +require_relative '../../../puppet/indirector/fact_search' class Puppet::Node::Facts::Yaml < Puppet::Indirector::Yaml desc "Store client facts as flat files, serialized using YAML, or diff --git a/lib/puppet/indirector/file_bucket_file/file.rb b/lib/puppet/indirector/file_bucket_file/file.rb index b287617cb0a..94584dbfd6e 100644 --- a/lib/puppet/indirector/file_bucket_file/file.rb +++ b/lib/puppet/indirector/file_bucket_file/file.rb @@ -1,7 +1,7 @@ -require 'puppet/indirector/code' -require 'puppet/file_bucket/file' -require 'puppet/util/checksums' -require 'puppet/util/diff' +require_relative '../../../puppet/indirector/code' +require_relative '../../../puppet/file_bucket/file' +require_relative '../../../puppet/util/checksums' +require_relative '../../../puppet/util/diff' require 'fileutils' module Puppet::FileBucketFile diff --git a/lib/puppet/indirector/file_bucket_file/rest.rb b/lib/puppet/indirector/file_bucket_file/rest.rb index 8a71140b98a..13d8bf23f87 100644 --- a/lib/puppet/indirector/file_bucket_file/rest.rb +++ b/lib/puppet/indirector/file_bucket_file/rest.rb @@ -1,5 +1,5 @@ -require 'puppet/indirector/rest' -require 'puppet/file_bucket/file' +require_relative '../../../puppet/indirector/rest' +require_relative '../../../puppet/file_bucket/file' module Puppet::FileBucketFile class Rest < Puppet::Indirector::REST diff --git a/lib/puppet/indirector/file_bucket_file/selector.rb b/lib/puppet/indirector/file_bucket_file/selector.rb index 9b32f059993..53018b9ba6c 100644 --- a/lib/puppet/indirector/file_bucket_file/selector.rb +++ b/lib/puppet/indirector/file_bucket_file/selector.rb @@ -1,4 +1,4 @@ -require 'puppet/indirector/code' +require_relative '../../../puppet/indirector/code' module Puppet::FileBucketFile class Selector < Puppet::Indirector::Code diff --git a/lib/puppet/indirector/file_content.rb b/lib/puppet/indirector/file_content.rb index 5528b6263df..3d08383171c 100644 --- a/lib/puppet/indirector/file_content.rb +++ b/lib/puppet/indirector/file_content.rb @@ -2,4 +2,4 @@ class Puppet::Indirector::FileContent # :nodoc: end -require 'puppet/file_serving/content' +require_relative '../../puppet/file_serving/content' diff --git a/lib/puppet/indirector/file_content/file.rb b/lib/puppet/indirector/file_content/file.rb index 0bb7106d519..0df635d0c1d 100644 --- a/lib/puppet/indirector/file_content/file.rb +++ b/lib/puppet/indirector/file_content/file.rb @@ -1,6 +1,6 @@ -require 'puppet/file_serving/content' -require 'puppet/indirector/file_content' -require 'puppet/indirector/direct_file_server' +require_relative '../../../puppet/file_serving/content' +require_relative '../../../puppet/indirector/file_content' +require_relative '../../../puppet/indirector/direct_file_server' class Puppet::Indirector::FileContent::File < Puppet::Indirector::DirectFileServer desc "Retrieve file contents from disk." diff --git a/lib/puppet/indirector/file_content/file_server.rb b/lib/puppet/indirector/file_content/file_server.rb index 741c70458bf..a6b52a67f3c 100644 --- a/lib/puppet/indirector/file_content/file_server.rb +++ b/lib/puppet/indirector/file_content/file_server.rb @@ -1,6 +1,6 @@ -require 'puppet/file_serving/content' -require 'puppet/indirector/file_content' -require 'puppet/indirector/file_server' +require_relative '../../../puppet/file_serving/content' +require_relative '../../../puppet/indirector/file_content' +require_relative '../../../puppet/indirector/file_server' class Puppet::Indirector::FileContent::FileServer < Puppet::Indirector::FileServer desc "Retrieve file contents using Puppet's fileserver." diff --git a/lib/puppet/indirector/file_content/rest.rb b/lib/puppet/indirector/file_content/rest.rb index a776e37fb04..079a2472808 100644 --- a/lib/puppet/indirector/file_content/rest.rb +++ b/lib/puppet/indirector/file_content/rest.rb @@ -1,6 +1,6 @@ -require 'puppet/file_serving/content' -require 'puppet/indirector/file_content' -require 'puppet/indirector/rest' +require_relative '../../../puppet/file_serving/content' +require_relative '../../../puppet/indirector/file_content' +require_relative '../../../puppet/indirector/rest' class Puppet::Indirector::FileContent::Rest < Puppet::Indirector::REST desc "Retrieve file contents via a REST HTTP interface." diff --git a/lib/puppet/indirector/file_content/selector.rb b/lib/puppet/indirector/file_content/selector.rb index 32374ed7414..2d15d1d079f 100644 --- a/lib/puppet/indirector/file_content/selector.rb +++ b/lib/puppet/indirector/file_content/selector.rb @@ -1,7 +1,7 @@ -require 'puppet/file_serving/content' -require 'puppet/indirector/file_content' -require 'puppet/indirector/code' -require 'puppet/file_serving/terminus_selector' +require_relative '../../../puppet/file_serving/content' +require_relative '../../../puppet/indirector/file_content' +require_relative '../../../puppet/indirector/code' +require_relative '../../../puppet/file_serving/terminus_selector' class Puppet::Indirector::FileContent::Selector < Puppet::Indirector::Code desc "Select the terminus based on the request" diff --git a/lib/puppet/indirector/file_metadata.rb b/lib/puppet/indirector/file_metadata.rb index 2a90955f616..0fcb77d8478 100644 --- a/lib/puppet/indirector/file_metadata.rb +++ b/lib/puppet/indirector/file_metadata.rb @@ -2,4 +2,4 @@ class Puppet::Indirector::FileMetadata # :nodoc: end -require 'puppet/file_serving/metadata' +require_relative '../../puppet/file_serving/metadata' diff --git a/lib/puppet/indirector/file_metadata/file.rb b/lib/puppet/indirector/file_metadata/file.rb index 5cfbf87f7e1..a16b72e0781 100644 --- a/lib/puppet/indirector/file_metadata/file.rb +++ b/lib/puppet/indirector/file_metadata/file.rb @@ -1,6 +1,6 @@ -require 'puppet/file_serving/metadata' -require 'puppet/indirector/file_metadata' -require 'puppet/indirector/direct_file_server' +require_relative '../../../puppet/file_serving/metadata' +require_relative '../../../puppet/indirector/file_metadata' +require_relative '../../../puppet/indirector/direct_file_server' class Puppet::Indirector::FileMetadata::File < Puppet::Indirector::DirectFileServer desc "Retrieve file metadata directly from the local filesystem." diff --git a/lib/puppet/indirector/file_metadata/file_server.rb b/lib/puppet/indirector/file_metadata/file_server.rb index d3622990a20..3869ba2a3ea 100644 --- a/lib/puppet/indirector/file_metadata/file_server.rb +++ b/lib/puppet/indirector/file_metadata/file_server.rb @@ -1,6 +1,6 @@ -require 'puppet/file_serving/metadata' -require 'puppet/indirector/file_metadata' -require 'puppet/indirector/file_server' +require_relative '../../../puppet/file_serving/metadata' +require_relative '../../../puppet/indirector/file_metadata' +require_relative '../../../puppet/indirector/file_server' class Puppet::Indirector::FileMetadata::FileServer < Puppet::Indirector::FileServer desc "Retrieve file metadata using Puppet's fileserver." diff --git a/lib/puppet/indirector/file_metadata/http.rb b/lib/puppet/indirector/file_metadata/http.rb index a6483735d7c..06c67ff0f2b 100644 --- a/lib/puppet/indirector/file_metadata/http.rb +++ b/lib/puppet/indirector/file_metadata/http.rb @@ -1,6 +1,6 @@ -require 'puppet/file_serving/http_metadata' -require 'puppet/indirector/generic_http' -require 'puppet/indirector/file_metadata' +require_relative '../../../puppet/file_serving/http_metadata' +require_relative '../../../puppet/indirector/generic_http' +require_relative '../../../puppet/indirector/file_metadata' require 'net/http' class Puppet::Indirector::FileMetadata::Http < Puppet::Indirector::GenericHttp diff --git a/lib/puppet/indirector/file_metadata/rest.rb b/lib/puppet/indirector/file_metadata/rest.rb index d72ff63ae68..8ff3b31c5d3 100644 --- a/lib/puppet/indirector/file_metadata/rest.rb +++ b/lib/puppet/indirector/file_metadata/rest.rb @@ -1,6 +1,6 @@ -require 'puppet/file_serving/metadata' -require 'puppet/indirector/file_metadata' -require 'puppet/indirector/rest' +require_relative '../../../puppet/file_serving/metadata' +require_relative '../../../puppet/indirector/file_metadata' +require_relative '../../../puppet/indirector/rest' class Puppet::Indirector::FileMetadata::Rest < Puppet::Indirector::REST desc "Retrieve file metadata via a REST HTTP interface." diff --git a/lib/puppet/indirector/file_metadata/selector.rb b/lib/puppet/indirector/file_metadata/selector.rb index 08e4fbb8876..ea7ece15411 100644 --- a/lib/puppet/indirector/file_metadata/selector.rb +++ b/lib/puppet/indirector/file_metadata/selector.rb @@ -1,7 +1,7 @@ -require 'puppet/file_serving/metadata' -require 'puppet/indirector/file_metadata' -require 'puppet/indirector/code' -require 'puppet/file_serving/terminus_selector' +require_relative '../../../puppet/file_serving/metadata' +require_relative '../../../puppet/indirector/file_metadata' +require_relative '../../../puppet/indirector/code' +require_relative '../../../puppet/file_serving/terminus_selector' class Puppet::Indirector::FileMetadata::Selector < Puppet::Indirector::Code desc "Select the terminus based on the request" diff --git a/lib/puppet/indirector/file_server.rb b/lib/puppet/indirector/file_server.rb index 0ad490531c8..2b789957ec2 100644 --- a/lib/puppet/indirector/file_server.rb +++ b/lib/puppet/indirector/file_server.rb @@ -1,7 +1,7 @@ -require 'puppet/file_serving/configuration' -require 'puppet/file_serving/fileset' -require 'puppet/file_serving/terminus_helper' -require 'puppet/indirector/terminus' +require_relative '../../puppet/file_serving/configuration' +require_relative '../../puppet/file_serving/fileset' +require_relative '../../puppet/file_serving/terminus_helper' +require_relative '../../puppet/indirector/terminus' # Look files up using the file server. class Puppet::Indirector::FileServer < Puppet::Indirector::Terminus diff --git a/lib/puppet/indirector/generic_http.rb b/lib/puppet/indirector/generic_http.rb index de96715b286..88d160a7501 100644 --- a/lib/puppet/indirector/generic_http.rb +++ b/lib/puppet/indirector/generic_http.rb @@ -1,4 +1,4 @@ -require 'puppet/file_serving/terminus_helper' +require_relative '../../puppet/file_serving/terminus_helper' class Puppet::Indirector::GenericHttp < Puppet::Indirector::Terminus desc "Retrieve data from a remote HTTP server." diff --git a/lib/puppet/indirector/hiera.rb b/lib/puppet/indirector/hiera.rb index 20e401c4544..a29fc08af73 100644 --- a/lib/puppet/indirector/hiera.rb +++ b/lib/puppet/indirector/hiera.rb @@ -1,4 +1,4 @@ -require 'puppet/indirector/terminus' +require_relative '../../puppet/indirector/terminus' require 'hiera/scope' # This class can't be collapsed into Puppet::Indirector::DataBindings::Hiera diff --git a/lib/puppet/indirector/indirection.rb b/lib/puppet/indirector/indirection.rb index 80a75db218f..07f095177f4 100644 --- a/lib/puppet/indirector/indirection.rb +++ b/lib/puppet/indirector/indirection.rb @@ -1,8 +1,8 @@ -require 'puppet/util/docs' -require 'puppet/util/profiler' -require 'puppet/indirector/envelope' -require 'puppet/indirector/request' -require 'puppet/thread_local' +require_relative '../../puppet/util/docs' +require_relative '../../puppet/util/profiler' +require_relative '../../puppet/indirector/envelope' +require_relative '../../puppet/indirector/request' +require_relative '../../puppet/thread_local' # The class that connects functional classes with their different collection # back-ends. Each indirection has a set of associated terminus classes, diff --git a/lib/puppet/indirector/json.rb b/lib/puppet/indirector/json.rb index fe16aa1f401..d472a75cd0e 100644 --- a/lib/puppet/indirector/json.rb +++ b/lib/puppet/indirector/json.rb @@ -1,5 +1,5 @@ -require 'puppet/indirector/terminus' -require 'puppet/util' +require_relative '../../puppet/indirector/terminus' +require_relative '../../puppet/util' # The base class for JSON indirection terminus implementations. # diff --git a/lib/puppet/indirector/memory.rb b/lib/puppet/indirector/memory.rb index 2097ccb8eef..087b3c2d160 100644 --- a/lib/puppet/indirector/memory.rb +++ b/lib/puppet/indirector/memory.rb @@ -1,4 +1,4 @@ -require 'puppet/indirector/terminus' +require_relative '../../puppet/indirector/terminus' # Manage a memory-cached list of instances. class Puppet::Indirector::Memory < Puppet::Indirector::Terminus diff --git a/lib/puppet/indirector/msgpack.rb b/lib/puppet/indirector/msgpack.rb index 1abb638d2ef..4f0a15af6e0 100644 --- a/lib/puppet/indirector/msgpack.rb +++ b/lib/puppet/indirector/msgpack.rb @@ -1,5 +1,5 @@ -require 'puppet/indirector/terminus' -require 'puppet/util' +require_relative '../../puppet/indirector/terminus' +require_relative '../../puppet/util' # The base class for MessagePack indirection terminus implementations. # diff --git a/lib/puppet/indirector/node/exec.rb b/lib/puppet/indirector/node/exec.rb index 91670339191..3562789fa41 100644 --- a/lib/puppet/indirector/node/exec.rb +++ b/lib/puppet/indirector/node/exec.rb @@ -1,5 +1,5 @@ -require 'puppet/node' -require 'puppet/indirector/exec' +require_relative '../../../puppet/node' +require_relative '../../../puppet/indirector/exec' class Puppet::Node::Exec < Puppet::Indirector::Exec desc "Call an external program to get node information. See diff --git a/lib/puppet/indirector/node/json.rb b/lib/puppet/indirector/node/json.rb index a179a6d691d..91ad6981dde 100644 --- a/lib/puppet/indirector/node/json.rb +++ b/lib/puppet/indirector/node/json.rb @@ -1,5 +1,5 @@ -require 'puppet/node' -require 'puppet/indirector/json' +require_relative '../../../puppet/node' +require_relative '../../../puppet/indirector/json' class Puppet::Node::Json < Puppet::Indirector::JSON desc "Store node information as flat files, serialized using JSON, diff --git a/lib/puppet/indirector/node/memory.rb b/lib/puppet/indirector/node/memory.rb index 029926af8b6..dd4827c1b44 100644 --- a/lib/puppet/indirector/node/memory.rb +++ b/lib/puppet/indirector/node/memory.rb @@ -1,5 +1,5 @@ -require 'puppet/node' -require 'puppet/indirector/memory' +require_relative '../../../puppet/node' +require_relative '../../../puppet/indirector/memory' class Puppet::Node::Memory < Puppet::Indirector::Memory desc "Keep track of nodes in memory but nowhere else. This is used for diff --git a/lib/puppet/indirector/node/msgpack.rb b/lib/puppet/indirector/node/msgpack.rb index bf38a708a9c..088e2233af5 100644 --- a/lib/puppet/indirector/node/msgpack.rb +++ b/lib/puppet/indirector/node/msgpack.rb @@ -1,5 +1,5 @@ -require 'puppet/node' -require 'puppet/indirector/msgpack' +require_relative '../../../puppet/node' +require_relative '../../../puppet/indirector/msgpack' class Puppet::Node::Msgpack < Puppet::Indirector::Msgpack desc "Store node information as flat files, serialized using MessagePack, diff --git a/lib/puppet/indirector/node/plain.rb b/lib/puppet/indirector/node/plain.rb index b34b9cf57ef..659ec70482c 100644 --- a/lib/puppet/indirector/node/plain.rb +++ b/lib/puppet/indirector/node/plain.rb @@ -1,5 +1,5 @@ -require 'puppet/node' -require 'puppet/indirector/plain' +require_relative '../../../puppet/node' +require_relative '../../../puppet/indirector/plain' class Puppet::Node::Plain < Puppet::Indirector::Plain desc "Always return an empty node object. Assumes you keep track of nodes diff --git a/lib/puppet/indirector/node/rest.rb b/lib/puppet/indirector/node/rest.rb index b935a38057b..150d5f338dc 100644 --- a/lib/puppet/indirector/node/rest.rb +++ b/lib/puppet/indirector/node/rest.rb @@ -1,5 +1,5 @@ -require 'puppet/node' -require 'puppet/indirector/rest' +require_relative '../../../puppet/node' +require_relative '../../../puppet/indirector/rest' class Puppet::Node::Rest < Puppet::Indirector::REST desc "Get a node via REST. Puppet agent uses this to allow the puppet master diff --git a/lib/puppet/indirector/node/store_configs.rb b/lib/puppet/indirector/node/store_configs.rb index 62651db97eb..dabb1e0db49 100644 --- a/lib/puppet/indirector/node/store_configs.rb +++ b/lib/puppet/indirector/node/store_configs.rb @@ -1,5 +1,5 @@ -require 'puppet/indirector/store_configs' -require 'puppet/node' +require_relative '../../../puppet/indirector/store_configs' +require_relative '../../../puppet/node' class Puppet::Node::StoreConfigs < Puppet::Indirector::StoreConfigs diff --git a/lib/puppet/indirector/node/yaml.rb b/lib/puppet/indirector/node/yaml.rb index 5a316b62e88..ccd788a5234 100644 --- a/lib/puppet/indirector/node/yaml.rb +++ b/lib/puppet/indirector/node/yaml.rb @@ -1,5 +1,5 @@ -require 'puppet/node' -require 'puppet/indirector/yaml' +require_relative '../../../puppet/node' +require_relative '../../../puppet/indirector/yaml' class Puppet::Node::Yaml < Puppet::Indirector::Yaml desc "Store node information as flat files, serialized using YAML, diff --git a/lib/puppet/indirector/none.rb b/lib/puppet/indirector/none.rb index 69c888f772c..2f59afe03ee 100644 --- a/lib/puppet/indirector/none.rb +++ b/lib/puppet/indirector/none.rb @@ -1,4 +1,4 @@ -require 'puppet/indirector/terminus' +require_relative '../../puppet/indirector/terminus' # A none terminus type, meant to always return nil class Puppet::Indirector::None < Puppet::Indirector::Terminus diff --git a/lib/puppet/indirector/plain.rb b/lib/puppet/indirector/plain.rb index e11fc68c8ea..8235a6f51f2 100644 --- a/lib/puppet/indirector/plain.rb +++ b/lib/puppet/indirector/plain.rb @@ -1,4 +1,4 @@ -require 'puppet/indirector/terminus' +require_relative '../../puppet/indirector/terminus' # An empty terminus type, meant to just return empty objects. class Puppet::Indirector::Plain < Puppet::Indirector::Terminus diff --git a/lib/puppet/indirector/report/json.rb b/lib/puppet/indirector/report/json.rb index b3d72b76bab..7f707d3b578 100644 --- a/lib/puppet/indirector/report/json.rb +++ b/lib/puppet/indirector/report/json.rb @@ -1,5 +1,5 @@ -require 'puppet/transaction/report' -require 'puppet/indirector/json' +require_relative '../../../puppet/transaction/report' +require_relative '../../../puppet/indirector/json' class Puppet::Transaction::Report::Json < Puppet::Indirector::JSON include Puppet::Util::SymbolicFileMode diff --git a/lib/puppet/indirector/report/msgpack.rb b/lib/puppet/indirector/report/msgpack.rb index 057b359c79f..d9404eacfd2 100644 --- a/lib/puppet/indirector/report/msgpack.rb +++ b/lib/puppet/indirector/report/msgpack.rb @@ -1,5 +1,5 @@ -require 'puppet/transaction/report' -require 'puppet/indirector/msgpack' +require_relative '../../../puppet/transaction/report' +require_relative '../../../puppet/indirector/msgpack' class Puppet::Transaction::Report::Msgpack < Puppet::Indirector::Msgpack desc "Store last report as a flat file, serialized using MessagePack." diff --git a/lib/puppet/indirector/report/processor.rb b/lib/puppet/indirector/report/processor.rb index 186208f3cc7..5da7d4591b2 100644 --- a/lib/puppet/indirector/report/processor.rb +++ b/lib/puppet/indirector/report/processor.rb @@ -1,6 +1,6 @@ -require 'puppet/transaction/report' -require 'puppet/indirector/code' -require 'puppet/reports' +require_relative '../../../puppet/transaction/report' +require_relative '../../../puppet/indirector/code' +require_relative '../../../puppet/reports' class Puppet::Transaction::Report::Processor < Puppet::Indirector::Code desc "Puppet's report processor. Processes the report with each of diff --git a/lib/puppet/indirector/report/rest.rb b/lib/puppet/indirector/report/rest.rb index 13dae98defb..bf802d0493f 100644 --- a/lib/puppet/indirector/report/rest.rb +++ b/lib/puppet/indirector/report/rest.rb @@ -1,4 +1,4 @@ -require 'puppet/indirector/rest' +require_relative '../../../puppet/indirector/rest' require 'semantic_puppet' class Puppet::Transaction::Report::Rest < Puppet::Indirector::REST diff --git a/lib/puppet/indirector/report/yaml.rb b/lib/puppet/indirector/report/yaml.rb index 2c403c776db..f764faf80e1 100644 --- a/lib/puppet/indirector/report/yaml.rb +++ b/lib/puppet/indirector/report/yaml.rb @@ -1,5 +1,5 @@ -require 'puppet/transaction/report' -require 'puppet/indirector/yaml' +require_relative '../../../puppet/transaction/report' +require_relative '../../../puppet/indirector/yaml' class Puppet::Transaction::Report::Yaml < Puppet::Indirector::Yaml include Puppet::Util::SymbolicFileMode diff --git a/lib/puppet/indirector/request.rb b/lib/puppet/indirector/request.rb index e6faebdc275..688eeb31da1 100644 --- a/lib/puppet/indirector/request.rb +++ b/lib/puppet/indirector/request.rb @@ -1,8 +1,8 @@ require 'cgi' require 'uri' -require 'puppet/indirector' -require 'puppet/util/psych_support' -require 'puppet/util/warnings' +require_relative '../../puppet/indirector' +require_relative '../../puppet/util/psych_support' +require_relative '../../puppet/util/warnings' # This class encapsulates all of the information you need to make an # Indirection call, and as a result also handles REST calls. It's somewhat diff --git a/lib/puppet/indirector/resource/ral.rb b/lib/puppet/indirector/resource/ral.rb index 3f6c4a49e75..8a0354ddd88 100644 --- a/lib/puppet/indirector/resource/ral.rb +++ b/lib/puppet/indirector/resource/ral.rb @@ -1,4 +1,4 @@ -require 'puppet/indirector/resource/validator' +require_relative '../../../puppet/indirector/resource/validator' class Puppet::Resource::Ral < Puppet::Indirector::Code include Puppet::Resource::Validator diff --git a/lib/puppet/indirector/resource/store_configs.rb b/lib/puppet/indirector/resource/store_configs.rb index 80c5e8c5b64..0bc7107b003 100644 --- a/lib/puppet/indirector/resource/store_configs.rb +++ b/lib/puppet/indirector/resource/store_configs.rb @@ -1,5 +1,5 @@ -require 'puppet/indirector/store_configs' -require 'puppet/indirector/resource/validator' +require_relative '../../../puppet/indirector/store_configs' +require_relative '../../../puppet/indirector/resource/validator' class Puppet::Resource::StoreConfigs < Puppet::Indirector::StoreConfigs include Puppet::Resource::Validator diff --git a/lib/puppet/indirector/terminus.rb b/lib/puppet/indirector/terminus.rb index 1e68ce3d161..38ce49737b4 100644 --- a/lib/puppet/indirector/terminus.rb +++ b/lib/puppet/indirector/terminus.rb @@ -1,11 +1,11 @@ -require 'puppet/indirector' -require 'puppet/indirector/errors' -require 'puppet/indirector/indirection' -require 'puppet/util/instance_loader' +require_relative '../../puppet/indirector' +require_relative '../../puppet/indirector/errors' +require_relative '../../puppet/indirector/indirection' +require_relative '../../puppet/util/instance_loader' # A simple class that can function as the base class for indirected types. class Puppet::Indirector::Terminus - require 'puppet/util/docs' + require_relative '../../puppet/util/docs' extend Puppet::Util::Docs class << self diff --git a/lib/puppet/indirector/yaml.rb b/lib/puppet/indirector/yaml.rb index 2bda22b92db..e6df83801c5 100644 --- a/lib/puppet/indirector/yaml.rb +++ b/lib/puppet/indirector/yaml.rb @@ -1,5 +1,5 @@ -require 'puppet/indirector/terminus' -require 'puppet/util/yaml' +require_relative '../../puppet/indirector/terminus' +require_relative '../../puppet/util/yaml' # The base class for YAML indirection termini. class Puppet::Indirector::Yaml < Puppet::Indirector::Terminus diff --git a/lib/puppet/info_service.rb b/lib/puppet/info_service.rb index c74167bd505..d6e36ca99ce 100644 --- a/lib/puppet/info_service.rb +++ b/lib/puppet/info_service.rb @@ -1,8 +1,8 @@ module Puppet::InfoService - require 'puppet/info_service/class_information_service' - require 'puppet/info_service/task_information_service' - require 'puppet/info_service/plan_information_service' + require_relative 'info_service/class_information_service' + require_relative 'info_service/task_information_service' + require_relative 'info_service/plan_information_service' def self.classes_per_environment(env_file_hash) Puppet::InfoService::ClassInformationService.new.classes_per_environment(env_file_hash) diff --git a/lib/puppet/info_service/class_information_service.rb b/lib/puppet/info_service/class_information_service.rb index 4f534358aa9..dd3b33df21e 100644 --- a/lib/puppet/info_service/class_information_service.rb +++ b/lib/puppet/info_service/class_information_service.rb @@ -1,6 +1,6 @@ -require 'puppet' -require 'puppet/pops' -require 'puppet/pops/evaluator/json_strict_literal_evaluator' +require_relative '../../puppet' +require_relative '../../puppet/pops' +require_relative '../../puppet/pops/evaluator/json_strict_literal_evaluator' class Puppet::InfoService::ClassInformationService diff --git a/lib/puppet/info_service/plan_information_service.rb b/lib/puppet/info_service/plan_information_service.rb index 6c781e29079..86f21ecfefd 100644 --- a/lib/puppet/info_service/plan_information_service.rb +++ b/lib/puppet/info_service/plan_information_service.rb @@ -1,5 +1,5 @@ class Puppet::InfoService::PlanInformationService - require 'puppet/module' + require_relative '../../puppet/module' def self.plans_per_environment(environment_name) # get the actual environment object, raise error if the named env doesn't exist diff --git a/lib/puppet/info_service/task_information_service.rb b/lib/puppet/info_service/task_information_service.rb index 22c933ba95e..9ea53984209 100644 --- a/lib/puppet/info_service/task_information_service.rb +++ b/lib/puppet/info_service/task_information_service.rb @@ -1,5 +1,5 @@ class Puppet::InfoService::TaskInformationService - require 'puppet/module' + require_relative '../../puppet/module' def self.tasks_per_environment(environment_name) # get the actual environment object, raise error if the named env doesn't exist diff --git a/lib/puppet/interface.rb b/lib/puppet/interface.rb index 13ab82266e3..d58e6650472 100644 --- a/lib/puppet/interface.rb +++ b/lib/puppet/interface.rb @@ -1,19 +1,19 @@ -require 'puppet' -require 'puppet/util/autoload' +require_relative '../puppet' +require_relative '../puppet/util/autoload' require 'prettyprint' # @api public class Puppet::Interface - require 'puppet/interface/documentation' - require 'puppet/interface/face_collection' + require_relative 'interface/documentation' + require_relative 'interface/face_collection' - require 'puppet/interface/action' - require 'puppet/interface/action_builder' - require 'puppet/interface/action_manager' + require_relative 'interface/action' + require_relative 'interface/action_builder' + require_relative 'interface/action_manager' - require 'puppet/interface/option' - require 'puppet/interface/option_builder' - require 'puppet/interface/option_manager' + require_relative 'interface/option' + require_relative 'interface/option_builder' + require_relative 'interface/option_manager' include FullDocs diff --git a/lib/puppet/interface/documentation.rb b/lib/puppet/interface/documentation.rb index a4e9ec1e884..fb08ccef4c6 100644 --- a/lib/puppet/interface/documentation.rb +++ b/lib/puppet/interface/documentation.rb @@ -1,7 +1,7 @@ class Puppet::Interface # @api private module DocGen - require 'puppet/util/docs' + require_relative '../../puppet/util/docs' # @api private def self.strip_whitespace(text) diff --git a/lib/puppet/loaders.rb b/lib/puppet/loaders.rb index d527d49d286..672d5dd95e3 100644 --- a/lib/puppet/loaders.rb +++ b/lib/puppet/loaders.rb @@ -1,29 +1,29 @@ -require 'puppet/concurrent/synchronized' +require_relative '../puppet/concurrent/synchronized' module Puppet module Pops - require 'puppet/pops/loaders' + require_relative '../puppet/pops/loaders' module Loader - require 'puppet/pops/loader/typed_name' - require 'puppet/pops/loader/loader' - require 'puppet/pops/loader/base_loader' - require 'puppet/pops/loader/gem_support' - require 'puppet/pops/loader/module_loaders' - require 'puppet/pops/loader/dependency_loader' - require 'puppet/pops/loader/static_loader' - require 'puppet/pops/loader/runtime3_type_loader' - require 'puppet/pops/loader/ruby_function_instantiator' - require 'puppet/pops/loader/ruby_legacy_function_instantiator' - require 'puppet/pops/loader/ruby_data_type_instantiator' - require 'puppet/pops/loader/puppet_function_instantiator' - require 'puppet/pops/loader/type_definition_instantiator' - require 'puppet/pops/loader/puppet_resource_type_impl_instantiator' - require 'puppet/pops/loader/loader_paths' - require 'puppet/pops/loader/simple_environment_loader' - require 'puppet/pops/loader/predefined_loader' - require 'puppet/pops/loader/generic_plan_instantiator' - require 'puppet/pops/loader/puppet_plan_instantiator' + require_relative '../puppet/pops/loader/typed_name' + require_relative '../puppet/pops/loader/loader' + require_relative '../puppet/pops/loader/base_loader' + require_relative '../puppet/pops/loader/gem_support' + require_relative '../puppet/pops/loader/module_loaders' + require_relative '../puppet/pops/loader/dependency_loader' + require_relative '../puppet/pops/loader/static_loader' + require_relative '../puppet/pops/loader/runtime3_type_loader' + require_relative '../puppet/pops/loader/ruby_function_instantiator' + require_relative '../puppet/pops/loader/ruby_legacy_function_instantiator' + require_relative '../puppet/pops/loader/ruby_data_type_instantiator' + require_relative '../puppet/pops/loader/puppet_function_instantiator' + require_relative '../puppet/pops/loader/type_definition_instantiator' + require_relative '../puppet/pops/loader/puppet_resource_type_impl_instantiator' + require_relative '../puppet/pops/loader/loader_paths' + require_relative '../puppet/pops/loader/simple_environment_loader' + require_relative '../puppet/pops/loader/predefined_loader' + require_relative '../puppet/pops/loader/generic_plan_instantiator' + require_relative '../puppet/pops/loader/puppet_plan_instantiator' end end diff --git a/lib/puppet/metatype/manager.rb b/lib/puppet/metatype/manager.rb index 57187b95eb8..8e7bf5af704 100644 --- a/lib/puppet/metatype/manager.rb +++ b/lib/puppet/metatype/manager.rb @@ -1,6 +1,6 @@ -require 'puppet' -require 'puppet/util/classgen' -require 'puppet/node/environment' +require_relative '../../puppet' +require_relative '../../puppet/util/classgen' +require_relative '../../puppet/node/environment' # This module defines methods dealing with Type management. # This module gets included into the Puppet::Type class, it's just split out here for clarity. diff --git a/lib/puppet/module.rb b/lib/puppet/module.rb index 92c19141104..8605261544b 100644 --- a/lib/puppet/module.rb +++ b/lib/puppet/module.rb @@ -1,7 +1,7 @@ -require 'puppet/util/logging' -require 'puppet/module/task' -require 'puppet/module/plan' -require 'puppet/util/json' +require_relative '../puppet/util/logging' +require_relative 'module/task' +require_relative 'module/plan' +require_relative '../puppet/util/json' require 'semantic_puppet/gem_version' # Support for modules diff --git a/lib/puppet/module/plan.rb b/lib/puppet/module/plan.rb index 395145c1292..3d738863bc7 100644 --- a/lib/puppet/module/plan.rb +++ b/lib/puppet/module/plan.rb @@ -1,4 +1,4 @@ -require 'puppet/util/logging' +require_relative '../../puppet/util/logging' class Puppet::Module class Plan diff --git a/lib/puppet/module/task.rb b/lib/puppet/module/task.rb index 60f08a6439c..d0e8cef86cf 100644 --- a/lib/puppet/module/task.rb +++ b/lib/puppet/module/task.rb @@ -1,4 +1,4 @@ -require 'puppet/util/logging' +require_relative '../../puppet/util/logging' class Puppet::Module class Task diff --git a/lib/puppet/module_tool.rb b/lib/puppet/module_tool.rb index 20203f65ef9..2593835128b 100644 --- a/lib/puppet/module_tool.rb +++ b/lib/puppet/module_tool.rb @@ -2,11 +2,11 @@ # Load standard libraries require 'pathname' require 'fileutils' -require 'puppet/util/colors' +require_relative '../puppet/util/colors' module Puppet module ModuleTool - require 'puppet/module_tool/tar' + require_relative 'module_tool/tar' extend Puppet::Util::Colors # Directory and names that should not be checksummed. @@ -184,11 +184,11 @@ def self.parse_module_dependency(where, dep) end # Load remaining libraries -require 'puppet/module_tool/errors' -require 'puppet/module_tool/applications' -require 'puppet/module_tool/checksums' -require 'puppet/module_tool/contents_description' -require 'puppet/module_tool/dependency' -require 'puppet/module_tool/metadata' -require 'puppet/forge/cache' -require 'puppet/forge' +require_relative 'module_tool/errors' +require_relative 'module_tool/applications' +require_relative 'module_tool/checksums' +require_relative 'module_tool/contents_description' +require_relative 'module_tool/dependency' +require_relative 'module_tool/metadata' +require_relative '../puppet/forge/cache' +require_relative '../puppet/forge' diff --git a/lib/puppet/module_tool/applications.rb b/lib/puppet/module_tool/applications.rb index 9591f129692..74a80ec0fbf 100644 --- a/lib/puppet/module_tool/applications.rb +++ b/lib/puppet/module_tool/applications.rb @@ -1,12 +1,12 @@ -require 'puppet/module_tool' +require_relative '../../puppet/module_tool' module Puppet::ModuleTool module Applications - require 'puppet/module_tool/applications/application' - require 'puppet/module_tool/applications/checksummer' - require 'puppet/module_tool/applications/installer' - require 'puppet/module_tool/applications/unpacker' - require 'puppet/module_tool/applications/uninstaller' - require 'puppet/module_tool/applications/upgrader' + require_relative 'applications/application' + require_relative 'applications/checksummer' + require_relative 'applications/installer' + require_relative 'applications/unpacker' + require_relative 'applications/uninstaller' + require_relative 'applications/upgrader' end end diff --git a/lib/puppet/module_tool/applications/application.rb b/lib/puppet/module_tool/applications/application.rb index e7031ddabdf..c0412272348 100644 --- a/lib/puppet/module_tool/applications/application.rb +++ b/lib/puppet/module_tool/applications/application.rb @@ -1,6 +1,6 @@ require 'net/http' -require 'puppet/util/json' -require 'puppet/util/colors' +require_relative '../../../puppet/util/json' +require_relative '../../../puppet/util/colors' module Puppet::ModuleTool module Applications diff --git a/lib/puppet/module_tool/applications/checksummer.rb b/lib/puppet/module_tool/applications/checksummer.rb index 8bcf9dbceb7..bf5b0e8ea38 100644 --- a/lib/puppet/module_tool/applications/checksummer.rb +++ b/lib/puppet/module_tool/applications/checksummer.rb @@ -1,5 +1,5 @@ -require 'puppet/util/json' -require 'puppet/module_tool/checksums' +require_relative '../../../puppet/util/json' +require_relative '../../../puppet/module_tool/checksums' module Puppet::ModuleTool module Applications diff --git a/lib/puppet/module_tool/applications/installer.rb b/lib/puppet/module_tool/applications/installer.rb index 99d94a63860..55850225a76 100644 --- a/lib/puppet/module_tool/applications/installer.rb +++ b/lib/puppet/module_tool/applications/installer.rb @@ -3,13 +3,13 @@ require 'fileutils' require 'tmpdir' -require 'puppet/forge' -require 'puppet/module_tool' -require 'puppet/module_tool/shared_behaviors' -require 'puppet/module_tool/install_directory' -require 'puppet/module_tool/local_tarball' -require 'puppet/module_tool/installed_modules' -require 'puppet/network/uri' +require_relative '../../../puppet/forge' +require_relative '../../../puppet/module_tool' +require_relative '../../../puppet/module_tool/shared_behaviors' +require_relative '../../../puppet/module_tool/install_directory' +require_relative '../../../puppet/module_tool/local_tarball' +require_relative '../../../puppet/module_tool/installed_modules' +require_relative '../../../puppet/network/uri' module Puppet::ModuleTool module Applications diff --git a/lib/puppet/module_tool/applications/unpacker.rb b/lib/puppet/module_tool/applications/unpacker.rb index ce147974312..4553435b9a9 100644 --- a/lib/puppet/module_tool/applications/unpacker.rb +++ b/lib/puppet/module_tool/applications/unpacker.rb @@ -1,7 +1,7 @@ require 'pathname' require 'tmpdir' -require 'puppet/util/json' -require 'puppet/file_system' +require_relative '../../../puppet/util/json' +require_relative '../../../puppet/file_system' module Puppet::ModuleTool module Applications diff --git a/lib/puppet/module_tool/applications/upgrader.rb b/lib/puppet/module_tool/applications/upgrader.rb index f9babc13ea4..67f7d0702bf 100644 --- a/lib/puppet/module_tool/applications/upgrader.rb +++ b/lib/puppet/module_tool/applications/upgrader.rb @@ -1,10 +1,10 @@ require 'pathname' -require 'puppet/forge' -require 'puppet/module_tool' -require 'puppet/module_tool/shared_behaviors' -require 'puppet/module_tool/install_directory' -require 'puppet/module_tool/installed_modules' +require_relative '../../../puppet/forge' +require_relative '../../../puppet/module_tool' +require_relative '../../../puppet/module_tool/shared_behaviors' +require_relative '../../../puppet/module_tool/install_directory' +require_relative '../../../puppet/module_tool/installed_modules' module Puppet::ModuleTool module Applications diff --git a/lib/puppet/module_tool/checksums.rb b/lib/puppet/module_tool/checksums.rb index fbc12e04806..ebe1d74c144 100644 --- a/lib/puppet/module_tool/checksums.rb +++ b/lib/puppet/module_tool/checksums.rb @@ -1,5 +1,5 @@ require 'digest/md5' -require 'puppet/network/format_support' +require_relative '../../puppet/network/format_support' module Puppet::ModuleTool diff --git a/lib/puppet/module_tool/contents_description.rb b/lib/puppet/module_tool/contents_description.rb index 772a6f0902d..84c92b19009 100644 --- a/lib/puppet/module_tool/contents_description.rb +++ b/lib/puppet/module_tool/contents_description.rb @@ -1,4 +1,4 @@ -require 'puppet/module_tool' +require_relative '../../puppet/module_tool' module Puppet::ModuleTool diff --git a/lib/puppet/module_tool/dependency.rb b/lib/puppet/module_tool/dependency.rb index aa56cf39072..aee20628b5d 100644 --- a/lib/puppet/module_tool/dependency.rb +++ b/lib/puppet/module_tool/dependency.rb @@ -1,5 +1,5 @@ -require 'puppet/module_tool' -require 'puppet/network/format_support' +require_relative '../../puppet/module_tool' +require_relative '../../puppet/network/format_support' module Puppet::ModuleTool diff --git a/lib/puppet/module_tool/errors.rb b/lib/puppet/module_tool/errors.rb index 3f917bd35d4..22ca9b449b4 100644 --- a/lib/puppet/module_tool/errors.rb +++ b/lib/puppet/module_tool/errors.rb @@ -1,11 +1,11 @@ -require 'puppet/module_tool' +require_relative '../../puppet/module_tool' module Puppet::ModuleTool module Errors - require 'puppet/module_tool/errors/base' - require 'puppet/module_tool/errors/installer' - require 'puppet/module_tool/errors/uninstaller' - require 'puppet/module_tool/errors/upgrader' - require 'puppet/module_tool/errors/shared' + require_relative 'errors/base' + require_relative 'errors/installer' + require_relative 'errors/uninstaller' + require_relative 'errors/upgrader' + require_relative 'errors/shared' end end diff --git a/lib/puppet/module_tool/install_directory.rb b/lib/puppet/module_tool/install_directory.rb index 7e0ac254bdb..5d4f5a2007f 100644 --- a/lib/puppet/module_tool/install_directory.rb +++ b/lib/puppet/module_tool/install_directory.rb @@ -1,5 +1,5 @@ -require 'puppet/module_tool' -require 'puppet/module_tool/errors' +require_relative '../../puppet/module_tool' +require_relative '../../puppet/module_tool/errors' module Puppet module ModuleTool diff --git a/lib/puppet/module_tool/installed_modules.rb b/lib/puppet/module_tool/installed_modules.rb index f2800fe7b93..94dc867f831 100644 --- a/lib/puppet/module_tool/installed_modules.rb +++ b/lib/puppet/module_tool/installed_modules.rb @@ -1,7 +1,7 @@ require 'pathname' -require 'puppet/forge' -require 'puppet/module_tool' +require_relative '../../puppet/forge' +require_relative '../../puppet/module_tool' module Puppet::ModuleTool class InstalledModules < SemanticPuppet::Dependency::Source diff --git a/lib/puppet/module_tool/local_tarball.rb b/lib/puppet/module_tool/local_tarball.rb index 6c225812915..c728d3a5cba 100644 --- a/lib/puppet/module_tool/local_tarball.rb +++ b/lib/puppet/module_tool/local_tarball.rb @@ -1,8 +1,8 @@ require 'pathname' require 'tmpdir' -require 'puppet/forge' -require 'puppet/module_tool' +require_relative '../../puppet/forge' +require_relative '../../puppet/module_tool' module Puppet::ModuleTool class LocalTarball < SemanticPuppet::Dependency::Source diff --git a/lib/puppet/module_tool/metadata.rb b/lib/puppet/module_tool/metadata.rb index f3840f327ad..e7006bfc35c 100644 --- a/lib/puppet/module_tool/metadata.rb +++ b/lib/puppet/module_tool/metadata.rb @@ -1,7 +1,7 @@ -require 'puppet/module_tool' -require 'puppet/network/format_support' +require_relative '../../puppet/module_tool' +require_relative '../../puppet/network/format_support' require 'uri' -require 'puppet/util/json' +require_relative '../../puppet/util/json' require 'set' module Puppet::ModuleTool diff --git a/lib/puppet/module_tool/tar.rb b/lib/puppet/module_tool/tar.rb index 11ae1e5a566..ce92b7a06ad 100644 --- a/lib/puppet/module_tool/tar.rb +++ b/lib/puppet/module_tool/tar.rb @@ -1,9 +1,9 @@ -require 'puppet/module_tool' -require 'puppet/util' +require_relative '../../puppet/module_tool' +require_relative '../../puppet/util' module Puppet::ModuleTool::Tar - require 'puppet/module_tool/tar/gnu' - require 'puppet/module_tool/tar/mini' + require_relative 'tar/gnu' + require_relative 'tar/mini' def self.instance if Puppet.features.minitar? && Puppet.features.zlib? diff --git a/lib/puppet/network/format.rb b/lib/puppet/network/format.rb index 2dc44633bf4..391ff3ae4bd 100644 --- a/lib/puppet/network/format.rb +++ b/lib/puppet/network/format.rb @@ -1,4 +1,4 @@ -require 'puppet/confiner' +require_relative '../../puppet/confiner' # A simple class for modeling encoding formats for moving # instances around the network. diff --git a/lib/puppet/network/format_handler.rb b/lib/puppet/network/format_handler.rb index 839314add58..d7d9302f049 100644 --- a/lib/puppet/network/format_handler.rb +++ b/lib/puppet/network/format_handler.rb @@ -1,6 +1,6 @@ require 'yaml' -require 'puppet/network' -require 'puppet/network/format' +require_relative '../../puppet/network' +require_relative '../../puppet/network/format' module Puppet::Network::FormatHandler class FormatError < Puppet::Error; end @@ -105,4 +105,4 @@ def self.format_to_canonical_name_or_nil(format) end end -require 'puppet/network/formats' +require_relative '../../puppet/network/formats' diff --git a/lib/puppet/network/format_support.rb b/lib/puppet/network/format_support.rb index 615967c36ba..ca856110247 100644 --- a/lib/puppet/network/format_support.rb +++ b/lib/puppet/network/format_support.rb @@ -1,4 +1,4 @@ -require 'puppet/network/format_handler' +require_relative '../../puppet/network/format_handler' # Provides network serialization support when included # @api public diff --git a/lib/puppet/network/formats.rb b/lib/puppet/network/formats.rb index 757acc16572..14869fd9196 100644 --- a/lib/puppet/network/formats.rb +++ b/lib/puppet/network/formats.rb @@ -1,5 +1,5 @@ -require 'puppet/network/format_handler' -require 'puppet/util/json' +require_relative '../../puppet/network/format_handler' +require_relative '../../puppet/util/json' Puppet::Network::FormatHandler.create_serialized_formats(:msgpack, :weight => 20, :mime => "application/x-msgpack", :required_methods => [:render_method, :intern_method], :intern_method => :from_data_hash) do diff --git a/lib/puppet/network/http.rb b/lib/puppet/network/http.rb index f86b1e17a6e..b6441dbc565 100644 --- a/lib/puppet/network/http.rb +++ b/lib/puppet/network/http.rb @@ -12,17 +12,17 @@ module Puppet::Network::HTTP CA_URL_PREFIX = "/puppet-ca" CA_URL_VERSIONS = "v1" - require 'puppet/network/authconfig' - require 'puppet/network/authorization' + require_relative '../../puppet/network/authconfig' + require_relative '../../puppet/network/authorization' - require 'puppet/network/http/issues' - require 'puppet/network/http/error' - require 'puppet/network/http/route' - require 'puppet/network/http/api' - require 'puppet/network/http/api/master' - require 'puppet/network/http/api/master/v3' - require 'puppet/network/http/handler' - require 'puppet/network/http/response' - require 'puppet/network/http/request' - require 'puppet/network/http/memory_response' + require_relative 'http/issues' + require_relative 'http/error' + require_relative 'http/route' + require_relative 'http/api' + require_relative 'http/api/master' + require_relative 'http/api/master/v3' + require_relative 'http/handler' + require_relative 'http/response' + require_relative 'http/request' + require_relative 'http/memory_response' end diff --git a/lib/puppet/network/http/api.rb b/lib/puppet/network/http/api.rb index f5b7d18d620..5f79cb7edd1 100644 --- a/lib/puppet/network/http/api.rb +++ b/lib/puppet/network/http/api.rb @@ -1,5 +1,5 @@ class Puppet::Network::HTTP::API - require 'puppet/version' + require_relative '../../../puppet/version' def self.not_found Puppet::Network::HTTP::Route. diff --git a/lib/puppet/network/http/api/indirected_routes.rb b/lib/puppet/network/http/api/indirected_routes.rb index aa04e206968..7ffa26c5d56 100644 --- a/lib/puppet/network/http/api/indirected_routes.rb +++ b/lib/puppet/network/http/api/indirected_routes.rb @@ -1,4 +1,4 @@ -require 'puppet/network/http/api/indirection_type' +require_relative '../../../../puppet/network/http/api/indirection_type' class Puppet::Network::HTTP::API::IndirectedRoutes diff --git a/lib/puppet/network/http/api/master.rb b/lib/puppet/network/http/api/master.rb index 8ad6323240a..bf600903f4b 100644 --- a/lib/puppet/network/http/api/master.rb +++ b/lib/puppet/network/http/api/master.rb @@ -1,3 +1,3 @@ -require 'puppet/network/http/api/server' +require_relative '../../../../puppet/network/http/api/server' Puppet::Network::HTTP::API::Master = Puppet::Network::HTTP::API::Server diff --git a/lib/puppet/network/http/api/master/v3.rb b/lib/puppet/network/http/api/master/v3.rb index 2460edbfba4..0481d07fbb5 100644 --- a/lib/puppet/network/http/api/master/v3.rb +++ b/lib/puppet/network/http/api/master/v3.rb @@ -1,3 +1,3 @@ -require 'puppet/network/http/api/master' -require 'puppet/network/http/api/server/v3' +require_relative '../../../../../puppet/network/http/api/master' +require_relative '../../../../../puppet/network/http/api/server/v3' diff --git a/lib/puppet/network/http/api/master/v3/environments.rb b/lib/puppet/network/http/api/master/v3/environments.rb index 86c9677b070..f7893a870be 100644 --- a/lib/puppet/network/http/api/master/v3/environments.rb +++ b/lib/puppet/network/http/api/master/v3/environments.rb @@ -1,3 +1,3 @@ -require 'puppet/network/http/api/master' -require 'puppet/network/http/api/server/v3/environments' +require_relative '../../../../../../puppet/network/http/api/master' +require_relative '../../../../../../puppet/network/http/api/server/v3/environments' diff --git a/lib/puppet/network/http/api/server/v3.rb b/lib/puppet/network/http/api/server/v3.rb index c172a61d2b6..76cbb67c399 100644 --- a/lib/puppet/network/http/api/server/v3.rb +++ b/lib/puppet/network/http/api/server/v3.rb @@ -1,5 +1,5 @@ -require 'puppet/network/http/api/server/v3/environments' -require 'puppet/network/http/api/indirected_routes' +require_relative 'v3/environments' +require_relative '../../../../../puppet/network/http/api/indirected_routes' module Puppet module Network diff --git a/lib/puppet/network/http/api/server/v3/environments.rb b/lib/puppet/network/http/api/server/v3/environments.rb index 2fa3233c573..ec6732ed7b7 100644 --- a/lib/puppet/network/http/api/server/v3/environments.rb +++ b/lib/puppet/network/http/api/server/v3/environments.rb @@ -1,4 +1,4 @@ -require 'puppet/util/json' +require_relative '../../../../../../puppet/util/json' module Puppet module Network diff --git a/lib/puppet/network/http/connection.rb b/lib/puppet/network/http/connection.rb index 721036ecea5..07a20d47003 100644 --- a/lib/puppet/network/http/connection.rb +++ b/lib/puppet/network/http/connection.rb @@ -1,4 +1,4 @@ -require 'puppet/http' +require_relative '../../../puppet/http' # This will be raised if too many redirects happen for a given HTTP request class Puppet::Network::HTTP::RedirectionLimitExceededException < Puppet::Error ; end diff --git a/lib/puppet/network/http/error.rb b/lib/puppet/network/http/error.rb index ad9a8a98178..e5309a2e7e8 100644 --- a/lib/puppet/network/http/error.rb +++ b/lib/puppet/network/http/error.rb @@ -1,4 +1,4 @@ -require 'puppet/util/json' +require_relative '../../../puppet/util/json' module Puppet::Network::HTTP::Error Issues = Puppet::Network::HTTP::Issues diff --git a/lib/puppet/network/http/handler.rb b/lib/puppet/network/http/handler.rb index 74328e1c2a3..cea8c450ad1 100644 --- a/lib/puppet/network/http/handler.rb +++ b/lib/puppet/network/http/handler.rb @@ -1,9 +1,9 @@ module Puppet::Network::HTTP end -require 'puppet/network/http' -require 'puppet/util/profiler' -require 'puppet/util/profiler/aggregate' +require_relative '../../../puppet/network/http' +require_relative '../../../puppet/util/profiler' +require_relative '../../../puppet/util/profiler/aggregate' require 'resolv' module Puppet::Network::HTTP::Handler diff --git a/lib/puppet/network/http_pool.rb b/lib/puppet/network/http_pool.rb index 788490adfe4..ba84eb3c7a9 100644 --- a/lib/puppet/network/http_pool.rb +++ b/lib/puppet/network/http_pool.rb @@ -1,4 +1,4 @@ -require 'puppet/network/http/connection' +require_relative '../../puppet/network/http/connection' module Puppet::Network; end diff --git a/lib/puppet/node.rb b/lib/puppet/node.rb index 9e433bb9ff3..86eba8fd6d9 100644 --- a/lib/puppet/node.rb +++ b/lib/puppet/node.rb @@ -1,9 +1,9 @@ -require 'puppet/indirector' +require_relative '../puppet/indirector' # A class for managing nodes, including their facts and environment. class Puppet::Node - require 'puppet/node/facts' - require 'puppet/node/environment' + require_relative 'node/facts' + require_relative 'node/environment' # Set up indirection, so that nodes can be looked for in # the node sources. diff --git a/lib/puppet/node/environment.rb b/lib/puppet/node/environment.rb index c178f2791ff..86a9e9d78f7 100644 --- a/lib/puppet/node/environment.rb +++ b/lib/puppet/node/environment.rb @@ -1,7 +1,7 @@ -require 'puppet/util' +require_relative '../../puppet/util' require 'monitor' -require 'puppet/parser/parser_factory' -require 'puppet/concurrent/lock' +require_relative '../../puppet/parser/parser_factory' +require_relative '../../puppet/concurrent/lock' # Just define it, so this class has fewer load dependencies. class Puppet::Node diff --git a/lib/puppet/node/facts.rb b/lib/puppet/node/facts.rb index 8ccddf3c25e..f7385e82103 100644 --- a/lib/puppet/node/facts.rb +++ b/lib/puppet/node/facts.rb @@ -1,8 +1,8 @@ require 'time' -require 'puppet/node' -require 'puppet/indirector' -require 'puppet/util/psych_support' +require_relative '../../puppet/node' +require_relative '../../puppet/indirector' +require_relative '../../puppet/util/psych_support' # Manage a given node's facts. This either accepts facts and stores them, or diff --git a/lib/puppet/pal/pal_api.rb b/lib/puppet/pal/pal_api.rb index e725208f603..c9287114a19 100644 --- a/lib/puppet/pal/pal_api.rb +++ b/lib/puppet/pal/pal_api.rb @@ -1,15 +1,15 @@ module Puppet - require 'puppet/parser/script_compiler' - require 'puppet/parser/catalog_compiler' + require_relative '../../puppet/parser/script_compiler' + require_relative '../../puppet/parser/catalog_compiler' module Pal - require 'puppet/pal/json_catalog_encoder' - require 'puppet/pal/function_signature' - require 'puppet/pal/task_signature' - require 'puppet/pal/plan_signature' - require 'puppet/pal/compiler' - require 'puppet/pal/script_compiler' - require 'puppet/pal/catalog_compiler' - require 'puppet/pal/pal_impl' + require_relative '../../puppet/pal/json_catalog_encoder' + require_relative '../../puppet/pal/function_signature' + require_relative '../../puppet/pal/task_signature' + require_relative '../../puppet/pal/plan_signature' + require_relative '../../puppet/pal/compiler' + require_relative '../../puppet/pal/script_compiler' + require_relative '../../puppet/pal/catalog_compiler' + require_relative '../../puppet/pal/pal_impl' end end diff --git a/lib/puppet/pal/pal_impl.rb b/lib/puppet/pal/pal_impl.rb index a44c31c31d7..df06024ef05 100644 --- a/lib/puppet/pal/pal_impl.rb +++ b/lib/puppet/pal/pal_impl.rb @@ -1,9 +1,9 @@ # Puppet as a Library "PAL" # Yes, this requires all of puppet for now because 'settings' and many other things... -require 'puppet' -require 'puppet/parser/script_compiler' -require 'puppet/parser/catalog_compiler' +require_relative '../../puppet' +require_relative '../../puppet/parser/script_compiler' +require_relative '../../puppet/parser/catalog_compiler' module Puppet # This is the main entry point for "Puppet As a Library" PAL. diff --git a/lib/puppet/parameter.rb b/lib/puppet/parameter.rb index 520fb51d13f..83e10f22535 100644 --- a/lib/puppet/parameter.rb +++ b/lib/puppet/parameter.rb @@ -1,5 +1,5 @@ -require 'puppet/util/logging' -require 'puppet/util/docs' +require_relative '../puppet/util/logging' +require_relative '../puppet/util/docs' # The Parameter class is the implementation of a resource's attributes of _parameter_ kind. # The Parameter class is also the base class for {Puppet::Property}, and is used to describe meta-parameters @@ -22,7 +22,7 @@ class Puppet::Parameter include Puppet::Util::Errors include Puppet::Util::Logging - require 'puppet/parameter/value_collection' + require_relative 'parameter/value_collection' class << self include Puppet::Util @@ -571,4 +571,4 @@ def self.format_value_for_display(value) # @see Puppet::Parser::Compiler#finish end -require 'puppet/parameter/path' +require_relative 'parameter/path' diff --git a/lib/puppet/parameter/boolean.rb b/lib/puppet/parameter/boolean.rb index b63ec73c315..6e1b44c0fa4 100644 --- a/lib/puppet/parameter/boolean.rb +++ b/lib/puppet/parameter/boolean.rb @@ -1,4 +1,4 @@ -require 'puppet/coercion' +require_relative '../../puppet/coercion' # This specialized {Puppet::Parameter} handles Boolean options, accepting lots # of strings and symbols for both truth and falsehood. diff --git a/lib/puppet/parameter/package_options.rb b/lib/puppet/parameter/package_options.rb index 57da8aee3eb..0ad9631284e 100644 --- a/lib/puppet/parameter/package_options.rb +++ b/lib/puppet/parameter/package_options.rb @@ -1,4 +1,4 @@ -require 'puppet/parameter' +require_relative '../../puppet/parameter' # This specialized {Puppet::Parameter} handles munging of package options. # Package options are passed as an array of key value pairs. Special munging is diff --git a/lib/puppet/parameter/path.rb b/lib/puppet/parameter/path.rb index b72c0ee5d8c..5a6bab297e5 100644 --- a/lib/puppet/parameter/path.rb +++ b/lib/puppet/parameter/path.rb @@ -1,4 +1,4 @@ -require 'puppet/parameter' +require_relative '../../puppet/parameter' # This specialized {Puppet::Parameter} handles validation and munging of paths. # By default, a single path is accepted, and by calling {accept_arrays} it is possible to diff --git a/lib/puppet/parameter/value.rb b/lib/puppet/parameter/value.rb index 4c3a7915b11..cebc91ac61b 100644 --- a/lib/puppet/parameter/value.rb +++ b/lib/puppet/parameter/value.rb @@ -1,4 +1,4 @@ -require 'puppet/parameter/value_collection' +require_relative '../../puppet/parameter/value_collection' # Describes an acceptable value for a parameter or property. # An acceptable value is either specified as a literal value or a regular expression. diff --git a/lib/puppet/parameter/value_collection.rb b/lib/puppet/parameter/value_collection.rb index 8138c1d9848..45a86dd0d05 100644 --- a/lib/puppet/parameter/value_collection.rb +++ b/lib/puppet/parameter/value_collection.rb @@ -1,4 +1,4 @@ -require 'puppet/parameter/value' +require_relative '../../puppet/parameter/value' # A collection of values and regular expressions, used for specifying allowed values # in a given parameter. diff --git a/lib/puppet/parser.rb b/lib/puppet/parser.rb index e5374bd51c7..857f5382191 100644 --- a/lib/puppet/parser.rb +++ b/lib/puppet/parser.rb @@ -1,20 +1,20 @@ # is only needed to create the name space module Puppet::Parser; end -require 'puppet/parser/ast' -require 'puppet/parser/abstract_compiler' -require 'puppet/parser/compiler' -require 'puppet/parser/compiler/catalog_validator' -require 'puppet/resource/type_collection' +require_relative 'parser/ast' +require_relative 'parser/abstract_compiler' +require_relative 'parser/compiler' +require_relative 'parser/compiler/catalog_validator' +require_relative '../puppet/resource/type_collection' -require 'puppet/parser/functions' -require 'puppet/parser/files' -require 'puppet/parser/relationship' +require_relative 'parser/functions' +require_relative 'parser/files' +require_relative 'parser/relationship' -require 'puppet/resource/type' +require_relative '../puppet/resource/type' require 'monitor' -require 'puppet/parser/compiler/catalog_validator/relationship_validator.rb' +require_relative 'parser/compiler/catalog_validator/relationship_validator.rb' # PUP-3274 This should probably go someplace else class Puppet::LexError < RuntimeError; end diff --git a/lib/puppet/parser/ast.rb b/lib/puppet/parser/ast.rb index 4572b5cf641..8df7e220c80 100644 --- a/lib/puppet/parser/ast.rb +++ b/lib/puppet/parser/ast.rb @@ -51,11 +51,11 @@ def initialize(file: nil, line: nil, pos: nil) end # And include all of the AST subclasses. -require 'puppet/parser/ast/branch' -require 'puppet/parser/ast/leaf' -require 'puppet/parser/ast/block_expression' -require 'puppet/parser/ast/hostclass' -require 'puppet/parser/ast/node' -require 'puppet/parser/ast/resource' -require 'puppet/parser/ast/resource_instance' -require 'puppet/parser/ast/resourceparam' +require_relative 'ast/branch' +require_relative 'ast/leaf' +require_relative 'ast/block_expression' +require_relative 'ast/hostclass' +require_relative 'ast/node' +require_relative 'ast/resource' +require_relative 'ast/resource_instance' +require_relative 'ast/resourceparam' diff --git a/lib/puppet/parser/ast/hostclass.rb b/lib/puppet/parser/ast/hostclass.rb index 50ac55d9871..a6af859fbf6 100644 --- a/lib/puppet/parser/ast/hostclass.rb +++ b/lib/puppet/parser/ast/hostclass.rb @@ -1,4 +1,4 @@ -require 'puppet/parser/ast/top_level_construct' +require_relative '../../../puppet/parser/ast/top_level_construct' class Puppet::Parser::AST::Hostclass < Puppet::Parser::AST::TopLevelConstruct attr_accessor :name, :context diff --git a/lib/puppet/parser/ast/pops_bridge.rb b/lib/puppet/parser/ast/pops_bridge.rb index 2d9301f6d93..78614bfef9d 100644 --- a/lib/puppet/parser/ast/pops_bridge.rb +++ b/lib/puppet/parser/ast/pops_bridge.rb @@ -1,5 +1,5 @@ -require 'puppet/parser/ast/top_level_construct' -require 'puppet/pops' +require_relative '../../../puppet/parser/ast/top_level_construct' +require_relative '../../../puppet/pops' # The AST::Bridge contains classes that bridges between the new Pops based model # and the 3.x AST. This is required to be able to reuse the Puppet::Resource::Type which is diff --git a/lib/puppet/parser/catalog_compiler.rb b/lib/puppet/parser/catalog_compiler.rb index e3027b15cbf..482f136e04c 100644 --- a/lib/puppet/parser/catalog_compiler.rb +++ b/lib/puppet/parser/catalog_compiler.rb @@ -1,5 +1,5 @@ -require 'puppet/loaders' -require 'puppet/pops' +require_relative '../../puppet/loaders' +require_relative '../../puppet/pops' # A Catalog "compiler" that is like the regular compiler but with an API # that is harmonized with the ScriptCompiler diff --git a/lib/puppet/parser/compiler.rb b/lib/puppet/parser/compiler.rb index 37948c5fdca..3a57e289b95 100644 --- a/lib/puppet/parser/compiler.rb +++ b/lib/puppet/parser/compiler.rb @@ -1,11 +1,11 @@ require 'forwardable' -require 'puppet/node' -require 'puppet/resource/catalog' -require 'puppet/util/errors' +require_relative '../../puppet/node' +require_relative '../../puppet/resource/catalog' +require_relative '../../puppet/util/errors' -require 'puppet/loaders' -require 'puppet/pops' +require_relative '../../puppet/loaders' +require_relative '../../puppet/pops' # Maintain a graph of scopes, along with a bunch of data # about the individual catalog we're compiling. diff --git a/lib/puppet/parser/e4_parser_adapter.rb b/lib/puppet/parser/e4_parser_adapter.rb index 72ec76c033e..1ef50f7decf 100644 --- a/lib/puppet/parser/e4_parser_adapter.rb +++ b/lib/puppet/parser/e4_parser_adapter.rb @@ -1,4 +1,4 @@ -require 'puppet/pops' +require_relative '../../puppet/pops' module Puppet module Parser diff --git a/lib/puppet/parser/functions.rb b/lib/puppet/parser/functions.rb index 314dacca1fe..6050550ef27 100644 --- a/lib/puppet/parser/functions.rb +++ b/lib/puppet/parser/functions.rb @@ -1,7 +1,7 @@ -require 'puppet/util/autoload' -require 'puppet/parser/scope' -require 'puppet/pops/adaptable' -require 'puppet/concurrent/lock' +require_relative '../../puppet/util/autoload' +require_relative '../../puppet/parser/scope' +require_relative '../../puppet/pops/adaptable' +require_relative '../../puppet/concurrent/lock' # A module for managing parser functions. Each specified function # is added to a central module that then gets included into the Scope diff --git a/lib/puppet/parser/functions/digest.rb b/lib/puppet/parser/functions/digest.rb index 8cd75c3fb65..418fcfb100b 100644 --- a/lib/puppet/parser/functions/digest.rb +++ b/lib/puppet/parser/functions/digest.rb @@ -1,4 +1,4 @@ -require 'puppet/util/checksums' +require_relative '../../../puppet/util/checksums' Puppet::Parser::Functions::newfunction(:digest, :type => :rvalue, :arity => 1, :doc => "Returns a hash value from a provided string using the digest_algorithm setting from the Puppet config file.") do |args| algo = Puppet[:digest_algorithm] Puppet::Util::Checksums.method(algo.intern).call args[0] diff --git a/lib/puppet/parser/functions/file.rb b/lib/puppet/parser/functions/file.rb index e6520043264..d89d9833b07 100644 --- a/lib/puppet/parser/functions/file.rb +++ b/lib/puppet/parser/functions/file.rb @@ -1,4 +1,4 @@ -require 'puppet/file_system' +require_relative '../../../puppet/file_system' Puppet::Parser::Functions::newfunction( :file, :arity => -2, :type => :rvalue, diff --git a/lib/puppet/parser/functions/versioncmp.rb b/lib/puppet/parser/functions/versioncmp.rb index 302250d4f55..e27135b37fd 100644 --- a/lib/puppet/parser/functions/versioncmp.rb +++ b/lib/puppet/parser/functions/versioncmp.rb @@ -1,4 +1,4 @@ -require 'puppet/util/package' +require_relative '../../../puppet/util/package' Puppet::Parser::Functions::newfunction( :versioncmp, :type => :rvalue, :arity => 2, :doc => "Compares two version numbers. diff --git a/lib/puppet/parser/parser_factory.rb b/lib/puppet/parser/parser_factory.rb index 91d49039e59..622cd68ec14 100644 --- a/lib/puppet/parser/parser_factory.rb +++ b/lib/puppet/parser/parser_factory.rb @@ -17,8 +17,8 @@ def self.parser # def self.evaluating_parser unless defined?(Puppet::Parser::E4ParserAdapter) - require 'puppet/parser/e4_parser_adapter' - require 'puppet/pops/parser/code_merger' + require_relative '../../puppet/parser/e4_parser_adapter' + require_relative '../../puppet/pops/parser/code_merger' end E4ParserAdapter.new end diff --git a/lib/puppet/parser/resource.rb b/lib/puppet/parser/resource.rb index d4bb2156c9f..e76a4a5250c 100644 --- a/lib/puppet/parser/resource.rb +++ b/lib/puppet/parser/resource.rb @@ -1,11 +1,11 @@ -require 'puppet/resource' +require_relative '../../puppet/resource' # The primary difference between this class and its # parent is that this class has rules on who can set # parameters class Puppet::Parser::Resource < Puppet::Resource - require 'puppet/parser/resource/param' - require 'puppet/util/tagging' + require_relative 'resource/param' + require_relative '../../puppet/util/tagging' include Puppet::Util include Puppet::Util::Errors diff --git a/lib/puppet/parser/scope.rb b/lib/puppet/parser/scope.rb index ce8d35df79d..9d42135f152 100644 --- a/lib/puppet/parser/scope.rb +++ b/lib/puppet/parser/scope.rb @@ -2,9 +2,9 @@ # such. require 'forwardable' -require 'puppet/parser' -require 'puppet/parser/templatewrapper' -require 'puppet/parser/resource' +require_relative '../../puppet/parser' +require_relative '../../puppet/parser/templatewrapper' +require_relative '../../puppet/parser/resource' # This class is part of the internal parser/evaluator/compiler functionality of Puppet. # It is passed between the various classes that participate in evaluation. diff --git a/lib/puppet/parser/script_compiler.rb b/lib/puppet/parser/script_compiler.rb index 6c07f36316f..5bc8c7cffe4 100644 --- a/lib/puppet/parser/script_compiler.rb +++ b/lib/puppet/parser/script_compiler.rb @@ -1,5 +1,5 @@ -require 'puppet/loaders' -require 'puppet/pops' +require_relative '../../puppet/loaders' +require_relative '../../puppet/pops' # A Script "compiler" that does not support catalog operations # diff --git a/lib/puppet/parser/templatewrapper.rb b/lib/puppet/parser/templatewrapper.rb index 1bd7d67a681..09d46722331 100644 --- a/lib/puppet/parser/templatewrapper.rb +++ b/lib/puppet/parser/templatewrapper.rb @@ -1,6 +1,6 @@ -require 'puppet/parser/files' +require_relative '../../puppet/parser/files' require 'erb' -require 'puppet/file_system' +require_relative '../../puppet/file_system' # A simple wrapper for templates, so they don't have full access to # the scope objects. diff --git a/lib/puppet/parser/type_loader.rb b/lib/puppet/parser/type_loader.rb index 4ee0830b661..a1507a0752c 100644 --- a/lib/puppet/parser/type_loader.rb +++ b/lib/puppet/parser/type_loader.rb @@ -1,6 +1,6 @@ require 'find' require 'forwardable' -require 'puppet/parser/parser_factory' +require_relative '../../puppet/parser/parser_factory' class Puppet::Parser::TypeLoader extend Forwardable diff --git a/lib/puppet/plugins/configuration.rb b/lib/puppet/plugins/configuration.rb index f4ca8c3a601..ccfb47d7d30 100644 --- a/lib/puppet/plugins/configuration.rb +++ b/lib/puppet/plugins/configuration.rb @@ -7,11 +7,11 @@ # module Puppet::Plugins module Configuration - require 'puppet/plugins/syntax_checkers' - require 'puppet/syntax_checkers/base64' - require 'puppet/syntax_checkers/json' - require 'puppet/syntax_checkers/pp' - require 'puppet/syntax_checkers/epp' + require_relative '../../puppet/plugins/syntax_checkers' + require_relative '../../puppet/syntax_checkers/base64' + require_relative '../../puppet/syntax_checkers/json' + require_relative '../../puppet/syntax_checkers/pp' + require_relative '../../puppet/syntax_checkers/epp' def self.load_plugins # Register extensions diff --git a/lib/puppet/pops.rb b/lib/puppet/pops.rb index 0f5ce6f3795..e8807f0b1bc 100644 --- a/lib/puppet/pops.rb +++ b/lib/puppet/pops.rb @@ -22,100 +22,100 @@ module Pops require 'semantic_puppet' - require 'puppet/pops/patterns' - require 'puppet/pops/utils' - require 'puppet/pops/puppet_stack' + require_relative 'pops/patterns' + require_relative 'pops/utils' + require_relative 'pops/puppet_stack' - require 'puppet/pops/adaptable' - require 'puppet/pops/adapters' + require_relative 'pops/adaptable' + require_relative 'pops/adapters' - require 'puppet/pops/visitable' - require 'puppet/pops/visitor' + require_relative 'pops/visitable' + require_relative 'pops/visitor' - require 'puppet/pops/issues' - require 'puppet/pops/semantic_error' - require 'puppet/pops/label_provider' - require 'puppet/pops/validation' - require 'puppet/pops/issue_reporter' + require_relative 'pops/issues' + require_relative 'pops/semantic_error' + require_relative 'pops/label_provider' + require_relative 'pops/validation' + require_relative 'pops/issue_reporter' - require 'puppet/pops/time/timespan' - require 'puppet/pops/time/timestamp' + require_relative 'pops/time/timespan' + require_relative 'pops/time/timestamp' # (the Types module initializes itself) - require 'puppet/pops/types/types' - require 'puppet/pops/types/string_converter' - require 'puppet/pops/lookup' + require_relative 'pops/types/types' + require_relative 'pops/types/string_converter' + require_relative 'pops/lookup' - require 'puppet/pops/merge_strategy' + require_relative 'pops/merge_strategy' module Model - require 'puppet/pops/model/ast' - require 'puppet/pops/model/tree_dumper' - require 'puppet/pops/model/ast_transformer' - require 'puppet/pops/model/factory' - require 'puppet/pops/model/model_tree_dumper' - require 'puppet/pops/model/model_label_provider' + require_relative 'pops/model/ast' + require_relative 'pops/model/tree_dumper' + require_relative 'pops/model/ast_transformer' + require_relative 'pops/model/factory' + require_relative 'pops/model/model_tree_dumper' + require_relative 'pops/model/model_label_provider' end module Resource - require 'puppet/pops/resource/resource_type_impl' + require_relative 'pops/resource/resource_type_impl' end module Evaluator - require 'puppet/pops/evaluator/literal_evaluator' - require 'puppet/pops/evaluator/callable_signature' - require 'puppet/pops/evaluator/runtime3_converter' - require 'puppet/pops/evaluator/runtime3_resource_support' - require 'puppet/pops/evaluator/runtime3_support' - require 'puppet/pops/evaluator/evaluator_impl' - require 'puppet/pops/evaluator/epp_evaluator' - require 'puppet/pops/evaluator/collector_transformer' - require 'puppet/pops/evaluator/puppet_proc' - require 'puppet/pops/evaluator/deferred_resolver' + require_relative 'pops/evaluator/literal_evaluator' + require_relative 'pops/evaluator/callable_signature' + require_relative 'pops/evaluator/runtime3_converter' + require_relative 'pops/evaluator/runtime3_resource_support' + require_relative 'pops/evaluator/runtime3_support' + require_relative 'pops/evaluator/evaluator_impl' + require_relative 'pops/evaluator/epp_evaluator' + require_relative 'pops/evaluator/collector_transformer' + require_relative 'pops/evaluator/puppet_proc' + require_relative 'pops/evaluator/deferred_resolver' module Collectors - require 'puppet/pops/evaluator/collectors/abstract_collector' - require 'puppet/pops/evaluator/collectors/fixed_set_collector' - require 'puppet/pops/evaluator/collectors/catalog_collector' - require 'puppet/pops/evaluator/collectors/exported_collector' + require_relative 'pops/evaluator/collectors/abstract_collector' + require_relative 'pops/evaluator/collectors/fixed_set_collector' + require_relative 'pops/evaluator/collectors/catalog_collector' + require_relative 'pops/evaluator/collectors/exported_collector' end end module Parser - require 'puppet/pops/parser/eparser' - require 'puppet/pops/parser/parser_support' - require 'puppet/pops/parser/locator' - require 'puppet/pops/parser/locatable' - require 'puppet/pops/parser/lexer2' - require 'puppet/pops/parser/evaluating_parser' - require 'puppet/pops/parser/epp_parser' - require 'puppet/pops/parser/code_merger' + require_relative 'pops/parser/eparser' + require_relative 'pops/parser/parser_support' + require_relative 'pops/parser/locator' + require_relative 'pops/parser/locatable' + require_relative 'pops/parser/lexer2' + require_relative 'pops/parser/evaluating_parser' + require_relative 'pops/parser/epp_parser' + require_relative 'pops/parser/code_merger' end module Validation - require 'puppet/pops/validation/checker4_0' - require 'puppet/pops/validation/validator_factory_4_0' + require_relative 'pops/validation/checker4_0' + require_relative 'pops/validation/validator_factory_4_0' end # Subsystem for puppet functions defined in ruby. # # @api public module Functions - require 'puppet/pops/functions/function' - require 'puppet/pops/functions/dispatch' - require 'puppet/pops/functions/dispatcher' + require_relative 'pops/functions/function' + require_relative 'pops/functions/dispatch' + require_relative 'pops/functions/dispatcher' end module Migration - require 'puppet/pops/migration/migration_checker' + require_relative 'pops/migration/migration_checker' end module Serialization - require 'puppet/pops/serialization' + require_relative 'pops/serialization' end end - require 'puppet/parser/ast/pops_bridge' - require 'puppet/functions' - require 'puppet/datatypes' + require_relative '../puppet/parser/ast/pops_bridge' + require_relative '../puppet/functions' + require_relative '../puppet/datatypes' Puppet::Pops::Model.register_pcore_types end diff --git a/lib/puppet/pops/evaluator/deferred_resolver.rb b/lib/puppet/pops/evaluator/deferred_resolver.rb index 0bbddcd0818..d60dc1f4918 100644 --- a/lib/puppet/pops/evaluator/deferred_resolver.rb +++ b/lib/puppet/pops/evaluator/deferred_resolver.rb @@ -1,4 +1,4 @@ -require 'puppet/parser/script_compiler' +require_relative '../../../puppet/parser/script_compiler' module Puppet::Pops module Evaluator diff --git a/lib/puppet/pops/evaluator/evaluator_impl.rb b/lib/puppet/pops/evaluator/evaluator_impl.rb index 66b5fb27b41..792927febe4 100644 --- a/lib/puppet/pops/evaluator/evaluator_impl.rb +++ b/lib/puppet/pops/evaluator/evaluator_impl.rb @@ -1,10 +1,10 @@ -require 'puppet/parser/scope' -require 'puppet/pops/evaluator/compare_operator' -require 'puppet/pops/evaluator/relationship_operator' -require 'puppet/pops/evaluator/access_operator' -require 'puppet/pops/evaluator/closure' -require 'puppet/pops/evaluator/external_syntax_support' -require 'puppet/pops/types/iterable' +require_relative '../../../puppet/parser/scope' +require_relative '../../../puppet/pops/evaluator/compare_operator' +require_relative '../../../puppet/pops/evaluator/relationship_operator' +require_relative '../../../puppet/pops/evaluator/access_operator' +require_relative '../../../puppet/pops/evaluator/closure' +require_relative '../../../puppet/pops/evaluator/external_syntax_support' +require_relative '../../../puppet/pops/types/iterable' module Puppet::Pops module Evaluator diff --git a/lib/puppet/pops/evaluator/external_syntax_support.rb b/lib/puppet/pops/evaluator/external_syntax_support.rb index 58c0ed635a8..b8f11d63cb9 100644 --- a/lib/puppet/pops/evaluator/external_syntax_support.rb +++ b/lib/puppet/pops/evaluator/external_syntax_support.rb @@ -1,7 +1,7 @@ # This module is an integral part of the evaluator. It deals with the concern of validating # external syntax in text produced by heredoc and templates. # -require 'puppet/plugins/syntax_checkers' +require_relative '../../../puppet/plugins/syntax_checkers' module Puppet::Pops::Evaluator::ExternalSyntaxSupport def assert_external_syntax(_, result, syntax, reference_expr) # ignore 'unspecified syntax' diff --git a/lib/puppet/pops/loader/task_instantiator.rb b/lib/puppet/pops/loader/task_instantiator.rb index 97583e870b2..d1820d8cd64 100644 --- a/lib/puppet/pops/loader/task_instantiator.rb +++ b/lib/puppet/pops/loader/task_instantiator.rb @@ -1,6 +1,6 @@ # The TypeDefinitionInstantiator instantiates a type alias or a type definition # -require 'puppet/module/task' +require_relative '../../../puppet/module/task' module Puppet::Pops module Loader class TaskInstantiator diff --git a/lib/puppet/pops/lookup/invocation.rb b/lib/puppet/pops/lookup/invocation.rb index 9c648497e48..eca5ec62fb6 100644 --- a/lib/puppet/pops/lookup/invocation.rb +++ b/lib/puppet/pops/lookup/invocation.rb @@ -1,4 +1,4 @@ -require 'puppet/thread_local' +require_relative '../../../puppet/thread_local' require_relative 'explainer' diff --git a/lib/puppet/pops/model/ast_transformer.rb b/lib/puppet/pops/model/ast_transformer.rb index da3b93d86a3..3006a5fd57f 100644 --- a/lib/puppet/pops/model/ast_transformer.rb +++ b/lib/puppet/pops/model/ast_transformer.rb @@ -1,4 +1,4 @@ -require 'puppet/parser/ast' +require_relative '../../../puppet/parser/ast' # The receiver of `import(file)` calls; once per imported file, or nil if imports are ignored # diff --git a/lib/puppet/pops/model/pn_transformer.rb b/lib/puppet/pops/model/pn_transformer.rb index 6d46efdaa88..007616ab247 100644 --- a/lib/puppet/pops/model/pn_transformer.rb +++ b/lib/puppet/pops/model/pn_transformer.rb @@ -1,4 +1,4 @@ -require 'puppet/concurrent/thread_local_singleton' +require_relative '../../../puppet/concurrent/thread_local_singleton' module Puppet::Pops module Model diff --git a/lib/puppet/pops/parser/eparser.rb b/lib/puppet/pops/parser/eparser.rb index 0cf19da1ef3..dd1ac31699e 100644 --- a/lib/puppet/pops/parser/eparser.rb +++ b/lib/puppet/pops/parser/eparser.rb @@ -6,8 +6,8 @@ require 'racc/parser.rb' -require 'puppet' -require 'puppet/pops' +require_relative '../../../puppet' +require_relative '../../../puppet/pops' module Puppet class ParseError < Puppet::Error; end diff --git a/lib/puppet/pops/parser/evaluating_parser.rb b/lib/puppet/pops/parser/evaluating_parser.rb index ad366dc1192..72c3e31490d 100644 --- a/lib/puppet/pops/parser/evaluating_parser.rb +++ b/lib/puppet/pops/parser/evaluating_parser.rb @@ -1,4 +1,4 @@ -require 'puppet/concurrent/thread_local_singleton' +require_relative '../../../puppet/concurrent/thread_local_singleton' module Puppet::Pops module Parser diff --git a/lib/puppet/pops/parser/lexer2.rb b/lib/puppet/pops/parser/lexer2.rb index 39edb255670..c2ad39fb1b1 100644 --- a/lib/puppet/pops/parser/lexer2.rb +++ b/lib/puppet/pops/parser/lexer2.rb @@ -6,11 +6,11 @@ # or Token.new([token], locator) with the same API x[0] = token_symbol, x[1] = self, x[:key] = (:value, :file, :line, :pos) etc require 'strscan' -require 'puppet/pops/parser/lexer_support' -require 'puppet/pops/parser/heredoc_support' -require 'puppet/pops/parser/interpolation_support' -require 'puppet/pops/parser/epp_support' -require 'puppet/pops/parser/slurp_support' +require_relative '../../../puppet/pops/parser/lexer_support' +require_relative '../../../puppet/pops/parser/heredoc_support' +require_relative '../../../puppet/pops/parser/interpolation_support' +require_relative '../../../puppet/pops/parser/epp_support' +require_relative '../../../puppet/pops/parser/slurp_support' module Puppet::Pops module Parser diff --git a/lib/puppet/pops/parser/lexer_support.rb b/lib/puppet/pops/parser/lexer_support.rb index 15b6af6c232..d8c8f7f4488 100644 --- a/lib/puppet/pops/parser/lexer_support.rb +++ b/lib/puppet/pops/parser/lexer_support.rb @@ -2,7 +2,7 @@ module Puppet::Pops module Parser -require 'puppet/util/multi_match' +require_relative '../../../puppet/util/multi_match' # This is an integral part of the Lexer. It is broken out into a separate module # for maintainability of the code, and making the various parts of the lexer focused. diff --git a/lib/puppet/pops/parser/parser_support.rb b/lib/puppet/pops/parser/parser_support.rb index 75b1ee0fadb..1e158538271 100644 --- a/lib/puppet/pops/parser/parser_support.rb +++ b/lib/puppet/pops/parser/parser_support.rb @@ -1,7 +1,7 @@ -require 'puppet/parser/functions' -require 'puppet/parser/files' -require 'puppet/resource/type_collection' -require 'puppet/resource/type' +require_relative '../../../puppet/parser/functions' +require_relative '../../../puppet/parser/files' +require_relative '../../../puppet/resource/type_collection' +require_relative '../../../puppet/resource/type' require 'monitor' module Puppet::Pops diff --git a/lib/puppet/pops/puppet_stack.rb b/lib/puppet/pops/puppet_stack.rb index 1ceff9b192b..9b211e11a65 100644 --- a/lib/puppet/pops/puppet_stack.rb +++ b/lib/puppet/pops/puppet_stack.rb @@ -1,4 +1,4 @@ -require 'puppet/thread_local' +require_relative '../../puppet/thread_local' module Puppet module Pops diff --git a/lib/puppet/pops/serialization/json.rb b/lib/puppet/pops/serialization/json.rb index 53943c4755d..d6859dad2ef 100644 --- a/lib/puppet/pops/serialization/json.rb +++ b/lib/puppet/pops/serialization/json.rb @@ -1,4 +1,4 @@ -require 'puppet/util/json' +require_relative '../../../puppet/util/json' module Puppet::Pops module Serialization diff --git a/lib/puppet/pops/serialization/json_path.rb b/lib/puppet/pops/serialization/json_path.rb index 0b6dd14f2d4..29a1fb5b7ae 100644 --- a/lib/puppet/pops/serialization/json_path.rb +++ b/lib/puppet/pops/serialization/json_path.rb @@ -1,4 +1,4 @@ -require 'puppet/concurrent/thread_local_singleton' +require_relative '../../../puppet/concurrent/thread_local_singleton' module Puppet::Pops module Serialization diff --git a/lib/puppet/pops/time/timespan.rb b/lib/puppet/pops/time/timespan.rb index 5990cfc5e4f..0a65fee3cf9 100644 --- a/lib/puppet/pops/time/timespan.rb +++ b/lib/puppet/pops/time/timespan.rb @@ -1,4 +1,4 @@ -require 'puppet/concurrent/thread_local_singleton' +require_relative '../../../puppet/concurrent/thread_local_singleton' module Puppet::Pops module Time diff --git a/lib/puppet/pops/types/string_converter.rb b/lib/puppet/pops/types/string_converter.rb index 21d1f45dd90..8160a06169d 100644 --- a/lib/puppet/pops/types/string_converter.rb +++ b/lib/puppet/pops/types/string_converter.rb @@ -1,4 +1,4 @@ -require 'puppet/concurrent/thread_local_singleton' +require_relative '../../../puppet/concurrent/thread_local_singleton' module Puppet::Pops module Types diff --git a/lib/puppet/pops/types/type_calculator.rb b/lib/puppet/pops/types/type_calculator.rb index df62fa5e09d..e1fc229df06 100644 --- a/lib/puppet/pops/types/type_calculator.rb +++ b/lib/puppet/pops/types/type_calculator.rb @@ -1,4 +1,4 @@ -require 'puppet/concurrent/thread_local_singleton' +require_relative '../../../puppet/concurrent/thread_local_singleton' module Puppet::Pops module Types diff --git a/lib/puppet/pops/types/type_formatter.rb b/lib/puppet/pops/types/type_formatter.rb index 9175ed41c15..9ae5177b3e0 100644 --- a/lib/puppet/pops/types/type_formatter.rb +++ b/lib/puppet/pops/types/type_formatter.rb @@ -1,4 +1,4 @@ -require 'puppet/concurrent/thread_local_singleton' +require_relative '../../../puppet/concurrent/thread_local_singleton' module Puppet::Pops module Types diff --git a/lib/puppet/pops/types/type_parser.rb b/lib/puppet/pops/types/type_parser.rb index 903769add94..61bc42dfe6c 100644 --- a/lib/puppet/pops/types/type_parser.rb +++ b/lib/puppet/pops/types/type_parser.rb @@ -1,4 +1,4 @@ -require 'puppet/concurrent/thread_local_singleton' +require_relative '../../../puppet/concurrent/thread_local_singleton' # This class provides parsing of Type Specification from a string into the Type # Model that is produced by the TypeFactory. diff --git a/lib/puppet/pops/types/types.rb b/lib/puppet/pops/types/types.rb index 948f86c94e1..2cc6c15ecb9 100644 --- a/lib/puppet/pops/types/types.rb +++ b/lib/puppet/pops/types/types.rb @@ -3610,7 +3610,7 @@ def when_self_recursion_detected end end -require 'puppet/pops/pcore' +require_relative '../../../puppet/pops/pcore' require_relative 'annotatable' require_relative 'p_meta_type' diff --git a/lib/puppet/pops/validation/checker4_0.rb b/lib/puppet/pops/validation/checker4_0.rb index 008b191105d..47db54466a3 100644 --- a/lib/puppet/pops/validation/checker4_0.rb +++ b/lib/puppet/pops/validation/checker4_0.rb @@ -1,4 +1,4 @@ -require 'puppet/pops/evaluator/external_syntax_support' +require_relative '../../../puppet/pops/evaluator/external_syntax_support' module Puppet::Pops module Validation diff --git a/lib/puppet/property.rb b/lib/puppet/property.rb index cc5251a936a..3384aacd466 100644 --- a/lib/puppet/property.rb +++ b/lib/puppet/property.rb @@ -1,8 +1,8 @@ # The virtual base class for properties, which are the self-contained building # blocks for actually doing work on the system. -require 'puppet' -require 'puppet/parameter' +require_relative '../puppet' +require_relative '../puppet/parameter' # The Property class is the implementation of a resource's attributes of _property_ kind. # A Property is a specialized Resource Type Parameter that has both an 'is' (current) state, and @@ -39,7 +39,7 @@ # @api public # class Puppet::Property < Puppet::Parameter - require 'puppet/property/ensure' + require_relative 'property/ensure' # Returns the original wanted value(s) _(should)_ unprocessed by munging/unmunging. # The original values are set by {#value=} or {#should=}. diff --git a/lib/puppet/property/boolean.rb b/lib/puppet/property/boolean.rb index bd21a2e79f5..ea01b8a4a84 100644 --- a/lib/puppet/property/boolean.rb +++ b/lib/puppet/property/boolean.rb @@ -1,4 +1,4 @@ -require 'puppet/coercion' +require_relative '../../puppet/coercion' class Puppet::Property::Boolean < Puppet::Property def unsafe_munge(value) diff --git a/lib/puppet/property/ensure.rb b/lib/puppet/property/ensure.rb index 0e43c1596e8..a756a7d5956 100644 --- a/lib/puppet/property/ensure.rb +++ b/lib/puppet/property/ensure.rb @@ -1,4 +1,4 @@ -require 'puppet/property' +require_relative '../../puppet/property' # This property is automatically added to any {Puppet::Type} that responds # to the methods 'exists?', 'create', and 'destroy'. diff --git a/lib/puppet/property/keyvalue.rb b/lib/puppet/property/keyvalue.rb index dc6dc39a2cc..c59cb7d5a75 100644 --- a/lib/puppet/property/keyvalue.rb +++ b/lib/puppet/property/keyvalue.rb @@ -1,4 +1,4 @@ -require 'puppet/property' +require_relative '../../puppet/property' module Puppet class Property diff --git a/lib/puppet/property/list.rb b/lib/puppet/property/list.rb index 41a1c10c79b..c5ac0901ddd 100644 --- a/lib/puppet/property/list.rb +++ b/lib/puppet/property/list.rb @@ -1,4 +1,4 @@ -require 'puppet/property' +require_relative '../../puppet/property' module Puppet class Property diff --git a/lib/puppet/property/ordered_list.rb b/lib/puppet/property/ordered_list.rb index 28c56510e2a..3896af23725 100644 --- a/lib/puppet/property/ordered_list.rb +++ b/lib/puppet/property/ordered_list.rb @@ -1,4 +1,4 @@ -require 'puppet/property/list' +require_relative '../../puppet/property/list' module Puppet class Property diff --git a/lib/puppet/provider.rb b/lib/puppet/provider.rb index 0cfd86b5879..c0cafbb22f6 100644 --- a/lib/puppet/provider.rb +++ b/lib/puppet/provider.rb @@ -40,8 +40,8 @@ class Puppet::Provider include Puppet::Util::Warnings extend Puppet::Util::Warnings - require 'puppet/confiner' - require 'puppet/provider/command' + require_relative '../puppet/confiner' + require_relative 'provider/command' extend Puppet::Confiner diff --git a/lib/puppet/provider/confine.rb b/lib/puppet/provider/confine.rb index 4804465b064..de347840a53 100644 --- a/lib/puppet/provider/confine.rb +++ b/lib/puppet/provider/confine.rb @@ -1,6 +1,6 @@ # Confines have been moved out of the provider as they are also used for other things. # This provides backwards compatibility for people still including this old location. -require 'puppet/provider' -require 'puppet/confine' +require_relative '../../puppet/provider' +require_relative '../../puppet/confine' Puppet::Provider::Confine = Puppet::Confine diff --git a/lib/puppet/provider/exec.rb b/lib/puppet/provider/exec.rb index b3c0f8ad166..c40305247b0 100644 --- a/lib/puppet/provider/exec.rb +++ b/lib/puppet/provider/exec.rb @@ -1,5 +1,5 @@ -require 'puppet/provider' -require 'puppet/util/execution' +require_relative '../../puppet/provider' +require_relative '../../puppet/util/execution' class Puppet::Provider::Exec < Puppet::Provider include Puppet::Util::Execution diff --git a/lib/puppet/provider/exec/posix.rb b/lib/puppet/provider/exec/posix.rb index e8f623828fd..e24c14f8512 100644 --- a/lib/puppet/provider/exec/posix.rb +++ b/lib/puppet/provider/exec/posix.rb @@ -1,4 +1,4 @@ -require 'puppet/provider/exec' +require_relative '../../../puppet/provider/exec' Puppet::Type.type(:exec).provide :posix, :parent => Puppet::Provider::Exec do has_feature :umask diff --git a/lib/puppet/provider/exec/windows.rb b/lib/puppet/provider/exec/windows.rb index 422fb23bbb9..15b43d41f44 100644 --- a/lib/puppet/provider/exec/windows.rb +++ b/lib/puppet/provider/exec/windows.rb @@ -1,4 +1,4 @@ -require 'puppet/provider/exec' +require_relative '../../../puppet/provider/exec' Puppet::Type.type(:exec).provide :windows, :parent => Puppet::Provider::Exec do diff --git a/lib/puppet/provider/file/posix.rb b/lib/puppet/provider/file/posix.rb index 179fc8ebf83..75a16d3592b 100644 --- a/lib/puppet/provider/file/posix.rb +++ b/lib/puppet/provider/file/posix.rb @@ -8,7 +8,7 @@ include Puppet::Util::Warnings require 'etc' - require 'puppet/util/selinux' + require_relative '../../../puppet/util/selinux' def self.post_resource_eval Selinux.matchpathcon_fini if Puppet::Util::SELinux.selinux_support? diff --git a/lib/puppet/provider/file/windows.rb b/lib/puppet/provider/file/windows.rb index 4c2b5261273..cfadd425a13 100644 --- a/lib/puppet/provider/file/windows.rb +++ b/lib/puppet/provider/file/windows.rb @@ -7,7 +7,7 @@ include Puppet::Util::Warnings if Puppet::Util::Platform.windows? - require 'puppet/util/windows' + require_relative '../../../puppet/util/windows' include Puppet::Util::Windows::Security end diff --git a/lib/puppet/provider/group/aix.rb b/lib/puppet/provider/group/aix.rb index 68c5441f9b4..a15e896d26b 100644 --- a/lib/puppet/provider/group/aix.rb +++ b/lib/puppet/provider/group/aix.rb @@ -1,6 +1,6 @@ # Group Puppet provider for AIX. It uses standard commands to manage groups: # mkgroup, rmgroup, lsgroup, chgroup -require 'puppet/provider/aix_object' +require_relative '../../../puppet/provider/aix_object' Puppet::Type.type(:group).provide :aix, :parent => Puppet::Provider::AixObject do desc "Group management for AIX." diff --git a/lib/puppet/provider/group/directoryservice.rb b/lib/puppet/provider/group/directoryservice.rb index 35856b898bc..f45422a695f 100644 --- a/lib/puppet/provider/group/directoryservice.rb +++ b/lib/puppet/provider/group/directoryservice.rb @@ -1,4 +1,4 @@ -require 'puppet/provider/nameservice/directoryservice' +require_relative '../../../puppet/provider/nameservice/directoryservice' Puppet::Type.type(:group).provide :directoryservice, :parent => Puppet::Provider::NameService::DirectoryService do desc "Group management using DirectoryService on OS X. diff --git a/lib/puppet/provider/group/groupadd.rb b/lib/puppet/provider/group/groupadd.rb index 38aafd6109e..6659c82171b 100644 --- a/lib/puppet/provider/group/groupadd.rb +++ b/lib/puppet/provider/group/groupadd.rb @@ -1,5 +1,5 @@ -require 'puppet/provider/nameservice/objectadd' -require 'puppet/util/libuser' +require_relative '../../../puppet/provider/nameservice/objectadd' +require_relative '../../../puppet/util/libuser' Puppet::Type.type(:group).provide :groupadd, :parent => Puppet::Provider::NameService::ObjectAdd do desc "Group management via `groupadd` and its ilk. The default for most platforms." diff --git a/lib/puppet/provider/group/ldap.rb b/lib/puppet/provider/group/ldap.rb index 0ce91bc9816..0d632ca9475 100644 --- a/lib/puppet/provider/group/ldap.rb +++ b/lib/puppet/provider/group/ldap.rb @@ -1,4 +1,4 @@ -require 'puppet/provider/ldap' +require_relative '../../../puppet/provider/ldap' Puppet::Type.type(:group).provide :ldap, :parent => Puppet::Provider::Ldap do desc "Group management via LDAP. diff --git a/lib/puppet/provider/group/pw.rb b/lib/puppet/provider/group/pw.rb index c9ea39de966..c6cf3f6a9f1 100644 --- a/lib/puppet/provider/group/pw.rb +++ b/lib/puppet/provider/group/pw.rb @@ -1,4 +1,4 @@ -require 'puppet/provider/nameservice/pw' +require_relative '../../../puppet/provider/nameservice/pw' Puppet::Type.type(:group).provide :pw, :parent => Puppet::Provider::NameService::PW do desc "Group management via `pw` on FreeBSD and DragonFly BSD." diff --git a/lib/puppet/provider/group/windows_adsi.rb b/lib/puppet/provider/group/windows_adsi.rb index b10b350e9c5..26208fde2f2 100644 --- a/lib/puppet/provider/group/windows_adsi.rb +++ b/lib/puppet/provider/group/windows_adsi.rb @@ -1,4 +1,4 @@ -require 'puppet/util/windows' +require_relative '../../../puppet/util/windows' Puppet::Type.type(:group).provide :windows_adsi do desc "Local group management for Windows. Group members can be both users and groups. diff --git a/lib/puppet/provider/ldap.rb b/lib/puppet/provider/ldap.rb index c614712a1c3..76e287c7b0c 100644 --- a/lib/puppet/provider/ldap.rb +++ b/lib/puppet/provider/ldap.rb @@ -1,8 +1,8 @@ -require 'puppet/provider' +require_relative '../../puppet/provider' # The base class for LDAP providers. class Puppet::Provider::Ldap < Puppet::Provider - require 'puppet/util/ldap/manager' + require_relative '../../puppet/util/ldap/manager' class << self attr_reader :manager diff --git a/lib/puppet/provider/nameservice.rb b/lib/puppet/provider/nameservice.rb index 8ad3d82522c..b944d73d31b 100644 --- a/lib/puppet/provider/nameservice.rb +++ b/lib/puppet/provider/nameservice.rb @@ -1,4 +1,4 @@ -require 'puppet' +require_relative '../../puppet' # This is the parent class of all NSS classes. They're very different in # their backend, but they're pretty similar on the front-end. This class diff --git a/lib/puppet/provider/nameservice/directoryservice.rb b/lib/puppet/provider/nameservice/directoryservice.rb index 1c9c1771e35..a6bdf5c045e 100644 --- a/lib/puppet/provider/nameservice/directoryservice.rb +++ b/lib/puppet/provider/nameservice/directoryservice.rb @@ -1,6 +1,6 @@ -require 'puppet' -require 'puppet/provider/nameservice' -require 'puppet/util/plist' if Puppet.features.cfpropertylist? +require_relative '../../../puppet' +require_relative '../../../puppet/provider/nameservice' +require_relative '../../../puppet/util/plist' if Puppet.features.cfpropertylist? require 'fileutils' class Puppet::Provider::NameService::DirectoryService < Puppet::Provider::NameService diff --git a/lib/puppet/provider/nameservice/objectadd.rb b/lib/puppet/provider/nameservice/objectadd.rb index 37880613560..2e4fe8bbb6d 100644 --- a/lib/puppet/provider/nameservice/objectadd.rb +++ b/lib/puppet/provider/nameservice/objectadd.rb @@ -1,4 +1,4 @@ -require 'puppet/provider/nameservice' +require_relative '../../../puppet/provider/nameservice' class Puppet::Provider::NameService class ObjectAdd < Puppet::Provider::NameService diff --git a/lib/puppet/provider/nameservice/pw.rb b/lib/puppet/provider/nameservice/pw.rb index fcf545a75b3..a6c54c1fa1b 100644 --- a/lib/puppet/provider/nameservice/pw.rb +++ b/lib/puppet/provider/nameservice/pw.rb @@ -1,4 +1,4 @@ -require 'puppet/provider/nameservice/objectadd' +require_relative '../../../puppet/provider/nameservice/objectadd' class Puppet::Provider::NameService class PW < ObjectAdd diff --git a/lib/puppet/provider/package.rb b/lib/puppet/provider/package.rb index cef7adb45b2..ebf3d7abcb1 100644 --- a/lib/puppet/provider/package.rb +++ b/lib/puppet/provider/package.rb @@ -1,4 +1,4 @@ -require 'puppet/provider' +require_relative '../../puppet/provider' class Puppet::Provider::Package < Puppet::Provider # Prefetch our package list, yo. diff --git a/lib/puppet/provider/package/aix.rb b/lib/puppet/provider/package/aix.rb index c4f28a4caf9..1bad7cb9a6c 100644 --- a/lib/puppet/provider/package/aix.rb +++ b/lib/puppet/provider/package/aix.rb @@ -1,5 +1,5 @@ -require 'puppet/provider/package' -require 'puppet/util/package' +require_relative '../../../puppet/provider/package' +require_relative '../../../puppet/util/package' Puppet::Type.type(:package).provide :aix, :parent => Puppet::Provider::Package do desc "Installation from an AIX software directory, using the AIX `installp` diff --git a/lib/puppet/provider/package/appdmg.rb b/lib/puppet/provider/package/appdmg.rb index 487e7c2aa90..6feedaea6c0 100644 --- a/lib/puppet/provider/package/appdmg.rb +++ b/lib/puppet/provider/package/appdmg.rb @@ -12,8 +12,8 @@ # As a result, we store installed .app.dmg file names # in /var/db/.puppet_appdmg_installed_ -require 'puppet/provider/package' -require 'puppet/util/plist' if Puppet.features.cfpropertylist? +require_relative '../../../puppet/provider/package' +require_relative '../../../puppet/util/plist' if Puppet.features.cfpropertylist? Puppet::Type.type(:package).provide(:appdmg, :parent => Puppet::Provider::Package) do desc "Package management which copies application bundles to a target." diff --git a/lib/puppet/provider/package/apple.rb b/lib/puppet/provider/package/apple.rb index 1a6cecad720..330c5b7a4f2 100644 --- a/lib/puppet/provider/package/apple.rb +++ b/lib/puppet/provider/package/apple.rb @@ -1,4 +1,4 @@ -require 'puppet/provider/package' +require_relative '../../../puppet/provider/package' # OS X Packaging sucks. We can install packages, but that's about it. Puppet::Type.type(:package).provide :apple, :parent => Puppet::Provider::Package do diff --git a/lib/puppet/provider/package/apt.rb b/lib/puppet/provider/package/apt.rb index 44967cc0972..0149e0270c7 100644 --- a/lib/puppet/provider/package/apt.rb +++ b/lib/puppet/provider/package/apt.rb @@ -1,5 +1,5 @@ -require 'puppet/util/package/version/range' -require 'puppet/util/package/version/debian' +require_relative '../../../puppet/util/package/version/range' +require_relative '../../../puppet/util/package/version/debian' Puppet::Type.type(:package).provide :apt, :parent => :dpkg, :source => :dpkg do # Provide sorting functionality diff --git a/lib/puppet/provider/package/dnfmodule.rb b/lib/puppet/provider/package/dnfmodule.rb index 265de0a282d..d6cf9f6d143 100644 --- a/lib/puppet/provider/package/dnfmodule.rb +++ b/lib/puppet/provider/package/dnfmodule.rb @@ -8,7 +8,7 @@ # } -require 'puppet/provider/package' +require_relative '../../../puppet/provider/package' Puppet::Type.type(:package).provide :dnfmodule, :parent => :dnf do diff --git a/lib/puppet/provider/package/dpkg.rb b/lib/puppet/provider/package/dpkg.rb index 7ed897c2f97..40a12a6c1ac 100644 --- a/lib/puppet/provider/package/dpkg.rb +++ b/lib/puppet/provider/package/dpkg.rb @@ -1,4 +1,4 @@ -require 'puppet/provider/package' +require_relative '../../../puppet/provider/package' Puppet::Type.type(:package).provide :dpkg, :parent => Puppet::Provider::Package do desc "Package management via `dpkg`. Because this only uses `dpkg` diff --git a/lib/puppet/provider/package/gem.rb b/lib/puppet/provider/package/gem.rb index 75393194bfd..8c4b4cc915e 100644 --- a/lib/puppet/provider/package/gem.rb +++ b/lib/puppet/provider/package/gem.rb @@ -1,6 +1,6 @@ -require 'puppet/util/package/version/gem' -require 'puppet/util/package/version/range' -require 'puppet/provider/package_targetable' +require_relative '../../../puppet/util/package/version/gem' +require_relative '../../../puppet/util/package/version/range' +require_relative '../../../puppet/provider/package_targetable' require 'uri' # Ruby gems support. diff --git a/lib/puppet/provider/package/hpux.rb b/lib/puppet/provider/package/hpux.rb index 4416f010157..10523b8e246 100644 --- a/lib/puppet/provider/package/hpux.rb +++ b/lib/puppet/provider/package/hpux.rb @@ -1,6 +1,6 @@ # HP-UX packaging. -require 'puppet/provider/package' +require_relative '../../../puppet/provider/package' Puppet::Type.type(:package).provide :hpux, :parent => Puppet::Provider::Package do diff --git a/lib/puppet/provider/package/macports.rb b/lib/puppet/provider/package/macports.rb index ea8d2ce45dd..99a96d04d93 100644 --- a/lib/puppet/provider/package/macports.rb +++ b/lib/puppet/provider/package/macports.rb @@ -1,5 +1,5 @@ -require 'puppet/provider/package' -require 'puppet/provider/command' +require_relative '../../../puppet/provider/package' +require_relative '../../../puppet/provider/command' Puppet::Type.type(:package).provide :macports, :parent => Puppet::Provider::Package do desc "Package management using MacPorts on OS X. diff --git a/lib/puppet/provider/package/nim.rb b/lib/puppet/provider/package/nim.rb index b5a12083f53..983105118d3 100644 --- a/lib/puppet/provider/package/nim.rb +++ b/lib/puppet/provider/package/nim.rb @@ -1,5 +1,5 @@ -require 'puppet/provider/package' -require 'puppet/util/package' +require_relative '../../../puppet/provider/package' +require_relative '../../../puppet/util/package' Puppet::Type.type(:package).provide :nim, :parent => :aix, :source => :aix do desc "Installation from an AIX NIM LPP source. The `source` parameter is required diff --git a/lib/puppet/provider/package/openbsd.rb b/lib/puppet/provider/package/openbsd.rb index b47a93969bc..4ddadb39f21 100644 --- a/lib/puppet/provider/package/openbsd.rb +++ b/lib/puppet/provider/package/openbsd.rb @@ -1,4 +1,4 @@ -require 'puppet/provider/package' +require_relative '../../../puppet/provider/package' # Packaging on OpenBSD. Doesn't work anywhere else that I know of. Puppet::Type.type(:package).provide :openbsd, :parent => Puppet::Provider::Package do diff --git a/lib/puppet/provider/package/opkg.rb b/lib/puppet/provider/package/opkg.rb index 1a110f40384..0a48f5f82ac 100644 --- a/lib/puppet/provider/package/opkg.rb +++ b/lib/puppet/provider/package/opkg.rb @@ -1,4 +1,4 @@ -require 'puppet/provider/package' +require_relative '../../../puppet/provider/package' Puppet::Type.type(:package).provide :opkg, :source => :opkg, :parent => Puppet::Provider::Package do desc "Opkg packaging support. Common on OpenWrt and OpenEmbedded platforms" diff --git a/lib/puppet/provider/package/pacman.rb b/lib/puppet/provider/package/pacman.rb index acd3b3ef7ac..600721faaab 100644 --- a/lib/puppet/provider/package/pacman.rb +++ b/lib/puppet/provider/package/pacman.rb @@ -1,4 +1,4 @@ -require 'puppet/provider/package' +require_relative '../../../puppet/provider/package' require 'set' require 'uri' diff --git a/lib/puppet/provider/package/pip.rb b/lib/puppet/provider/package/pip.rb index 09b3032355b..e67c13fa50d 100644 --- a/lib/puppet/provider/package/pip.rb +++ b/lib/puppet/provider/package/pip.rb @@ -1,9 +1,9 @@ # Puppet package provider for Python's `pip` package management frontend. # -require 'puppet/util/package/version/pip' -require 'puppet/util/package/version/range' -require 'puppet/provider/package_targetable' +require_relative '../../../puppet/util/package/version/pip' +require_relative '../../../puppet/util/package/version/range' +require_relative '../../../puppet/provider/package_targetable' Puppet::Type.type(:package).provide :pip, :parent => ::Puppet::Provider::Package::Targetable do diff --git a/lib/puppet/provider/package/pkg.rb b/lib/puppet/provider/package/pkg.rb index c6777ce5d25..a787a764fed 100644 --- a/lib/puppet/provider/package/pkg.rb +++ b/lib/puppet/provider/package/pkg.rb @@ -1,4 +1,4 @@ -require 'puppet/provider/package' +require_relative '../../../puppet/provider/package' Puppet::Type.type(:package).provide :pkg, :parent => Puppet::Provider::Package do desc "OpenSolaris image packaging system. See pkg(5) for more information. diff --git a/lib/puppet/provider/package/pkgdmg.rb b/lib/puppet/provider/package/pkgdmg.rb index c673d443bab..ff7b06bfe2b 100644 --- a/lib/puppet/provider/package/pkgdmg.rb +++ b/lib/puppet/provider/package/pkgdmg.rb @@ -8,9 +8,9 @@ # As a result, we store installed .pkg.dmg file names # in /var/db/.puppet_pkgdmg_installed_ -require 'puppet/provider/package' -require 'puppet/util/plist' -require 'puppet/util/http_proxy' +require_relative '../../../puppet/provider/package' +require_relative '../../../puppet/util/plist' +require_relative '../../../puppet/util/http_proxy' Puppet::Type.type(:package).provide :pkgdmg, :parent => Puppet::Provider::Package do desc "Package management based on Apple's Installer.app and DiskUtility.app. diff --git a/lib/puppet/provider/package/pkgin.rb b/lib/puppet/provider/package/pkgin.rb index 5121a847690..a985c6d56a9 100644 --- a/lib/puppet/provider/package/pkgin.rb +++ b/lib/puppet/provider/package/pkgin.rb @@ -1,4 +1,4 @@ -require 'puppet/provider/package' +require_relative '../../../puppet/provider/package' Puppet::Type.type(:package).provide :pkgin, :parent => Puppet::Provider::Package do desc "Package management using pkgin, a binary package manager for pkgsrc." diff --git a/lib/puppet/provider/package/pkgng.rb b/lib/puppet/provider/package/pkgng.rb index d8e5b0fe91e..3b8afe87d80 100644 --- a/lib/puppet/provider/package/pkgng.rb +++ b/lib/puppet/provider/package/pkgng.rb @@ -1,4 +1,4 @@ -require 'puppet/provider/package' +require_relative '../../../puppet/provider/package' Puppet::Type.type(:package).provide :pkgng, :parent => Puppet::Provider::Package do desc "A PkgNG provider for FreeBSD and DragonFly." diff --git a/lib/puppet/provider/package/portage.rb b/lib/puppet/provider/package/portage.rb index 3f463beeda3..1fbf4b99012 100644 --- a/lib/puppet/provider/package/portage.rb +++ b/lib/puppet/provider/package/portage.rb @@ -1,4 +1,4 @@ -require 'puppet/provider/package' +require_relative '../../../puppet/provider/package' require 'fileutils' Puppet::Type.type(:package).provide :portage, :parent => Puppet::Provider::Package do diff --git a/lib/puppet/provider/package/portupgrade.rb b/lib/puppet/provider/package/portupgrade.rb index 7c1a81cddc4..3f32bc87c27 100644 --- a/lib/puppet/provider/package/portupgrade.rb +++ b/lib/puppet/provider/package/portupgrade.rb @@ -1,5 +1,5 @@ # Whole new package, so include pack stuff -require 'puppet/provider/package' +require_relative '../../../puppet/provider/package' Puppet::Type.type(:package).provide :portupgrade, :parent => Puppet::Provider::Package do include Puppet::Util::Execution diff --git a/lib/puppet/provider/package/rpm.rb b/lib/puppet/provider/package/rpm.rb index c96363e1dfd..d25e4900dc2 100644 --- a/lib/puppet/provider/package/rpm.rb +++ b/lib/puppet/provider/package/rpm.rb @@ -1,5 +1,5 @@ -require 'puppet/provider/package' -require 'puppet/util/rpm_compare' +require_relative '../../../puppet/provider/package' +require_relative '../../../puppet/util/rpm_compare' # RPM packaging. Should work anywhere that has rpm installed. Puppet::Type.type(:package).provide :rpm, :source => :rpm, :parent => Puppet::Provider::Package do diff --git a/lib/puppet/provider/package/sun.rb b/lib/puppet/provider/package/sun.rb index 20bf708a919..0df246ae9fc 100644 --- a/lib/puppet/provider/package/sun.rb +++ b/lib/puppet/provider/package/sun.rb @@ -1,6 +1,6 @@ # Sun packaging. -require 'puppet/provider/package' +require_relative '../../../puppet/provider/package' Puppet::Type.type(:package).provide :sun, :parent => Puppet::Provider::Package do desc "Sun's packaging system. Requires that you specify the source for diff --git a/lib/puppet/provider/package/windows.rb b/lib/puppet/provider/package/windows.rb index 09de9bd2fe1..aec8b45493d 100644 --- a/lib/puppet/provider/package/windows.rb +++ b/lib/puppet/provider/package/windows.rb @@ -1,6 +1,6 @@ -require 'puppet/provider/package' -require 'puppet/util/windows' -require 'puppet/provider/package/windows/package' +require_relative '../../../puppet/provider/package' +require_relative '../../../puppet/util/windows' +require_relative 'windows/package' Puppet::Type.type(:package).provide(:windows, :parent => Puppet::Provider::Package) do desc "Windows package management. diff --git a/lib/puppet/provider/package/windows/exe_package.rb b/lib/puppet/provider/package/windows/exe_package.rb index dd0942c0d92..b5406af7a27 100644 --- a/lib/puppet/provider/package/windows/exe_package.rb +++ b/lib/puppet/provider/package/windows/exe_package.rb @@ -1,4 +1,4 @@ -require 'puppet/provider/package/windows/package' +require_relative '../../../../puppet/provider/package/windows/package' class Puppet::Provider::Package::Windows class ExePackage < Puppet::Provider::Package::Windows::Package diff --git a/lib/puppet/provider/package/windows/msi_package.rb b/lib/puppet/provider/package/windows/msi_package.rb index 78eed6c7bcc..08ce490d8b9 100644 --- a/lib/puppet/provider/package/windows/msi_package.rb +++ b/lib/puppet/provider/package/windows/msi_package.rb @@ -1,4 +1,4 @@ -require 'puppet/provider/package/windows/package' +require_relative '../../../../puppet/provider/package/windows/package' class Puppet::Provider::Package::Windows class MsiPackage < Puppet::Provider::Package::Windows::Package diff --git a/lib/puppet/provider/package/windows/package.rb b/lib/puppet/provider/package/windows/package.rb index 87b6e13de3e..cb31c89299f 100644 --- a/lib/puppet/provider/package/windows/package.rb +++ b/lib/puppet/provider/package/windows/package.rb @@ -1,5 +1,5 @@ -require 'puppet/provider/package' -require 'puppet/util/windows' +require_relative '../../../../puppet/provider/package' +require_relative '../../../../puppet/util/windows' class Puppet::Provider::Package::Windows class Package @@ -105,5 +105,5 @@ def initialize(name, version) end end -require 'puppet/provider/package/windows/msi_package' -require 'puppet/provider/package/windows/exe_package' +require_relative '../../../../puppet/provider/package/windows/msi_package' +require_relative '../../../../puppet/provider/package/windows/exe_package' diff --git a/lib/puppet/provider/package/yum.rb b/lib/puppet/provider/package/yum.rb index e26083f40e0..a6534a9d72c 100644 --- a/lib/puppet/provider/package/yum.rb +++ b/lib/puppet/provider/package/yum.rb @@ -1,6 +1,6 @@ -require 'puppet/util/package/version/range' -require 'puppet/util/package/version/rpm' -require 'puppet/util/rpm_compare' +require_relative '../../../puppet/util/package/version/range' +require_relative '../../../puppet/util/package/version/rpm' +require_relative '../../../puppet/util/rpm_compare' Puppet::Type.type(:package).provide :yum, :parent => :rpm, :source => :rpm do # provides Rpm parsing and comparison diff --git a/lib/puppet/provider/package_targetable.rb b/lib/puppet/provider/package_targetable.rb index a8aaf58754b..0ed8c04bbbf 100644 --- a/lib/puppet/provider/package_targetable.rb +++ b/lib/puppet/provider/package_targetable.rb @@ -7,7 +7,7 @@ # possibly via a `prefetchV2` method that could take a better data structure.) # # In addition, `Puppet::Provider::Package::properties` calls `query` in the provider. -require 'puppet/provider/package' +require_relative '../../puppet/provider/package' # But `query` in the provider depends upon whether a `command` attribute is defined for the resource. # This is a Catch-22. diff --git a/lib/puppet/provider/parsedfile.rb b/lib/puppet/provider/parsedfile.rb index 2ab2bb60007..2a55edb3157 100644 --- a/lib/puppet/provider/parsedfile.rb +++ b/lib/puppet/provider/parsedfile.rb @@ -1,6 +1,6 @@ -require 'puppet' -require 'puppet/util/filetype' -require 'puppet/util/fileparsing' +require_relative '../../puppet' +require_relative '../../puppet/util/filetype' +require_relative '../../puppet/util/fileparsing' # This provider can be used as the parent class for a provider that # parses and generates files. Its content must be loaded via the diff --git a/lib/puppet/provider/service/launchd.rb b/lib/puppet/provider/service/launchd.rb index bde8535cb13..ddc8024f0bc 100644 --- a/lib/puppet/provider/service/launchd.rb +++ b/lib/puppet/provider/service/launchd.rb @@ -1,4 +1,4 @@ -require 'puppet/util/plist' +require_relative '../../../puppet/util/plist' Puppet::Type.type(:service).provide :launchd, :parent => :base do desc <<-'EOT' This provider manages jobs with `launchd`, which is the default service diff --git a/lib/puppet/provider/service/systemd.rb b/lib/puppet/provider/service/systemd.rb index d0bfb85e5a6..24920a2dba4 100644 --- a/lib/puppet/provider/service/systemd.rb +++ b/lib/puppet/provider/service/systemd.rb @@ -1,6 +1,6 @@ # Manage systemd services using systemctl -require 'puppet/file_system' +require_relative '../../../puppet/file_system' Puppet::Type.type(:service).provide :systemd, :parent => :base do desc "Manages `systemd` services using `systemctl`. diff --git a/lib/puppet/provider/user/aix.rb b/lib/puppet/provider/user/aix.rb index de2fe9a6869..d5e75c55dd6 100644 --- a/lib/puppet/provider/user/aix.rb +++ b/lib/puppet/provider/user/aix.rb @@ -9,8 +9,8 @@ # # See https://puppet.com/docs/puppet/latest/provider_development.html # for more information -require 'puppet/provider/aix_object' -require 'puppet/util/posix' +require_relative '../../../puppet/provider/aix_object' +require_relative '../../../puppet/util/posix' require 'tempfile' require 'date' diff --git a/lib/puppet/provider/user/directoryservice.rb b/lib/puppet/provider/user/directoryservice.rb index 65bde4fea37..9dec5341c8c 100644 --- a/lib/puppet/provider/user/directoryservice.rb +++ b/lib/puppet/provider/user/directoryservice.rb @@ -1,5 +1,5 @@ -require 'puppet' -require 'puppet/util/plist' if Puppet.features.cfpropertylist? +require_relative '../../../puppet' +require_relative '../../../puppet/util/plist' if Puppet.features.cfpropertylist? require 'base64' Puppet::Type.type(:user).provide :directoryservice do diff --git a/lib/puppet/provider/user/ldap.rb b/lib/puppet/provider/user/ldap.rb index 829ffb87172..7a84dfaf8ad 100644 --- a/lib/puppet/provider/user/ldap.rb +++ b/lib/puppet/provider/user/ldap.rb @@ -1,4 +1,4 @@ -require 'puppet/provider/ldap' +require_relative '../../../puppet/provider/ldap' Puppet::Type.type(:user).provide :ldap, :parent => Puppet::Provider::Ldap do desc "User management via LDAP. diff --git a/lib/puppet/provider/user/openbsd.rb b/lib/puppet/provider/user/openbsd.rb index 1b550226e1a..584166bf5ed 100644 --- a/lib/puppet/provider/user/openbsd.rb +++ b/lib/puppet/provider/user/openbsd.rb @@ -1,4 +1,4 @@ -require 'puppet/error' +require_relative '../../../puppet/error' Puppet::Type.type(:user).provide :openbsd, :parent => :useradd do desc "User management via `useradd` and its ilk for OpenBSD. Note that you diff --git a/lib/puppet/provider/user/pw.rb b/lib/puppet/provider/user/pw.rb index a1706af14f6..cee1cd128cf 100644 --- a/lib/puppet/provider/user/pw.rb +++ b/lib/puppet/provider/user/pw.rb @@ -1,4 +1,4 @@ -require 'puppet/provider/nameservice/pw' +require_relative '../../../puppet/provider/nameservice/pw' require 'open3' Puppet::Type.type(:user).provide :pw, :parent => Puppet::Provider::NameService::PW do diff --git a/lib/puppet/provider/user/user_role_add.rb b/lib/puppet/provider/user/user_role_add.rb index 304a512daa7..1a841d38c1d 100644 --- a/lib/puppet/provider/user/user_role_add.rb +++ b/lib/puppet/provider/user/user_role_add.rb @@ -1,5 +1,5 @@ -require 'puppet/util' -require 'puppet/util/user_attr' +require_relative '../../../puppet/util' +require_relative '../../../puppet/util/user_attr' require 'date' Puppet::Type.type(:user).provide :user_role_add, :parent => :useradd, :source => :useradd do diff --git a/lib/puppet/provider/user/useradd.rb b/lib/puppet/provider/user/useradd.rb index 3cbab9ba8e3..e668c7abc3b 100644 --- a/lib/puppet/provider/user/useradd.rb +++ b/lib/puppet/provider/user/useradd.rb @@ -1,8 +1,8 @@ -require 'puppet/provider/nameservice/objectadd' +require_relative '../../../puppet/provider/nameservice/objectadd' require 'date' -require 'puppet/util/libuser' +require_relative '../../../puppet/util/libuser' require 'time' -require 'puppet/error' +require_relative '../../../puppet/error' Puppet::Type.type(:user).provide :useradd, :parent => Puppet::Provider::NameService::ObjectAdd do desc "User management via `useradd` and its ilk. Note that you will need to diff --git a/lib/puppet/provider/user/windows_adsi.rb b/lib/puppet/provider/user/windows_adsi.rb index 00510940664..a584f05bdd2 100644 --- a/lib/puppet/provider/user/windows_adsi.rb +++ b/lib/puppet/provider/user/windows_adsi.rb @@ -1,4 +1,4 @@ -require 'puppet/util/windows' +require_relative '../../../puppet/util/windows' Puppet::Type.type(:user).provide :windows_adsi do desc "Local user management for Windows." diff --git a/lib/puppet/reference/indirection.rb b/lib/puppet/reference/indirection.rb index d42c94a42ca..911f9da6ea9 100644 --- a/lib/puppet/reference/indirection.rb +++ b/lib/puppet/reference/indirection.rb @@ -1,7 +1,7 @@ -require 'puppet/indirector/indirection' -require 'puppet/util/checksums' -require 'puppet/file_serving/content' -require 'puppet/file_serving/metadata' +require_relative '../../puppet/indirector/indirection' +require_relative '../../puppet/util/checksums' +require_relative '../../puppet/file_serving/content' +require_relative '../../puppet/file_serving/metadata' reference = Puppet::Util::Reference.newreference :indirection, :doc => "Indirection types and their terminus classes" do text = "" diff --git a/lib/puppet/reference/report.rb b/lib/puppet/reference/report.rb index 38119008c67..69970a8eb01 100644 --- a/lib/puppet/reference/report.rb +++ b/lib/puppet/reference/report.rb @@ -1,4 +1,4 @@ -require 'puppet/reports' +require_relative '../../puppet/reports' report = Puppet::Util::Reference.newreference :report, :doc => "All available transaction reports" do Puppet::Reports.reportdocs diff --git a/lib/puppet/reports.rb b/lib/puppet/reports.rb index c3dcc332675..609bc61605c 100644 --- a/lib/puppet/reports.rb +++ b/lib/puppet/reports.rb @@ -1,4 +1,4 @@ -require 'puppet/util/instance_loader' +require_relative '../puppet/util/instance_loader' # This class is an implementation of a simple mechanism for loading and returning reports. # The intent is that a user registers a report by calling {register_report} and providing a code diff --git a/lib/puppet/reports/http.rb b/lib/puppet/reports/http.rb index f7668b476c3..bb11b765fc7 100644 --- a/lib/puppet/reports/http.rb +++ b/lib/puppet/reports/http.rb @@ -1,5 +1,5 @@ -require 'puppet' -require 'puppet/network/http_pool' +require_relative '../../puppet' +require_relative '../../puppet/network/http_pool' require 'uri' Puppet::Reports.register_report(:http) do diff --git a/lib/puppet/reports/log.rb b/lib/puppet/reports/log.rb index 1fc6876a6e9..a601d49f296 100644 --- a/lib/puppet/reports/log.rb +++ b/lib/puppet/reports/log.rb @@ -1,4 +1,4 @@ -require 'puppet/reports' +require_relative '../../puppet/reports' Puppet::Reports.register_report(:log) do desc "Send all received logs to the local log destinations. Usually diff --git a/lib/puppet/reports/store.rb b/lib/puppet/reports/store.rb index 10171573d60..6ec78ea1777 100644 --- a/lib/puppet/reports/store.rb +++ b/lib/puppet/reports/store.rb @@ -1,6 +1,6 @@ -require 'puppet' +require_relative '../../puppet' require 'fileutils' -require 'puppet/util' +require_relative '../../puppet/util' SEPARATOR = [Regexp.escape(File::SEPARATOR.to_s), Regexp.escape(File::ALT_SEPARATOR.to_s)].join diff --git a/lib/puppet/resource.rb b/lib/puppet/resource.rb index a7de0a6d7ce..ca484a327f8 100644 --- a/lib/puppet/resource.rb +++ b/lib/puppet/resource.rb @@ -1,6 +1,6 @@ -require 'puppet' -require 'puppet/util/tagging' -require 'puppet/parameter' +require_relative '../puppet' +require_relative '../puppet/util/tagging' +require_relative '../puppet/parameter' # The simplest resource class. Eventually it will function as the # base class for all resource-like behaviour. @@ -22,7 +22,7 @@ class Puppet::Resource # @deprecated attr_accessor :validate_parameters - require 'puppet/indirector' + require_relative '../puppet/indirector' extend Puppet::Indirector indirects :resource, :terminus_class => :ral diff --git a/lib/puppet/resource/catalog.rb b/lib/puppet/resource/catalog.rb index 8823f535927..ce210914bce 100644 --- a/lib/puppet/resource/catalog.rb +++ b/lib/puppet/resource/catalog.rb @@ -1,8 +1,8 @@ -require 'puppet/node' -require 'puppet/indirector' -require 'puppet/transaction' -require 'puppet/util/tagging' -require 'puppet/graph' +require_relative '../../puppet/node' +require_relative '../../puppet/indirector' +require_relative '../../puppet/transaction' +require_relative '../../puppet/util/tagging' +require_relative '../../puppet/graph' require 'securerandom' # This class models a node catalog. It is the thing meant to be passed diff --git a/lib/puppet/resource/status.rb b/lib/puppet/resource/status.rb index 5908f3b3f6e..4d1877ab61d 100644 --- a/lib/puppet/resource/status.rb +++ b/lib/puppet/resource/status.rb @@ -1,6 +1,6 @@ require 'time' -require 'puppet/network/format_support' -require 'puppet/util/psych_support' +require_relative '../../puppet/network/format_support' +require_relative '../../puppet/util/psych_support' module Puppet class Resource diff --git a/lib/puppet/resource/type.rb b/lib/puppet/resource/type.rb index f15ca4c3354..2ccd4bec22b 100644 --- a/lib/puppet/resource/type.rb +++ b/lib/puppet/resource/type.rb @@ -1,7 +1,7 @@ -require 'puppet/parser' -require 'puppet/util/warnings' -require 'puppet/util/errors' -require 'puppet/parser/ast/leaf' +require_relative '../../puppet/parser' +require_relative '../../puppet/util/warnings' +require_relative '../../puppet/util/errors' +require_relative '../../puppet/parser/ast/leaf' # Puppet::Resource::Type represents nodes, classes and defined types. # diff --git a/lib/puppet/resource/type_collection.rb b/lib/puppet/resource/type_collection.rb index 8d635596280..d7e5224af27 100644 --- a/lib/puppet/resource/type_collection.rb +++ b/lib/puppet/resource/type_collection.rb @@ -1,7 +1,7 @@ -require 'puppet/parser/type_loader' -require 'puppet/util/file_watcher' -require 'puppet/util/warnings' -require 'puppet/concurrent/lock' +require_relative '../../puppet/parser/type_loader' +require_relative '../../puppet/util/file_watcher' +require_relative '../../puppet/util/warnings' +require_relative '../../puppet/concurrent/lock' # @api private class Puppet::Resource::TypeCollection diff --git a/lib/puppet/runtime.rb b/lib/puppet/runtime.rb index 0db31815779..07f3d5aa323 100644 --- a/lib/puppet/runtime.rb +++ b/lib/puppet/runtime.rb @@ -1,4 +1,4 @@ -require 'puppet/http' +require_relative '../puppet/http' require 'singleton' # Provides access to runtime implementations. diff --git a/lib/puppet/scheduler.rb b/lib/puppet/scheduler.rb index e9697a1997a..c6ea3af66ed 100644 --- a/lib/puppet/scheduler.rb +++ b/lib/puppet/scheduler.rb @@ -1,8 +1,8 @@ module Puppet::Scheduler - require 'puppet/scheduler/job' - require 'puppet/scheduler/splay_job' - require 'puppet/scheduler/scheduler' - require 'puppet/scheduler/timer' + require_relative 'scheduler/job' + require_relative 'scheduler/splay_job' + require_relative 'scheduler/scheduler' + require_relative 'scheduler/timer' module_function diff --git a/lib/puppet/settings.rb b/lib/puppet/settings.rb index 0763aabb455..7f3b2d5de4c 100644 --- a/lib/puppet/settings.rb +++ b/lib/puppet/settings.rb @@ -1,7 +1,7 @@ -require 'puppet' +require_relative '../puppet' require 'getoptlong' -require 'puppet/util/watched_file' -require 'puppet/util/command_line/puppet_option_parser' +require_relative '../puppet/util/watched_file' +require_relative '../puppet/util/command_line/puppet_option_parser' require 'forwardable' require 'fileutils' require 'concurrent' @@ -11,31 +11,31 @@ class Puppet::Settings extend Forwardable include Enumerable - require 'puppet/settings/errors' - require 'puppet/settings/base_setting' - require 'puppet/settings/string_setting' - require 'puppet/settings/enum_setting' - require 'puppet/settings/symbolic_enum_setting' - require 'puppet/settings/array_setting' - require 'puppet/settings/file_setting' - require 'puppet/settings/directory_setting' - require 'puppet/settings/file_or_directory_setting' - require 'puppet/settings/path_setting' - require 'puppet/settings/boolean_setting' - require 'puppet/settings/integer_setting' - require 'puppet/settings/port_setting' - require 'puppet/settings/terminus_setting' - require 'puppet/settings/duration_setting' - require 'puppet/settings/ttl_setting' - require 'puppet/settings/priority_setting' - require 'puppet/settings/autosign_setting' - require 'puppet/settings/config_file' - require 'puppet/settings/value_translator' - require 'puppet/settings/environment_conf' - require 'puppet/settings/server_list_setting' - require 'puppet/settings/http_extra_headers_setting' - require 'puppet/settings/certificate_revocation_setting' - require 'puppet/settings/alias_setting' + require_relative 'settings/errors' + require_relative 'settings/base_setting' + require_relative 'settings/string_setting' + require_relative 'settings/enum_setting' + require_relative 'settings/symbolic_enum_setting' + require_relative 'settings/array_setting' + require_relative 'settings/file_setting' + require_relative 'settings/directory_setting' + require_relative 'settings/file_or_directory_setting' + require_relative 'settings/path_setting' + require_relative 'settings/boolean_setting' + require_relative 'settings/integer_setting' + require_relative 'settings/port_setting' + require_relative 'settings/terminus_setting' + require_relative 'settings/duration_setting' + require_relative 'settings/ttl_setting' + require_relative 'settings/priority_setting' + require_relative 'settings/autosign_setting' + require_relative 'settings/config_file' + require_relative 'settings/value_translator' + require_relative 'settings/environment_conf' + require_relative 'settings/server_list_setting' + require_relative 'settings/http_extra_headers_setting' + require_relative 'settings/certificate_revocation_setting' + require_relative 'settings/alias_setting' # local reference for convenience PuppetOptionParser = Puppet::Util::CommandLine::PuppetOptionParser diff --git a/lib/puppet/settings/autosign_setting.rb b/lib/puppet/settings/autosign_setting.rb index bc9e706b058..7fea181b037 100644 --- a/lib/puppet/settings/autosign_setting.rb +++ b/lib/puppet/settings/autosign_setting.rb @@ -1,4 +1,4 @@ -require 'puppet/settings/base_setting' +require_relative '../../puppet/settings/base_setting' # A specialization of the file setting to allow boolean values. # diff --git a/lib/puppet/settings/base_setting.rb b/lib/puppet/settings/base_setting.rb index 3abd8f4cb2f..4bda1573f30 100644 --- a/lib/puppet/settings/base_setting.rb +++ b/lib/puppet/settings/base_setting.rb @@ -1,5 +1,5 @@ require 'set' -require 'puppet/settings/errors' +require_relative '../../puppet/settings/errors' # The base setting type class Puppet::Settings::BaseSetting @@ -145,7 +145,7 @@ def default(check_application_defaults_first = false) # Convert the object to a config statement. def to_config - require 'puppet/util/docs' + require_relative '../../puppet/util/docs' # Scrub any funky indentation; comment out description. str = Puppet::Util::Docs.scrub(@desc).gsub(/^/, "# ") + "\n" diff --git a/lib/puppet/settings/certificate_revocation_setting.rb b/lib/puppet/settings/certificate_revocation_setting.rb index 9c75dda05bb..a71b1ee248e 100644 --- a/lib/puppet/settings/certificate_revocation_setting.rb +++ b/lib/puppet/settings/certificate_revocation_setting.rb @@ -1,4 +1,4 @@ -require 'puppet/settings/base_setting' +require_relative '../../puppet/settings/base_setting' class Puppet::Settings::CertificateRevocationSetting < Puppet::Settings::BaseSetting diff --git a/lib/puppet/settings/config_file.rb b/lib/puppet/settings/config_file.rb index f8ab50d423b..24c42444f03 100644 --- a/lib/puppet/settings/config_file.rb +++ b/lib/puppet/settings/config_file.rb @@ -1,4 +1,4 @@ -require 'puppet/settings/ini_file' +require_relative '../../puppet/settings/ini_file' ## # @api private diff --git a/lib/puppet/settings/errors.rb b/lib/puppet/settings/errors.rb index 25a009ead3f..80b2f0a2d99 100644 --- a/lib/puppet/settings/errors.rb +++ b/lib/puppet/settings/errors.rb @@ -1,5 +1,5 @@ # Exceptions for the settings module -require 'puppet/error' +require_relative '../../puppet/error' class Puppet::Settings class SettingsError < Puppet::Error ; end diff --git a/lib/puppet/settings/priority_setting.rb b/lib/puppet/settings/priority_setting.rb index de87926a411..e153e64ffe1 100644 --- a/lib/puppet/settings/priority_setting.rb +++ b/lib/puppet/settings/priority_setting.rb @@ -1,12 +1,12 @@ -require 'puppet/settings/base_setting' +require_relative '../../puppet/settings/base_setting' # A setting that represents a scheduling priority, and evaluates to an # OS-specific priority level. class Puppet::Settings::PrioritySetting < Puppet::Settings::BaseSetting PRIORITY_MAP = if Puppet::Util::Platform.windows? - require 'puppet/util/windows/process' - require 'puppet/ffi/windows/constants' + require_relative '../../puppet/util/windows/process' + require_relative '../../puppet/ffi/windows/constants' { :high => Puppet::FFI::Windows::Constants::HIGH_PRIORITY_CLASS, :normal => Puppet::FFI::Windows::Constants::NORMAL_PRIORITY_CLASS, diff --git a/lib/puppet/ssl.rb b/lib/puppet/ssl.rb index 2eccd85a42f..be853bf5282 100644 --- a/lib/puppet/ssl.rb +++ b/lib/puppet/ssl.rb @@ -1,6 +1,6 @@ # Just to make the constants work out. -require 'puppet' -require 'puppet/ssl/openssl_loader' +require_relative '../puppet' +require_relative 'ssl/openssl_loader' # Responsible for bootstrapping an agent's certificate and private key, generating # SSLContexts for use in making HTTPS connections, and handling CSR attributes and @@ -11,13 +11,13 @@ module Puppet::SSL CA_NAME = "ca".freeze - require 'puppet/ssl/oids' - require 'puppet/ssl/error' - require 'puppet/ssl/ssl_context' - require 'puppet/ssl/verifier' - require 'puppet/ssl/ssl_provider' - require 'puppet/ssl/state_machine' - require 'puppet/ssl/certificate' - require 'puppet/ssl/certificate_request' - require 'puppet/ssl/certificate_request_attributes' + require_relative 'ssl/oids' + require_relative 'ssl/error' + require_relative 'ssl/ssl_context' + require_relative 'ssl/verifier' + require_relative 'ssl/ssl_provider' + require_relative 'ssl/state_machine' + require_relative 'ssl/certificate' + require_relative 'ssl/certificate_request' + require_relative 'ssl/certificate_request_attributes' end diff --git a/lib/puppet/ssl/base.rb b/lib/puppet/ssl/base.rb index 6d5ec46f34d..8a07eeaaae3 100644 --- a/lib/puppet/ssl/base.rb +++ b/lib/puppet/ssl/base.rb @@ -1,6 +1,6 @@ -require 'puppet/ssl/openssl_loader' -require 'puppet/ssl' -require 'puppet/ssl/digest' +require_relative '../../puppet/ssl/openssl_loader' +require_relative '../../puppet/ssl' +require_relative '../../puppet/ssl/digest' # The base class for wrapping SSL instances. class Puppet::SSL::Base diff --git a/lib/puppet/ssl/certificate.rb b/lib/puppet/ssl/certificate.rb index c3d2079f6f2..05c4cf6bbe1 100644 --- a/lib/puppet/ssl/certificate.rb +++ b/lib/puppet/ssl/certificate.rb @@ -1,4 +1,4 @@ -require 'puppet/ssl/base' +require_relative '../../puppet/ssl/base' # Manage certificates themselves. This class has no # 'generate' method because the CA is responsible diff --git a/lib/puppet/ssl/certificate_request.rb b/lib/puppet/ssl/certificate_request.rb index fea88462507..9a1c3ad1f70 100644 --- a/lib/puppet/ssl/certificate_request.rb +++ b/lib/puppet/ssl/certificate_request.rb @@ -1,5 +1,5 @@ -require 'puppet/ssl/base' -require 'puppet/ssl/certificate_signer' +require_relative '../../puppet/ssl/base' +require_relative '../../puppet/ssl/certificate_signer' # This class creates and manages X509 certificate signing requests. # diff --git a/lib/puppet/ssl/certificate_request_attributes.rb b/lib/puppet/ssl/certificate_request_attributes.rb index 21c4a686ace..6cd7404c91d 100644 --- a/lib/puppet/ssl/certificate_request_attributes.rb +++ b/lib/puppet/ssl/certificate_request_attributes.rb @@ -1,5 +1,5 @@ -require 'puppet/ssl' -require 'puppet/util/yaml' +require_relative '../../puppet/ssl' +require_relative '../../puppet/util/yaml' # This class transforms simple key/value pairs into the equivalent ASN1 # structures. Values may be strings or arrays of strings. diff --git a/lib/puppet/ssl/oids.rb b/lib/puppet/ssl/oids.rb index eb2ec668738..a8d355abd07 100644 --- a/lib/puppet/ssl/oids.rb +++ b/lib/puppet/ssl/oids.rb @@ -1,4 +1,4 @@ -require 'puppet/ssl' +require_relative '../../puppet/ssl' # This module defines OIDs for use within Puppet. # diff --git a/lib/puppet/ssl/openssl_loader.rb b/lib/puppet/ssl/openssl_loader.rb index fe1e9901954..66958482724 100644 --- a/lib/puppet/ssl/openssl_loader.rb +++ b/lib/puppet/ssl/openssl_loader.rb @@ -1,4 +1,4 @@ -require 'puppet/util/platform' +require_relative '../../puppet/util/platform' # This file should be required instead of writing `require 'openssl'` # or any library that loads openssl like `net/https`. This allows the diff --git a/lib/puppet/ssl/ssl_context.rb b/lib/puppet/ssl/ssl_context.rb index 9d015e9090e..3a63e3894f0 100644 --- a/lib/puppet/ssl/ssl_context.rb +++ b/lib/puppet/ssl/ssl_context.rb @@ -1,4 +1,4 @@ -require 'puppet/ssl' +require_relative '../../puppet/ssl' module Puppet::SSL SSLContext = Struct.new( diff --git a/lib/puppet/ssl/ssl_provider.rb b/lib/puppet/ssl/ssl_provider.rb index cd249000732..064d04d145c 100644 --- a/lib/puppet/ssl/ssl_provider.rb +++ b/lib/puppet/ssl/ssl_provider.rb @@ -1,4 +1,4 @@ -require 'puppet/ssl' +require_relative '../../puppet/ssl' # SSL Provider creates `SSLContext` objects that can be used to create # secure connections. diff --git a/lib/puppet/ssl/state_machine.rb b/lib/puppet/ssl/state_machine.rb index c7c38b6c222..728c70ec9a5 100644 --- a/lib/puppet/ssl/state_machine.rb +++ b/lib/puppet/ssl/state_machine.rb @@ -1,5 +1,5 @@ -require 'puppet/ssl' -require 'puppet/util/pidlock' +require_relative '../../puppet/ssl' +require_relative '../../puppet/util/pidlock' # This class implements a state machine for bootstrapping a host's CA and CRL # bundles, private key and signed client certificate. Each state has a frozen diff --git a/lib/puppet/ssl/verifier.rb b/lib/puppet/ssl/verifier.rb index a3df7b5a463..966b01b43fb 100644 --- a/lib/puppet/ssl/verifier.rb +++ b/lib/puppet/ssl/verifier.rb @@ -1,4 +1,4 @@ -require 'puppet/ssl' +require_relative '../../puppet/ssl' # Verify an SSL connection. # diff --git a/lib/puppet/syntax_checkers/base64.rb b/lib/puppet/syntax_checkers/base64.rb index d5dc85432e1..55404e15332 100644 --- a/lib/puppet/syntax_checkers/base64.rb +++ b/lib/puppet/syntax_checkers/base64.rb @@ -1,6 +1,6 @@ # A syntax checker for Base64. # @api public -require 'puppet/syntax_checkers' +require_relative '../../puppet/syntax_checkers' require 'base64' class Puppet::SyntaxCheckers::Base64 < Puppet::Plugins::SyntaxCheckers::SyntaxChecker diff --git a/lib/puppet/syntax_checkers/epp.rb b/lib/puppet/syntax_checkers/epp.rb index 6fde3009e58..7914d227c7f 100644 --- a/lib/puppet/syntax_checkers/epp.rb +++ b/lib/puppet/syntax_checkers/epp.rb @@ -1,6 +1,6 @@ # A syntax checker for JSON. # @api public -require 'puppet/syntax_checkers' +require_relative '../../puppet/syntax_checkers' class Puppet::SyntaxCheckers::EPP < Puppet::Plugins::SyntaxCheckers::SyntaxChecker # Checks the text for Puppet Language EPP syntax issues and reports them to the given acceptor. diff --git a/lib/puppet/syntax_checkers/json.rb b/lib/puppet/syntax_checkers/json.rb index 1483f9e6b08..ecc422af3b2 100644 --- a/lib/puppet/syntax_checkers/json.rb +++ b/lib/puppet/syntax_checkers/json.rb @@ -1,6 +1,6 @@ # A syntax checker for JSON. # @api public -require 'puppet/syntax_checkers' +require_relative '../../puppet/syntax_checkers' class Puppet::SyntaxCheckers::Json < Puppet::Plugins::SyntaxCheckers::SyntaxChecker # Checks the text for JSON syntax issues and reports them to the given acceptor. diff --git a/lib/puppet/syntax_checkers/pp.rb b/lib/puppet/syntax_checkers/pp.rb index 119b791f561..3587760fa43 100644 --- a/lib/puppet/syntax_checkers/pp.rb +++ b/lib/puppet/syntax_checkers/pp.rb @@ -1,6 +1,6 @@ # A syntax checker for JSON. # @api public -require 'puppet/syntax_checkers' +require_relative '../../puppet/syntax_checkers' class Puppet::SyntaxCheckers::PP < Puppet::Plugins::SyntaxCheckers::SyntaxChecker # Checks the text for Puppet Language syntax issues and reports them to the given acceptor. diff --git a/lib/puppet/transaction.rb b/lib/puppet/transaction.rb index 678e2bd0518..3fd7a0146a8 100644 --- a/lib/puppet/transaction.rb +++ b/lib/puppet/transaction.rb @@ -1,7 +1,7 @@ -require 'puppet' -require 'puppet/util/tagging' -require 'puppet/util/skip_tags' -require 'puppet/application' +require_relative '../puppet' +require_relative '../puppet/util/tagging' +require_relative '../puppet/util/skip_tags' +require_relative '../puppet/application' require 'digest/sha1' require 'set' @@ -10,12 +10,12 @@ # # @api private class Puppet::Transaction - require 'puppet/transaction/additional_resource_generator' - require 'puppet/transaction/event' - require 'puppet/transaction/event_manager' - require 'puppet/transaction/resource_harness' - require 'puppet/resource/status' - require 'puppet/transaction/persistence' + require_relative 'transaction/additional_resource_generator' + require_relative 'transaction/event' + require_relative 'transaction/event_manager' + require_relative 'transaction/resource_harness' + require_relative '../puppet/resource/status' + require_relative 'transaction/persistence' attr_accessor :catalog, :ignoreschedules, :for_network_device @@ -466,4 +466,4 @@ def split_qualified_tags? end -require 'puppet/transaction/report' +require_relative 'transaction/report' diff --git a/lib/puppet/transaction/event.rb b/lib/puppet/transaction/event.rb index 1229a27a8f8..f03876b3c95 100644 --- a/lib/puppet/transaction/event.rb +++ b/lib/puppet/transaction/event.rb @@ -1,7 +1,7 @@ -require 'puppet/transaction' -require 'puppet/util/tagging' -require 'puppet/util/logging' -require 'puppet/network/format_support' +require_relative '../../puppet/transaction' +require_relative '../../puppet/util/tagging' +require_relative '../../puppet/util/logging' +require_relative '../../puppet/network/format_support' # A simple struct for storing what happens on the system. class Puppet::Transaction::Event diff --git a/lib/puppet/transaction/event_manager.rb b/lib/puppet/transaction/event_manager.rb index 27602ccfc3c..93dbb32d5d5 100644 --- a/lib/puppet/transaction/event_manager.rb +++ b/lib/puppet/transaction/event_manager.rb @@ -1,4 +1,4 @@ -require 'puppet/transaction' +require_relative '../../puppet/transaction' # This class stores, routes, and responds to events generated while evaluating # a transaction. diff --git a/lib/puppet/transaction/persistence.rb b/lib/puppet/transaction/persistence.rb index 2513505adf6..1acc2c893e0 100644 --- a/lib/puppet/transaction/persistence.rb +++ b/lib/puppet/transaction/persistence.rb @@ -1,5 +1,5 @@ require 'yaml' -require 'puppet/util/yaml' +require_relative '../../puppet/util/yaml' # A persistence store implementation for storing information between # transaction runs for the purposes of information inference (such diff --git a/lib/puppet/transaction/report.rb b/lib/puppet/transaction/report.rb index 5379ea1450f..e80e11f191d 100644 --- a/lib/puppet/transaction/report.rb +++ b/lib/puppet/transaction/report.rb @@ -1,5 +1,5 @@ -require 'puppet' -require 'puppet/indirector' +require_relative '../../puppet' +require_relative '../../puppet/indirector' # This class is used to report what happens on a client. # There are two types of data in a report; _Logs_ and _Metrics_. diff --git a/lib/puppet/transaction/resource_harness.rb b/lib/puppet/transaction/resource_harness.rb index 97bfc32c817..ca9ced235dc 100644 --- a/lib/puppet/transaction/resource_harness.rb +++ b/lib/puppet/transaction/resource_harness.rb @@ -1,4 +1,4 @@ -require 'puppet/resource/status' +require_relative '../../puppet/resource/status' class Puppet::Transaction::ResourceHarness NO_ACTION = Object.new diff --git a/lib/puppet/type.rb b/lib/puppet/type.rb index 4e8253ab1dd..6690a451a7b 100644 --- a/lib/puppet/type.rb +++ b/lib/puppet/type.rb @@ -1,16 +1,16 @@ # -*- coding: utf-8 -*- -require 'puppet' -require 'puppet/util/log' -require 'puppet/util/metric' -require 'puppet/property' -require 'puppet/parameter' -require 'puppet/util' -require 'puppet/util/autoload' -require 'puppet/metatype/manager' -require 'puppet/util/errors' -require 'puppet/util/logging' -require 'puppet/util/tagging' -require 'puppet/concurrent/lock' +require_relative '../puppet' +require_relative '../puppet/util/log' +require_relative '../puppet/util/metric' +require_relative '../puppet/property' +require_relative '../puppet/parameter' +require_relative '../puppet/util' +require_relative '../puppet/util/autoload' +require_relative '../puppet/metatype/manager' +require_relative '../puppet/util/errors' +require_relative '../puppet/util/logging' +require_relative '../puppet/util/tagging' +require_relative '../puppet/concurrent/lock' # see the bottom of the file for the rest of the inclusions @@ -1699,8 +1699,8 @@ class { 'apt-updates': ############################### # All of the provider plumbing for the resource types. - require 'puppet/provider' - require 'puppet/util/provider_features' + require_relative '../puppet/provider' + require_relative '../puppet/util/provider_features' # Add the feature handling module. extend Puppet::Util::ProviderFeatures diff --git a/lib/puppet/type/component.rb b/lib/puppet/type/component.rb index c2bf3046239..0fb87f3f600 100644 --- a/lib/puppet/type/component.rb +++ b/lib/puppet/type/component.rb @@ -1,7 +1,7 @@ -require 'puppet' -require 'puppet/type' -require 'puppet/transaction' +require_relative '../../puppet' +require_relative '../../puppet/type' +require_relative '../../puppet/transaction' Puppet::Type.newtype(:component) do include Enumerable diff --git a/lib/puppet/type/file.rb b/lib/puppet/type/file.rb index 06dbdd72ba6..a2c8c600ee7 100644 --- a/lib/puppet/type/file.rb +++ b/lib/puppet/type/file.rb @@ -6,11 +6,11 @@ require 'fileutils' require 'enumerator' require 'pathname' -require 'puppet/parameter/boolean' -require 'puppet/util/diff' -require 'puppet/util/checksums' -require 'puppet/util/backups' -require 'puppet/util/symbolic_file_mode' +require_relative '../../puppet/parameter/boolean' +require_relative '../../puppet/util/diff' +require_relative '../../puppet/util/checksums' +require_relative '../../puppet/util/backups' +require_relative '../../puppet/util/symbolic_file_mode' Puppet::Type.newtype(:file) do include Puppet::Util::Checksums @@ -1100,16 +1100,16 @@ def property_fix # We put all of the properties in separate files, because there are so many # of them. The order these are loaded is important, because it determines # the order they are in the property lit. -require 'puppet/type/file/checksum' -require 'puppet/type/file/content' # can create the file -require 'puppet/type/file/source' # can create the file -require 'puppet/type/file/checksum_value' # can create the file, in place of content -require 'puppet/type/file/target' # creates a different type of file -require 'puppet/type/file/ensure' # can create the file -require 'puppet/type/file/owner' -require 'puppet/type/file/group' -require 'puppet/type/file/mode' -require 'puppet/type/file/type' -require 'puppet/type/file/selcontext' # SELinux file context -require 'puppet/type/file/ctime' -require 'puppet/type/file/mtime' +require_relative 'file/checksum' +require_relative 'file/content' # can create the file +require_relative 'file/source' # can create the file +require_relative 'file/checksum_value' # can create the file, in place of content +require_relative 'file/target' # creates a different type of file +require_relative 'file/ensure' # can create the file +require_relative 'file/owner' +require_relative 'file/group' +require_relative 'file/mode' +require_relative 'file/type' +require_relative 'file/selcontext' # SELinux file context +require_relative 'file/ctime' +require_relative 'file/mtime' diff --git a/lib/puppet/type/file/checksum.rb b/lib/puppet/type/file/checksum.rb index 983463e173b..05ec1603c9c 100644 --- a/lib/puppet/type/file/checksum.rb +++ b/lib/puppet/type/file/checksum.rb @@ -1,4 +1,4 @@ -require 'puppet/util/checksums' +require_relative '../../../puppet/util/checksums' # Specify which checksum algorithm to use when checksumming # files. diff --git a/lib/puppet/type/file/checksum_value.rb b/lib/puppet/type/file/checksum_value.rb index e3eb86b4ea4..9e8b418ee6f 100644 --- a/lib/puppet/type/file/checksum_value.rb +++ b/lib/puppet/type/file/checksum_value.rb @@ -1,5 +1,5 @@ -require 'puppet/util/checksums' -require 'puppet/type/file/data_sync' +require_relative '../../../puppet/util/checksums' +require_relative '../../../puppet/type/file/data_sync' module Puppet Puppet::Type.type(:file).newproperty(:checksum_value) do diff --git a/lib/puppet/type/file/content.rb b/lib/puppet/type/file/content.rb index 73872c5ac29..4184388f18a 100644 --- a/lib/puppet/type/file/content.rb +++ b/lib/puppet/type/file/content.rb @@ -2,8 +2,8 @@ require 'uri' require 'tempfile' -require 'puppet/util/checksums' -require 'puppet/type/file/data_sync.rb' +require_relative '../../../puppet/util/checksums' +require_relative '../../../puppet/type/file/data_sync.rb' module Puppet Puppet::Type.type(:file).newproperty(:content) do diff --git a/lib/puppet/type/file/data_sync.rb b/lib/puppet/type/file/data_sync.rb index c1015d2bb77..5aa82b62dbe 100644 --- a/lib/puppet/type/file/data_sync.rb +++ b/lib/puppet/type/file/data_sync.rb @@ -1,5 +1,5 @@ -require 'puppet/util/checksums' -require 'puppet/util/diff' +require_relative '../../../puppet/util/checksums' +require_relative '../../../puppet/util/diff' require 'date' require 'tempfile' diff --git a/lib/puppet/type/file/ensure.rb b/lib/puppet/type/file/ensure.rb index 78a3a947ad7..91ab0ed76e7 100644 --- a/lib/puppet/type/file/ensure.rb +++ b/lib/puppet/type/file/ensure.rb @@ -2,7 +2,7 @@ module Puppet Puppet::Type.type(:file).ensurable do require 'etc' - require 'puppet/util/symbolic_file_mode' + require_relative '../../../puppet/util/symbolic_file_mode' include Puppet::Util::SymbolicFileMode desc <<-EOT diff --git a/lib/puppet/type/file/group.rb b/lib/puppet/type/file/group.rb index 62fca9c3d5f..3a20673b0bf 100644 --- a/lib/puppet/type/file/group.rb +++ b/lib/puppet/type/file/group.rb @@ -1,4 +1,4 @@ -require 'puppet/util/posix' +require_relative '../../../puppet/util/posix' module Puppet # Manage file group ownership. diff --git a/lib/puppet/type/file/mode.rb b/lib/puppet/type/file/mode.rb index e900ba7a01a..759303bab42 100644 --- a/lib/puppet/type/file/mode.rb +++ b/lib/puppet/type/file/mode.rb @@ -5,7 +5,7 @@ module Puppet Puppet::Type.type(:file).newproperty(:mode) do - require 'puppet/util/symbolic_file_mode' + require_relative '../../../puppet/util/symbolic_file_mode' include Puppet::Util::SymbolicFileMode desc <<-'EOT' diff --git a/lib/puppet/type/file/selcontext.rb b/lib/puppet/type/file/selcontext.rb index 672a5682f1e..2bcc850ca44 100644 --- a/lib/puppet/type/file/selcontext.rb +++ b/lib/puppet/type/file/selcontext.rb @@ -21,7 +21,7 @@ module Puppet - require 'puppet/util/selinux' + require_relative '../../../puppet/util/selinux' class SELFileContext < Puppet::Property include Puppet::Util::SELinux diff --git a/lib/puppet/type/file/source.rb b/lib/puppet/type/file/source.rb index 8e54bfa5410..e59c4a2ab20 100644 --- a/lib/puppet/type/file/source.rb +++ b/lib/puppet/type/file/source.rb @@ -1,8 +1,8 @@ -require 'puppet/file_serving/content' -require 'puppet/file_serving/metadata' -require 'puppet/file_serving/terminus_helper' +require_relative '../../../puppet/file_serving/content' +require_relative '../../../puppet/file_serving/metadata' +require_relative '../../../puppet/file_serving/terminus_helper' -require 'puppet/http' +require_relative '../../../puppet/http' module Puppet # Copy files from a local or remote source. This state *only* does any work diff --git a/lib/puppet/type/filebucket.rb b/lib/puppet/type/filebucket.rb index 96234a3f79d..ed366449d6d 100644 --- a/lib/puppet/type/filebucket.rb +++ b/lib/puppet/type/filebucket.rb @@ -1,5 +1,5 @@ module Puppet - require 'puppet/file_bucket/dipper' + require_relative '../../puppet/file_bucket/dipper' Type.newtype(:filebucket) do @doc = <<-EOT diff --git a/lib/puppet/type/group.rb b/lib/puppet/type/group.rb index 71fda4ee411..5f7a7937119 100644 --- a/lib/puppet/type/group.rb +++ b/lib/puppet/type/group.rb @@ -1,7 +1,7 @@ require 'etc' require 'facter' -require 'puppet/property/keyvalue' -require 'puppet/parameter/boolean' +require_relative '../../puppet/property/keyvalue' +require_relative '../../puppet/parameter/boolean' module Puppet Type.newtype(:group) do diff --git a/lib/puppet/type/package.rb b/lib/puppet/type/package.rb index abddd42a9a4..2af6b4a45d3 100644 --- a/lib/puppet/type/package.rb +++ b/lib/puppet/type/package.rb @@ -4,8 +4,8 @@ # This allows packages to exist on the same machine using different packaging # systems. -require 'puppet/parameter/package_options' -require 'puppet/parameter/boolean' +require_relative '../../puppet/parameter/package_options' +require_relative '../../puppet/parameter/boolean' module Puppet Type.newtype(:package) do diff --git a/lib/puppet/type/resources.rb b/lib/puppet/type/resources.rb index 51c102c5f43..1dcaf2c838f 100644 --- a/lib/puppet/type/resources.rb +++ b/lib/puppet/type/resources.rb @@ -1,5 +1,5 @@ -require 'puppet' -require 'puppet/parameter/boolean' +require_relative '../../puppet' +require_relative '../../puppet/parameter/boolean' Puppet::Type.newtype(:resources) do @doc = "This is a metatype that can manage other resource types. Any diff --git a/lib/puppet/type/tidy.rb b/lib/puppet/type/tidy.rb index e134ad3492e..27f330bf6cf 100644 --- a/lib/puppet/type/tidy.rb +++ b/lib/puppet/type/tidy.rb @@ -1,8 +1,8 @@ -require 'puppet/parameter/boolean' +require_relative '../../puppet/parameter/boolean' Puppet::Type.newtype(:tidy) do - require 'puppet/file_serving/fileset' - require 'puppet/file_bucket/dipper' + require_relative '../../puppet/file_serving/fileset' + require_relative '../../puppet/file_bucket/dipper' @doc = "Remove unwanted files based on specific criteria. Multiple criteria are OR'd together, so a file that is too large but is not diff --git a/lib/puppet/type/user.rb b/lib/puppet/type/user.rb index cb9940c036f..c61432acfe9 100644 --- a/lib/puppet/type/user.rb +++ b/lib/puppet/type/user.rb @@ -1,9 +1,9 @@ require 'etc' require 'facter' -require 'puppet/parameter/boolean' -require 'puppet/property/list' -require 'puppet/property/ordered_list' -require 'puppet/property/keyvalue' +require_relative '../../puppet/parameter/boolean' +require_relative '../../puppet/property/list' +require_relative '../../puppet/property/ordered_list' +require_relative '../../puppet/property/keyvalue' module Puppet Type.newtype(:user) do diff --git a/lib/puppet/util.rb b/lib/puppet/util.rb index db1aa640062..81e9019e8d7 100644 --- a/lib/puppet/util.rb +++ b/lib/puppet/util.rb @@ -1,28 +1,28 @@ # A module to collect utility functions. require 'English' -require 'puppet/error' -require 'puppet/util/execution_stub' +require_relative '../puppet/error' +require_relative 'util/execution_stub' require 'uri' require 'pathname' require 'ostruct' -require 'puppet/util/platform' -require 'puppet/util/symbolic_file_mode' -require 'puppet/file_system/uniquefile' +require_relative 'util/platform' +require_relative 'util/symbolic_file_mode' +require_relative '../puppet/file_system/uniquefile' require 'securerandom' -require 'puppet/util/character_encoding' +require_relative 'util/character_encoding' module Puppet module Util - require 'puppet/util/monkey_patches' + require_relative 'util/monkey_patches' require 'benchmark' # These are all for backward compatibility -- these are methods that used # to be in Puppet::Util but have been moved into external modules. - require 'puppet/util/posix' + require_relative 'util/posix' extend Puppet::Util::POSIX - require 'puppet/util/windows/process' if Puppet::Util::Platform.windows? + require_relative 'util/windows/process' if Puppet::Util::Platform.windows? extend Puppet::Util::SymbolicFileMode @@ -776,11 +776,11 @@ def skip_external_facts end -require 'puppet/util/errors' -require 'puppet/util/metaid' -require 'puppet/util/classgen' -require 'puppet/util/docs' -require 'puppet/util/execution' -require 'puppet/util/logging' -require 'puppet/util/package' -require 'puppet/util/warnings' +require_relative 'util/errors' +require_relative 'util/metaid' +require_relative 'util/classgen' +require_relative 'util/docs' +require_relative 'util/execution' +require_relative 'util/logging' +require_relative 'util/package' +require_relative 'util/warnings' diff --git a/lib/puppet/util/autoload.rb b/lib/puppet/util/autoload.rb index f0b64b49966..e032c1dab63 100644 --- a/lib/puppet/util/autoload.rb +++ b/lib/puppet/util/autoload.rb @@ -1,8 +1,8 @@ require 'pathname' -require 'puppet/util/rubygems' -require 'puppet/util/warnings' -require 'puppet/pops/adaptable' -require 'puppet/concurrent/synchronized' +require_relative '../../puppet/util/rubygems' +require_relative '../../puppet/util/warnings' +require_relative '../../puppet/pops/adaptable' +require_relative '../../puppet/concurrent/synchronized' # An adapter that ties the module_directories cache to the environment where the modules are parsed. This # adapter ensures that the life-cycle of this cache doesn't exceed the life-cycle of the environment. diff --git a/lib/puppet/util/checksums.rb b/lib/puppet/util/checksums.rb index b60fbc80061..f4962a86879 100644 --- a/lib/puppet/util/checksums.rb +++ b/lib/puppet/util/checksums.rb @@ -154,7 +154,7 @@ def sha512_hex_length # Calculate a checksum using Digest::SHA224. def sha224(content) - require 'puppet/ssl/openssl_loader' + require_relative '../../puppet/ssl/openssl_loader' OpenSSL::Digest::SHA224.new.hexdigest(content) end @@ -163,14 +163,14 @@ def sha224?(string) end def sha224_file(filename, lite = false) - require 'puppet/ssl/openssl_loader' + require_relative '../../puppet/ssl/openssl_loader' digest = OpenSSL::Digest::SHA224.new checksum_file(digest, filename, lite) end def sha224_stream(lite = false, &block) - require 'puppet/ssl/openssl_loader' + require_relative '../../puppet/ssl/openssl_loader' digest = OpenSSL::Digest::SHA224.new checksum_stream(digest, block, lite) end diff --git a/lib/puppet/util/colors.rb b/lib/puppet/util/colors.rb index fa42397a6dc..ec05715a537 100644 --- a/lib/puppet/util/colors.rb +++ b/lib/puppet/util/colors.rb @@ -1,4 +1,4 @@ -require 'puppet/util/platform' +require_relative '../../puppet/util/platform' module Puppet::Util::Colors BLACK = {:console => "\e[0;30m", :html => "color: #FFA0A0" } diff --git a/lib/puppet/util/command_line.rb b/lib/puppet/util/command_line.rb index 1b77f3d88b2..0e7b6612d5d 100644 --- a/lib/puppet/util/command_line.rb +++ b/lib/puppet/util/command_line.rb @@ -9,12 +9,12 @@ end end -require 'puppet' -require 'puppet/util' -require 'puppet/util/rubygems' -require 'puppet/util/limits' -require 'puppet/util/colors' -require 'puppet/gettext/module_translations' +require_relative '../../puppet' +require_relative '../../puppet/util' +require_relative '../../puppet/util/rubygems' +require_relative '../../puppet/util/limits' +require_relative '../../puppet/util/colors' +require_relative '../../puppet/gettext/module_translations' module Puppet module Util diff --git a/lib/puppet/util/command_line/puppet_option_parser.rb b/lib/puppet/util/command_line/puppet_option_parser.rb index 160de891f35..edbf4729c0c 100644 --- a/lib/puppet/util/command_line/puppet_option_parser.rb +++ b/lib/puppet/util/command_line/puppet_option_parser.rb @@ -1,4 +1,4 @@ -require 'puppet/util/command_line/trollop' +require_relative '../../../puppet/util/command_line/trollop' module Puppet module Util @@ -16,7 +16,7 @@ class TrollopCommandlineError < Puppet::Util::CommandLine::Trollop::CommandlineE class PuppetOptionParser def initialize(usage_msg = nil) - require 'puppet/util/command_line/trollop' + require_relative '../../../puppet/util/command_line/trollop' @create_default_short_options = false diff --git a/lib/puppet/util/execution.rb b/lib/puppet/util/execution.rb index e3e3916d412..adaa16990b0 100644 --- a/lib/puppet/util/execution.rb +++ b/lib/puppet/util/execution.rb @@ -1,10 +1,10 @@ require 'timeout' -require 'puppet/file_system/uniquefile' +require_relative '../../puppet/file_system/uniquefile' module Puppet require 'rbconfig' - require 'puppet/error' + require_relative '../../puppet/error' # A command failed to execute. # @api public class ExecutionFailure < Puppet::Error diff --git a/lib/puppet/util/feature.rb b/lib/puppet/util/feature.rb index df05512c088..cb4209e3cb8 100644 --- a/lib/puppet/util/feature.rb +++ b/lib/puppet/util/feature.rb @@ -1,5 +1,5 @@ -require 'puppet' -require 'puppet/util/warnings' +require_relative '../../puppet' +require_relative '../../puppet/util/warnings' class Puppet::Util::Feature include Puppet::Util::Warnings diff --git a/lib/puppet/util/filetype.rb b/lib/puppet/util/filetype.rb index 41d5a964765..723fb9df622 100644 --- a/lib/puppet/util/filetype.rb +++ b/lib/puppet/util/filetype.rb @@ -1,7 +1,7 @@ # Basic classes for reading, writing, and emptying files. Not much # to see here. -require 'puppet/util/selinux' +require_relative '../../puppet/util/selinux' require 'tempfile' require 'fileutils' diff --git a/lib/puppet/util/http_proxy.rb b/lib/puppet/util/http_proxy.rb index d030d35a082..1c3a6f41dba 100644 --- a/lib/puppet/util/http_proxy.rb +++ b/lib/puppet/util/http_proxy.rb @@ -1,4 +1,4 @@ -require 'puppet/http' +require_relative '../../puppet/http' # for backwards compatibility Puppet::Util::HttpProxy = Puppet::HTTP::Proxy diff --git a/lib/puppet/util/inifile.rb b/lib/puppet/util/inifile.rb index 0565ec79fd0..123d0ca058b 100644 --- a/lib/puppet/util/inifile.rb +++ b/lib/puppet/util/inifile.rb @@ -8,8 +8,8 @@ # # The parsing tries to stay close to python's ConfigParser -require 'puppet/util/filetype' -require 'puppet/error' +require_relative '../../puppet/util/filetype' +require_relative '../../puppet/error' module Puppet::Util::IniConfig # A section in a .ini file diff --git a/lib/puppet/util/instance_loader.rb b/lib/puppet/util/instance_loader.rb index c36074ec2dd..5ee35be880b 100644 --- a/lib/puppet/util/instance_loader.rb +++ b/lib/puppet/util/instance_loader.rb @@ -1,6 +1,6 @@ -require 'puppet/util/autoload' -require 'puppet/util' -require 'puppet/concurrent/lock' +require_relative '../../puppet/util/autoload' +require_relative '../../puppet/util' +require_relative '../../puppet/concurrent/lock' # A module that can easily autoload things for us. Uses an instance # of Puppet::Util::Autoload diff --git a/lib/puppet/util/json_lockfile.rb b/lib/puppet/util/json_lockfile.rb index 387f2418d3a..d2bf6eba07c 100644 --- a/lib/puppet/util/json_lockfile.rb +++ b/lib/puppet/util/json_lockfile.rb @@ -1,4 +1,4 @@ -require 'puppet/util/lockfile' +require_relative '../../puppet/util/lockfile' # This class provides a simple API for managing a lock file # whose contents are a serialized JSON object. In addition diff --git a/lib/puppet/util/ldap/connection.rb b/lib/puppet/util/ldap/connection.rb index 27dbd312964..d1ca9f668f6 100644 --- a/lib/puppet/util/ldap/connection.rb +++ b/lib/puppet/util/ldap/connection.rb @@ -1,4 +1,4 @@ -require 'puppet/util/ldap' +require_relative '../../../puppet/util/ldap' class Puppet::Util::Ldap::Connection attr_accessor :host, :port, :user, :password, :reset, :ssl diff --git a/lib/puppet/util/ldap/generator.rb b/lib/puppet/util/ldap/generator.rb index 608d72974fd..861d867201b 100644 --- a/lib/puppet/util/ldap/generator.rb +++ b/lib/puppet/util/ldap/generator.rb @@ -1,4 +1,4 @@ -require 'puppet/util/ldap' +require_relative '../../../puppet/util/ldap' class Puppet::Util::Ldap::Generator # Declare the attribute we'll use to generate the value. diff --git a/lib/puppet/util/ldap/manager.rb b/lib/puppet/util/ldap/manager.rb index 65cba2dca2f..ffbe91ffeb3 100644 --- a/lib/puppet/util/ldap/manager.rb +++ b/lib/puppet/util/ldap/manager.rb @@ -1,6 +1,6 @@ -require 'puppet/util/ldap' -require 'puppet/util/ldap/connection' -require 'puppet/util/ldap/generator' +require_relative '../../../puppet/util/ldap' +require_relative '../../../puppet/util/ldap/connection' +require_relative '../../../puppet/util/ldap/generator' # The configuration class for LDAP providers, plus # connection handling for actually interacting with ldap. diff --git a/lib/puppet/util/limits.rb b/lib/puppet/util/limits.rb index f84bb6136c8..543b4dad9c7 100644 --- a/lib/puppet/util/limits.rb +++ b/lib/puppet/util/limits.rb @@ -1,4 +1,4 @@ -require 'puppet/util' +require_relative '../../puppet/util' module Puppet::Util::Limits # @api private diff --git a/lib/puppet/util/log.rb b/lib/puppet/util/log.rb index 8f23eca060e..cc5a3d79a5a 100644 --- a/lib/puppet/util/log.rb +++ b/lib/puppet/util/log.rb @@ -1,7 +1,7 @@ -require 'puppet/util/tagging' -require 'puppet/util/classgen' -require 'puppet/util/psych_support' -require 'puppet/network/format_support' +require_relative '../../puppet/util/tagging' +require_relative '../../puppet/util/classgen' +require_relative '../../puppet/util/psych_support' +require_relative '../../puppet/network/format_support' require 'facter' # Pass feedback to the user. Log levels are modeled after syslog's, and it is @@ -35,8 +35,8 @@ def self.newdesttype(name, options = {}, &block) dest end - require 'puppet/util/log/destination' - require 'puppet/util/log/destinations' + require_relative 'log/destination' + require_relative 'log/destinations' @destinations = {} diff --git a/lib/puppet/util/log/destinations.rb b/lib/puppet/util/log/destinations.rb index d0ba4f62f9e..d2830d290e0 100644 --- a/lib/puppet/util/log/destinations.rb +++ b/lib/puppet/util/log/destinations.rb @@ -135,7 +135,7 @@ def handle(msg) end Puppet::Util::Log.newdesttype :console do - require 'puppet/util/colors' + require_relative '../../../puppet/util/colors' include Puppet::Util::Colors def initialize diff --git a/lib/puppet/util/logging.rb b/lib/puppet/util/logging.rb index f31f0995ebb..cde2fe983b0 100644 --- a/lib/puppet/util/logging.rb +++ b/lib/puppet/util/logging.rb @@ -1,6 +1,6 @@ # A module to make logging a bit easier. -require 'puppet/util/log' -require 'puppet/error' +require_relative '../../puppet/util/log' +require_relative '../../puppet/error' require 'facter' diff --git a/lib/puppet/util/metric.rb b/lib/puppet/util/metric.rb index e18dd7c3f84..dde583f5348 100644 --- a/lib/puppet/util/metric.rb +++ b/lib/puppet/util/metric.rb @@ -1,6 +1,6 @@ # included so we can test object types -require 'puppet' -require 'puppet/network/format_support' +require_relative '../../puppet' +require_relative '../../puppet/network/format_support' # A class for handling metrics. This is currently ridiculously hackish. class Puppet::Util::Metric diff --git a/lib/puppet/util/monkey_patches.rb b/lib/puppet/util/monkey_patches.rb index b429557f1a5..408a85cc3b6 100644 --- a/lib/puppet/util/monkey_patches.rb +++ b/lib/puppet/util/monkey_patches.rb @@ -1,4 +1,4 @@ -require 'puppet/util/platform' +require_relative '../../puppet/util/platform' module Puppet::Util::MonkeyPatches end @@ -30,7 +30,7 @@ def daemonize end # (#19151) Reject all SSLv2 ciphers and handshakes -require 'puppet/ssl/openssl_loader' +require_relative '../../puppet/ssl/openssl_loader' unless Puppet::Util::Platform.jruby_fips? unless defined?(OpenSSL::SSL::TLS1_VERSION) module OpenSSL::SSL @@ -64,7 +64,7 @@ def initialize(*args) end if Puppet::Util::Platform.windows? - require 'puppet/util/windows' + require_relative '../../puppet/util/windows' class OpenSSL::X509::Store @puppet_certs_loaded = false diff --git a/lib/puppet/util/network_device/base.rb b/lib/puppet/util/network_device/base.rb index 1dc2dc92625..44cbd20906b 100644 --- a/lib/puppet/util/network_device/base.rb +++ b/lib/puppet/util/network_device/base.rb @@ -1,7 +1,7 @@ -require 'puppet/util/autoload' +require_relative '../../../puppet/util/autoload' require 'uri' -require 'puppet/util/network_device/transport' -require 'puppet/util/network_device/transport/base' +require_relative '../../../puppet/util/network_device/transport' +require_relative '../../../puppet/util/network_device/transport/base' class Puppet::Util::NetworkDevice::Base diff --git a/lib/puppet/util/network_device/config.rb b/lib/puppet/util/network_device/config.rb index 7d2757d23ca..6b8b9b55ee8 100644 --- a/lib/puppet/util/network_device/config.rb +++ b/lib/puppet/util/network_device/config.rb @@ -1,6 +1,6 @@ require 'ostruct' -require 'puppet/util/watched_file' -require 'puppet/util/network_device' +require_relative '../../../puppet/util/watched_file' +require_relative '../../../puppet/util/network_device' class Puppet::Util::NetworkDevice::Config diff --git a/lib/puppet/util/network_device/transport.rb b/lib/puppet/util/network_device/transport.rb index 6ecfa8ebd5a..e00187458bd 100644 --- a/lib/puppet/util/network_device/transport.rb +++ b/lib/puppet/util/network_device/transport.rb @@ -1,4 +1,4 @@ -require 'puppet/util/network_device' +require_relative '../../../puppet/util/network_device' # stub module Puppet::Util::NetworkDevice::Transport diff --git a/lib/puppet/util/network_device/transport/base.rb b/lib/puppet/util/network_device/transport/base.rb index 4cee0dd3abd..8f4912cf39b 100644 --- a/lib/puppet/util/network_device/transport/base.rb +++ b/lib/puppet/util/network_device/transport/base.rb @@ -1,6 +1,6 @@ -require 'puppet/util/network_device' -require 'puppet/util/network_device/transport' +require_relative '../../../../puppet/util/network_device' +require_relative '../../../../puppet/util/network_device/transport' class Puppet::Util::NetworkDevice::Transport::Base attr_accessor :user, :password, :host, :port diff --git a/lib/puppet/util/package/version/range.rb b/lib/puppet/util/package/version/range.rb index fb807664ea9..7c797078589 100644 --- a/lib/puppet/util/package/version/range.rb +++ b/lib/puppet/util/package/version/range.rb @@ -1,9 +1,9 @@ -require 'puppet/util/package/version/range/lt' -require 'puppet/util/package/version/range/lt_eq' -require 'puppet/util/package/version/range/gt' -require 'puppet/util/package/version/range/gt_eq' -require 'puppet/util/package/version/range/eq' -require 'puppet/util/package/version/range/min_max' +require_relative 'range/lt' +require_relative 'range/lt_eq' +require_relative 'range/gt' +require_relative 'range/gt_eq' +require_relative 'range/eq' +require_relative 'range/min_max' module Puppet::Util::Package::Version class Range diff --git a/lib/puppet/util/package/version/range/eq.rb b/lib/puppet/util/package/version/range/eq.rb index b8eb542f288..f653d55b2f6 100644 --- a/lib/puppet/util/package/version/range/eq.rb +++ b/lib/puppet/util/package/version/range/eq.rb @@ -1,4 +1,4 @@ -require 'puppet/util/package/version/range/simple' +require_relative '../../../../../puppet/util/package/version/range/simple' module Puppet::Util::Package::Version class Range diff --git a/lib/puppet/util/package/version/range/gt.rb b/lib/puppet/util/package/version/range/gt.rb index 66abf80cf2d..642a7c18a7c 100644 --- a/lib/puppet/util/package/version/range/gt.rb +++ b/lib/puppet/util/package/version/range/gt.rb @@ -1,4 +1,4 @@ -require 'puppet/util/package/version/range/simple' +require_relative '../../../../../puppet/util/package/version/range/simple' module Puppet::Util::Package::Version class Range diff --git a/lib/puppet/util/package/version/range/gt_eq.rb b/lib/puppet/util/package/version/range/gt_eq.rb index 7bc9e561562..2f9fe233b38 100644 --- a/lib/puppet/util/package/version/range/gt_eq.rb +++ b/lib/puppet/util/package/version/range/gt_eq.rb @@ -1,4 +1,4 @@ -require 'puppet/util/package/version/range/simple' +require_relative '../../../../../puppet/util/package/version/range/simple' module Puppet::Util::Package::Version class Range diff --git a/lib/puppet/util/package/version/range/lt.rb b/lib/puppet/util/package/version/range/lt.rb index 239dbf35ecf..69b6e8a0bf7 100644 --- a/lib/puppet/util/package/version/range/lt.rb +++ b/lib/puppet/util/package/version/range/lt.rb @@ -1,4 +1,4 @@ -require 'puppet/util/package/version/range/simple' +require_relative '../../../../../puppet/util/package/version/range/simple' module Puppet::Util::Package::Version class Range diff --git a/lib/puppet/util/package/version/range/lt_eq.rb b/lib/puppet/util/package/version/range/lt_eq.rb index 90a35efe372..936736d7a72 100644 --- a/lib/puppet/util/package/version/range/lt_eq.rb +++ b/lib/puppet/util/package/version/range/lt_eq.rb @@ -1,4 +1,4 @@ -require 'puppet/util/package/version/range/simple' +require_relative '../../../../../puppet/util/package/version/range/simple' module Puppet::Util::Package::Version class Range diff --git a/lib/puppet/util/package/version/range/min_max.rb b/lib/puppet/util/package/version/range/min_max.rb index e7d7e8f4d61..c6a88ec4446 100644 --- a/lib/puppet/util/package/version/range/min_max.rb +++ b/lib/puppet/util/package/version/range/min_max.rb @@ -1,4 +1,4 @@ -require 'puppet/util/package/version/range' +require_relative '../../../../../puppet/util/package/version/range' module Puppet::Util::Package::Version class Range diff --git a/lib/puppet/util/package/version/range/simple.rb b/lib/puppet/util/package/version/range/simple.rb index d82157593f2..57a303983b9 100644 --- a/lib/puppet/util/package/version/range/simple.rb +++ b/lib/puppet/util/package/version/range/simple.rb @@ -1,4 +1,4 @@ -require 'puppet/util/package/version/range' +require_relative '../../../../../puppet/util/package/version/range' module Puppet::Util::Package::Version class Range diff --git a/lib/puppet/util/package/version/rpm.rb b/lib/puppet/util/package/version/rpm.rb index 80f3dae53be..e5dc8a9f3c2 100644 --- a/lib/puppet/util/package/version/rpm.rb +++ b/lib/puppet/util/package/version/rpm.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'puppet/util/rpm_compare' +require_relative '../../../../puppet/util/rpm_compare' module Puppet::Util::Package::Version class Rpm < Numeric diff --git a/lib/puppet/util/pidlock.rb b/lib/puppet/util/pidlock.rb index b214b0b7c21..a65f21c6544 100644 --- a/lib/puppet/util/pidlock.rb +++ b/lib/puppet/util/pidlock.rb @@ -1,5 +1,5 @@ require 'fileutils' -require 'puppet/util/lockfile' +require_relative '../../puppet/util/lockfile' class Puppet::Util::Pidlock diff --git a/lib/puppet/util/plist.rb b/lib/puppet/util/plist.rb index 69f858c28f4..05178d79a53 100644 --- a/lib/puppet/util/plist.rb +++ b/lib/puppet/util/plist.rb @@ -1,5 +1,5 @@ require 'cfpropertylist' if Puppet.features.cfpropertylist? -require 'puppet/util/execution' +require_relative '../../puppet/util/execution' module Puppet::Util::Plist diff --git a/lib/puppet/util/profiler.rb b/lib/puppet/util/profiler.rb index 98bbf0baae1..d453adcf57d 100644 --- a/lib/puppet/util/profiler.rb +++ b/lib/puppet/util/profiler.rb @@ -4,9 +4,9 @@ # # @api public module Puppet::Util::Profiler - require 'puppet/util/profiler/wall_clock' - require 'puppet/util/profiler/object_counts' - require 'puppet/util/profiler/around_profiler' + require_relative 'profiler/wall_clock' + require_relative 'profiler/object_counts' + require_relative 'profiler/around_profiler' @profiler = Puppet::Util::Profiler::AroundProfiler.new diff --git a/lib/puppet/util/profiler/aggregate.rb b/lib/puppet/util/profiler/aggregate.rb index 1419964ae42..16969a6feaa 100644 --- a/lib/puppet/util/profiler/aggregate.rb +++ b/lib/puppet/util/profiler/aggregate.rb @@ -1,5 +1,5 @@ -require 'puppet/util/profiler' -require 'puppet/util/profiler/wall_clock' +require_relative '../../../puppet/util/profiler' +require_relative '../../../puppet/util/profiler/wall_clock' class Puppet::Util::Profiler::Aggregate < Puppet::Util::Profiler::WallClock def initialize(logger, identifier) diff --git a/lib/puppet/util/profiler/object_counts.rb b/lib/puppet/util/profiler/object_counts.rb index 3f9e5deb6c5..ac96202457f 100644 --- a/lib/puppet/util/profiler/object_counts.rb +++ b/lib/puppet/util/profiler/object_counts.rb @@ -1,4 +1,4 @@ -require 'puppet/util/profiler/logging' +require_relative '../../../puppet/util/profiler/logging' class Puppet::Util::Profiler::ObjectCounts < Puppet::Util::Profiler::Logging def start diff --git a/lib/puppet/util/profiler/wall_clock.rb b/lib/puppet/util/profiler/wall_clock.rb index 8e0b294ad52..4c5654b5878 100644 --- a/lib/puppet/util/profiler/wall_clock.rb +++ b/lib/puppet/util/profiler/wall_clock.rb @@ -1,4 +1,4 @@ -require 'puppet/util/profiler/logging' +require_relative '../../../puppet/util/profiler/logging' # A profiler implementation that measures the number of seconds a segment of # code takes to execute and provides a callback with a string representation of diff --git a/lib/puppet/util/provider_features.rb b/lib/puppet/util/provider_features.rb index 1a67ec9113f..4716cf337eb 100644 --- a/lib/puppet/util/provider_features.rb +++ b/lib/puppet/util/provider_features.rb @@ -1,6 +1,6 @@ # Provides feature definitions. -require 'puppet/util/docs' -require 'puppet/util' +require_relative '../../puppet/util/docs' +require_relative '../../puppet/util' # This module models provider features and handles checking whether the features # are present. # @todo Unclear what is api and what is private in this module. diff --git a/lib/puppet/util/rdoc.rb b/lib/puppet/util/rdoc.rb index 47894aec2a5..c4064c41f76 100644 --- a/lib/puppet/util/rdoc.rb +++ b/lib/puppet/util/rdoc.rb @@ -1,4 +1,4 @@ -require 'puppet/util' +require_relative '../../puppet/util' module Puppet::Util::RDoc module_function @@ -11,7 +11,7 @@ def rdoc(outputdir, files, charset = nil) require 'rdoc/options' # load our parser - require 'puppet/util/rdoc/parser' + require_relative 'rdoc/parser' r = RDoc::RDoc.new diff --git a/lib/puppet/util/rdoc/generators/puppet_generator.rb b/lib/puppet/util/rdoc/generators/puppet_generator.rb index 1200dd561b3..22216a88608 100644 --- a/lib/puppet/util/rdoc/generators/puppet_generator.rb +++ b/lib/puppet/util/rdoc/generators/puppet_generator.rb @@ -1,5 +1,5 @@ require 'rdoc/generators/html_generator' -require 'puppet/util/rdoc/code_objects' +require_relative '../../../../puppet/util/rdoc/code_objects' require 'digest/md5' module Generators @@ -70,7 +70,7 @@ def initialize(options) #:not-new: # loads our own html template file def load_html_template - require 'puppet/util/rdoc/generators/template/puppet/puppet' + require_relative '../../../../puppet/util/rdoc/generators/template/puppet/puppet' extend RDoc::Page rescue LoadError $stderr.puts "Could not find Puppet template '#{template}'" diff --git a/lib/puppet/util/rdoc/parser.rb b/lib/puppet/util/rdoc/parser.rb index beafb295eb2..0f43673e48e 100644 --- a/lib/puppet/util/rdoc/parser.rb +++ b/lib/puppet/util/rdoc/parser.rb @@ -5,8 +5,8 @@ # rdoc2 includes require 'rdoc/code_objects' -require 'puppet/util/rdoc/code_objects' +require_relative '../../../puppet/util/rdoc/code_objects' require 'rdoc/token_stream' require 'rdoc/markup/pre_process' require 'rdoc/parser' -require 'puppet/util/rdoc/parser/puppet_parser_rdoc2.rb' +require_relative 'parser/puppet_parser_rdoc2.rb' diff --git a/lib/puppet/util/rdoc/parser/puppet_parser_rdoc2.rb b/lib/puppet/util/rdoc/parser/puppet_parser_rdoc2.rb index c825031172f..019ec2a70fa 100644 --- a/lib/puppet/util/rdoc/parser/puppet_parser_rdoc2.rb +++ b/lib/puppet/util/rdoc/parser/puppet_parser_rdoc2.rb @@ -1,4 +1,4 @@ -require 'puppet/util/rdoc/parser/puppet_parser_core.rb' +require_relative '../../../../puppet/util/rdoc/parser/puppet_parser_core.rb' module RDoc PUPPET_RDOC_VERSION = 2 diff --git a/lib/puppet/util/reference.rb b/lib/puppet/util/reference.rb index 70400530dbb..43de439e446 100644 --- a/lib/puppet/util/reference.rb +++ b/lib/puppet/util/reference.rb @@ -1,4 +1,4 @@ -require 'puppet/util/instance_loader' +require_relative '../../puppet/util/instance_loader' require 'fileutils' # Manage Reference Documentation. diff --git a/lib/puppet/util/resource_template.rb b/lib/puppet/util/resource_template.rb index c3cb29cf323..30bbd5a8558 100644 --- a/lib/puppet/util/resource_template.rb +++ b/lib/puppet/util/resource_template.rb @@ -1,5 +1,5 @@ -require 'puppet/util' -require 'puppet/util/logging' +require_relative '../../puppet/util' +require_relative '../../puppet/util/logging' require 'erb' # A template wrapper that evaluates a template in the diff --git a/lib/puppet/util/rubygems.rb b/lib/puppet/util/rubygems.rb index 83b433bfe0b..88f4d2e19e2 100644 --- a/lib/puppet/util/rubygems.rb +++ b/lib/puppet/util/rubygems.rb @@ -1,4 +1,4 @@ -require 'puppet/util' +require_relative '../../puppet/util' module Puppet::Util::RubyGems diff --git a/lib/puppet/util/skip_tags.rb b/lib/puppet/util/skip_tags.rb index 42e81abbf24..652efa76ec7 100644 --- a/lib/puppet/util/skip_tags.rb +++ b/lib/puppet/util/skip_tags.rb @@ -1,4 +1,4 @@ -require 'puppet/util/tagging' +require_relative '../../puppet/util/tagging' class Puppet::Util::SkipTags include Puppet::Util::Tagging diff --git a/lib/puppet/util/storage.rb b/lib/puppet/util/storage.rb index 4eeaae21118..da8a4aff437 100644 --- a/lib/puppet/util/storage.rb +++ b/lib/puppet/util/storage.rb @@ -1,6 +1,6 @@ require 'yaml' require 'singleton' -require 'puppet/util/yaml' +require_relative '../../puppet/util/yaml' # a class for storing state class Puppet::Util::Storage diff --git a/lib/puppet/util/suidmanager.rb b/lib/puppet/util/suidmanager.rb index 6c3cd818baf..aab8433082e 100644 --- a/lib/puppet/util/suidmanager.rb +++ b/lib/puppet/util/suidmanager.rb @@ -1,5 +1,5 @@ require 'facter' -require 'puppet/util/warnings' +require_relative '../../puppet/util/warnings' require 'forwardable' require 'etc' @@ -48,7 +48,7 @@ def groups=(grouplist) def self.root? if Puppet::Util::Platform.windows? - require 'puppet/util/windows/user' + require_relative '../../puppet/util/windows/user' Puppet::Util::Windows::User.admin? else Process.uid == 0 diff --git a/lib/puppet/util/symbolic_file_mode.rb b/lib/puppet/util/symbolic_file_mode.rb index 565f912ad67..89d54d858e3 100644 --- a/lib/puppet/util/symbolic_file_mode.rb +++ b/lib/puppet/util/symbolic_file_mode.rb @@ -1,4 +1,4 @@ -require 'puppet/util' +require_relative '../../puppet/util' module Puppet module Util diff --git a/lib/puppet/util/tag_set.rb b/lib/puppet/util/tag_set.rb index d966c35aa40..2cf3ae7d56c 100644 --- a/lib/puppet/util/tag_set.rb +++ b/lib/puppet/util/tag_set.rb @@ -1,5 +1,5 @@ require 'set' -require 'puppet/network/format_support' +require_relative '../../puppet/network/format_support' class Puppet::Util::TagSet < Set include Puppet::Network::FormatSupport diff --git a/lib/puppet/util/tagging.rb b/lib/puppet/util/tagging.rb index f375322fd94..448790cac63 100644 --- a/lib/puppet/util/tagging.rb +++ b/lib/puppet/util/tagging.rb @@ -1,4 +1,4 @@ -require 'puppet/util/tag_set' +require_relative '../../puppet/util/tag_set' module Puppet::Util::Tagging ValidTagRegex = /\A[[:alnum:]_][[:alnum:]_:.-]*\Z/u diff --git a/lib/puppet/util/watched_file.rb b/lib/puppet/util/watched_file.rb index 8843771340d..7da50d159db 100644 --- a/lib/puppet/util/watched_file.rb +++ b/lib/puppet/util/watched_file.rb @@ -1,4 +1,4 @@ -require 'puppet/util/watcher' +require_relative '../../puppet/util/watcher' # Monitor a given file for changes on a periodic interval. Changes are detected # by looking for a change in the file ctime. diff --git a/lib/puppet/util/watcher.rb b/lib/puppet/util/watcher.rb index a65788bd575..857b49a6b2e 100644 --- a/lib/puppet/util/watcher.rb +++ b/lib/puppet/util/watcher.rb @@ -1,7 +1,7 @@ module Puppet::Util::Watcher - require 'puppet/util/watcher/timer' - require 'puppet/util/watcher/change_watcher' - require 'puppet/util/watcher/periodic_watcher' + require_relative 'watcher/timer' + require_relative 'watcher/change_watcher' + require_relative 'watcher/periodic_watcher' module Common def self.file_ctime_change_watcher(filename) diff --git a/lib/puppet/util/windows.rb b/lib/puppet/util/windows.rb index ad6f3b71964..cdacc53cc7e 100644 --- a/lib/puppet/util/windows.rb +++ b/lib/puppet/util/windows.rb @@ -1,4 +1,4 @@ -require 'puppet/util/platform' +require_relative '../../puppet/util/platform' module Puppet::Util::Windows module ADSI @@ -25,24 +25,24 @@ class EventLog; end require 'win32ole' ; WIN32OLE.codepage = WIN32OLE::CP_UTF8 # these reference platform specific gems - require 'puppet/ffi/windows' - require 'puppet/util/windows/string' - require 'puppet/util/windows/error' - require 'puppet/util/windows/com' - require 'puppet/util/windows/sid' - require 'puppet/util/windows/principal' - require 'puppet/util/windows/file' - require 'puppet/util/windows/security' - require 'puppet/util/windows/user' - require 'puppet/util/windows/process' - require 'puppet/util/windows/root_certs' - require 'puppet/util/windows/access_control_entry' - require 'puppet/util/windows/access_control_list' - require 'puppet/util/windows/security_descriptor' - require 'puppet/util/windows/adsi' - require 'puppet/util/windows/registry' - require 'puppet/util/windows/eventlog' - require 'puppet/util/windows/service' - require 'puppet/util/windows/monkey_patches/process' + require_relative '../../puppet/ffi/windows' + require_relative 'windows/string' + require_relative 'windows/error' + require_relative 'windows/com' + require_relative 'windows/sid' + require_relative 'windows/principal' + require_relative 'windows/file' + require_relative 'windows/security' + require_relative 'windows/user' + require_relative 'windows/process' + require_relative 'windows/root_certs' + require_relative 'windows/access_control_entry' + require_relative 'windows/access_control_list' + require_relative 'windows/security_descriptor' + require_relative 'windows/adsi' + require_relative 'windows/registry' + require_relative 'windows/eventlog' + require_relative 'windows/service' + require_relative 'windows/monkey_patches/process' end end diff --git a/lib/puppet/util/windows/access_control_entry.rb b/lib/puppet/util/windows/access_control_entry.rb index 33fa52dc6eb..1b12af24db3 100644 --- a/lib/puppet/util/windows/access_control_entry.rb +++ b/lib/puppet/util/windows/access_control_entry.rb @@ -6,7 +6,7 @@ # @see https://msdn.microsoft.com/en-us/library/windows/desktop/aa374868(v=vs.85).aspx # @api private class Puppet::Util::Windows::AccessControlEntry - require 'puppet/util/windows/security' + require_relative '../../../puppet/util/windows/security' include Puppet::Util::Windows::SID attr_accessor :sid diff --git a/lib/puppet/util/windows/adsi.rb b/lib/puppet/util/windows/adsi.rb index 3f9bae825c0..b19581bc9bd 100644 --- a/lib/puppet/util/windows/adsi.rb +++ b/lib/puppet/util/windows/adsi.rb @@ -293,7 +293,7 @@ def commit class User < ADSIObject extend FFI::Library - require 'puppet/util/windows/sid' + require_relative '../../../puppet/util/windows/sid' # https://msdn.microsoft.com/en-us/library/aa746340.aspx # IADsUser interface diff --git a/lib/puppet/util/windows/daemon.rb b/lib/puppet/util/windows/daemon.rb index 27af3d449fa..e4a61544317 100644 --- a/lib/puppet/util/windows/daemon.rb +++ b/lib/puppet/util/windows/daemon.rb @@ -1,4 +1,4 @@ -require 'puppet/ffi/windows' +require_relative '../../../puppet/ffi/windows' module Puppet::Util::Windows diff --git a/lib/puppet/util/windows/error.rb b/lib/puppet/util/windows/error.rb index 24ecc7b1f69..0eac79eb837 100644 --- a/lib/puppet/util/windows/error.rb +++ b/lib/puppet/util/windows/error.rb @@ -1,5 +1,5 @@ -require 'puppet/util/windows' -require 'puppet/error' +require_relative '../../../puppet/util/windows' +require_relative '../../../puppet/error' # represents an error resulting from a Win32 error code class Puppet::Util::Windows::Error < Puppet::Error diff --git a/lib/puppet/util/windows/file.rb b/lib/puppet/util/windows/file.rb index 3ae8296066e..c5a0ee2f03d 100644 --- a/lib/puppet/util/windows/file.rb +++ b/lib/puppet/util/windows/file.rb @@ -1,4 +1,4 @@ -require 'puppet/ffi/windows' +require_relative '../../../puppet/ffi/windows' module Puppet::Util::Windows::File extend Puppet::Util::Windows::String diff --git a/lib/puppet/util/windows/monkey_patches/process.rb b/lib/puppet/util/windows/monkey_patches/process.rb index cda9ac1049e..25c714edf9e 100644 --- a/lib/puppet/util/windows/monkey_patches/process.rb +++ b/lib/puppet/util/windows/monkey_patches/process.rb @@ -1,8 +1,8 @@ # frozen_string_literal: true require 'ffi' -require 'puppet/ffi/windows' -require 'puppet/util/windows/string' +require_relative '../../../../puppet/ffi/windows' +require_relative '../../../../puppet/util/windows/string' module Process extend FFI::Library diff --git a/lib/puppet/util/windows/principal.rb b/lib/puppet/util/windows/principal.rb index e82b2593795..3c8fc1e9719 100644 --- a/lib/puppet/util/windows/principal.rb +++ b/lib/puppet/util/windows/principal.rb @@ -1,4 +1,4 @@ -require 'puppet/util/windows' +require_relative '../../../puppet/util/windows' module Puppet::Util::Windows::SID class Principal diff --git a/lib/puppet/util/windows/process.rb b/lib/puppet/util/windows/process.rb index ccdbf3ca0b5..b96c5689ee9 100644 --- a/lib/puppet/util/windows/process.rb +++ b/lib/puppet/util/windows/process.rb @@ -1,5 +1,5 @@ -require 'puppet/util/windows/monkey_patches/process' -require 'puppet/ffi/windows' +require_relative '../../../puppet/util/windows/monkey_patches/process' +require_relative '../../../puppet/ffi/windows' module Puppet::Util::Windows::Process extend Puppet::FFI::Windows::Functions diff --git a/lib/puppet/util/windows/registry.rb b/lib/puppet/util/windows/registry.rb index d2dfbd0d4c4..f37a8d848fe 100644 --- a/lib/puppet/util/windows/registry.rb +++ b/lib/puppet/util/windows/registry.rb @@ -1,4 +1,4 @@ -require 'puppet/util/windows' +require_relative '../../../puppet/util/windows' module Puppet::Util::Windows module Registry diff --git a/lib/puppet/util/windows/root_certs.rb b/lib/puppet/util/windows/root_certs.rb index 0c213daa1f4..a6981233400 100644 --- a/lib/puppet/util/windows/root_certs.rb +++ b/lib/puppet/util/windows/root_certs.rb @@ -1,5 +1,5 @@ -require 'puppet/util/windows' -require 'puppet/ssl/openssl_loader' +require_relative '../../../puppet/util/windows' +require_relative '../../../puppet/ssl/openssl_loader' require 'ffi' # Represents a collection of trusted root certificates. diff --git a/lib/puppet/util/windows/security.rb b/lib/puppet/util/windows/security.rb index 374c9c544a7..98f5c680b2e 100644 --- a/lib/puppet/util/windows/security.rb +++ b/lib/puppet/util/windows/security.rb @@ -61,7 +61,7 @@ # automatically rebuild the access control list based on the new # (and different) owner or group. -require 'puppet/util/windows' +require_relative '../../../puppet/util/windows' require 'pathname' require 'ffi' diff --git a/lib/puppet/util/windows/security_descriptor.rb b/lib/puppet/util/windows/security_descriptor.rb index 27e50593e99..681bac52e71 100644 --- a/lib/puppet/util/windows/security_descriptor.rb +++ b/lib/puppet/util/windows/security_descriptor.rb @@ -8,7 +8,7 @@ # @see https://msdn.microsoft.com/en-us/library/windows/desktop/aa379563(v=vs.85).aspx # @api private class Puppet::Util::Windows::SecurityDescriptor - require 'puppet/util/windows/security' + require_relative '../../../puppet/util/windows/security' include Puppet::Util::Windows::SID attr_reader :owner, :group, :dacl diff --git a/lib/puppet/util/windows/service.rb b/lib/puppet/util/windows/service.rb index 98552e4f6b8..7601b304ba3 100644 --- a/lib/puppet/util/windows/service.rb +++ b/lib/puppet/util/windows/service.rb @@ -1,5 +1,5 @@ # coding: utf-8 -require 'puppet/ffi/windows' +require_relative '../../../puppet/ffi/windows' module Puppet::Util::Windows # This module is designed to provide an API between the windows system and puppet for diff --git a/lib/puppet/util/windows/sid.rb b/lib/puppet/util/windows/sid.rb index d648b080226..bc3d2c5795d 100644 --- a/lib/puppet/util/windows/sid.rb +++ b/lib/puppet/util/windows/sid.rb @@ -1,4 +1,4 @@ -require 'puppet/util/windows' +require_relative '../../../puppet/util/windows' module Puppet::Util::Windows module SID diff --git a/lib/puppet/util/windows/user.rb b/lib/puppet/util/windows/user.rb index 213b79f1946..a5a2e89676d 100644 --- a/lib/puppet/util/windows/user.rb +++ b/lib/puppet/util/windows/user.rb @@ -1,4 +1,4 @@ -require 'puppet/util/windows' +require_relative '../../../puppet/util/windows' require 'facter' require 'ffi' diff --git a/lib/puppet/vendor.rb b/lib/puppet/vendor.rb index 5495f6b4ae2..161f6a6953e 100644 --- a/lib/puppet/vendor.rb +++ b/lib/puppet/vendor.rb @@ -37,7 +37,7 @@ def load_entry(entry) # @api private def require_libs - require 'puppet/vendor/require_vendored' + require_relative 'vendor/require_vendored' end # Configures the path for all vendored libraries and loads required libraries. diff --git a/lib/puppet/x509.rb b/lib/puppet/x509.rb index 75191993ff3..d447b237a62 100644 --- a/lib/puppet/x509.rb +++ b/lib/puppet/x509.rb @@ -1,11 +1,11 @@ -require 'puppet' -require 'puppet/ssl/openssl_loader' +require_relative '../puppet' +require_relative '../puppet/ssl/openssl_loader' # Responsible for loading and saving certificates and private keys. # # @see Puppet::X509::CertProvider # @api private module Puppet::X509 - require 'puppet/x509/pem_store' - require 'puppet/x509/cert_provider' + require_relative 'x509/pem_store' + require_relative 'x509/cert_provider' end diff --git a/lib/puppet/x509/cert_provider.rb b/lib/puppet/x509/cert_provider.rb index d170736f29b..7f38216608b 100644 --- a/lib/puppet/x509/cert_provider.rb +++ b/lib/puppet/x509/cert_provider.rb @@ -1,4 +1,4 @@ -require 'puppet/x509' +require_relative '../../puppet/x509' # Class for loading and saving cert related objects. By default the provider # loads and saves based on puppet's default settings, such as `Puppet[:localcacert]`. diff --git a/lib/puppet/x509/pem_store.rb b/lib/puppet/x509/pem_store.rb index c2f20a9d8b9..c57993ac87c 100644 --- a/lib/puppet/x509/pem_store.rb +++ b/lib/puppet/x509/pem_store.rb @@ -1,4 +1,4 @@ -require 'puppet/x509' +require_relative '../../puppet/x509' # Methods for managing PEM encoded files. While PEM encoded strings are # always ASCII, the files may contain user specified comments, so they are diff --git a/lib/puppet_pal.rb b/lib/puppet_pal.rb index be6a0bb90c1..47587aca670 100644 --- a/lib/puppet_pal.rb +++ b/lib/puppet_pal.rb @@ -4,5 +4,5 @@ # This requires all of puppet because 'settings' and many other things are still required in PAL. # Eventually that will not be the case. # -require 'puppet' -require 'puppet/pal/pal_api' +require_relative 'puppet' +require_relative 'puppet/pal/pal_api' From f5a5928bd92035d454636eb0fa9aa1e68ac90c93 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Wed, 12 May 2021 16:38:05 +0000 Subject: [PATCH 366/731] (packaging) Updating the puppet.pot file --- locales/puppet.pot | 82 +++++++++++++++++++++++----------------------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/locales/puppet.pot b/locales/puppet.pot index d4bf225d79c..6cd8d5bbda4 100644 --- a/locales/puppet.pot +++ b/locales/puppet.pot @@ -6,11 +6,11 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Puppet automation framework 7.6.1-59-g0ccaccd84e\n" +"Project-Id-Version: Puppet automation framework 7.6.1-91-g3f8691353f\n" "\n" "Report-Msgid-Bugs-To: https://tickets.puppetlabs.com\n" -"POT-Creation-Date: 2021-05-05 08:07+0000\n" -"PO-Revision-Date: 2021-05-05 08:07+0000\n" +"POT-Creation-Date: 2021-05-12 16:37+0000\n" +"PO-Revision-Date: 2021-05-12 16:37+0000\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -1650,20 +1650,20 @@ msgstr "" msgid "Fileset recurse parameter must not be a number anymore, please use recurselimit" msgstr "" -#: ../lib/puppet/file_serving/fileset.rb:65 -msgid "The directory '%{path}' contains %{entries} entries, which exceeds the limit of %{max_files} specified by the max_files parameter for this resource. The limit may be increased, but be aware that large number of file resources can result in excessive resource consumption and degraded performance. Consider using an alternate method to manage large directory trees" +#: ../lib/puppet/file_serving/fileset.rb:69 +msgid "The directory '%{path}' contains %{entries} entries, which exceeds the limit of %{munged_max_files} specified by the max_files parameter for this resource. The limit may be increased, but be aware that large number of file resources can result in excessive resource consumption and degraded performance. Consider using an alternate method to manage large directory trees" msgstr "" -#: ../lib/puppet/file_serving/fileset.rb:67 -msgid "The directory '%{path}' contains %{entries} entries, which exceeds the default soft limit %{max_files} and may cause excessive resource consumption and degraded performance. To remove this warning set a value for `max_files` parameter or consider using an alternate method to manage large directory trees" +#: ../lib/puppet/file_serving/fileset.rb:71 +msgid "The directory '%{path}' contains %{entries} entries, which exceeds the default soft limit %{soft_max_files} and may cause excessive resource consumption and degraded performance. To remove this warning set a value for `max_files` parameter or consider using an alternate method to manage large directory trees" msgstr "" #. TRANSLATORS ":links" is a parameter name and should not be translated -#: ../lib/puppet/file_serving/fileset.rb:88 +#: ../lib/puppet/file_serving/fileset.rb:92 msgid "Invalid :links value '%{links}'" msgstr "" -#: ../lib/puppet/file_serving/fileset.rb:101 +#: ../lib/puppet/file_serving/fileset.rb:105 msgid "Invalid option '%{option}'" msgstr "" @@ -1747,7 +1747,7 @@ msgstr "" msgid "Timeout waiting for exclusive lock on %{path}" msgstr "" -#: ../lib/puppet/file_system/jruby.rb:18 ../lib/puppet/file_system/windows.rb:127 ../lib/puppet/util.rb:706 +#: ../lib/puppet/file_system/jruby.rb:18 ../lib/puppet/file_system/windows.rb:127 ../lib/puppet/util.rb:715 msgid "Is a directory: %{directory}" msgstr "" @@ -2853,8 +2853,8 @@ msgstr "" msgid "Option %{option} conflicts with existing option %{conflict} on %{face}" msgstr "" -#. TRANSLATORS 'Puppet.settings' references to the Puppet settings options and should not be translated #. TRANSLATORS 'Puppet.settings' should not be translated +#. TRANSLATORS 'Puppet.settings' references to the Puppet settings options and should not be translated #: ../lib/puppet/interface/action.rb:315 ../lib/puppet/interface/option_manager.rb:14 msgid "Global option %{option} does not exist in Puppet.settings" msgstr "" @@ -6749,7 +6749,7 @@ msgstr "" msgid "Somehow got told to prefetch with no resource set" msgstr "" -#: ../lib/puppet/provider/service/base.rb:121 +#: ../lib/puppet/provider/service/base.rb:123 msgid "%{name} is not running" msgstr "" @@ -6775,15 +6775,15 @@ msgstr "" msgid "Waiting 5 seconds for runsvdir to discover service %{service}" msgstr "" -#: ../lib/puppet/provider/service/smf.rb:120 +#: ../lib/puppet/provider/service/smf.rb:96 msgid "Failed to get the FMRI of the %{service} service: The pattern '%{service}' matches multiple FMRIs! These are the FMRIs it matches: %{all_fmris}" msgstr "" -#: ../lib/puppet/provider/service/smf.rb:135 +#: ../lib/puppet/provider/service/smf.rb:111 msgid "Cannot query if the %{service} service is complete: The concept of complete/incomplete services was introduced in Solaris 11.1. You are on a Solaris %{release} machine." msgstr "" -#: ../lib/puppet/provider/service/smf.rb:221 +#: ../lib/puppet/provider/service/smf.rb:197 msgid "The %{service} service is incomplete so its status will be reported as :stopped. See `svcs -xv %{fmri}` for more details." msgstr "" @@ -7600,7 +7600,7 @@ msgid "Verified CA certificate '%{subject}' fingerprint %{digest}" msgstr "" #. TRANSLATORS: `error` is an untranslated message from openssl describing why a certificate in the server's chain is invalid, and `subject` is the identity/name of the failed certificate -#: ../lib/puppet/ssl/verifier.rb:130 +#: ../lib/puppet/ssl/verifier.rb:134 msgid "certificate verify failed [%{error} for %{subject}]" msgstr "" @@ -8017,74 +8017,74 @@ msgstr "" msgid "Invalid recurselimit value %{value}" msgstr "" -#: ../lib/puppet/type/file.rb:432 +#: ../lib/puppet/type/file.rb:433 msgid "You cannot specify more than one of %{creators}" msgstr "" -#: ../lib/puppet/type/file.rb:434 +#: ../lib/puppet/type/file.rb:435 msgid "You cannot specify a remote recursion without a source" msgstr "" -#: ../lib/puppet/type/file.rb:436 +#: ../lib/puppet/type/file.rb:437 msgid "You cannot specify source when using checksum 'none'" msgstr "" -#: ../lib/puppet/type/file.rb:439 +#: ../lib/puppet/type/file.rb:440 msgid "You cannot specify content when using checksum '%{checksum_type}'" msgstr "" -#: ../lib/puppet/type/file.rb:442 +#: ../lib/puppet/type/file.rb:443 msgid "Possible error: recurselimit is set but not recurse, no recursion will happen" msgstr "" -#: ../lib/puppet/type/file.rb:450 +#: ../lib/puppet/type/file.rb:451 msgid "Checksum value '%{value}' is not a valid checksum type %{checksum}" msgstr "" -#: ../lib/puppet/type/file.rb:453 +#: ../lib/puppet/type/file.rb:454 msgid "Checksum value is ignored unless content or source are specified" msgstr "" -#: ../lib/puppet/type/file.rb:491 +#: ../lib/puppet/type/file.rb:492 msgid "Can not find filebucket for backups without a catalog" msgstr "" -#: ../lib/puppet/type/file.rb:496 +#: ../lib/puppet/type/file.rb:497 msgid "Could not find filebucket %{backup} specified in backup" msgstr "" -#: ../lib/puppet/type/file.rb:795 +#: ../lib/puppet/type/file.rb:796 msgid "Could not back up file of type %{current_type}" msgstr "" -#: ../lib/puppet/type/file.rb:810 +#: ../lib/puppet/type/file.rb:811 msgid "Could not remove files of type %{current_type}" msgstr "" #. TRANSLATORS "source_permissions => ignore" should not be translated -#: ../lib/puppet/type/file.rb:821 +#: ../lib/puppet/type/file.rb:822 msgid "Copying owner/mode/group from the source file on Windows is not supported; use source_permissions => ignore." msgstr "" #. TRANSLATORS "stat" is a program name and should not be translated -#: ../lib/puppet/type/file.rb:902 ../lib/puppet/type/tidy.rb:371 +#: ../lib/puppet/type/file.rb:903 ../lib/puppet/type/tidy.rb:371 msgid "Could not stat; permission denied" msgstr "" -#: ../lib/puppet/type/file.rb:905 +#: ../lib/puppet/type/file.rb:906 msgid "Could not stat; invalid pathname" msgstr "" -#: ../lib/puppet/type/file.rb:1033 +#: ../lib/puppet/type/file.rb:1034 msgid "Not removing directory; use 'force' to override" msgstr "" #. TRANSLATORS refers to a file which could not be backed up -#: ../lib/puppet/type/file.rb:1058 +#: ../lib/puppet/type/file.rb:1059 msgid "Could not back up; will not remove" msgstr "" -#: ../lib/puppet/type/file.rb:1073 +#: ../lib/puppet/type/file.rb:1074 msgid "File written to disk did not match desired checksum; discarding changes (%{content_checksum} vs %{desired_checksum})" msgstr "" @@ -8238,18 +8238,18 @@ msgstr "" msgid "Setting enable to %{value} is only supported on Microsoft Windows." msgstr "" -#: ../lib/puppet/type/service.rb:166 -msgid "The 'logonaccount' parameter is mandatory when setting 'logonpassword'." -msgstr "" - -#: ../lib/puppet/type/service.rb:167 ../lib/puppet/type/user.rb:271 +#: ../lib/puppet/type/service.rb:152 ../lib/puppet/type/user.rb:271 msgid "Passwords cannot include ':'" msgstr "" -#: ../lib/puppet/type/service.rb:304 +#: ../lib/puppet/type/service.rb:279 msgid "\"%{value}\" is not a positive integer: the timeout parameter must be specified as a positive integer" msgstr "" +#: ../lib/puppet/type/service.rb:301 +msgid "The 'logonaccount' parameter is mandatory when setting 'logonpassword'." +msgstr "" + #: ../lib/puppet/type/tidy.rb:101 msgid "Tidy can't use matches with recurse 0, false, or undef" msgstr "" @@ -8418,11 +8418,11 @@ msgstr "" msgid "path may not be nil" msgstr "" -#: ../lib/puppet/util.rb:621 +#: ../lib/puppet/util.rb:630 msgid "replace_file requires a block" msgstr "" -#: ../lib/puppet/util.rb:625 +#: ../lib/puppet/util.rb:634 msgid "replace_file default_mode: %{default_mode} is invalid" msgstr "" From e6603550d85951e2305ec6c8058c26ec9522e8bc Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Wed, 12 May 2021 15:52:59 -0700 Subject: [PATCH 367/731] (PUP-11048) Correct changes from system to execute Commit 2f14ddd26 changed the debian and systemd service providers from calling `Kernel.system` to `Puppet::Provider.execute`, but the methods don't take arguments in the same way, resulting in: wrong number of arguments (given 5, expected 1..2) This code path only seems to occur when ensuring a non-existent service isn't enabled such as: # puppet resource service doesnotexist ensure=false enable=false Prior to 2f14ddd26 we did not use a shell when calling Kernel.system: # strace -fi -e trace=execve ruby -e "system('ls','*')" .. [pid 1631] [00007fe41e5d1e37] execve("/bin/ls", ["ls", "*"], 0x55c1d97b3c50 /* 20 vars */) = 0 So we preserve that behavior when calling Puppet::Provider#execute: # strace -fi -e trace=execve /opt/puppetlabs/puppet/bin/ruby -e \ "require 'puppet'; Puppet::Util::Execution.execute(['ls', '*'])" .. [pid 1613] [00007f1231b57e37] execve("/bin/ls", ["ls", "*"], 0x5615349c44d0 /* 18 vars */) = 0 We also have to pass `failonfail => false` to prevent puppet from raising on non-zero exit status. --- lib/puppet/provider/service/debian.rb | 2 +- lib/puppet/provider/service/systemd.rb | 2 +- spec/unit/provider/service/debian_spec.rb | 10 +++++++++- spec/unit/provider/service/systemd_spec.rb | 10 ++++++++++ 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/lib/puppet/provider/service/debian.rb b/lib/puppet/provider/service/debian.rb index 8cbacc9b992..c6ba5b34b05 100644 --- a/lib/puppet/provider/service/debian.rb +++ b/lib/puppet/provider/service/debian.rb @@ -34,7 +34,7 @@ def disable end def enabled? - status = execute("/usr/sbin/invoke-rc.d", "--quiet", "--query", @resource[:name], "start") + status = execute(["/usr/sbin/invoke-rc.d", "--quiet", "--query", @resource[:name], "start"], :failonfail => false) # 104 is the exit status when you query start an enabled service. # 106 is the exit status when the policy layer supplies a fallback action diff --git a/lib/puppet/provider/service/systemd.rb b/lib/puppet/provider/service/systemd.rb index ea974ce0d36..6125107d8f9 100644 --- a/lib/puppet/provider/service/systemd.rb +++ b/lib/puppet/provider/service/systemd.rb @@ -119,7 +119,7 @@ def enabled? # whether it is enabled or not. See PUP-5016 for more details. # def debian_enabled? - status = execute("/usr/sbin/invoke-rc.d", "--quiet", "--query", @resource[:name], "start") + status = execute(["/usr/sbin/invoke-rc.d", "--quiet", "--query", @resource[:name], "start"], :failonfail => false) if [104, 106].include?(status.exitstatus) return :true elsif [101, 105].include?(status.exitstatus) diff --git a/spec/unit/provider/service/debian_spec.rb b/spec/unit/provider/service/debian_spec.rb index 303850b3a46..02ce242c4b1 100644 --- a/spec/unit/provider/service/debian_spec.rb +++ b/spec/unit/provider/service/debian_spec.rb @@ -87,7 +87,8 @@ context "when checking whether it is enabled" do it "should execute the query command" do - expect(@provider).to receive(:execute).with("/usr/sbin/invoke-rc.d", "--quiet", "--query", @resource[:name], "start").and_return(Puppet::Util::Execution::ProcessOutput.new('', 0)) + expect(@provider).to receive(:execute).with(["/usr/sbin/invoke-rc.d", "--quiet", "--query", @resource[:name], "start"], :failonfail => false) + .and_return(Puppet::Util::Execution::ProcessOutput.new('', 0)) @provider.enabled? end @@ -101,6 +102,13 @@ expect(@provider.enabled?).to eq(:true) end + it "should consider nonexistent services to be disabled" do + @provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'doesnotexist')) + expect(@provider).to receive(:execute).with(["/usr/sbin/invoke-rc.d", "--quiet", "--query", "doesnotexist", "start"], :failonfail => false) + .and_return(Puppet::Util::Execution::ProcessOutput.new("", 1)) + expect(@provider.enabled?).to be(:false) + end + shared_examples "manually queries service status" do |status| it "links count is 4" do allow(@provider).to receive(:execute).and_return(Puppet::Util::Execution::ProcessOutput.new('', status)) diff --git a/spec/unit/provider/service/systemd_spec.rb b/spec/unit/provider/service/systemd_spec.rb index 886254b269a..99c28ee7f50 100644 --- a/spec/unit/provider/service/systemd_spec.rb +++ b/spec/unit/provider/service/systemd_spec.rb @@ -330,6 +330,16 @@ and_return(Puppet::Util::Execution::ProcessOutput.new("masked\n", 1)) expect(provider.enabled?).to eq(:mask) end + + it "should consider nonexistent services to be disabled" do + provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'doesnotexist')) + expect(provider).to receive(:execute).with(['/bin/systemctl','is-enabled', '--', 'doesnotexist'], :failonfail => false) + .and_return(Puppet::Util::Execution::ProcessOutput.new("", 1)) + expect(provider).to receive(:execute).with(["/usr/sbin/invoke-rc.d", "--quiet", "--query", "doesnotexist", "start"], :failonfail => false) + .and_return(Puppet::Util::Execution::ProcessOutput.new("", 1)) + + expect(provider.enabled?).to be(:false) + end end describe "#enable" do From 69eb68db5d11bac31afbf9856d30088de9b91a98 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Fri, 14 May 2021 14:24:25 +0000 Subject: [PATCH 368/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 495 +++++++++++++++++++++-------------------- 1 file changed, 255 insertions(+), 240 deletions(-) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index 018960d262c..d05a2874eca 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -42,7 +42,7 @@ See the configuration guide \fIhttps://puppet\.com/docs/puppet/latest/config_abo A lock file to indicate that a puppet agent catalog run is currently in progress\. The file contains the pid of the process that holds the lock on the catalog run\. . .IP "\(bu" 4 -\fIDefault\fR: $statedir/agent_catalog_run\.lock +\fIDefault\fR: \fB$statedir/agent_catalog_run\.lock\fR . .IP "" 0 . @@ -50,7 +50,7 @@ A lock file to indicate that a puppet agent catalog run is currently in progress A lock file to indicate that puppet agent runs have been administratively disabled\. File contains a JSON object with state information\. . .IP "\(bu" 4 -\fIDefault\fR: $statedir/agent_disabled\.lock +\fIDefault\fR: \fB$statedir/agent_disabled\.lock\fR . .IP "" 0 . @@ -58,7 +58,7 @@ A lock file to indicate that puppet agent runs have been administratively disabl Whether to allow a new certificate request to overwrite an existing certificate request\. If true, then the old certificate must be cleaned using \fBpuppetserver ca clean\fR, and the new request signed using \fBpuppetserver ca sign\fR\. . .IP "\(bu" 4 -\fIDefault\fR: false +\fIDefault\fR: \fBfalse\fR . .IP "" 0 . @@ -69,7 +69,7 @@ Affects how we cache attempts to load Puppet resource types and features\. If tr If this setting is set to false, then types and features will only be checked once, and if they are not available, the negative result is cached and returned for all subsequent attempts to load the type or feature\. This behavior is almost always appropriate for the server, and can result in a significant performance improvement for types and features that are checked frequently\. . .IP "\(bu" 4 -\fIDefault\fR: true +\fIDefault\fR: \fBtrue\fR . .IP "" 0 . @@ -77,7 +77,7 @@ If this setting is set to false, then types and features will only be checked on Whether log files should always flush to disk\. . .IP "\(bu" 4 -\fIDefault\fR: true +\fIDefault\fR: \fBtrue\fR . .IP "" 0 . @@ -100,7 +100,7 @@ If a certificate request is not autosigned, it will persist for review\. An admi For info on autosign configuration files, see the guide to Puppet\'s config files \fIhttps://puppet\.com/docs/puppet/latest/config_file_autosign\.html\fR\. . .IP "\(bu" 4 -\fIDefault\fR: $confdir/autosign\.conf +\fIDefault\fR: \fB$confdir/autosign\.conf\fR . .IP "" 0 . @@ -111,37 +111,39 @@ The search path for \fBglobal\fR modules\. Should be specified as a list of dire These are the modules that will be used by \fIall\fR environments\. Note that the \fBmodules\fR directory of the active environment will have priority over any global directories\. For more info, see \fIhttps://puppet\.com/docs/puppet/latest/environments_about\.html\fR . .IP "\(bu" 4 -\fIDefault\fR: $codedir/modules:/opt/puppetlabs/puppet/modules +\fIDefault\fR: \fB$codedir/modules:/opt/puppetlabs/puppet/modules\fR . .IP "" 0 . .SS "binder_config" The binder configuration file\. Puppet reads this file on each request to configure the bindings system\. If set to nil (the default), a $confdir/binder_config\.yaml is optionally loaded\. If it does not exists, a default configuration is used\. If the setting :binding_config is specified, it must reference a valid and existing yaml file\. . -.TP -\fIDefault\fR: - +.IP "\(bu" 4 +\fIDefault\fR: `` +. +.IP "" 0 . .SS "bucketdir" Where FileBucket files are stored\. . .IP "\(bu" 4 -\fIDefault\fR: $vardir/bucket +\fIDefault\fR: \fB$vardir/bucket\fR . .IP "" 0 . .SS "ca_fingerprint" The expected fingerprint of the CA certificate\. If specified, the agent will compare the CA certificate fingerprint that it downloads against this value and reject the CA certificate if the values do not match\. This only applies during the first download of the CA certificate\. . -.TP -\fIDefault\fR: - +.IP "\(bu" 4 +\fIDefault\fR: `` +. +.IP "" 0 . .SS "ca_name" The name to use the Certificate Authority certificate\. . .IP "\(bu" 4 -\fIDefault\fR: Puppet CA: $certname +\fIDefault\fR: \fBPuppet CA: $certname\fR . .IP "" 0 . @@ -149,7 +151,7 @@ The name to use the Certificate Authority certificate\. The port to use for the certificate authority\. . .IP "\(bu" 4 -\fIDefault\fR: $serverport +\fIDefault\fR: \fB$serverport\fR . .IP "" 0 . @@ -157,7 +159,7 @@ The port to use for the certificate authority\. The server to use for certificate authority requests\. It\'s a separate server because it cannot and does not need to horizontally scale\. . .IP "\(bu" 4 -\fIDefault\fR: $server +\fIDefault\fR: \fB$server\fR . .IP "" 0 . @@ -165,7 +167,7 @@ The server to use for certificate authority requests\. It\'s a separate server b The default TTL for new certificates\. This setting can be a time interval in seconds (30 or 30s), minutes (30m), hours (6h), days (2d), or years (5y)\. . .IP "\(bu" 4 -\fIDefault\fR: 5y +\fIDefault\fR: \fB5y\fR . .IP "" 0 . @@ -173,7 +175,7 @@ The default TTL for new certificates\. This setting can be a time interval in se The CA certificate\. . .IP "\(bu" 4 -\fIDefault\fR: $cadir/ca_crt\.pem +\fIDefault\fR: \fB$cadir/ca_crt\.pem\fR . .IP "" 0 . @@ -181,7 +183,7 @@ The CA certificate\. The certificate revocation list (CRL) for the CA\. . .IP "\(bu" 4 -\fIDefault\fR: $cadir/ca_crl\.pem +\fIDefault\fR: \fB$cadir/ca_crl\.pem\fR . .IP "" 0 . @@ -189,7 +191,7 @@ The certificate revocation list (CRL) for the CA\. The root directory for the certificate authority\. . .IP "\(bu" 4 -\fIDefault\fR: /etc/puppetlabs/puppetserver/ca +\fIDefault\fR: \fB/etc/puppetlabs/puppetserver/ca\fR . .IP "" 0 . @@ -197,7 +199,7 @@ The root directory for the certificate authority\. The CA private key\. . .IP "\(bu" 4 -\fIDefault\fR: $cadir/ca_key\.pem +\fIDefault\fR: \fB$cadir/ca_key\.pem\fR . .IP "" 0 . @@ -205,22 +207,23 @@ The CA private key\. The CA public key\. . .IP "\(bu" 4 -\fIDefault\fR: $cadir/ca_pub\.pem +\fIDefault\fR: \fB$cadir/ca_pub\.pem\fR . .IP "" 0 . .SS "catalog_cache_terminus" How to store cached catalogs\. Valid values are \'json\', \'msgpack\' and \'yaml\'\. The agent application defaults to \'json\'\. . -.TP -\fIDefault\fR: - +.IP "\(bu" 4 +\fIDefault\fR: `` +. +.IP "" 0 . .SS "catalog_terminus" Where to get node catalogs\. This is useful to change if, for instance, you\'d like to pre\-compile catalogs and store them in memcached or some other easily\-accessed store\. . .IP "\(bu" 4 -\fIDefault\fR: compiler +\fIDefault\fR: \fBcompiler\fR . .IP "" 0 . @@ -228,7 +231,7 @@ Where to get node catalogs\. This is useful to change if, for instance, you\'d l The inventory file\. This is a text file to which the CA writes a complete listing of all certificates\. . .IP "\(bu" 4 -\fIDefault\fR: $cadir/inventory\.txt +\fIDefault\fR: \fB$cadir/inventory\.txt\fR . .IP "" 0 . @@ -236,7 +239,7 @@ The inventory file\. This is a text file to which the CA writes a complete listi The certificate directory\. . .IP "\(bu" 4 -\fIDefault\fR: $ssldir/certs +\fIDefault\fR: \fB$ssldir/certs\fR . .IP "" 0 . @@ -256,7 +259,7 @@ When certificate_revocation is set to \'leaf\', Puppet verifies certs against th When certificate_revocation is set to \'false\', Puppet disables all certificate revocation checking and does not attempt to download the CRL\. . .IP "\(bu" 4 -\fIDefault\fR: chain +\fIDefault\fR: \fBchain\fR . .IP "" 0 . @@ -284,7 +287,7 @@ The special value \fBca\fR is reserved, and can\'t be used as the certname for a Defaults to the node\'s fully qualified domain name\. . .IP "\(bu" 4 -\fIDefault\fR: the Host\'s fully qualified domain name, as determined by Facter +\fIDefault\fR: \fBthe Host\'s fully qualified domain name, as determined by Facter\fR . .IP "" 0 . @@ -292,7 +295,7 @@ Defaults to the node\'s fully qualified domain name\. The list of ciphersuites for TLS connections initiated by puppet\. The default value is chosen to support TLS 1\.0 and up, but can be made more restrictive if needed\. The ciphersuites must be specified in OpenSSL format, not IANA\. . .IP "\(bu" 4 -\fIDefault\fR: ECDHE\-ECDSA\-AES128\-GCM\-SHA256:ECDHE\-RSA\-AES128\-GCM\-SHA256:ECDHE\-ECDSA\-AES256\-GCM\-SHA384:ECDHE\-RSA\-AES256\-GCM\-SHA384:ECDHE\-ECDSA\-CHACHA20\-POLY1305:ECDHE\-RSA\-CHACHA20\-POLY1305:DHE\-RSA\-AES128\-GCM\-SHA256:DHE\-RSA\-AES256\-GCM\-SHA384:DHE\-RSA\-CHACHA20\-POLY1305:ECDHE\-ECDSA\-AES128\-SHA256:ECDHE\-RSA\-AES128\-SHA256:ECDHE\-ECDSA\-AES128\-SHA:ECDHE\-RSA\-AES128\-SHA:ECDHE\-ECDSA\-AES256\-SHA384:ECDHE\-RSA\-AES256\-SHA384:ECDHE\-ECDSA\-AES256\-SHA:ECDHE\-RSA\-AES256\-SHA:DHE\-RSA\-AES128\-SHA256:DHE\-RSA\-AES256\-SHA256:AES128\-GCM\-SHA256:AES256\-GCM\-SHA384:AES128\-SHA256:AES256\-SHA256 +\fIDefault\fR: \fBECDHE\-ECDSA\-AES128\-GCM\-SHA256:ECDHE\-RSA\-AES128\-GCM\-SHA256:ECDHE\-ECDSA\-AES256\-GCM\-SHA384:ECDHE\-RSA\-AES256\-GCM\-SHA384:ECDHE\-ECDSA\-CHACHA20\-POLY1305:ECDHE\-RSA\-CHACHA20\-POLY1305:DHE\-RSA\-AES128\-GCM\-SHA256:DHE\-RSA\-AES256\-GCM\-SHA384:DHE\-RSA\-CHACHA20\-POLY1305:ECDHE\-ECDSA\-AES128\-SHA256:ECDHE\-RSA\-AES128\-SHA256:ECDHE\-ECDSA\-AES128\-SHA:ECDHE\-RSA\-AES128\-SHA:ECDHE\-ECDSA\-AES256\-SHA384:ECDHE\-RSA\-AES256\-SHA384:ECDHE\-ECDSA\-AES256\-SHA:ECDHE\-RSA\-AES256\-SHA:DHE\-RSA\-AES128\-SHA256:DHE\-RSA\-AES256\-SHA256:AES128\-GCM\-SHA256:AES256\-GCM\-SHA384:AES128\-SHA256:AES256\-SHA256\fR . .IP "" 0 . @@ -300,7 +303,7 @@ The list of ciphersuites for TLS connections initiated by puppet\. The default v The file in which puppet agent stores a list of the classes associated with the retrieved configuration\. Can be loaded in the separate \fBpuppet\fR executable using the \fB\-\-loadclasses\fR option\. . .IP "\(bu" 4 -\fIDefault\fR: $statedir/classes\.txt +\fIDefault\fR: \fB$statedir/classes\.txt\fR . .IP "" 0 . @@ -308,7 +311,7 @@ The file in which puppet agent stores a list of the classes associated with the The directory in which serialized data is stored on the client\. . .IP "\(bu" 4 -\fIDefault\fR: $vardir/client_data +\fIDefault\fR: \fB$vardir/client_data\fR . .IP "" 0 . @@ -316,7 +319,7 @@ The directory in which serialized data is stored on the client\. Where FileBucket files are stored locally\. . .IP "\(bu" 4 -\fIDefault\fR: $vardir/clientbucket +\fIDefault\fR: \fB$vardir/clientbucket\fR . .IP "" 0 . @@ -324,7 +327,7 @@ Where FileBucket files are stored locally\. The directory in which client\-side YAML data is stored\. . .IP "\(bu" 4 -\fIDefault\fR: $vardir/client_yaml +\fIDefault\fR: \fB$vardir/client_yaml\fR . .IP "" 0 . @@ -335,7 +338,7 @@ Code to parse directly\. This is essentially only used by \fBpuppet\fR, and shou The main Puppet code directory\. The default for this setting is calculated based on the user\. If the process is running as root or the user that Puppet is supposed to run as, it defaults to a system directory, but if it\'s running as any other user, it defaults to being in the user\'s home directory\. . .IP "\(bu" 4 -\fIDefault\fR: Unix/Linux: /etc/puppetlabs/code \-\- Windows: C:\eProgramData\ePuppetLabs\ecode \-\- Non\-root user: ~/\.puppetlabs/etc/code +\fIDefault\fR: \fBUnix/Linux: /etc/puppetlabs/code \-\- Windows: C:\eProgramData\ePuppetLabs\ecode \-\- Non\-root user: ~/\.puppetlabs/etc/code\fR . .IP "" 0 . @@ -343,7 +346,7 @@ The main Puppet code directory\. The default for this setting is calculated base Whether to use colors when logging to the console\. Valid values are \fBansi\fR (equivalent to \fBtrue\fR), \fBhtml\fR, and \fBfalse\fR, which produces no color\. . .IP "\(bu" 4 -\fIDefault\fR: ansi +\fIDefault\fR: \fBansi\fR . .IP "" 0 . @@ -351,7 +354,7 @@ Whether to use colors when logging to the console\. Valid values are \fBansi\fR The main Puppet configuration directory\. The default for this setting is calculated based on the user\. If the process is running as root or the user that Puppet is supposed to run as, it defaults to a system directory, but if it\'s running as any other user, it defaults to being in the user\'s home directory\. . .IP "\(bu" 4 -\fIDefault\fR: Unix/Linux: /etc/puppetlabs/puppet \-\- Windows: C:\eProgramData\ePuppetLabs\epuppet\eetc \-\- Non\-root user: ~/\.puppetlabs/etc/puppet +\fIDefault\fR: \fBUnix/Linux: /etc/puppetlabs/puppet \-\- Windows: C:\eProgramData\ePuppetLabs\epuppet\eetc \-\- Non\-root user: ~/\.puppetlabs/etc/puppet\fR . .IP "" 0 . @@ -359,7 +362,7 @@ The main Puppet configuration directory\. The default for this setting is calcul The configuration file for the current puppet application\. . .IP "\(bu" 4 -\fIDefault\fR: $confdir/${config_file_name} +\fIDefault\fR: \fB$confdir/${config_file_name}\fR . .IP "" 0 . @@ -367,7 +370,7 @@ The configuration file for the current puppet application\. The name of the puppet config file\. . .IP "\(bu" 4 -\fIDefault\fR: puppet\.conf +\fIDefault\fR: \fBpuppet\.conf\fR . .IP "" 0 . @@ -389,9 +392,10 @@ In general, the duration should be greater than the \fBruninterval\fR\. Setting .P If the agent downloads a new CRL, the agent will use it for subsequent network requests\. If the refresh request fails or if the CRL is unchanged on the server, then the agent run will continue using the local CRL it already has\.This setting can be a time interval in seconds (30 or 30s), minutes (30m), hours (6h), days (2d), or years (5y)\. . -.TP -\fIDefault\fR: - +.IP "\(bu" 4 +\fIDefault\fR: `` +. +.IP "" 0 . .SS "csr_attributes" An optional file containing custom attributes to add to certificate signing requests (CSRs)\. You should ensure that this file does not exist on your CA puppet master; if it does, unwanted certificate extensions may leak into certificates created with the \fBpuppetserver ca generate\fR command\. @@ -406,7 +410,7 @@ Custom attributes can be used by the CA when deciding whether to sign the certif Extension requests will be permanently embedded in the final certificate\. Extension OIDs must be in the "ppRegCertExt" (\fB1\.3\.6\.1\.4\.1\.34380\.1\.1\fR), "ppPrivCertExt" (\fB1\.3\.6\.1\.4\.1\.34380\.1\.2\fR), or "ppAuthCertExt" (\fB1\.3\.6\.1\.4\.1\.34380\.1\.3\fR) OID arcs\. The ppRegCertExt arc is reserved for four of the most common pieces of data to embed: \fBpp_uuid\fR (\fB\.1\fR), \fBpp_instance_id\fR (\fB\.2\fR), \fBpp_image_name\fR (\fB\.3\fR), and \fBpp_preshared_key\fR (\fB\.4\fR) \-\-\- in the YAML file, these can be referred to by their short descriptive names instead of their full OID\. The ppPrivCertExt arc is unregulated, and can be used for site\-specific extensions\. The ppAuthCert arc is reserved for two pieces of data to embed: \fBpp_authorization\fR (\fB\.1\fR) and \fBpp_auth_role\fR (\fB\.13\fR)\. As with ppRegCertExt, in the YAML file, these can be referred to by their short descriptive name instead of their full OID\. . .IP "\(bu" 4 -\fIDefault\fR: $confdir/csr_attributes\.yaml +\fIDefault\fR: \fB$confdir/csr_attributes\.yaml\fR . .IP "" 0 . @@ -414,7 +418,7 @@ Extension requests will be permanently embedded in the final certificate\. Exten Where the CA stores certificate requests\. . .IP "\(bu" 4 -\fIDefault\fR: $cadir/requests +\fIDefault\fR: \fB$cadir/requests\fR . .IP "" 0 . @@ -422,7 +426,7 @@ Where the CA stores certificate requests\. Whether to send the process into the background\. This defaults to true on POSIX systems, and to false on Windows (where Puppet currently cannot daemonize)\. . .IP "\(bu" 4 -\fIDefault\fR: true +\fIDefault\fR: \fBtrue\fR . .IP "" 0 . @@ -430,7 +434,7 @@ Whether to send the process into the background\. This defaults to true on POSIX This setting has been deprecated\. Use of any value other than \'hiera\' should instead be configured in a version 5 hiera\.yaml\. Until this setting is removed, it controls which data binding terminus to use for global automatic data binding (across all environments)\. By default this value is \'hiera\'\. A value of \'none\' turns off the global binding\. . .IP "\(bu" 4 -\fIDefault\fR: hiera +\fIDefault\fR: \fBhiera\fR . .IP "" 0 . @@ -438,7 +442,7 @@ This setting has been deprecated\. Use of any value other than \'hiera\' should The default source for files if no server is given in a uri, e\.g\. puppet:///file\. The default of \fBrest\fR causes the file to be retrieved using the \fBserver\fR setting\. When running \fBapply\fR the default is \fBfile_server\fR, causing requests to be filled locally\. . .IP "\(bu" 4 -\fIDefault\fR: rest +\fIDefault\fR: \fBrest\fR . .IP "" 0 . @@ -452,7 +456,7 @@ This setting\'s value can be an absolute or relative path\. An absolute path wil In either case, the path can point to a single file or to a directory of manifests to be evaluated in alphabetical order\. . .IP "\(bu" 4 -\fIDefault\fR: \./manifests +\fIDefault\fR: \fB\./manifests\fR . .IP "" 0 . @@ -460,7 +464,7 @@ In either case, the path can point to a single file or to a directory of manifes Boolean; whether to generate the default schedule resources\. Setting this to false is useful for keeping external report processors clean of skipped schedule resources\. . .IP "\(bu" 4 -\fIDefault\fR: true +\fIDefault\fR: \fBtrue\fR . .IP "" 0 . @@ -468,7 +472,7 @@ Boolean; whether to generate the default schedule resources\. Setting this to fa The root directory of devices\' $confdir\. . .IP "\(bu" 4 -\fIDefault\fR: $confdir/devices +\fIDefault\fR: \fB$confdir/devices\fR . .IP "" 0 . @@ -476,7 +480,7 @@ The root directory of devices\' $confdir\. Path to the device config file for puppet device\. . .IP "\(bu" 4 -\fIDefault\fR: $confdir/device\.conf +\fIDefault\fR: \fB$confdir/device\.conf\fR . .IP "" 0 . @@ -484,7 +488,7 @@ Path to the device config file for puppet device\. The root directory of devices\' $vardir\. . .IP "\(bu" 4 -\fIDefault\fR: $vardir/devices +\fIDefault\fR: \fB$vardir/devices\fR . .IP "" 0 . @@ -492,7 +496,7 @@ The root directory of devices\' $vardir\. Which diff command to use when printing differences between files\. This setting has no default value on Windows, as standard \fBdiff\fR is not available, but Puppet can use many third\-party diff tools\. . .IP "\(bu" 4 -\fIDefault\fR: diff +\fIDefault\fR: \fBdiff\fR . .IP "" 0 . @@ -500,7 +504,7 @@ Which diff command to use when printing differences between files\. This setting Which arguments to pass to the diff command when printing differences between files\. The command to use can be chosen with the \fBdiff\fR setting\. . .IP "\(bu" 4 -\fIDefault\fR: \-u +\fIDefault\fR: \fB\-u\fR . .IP "" 0 . @@ -508,7 +512,7 @@ Which arguments to pass to the diff command when printing differences between fi Which digest algorithm to use for file resources and the filebucket\. Valid values are sha256, sha384, sha512, sha224, md5\. Default is sha256\. . .IP "\(bu" 4 -\fIDefault\fR: sha256 +\fIDefault\fR: \fBsha256\fR . .IP "" 0 . @@ -516,7 +520,7 @@ Which digest algorithm to use for file resources and the filebucket\. Valid valu If true, turns off all translations of Puppet and module log messages, which affects error, warning, and info log messages, as well as any translations in the report and CLI\. . .IP "\(bu" 4 -\fIDefault\fR: true +\fIDefault\fR: \fBtrue\fR . .IP "" 0 . @@ -527,7 +531,7 @@ Whether to disallow an environment\-specific main manifest\. When set to \fBtrue This setting requires \fBdefault_manifest\fR to be set to an absolute path\. . .IP "\(bu" 4 -\fIDefault\fR: false +\fIDefault\fR: \fBfalse\fR . .IP "" 0 . @@ -550,7 +554,7 @@ Valid values for this setting are: \fBundefined_resources\fR \-\-\- disables warnings about non existing resources\. . .IP "\(bu" 4 -\fIDefault\fR: [] +\fIDefault\fR: \fB[]\fR . .IP "" 0 . @@ -561,7 +565,7 @@ A comma\-separated list of alternate DNS names for Puppet Server\. These are ext In order to handle agent requests at a given hostname (like "puppet\.example\.com"), Puppet Server needs a certificate that proves it\'s allowed to use that name; if a server shows a certificate that doesn\'t include its hostname, Puppet agents will refuse to trust it\. If you use a single hostname for Puppet traffic but load\-balance it to multiple Puppet Servers, each of those servers needs to include the official hostname in its list of extra names\. . .P -\fBNote:\fR The list of alternate names is locked in when the server\'s certificate is signed\. If you need to change the list later, you can\'t just change this setting; you also need to regenerate the certificate\. For more information on that process, see the [cert regen docs] (https://puppet\.com/docs/puppet/latest/ssl_regenerate_certificates\.html)\. +\fBNote:\fR The list of alternate names is locked in when the server\'s certificate is signed\. If you need to change the list later, you can\'t just change this setting; you also need to regenerate the certificate\. For more information on that process, see the cert regen docs \fIhttps://puppet\.com/docs/puppet/latest/ssl_regenerate_certificates\.html\fR\. . .P To see all the alternate names your servers are using, log into your CA server and run \fBpuppetserver ca list \-\-all\fR, then check the output for \fB(alt names: \.\.\.)\fR\. Most agent nodes should NOT have alternate names; the only certs that should have them are Puppet Server nodes that you want other agents to trust\. @@ -570,7 +574,7 @@ To see all the alternate names your servers are using, log into your CA server a Whether to document all resources when using \fBpuppet doc\fR to generate manifest documentation\. . .IP "\(bu" 4 -\fIDefault\fR: false +\fIDefault\fR: \fBfalse\fR . .IP "" 0 . @@ -587,16 +591,17 @@ When defined in the \fB[user]\fR section, the environment refers to the path tha Given that the context and effects vary depending on the config section \fIhttps://puppet\.com/docs/puppet/latest/config_file_main\.html#config\-sections\fR in which the \fBenvironment\fR setting is defined, do not set it globally\. . .IP "\(bu" 4 -\fIDefault\fR: production +\fIDefault\fR: \fBproduction\fR . .IP "" 0 . .SS "environment_data_provider" The name of a registered environment data provider used when obtaining environment specific data\. The three built in and registered providers are \'none\' (no data), \'function\' (data obtained by calling the function \'environment::data()\') and \'hiera\' (data obtained using a data provider configured using a hiera\.yaml file in root of the environment)\. Other environment data providers may be registered in modules on the module path\. For such custom data providers see the respective module documentation\. This setting is deprecated\. . -.TP -\fIDefault\fR: - +.IP "\(bu" 4 +\fIDefault\fR: `` +. +.IP "" 0 . .SS "environment_timeout" How long the Puppet server should cache data it loads from an environment\. @@ -619,7 +624,7 @@ Setting this to a number that will keep your most actively used environments cac Once you set \fBenvironment_timeout\fR to a non\-zero value, you need to tell Puppet server to read new code from disk using the \fBenvironment\-cache\fR API endpoint after you deploy new code\. See the docs for the Puppet Server administrative API \fIhttps://puppet\.com/docs/puppetserver/latest/admin\-api/v1/environment\-cache\.html\fR\. . .IP "\(bu" 4 -\fIDefault\fR: 0 +\fIDefault\fR: \fB0\fR . .IP "" 0 . @@ -630,7 +635,7 @@ A search path for directory environments, as a list of directories separated by This setting must have a value set to enable \fBdirectory environments\.\fR The recommended value is \fB$codedir/environments\fR\. For more details, see \fIhttps://puppet\.com/docs/puppet/latest/environments_about\.html\fR . .IP "\(bu" 4 -\fIDefault\fR: $codedir/environments +\fIDefault\fR: \fB$codedir/environments\fR . .IP "" 0 . @@ -638,7 +643,7 @@ This setting must have a value set to enable \fBdirectory environments\.\fR The Whether each resource should log when it is being evaluated\. This allows you to interactively see exactly what is being done\. . .IP "\(bu" 4 -\fIDefault\fR: false +\fIDefault\fR: \fBfalse\fR . .IP "" 0 . @@ -680,7 +685,7 @@ Generally, an ENC script makes requests to an external data source\. For more info, see the ENC documentation \fIhttps://puppet\.com/docs/puppet/latest/nodes_external\.html\fR\. . .IP "\(bu" 4 -\fIDefault\fR: none +\fIDefault\fR: \fBnone\fR . .IP "" 0 . @@ -688,7 +693,7 @@ For more info, see the ENC documentation \fIhttps://puppet\.com/docs/puppet/late Where Puppet should look for facts\. Multiple directories should be separated by the system path separator character\. (The POSIX path separator is \':\', and the Windows path separator is \';\'\.) . .IP "\(bu" 4 -\fIDefault\fR: $vardir/lib/facter:$vardir/facts +\fIDefault\fR: \fB$vardir/lib/facter:$vardir/facts\fR . .IP "" 0 . @@ -696,7 +701,7 @@ Where Puppet should look for facts\. Multiple directories should be separated by The node facts terminus\. . .IP "\(bu" 4 -\fIDefault\fR: facter +\fIDefault\fR: \fBfacter\fR . .IP "" 0 . @@ -704,7 +709,7 @@ The node facts terminus\. Where the fileserver configuration is stored\. . .IP "\(bu" 4 -\fIDefault\fR: $confdir/fileserver\.conf +\fIDefault\fR: \fB$confdir/fileserver\.conf\fR . .IP "" 0 . @@ -712,22 +717,23 @@ Where the fileserver configuration is stored\. The minimum time to wait between checking for updates in configuration files\. This timeout determines how quickly Puppet checks whether a file (such as manifests or puppet\.conf) has changed on disk\. The default will change in a future release to be \'unlimited\', requiring a reload of the Puppet service to pick up changes to its internal configuration\. Currently we do not accept a value of \'unlimited\'\. To reparse files within an environment in Puppet Server please use the environment_cache endpoint . .IP "\(bu" 4 -\fIDefault\fR: 15s +\fIDefault\fR: \fB15s\fR . .IP "" 0 . .SS "forge_authorization" The authorization key to connect to the Puppet Forge\. Leave blank for unauthorized or license based connections . -.TP -\fIDefault\fR: - +.IP "\(bu" 4 +\fIDefault\fR: `` +. +.IP "" 0 . .SS "freeze_main" Freezes the \'main\' class, disallowing any code to be added to it\. This essentially means that you can\'t have any code outside of a node, class, or definition other than in the site manifest\. . .IP "\(bu" 4 -\fIDefault\fR: false +\fIDefault\fR: \fBfalse\fR . .IP "" 0 . @@ -735,7 +741,7 @@ Freezes the \'main\' class, disallowing any code to be added to it\. This essent When true, causes Puppet applications to print an example config file to stdout and exit\. The example will include descriptions of each setting, and the current (or default) value of each setting, incorporating any settings overridden on the CLI (with the exception of \fBgenconfig\fR itself)\. This setting only makes sense when specified on the command line as \fB\-\-genconfig\fR\. . .IP "\(bu" 4 -\fIDefault\fR: false +\fIDefault\fR: \fBfalse\fR . .IP "" 0 . @@ -743,7 +749,7 @@ When true, causes Puppet applications to print an example config file to stdout Whether to just print a manifest to stdout and exit\. Only makes sense when specified on the command line as \fB\-\-genmanifest\fR\. Takes into account arguments specified on the CLI\. . .IP "\(bu" 4 -\fIDefault\fR: false +\fIDefault\fR: \fBfalse\fR . .IP "" 0 . @@ -760,7 +766,7 @@ The \fBgraphdir\fR setting determines where Puppet will save graphs\. Note that See your graphing software\'s documentation for details on opening \.dot files\. If you\'re using GraphViz\'s \fBdot\fR command, you can do a quick PNG render with \fBdot \-Tpng \-o \fR\. . .IP "\(bu" 4 -\fIDefault\fR: false +\fIDefault\fR: \fBfalse\fR . .IP "" 0 . @@ -768,7 +774,7 @@ See your graphing software\'s documentation for details on opening \.dot files\. Where to save \.dot\-format graphs (when the \fBgraph\fR setting is enabled)\. . .IP "\(bu" 4 -\fIDefault\fR: $statedir/graphs +\fIDefault\fR: \fB$statedir/graphs\fR . .IP "" 0 . @@ -776,7 +782,7 @@ Where to save \.dot\-format graphs (when the \fBgraph\fR setting is enabled)\. The group Puppet Server will run as\. Used to ensure the agent side processes (agent, apply, etc) create files and directories readable by Puppet Server when necessary\. . .IP "\(bu" 4 -\fIDefault\fR: puppet +\fIDefault\fR: \fBpuppet\fR . .IP "" 0 . @@ -784,7 +790,7 @@ The group Puppet Server will run as\. Used to ensure the agent side processes (a The hiera configuration file\. Puppet only reads this file on startup, so you must restart the puppet server every time you edit it\. . .IP "\(bu" 4 -\fIDefault\fR: $confdir/hiera\.yaml\. However, for backwards compatibility, if a file exists at $codedir/hiera\.yaml, Puppet uses that instead\. +\fIDefault\fR: \fB$confdir/hiera\.yaml\. However, for backwards compatibility, if a file exists at $codedir/hiera\.yaml, Puppet uses that instead\.\fR . .IP "" 0 . @@ -792,7 +798,7 @@ The hiera configuration file\. Puppet only reads this file on startup, so you mu Where individual hosts store and look for their certificates\. . .IP "\(bu" 4 -\fIDefault\fR: $certdir/$certname\.pem +\fIDefault\fR: \fB$certdir/$certname\.pem\fR . .IP "" 0 . @@ -800,7 +806,7 @@ Where individual hosts store and look for their certificates\. Where the host\'s certificate revocation list can be found\. This is distinct from the certificate authority\'s CRL\. . .IP "\(bu" 4 -\fIDefault\fR: $ssldir/crl\.pem +\fIDefault\fR: \fB$ssldir/crl\.pem\fR . .IP "" 0 . @@ -808,7 +814,7 @@ Where the host\'s certificate revocation list can be found\. This is distinct fr Where individual hosts store their certificate request (CSR) while waiting for the CA to issue their certificate\. . .IP "\(bu" 4 -\fIDefault\fR: $requestdir/$certname\.pem +\fIDefault\fR: \fB$requestdir/$certname\.pem\fR . .IP "" 0 . @@ -816,7 +822,7 @@ Where individual hosts store their certificate request (CSR) while waiting for t Where individual hosts store and look for their private key\. . .IP "\(bu" 4 -\fIDefault\fR: $privatekeydir/$certname\.pem +\fIDefault\fR: \fB$privatekeydir/$certname\.pem\fR . .IP "" 0 . @@ -824,7 +830,7 @@ Where individual hosts store and look for their private key\. Where individual hosts store and look for their public key\. . .IP "\(bu" 4 -\fIDefault\fR: $publickeydir/$certname\.pem +\fIDefault\fR: \fB$publickeydir/$certname\.pem\fR . .IP "" 0 . @@ -832,7 +838,7 @@ Where individual hosts store and look for their public key\. The maximum amount of time to wait when establishing an HTTP connection\. The default value is 2 minutes\. This setting can be a time interval in seconds (30 or 30s), minutes (30m), hours (6h), days (2d), or years (5y)\. . .IP "\(bu" 4 -\fIDefault\fR: 2m +\fIDefault\fR: \fB2m\fR . .IP "" 0 . @@ -840,7 +846,7 @@ The maximum amount of time to wait when establishing an HTTP connection\. The de Whether to write HTTP request and responses to stderr\. This should never be used in a production environment\. . .IP "\(bu" 4 -\fIDefault\fR: false +\fIDefault\fR: \fBfalse\fR . .IP "" 0 . @@ -848,7 +854,7 @@ Whether to write HTTP request and responses to stderr\. This should never be use The list of extra headers that will be sent with http requests to the master\. The header definition consists of a name and a value separated by a colon\. . .IP "\(bu" 4 -\fIDefault\fR: [] +\fIDefault\fR: \fB[]\fR . .IP "" 0 . @@ -856,7 +862,7 @@ The list of extra headers that will be sent with http requests to the master\. T The maximum amount of time a persistent HTTP connection can remain idle in the connection pool, before it is closed\. This timeout should be shorter than the keepalive timeout used on the HTTP server, e\.g\. Apache KeepAliveTimeout directive\. This setting can be a time interval in seconds (30 or 30s), minutes (30m), hours (6h), days (2d), or years (5y)\. . .IP "\(bu" 4 -\fIDefault\fR: 4s +\fIDefault\fR: \fB4s\fR . .IP "" 0 . @@ -864,7 +870,7 @@ The maximum amount of time a persistent HTTP connection can remain idle in the c The HTTP proxy host to use for outgoing connections\. The proxy will be bypassed if the server\'s hostname matches the NO_PROXY environment variable or \fBno_proxy\fR setting\. Note: You may need to use a FQDN for the server hostname when using a proxy\. Environment variable http_proxy or HTTP_PROXY will override this value\. . .IP "\(bu" 4 -\fIDefault\fR: none +\fIDefault\fR: \fBnone\fR . .IP "" 0 . @@ -875,7 +881,7 @@ The password for the user of an authenticated HTTP proxy\. Requires the \fBhttp_ Note that passwords must be valid when used as part of a URL\. If a password contains any characters with special meanings in URLs (as specified by RFC 3986 section 2\.2), they must be URL\-encoded\. (For example, \fB#\fR would become \fB%23\fR\.) . .IP "\(bu" 4 -\fIDefault\fR: none +\fIDefault\fR: \fBnone\fR . .IP "" 0 . @@ -883,7 +889,7 @@ Note that passwords must be valid when used as part of a URL\. If a password con The HTTP proxy port to use for outgoing connections . .IP "\(bu" 4 -\fIDefault\fR: 3128 +\fIDefault\fR: \fB3128\fR . .IP "" 0 . @@ -891,7 +897,7 @@ The HTTP proxy port to use for outgoing connections The user name for an authenticated HTTP proxy\. Requires the \fBhttp_proxy_host\fR setting\. . .IP "\(bu" 4 -\fIDefault\fR: none +\fIDefault\fR: \fBnone\fR . .IP "" 0 . @@ -899,7 +905,7 @@ The user name for an authenticated HTTP proxy\. Requires the \fBhttp_proxy_host\ The time to wait for data to be read from an HTTP connection\. If nothing is read after the elapsed interval then the connection will be closed\. The default value is 10 minutes\. This setting can be a time interval in seconds (30 or 30s), minutes (30m), hours (6h), days (2d), or years (5y)\. . .IP "\(bu" 4 -\fIDefault\fR: 10m +\fIDefault\fR: \fB10m\fR . .IP "" 0 . @@ -907,7 +913,7 @@ The time to wait for data to be read from an HTTP connection\. If nothing is rea The HTTP User\-Agent string to send when making network requests\. . .IP "\(bu" 4 -\fIDefault\fR: Puppet/7\.7\.0 Ruby/2\.5\.1\-p57 (x86_64\-linux) +\fIDefault\fR: \fBPuppet/7\.7\.0 Ruby/2\.5\.1\-p57 (x86_64\-linux)\fR . .IP "" 0 . @@ -915,7 +921,7 @@ The HTTP User\-Agent string to send when making network requests\. Whether the puppet run should ignore errors during pluginsync\. If the setting is false and there are errors during pluginsync, then the agent will abort the run and submit a report containing information about the failed run\. . .IP "\(bu" 4 -\fIDefault\fR: false +\fIDefault\fR: \fBfalse\fR . .IP "" 0 . @@ -923,7 +929,7 @@ Whether the puppet run should ignore errors during pluginsync\. If the setting i Skip searching for classes and definitions that were missing during a prior compilation\. The list of missing objects is maintained per\-environment and persists until the environment is cleared or the master is restarted\. . .IP "\(bu" 4 -\fIDefault\fR: false +\fIDefault\fR: \fBfalse\fR . .IP "" 0 . @@ -931,7 +937,7 @@ Skip searching for classes and definitions that were missing during a prior comp Boolean; whether puppet agent should ignore schedules\. This is useful for initial puppet agent runs\. . .IP "\(bu" 4 -\fIDefault\fR: false +\fIDefault\fR: \fBfalse\fR . .IP "" 0 . @@ -939,7 +945,7 @@ Boolean; whether puppet agent should ignore schedules\. This is useful for initi The type of private key\. Valid values are \fBrsa\fR and \fBec\fR\. Default is \fBrsa\fR\. . .IP "\(bu" 4 -\fIDefault\fR: rsa +\fIDefault\fR: \fBrsa\fR . .IP "" 0 . @@ -947,7 +953,7 @@ The type of private key\. Valid values are \fBrsa\fR and \fBec\fR\. Default is \ The bit length of keys\. . .IP "\(bu" 4 -\fIDefault\fR: 4096 +\fIDefault\fR: \fB4096\fR . .IP "" 0 . @@ -955,7 +961,7 @@ The bit length of keys\. Where puppet agent stores the last run report summary in yaml format\. . .IP "\(bu" 4 -\fIDefault\fR: $publicdir/last_run_summary\.yaml +\fIDefault\fR: \fB$publicdir/last_run_summary\.yaml\fR . .IP "" 0 . @@ -963,7 +969,7 @@ Where puppet agent stores the last run report summary in yaml format\. Where Puppet Agent stores the last run report, by default, in yaml format\. The format of the report can be changed by setting the \fBcache\fR key of the \fBreport\fR terminus in the routes\.yaml \fIhttps://puppet\.com/docs/puppet/latest/config_file_routes\.html\fR file\. To avoid mismatches between content and file extension, this setting needs to be manually updated to reflect the terminus changes\. . .IP "\(bu" 4 -\fIDefault\fR: $statedir/last_run_report\.yaml +\fIDefault\fR: \fB$statedir/last_run_report\.yaml\fR . .IP "" 0 . @@ -971,7 +977,7 @@ Where Puppet Agent stores the last run report, by default, in yaml format\. The The LDAP attributes to include when querying LDAP for nodes\. All returned attributes are set as variables in the top\-level scope\. Multiple values should be comma\-separated\. The value \'all\' returns all attributes\. . .IP "\(bu" 4 -\fIDefault\fR: all +\fIDefault\fR: \fBall\fR . .IP "" 0 . @@ -982,7 +988,7 @@ The search base for LDAP searches\. It\'s impossible to provide a meaningful def The LDAP attributes to use to define Puppet classes\. Values should be comma\-separated\. . .IP "\(bu" 4 -\fIDefault\fR: puppetclass +\fIDefault\fR: \fBpuppetclass\fR . .IP "" 0 . @@ -990,7 +996,7 @@ The LDAP attributes to use to define Puppet classes\. Values should be comma\-se The attribute to use to define the parent node\. . .IP "\(bu" 4 -\fIDefault\fR: parentnode +\fIDefault\fR: \fBparentnode\fR . .IP "" 0 . @@ -1001,7 +1007,7 @@ The password to use to connect to LDAP\. The LDAP port\. . .IP "\(bu" 4 -\fIDefault\fR: 389 +\fIDefault\fR: \fB389\fR . .IP "" 0 . @@ -1009,7 +1015,7 @@ The LDAP port\. The LDAP server\. . .IP "\(bu" 4 -\fIDefault\fR: ldap +\fIDefault\fR: \fBldap\fR . .IP "" 0 . @@ -1017,7 +1023,7 @@ The LDAP server\. Whether SSL should be used when searching for nodes\. Defaults to false because SSL usually requires certificates to be set up on the client side\. . .IP "\(bu" 4 -\fIDefault\fR: false +\fIDefault\fR: \fBfalse\fR . .IP "" 0 . @@ -1025,7 +1031,7 @@ Whether SSL should be used when searching for nodes\. Defaults to false because The LDAP attributes that should be stacked to arrays by adding the values in all hierarchy elements of the tree\. Values should be comma\-separated\. . .IP "\(bu" 4 -\fIDefault\fR: puppetvar +\fIDefault\fR: \fBpuppetvar\fR . .IP "" 0 . @@ -1033,7 +1039,7 @@ The LDAP attributes that should be stacked to arrays by adding the values in all The search string used to find an LDAP node\. . .IP "\(bu" 4 -\fIDefault\fR: (&(objectclass=puppetClient)(cn=%s)) +\fIDefault\fR: \fB(&(objectclass=puppetClient)(cn=%s))\fR . .IP "" 0 . @@ -1041,7 +1047,7 @@ The search string used to find an LDAP node\. Whether TLS should be used when searching for nodes\. Defaults to false because TLS usually requires certificates to be set up on the client side\. . .IP "\(bu" 4 -\fIDefault\fR: false +\fIDefault\fR: \fBfalse\fR . .IP "" 0 . @@ -1052,7 +1058,7 @@ The user to use to connect to LDAP\. Must be specified as a full DN\. An extra search path for Puppet\. This is only useful for those files that Puppet will load on demand, and is only guaranteed to work for those cases\. In fact, the autoload mechanism is responsible for making sure this directory is in Ruby\'s search path . .IP "\(bu" 4 -\fIDefault\fR: $vardir/lib +\fIDefault\fR: \fB$vardir/lib\fR . .IP "" 0 . @@ -1060,7 +1066,7 @@ An extra search path for Puppet\. This is only useful for those files that Puppe Where each client stores the CA certificate\. . .IP "\(bu" 4 -\fIDefault\fR: $certdir/ca\.pem +\fIDefault\fR: \fB$certdir/ca\.pem\fR . .IP "" 0 . @@ -1068,7 +1074,7 @@ Where each client stores the CA certificate\. Where Puppet should store translation files that it pulls down from the central server\. . .IP "\(bu" 4 -\fIDefault\fR: $vardir/locales +\fIDefault\fR: \fB$vardir/locales\fR . .IP "" 0 . @@ -1076,7 +1082,7 @@ Where Puppet should store translation files that it pulls down from the central From where to retrieve translation files\. The standard Puppet \fBfile\fR type is used for retrieval, so anything that is a valid file source can be used here\. . .IP "\(bu" 4 -\fIDefault\fR: puppet:///locales +\fIDefault\fR: \fBpuppet:///locales\fR . .IP "" 0 . @@ -1108,22 +1114,23 @@ emerg crit . .IP "\(bu" 4 -\fIDefault\fR: notice +\fIDefault\fR: \fBnotice\fR . .IP "" 0 . .SS "logdest" Where to send log messages\. Choose between \'syslog\' (the POSIX syslog service), \'eventlog\' (the Windows Event Log), \'console\', or the path to a log file\. Multiple destinations can be set using a comma separated list (eg: \fB/path/file1,console,/path/file2\fR) . -.TP -\fIDefault\fR: - +.IP "\(bu" 4 +\fIDefault\fR: `` +. +.IP "" 0 . .SS "logdir" The directory in which to store log files . .IP "\(bu" 4 -\fIDefault\fR: Unix/Linux: /var/log/puppetlabs/puppet \-\- Windows: C:\eProgramData\ePuppetLabs\epuppet\evar\elog \-\- Non\-root user: ~/\.puppetlabs/var/log +\fIDefault\fR: \fBUnix/Linux: /var/log/puppetlabs/puppet \-\- Windows: C:\eProgramData\ePuppetLabs\epuppet\evar\elog \-\- Non\-root user: ~/\.puppetlabs/var/log\fR . .IP "" 0 . @@ -1131,7 +1138,7 @@ The directory in which to store log files Whether Puppet should manage the owner, group, and mode of files it uses internally\. \fBNote\fR: For Windows agents, the default is \fBfalse\fR for versions 4\.10\.13 and greater, versions 5\.5\.6 and greater, and versions 6\.0 and greater\. . .IP "\(bu" 4 -\fIDefault\fR: true +\fIDefault\fR: \fBtrue\fR . .IP "" 0 . @@ -1141,15 +1148,16 @@ The entry\-point manifest for puppet master\. This can be one file or a director .P Setting a global value for \fBmanifest\fR in puppet\.conf is not allowed (but it can be overridden from the commandline)\. Please use directory environments instead\. If you need to use something other than the environment\'s \fBmanifests\fR directory as the main manifest, you can set \fBmanifest\fR in environment\.conf\. For more info, see \fIhttps://puppet\.com/docs/puppet/latest/environments_about\.html\fR . -.TP -\fIDefault\fR: - +.IP "\(bu" 4 +\fIDefault\fR: `` +. +.IP "" 0 . .SS "masterport" The default port puppet subcommands use to communicate with Puppet Server\. (eg \fBpuppet facts upload\fR, \fBpuppet agent\fR)\. May be overridden by more specific settings (see \fBca_port\fR, \fBreport_port\fR)\. . .IP "\(bu" 4 -\fIDefault\fR: 8140 +\fIDefault\fR: \fB8140\fR . .IP "" 0 . @@ -1157,7 +1165,7 @@ The default port puppet subcommands use to communicate with Puppet Server\. (eg Sets the max number of logged/displayed parser validation deprecation warnings in case multiple deprecation warnings have been detected\. A value of 0 blocks the logging of deprecation warnings\. The count is per manifest\. . .IP "\(bu" 4 -\fIDefault\fR: 10 +\fIDefault\fR: \fB10\fR . .IP "" 0 . @@ -1165,7 +1173,7 @@ Sets the max number of logged/displayed parser validation deprecation warnings i Sets the max number of logged/displayed parser validation errors in case multiple errors have been detected\. A value of 0 is the same as a value of 1; a minimum of one error is always raised\. The count is per manifest\. . .IP "\(bu" 4 -\fIDefault\fR: 10 +\fIDefault\fR: \fB10\fR . .IP "" 0 . @@ -1173,7 +1181,7 @@ Sets the max number of logged/displayed parser validation errors in case multipl Sets the max number of logged/displayed parser validation warnings in case multiple warnings have been detected\. A value of 0 blocks logging of warnings\. The count is per manifest\. . .IP "\(bu" 4 -\fIDefault\fR: 10 +\fIDefault\fR: \fB10\fR . .IP "" 0 . @@ -1181,7 +1189,7 @@ Sets the max number of logged/displayed parser validation warnings in case multi The maximum allowed UID\. Some platforms use negative UIDs but then ship with tools that do not know how to handle signed ints, so the UIDs show up as huge numbers that can then not be fed back into the system\. This is a hackish way to fail in a slightly more useful way when that happens\. . .IP "\(bu" 4 -\fIDefault\fR: 4294967290 +\fIDefault\fR: \fB4294967290\fR . .IP "" 0 . @@ -1189,7 +1197,7 @@ The maximum allowed UID\. Some platforms use negative UIDs but then ship with to The maximum amount of time the Puppet agent should wait for its certificate request to be signed\. A value of \fBunlimited\fR will cause puppet agent to ask for a signed certificate indefinitely\. This setting can be a time interval in seconds (30 or 30s), minutes (30m), hours (6h), days (2d), or years (5y)\. . .IP "\(bu" 4 -\fIDefault\fR: unlimited +\fIDefault\fR: \fBunlimited\fR . .IP "" 0 . @@ -1197,7 +1205,7 @@ The maximum amount of time the Puppet agent should wait for its certificate requ The maximum amount of time the puppet agent should wait for an already running puppet agent to finish before starting a new one\. This is set by default to 1 minute\. A value of \fBunlimited\fR will cause puppet agent to wait indefinitely\. This setting can be a time interval in seconds (30 or 30s), minutes (30m), hours (6h), days (2d), or years (5y)\. . .IP "\(bu" 4 -\fIDefault\fR: 1m +\fIDefault\fR: \fB1m\fR . .IP "" 0 . @@ -1211,7 +1219,7 @@ When a class has a failed dependency, every resource in the class generates a no If true, all messages caused by a class dependency failure are merged into one message associated with the class\. . .IP "\(bu" 4 -\fIDefault\fR: false +\fIDefault\fR: \fBfalse\fR . .IP "" 0 . @@ -1219,22 +1227,23 @@ If true, all messages caused by a class dependency failure are merged into one m Whether to create the necessary user and group that puppet agent will run as\. . .IP "\(bu" 4 -\fIDefault\fR: false +\fIDefault\fR: \fBfalse\fR . .IP "" 0 . .SS "module_groups" Extra module groups to request from the Puppet Forge\. This is an internal setting, and users should never change it\. . -.TP -\fIDefault\fR: - +.IP "\(bu" 4 +\fIDefault\fR: `` +. +.IP "" 0 . .SS "module_repository" The module repository . .IP "\(bu" 4 -\fIDefault\fR: https://forgeapi\.puppet\.com +\fIDefault\fR: \fBhttps://forgeapi\.puppet\.com\fR . .IP "" 0 . @@ -1242,7 +1251,7 @@ The module repository The directory into which module tool data is stored . .IP "\(bu" 4 -\fIDefault\fR: $vardir/puppet\-module +\fIDefault\fR: \fB$vardir/puppet\-module\fR . .IP "" 0 . @@ -1255,15 +1264,16 @@ Setting a global value for \fBmodulepath\fR in puppet\.conf is not allowed (but .SS "name" The name of the application, if we are running as one\. The default is essentially $0 without the path or \fB\.rb\fR\. . -.TP -\fIDefault\fR: - +.IP "\(bu" 4 +\fIDefault\fR: `` +. +.IP "" 0 . .SS "named_curve" The short name for the EC curve used to generate the EC private key\. Valid values must be one of the curves in \fBOpenSSL::PKey::EC\.builtin_curves\fR\. Default is \fBprime256v1\fR\. . .IP "\(bu" 4 -\fIDefault\fR: prime256v1 +\fIDefault\fR: \fBprime256v1\fR . .IP "" 0 . @@ -1271,16 +1281,17 @@ The short name for the EC curve used to generate the EC private key\. Valid valu List of host or domain names that should not go through \fBhttp_proxy_host\fR\. Environment variable no_proxy or NO_PROXY will override this value\. Names can be specified as an FQDN \fBhost\.example\.com\fR, wildcard \fB*\.example\.com\fR, dotted domain \fB\.example\.com\fR, or suffix \fBexample\.com\fR\. . .IP "\(bu" 4 -\fIDefault\fR: localhost, 127\.0\.0\.1 +\fIDefault\fR: \fBlocalhost, 127\.0\.0\.1\fR . .IP "" 0 . .SS "node_cache_terminus" How to store cached nodes\. Valid values are (none), \'json\', \'msgpack\', or \'yaml\'\. . -.TP -\fIDefault\fR: - +.IP "\(bu" 4 +\fIDefault\fR: `` +. +.IP "" 0 . .SS "node_name_fact" The fact name used to determine the node name used for all requests the agent makes to the master\. WARNING: This setting is mutually exclusive with node_name_value\. Changing this setting also requires changes to Puppet Server\'s default auth\.conf \fIhttps://puppet\.com/docs/puppetserver/latest/config_file_auth\.html\fR\. @@ -1289,7 +1300,7 @@ The fact name used to determine the node name used for all requests the agent ma The explicit value used for the node name for all requests the agent makes to the master\. WARNING: This setting is mutually exclusive with node_name_fact\. Changing this setting also requires changes to Puppet Server\'s default auth\.conf \fIhttps://puppet\.com/docs/puppetserver/latest/config_file_auth\.html\fR\. . .IP "\(bu" 4 -\fIDefault\fR: $certname +\fIDefault\fR: \fB$certname\fR . .IP "" 0 . @@ -1323,7 +1334,7 @@ The three main node data plugins are: \fBclassifier\fR (formerly \fBconsole\fR) \-\-\- Specific to Puppet Enterprise\. Uses the PE console for node data\." . .IP "\(bu" 4 -\fIDefault\fR: plain +\fIDefault\fR: \fBplain\fR . .IP "" 0 . @@ -1337,7 +1348,7 @@ When running in noop mode, Puppet will check whether each resource is in sync, l \fBImportant note:\fR The \fBnoop\fR metaparameter \fIhttps://puppet\.com/docs/puppet/latest/metaparameter\.html#noop\fR allows you to apply individual resources in noop mode, and will override the global value of the \fBnoop\fR setting\. This means a resource with \fBnoop => false\fR \fIwill\fR be changed if necessary, even when running puppet agent with \fBnoop = true\fR or \fB\-\-noop\fR\. (Conversely, a resource with \fBnoop => true\fR will only be simulated, even when noop mode is globally disabled\.) . .IP "\(bu" 4 -\fIDefault\fR: false +\fIDefault\fR: \fBfalse\fR . .IP "" 0 . @@ -1345,7 +1356,7 @@ When running in noop mode, Puppet will check whether each resource is in sync, l Perform one configuration run and exit, rather than spawning a long\-running daemon\. This is useful for interactively running puppet agent, or running puppet agent from cron\. . .IP "\(bu" 4 -\fIDefault\fR: false +\fIDefault\fR: \fBfalse\fR . .IP "" 0 . @@ -1353,7 +1364,7 @@ Perform one configuration run and exit, rather than spawning a long\-running dae Where puppet agent stores the password for its private key\. Generally unused\. . .IP "\(bu" 4 -\fIDefault\fR: $privatedir/password +\fIDefault\fR: \fB$privatedir/password\fR . .IP "" 0 . @@ -1364,7 +1375,7 @@ The shell search path\. Defaults to whatever is inherited from the parent proces This setting can only be set in the \fB[main]\fR section of puppet\.conf; it cannot be set in \fB[server]\fR, \fB[agent]\fR, or an environment config section\. . .IP "\(bu" 4 -\fIDefault\fR: none +\fIDefault\fR: \fBnone\fR . .IP "" 0 . @@ -1372,7 +1383,7 @@ This setting can only be set in the \fB[main]\fR section of puppet\.conf; it can The file containing the PID of a running process\. This file is intended to be used by service management frameworks and monitoring systems to determine if a puppet process is still in the process table\. . .IP "\(bu" 4 -\fIDefault\fR: $rundir/${run_mode}\.pid +\fIDefault\fR: \fB$rundir/${run_mode}\.pid\fR . .IP "" 0 . @@ -1380,7 +1391,7 @@ The file containing the PID of a running process\. This file is intended to be u Where Puppet should store plugins that it pulls down from the central server\. . .IP "\(bu" 4 -\fIDefault\fR: $libdir +\fIDefault\fR: \fB$libdir\fR . .IP "" 0 . @@ -1388,7 +1399,7 @@ Where Puppet should store plugins that it pulls down from the central server\. Where Puppet should store external facts that are being handled by pluginsync . .IP "\(bu" 4 -\fIDefault\fR: $vardir/facts\.d +\fIDefault\fR: \fB$vardir/facts\.d\fR . .IP "" 0 . @@ -1396,7 +1407,7 @@ Where Puppet should store external facts that are being handled by pluginsync Where to retrieve external facts for pluginsync . .IP "\(bu" 4 -\fIDefault\fR: puppet:///pluginfacts +\fIDefault\fR: \fBpuppet:///pluginfacts\fR . .IP "" 0 . @@ -1404,7 +1415,7 @@ Where to retrieve external facts for pluginsync What files to ignore when pulling down plugins\. . .IP "\(bu" 4 -\fIDefault\fR: \.svn CVS \.git \.hg +\fIDefault\fR: \fB\.svn CVS \.git \.hg\fR . .IP "" 0 . @@ -1412,7 +1423,7 @@ What files to ignore when pulling down plugins\. From where to retrieve plugins\. The standard Puppet \fBfile\fR type is used for retrieval, so anything that is a valid file source can be used here\. . .IP "\(bu" 4 -\fIDefault\fR: puppet:///plugins +\fIDefault\fR: \fBpuppet:///plugins\fR . .IP "" 0 . @@ -1420,7 +1431,7 @@ From where to retrieve plugins\. The standard Puppet \fBfile\fR type is used for Whether plugins should be synced with the central server\. This setting is deprecated\. . .IP "\(bu" 4 -\fIDefault\fR: true +\fIDefault\fR: \fBtrue\fR . .IP "" 0 . @@ -1431,7 +1442,7 @@ A command to run after every agent run\. If this command returns a non\-zero ret The preferred means of serializing ruby instances for passing over the wire\. This won\'t guarantee that all instances will be serialized using this method, since not all classes can be guaranteed to support this format, but it will be used for all classes that support it\. . .IP "\(bu" 4 -\fIDefault\fR: json +\fIDefault\fR: \fBjson\fR . .IP "" 0 . @@ -1442,22 +1453,23 @@ A command to run before every agent run\. If this command returns a non\-zero re The directory where catalog previews per node are generated\. . .IP "\(bu" 4 -\fIDefault\fR: $vardir/preview +\fIDefault\fR: \fB$vardir/preview\fR . .IP "" 0 . .SS "priority" The scheduling priority of the process\. Valid values are \'high\', \'normal\', \'low\', or \'idle\', which are mapped to platform\-specific values\. The priority can also be specified as an integer value and will be passed as is, e\.g\. \-5\. Puppet must be running as a privileged user in order to increase scheduling priority\. . -.TP -\fIDefault\fR: - +.IP "\(bu" 4 +\fIDefault\fR: `` +. +.IP "" 0 . .SS "privatedir" Where the client stores private certificate information\. . .IP "\(bu" 4 -\fIDefault\fR: $ssldir/private +\fIDefault\fR: \fB$ssldir/private\fR . .IP "" 0 . @@ -1465,7 +1477,7 @@ Where the client stores private certificate information\. The private key directory\. . .IP "\(bu" 4 -\fIDefault\fR: $ssldir/private_keys +\fIDefault\fR: \fB$ssldir/private_keys\fR . .IP "" 0 . @@ -1473,7 +1485,7 @@ The private key directory\. Whether to enable experimental performance profiling . .IP "\(bu" 4 -\fIDefault\fR: false +\fIDefault\fR: \fBfalse\fR . .IP "" 0 . @@ -1481,7 +1493,7 @@ Whether to enable experimental performance profiling Where Puppet stores public files\. . .IP "\(bu" 4 -\fIDefault\fR: Unix/Linux: /opt/puppetlabs/puppet/public \-\- Windows: C:\eProgramData\ePuppetLabs\epuppet\epublic \-\- Non\-root user: ~/\.puppetlabs/opt/puppet/public +\fIDefault\fR: \fBUnix/Linux: /opt/puppetlabs/puppet/public \-\- Windows: C:\eProgramData\ePuppetLabs\epuppet\epublic \-\- Non\-root user: ~/\.puppetlabs/opt/puppet/public\fR . .IP "" 0 . @@ -1489,7 +1501,7 @@ Where Puppet stores public files\. The public key directory\. . .IP "\(bu" 4 -\fIDefault\fR: $ssldir/public_keys +\fIDefault\fR: \fB$ssldir/public_keys\fR . .IP "" 0 . @@ -1497,7 +1509,7 @@ The public key directory\. Whether to print the Puppet stack trace on some errors\. This is a noop if \fBtrace\fR is also set\. . .IP "\(bu" 4 -\fIDefault\fR: false +\fIDefault\fR: \fBfalse\fR . .IP "" 0 . @@ -1511,7 +1523,7 @@ Despite the name, both puppet agent and puppet master will use this file as the For control over logging destinations, see the \fB\-\-logdest\fR command line option in the manual pages for puppet master, puppet agent, and puppet apply\. You can see man pages by running \fBpuppet \-\-help\fR, or read them online at https://puppet\.com/docs/puppet/latest/man/\. . .IP "\(bu" 4 -\fIDefault\fR: $logdir/puppetd\.log +\fIDefault\fR: \fB$logdir/puppetd\.log\fR . .IP "" 0 . @@ -1519,7 +1531,7 @@ For control over logging destinations, see the \fB\-\-logdest\fR command line op Whether to send reports after every transaction\. . .IP "\(bu" 4 -\fIDefault\fR: true +\fIDefault\fR: \fBtrue\fR . .IP "" 0 . @@ -1527,7 +1539,7 @@ Whether to send reports after every transaction\. Whether the \'http\' report processor should include the system certificate store when submitting reports to HTTPS URLs\. If false, then the \'http\' processor will only trust HTTPS report servers whose certificates are issued by the puppet CA or one of its intermediate CAs\. If true, the processor will additionally trust CA certificates in the system\'s certificate store\. . .IP "\(bu" 4 -\fIDefault\fR: false +\fIDefault\fR: \fBfalse\fR . .IP "" 0 . @@ -1535,7 +1547,7 @@ Whether the \'http\' report processor should include the system certificate stor The port to communicate with the report_server\. . .IP "\(bu" 4 -\fIDefault\fR: $serverport +\fIDefault\fR: \fB$serverport\fR . .IP "" 0 . @@ -1543,7 +1555,7 @@ The port to communicate with the report_server\. The server to send transaction reports to\. . .IP "\(bu" 4 -\fIDefault\fR: $server +\fIDefault\fR: \fB$server\fR . .IP "" 0 . @@ -1551,7 +1563,7 @@ The server to send transaction reports to\. The directory in which to store reports\. Each node gets a separate subdirectory in this directory\. This setting is only used when the \fBstore\fR report processor is enabled (see the \fBreports\fR setting)\. . .IP "\(bu" 4 -\fIDefault\fR: $vardir/reports +\fIDefault\fR: \fB$vardir/reports\fR . .IP "" 0 . @@ -1565,7 +1577,7 @@ This setting is relevant to puppet master and puppet apply\. The puppet master w See the report reference for information on the built\-in report handlers; custom report handlers can also be loaded from modules\. (Report handlers are loaded from the lib directory, at \fBpuppet/reports/NAME\.rb\fR\.) . .IP "\(bu" 4 -\fIDefault\fR: store +\fIDefault\fR: \fBstore\fR . .IP "" 0 . @@ -1573,7 +1585,7 @@ See the report reference for information on the built\-in report handlers; custo The URL that reports should be forwarded to\. This setting is only used when the \fBhttp\fR report processor is enabled (see the \fBreports\fR setting)\. . .IP "\(bu" 4 -\fIDefault\fR: http://localhost:3000/reports/upload +\fIDefault\fR: \fBhttp://localhost:3000/reports/upload\fR . .IP "" 0 . @@ -1581,7 +1593,7 @@ The URL that reports should be forwarded to\. This setting is only used when the Where host certificate requests are stored\. . .IP "\(bu" 4 -\fIDefault\fR: $ssldir/certificate_requests +\fIDefault\fR: \fB$ssldir/certificate_requests\fR . .IP "" 0 . @@ -1589,7 +1601,7 @@ Where host certificate requests are stored\. The file in which puppet agent stores a list of the resources associated with the retrieved configuration\. . .IP "\(bu" 4 -\fIDefault\fR: $statedir/resources\.txt +\fIDefault\fR: \fB$statedir/resources\.txt\fR . .IP "" 0 . @@ -1597,7 +1609,7 @@ The file in which puppet agent stores a list of the resources associated with th Whether to send updated facts after every transaction\. By default puppet only submits facts at the beginning of the transaction before applying a catalog\. Since puppet can modify the state of the system, the value of the facts may change after puppet finishes\. Therefore, any facts stored in puppetdb may not be consistent until the agent next runs, typically in 30 minutes\. If this feature is enabled, puppet will resubmit facts after applying its catalog, ensuring facts for the node stored in puppetdb are current\. However, this will double the fact submission load on puppetdb, so it is disabled by default\. . .IP "\(bu" 4 -\fIDefault\fR: false +\fIDefault\fR: \fBfalse\fR . .IP "" 0 . @@ -1605,7 +1617,7 @@ Whether to send updated facts after every transaction\. By default puppet only s Enables having extended data in the catalog by storing them as a hash with the special key \fB__ptype\fR\. When enabled, resource containing values of the data types \fBBinary\fR, \fBRegexp\fR, \fBSemVer\fR, \fBSemVerRange\fR, \fBTimespan\fR and \fBTimestamp\fR, as well as instances of types derived from \fBObject\fR retain their data type\. . .IP "\(bu" 4 -\fIDefault\fR: true +\fIDefault\fR: \fBtrue\fR . .IP "" 0 . @@ -1613,7 +1625,7 @@ Enables having extended data in the catalog by storing them as a hash with the s The YAML file containing indirector route configuration\. . .IP "\(bu" 4 -\fIDefault\fR: $confdir/routes\.yaml +\fIDefault\fR: \fB$confdir/routes\.yaml\fR . .IP "" 0 . @@ -1621,7 +1633,7 @@ The YAML file containing indirector route configuration\. Where Puppet PID files are kept\. . .IP "\(bu" 4 -\fIDefault\fR: Unix/Linux: /var/run/puppetlabs \-\- Windows: C:\eProgramData\ePuppetLabs\epuppet\evar\erun \-\- Non\-root user: ~/\.puppetlabs/var/run +\fIDefault\fR: \fBUnix/Linux: /var/run/puppetlabs \-\- Windows: C:\eProgramData\ePuppetLabs\epuppet\evar\erun \-\- Non\-root user: ~/\.puppetlabs/var/run\fR . .IP "" 0 . @@ -1629,7 +1641,7 @@ Where Puppet PID files are kept\. How often puppet agent applies the catalog\. Note that a runinterval of 0 means "run continuously" rather than "never run\." This setting can be a time interval in seconds (30 or 30s), minutes (30m), hours (6h), days (2d), or years (5y)\. . .IP "\(bu" 4 -\fIDefault\fR: 30m +\fIDefault\fR: \fB30m\fR . .IP "" 0 . @@ -1637,7 +1649,7 @@ How often puppet agent applies the catalog\. Note that a runinterval of 0 means The maximum amount of time an agent run is allowed to take\. A Puppet agent run that exceeds this timeout will be aborted\. A value of 0 disables the timeout\. Defaults to 1 hour\. This setting can be a time interval in seconds (30 or 30s), minutes (30m), hours (6h), days (2d), or years (5y)\. . .IP "\(bu" 4 -\fIDefault\fR: 1h +\fIDefault\fR: \fB1h\fR . .IP "" 0 . @@ -1645,7 +1657,7 @@ The maximum amount of time an agent run is allowed to take\. A Puppet agent run Where the serial number for certificates is stored\. . .IP "\(bu" 4 -\fIDefault\fR: $cadir/serial +\fIDefault\fR: \fB$cadir/serial\fR . .IP "" 0 . @@ -1653,7 +1665,7 @@ Where the serial number for certificates is stored\. The puppet master server to which the puppet agent should connect\. . .IP "\(bu" 4 -\fIDefault\fR: puppet +\fIDefault\fR: \fBpuppet\fR . .IP "" 0 . @@ -1661,7 +1673,7 @@ The puppet master server to which the puppet agent should connect\. The directory in which serialized data is stored, usually in a subdirectory\. . .IP "\(bu" 4 -\fIDefault\fR: $vardir/server_data +\fIDefault\fR: \fB$vardir/server_data\fR . .IP "" 0 . @@ -1669,7 +1681,7 @@ The directory in which serialized data is stored, usually in a subdirectory\. The list of Puppet master servers to which the Puppet agent should connect, 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\. . .IP "\(bu" 4 -\fIDefault\fR: [] +\fIDefault\fR: \fB[]\fR . .IP "" 0 . @@ -1677,7 +1689,7 @@ The list of Puppet master servers to which the Puppet agent should connect, in t The default port puppet subcommands use to communicate with Puppet Server\. (eg \fBpuppet facts upload\fR, \fBpuppet agent\fR)\. May be overridden by more specific settings (see \fBca_port\fR, \fBreport_port\fR)\. . .IP "\(bu" 4 -\fIDefault\fR: 8140 +\fIDefault\fR: \fB8140\fR . .IP "" 0 . @@ -1685,7 +1697,7 @@ The default port puppet subcommands use to communicate with Puppet Server\. (eg Whether to compile and apply the settings catalog . .IP "\(bu" 4 -\fIDefault\fR: true +\fIDefault\fR: \fBtrue\fR . .IP "" 0 . @@ -1693,7 +1705,7 @@ Whether to compile and apply the settings catalog Whether to log and report a contextual diff when files are being replaced\. This causes partial file contents to pass through Puppet\'s normal logging and reporting system, so this setting should be used with caution if you are sending Puppet\'s reports to an insecure destination\. This feature currently requires the \fBdiff/lcs\fR Ruby library\. . .IP "\(bu" 4 -\fIDefault\fR: false +\fIDefault\fR: \fBfalse\fR . .IP "" 0 . @@ -1701,7 +1713,7 @@ Whether to log and report a contextual diff when files are being replaced\. This Where the CA stores signed certificates\. . .IP "\(bu" 4 -\fIDefault\fR: $cadir/signed +\fIDefault\fR: \fB$cadir/signed\fR . .IP "" 0 . @@ -1711,9 +1723,10 @@ Tags to use to filter resources\. If this is set, then only resources not tagged .SS "sourceaddress" The address the agent should use to initiate requests\. . -.TP -\fIDefault\fR: - +.IP "\(bu" 4 +\fIDefault\fR: `` +. +.IP "" 0 . .SS "splay" Whether to sleep for a random amount of time, ranging from immediately up to its \fB$splaylimit\fR, before performing its first agent run after a service restart\. After this period, the agent runs periodically on its \fB$runinterval\fR\. @@ -1728,7 +1741,7 @@ With \fBsplay\fR enabled, it waits any amount of time up to its \fB$splaylimit\f If you restart an agent\'s puppet service with \fBsplay\fR enabled, it recalculates its splay period and delays its first agent run after restarting for this new period\. If you simultaneously restart a group of puppet agents with \fBsplay\fR enabled, their checkins to your puppet masters can be distributed more evenly\. . .IP "\(bu" 4 -\fIDefault\fR: false +\fIDefault\fR: \fBfalse\fR . .IP "" 0 . @@ -1736,7 +1749,7 @@ If you restart an agent\'s puppet service with \fBsplay\fR enabled, it recalcula The maximum time to delay before an agent\'s first run when \fBsplay\fR is enabled\. Defaults to the agent\'s \fB$runinterval\fR\. The \fBsplay\fR interval is random and recalculated each time the agent is started or restarted\. This setting can be a time interval in seconds (30 or 30s), minutes (30m), hours (6h), days (2d), or years (5y)\. . .IP "\(bu" 4 -\fIDefault\fR: $runinterval +\fIDefault\fR: \fB$runinterval\fR . .IP "" 0 . @@ -1744,7 +1757,7 @@ The maximum time to delay before an agent\'s first run when \fBsplay\fR is enabl The domain which will be queried to find the SRV records of servers to use\. . .IP "\(bu" 4 -\fIDefault\fR: ci\-jenkins\-setup\-platform\.svc\.cluster\.local +\fIDefault\fR: \fBci\-jenkins\-setup\-platform\.svc\.cluster\.local\fR . .IP "" 0 . @@ -1755,7 +1768,7 @@ The header containing an authenticated client\'s SSL DN\. This header must be se Note that the name of the HTTP header gets munged by the web server common gateway interface: an \fBHTTP_\fR prefix is added, dashes are converted to underscores, and all letters are uppercased\. Thus, to use the \fBX\-Client\-DN\fR header, this setting should be \fBHTTP_X_CLIENT_DN\fR\. . .IP "\(bu" 4 -\fIDefault\fR: HTTP_X_CLIENT_DN +\fIDefault\fR: \fBHTTP_X_CLIENT_DN\fR . .IP "" 0 . @@ -1766,7 +1779,7 @@ The header containing the status message of the client verification\. This heade Note that the name of the HTTP header gets munged by the web server common gateway interface: an \fBHTTP_\fR prefix is added, dashes are converted to underscores, and all letters are uppercased\. Thus, to use the \fBX\-Client\-Verify\fR header, this setting should be \fBHTTP_X_CLIENT_VERIFY\fR\. . .IP "\(bu" 4 -\fIDefault\fR: HTTP_X_CLIENT_VERIFY +\fIDefault\fR: \fBHTTP_X_CLIENT_VERIFY\fR . .IP "" 0 . @@ -1774,22 +1787,23 @@ Note that the name of the HTTP header gets munged by the web server common gatew A lock file to indicate that the ssl bootstrap process is currently in progress\. . .IP "\(bu" 4 -\fIDefault\fR: $ssldir/ssl\.lock +\fIDefault\fR: \fB$ssldir/ssl\.lock\fR . .IP "" 0 . .SS "ssl_trust_store" A file containing CA certificates in PEM format that puppet should trust when making HTTPS requests\. This \fBonly\fR applies to https requests to non\-puppet infrastructure, such as retrieving file metadata and content from https file sources, puppet module tool and the \'http\' report processor\. This setting is ignored when making requests to puppet:// URLs such as catalog and report requests\. . -.TP -\fIDefault\fR: - +.IP "\(bu" 4 +\fIDefault\fR: `` +. +.IP "" 0 . .SS "ssldir" Where SSL certificates are kept\. . .IP "\(bu" 4 -\fIDefault\fR: $confdir/ssl +\fIDefault\fR: \fB$confdir/ssl\fR . .IP "" 0 . @@ -1797,7 +1811,7 @@ Where SSL certificates are kept\. The directory where Puppet state is stored\. Generally, this directory can be removed without causing harm (although it might result in spurious service restarts)\. . .IP "\(bu" 4 -\fIDefault\fR: $vardir/state +\fIDefault\fR: \fB$vardir/state\fR . .IP "" 0 . @@ -1805,7 +1819,7 @@ The directory where Puppet state is stored\. Generally, this directory can be re Where puppet agent and puppet master store state associated with the running configuration\. In the case of puppet master, this file reflects the state discovered through interacting with clients\. . .IP "\(bu" 4 -\fIDefault\fR: $statedir/state\.yaml +\fIDefault\fR: \fB$statedir/state\.yaml\fR . .IP "" 0 . @@ -1816,7 +1830,7 @@ How long the Puppet agent should cache when a resource was last checked or synce This setting affects the usage of \fBschedule\fR resources, as the information about when a resource was last checked (and therefore when it needs to be checked again) is stored in the \fBstatefile\fR\. The \fBstatettl\fR needs to be large enough to ensure that a resource will not trigger multiple times during a schedule due to its entry expiring from the cache\. . .IP "\(bu" 4 -\fIDefault\fR: 32d +\fIDefault\fR: \fB32d\fR . .IP "" 0 . @@ -1824,7 +1838,7 @@ This setting affects the usage of \fBschedule\fR resources, as the information a Whether to compile a static catalog \fIhttps://puppet\.com/docs/puppet/latest/static_catalogs\.html#enabling\-or\-disabling\-static\-catalogs\fR, which occurs only on a Puppet Server master when the \fBcode\-id\-command\fR and \fBcode\-content\-command\fR settings are configured in its \fBpuppetserver\.conf\fR file\. . .IP "\(bu" 4 -\fIDefault\fR: true +\fIDefault\fR: \fBtrue\fR . .IP "" 0 . @@ -1838,7 +1852,7 @@ By default this uses the \'puppetdb\' backend\. You can adjust the backend using the storeconfigs_backend setting\. . .IP "\(bu" 4 -\fIDefault\fR: false +\fIDefault\fR: \fBfalse\fR . .IP "" 0 . @@ -1846,7 +1860,7 @@ You can adjust the backend using the storeconfigs_backend setting\. Configure the backend terminus used for StoreConfigs\. By default, this uses the PuppetDB store, which must be installed and configured before turning on StoreConfigs\. . .IP "\(bu" 4 -\fIDefault\fR: puppetdb +\fIDefault\fR: \fBpuppetdb\fR . .IP "" 0 . @@ -1871,7 +1885,7 @@ The strictness level is for both language semantics and runtime evaluation valid No new validations will be added to a micro (x\.y\.z) release, but may be added in minor releases (x\.y\.0)\. In major releases it expected that most (if not all) strictness validation become standard behavior\. . .IP "\(bu" 4 -\fIDefault\fR: warning +\fIDefault\fR: \fBwarning\fR . .IP "" 0 . @@ -1879,7 +1893,7 @@ No new validations will be added to a micro (x\.y\.z) release, but may be added Whether the agent specified environment should be considered authoritative, causing the run to fail if the retrieved catalog does not match it\. . .IP "\(bu" 4 -\fIDefault\fR: false +\fIDefault\fR: \fBfalse\fR . .IP "" 0 . @@ -1887,7 +1901,7 @@ Whether the agent specified environment should be considered authoritative, caus Causes an evaluation error when referencing unknown variables\. (This does not affect referencing variables that are explicitly set to undef)\. . .IP "\(bu" 4 -\fIDefault\fR: false +\fIDefault\fR: \fBfalse\fR . .IP "" 0 . @@ -1895,7 +1909,7 @@ Causes an evaluation error when referencing unknown variables\. (This does not a Whether to print a transaction summary\. . .IP "\(bu" 4 -\fIDefault\fR: false +\fIDefault\fR: \fBfalse\fR . .IP "" 0 . @@ -1903,7 +1917,7 @@ Whether to print a transaction summary\. Checksum types supported by this agent for use in file resources of a static catalog\. Values must be comma\-separated\. Valid types are sha256, sha256lite, sha384, sha512, sha224, sha1, sha1lite, md5, md5lite, mtime, ctime\. Default is sha256, sha384, sha512, sha224, md5\. . .IP "\(bu" 4 -\fIDefault\fR: ["sha256", "sha384", "sha512", "sha224", "md5"] +\fIDefault\fR: \fB["sha256", "sha384", "sha512", "sha224", "md5"]\fR . .IP "" 0 . @@ -1911,7 +1925,7 @@ Checksum types supported by this agent for use in file resources of a static cat What syslog facility to use when logging to syslog\. Syslog has a fixed list of valid facilities, and you must choose one of those; you cannot just make one up\. . .IP "\(bu" 4 -\fIDefault\fR: daemon +\fIDefault\fR: \fBdaemon\fR . .IP "" 0 . @@ -1922,7 +1936,7 @@ Tags to use to find resources\. If this is set, then only resources tagged with Turns on experimental support for tasks and plans in the puppet language\. This is for internal API use only\. Do not change this setting\. . .IP "\(bu" 4 -\fIDefault\fR: false +\fIDefault\fR: \fBfalse\fR . .IP "" 0 . @@ -1930,7 +1944,7 @@ Turns on experimental support for tasks and plans in the puppet language\. This Whether to print stack traces on some errors\. Will print internal Ruby stack trace interleaved with Puppet function frames\. . .IP "\(bu" 4 -\fIDefault\fR: false +\fIDefault\fR: \fBfalse\fR . .IP "" 0 . @@ -1938,7 +1952,7 @@ Whether to print stack traces on some errors\. Will print internal Ruby stack tr Transactional storage file for persisting data between transactions for the purposes of infering information (such as corrective_change) on new data received\. . .IP "\(bu" 4 -\fIDefault\fR: $statedir/transactionstore\.yaml +\fIDefault\fR: \fB$statedir/transactionstore\.yaml\fR . .IP "" 0 . @@ -1959,15 +1973,16 @@ For unknown or invalid nodes, exit with a non\-zero exit code\. .P If the setting points to an executable command, then the external trusted facts will be stored in the \'external\' key of the trusted facts hash\. Otherwise for each executable file in the directory, the external trusted facts will be stored in the \fB\fR key of the \fBtrusted[\'external\']\fR hash\. For example, if the files foo\.rb and bar\.sh are in the directory, then \fBtrusted[\'external\']\fR will be the hash \fB{ \'foo\' => , \'bar\' => }\fR\. . -.TP -\fIDefault\fR: - +.IP "\(bu" 4 +\fIDefault\fR: `` +. +.IP "" 0 . .SS "trusted_oid_mapping_file" File that provides mapping between custom SSL oids and user\-friendly names . .IP "\(bu" 4 -\fIDefault\fR: $confdir/custom_trusted_oid_mapping\.yaml +\fIDefault\fR: \fB$confdir/custom_trusted_oid_mapping\.yaml\fR . .IP "" 0 . @@ -1975,7 +1990,7 @@ File that provides mapping between custom SSL oids and user\-friendly names Whether to only use the cached catalog rather than compiling a new catalog on every run\. Puppet can be run with this enabled by default and then selectively disabled when a recompile is desired\. Because a Puppet agent using cached catalogs does not contact the master for a new catalog, it also does not upload facts at the beginning of the Puppet run\. . .IP "\(bu" 4 -\fIDefault\fR: false +\fIDefault\fR: \fBfalse\fR . .IP "" 0 . @@ -1983,7 +1998,7 @@ Whether to only use the cached catalog rather than compiling a new catalog on ev Whether the server will search for SRV records in DNS for the current domain\. . .IP "\(bu" 4 -\fIDefault\fR: false +\fIDefault\fR: \fBfalse\fR . .IP "" 0 . @@ -1991,7 +2006,7 @@ Whether the server will search for SRV records in DNS for the current domain\. Whether to use the cached configuration when the remote configuration will not compile\. This option is useful for testing new configurations, where you want to fix the broken configuration rather than reverting to a known\-good one\. . .IP "\(bu" 4 -\fIDefault\fR: true +\fIDefault\fR: \fBtrue\fR . .IP "" 0 . @@ -1999,7 +2014,7 @@ Whether to use the cached configuration when the remote configuration will not c The user Puppet Server will run as\. Used to ensure the agent side processes (agent, apply, etc) create files and directories readable by Puppet Server when necessary\. . .IP "\(bu" 4 -\fIDefault\fR: puppet +\fIDefault\fR: \fBpuppet\fR . .IP "" 0 . @@ -2007,7 +2022,7 @@ The user Puppet Server will run as\. Used to ensure the agent side processes (ag Where Puppet stores dynamic and growing data\. The default for this setting is calculated specially, like \fBconfdir\fR_\. . .IP "\(bu" 4 -\fIDefault\fR: Unix/Linux: /opt/puppetlabs/puppet/cache \-\- Windows: C:\eProgramData\ePuppetLabs\epuppet\ecache \-\- Non\-root user: ~/\.puppetlabs/opt/puppet/cache +\fIDefault\fR: \fBUnix/Linux: /opt/puppetlabs/puppet/cache \-\- Windows: C:\eProgramData\ePuppetLabs\epuppet\ecache \-\- Non\-root user: ~/\.puppetlabs/opt/puppet/cache\fR . .IP "" 0 . @@ -2015,7 +2030,7 @@ Where Puppet stores dynamic and growing data\. The default for this setting is c The directory containing \fBvendored\fR modules\. These modules will be used by \fIall\fR environments like those in the \fBbasemodulepath\fR\. The only difference is that modules in the \fBbasemodulepath\fR are pluginsynced, while vendored modules are not . .IP "\(bu" 4 -\fIDefault\fR: /opt/puppetlabs/puppet/vendor_modules +\fIDefault\fR: \fB/opt/puppetlabs/puppet/vendor_modules\fR . .IP "" 0 . @@ -2023,7 +2038,7 @@ The directory containing \fBvendored\fR modules\. These modules will be used by Whether or not to look for versioned environment directories, symlinked from \fB$environmentpath/\fR\. This is an experimental feature and should be used with caution\. . .IP "\(bu" 4 -\fIDefault\fR: false +\fIDefault\fR: \fBfalse\fR . .IP "" 0 . @@ -2037,7 +2052,7 @@ When starting for the first time, puppet agent will submit a certificate signing Puppet agent cannot apply configurations until its approved certificate is available\. Since the certificate may or may not be available immediately, puppet agent will repeatedly try to fetch it at this interval\. You can turn off waiting for certificates by specifying a time of 0, or a maximum amount of time to wait in the \fBmaxwaitforcert\fR setting, in which case puppet agent will exit if it cannot get a cert\. This setting can be a time interval in seconds (30 or 30s), minutes (30m), hours (6h), days (2d), or years (5y)\. . .IP "\(bu" 4 -\fIDefault\fR: 2m +\fIDefault\fR: \fB2m\fR . .IP "" 0 . @@ -2048,7 +2063,7 @@ How frequently puppet agent should try running when there is an already ongoing This argument is by default disabled (value set to 0)\. In this case puppet agent will immediately exit if it cannot run at that moment\. When a value other than 0 is set, this can also be used in combination with the \fBmaxwaitforlock\fR argument\. This setting can be a time interval in seconds (30 or 30s), minutes (30m), hours (6h), days (2d), or years (5y)\. . .IP "\(bu" 4 -\fIDefault\fR: 0 +\fIDefault\fR: \fB0\fR . .IP "" 0 . @@ -2056,7 +2071,7 @@ This argument is by default disabled (value set to 0)\. In this case puppet agen The directory in which YAML data is stored, usually in a subdirectory\. . .IP "\(bu" 4 -\fIDefault\fR: $vardir/yaml +\fIDefault\fR: \fB$vardir/yaml\fR . .IP "" 0 From 52db30333d1015744407e92783881168e60ab760 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Fri, 21 May 2021 07:04:03 +0000 Subject: [PATCH 369/731] (packaging) Bump to version '7.8.0' [no-promote] --- .gemspec | 2 +- lib/puppet/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gemspec b/.gemspec index 63fa8a94385..54f01af355e 100644 --- a/.gemspec +++ b/.gemspec @@ -13,7 +13,7 @@ Gem::Specification.new do |s| s.name = "puppet" - version = "7.7.0" + version = "7.8.0" mdata = version.match(/(\d+\.\d+\.\d+)/) s.version = mdata ? mdata[1] : version diff --git a/lib/puppet/version.rb b/lib/puppet/version.rb index c3756ac3713..b18c1eb2b97 100644 --- a/lib/puppet/version.rb +++ b/lib/puppet/version.rb @@ -6,7 +6,7 @@ # Raketasks and such to set the version based on the output of `git describe` module Puppet - PUPPETVERSION = '7.7.0' + PUPPETVERSION = '7.8.0' ## # version is a public API method intended to always provide a fast and From e200b3e86ecf7eceaf90a79701c34cdcdeeae374 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Fri, 21 May 2021 07:08:43 +0000 Subject: [PATCH 370/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 2 +- man/man8/puppet.8 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index d05a2874eca..d7f9fa3bede 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -913,7 +913,7 @@ The time to wait for data to be read from an HTTP connection\. If nothing is rea The HTTP User\-Agent string to send when making network requests\. . .IP "\(bu" 4 -\fIDefault\fR: \fBPuppet/7\.7\.0 Ruby/2\.5\.1\-p57 (x86_64\-linux)\fR +\fIDefault\fR: \fBPuppet/7\.8\.0 Ruby/2\.5\.1\-p57 (x86_64\-linux)\fR . .IP "" 0 . diff --git a/man/man8/puppet.8 b/man/man8/puppet.8 index 30c6ed5902f..fa430bca6eb 100644 --- a/man/man8/puppet.8 +++ b/man/man8/puppet.8 @@ -25,4 +25,4 @@ Specialized: 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 . .P -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\.7\.0 +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\.8\.0 From 3aecb85fd55235d0d5f98170d3268a756f000a17 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Mon, 24 May 2021 20:54:34 +0000 Subject: [PATCH 371/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index d7f9fa3bede..549da6cea79 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -1576,6 +1576,9 @@ This setting is relevant to puppet master and puppet apply\. The puppet master w .P See the report reference for information on the built\-in report handlers; custom report handlers can also be loaded from modules\. (Report handlers are loaded from the lib directory, at \fBpuppet/reports/NAME\.rb\fR\.) . +.P +To turn off reports entirely, set this to \fBnone\fR +. .IP "\(bu" 4 \fIDefault\fR: \fBstore\fR . From 5497e87c0f698b3245d23080143e7514f8d52998 Mon Sep 17 00:00:00 2001 From: Kenyon Ralph Date: Mon, 24 May 2021 11:39:31 -0700 Subject: [PATCH 372/731] (docs) CONTRIBUTING.md: update link to CLA --- CONTRIBUTING.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index dd417124870..79843aeecec 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -114,7 +114,7 @@ respectively. ## Submitting Changes -* Sign the [Contributor License Agreement](https://cla.puppet.com). +* Sign the [Contributor License Agreement](https://cla-assistant.io/puppetlabs/). * Push your changes to a topic branch in your fork of the repository. * Submit a pull request to the repository in the puppetlabs organization. * Update the related Jira ticket to mark that you have submitted code and are ready @@ -158,4 +158,4 @@ ensure the issue has been resolved. * [General GitHub documentation](https://help.github.com/) * [GitHub pull request documentation](https://help.github.com/articles/creating-a-pull-request/) * [puppet-dev mailing list](https://groups.google.com/forum/#!forum/puppet-dev) -* [Puppet community slack](https://slack.puppet.com) \ No newline at end of file +* [Puppet community slack](https://slack.puppet.com) From d00a8506933f845192d1b68b7b9390f426f62bc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Wed, 26 May 2021 20:26:34 -1000 Subject: [PATCH 373/731] (maint) Truncate file before overwriting it Previously, we did not truncate the script when updating a variable. Since the module only support setting variables to "YES" and "NO", the only consequence was that when switching from "YES" to "NO" the last character of the file was kept and we ended up with a blank line: sshd_enable="YES"\n -> sshd_enable="NO"\n\n With the introduction of the support of more variables for the freebsd provider, this result however in more breakage so we have to fix it. --- lib/puppet/provider/service/freebsd.rb | 2 +- spec/unit/provider/service/freebsd_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/puppet/provider/service/freebsd.rb b/lib/puppet/provider/service/freebsd.rb index 9ad46053056..8414548d05b 100644 --- a/lib/puppet/provider/service/freebsd.rb +++ b/lib/puppet/provider/service/freebsd.rb @@ -74,7 +74,7 @@ def rc_replace(service, rcvar, yesno) if Puppet::FileSystem.exist?(filename) s = File.read(filename) if s.gsub!(/^(#{rcvar}(_enable)?)=\"?(YES|NO)\"?/, "\\1=\"#{yesno}\"") - File.open(filename, File::WRONLY) { |f| f << s } + File.open(filename, File::WRONLY | File::TRUNC) { |f| f << s } self.debug("Replaced in #{filename}") success = true end diff --git a/spec/unit/provider/service/freebsd_spec.rb b/spec/unit/provider/service/freebsd_spec.rb index 7ee52e9e81c..dd0da565d94 100644 --- a/spec/unit/provider/service/freebsd_spec.rb +++ b/spec/unit/provider/service/freebsd_spec.rb @@ -82,7 +82,7 @@ allow(Puppet::FileSystem).to receive(:exist?).with('/etc/rc.conf').and_return(true) allow(File).to receive(:read).with('/etc/rc.conf').and_return("openntpd_enable=\"NO\"\nntpd_enable=\"NO\"\n") fh = double('fh') - allow(File).to receive(:open).with('/etc/rc.conf', File::WRONLY).and_yield(fh) + allow(File).to receive(:open).with('/etc/rc.conf', File::WRONLY | File::TRUNC).and_yield(fh) expect(fh).to receive(:<<).with("openntpd_enable=\"NO\"\nntpd_enable=\"YES\"\n") allow(Puppet::FileSystem).to receive(:exist?).with('/etc/rc.conf.local').and_return(false) allow(Puppet::FileSystem).to receive(:exist?).with('/etc/rc.conf.d/ntpd').and_return(false) From ab56d86ecb4b71298c75325462bf73376420bb40 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Thu, 27 May 2021 07:22:32 +0000 Subject: [PATCH 374/731] (packaging) Updating the puppet.pot file --- locales/puppet.pot | 76 ++++++++++++++++++++++------------------------ 1 file changed, 36 insertions(+), 40 deletions(-) diff --git a/locales/puppet.pot b/locales/puppet.pot index 6cd8d5bbda4..97373f04996 100644 --- a/locales/puppet.pot +++ b/locales/puppet.pot @@ -6,11 +6,11 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Puppet automation framework 7.6.1-91-g3f8691353f\n" +"Project-Id-Version: Puppet automation framework 7.7.0-19-gf6adbd522b\n" "\n" "Report-Msgid-Bugs-To: https://tickets.puppetlabs.com\n" -"POT-Creation-Date: 2021-05-12 16:37+0000\n" -"PO-Revision-Date: 2021-05-12 16:37+0000\n" +"POT-Creation-Date: 2021-05-27 07:22+0000\n" +"PO-Revision-Date: 2021-05-27 07:22+0000\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -184,19 +184,19 @@ msgstr "" msgid "The puppet agent daemon" msgstr "" -#: ../lib/puppet/application/agent.rb:415 +#: ../lib/puppet/application/agent.rb:422 msgid "Fingerprint asked but neither the certificate, nor the certificate request have been issued" msgstr "" -#: ../lib/puppet/application/agent.rb:420 +#: ../lib/puppet/application/agent.rb:427 msgid "Failed to generate fingerprint: %{message}" msgstr "" -#: ../lib/puppet/application/agent.rb:443 +#: ../lib/puppet/application/agent.rb:450 msgid "Starting Puppet client version %{version}" msgstr "" -#: ../lib/puppet/application/agent.rb:459 +#: ../lib/puppet/application/agent.rb:466 msgid "The puppet agent command does not take parameters" msgstr "" @@ -206,35 +206,35 @@ msgstr "" #. TRANSLATORS "puppet apply" is a program command and should not be translated #. TRANSLATORS "puppet apply" is a program command and should not be translated -#: ../lib/puppet/application/apply.rb:208 ../lib/puppet/application/apply.rb:321 +#: ../lib/puppet/application/apply.rb:209 ../lib/puppet/application/apply.rb:322 msgid "For puppet apply" msgstr "" -#: ../lib/puppet/application/apply.rb:216 +#: ../lib/puppet/application/apply.rb:217 msgid "%{file} is not readable" msgstr "" -#: ../lib/puppet/application/apply.rb:287 ../lib/puppet/application/script.rb:240 +#: ../lib/puppet/application/apply.rb:288 ../lib/puppet/application/script.rb:241 msgid "Exiting" msgstr "" -#: ../lib/puppet/application/apply.rb:331 +#: ../lib/puppet/application/apply.rb:332 msgid "Could not deserialize catalog from %{format}: %{detail}" msgstr "" -#: ../lib/puppet/application/apply.rb:352 ../lib/puppet/application/script.rb:145 +#: ../lib/puppet/application/apply.rb:353 ../lib/puppet/application/script.rb:146 msgid "Could not find facts for %{node}" msgstr "" -#: ../lib/puppet/application/apply.rb:364 ../lib/puppet/application/script.rb:153 +#: ../lib/puppet/application/apply.rb:365 ../lib/puppet/application/script.rb:154 msgid "Could not find node %{node}" msgstr "" -#: ../lib/puppet/application/apply.rb:377 ../lib/puppet/application/script.rb:138 +#: ../lib/puppet/application/apply.rb:378 ../lib/puppet/application/script.rb:139 msgid "Could not find file %{manifest}" msgstr "" -#: ../lib/puppet/application/apply.rb:378 +#: ../lib/puppet/application/apply.rb:379 msgid "Only one file can be applied per run. Skipping %{files}" msgstr "" @@ -246,47 +246,47 @@ msgstr "" msgid "Manage remote network devices" msgstr "" -#: ../lib/puppet/application/device.rb:231 +#: ../lib/puppet/application/device.rb:232 msgid "resource command requires target" msgstr "" -#: ../lib/puppet/application/device.rb:234 +#: ../lib/puppet/application/device.rb:235 msgid "facts command requires target" msgstr "" -#: ../lib/puppet/application/device.rb:237 +#: ../lib/puppet/application/device.rb:238 msgid "missing argument: --target is required when using --apply" msgstr "" -#: ../lib/puppet/application/device.rb:238 +#: ../lib/puppet/application/device.rb:239 msgid "%{file} does not exist, cannot apply" msgstr "" -#: ../lib/puppet/application/device.rb:256 +#: ../lib/puppet/application/device.rb:257 msgid "Target device / certificate '%{target}' not found in %{config}" msgstr "" -#: ../lib/puppet/application/device.rb:258 +#: ../lib/puppet/application/device.rb:259 msgid "No device found in %{config}" msgstr "" -#: ../lib/puppet/application/device.rb:315 +#: ../lib/puppet/application/device.rb:316 msgid "retrieving resource: %{resource} from %{target} at %{scheme}%{url_host}%{port}%{url_path}" msgstr "" -#: ../lib/puppet/application/device.rb:330 +#: ../lib/puppet/application/device.rb:331 msgid "retrieving facts from %{target} at %{scheme}%{url_host}%{port}%{url_path}" msgstr "" -#: ../lib/puppet/application/device.rb:353 +#: ../lib/puppet/application/device.rb:354 msgid "starting applying configuration to %{target} at %{scheme}%{url_host}%{port}%{url_path}" msgstr "" -#: ../lib/puppet/application/device.rb:389 ../lib/puppet/application/resource.rb:196 +#: ../lib/puppet/application/device.rb:390 ../lib/puppet/application/resource.rb:197 msgid "You must specify the type to display" msgstr "" -#: ../lib/puppet/application/device.rb:390 ../lib/puppet/application/resource.rb:197 +#: ../lib/puppet/application/device.rb:391 ../lib/puppet/application/resource.rb:198 msgid "Could not find type %{type}" msgstr "" @@ -418,15 +418,15 @@ msgstr "" msgid "The resource abstraction layer shell" msgstr "" -#: ../lib/puppet/application/resource.rb:140 +#: ../lib/puppet/application/resource.rb:141 msgid "Editing with Yaml output is not supported" msgstr "" -#: ../lib/puppet/application/resource.rb:204 +#: ../lib/puppet/application/resource.rb:205 msgid "Invalid parameter setting %{setting}" msgstr "" -#: ../lib/puppet/application/resource.rb:226 +#: ../lib/puppet/application/resource.rb:227 msgid "Listing all file instances is not supported. Please specify a file or directory, e.g. puppet resource file /etc" msgstr "" @@ -434,11 +434,11 @@ msgstr "" msgid "Run a puppet manifests as a script without compiling a catalog" msgstr "" -#: ../lib/puppet/application/script.rb:125 +#: ../lib/puppet/application/script.rb:126 msgid "Bolt must be installed to use the script application" msgstr "" -#: ../lib/puppet/application/script.rb:139 +#: ../lib/puppet/application/script.rb:140 msgid "Only one file can be used per run. Skipping %{files}" msgstr "" @@ -720,7 +720,7 @@ msgid "Invalid value '%{value}' for parameter %{name}. Allowed values are '%{all msgstr "" #. TRANSLATORS 'pluginsync' is a setting and should not be translated -#: ../lib/puppet/defaults.rb:1914 +#: ../lib/puppet/defaults.rb:1916 msgid "Setting 'pluginsync' is deprecated." msgstr "" @@ -2853,8 +2853,8 @@ msgstr "" msgid "Option %{option} conflicts with existing option %{conflict} on %{face}" msgstr "" -#. TRANSLATORS 'Puppet.settings' should not be translated #. TRANSLATORS 'Puppet.settings' references to the Puppet settings options and should not be translated +#. TRANSLATORS 'Puppet.settings' should not be translated #: ../lib/puppet/interface/action.rb:315 ../lib/puppet/interface/option_manager.rb:14 msgid "Global option %{option} does not exist in Puppet.settings" msgstr "" @@ -8234,19 +8234,15 @@ msgstr "" msgid "%{value} is not a valid day of the week" msgstr "" -#: ../lib/puppet/type/service.rb:96 -msgid "Setting enable to %{value} is only supported on Microsoft Windows." -msgstr "" - -#: ../lib/puppet/type/service.rb:152 ../lib/puppet/type/user.rb:271 +#: ../lib/puppet/type/service.rb:151 ../lib/puppet/type/user.rb:271 msgid "Passwords cannot include ':'" msgstr "" -#: ../lib/puppet/type/service.rb:279 +#: ../lib/puppet/type/service.rb:278 msgid "\"%{value}\" is not a positive integer: the timeout parameter must be specified as a positive integer" msgstr "" -#: ../lib/puppet/type/service.rb:301 +#: ../lib/puppet/type/service.rb:300 msgid "The 'logonaccount' parameter is mandatory when setting 'logonpassword'." msgstr "" From 7d13402d96a9c7f26eaa1aac52e7830ff7506c32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Thu, 27 May 2021 07:48:57 -1000 Subject: [PATCH 375/731] (maint) Prefer Puppet::FileSystem.replace_file to File.open The replace_file function ensure the operation is done atomically. --- lib/puppet/provider/service/freebsd.rb | 2 +- spec/unit/provider/service/freebsd_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/puppet/provider/service/freebsd.rb b/lib/puppet/provider/service/freebsd.rb index 8414548d05b..d97c605e34b 100644 --- a/lib/puppet/provider/service/freebsd.rb +++ b/lib/puppet/provider/service/freebsd.rb @@ -74,7 +74,7 @@ def rc_replace(service, rcvar, yesno) if Puppet::FileSystem.exist?(filename) s = File.read(filename) if s.gsub!(/^(#{rcvar}(_enable)?)=\"?(YES|NO)\"?/, "\\1=\"#{yesno}\"") - File.open(filename, File::WRONLY | File::TRUNC) { |f| f << s } + Puppet::FileSystem.replace_file(filename) { |f| f << s } self.debug("Replaced in #{filename}") success = true end diff --git a/spec/unit/provider/service/freebsd_spec.rb b/spec/unit/provider/service/freebsd_spec.rb index dd0da565d94..2f71d5a03d3 100644 --- a/spec/unit/provider/service/freebsd_spec.rb +++ b/spec/unit/provider/service/freebsd_spec.rb @@ -82,7 +82,7 @@ allow(Puppet::FileSystem).to receive(:exist?).with('/etc/rc.conf').and_return(true) allow(File).to receive(:read).with('/etc/rc.conf').and_return("openntpd_enable=\"NO\"\nntpd_enable=\"NO\"\n") fh = double('fh') - allow(File).to receive(:open).with('/etc/rc.conf', File::WRONLY | File::TRUNC).and_yield(fh) + allow(Puppet::FileSystem).to receive(:replace_file).with('/etc/rc.conf').and_yield(fh) expect(fh).to receive(:<<).with("openntpd_enable=\"NO\"\nntpd_enable=\"YES\"\n") allow(Puppet::FileSystem).to receive(:exist?).with('/etc/rc.conf.local').and_return(false) allow(Puppet::FileSystem).to receive(:exist?).with('/etc/rc.conf.d/ntpd').and_return(false) From 2728508de029d87de417bb99f2c8232e42466f1f Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Tue, 27 Apr 2021 11:18:52 -0700 Subject: [PATCH 376/731] (PUP-11047) Add webrick to test group WEBrick was moved to a separate gem but is only used in integration tests. So add it to the 'test' group in the Gemfile. --- Gemfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Gemfile b/Gemfile index f1e5ff1c633..5e37b2e7170 100644 --- a/Gemfile +++ b/Gemfile @@ -43,6 +43,7 @@ group(:test) do gem "rspec-its", "~> 1.1", require: false gem 'vcr', '~> 5.0', require: false gem 'webmock', '~> 3.0', require: false + gem 'webrick', '~> 1.7', require: false if RUBY_VERSION.to_f >= 3.0 gem 'yard', require: false gem 'rubocop', '~> 0.49', require: false, platforms: [:ruby] From 5d7da2e03c810caf41eca623fbb56983487439de Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Wed, 28 Apr 2021 13:04:42 -0700 Subject: [PATCH 377/731] (PUP-11047) Update rake for benchmark tasks Running benchmark tasks on ruby 3 fails when calling FileUtils.mkdir_p due to the way rake 12.x monkey patches it. Bump rake dependency. --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 5e37b2e7170..ade7e966d80 100644 --- a/Gemfile +++ b/Gemfile @@ -37,7 +37,7 @@ end group(:test) do gem "ffi", require: false gem "json-schema", "~> 2.0", require: false - gem "rake", *location_for(ENV['RAKE_LOCATION'] || '~> 12.2') + gem "rake", *location_for(ENV['RAKE_LOCATION'] || '~> 13.0') gem "rspec", "~> 3.1", require: false gem "rspec-expectations", ["~> 3.9", "!= 3.9.3"] gem "rspec-its", "~> 1.1", require: false From c060770387014f7729a24fc43bd9a50ca0c35da4 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Tue, 27 Apr 2021 23:31:10 -0700 Subject: [PATCH 378/731] (PUP-11047) Pass binding's source location If eval is called with a binding, then ruby 3 will report the source location as ["(eval)", 1], whereas ruby 2 reports the source location from the binding, which in the test is the `functions4_spec.rb` file. The `Binding#source_location` method only exists in ruby 2.6 and up, so conditionally pass the source location if it's available. See https://bugs.ruby-lang.org/issues/4352 --- spec/unit/functions4_spec.rb | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/spec/unit/functions4_spec.rb b/spec/unit/functions4_spec.rb index 12f609bb9d7..96a0a1845a7 100644 --- a/spec/unit/functions4_spec.rb +++ b/spec/unit/functions4_spec.rb @@ -39,6 +39,15 @@ def load_constant(typed_name) let(:loader) { FunctionAPISpecModule::TestFunctionLoader.new } + def parse_eval(code, here) + if here.respond_to?(:source_location) + eval(code, here, here.source_location[0], here.source_location[1]) + else + # this can be removed when ruby < 2.6 is dropped + eval(code, here) + end + end + it 'allows a simple function to be created without dispatch declaration' do f = Puppet::Functions.create_function('min') do def min(x,y) @@ -484,7 +493,7 @@ def test(x) the_loader = loader() here = get_binding(the_loader) expect do - eval(<<-CODE, here) + parse_eval(<<-CODE, here) Puppet::Functions.create_function('testing::test') do local_types do type 'MyType += Array[Integer]' @@ -505,7 +514,7 @@ def test(x) the_loader = loader() here = get_binding(the_loader) expect do - eval(<<-CODE, here) + parse_eval(<<-CODE, here) Puppet::Functions.create_function('testing::test') do dispatch :test do param 'Array[1+=1]', :x @@ -525,7 +534,7 @@ def test(x) it 'uses return_type to validate returned value' do the_loader = loader() here = get_binding(the_loader) - fc = eval(<<-CODE, here) + fc = parse_eval(<<-CODE, here) Puppet::Functions.create_function('testing::test') do dispatch :test do param 'Integer', :x @@ -547,7 +556,7 @@ def test(x) the_loader = loader() the_loader.add_type('myalias', type_alias_t('MyAlias', 'Integer')) here = get_binding(the_loader) - fc = eval(<<-CODE, here) + fc = parse_eval(<<-CODE, here) Puppet::Functions.create_function('testing::test') do dispatch :test do param 'MyAlias', :x @@ -567,7 +576,7 @@ def test(x) it 'reports a reference to an unresolved type' do the_loader = loader() here = get_binding(the_loader) - fc = eval(<<-CODE, here) + fc = parse_eval(<<-CODE, here) Puppet::Functions.create_function('testing::test') do dispatch :test do param 'MyAlias', :x @@ -586,7 +595,7 @@ def test(x) it 'create local Type aliases' do the_loader = loader() here = get_binding(the_loader) - fc = eval(<<-CODE, here) + fc = parse_eval(<<-CODE, here) Puppet::Functions.create_function('testing::test') do local_types do type 'MyType = Array[Integer]' @@ -608,7 +617,7 @@ def test(x) it 'create nested local Type aliases' do the_loader = loader() here = get_binding(the_loader) - fc = eval(<<-CODE, here) + fc = parse_eval(<<-CODE, here) Puppet::Functions.create_function('testing::test') do local_types do type 'InnerType = Array[Integer]' @@ -631,7 +640,7 @@ def test(x) it 'create self referencing local Type aliases' do the_loader = loader() here = get_binding(the_loader) - fc = eval(<<-CODE, here) + fc = parse_eval(<<-CODE, here) Puppet::Functions.create_function('testing::test') do local_types do type 'Tree = Hash[String,Variant[String,Tree]]' From 22a0fb328e409150c9a370824a46d514953aabdb Mon Sep 17 00:00:00 2001 From: gimmy Date: Thu, 27 May 2021 16:22:35 +0300 Subject: [PATCH 379/731] (PUP-11076) remove sorted_set usage Ruby 3 has removed sorted_set from the core and exposes it as an external gem. In puppet, we use it to store the versions of a package. This can be safely replaced by an Array. --- lib/puppet/provider/package/apt.rb | 6 +++--- lib/puppet/provider/package/yum.rb | 6 +++--- lib/puppet/provider/package/zypper.rb | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/puppet/provider/package/apt.rb b/lib/puppet/provider/package/apt.rb index 0149e0270c7..670b68fa0fb 100644 --- a/lib/puppet/provider/package/apt.rb +++ b/lib/puppet/provider/package/apt.rb @@ -91,20 +91,20 @@ def checkforcdrom end def best_version(should_range) - available_versions = SortedSet.new + versions = [] output = aptcache :madison, @resource[:name] output.each_line do |line| is = line.split('|')[1].strip begin is_version = DebianVersion.parse(is) - available_versions << is_version if should_range.include?(is_version) + versions << is_version if should_range.include?(is_version) rescue DebianVersion::ValidationFailure Puppet.debug("Cannot parse #{is} as a debian version") end end - return available_versions.to_a.last unless available_versions.empty? + return versions.sort.last if versions.any? Puppet.debug("No available version for package #{@resource[:name]} is included in range #{should_range}") should_range diff --git a/lib/puppet/provider/package/yum.rb b/lib/puppet/provider/package/yum.rb index a6534a9d72c..dcfb1414979 100644 --- a/lib/puppet/provider/package/yum.rb +++ b/lib/puppet/provider/package/yum.rb @@ -203,17 +203,17 @@ def best_version(should) Puppet.debug("Cannot parse #{should} as a RPM version range") return should end - sorted_versions = SortedSet.new + versions = [] available_versions(@resource[:name]).each do |version| begin rpm_version = RPM_VERSION.parse(version) - sorted_versions << rpm_version if should_range.include?(rpm_version) + versions << rpm_version if should_range.include?(rpm_version) rescue RPM_VERSION::ValidationFailure Puppet.debug("Cannot parse #{version} as a RPM version") end end - version = sorted_versions.entries.last + version = versions.sort.last if versions.any? if version version = version.to_s.sub(/^\d+:/, '') diff --git a/lib/puppet/provider/package/zypper.rb b/lib/puppet/provider/package/zypper.rb index 5f5d6016d18..464a80b5f6d 100644 --- a/lib/puppet/provider/package/zypper.rb +++ b/lib/puppet/provider/package/zypper.rb @@ -63,7 +63,7 @@ def best_version(should) return should end - sorted_versions = SortedSet.new + versions = [] output = zypper('search', '--match-exact', '--type', 'package', '--uninstalled-only', '-s', @resource[:name]) output.lines.each do |line| @@ -72,13 +72,13 @@ def best_version(should) begin rpm_version = Puppet::Util::Package::Version::Rpm.parse(pkg_ver[3]) - sorted_versions << rpm_version if should_range.include?(rpm_version) + versions << rpm_version if should_range.include?(rpm_version) rescue Puppet::Util::Package::Version::Rpm::ValidationFailure Puppet.debug("Cannot parse #{pkg_ver[3]} as a RPM version") end end - return sorted_versions.entries.last if sorted_versions.any? + return versions.sort.last if versions.any? Puppet.debug("No available version for package #{@resource[:name]} is included in range #{should_range}") should From 1a13e0cf96c70b303492e684f9ccf4c38207b3dd Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Wed, 2 Jun 2021 02:11:05 +0000 Subject: [PATCH 380/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 2 +- man/man8/puppet-agent.8 | 2 +- man/man8/puppet-apply.8 | 2 +- man/man8/puppet-catalog.8 | 2 +- man/man8/puppet-config.8 | 2 +- man/man8/puppet-describe.8 | 2 +- man/man8/puppet-device.8 | 2 +- man/man8/puppet-doc.8 | 2 +- man/man8/puppet-epp.8 | 2 +- man/man8/puppet-facts.8 | 2 +- man/man8/puppet-filebucket.8 | 2 +- man/man8/puppet-generate.8 | 2 +- man/man8/puppet-help.8 | 2 +- man/man8/puppet-lookup.8 | 2 +- man/man8/puppet-module.8 | 2 +- man/man8/puppet-node.8 | 2 +- man/man8/puppet-parser.8 | 2 +- man/man8/puppet-plugin.8 | 2 +- man/man8/puppet-report.8 | 2 +- man/man8/puppet-resource.8 | 2 +- man/man8/puppet-script.8 | 2 +- man/man8/puppet-ssl.8 | 2 +- man/man8/puppet.8 | 2 +- 23 files changed, 23 insertions(+), 23 deletions(-) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index 549da6cea79..1dce6db75d0 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPETCONF" "5" "May 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPETCONF" "5" "June 2021" "Puppet, Inc." "Puppet manual" \fBThis page is autogenerated; any changes will get overwritten\fR . .SH "Configuration settings" diff --git a/man/man8/puppet-agent.8 b/man/man8/puppet-agent.8 index edfe3ee0e62..6954b43325c 100644 --- a/man/man8/puppet-agent.8 +++ b/man/man8/puppet-agent.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-AGENT" "8" "May 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-AGENT" "8" "June 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-agent\fR \- The puppet agent daemon diff --git a/man/man8/puppet-apply.8 b/man/man8/puppet-apply.8 index fe405ee56eb..6d39315043b 100644 --- a/man/man8/puppet-apply.8 +++ b/man/man8/puppet-apply.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-APPLY" "8" "May 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-APPLY" "8" "June 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-apply\fR \- Apply Puppet manifests locally diff --git a/man/man8/puppet-catalog.8 b/man/man8/puppet-catalog.8 index 8ca781fa6b9..0b6ed2b7ef4 100644 --- a/man/man8/puppet-catalog.8 +++ b/man/man8/puppet-catalog.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-CATALOG" "8" "May 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-CATALOG" "8" "June 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-catalog\fR \- Compile, save, view, and convert catalogs\. diff --git a/man/man8/puppet-config.8 b/man/man8/puppet-config.8 index 1c9b3caaaf3..087891f0a70 100644 --- a/man/man8/puppet-config.8 +++ b/man/man8/puppet-config.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-CONFIG" "8" "May 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-CONFIG" "8" "June 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-config\fR \- Interact with Puppet\'s settings\. diff --git a/man/man8/puppet-describe.8 b/man/man8/puppet-describe.8 index 8f84e924f36..3998cd0896b 100644 --- a/man/man8/puppet-describe.8 +++ b/man/man8/puppet-describe.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-DESCRIBE" "8" "May 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-DESCRIBE" "8" "June 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-describe\fR \- Display help about resource types diff --git a/man/man8/puppet-device.8 b/man/man8/puppet-device.8 index 0f0fb868906..ac528032f4c 100644 --- a/man/man8/puppet-device.8 +++ b/man/man8/puppet-device.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-DEVICE" "8" "May 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-DEVICE" "8" "June 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-device\fR \- Manage remote network devices diff --git a/man/man8/puppet-doc.8 b/man/man8/puppet-doc.8 index 1a5598f6ade..9524c2e0f45 100644 --- a/man/man8/puppet-doc.8 +++ b/man/man8/puppet-doc.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-DOC" "8" "May 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-DOC" "8" "June 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-doc\fR \- Generate Puppet references diff --git a/man/man8/puppet-epp.8 b/man/man8/puppet-epp.8 index 451b6db6a0d..9403650347d 100644 --- a/man/man8/puppet-epp.8 +++ b/man/man8/puppet-epp.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-EPP" "8" "May 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-EPP" "8" "June 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-epp\fR \- Interact directly with the EPP template parser/renderer\. diff --git a/man/man8/puppet-facts.8 b/man/man8/puppet-facts.8 index e48d30c506b..b95e267fb6f 100644 --- a/man/man8/puppet-facts.8 +++ b/man/man8/puppet-facts.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-FACTS" "8" "May 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-FACTS" "8" "June 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-facts\fR \- Retrieve and store facts\. diff --git a/man/man8/puppet-filebucket.8 b/man/man8/puppet-filebucket.8 index a4b699a7fb5..a615ada256e 100644 --- a/man/man8/puppet-filebucket.8 +++ b/man/man8/puppet-filebucket.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-FILEBUCKET" "8" "May 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-FILEBUCKET" "8" "June 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-filebucket\fR \- Store and retrieve files in a filebucket diff --git a/man/man8/puppet-generate.8 b/man/man8/puppet-generate.8 index bbc3f89e95c..aac9ec46894 100644 --- a/man/man8/puppet-generate.8 +++ b/man/man8/puppet-generate.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-GENERATE" "8" "May 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-GENERATE" "8" "June 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-generate\fR \- Generates Puppet code from Ruby definitions\. diff --git a/man/man8/puppet-help.8 b/man/man8/puppet-help.8 index b35c5ee48a3..eadb8b01e27 100644 --- a/man/man8/puppet-help.8 +++ b/man/man8/puppet-help.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-HELP" "8" "May 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-HELP" "8" "June 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-help\fR \- Display Puppet help\. diff --git a/man/man8/puppet-lookup.8 b/man/man8/puppet-lookup.8 index 37128c663de..267a7cdbc09 100644 --- a/man/man8/puppet-lookup.8 +++ b/man/man8/puppet-lookup.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-LOOKUP" "8" "May 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-LOOKUP" "8" "June 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-lookup\fR \- Interactive Hiera lookup diff --git a/man/man8/puppet-module.8 b/man/man8/puppet-module.8 index 90d0c11daa4..f09ba5c5a68 100644 --- a/man/man8/puppet-module.8 +++ b/man/man8/puppet-module.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-MODULE" "8" "May 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-MODULE" "8" "June 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-module\fR \- Creates, installs and searches for modules on the Puppet Forge\. diff --git a/man/man8/puppet-node.8 b/man/man8/puppet-node.8 index 85f859730f2..20ce6f75b60 100644 --- a/man/man8/puppet-node.8 +++ b/man/man8/puppet-node.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-NODE" "8" "May 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-NODE" "8" "June 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-node\fR \- View and manage node definitions\. diff --git a/man/man8/puppet-parser.8 b/man/man8/puppet-parser.8 index 2d563f6b57b..5ae92f28ae7 100644 --- a/man/man8/puppet-parser.8 +++ b/man/man8/puppet-parser.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-PARSER" "8" "May 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-PARSER" "8" "June 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-parser\fR \- Interact directly with the parser\. diff --git a/man/man8/puppet-plugin.8 b/man/man8/puppet-plugin.8 index 467432bfab9..a0752581363 100644 --- a/man/man8/puppet-plugin.8 +++ b/man/man8/puppet-plugin.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-PLUGIN" "8" "May 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-PLUGIN" "8" "June 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-plugin\fR \- Interact with the Puppet plugin system\. diff --git a/man/man8/puppet-report.8 b/man/man8/puppet-report.8 index ad9690f003c..aa4e127ee34 100644 --- a/man/man8/puppet-report.8 +++ b/man/man8/puppet-report.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-REPORT" "8" "May 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-REPORT" "8" "June 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-report\fR \- Create, display, and submit reports\. diff --git a/man/man8/puppet-resource.8 b/man/man8/puppet-resource.8 index 7b065f5b66b..7c41ac05061 100644 --- a/man/man8/puppet-resource.8 +++ b/man/man8/puppet-resource.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-RESOURCE" "8" "May 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-RESOURCE" "8" "June 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-resource\fR \- The resource abstraction layer shell diff --git a/man/man8/puppet-script.8 b/man/man8/puppet-script.8 index 1bf11d42838..3bf7a70e77d 100644 --- a/man/man8/puppet-script.8 +++ b/man/man8/puppet-script.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-SCRIPT" "8" "May 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-SCRIPT" "8" "June 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-script\fR \- Run a puppet manifests as a script without compiling a catalog diff --git a/man/man8/puppet-ssl.8 b/man/man8/puppet-ssl.8 index 031c94b4163..dffbbc2c24d 100644 --- a/man/man8/puppet-ssl.8 +++ b/man/man8/puppet-ssl.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-SSL" "8" "May 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-SSL" "8" "June 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-ssl\fR \- Manage SSL keys and certificates for puppet SSL clients diff --git a/man/man8/puppet.8 b/man/man8/puppet.8 index fa430bca6eb..b90beff9da7 100644 --- a/man/man8/puppet.8 +++ b/man/man8/puppet.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET" "8" "May 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET" "8" "June 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\fR From bba6919361f25c8709d3744d6e0f3bd2e43ee785 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Fri, 4 Jun 2021 13:30:01 +0200 Subject: [PATCH 381/731] (maint) Remove unsupported util/dev-puppet-master This script stats the old puppet master that's been removed in Puppet 6. Keeping this in just makes things confusing. --- util/README_UTIL.md | 40 ---------------------------------------- util/dev-puppet-master | 23 ----------------------- 2 files changed, 63 deletions(-) delete mode 100755 util/dev-puppet-master diff --git a/util/README_UTIL.md b/util/README_UTIL.md index e0b340c0ab4..eb7e112bacc 100644 --- a/util/README_UTIL.md +++ b/util/README_UTIL.md @@ -20,46 +20,6 @@ will begin bisecting runs before and after this spec until it narrows down to a To get the groups that the parallel task is running, run: be util/rspec_grouper 1000. Then run each spit out file with "be util/rspec_runner ". If it fails, rename it to spec_order.txt and run the binary script. -dev-puppet-master ------------------ - -This script is very helpful for setting up a local puppet master daemon which you can then interrogate with other puppet 'app' calls such as puppet cert or puppet agent. I'm not sure who wrote it originally. - -There are a few steps needed to get this configured properly. - -* /etc/hosts needs a 'puppetmaster' added to its localhost entry - -The dev-puppet-master script calls `puppet master` with --certname=puppetmaster, and this needs to resolve locally. - -You can execute the dev-puppet-master script with a name for the sandbox configuration directory (which will be placed in ~/test/master) or it will use 'default'. - -* ./util/dev-puppet-master bar-env - -(places conf and var info in ~/tests/master/bar-env for instance) - -You should now be able to do things like: - - jpartlow@percival:~/work/puppet$ bundler exec puppet agent -t --server puppetmaster - Info: Creating a new SSL key for percival.corp.puppetlabs.net - Info: Caching certificate for ca - Info: Creating a new SSL certificate request for percival.corp.puppetlabs.net - Info: Certificate Request fingerprint (SHA256): 1B:DE:91:8C:AE:10:1B:18:0D:67:9D:4B:87:F1:26:19:6D:C6:37:35:F6:64:40:90:CF:FC:BE:8F:6F:C9:8D:D4 - Info: Caching certificate for percival.corp.puppetlabs.net - Info: Caching certificate_revocation_list for ca - Info: Retrieving plugin - Info: Caching catalog for percival.corp.puppetlabs.net - Info: Applying configuration version '1374193823' - Info: Creating state file /home/jpartlow/.puppet/var/state/state.yaml - Notice: Finished catalog run in 0.04 seconds - -For an agent run (or any command you want to call the server), you must specify '--server puppetmaster'. - -To check the puppetmaster's certs, you instead would need to specify the confdir/vardir: - - jpartlow@percival:~/work/puppet$ bundler exec puppet cert list --all --confdir=~/test/master/default --vardir= ~/test/master/default/ - + "percival.corp.puppetlabs.net" (SHA256) 0D:8D:A4:F1:19:E3:7A:62:ED:ED:21:B4:76:FE:04:47:50:01:20:4A:04:48:09:3A:1A:98:86:4A:08:8D:46:F0 - + "puppetmaster" (SHA256) B9:F5:06:F4:74:3B:15:CE:7C:7B:A6:38:83:0E:30:6A:6F:DC:F4:FD:FF:B1:A9:8A:35:12:90:10:26:46:C2:A6 (alt names: "DNS:percival.corp.puppetlabs.net", "DNS:puppet", "DNS:puppet.corp.puppetlabs.net", "DNS:puppetmaster") - ### Curl For simple cases of testing REST API via curl: diff --git a/util/dev-puppet-master b/util/dev-puppet-master deleted file mode 100755 index 513a40307b8..00000000000 --- a/util/dev-puppet-master +++ /dev/null @@ -1,23 +0,0 @@ -#/bin/sh -name="default" - -if [ $# -gt 0 ]; then - name="$1" - shift 1 -fi - -export dir="${HOME}/test/master/${name}" -mkdir -p "${dir}" - -if [ ! -f $dir/auth.conf ]; then - # Edit this file to change default puppet authorizations. - cp ./conf/auth.conf "${dir}/auth.conf" -fi -mkdir -p "${dir}/manifests" -touch "${dir}/manifests/site.pp" - -# Work around Redmine #21908 where the master generates a warning if agent pluginsyncs -# and there isn't at least one module with a libdir. -mkdir -p "${dir}/modules/foo/lib" - -bundle exec puppet master --no-daemonize --autosign=true --confdir="$dir" --vardir="${dir}" --certname puppetmaster "$@" From 8b1a992b43849a86d5b5f1605c59b3d38b930f5f Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Tue, 8 Jun 2021 18:25:06 -0700 Subject: [PATCH 382/731] (maint) Drop private key passphrase workaround Ruby 2.4.0 and 2.4.1 required a password of at least 4 bytes to prevent openssl from prompting for a passphrase, even if one wasn't required. This was fixed in ruby/openssl 2.0.5, which was first included in ruby 2.5.0[1], so we can drop our workaround. [1] https://github.com/ruby/ruby/commit/df94c66f71448cf30b34375349fd201d1d035423 --- lib/puppet/x509/cert_provider.rb | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/puppet/x509/cert_provider.rb b/lib/puppet/x509/cert_provider.rb index 7f38216608b..5e185da733f 100644 --- a/lib/puppet/x509/cert_provider.rb +++ b/lib/puppet/x509/cert_provider.rb @@ -207,10 +207,7 @@ def load_private_key(name, required: false, password: nil) # @api private def load_private_key_from_pem(pem, password: nil) # set a non-nil password to ensure openssl doesn't prompt - # but ruby 2.4.0 & 2.4.1 require at least 4 bytes due to - # https://github.com/ruby/openssl/commit/f38501249f33bff7ca9d208670b8cde695ea8b7b - # and corrected in https://github.com/ruby/openssl/commit/a896c3d1dfa090e92dec1abf8ac12843af6af721 - password ||= ' ' + password ||= '' # Can't use OpenSSL::PKey.read, because it's broken in MRI 2.3, doesn't exist # in JRuby 9.1, and is broken in JRuby 9.2 From 8ac279df618bfa466f65dc152466ba2f2c83d7c7 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Wed, 9 Jun 2021 10:29:50 -0700 Subject: [PATCH 383/731] (maint) Drop some ruby+openssl monkey patches Ruby 2.5.0 bumped ruby/openssl from 2.0.5 to 2.1.0.beta1[1], which added the `OpenSSL::SSL::TLS1_VERSION` constant and is supported in jruby-openssl. Since puppet requires 2.5 or greater we can drop those patches. [1] https://github.com/ruby/ruby/commit/609103dbb5fb182eec12f052226c43e39b907682 --- lib/puppet/util/monkey_patches.rb | 7 ------- 1 file changed, 7 deletions(-) diff --git a/lib/puppet/util/monkey_patches.rb b/lib/puppet/util/monkey_patches.rb index d2903b7b0b1..f5248a4275f 100644 --- a/lib/puppet/util/monkey_patches.rb +++ b/lib/puppet/util/monkey_patches.rb @@ -32,13 +32,6 @@ def daemonize # (#19151) Reject all SSLv2 ciphers and handshakes require_relative '../../puppet/ssl/openssl_loader' unless Puppet::Util::Platform.jruby_fips? - unless defined?(OpenSSL::SSL::TLS1_VERSION) - module OpenSSL::SSL - # see https://github.com/ruby/ruby/commit/609103dbb5fb182eec12f052226c43e39b907682#diff-09f822c26289f5347111795ca22ed7ed1cfadd6ebd28f987991d1d414eef565aR2755-R2759 - OpenSSL::SSL::TLS1_VERSION = 0x301 - end - end - class OpenSSL::SSL::SSLContext if DEFAULT_PARAMS[:options] DEFAULT_PARAMS[:options] |= OpenSSL::SSL::OP_NO_SSLv2 | OpenSSL::SSL::OP_NO_SSLv3 From 0e68cf74dd4ee0da01155e46d62a45299e81bcd8 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Wed, 9 Jun 2021 10:59:38 -0700 Subject: [PATCH 384/731] (maint) Simply to_utf8 monkey patch Ruby 2.5.0 supports OpenSSL::X509::Name#to_utf8, but jruby-openssl does not. So simplify the monkey patch for JRuby and continue to only use RFC2253 format, because masking off ~ASN1_STRFLGS_ESC_MSB produces the wrong output: dn = OpenSSL::X509::Name.parse('/DC=com').to_s(OpenSSL::X509::Name::RFC2253 & ~4) => "/DC=com" dn = OpenSSL::X509::Name.parse('/DC=com').to_s(OpenSSL::X509::Name::RFC2253) => "DC=com" --- lib/puppet/util/monkey_patches.rb | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/lib/puppet/util/monkey_patches.rb b/lib/puppet/util/monkey_patches.rb index f5248a4275f..71415e10f39 100644 --- a/lib/puppet/util/monkey_patches.rb +++ b/lib/puppet/util/monkey_patches.rb @@ -87,20 +87,12 @@ def set_default_paths OpenSSL::X509.const_set(:V_ERR_HOSTNAME_MISMATCH, 62) end + # jruby-openssl doesn't support this unless OpenSSL::X509::Name.instance_methods.include?(:to_utf8) class OpenSSL::X509::Name - # https://github.com/openssl/openssl/blob/OpenSSL_1_1_0j/include/openssl/asn1.h#L362 - ASN1_STRFLGS_ESC_MSB = 4 - - FLAGS = if RUBY_PLATFORM == 'java' - OpenSSL::X509::Name::RFC2253 - else - OpenSSL::X509::Name::RFC2253 & ~ASN1_STRFLGS_ESC_MSB - end - def to_utf8 # https://github.com/ruby/ruby/blob/v2_5_5/ext/openssl/ossl_x509name.c#L317 - str = to_s(FLAGS) + str = to_s(OpenSSL::X509::Name::RFC2253) str.force_encoding(Encoding::UTF_8) end end From 276c678ab657594ae463d89a327cac069600bd40 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Wed, 9 Jun 2021 13:45:32 -0700 Subject: [PATCH 385/731] (PUP-11049) Update external encoding tests on Windows for Ruby 3 The lexer and dependency_loader issues are still tested in older ruby versions on Windows, so we don't need to fail the test on Ruby 3. The util/env test is predicated on ruby returning environment values that aren't UTF-8, so skip it when ruby version is 3 or greater. --- spec/unit/pops/loaders/dependency_loader_spec.rb | 9 --------- spec/unit/pops/parser/lexer2_spec.rb | 4 ---- spec/unit/util_spec.rb | 4 +--- 3 files changed, 1 insertion(+), 16 deletions(-) diff --git a/spec/unit/pops/loaders/dependency_loader_spec.rb b/spec/unit/pops/loaders/dependency_loader_spec.rb index 08fd8204de5..49e12b956b1 100644 --- a/spec/unit/pops/loaders/dependency_loader_spec.rb +++ b/spec/unit/pops/loaders/dependency_loader_spec.rb @@ -84,10 +84,6 @@ def foo context 'when loading files from disk' do it 'should always read files as UTF-8' do - if Puppet::Util::Platform.windows? && Encoding.default_external == Encoding::UTF_8 - raise 'This test must be run in a codepage other than 65001 to validate behavior' - end - module_dir = dir_containing('testmodule', { 'lib' => { 'puppet' => { 'functions' => { 'testmodule' => { 'foo.rb' => code_utf8 @@ -101,11 +97,6 @@ def foo it 'currently ignores the UTF-8 BOM (Byte Order Mark) when loading module files' do bom = "\uFEFF" - - if Puppet::Util::Platform.windows? && Encoding.default_external == Encoding::UTF_8 - raise 'This test must be run in a codepage other than 65001 to validate behavior' - end - module_dir = dir_containing('testmodule', { 'lib' => { 'puppet' => { 'functions' => { 'testmodule' => { 'foo.rb' => "#{bom}#{code_utf8}" diff --git a/spec/unit/pops/parser/lexer2_spec.rb b/spec/unit/pops/parser/lexer2_spec.rb index fddd649676e..b0ba5782627 100644 --- a/spec/unit/pops/parser/lexer2_spec.rb +++ b/spec/unit/pops/parser/lexer2_spec.rb @@ -918,10 +918,6 @@ def expect_issue(code, issue) context 'when lexing files from disk' do it 'should always read files as UTF-8' do - if Puppet::Util::Platform.windows? && Encoding.default_external == Encoding::UTF_8 - raise 'This test must be run in a codepage other than 65001 to validate behavior' - end - manifest_code = "notify { '#{rune_utf8}': }" manifest = file_containing('manifest.pp', manifest_code) lexed_file = described_class.new.lex_file(manifest) diff --git a/spec/unit/util_spec.rb b/spec/unit/util_spec.rb index 87bd9ccdfb1..f2be5f9305e 100644 --- a/spec/unit/util_spec.rb +++ b/spec/unit/util_spec.rb @@ -142,9 +142,7 @@ def withenv_utf8(&block) # In 2.3, the behavior is mostly correct when external codepage is 65001 / UTF-8 it "works around Ruby bug 8822 (which fails to preserve UTF-8 properly when accessing ENV) (Ruby >= 2.3.x) ", - :if => Puppet::Util::Platform.windows? do - - raise 'This test requires a non-UTF8 codepage' if Encoding.default_external == Encoding::UTF_8 + :if => Puppet::Util::Platform.windows? && RUBY_VERSION.to_f < 3 do withenv_utf8 do |utf_8_key, utf_8_value, codepage_key| # Ruby 2.3 fixes access by the original UTF-8 key, and behaves differently than 2.1 From 8412f5a27dd692a53347c732db631c16ca76447f Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Wed, 9 Jun 2021 14:17:18 -0700 Subject: [PATCH 386/731] (PUP-11049) Enable ruby 3 rspec tests --- .github/workflows/rspec_tests.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/rspec_tests.yaml b/.github/workflows/rspec_tests.yaml index 8bd0c0b6c9f..89b3d1aaa51 100644 --- a/.github/workflows/rspec_tests.yaml +++ b/.github/workflows/rspec_tests.yaml @@ -16,10 +16,12 @@ jobs: - {os: ubuntu-18.04, ruby: 2.5} - {os: ubuntu-18.04, ruby: 2.6} - {os: ubuntu-18.04, ruby: 2.7} + - {os: ubuntu-18.04, ruby: 3.0} - {os: ubuntu-18.04, ruby: jruby-9.2.9.0} - {os: windows-2016, ruby: 2.5} - {os: windows-2016, ruby: 2.6} - {os: windows-2016, ruby: 2.7} + - {os: windows-2016, ruby: 3.0} runs-on: ${{ matrix.cfg.os }} steps: From c642d6c79fa1e001d191781667b0c3a1a1664447 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Thu, 10 Jun 2021 12:49:04 -0700 Subject: [PATCH 387/731] (PUP-7315) Add test for interpolation of lookup options Verify interpolation within lookup options works. --- spec/unit/functions/lookup_spec.rb | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/spec/unit/functions/lookup_spec.rb b/spec/unit/functions/lookup_spec.rb index 0dc8eb4d49b..9377d4b7a03 100644 --- a/spec/unit/functions/lookup_spec.rb +++ b/spec/unit/functions/lookup_spec.rb @@ -3303,6 +3303,29 @@ def ruby_dig(segments, options, context) end end + context 'using options containing intepolated paths to the key pair' do + let(:scope_additions) { { 'priv_path' => private_key_path, 'pub_path' => public_key_path } } + + let(:hiera_yaml) do + <<-YAML.unindent + version: 5 + defaults: + datadir: #{code_dir}/hieradata + hierarchy: + - name: "secret data" + lookup_key: eyaml_lookup_key + path: common.eyaml + options: + pkcs7_private_key: "%{priv_path}" + pkcs7_public_key: "%{pub_path}" + YAML + end + + it 'finds data in the global layer' do + expect(lookup('a')).to eql("Encrypted value 'a' (from global)") + end + end + context 'with special extension declared in options' do let(:environment_files) { {} } let(:hiera_yaml) do From 59ac9fee264d9840fb0f38278e835f5f92168270 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Thu, 10 Jun 2021 21:40:40 -0700 Subject: [PATCH 388/731] (PUP-4884) Clean forge cache base directory On Windows the default forge cache base directory is created from Dir.mktmpdir and contains forward slashes: "C:/Users/josh/AppData/Local/Temp/...". When unpacking a tarball we check that the entry to be unpacked has the same prefix. The prefix is the result of File.expand_path, which also returns a path with forward slashes. When the cache base directory is changed to a Windows native path, e.g. C:\Temp, to work around long file path issues, the check will fail. This commit cleans the base_dir and the tar entry, so that the comparison is always done using forward slashes. --- lib/puppet/forge/cache.rb | 2 +- lib/puppet/module_tool/tar/mini.rb | 2 +- spec/unit/module_tool/applications/installer_spec.rb | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/puppet/forge/cache.rb b/lib/puppet/forge/cache.rb index 69b58937926..73891a6ab2d 100644 --- a/lib/puppet/forge/cache.rb +++ b/lib/puppet/forge/cache.rb @@ -47,7 +47,7 @@ def path # Return the base Pathname for all the caches. def self.base_path - (Pathname(Puppet.settings[:module_working_dir]) + 'cache').tap do |o| + (Pathname(Puppet.settings[:module_working_dir]) + 'cache').cleanpath.tap do |o| o.mkpath unless o.exist? end end diff --git a/lib/puppet/module_tool/tar/mini.rb b/lib/puppet/module_tool/tar/mini.rb index 69d9868f0bb..bfd368b8852 100644 --- a/lib/puppet/module_tool/tar/mini.rb +++ b/lib/puppet/module_tool/tar/mini.rb @@ -107,7 +107,7 @@ def validate_entry(destdir, path) raise Puppet::ModuleTool::Errors::InvalidPathInPackageError, :entry_path => path, :directory => destdir end - path = File.expand_path File.join(destdir, path) + path = Pathname.new(File.join(destdir, path)).cleanpath.to_path if path !~ /\A#{Regexp.escape destdir}/ raise Puppet::ModuleTool::Errors::InvalidPathInPackageError, :entry_path => path, :directory => destdir diff --git a/spec/unit/module_tool/applications/installer_spec.rb b/spec/unit/module_tool/applications/installer_spec.rb index 8a97e81186e..d79d25871d4 100644 --- a/spec/unit/module_tool/applications/installer_spec.rb +++ b/spec/unit/module_tool/applications/installer_spec.rb @@ -34,8 +34,7 @@ if Puppet::Util::Platform.windows? before :each do - allow(Puppet.settings).to receive(:[]) - allow(Puppet.settings).to receive(:[]).with(:module_working_dir).and_return(Dir.mktmpdir('installertmp')) + Puppet[:module_working_dir] = tmpdir('module_tool_install').gsub('/', '\\') end end From 9dd7efa29d4bfb1ac95236e1e0f817d2e65f387c Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Fri, 11 Jun 2021 07:38:27 +0000 Subject: [PATCH 389/731] (packaging) Bump to version '7.9.0' [no-promote] --- .gemspec | 2 +- lib/puppet/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gemspec b/.gemspec index 54f01af355e..ad779e0fcf2 100644 --- a/.gemspec +++ b/.gemspec @@ -13,7 +13,7 @@ Gem::Specification.new do |s| s.name = "puppet" - version = "7.8.0" + version = "7.9.0" mdata = version.match(/(\d+\.\d+\.\d+)/) s.version = mdata ? mdata[1] : version diff --git a/lib/puppet/version.rb b/lib/puppet/version.rb index b18c1eb2b97..2de9925aee1 100644 --- a/lib/puppet/version.rb +++ b/lib/puppet/version.rb @@ -6,7 +6,7 @@ # Raketasks and such to set the version based on the output of `git describe` module Puppet - PUPPETVERSION = '7.8.0' + PUPPETVERSION = '7.9.0' ## # version is a public API method intended to always provide a fast and From b2a72f7c2f51e24915f21dd00195e4c7aa446ce6 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Fri, 11 Jun 2021 07:53:44 +0000 Subject: [PATCH 390/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 2 +- man/man8/puppet.8 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index 1dce6db75d0..c2a17fa0845 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -913,7 +913,7 @@ The time to wait for data to be read from an HTTP connection\. If nothing is rea The HTTP User\-Agent string to send when making network requests\. . .IP "\(bu" 4 -\fIDefault\fR: \fBPuppet/7\.8\.0 Ruby/2\.5\.1\-p57 (x86_64\-linux)\fR +\fIDefault\fR: \fBPuppet/7\.9\.0 Ruby/2\.5\.1\-p57 (x86_64\-linux)\fR . .IP "" 0 . diff --git a/man/man8/puppet.8 b/man/man8/puppet.8 index b90beff9da7..8659e452672 100644 --- a/man/man8/puppet.8 +++ b/man/man8/puppet.8 @@ -25,4 +25,4 @@ Specialized: 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 . .P -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\.8\.0 +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\.9\.0 From 311f3b51803548c20780973c6815e4c535ee1706 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Tue, 15 Jun 2021 12:19:19 -0700 Subject: [PATCH 391/731] (PUP-7785) Remove dead code There isn't a `:mode` setting, so remove special case. --- lib/puppet/settings/config_file.rb | 9 +-------- spec/unit/settings/config_file_spec.rb | 12 +----------- 2 files changed, 2 insertions(+), 19 deletions(-) diff --git a/lib/puppet/settings/config_file.rb b/lib/puppet/settings/config_file.rb index 24c42444f03..db0539c7463 100644 --- a/lib/puppet/settings/config_file.rb +++ b/lib/puppet/settings/config_file.rb @@ -98,14 +98,7 @@ def unique_sections_in(ini, file, allowed_section_names) def parse_setting(setting, section) var = setting.name.intern - - # We don't want to munge modes, because they're specified in octal, so we'll - # just leave them as a String, since Puppet handles that case correctly. - if var == :mode - value = setting.value - else - value = @value_converter[setting.value] - end + value = @value_converter[setting.value] # Check to see if this is a file argument and it has extra options begin diff --git a/spec/unit/settings/config_file_spec.rb b/spec/unit/settings/config_file_spec.rb index 2bcd3c73967..d6f9a119a55 100644 --- a/spec/unit/settings/config_file_spec.rb +++ b/spec/unit/settings/config_file_spec.rb @@ -135,16 +135,6 @@ def the_parse_of(*lines) with_setting(:var, "value changed", NO_META))) end - it "does not try to transform an entry named 'mode'" do - config = Puppet::Settings::ConfigFile.new(Proc.new { raise "Should not transform" }) - - result = config.parse_file(filename, "mode = value") - - expect(result).to eq(Conf.new. - with_section(Section.new(:main). - with_setting(:mode, "value", NO_META))) - end - it "accepts non-UTF8 encoded text" do result = the_parse_of("var = value".encode("UTF-16LE")) @@ -152,6 +142,6 @@ def the_parse_of(*lines) with_section(Section.new(:main). with_setting(:var, "value", NO_META))) - end + end end From beba46207214521b58730f5a04680e9e524faddc Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Tue, 15 Jun 2021 15:02:50 -0700 Subject: [PATCH 392/731] (PUP-7785) Update tests to match reality The test defined settings with the same name as what's in defaults.rb, but the the test behaves differently than the actual settings like Puppet[:ca_port] which always returns an integer, not a string. --- spec/unit/settings_spec.rb | 42 +++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/spec/unit/settings_spec.rb b/spec/unit/settings_spec.rb index 6a46573ceb1..bade58e5290 100644 --- a/spec/unit/settings_spec.rb +++ b/spec/unit/settings_spec.rb @@ -1087,10 +1087,10 @@ def metadata(setting) context "when setting serverport and masterport" do before(:each) do @settings.define_settings :main, PuppetSpec::Settings::TEST_APP_DEFAULT_DEFINITIONS - @settings.define_settings :server, :masterport => { :desc => "a", :default => 1000 } + @settings.define_settings :server, :masterport => { :desc => "a", :default => 1000, :type => :port } @settings.define_settings :server, :serverport => { :type => :alias, :alias_for => :masterport } - @settings.define_settings :server, :ca_port => { :desc => "a", :default => "$serverport" } - @settings.define_settings :server, :report_port => { :desc => "a", :default => "$serverport" } + @settings.define_settings :server, :ca_port => { :desc => "a", :default => "$serverport", :type => :port } + @settings.define_settings :server, :report_port => { :desc => "a", :default => "$serverport", :type => :port } config_file = tmpfile('config') @settings[:config] = config_file @@ -1111,8 +1111,8 @@ def metadata(setting) end it { expect(@settings[:serverport]).to eq(444) } - it { expect(@settings[:ca_port]).to eq("444") } - it { expect(@settings[:report_port]).to eq("444") } + it { expect(@settings[:ca_port]).to eq(444) } + it { expect(@settings[:report_port]).to eq(444) } it { expect(@settings[:masterport]).to eq(445) } end @@ -1125,8 +1125,8 @@ def metadata(setting) end it { expect(@settings[:serverport]).to eq(445) } - it { expect(@settings[:ca_port]).to eq("445") } - it { expect(@settings[:report_port]).to eq("445") } + it { expect(@settings[:ca_port]).to eq(445) } + it { expect(@settings[:report_port]).to eq(445) } it { expect(@settings[:masterport]).to eq(444) } end @@ -1139,8 +1139,8 @@ def metadata(setting) end it { expect(@settings[:serverport]).to eq(445) } - it { expect(@settings[:ca_port]).to eq("445") } - it { expect(@settings[:report_port]).to eq("445") } + it { expect(@settings[:ca_port]).to eq(445) } + it { expect(@settings[:report_port]).to eq(445) } it { expect(@settings[:masterport]).to eq(444) } end @@ -1156,8 +1156,8 @@ def metadata(setting) end it { expect(@settings[:serverport]).to eq(445) } - it { expect(@settings[:ca_port]).to eq("445") } - it { expect(@settings[:report_port]).to eq("445") } + it { expect(@settings[:ca_port]).to eq(445) } + it { expect(@settings[:report_port]).to eq(445) } it { expect(@settings[:masterport]).to eq(444) } end @@ -1171,8 +1171,8 @@ def metadata(setting) end it { expect(@settings[:serverport]).to eq(444) } - it { expect(@settings[:ca_port]).to eq("444") } - it { expect(@settings[:report_port]).to eq("444") } + it { expect(@settings[:ca_port]).to eq(444) } + it { expect(@settings[:report_port]).to eq(444) } it { expect(@settings[:masterport]).to eq(445) } end @@ -1184,8 +1184,8 @@ def metadata(setting) end it { expect(@settings[:serverport]).to eq(445) } - it { expect(@settings[:ca_port]).to eq("445") } - it { expect(@settings[:report_port]).to eq("445") } + it { expect(@settings[:ca_port]).to eq(445) } + it { expect(@settings[:report_port]).to eq(445) } it { expect(@settings[:masterport]).to eq(445) } end @@ -1197,8 +1197,8 @@ def metadata(setting) end it { expect(@settings[:serverport]).to eq(445) } - it { expect(@settings[:ca_port]).to eq("445") } - it { expect(@settings[:report_port]).to eq("445") } + it { expect(@settings[:ca_port]).to eq(445) } + it { expect(@settings[:report_port]).to eq(445) } it { expect(@settings[:masterport]).to eq(445) } end @@ -1211,8 +1211,8 @@ def metadata(setting) it { expect(@settings[:serverport]).to eq(445) } it { expect(@settings[:masterport]).to eq(1000) } - it { expect(@settings[:ca_port]).to eq("445") } - it { expect(@settings[:report_port]).to eq("445") } + it { expect(@settings[:ca_port]).to eq(445) } + it { expect(@settings[:report_port]).to eq(445) } end context 'with serverport in main' do @@ -1224,8 +1224,8 @@ def metadata(setting) it { expect(@settings[:serverport]).to eq(445) } it { expect(@settings[:masterport]).to eq(1000) } - it { expect(@settings[:ca_port]).to eq("445") } - it { expect(@settings[:report_port]).to eq("445") } + it { expect(@settings[:ca_port]).to eq(445) } + it { expect(@settings[:report_port]).to eq(445) } end end From 22699d4a48a1e093ffe611c11e93f886845ff7b0 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Wed, 16 Jun 2021 12:52:33 +0000 Subject: [PATCH 393/731] (packaging) Updating the puppet.pot file --- locales/puppet.pot | 134 ++++++++++++++++++++++++--------------------- 1 file changed, 71 insertions(+), 63 deletions(-) diff --git a/locales/puppet.pot b/locales/puppet.pot index 97373f04996..a074c5cede3 100644 --- a/locales/puppet.pot +++ b/locales/puppet.pot @@ -6,11 +6,11 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Puppet automation framework 7.7.0-19-gf6adbd522b\n" +"Project-Id-Version: Puppet automation framework 7.8.0-32-gdd314abb53\n" "\n" "Report-Msgid-Bugs-To: https://tickets.puppetlabs.com\n" -"POT-Creation-Date: 2021-05-27 07:22+0000\n" -"PO-Revision-Date: 2021-05-27 07:22+0000\n" +"POT-Creation-Date: 2021-06-16 12:52+0000\n" +"PO-Revision-Date: 2021-06-16 12:52+0000\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -2752,7 +2752,7 @@ msgstr "" msgid "Could not understand URL %{key}: %{detail}" msgstr "" -#: ../lib/puppet/indirector/resource/ral.rb:59 +#: ../lib/puppet/indirector/resource/ral.rb:64 msgid "Could not find type %{request_type}" msgstr "" @@ -6474,31 +6474,31 @@ msgstr "" msgid "NIM package provider is unable to downgrade packages" msgstr "" -#: ../lib/puppet/provider/package/nim.rb:212 +#: ../lib/puppet/provider/package/nim.rb:217 msgid "" "Unable to parse output from nimclient showres: line does not match expected package header format:\n" "'%{line}'" msgstr "" -#: ../lib/puppet/provider/package/nim.rb:219 +#: ../lib/puppet/provider/package/nim.rb:224 msgid "" "Unable to parse output from nimclient showres: package string does not match expected installp package string format:\n" "'%{package_string}'" msgstr "" -#: ../lib/puppet/provider/package/nim.rb:229 +#: ../lib/puppet/provider/package/nim.rb:234 msgid "" "Unable to parse output from nimclient showres: package string does not match expected rpm package string format:\n" "'%{package_string}'" msgstr "" -#: ../lib/puppet/provider/package/nim.rb:239 +#: ../lib/puppet/provider/package/nim.rb:244 msgid "" "Unable to parse output from nimclient showres: line does not match expected package line format:\n" "'%{line}'" msgstr "" -#: ../lib/puppet/provider/package/nim.rb:251 +#: ../lib/puppet/provider/package/nim.rb:256 msgid "" "Unrecognized package type specifier: '%{package_type_flag}' in package line:\n" "'%{line}'" @@ -6733,19 +6733,19 @@ msgstr "" msgid "Failed to read %{target}'s records when prefetching them. Reason: %{detail}" msgstr "" -#: ../lib/puppet/provider/parsedfile.rb:291 -msgid "Could not prefetch %{resource} provider '%{name}' target '%{target}': %{detail}. Treating as empty" +#: ../lib/puppet/provider/parsedfile.rb:284 ../lib/puppet/provider/parsedfile.rb:308 +msgid "Prefetching %{target} for provider %{name} returned nil" msgstr "" -#: ../lib/puppet/provider/parsedfile.rb:305 -msgid "Prefetching %{target} for provider %{name} returned nil" +#: ../lib/puppet/provider/parsedfile.rb:294 +msgid "Could not prefetch %{resource} provider '%{name}' target '%{target}': %{detail}. Treating as empty" msgstr "" -#: ../lib/puppet/provider/parsedfile.rb:378 +#: ../lib/puppet/provider/parsedfile.rb:381 msgid "Parsed Providers must define a default target" msgstr "" -#: ../lib/puppet/provider/parsedfile.rb:469 +#: ../lib/puppet/provider/parsedfile.rb:472 msgid "Somehow got told to prefetch with no resource set" msgstr "" @@ -7095,49 +7095,57 @@ msgstr "" msgid "Invalid setting type '%{type}'" msgstr "" -#: ../lib/puppet/settings.rb:911 +#: ../lib/puppet/settings.rb:874 +msgid "Cannot manage owner permissions, because the provider for '%{name}' is not functional" +msgstr "" + +#: ../lib/puppet/settings.rb:890 +msgid "Cannot manage group permissions, because the provider for '%{name}' is not functional" +msgstr "" + +#: ../lib/puppet/settings.rb:919 msgid "Unknown searchpath case: %{source_type} for the %{source} settings path element." msgstr "" -#: ../lib/puppet/settings.rb:984 +#: ../lib/puppet/settings.rb:992 msgid "setting definition for '%{name}' is not a hash!" msgstr "" -#: ../lib/puppet/settings.rb:989 +#: ../lib/puppet/settings.rb:997 msgid "Setting %{name} is already defined" msgstr "" -#: ../lib/puppet/settings.rb:995 +#: ../lib/puppet/settings.rb:1003 msgid "Setting %{name} is already using short name '%{short}'" msgstr "" -#: ../lib/puppet/settings.rb:1266 +#: ../lib/puppet/settings.rb:1274 msgid "Setting %{name} is deprecated." msgstr "" #. TRANSLATORS 'puppet.conf' is a file name and should not be translated -#: ../lib/puppet/settings.rb:1271 +#: ../lib/puppet/settings.rb:1279 msgid "Setting %{name} is deprecated in puppet.conf." msgstr "" -#: ../lib/puppet/settings.rb:1458 +#: ../lib/puppet/settings.rb:1466 msgid "Error converting value for param '%{name}': %{detail}" msgstr "" -#: ../lib/puppet/settings.rb:1482 +#: ../lib/puppet/settings.rb:1490 msgid "Could not find value for %{expression}" msgstr "" #. TRANSLATORS '$environment' is a Puppet specific variable and should not be translated -#: ../lib/puppet/settings.rb:1492 +#: ../lib/puppet/settings.rb:1500 msgid "You cannot interpolate $environment within '%{setting_name}' when using directory environments." msgstr "" -#: ../lib/puppet/settings.rb:1493 +#: ../lib/puppet/settings.rb:1501 msgid "Its value will remain %{value}." msgstr "" -#: ../lib/puppet/settings.rb:1524 +#: ../lib/puppet/settings.rb:1532 msgid "Attempt to assign a value to unknown setting %{name}" msgstr "" @@ -7291,7 +7299,7 @@ msgstr "" msgid "%{name} has not declared what class it wraps" msgstr "" -#: ../lib/puppet/ssl/base.rb:31 ../lib/puppet/x509/cert_provider.rb:370 +#: ../lib/puppet/ssl/base.rb:31 ../lib/puppet/x509/cert_provider.rb:367 msgid "Certname %{name} must not contain unprintable or non-ASCII characters" msgstr "" @@ -8121,7 +8129,7 @@ msgstr "" msgid "Ensure set to :present but file type is %{file_type} so no content will be synced" msgstr "" -#: ../lib/puppet/type/file/mode.rb:126 +#: ../lib/puppet/type/file/mode.rb:132 msgid "Not managing symlink mode" msgstr "" @@ -8234,7 +8242,7 @@ msgstr "" msgid "%{value} is not a valid day of the week" msgstr "" -#: ../lib/puppet/type/service.rb:151 ../lib/puppet/type/user.rb:271 +#: ../lib/puppet/type/service.rb:151 ../lib/puppet/type/user.rb:272 msgid "Passwords cannot include ':'" msgstr "" @@ -8277,81 +8285,81 @@ msgstr "" msgid "File does not exist" msgstr "" -#: ../lib/puppet/type/user.rb:182 +#: ../lib/puppet/type/user.rb:183 msgid "Could not find group(s) %{groups}" msgstr "" -#: ../lib/puppet/type/user.rb:291 +#: ../lib/puppet/type/user.rb:292 msgid "Password minimum age must be provided as a number." msgstr "" -#: ../lib/puppet/type/user.rb:310 +#: ../lib/puppet/type/user.rb:311 msgid "Password maximum age must be provided as a number." msgstr "" -#: ../lib/puppet/type/user.rb:341 +#: ../lib/puppet/type/user.rb:342 msgid "Group names must be provided, not GID numbers." msgstr "" -#: ../lib/puppet/type/user.rb:343 +#: ../lib/puppet/type/user.rb:344 msgid "Group names must be provided as an array, not a comma-separated list." msgstr "" -#: ../lib/puppet/type/user.rb:344 +#: ../lib/puppet/type/user.rb:345 msgid "Group names must not be empty. If you want to specify \"no groups\" pass an empty array" msgstr "" -#: ../lib/puppet/type/user.rb:437 +#: ../lib/puppet/type/user.rb:438 msgid "User provider %{name} can not manage home directories" msgstr "" #. TRANSLATORS YYYY-MM-DD represents a date with a four-digit year, a two-digit month, and a two-digit day, #. TRANSLATORS separated by dashes. -#: ../lib/puppet/type/user.rb:454 +#: ../lib/puppet/type/user.rb:455 msgid "Expiry dates must be YYYY-MM-DD or the string \"absent\"" msgstr "" -#: ../lib/puppet/type/user.rb:521 +#: ../lib/puppet/type/user.rb:522 msgid "Role names must be provided, not numbers" msgstr "" -#: ../lib/puppet/type/user.rb:523 +#: ../lib/puppet/type/user.rb:524 msgid "Role names must be provided as an array, not a comma-separated list" msgstr "" -#: ../lib/puppet/type/user.rb:560 +#: ../lib/puppet/type/user.rb:561 msgid "Auth names must be provided, not numbers" msgstr "" -#: ../lib/puppet/type/user.rb:562 +#: ../lib/puppet/type/user.rb:563 msgid "Auth names must be provided as an array, not a comma-separated list" msgstr "" -#: ../lib/puppet/type/user.rb:586 +#: ../lib/puppet/type/user.rb:587 msgid "Profile names must be provided, not numbers" msgstr "" -#: ../lib/puppet/type/user.rb:588 +#: ../lib/puppet/type/user.rb:589 msgid "Profile names must be provided as an array, not a comma-separated list" msgstr "" -#: ../lib/puppet/type/user.rb:699 +#: ../lib/puppet/type/user.rb:701 msgid "Ssh_authorized_key type is not available. Cannot purge SSH keys." msgstr "" -#: ../lib/puppet/type/user.rb:737 +#: ../lib/puppet/type/user.rb:739 msgid "Each entry for purge_ssh_keys must be a string, not a %{klass}" msgstr "" -#: ../lib/puppet/type/user.rb:740 +#: ../lib/puppet/type/user.rb:742 msgid "Paths to keyfiles must be absolute, not %{entry}" msgstr "" -#: ../lib/puppet/type/user.rb:744 +#: ../lib/puppet/type/user.rb:746 msgid "purge_ssh_keys must be true, false, or an array of file names, not %{value}" msgstr "" -#: ../lib/puppet/type/user.rb:772 +#: ../lib/puppet/type/user.rb:755 msgid "Class name must be provided." msgstr "" @@ -9147,39 +9155,39 @@ msgstr "" msgid "Invalid %{klass}: %{id}" msgstr "" -#: ../lib/puppet/util/symbolic_file_mode.rb:37 +#: ../lib/puppet/util/symbolic_file_mode.rb:49 msgid "An empty mode string is illegal" msgstr "" -#: ../lib/puppet/util/symbolic_file_mode.rb:41 +#: ../lib/puppet/util/symbolic_file_mode.rb:53 msgid "Numeric modes must be in octal, not decimal!" msgstr "" -#: ../lib/puppet/util/symbolic_file_mode.rb:44 +#: ../lib/puppet/util/symbolic_file_mode.rb:56 msgid "non-numeric current mode (%{mode})" msgstr "" -#: ../lib/puppet/util/symbolic_file_mode.rb:64 +#: ../lib/puppet/util/symbolic_file_mode.rb:76 msgid "Missing action" msgstr "" -#: ../lib/puppet/util/symbolic_file_mode.rb:79 +#: ../lib/puppet/util/symbolic_file_mode.rb:91 msgid "Missing operation (-, =, or +)" msgstr "" -#: ../lib/puppet/util/symbolic_file_mode.rb:101 +#: ../lib/puppet/util/symbolic_file_mode.rb:113 msgid "X only works with the '+' operator" msgstr "" -#: ../lib/puppet/util/symbolic_file_mode.rb:112 +#: ../lib/puppet/util/symbolic_file_mode.rb:124 msgid "internal error" msgstr "" -#: ../lib/puppet/util/symbolic_file_mode.rb:116 +#: ../lib/puppet/util/symbolic_file_mode.rb:128 msgid "Unknown operation" msgstr "" -#: ../lib/puppet/util/symbolic_file_mode.rb:131 +#: ../lib/puppet/util/symbolic_file_mode.rb:143 msgid "%{error}%{rest} in symbolic mode %{modification}" msgstr "" @@ -9651,26 +9659,26 @@ msgstr "" msgid "Failed to load private key for '%{name}'" msgstr "" -#: ../lib/puppet/x509/cert_provider.rb:255 +#: ../lib/puppet/x509/cert_provider.rb:252 msgid "Failed to save client certificate for '%{name}'" msgstr "" -#: ../lib/puppet/x509/cert_provider.rb:271 +#: ../lib/puppet/x509/cert_provider.rb:268 msgid "The client certificate is missing from '%{path}'" msgstr "" -#: ../lib/puppet/x509/cert_provider.rb:275 +#: ../lib/puppet/x509/cert_provider.rb:272 msgid "Failed to load client certificate for '%{name}'" msgstr "" -#: ../lib/puppet/x509/cert_provider.rb:324 +#: ../lib/puppet/x509/cert_provider.rb:321 msgid "Failed to save certificate request for '%{name}'" msgstr "" -#: ../lib/puppet/x509/cert_provider.rb:340 +#: ../lib/puppet/x509/cert_provider.rb:337 msgid "Failed to load certificate request for '%{name}'" msgstr "" -#: ../lib/puppet/x509/cert_provider.rb:353 +#: ../lib/puppet/x509/cert_provider.rb:350 msgid "Failed to delete certificate request for '%{name}'" msgstr "" From eeb61d1c64ecd5ef5b72d06cbb2d040d6916cb4d Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Tue, 15 Jun 2021 14:03:23 -0700 Subject: [PATCH 394/731] (PUP-7785) Don't prematurely convert setting values It was not possible to set a setting to a string consisting of all digits such as `certname=000000000180`. This occurred, because the ConfigFile class prematurely converted any value that matched /\d+/ to an integer and Ruby will raise when given `Integer('000000000180')`. Similar problems were reported with the `environment` setting. The problem is that the conversion is done before we know the setting's type. The conversion is also only done when parsing puppet.conf or CLI arguments. So the value as stored in memory could be a string (if that was the default value), or it could be an integer (if set in puppet.conf). This change means settings must explicitly convert to an integer in their "munge" method which is called during interpolation. This is already done for autosign, duration, integer, port, priority and ttl settings. --- lib/puppet/settings/value_translator.rb | 1 - spec/integration/defaults_spec.rb | 5 +++++ spec/unit/settings/value_translator_spec.rb | 9 ++++----- spec/unit/settings_spec.rb | 4 ++-- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/lib/puppet/settings/value_translator.rb b/lib/puppet/settings/value_translator.rb index 58a3e278a15..2cbbc8a20ac 100644 --- a/lib/puppet/settings/value_translator.rb +++ b/lib/puppet/settings/value_translator.rb @@ -5,7 +5,6 @@ def [](value) return case value when /^false$/i; false when /^true$/i; true - when /^\d+$/i; Integer(value) when true; true when false; false else diff --git a/spec/integration/defaults_spec.rb b/spec/integration/defaults_spec.rb index 2adb87907f6..d3e3cea27b7 100644 --- a/spec/integration/defaults_spec.rb +++ b/spec/integration/defaults_spec.rb @@ -48,6 +48,11 @@ it "should fail if the certname is not downcased" do expect { Puppet.settings[:certname] = "Host.Domain.Com" }.to raise_error(ArgumentError) end + + it 'can set it to a value containing all digits' do + Puppet.settings[:certname] = "000000000180" + expect(Puppet.settings[:certname]).to eq("000000000180") + end end describe "when setting :node_name_value" do diff --git a/spec/unit/settings/value_translator_spec.rb b/spec/unit/settings/value_translator_spec.rb index 46062f371db..9624436cb15 100644 --- a/spec/unit/settings/value_translator_spec.rb +++ b/spec/unit/settings/value_translator_spec.rb @@ -25,13 +25,12 @@ end context "numbers" do - it "translates integer strings to integers" do - expect(translator["1"]).to eq(1) - expect(translator["2"]).to eq(2) + it "leaves integer strings" do + expect(translator["1"]).to eq("1") end - it "translates numbers starting with a 0 as octal" do - expect(translator["011"]).to eq(9) + it "leaves octal numbers as strings" do + expect(translator["011"]).to eq("011") end it "leaves hex numbers as strings" do diff --git a/spec/unit/settings_spec.rb b/spec/unit/settings_spec.rb index bade58e5290..68e5b0b33f6 100644 --- a/spec/unit/settings_spec.rb +++ b/spec/unit/settings_spec.rb @@ -1024,7 +1024,7 @@ def metadata(setting) expect(@settings[:two]).to eq(false) end - it "should convert integers in the configuration file into Ruby Integers" do + it "doesn't convert integers in the configuration file" do File.write(@file, <<~CONF) [main] one = 65 @@ -1032,7 +1032,7 @@ def metadata(setting) @settings.initialize_global_settings - expect(@settings[:one]).to eq(65) + expect(@settings[:one]).to eq('65') end it "should support specifying all metadata (owner, group, mode) in the configuration file" do From e6ba8f934542c05b17ad96293e523122c6bc66d5 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Thu, 17 Jun 2021 10:10:38 +0000 Subject: [PATCH 395/731] (packaging) Updating manpage file for main --- man/man8/puppet-facts.8 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/man/man8/puppet-facts.8 b/man/man8/puppet-facts.8 index b95e267fb6f..2591510b82d 100644 --- a/man/man8/puppet-facts.8 +++ b/man/man8/puppet-facts.8 @@ -7,7 +7,7 @@ \fBpuppet\-facts\fR \- Retrieve and store facts\. . .SH "SYNOPSIS" -puppet facts \fIaction\fR [\-\-terminus _TERMINUS] [\-\-extra HASH] +puppet facts \fIaction\fR [\-\-terminus _TERMINUS] . .SH "DESCRIPTION" This subcommand manages facts, which are collections of normalized system information used by Puppet\. It can read facts directly from the local system (with the default \fBfacter\fR terminus)\. @@ -51,7 +51,7 @@ The terminus for an action is often determined by context, but occasionally need \fBSYNOPSIS\fR . .IP -puppet facts find [\-\-terminus _TERMINUS] [\-\-extra HASH] [\fInode_certname\fR] +puppet facts find [\-\-terminus _TERMINUS] [\fInode_certname\fR] . .IP \fBDESCRIPTION\fR @@ -79,7 +79,7 @@ When using the \fBfacter\fR terminus, the host argument is ignored\. \fBSYNOPSIS\fR . .IP -puppet facts info [\-\-terminus _TERMINUS] [\-\-extra HASH] +puppet facts info [\-\-terminus _TERMINUS] . .IP \fBDESCRIPTION\fR @@ -92,7 +92,7 @@ Prints the default terminus class for this subcommand\. Note that different run \fBSYNOPSIS\fR . .IP -puppet facts save [\-\-terminus _TERMINUS] [\-\-extra HASH] \fIkey\fR +puppet facts save [\-\-terminus _TERMINUS] \fIkey\fR . .IP \fBDESCRIPTION\fR @@ -105,7 +105,7 @@ API only: create or overwrite an object\. As the Faces framework does not curren \fBSYNOPSIS\fR . .IP -puppet facts [\-\-terminus _TERMINUS] [\-\-extra HASH] [\-\-config\-file \fIpath\fR] [\-\-custom\-dir \fIpath\fR] [\-\-external\-dir \fIpath\fR] [\-\-no\-block] [\-\-no\-cache] [\-\-show\-legacy] [\-\-value\-only] [\-\-timing] [\fIfacts\fR] +puppet facts [\-\-terminus _TERMINUS] [\-\-config\-file \fIpath\fR] [\-\-custom\-dir \fIpath\fR] [\-\-external\-dir \fIpath\fR] [\-\-no\-block] [\-\-no\-cache] [\-\-show\-legacy] [\-\-value\-only] [\-\-timing] [\fIfacts\fR] . .IP \fBDESCRIPTION\fR @@ -151,7 +151,7 @@ The output of facter with added puppet specific facts\. \fBSYNOPSIS\fR . .IP -puppet facts upload [\-\-terminus _TERMINUS] [\-\-extra HASH] +puppet facts upload [\-\-terminus _TERMINUS] . .IP \fBDESCRIPTION\fR From 78712feb5dd54565d6a86be341410b0c3e04aab6 Mon Sep 17 00:00:00 2001 From: Maggie Dreyer Date: Tue, 15 Jun 2021 15:21:00 -0700 Subject: [PATCH 396/731] (PUP-11082) Use built-in OpenSSL::PKey.read This commit switches our code that reads private keys to use Ruby's built-in `PKey.read` method, instead of constructing `PKey` objects directly. Previously, we couldn't use this function because it was broken in older versions of Ruby, and the code that calls it was used in JRuby, where `PKey.read` is still broken. But we no longer load private keys in JRuby, and in Puppet 7 we no longer support the older versions of Ruby where `PKey.read` was broken. So it is now safe to use the more robust API method. This enables us to correctly read elliptic curve keys in PKCS#8 format, which is now the standard. It uses the "BEGIN PRIVATE KEY" header, which is also readable by the Java code on the server. Previously we required EC keys to begin with "BEGIN EC PRIVATE KEY", which is not supported by Bouncy Castle. Because JRuby does not support `PKey.read`, this commit also skips running some additional tests that no longer work correctly when run in JRuby. (PUP-11082) Skip private key loading tests on JRuby --- lib/puppet/x509/cert_provider.rb | 17 +------------- spec/fixtures/ssl/ec-key-openssl.pem | 8 +++++++ spec/fixtures/ssl/ec-key-pk8.pem | 5 ++++ spec/unit/ssl/ssl_provider_spec.rb | 34 +++++++++++++++------------- spec/unit/x509/cert_provider_spec.rb | 10 +++++++- 5 files changed, 41 insertions(+), 33 deletions(-) create mode 100644 spec/fixtures/ssl/ec-key-openssl.pem create mode 100644 spec/fixtures/ssl/ec-key-pk8.pem diff --git a/lib/puppet/x509/cert_provider.rb b/lib/puppet/x509/cert_provider.rb index 5e185da733f..811c9ec13b9 100644 --- a/lib/puppet/x509/cert_provider.rb +++ b/lib/puppet/x509/cert_provider.rb @@ -15,7 +15,6 @@ class Puppet::X509::CertProvider VALID_CERTNAME = /\A[ -.0-~]+\Z/ CERT_DELIMITERS = /-----BEGIN CERTIFICATE-----.*?-----END CERTIFICATE-----/m CRL_DELIMITERS = /-----BEGIN X509 CRL-----.*?-----END X509 CRL-----/m - EC_HEADER = /-----BEGIN EC PRIVATE KEY-----/ def initialize(capath: Puppet[:localcacert], crlpath: Puppet[:hostcrl], @@ -209,21 +208,7 @@ def load_private_key_from_pem(pem, password: nil) # set a non-nil password to ensure openssl doesn't prompt password ||= '' - # Can't use OpenSSL::PKey.read, because it's broken in MRI 2.3, doesn't exist - # in JRuby 9.1, and is broken in JRuby 9.2 - begin - if pem =~ EC_HEADER - OpenSSL::PKey::EC.new(pem, password) - else - OpenSSL::PKey::RSA.new(pem, password) - end - rescue OpenSSL::PKey::PKeyError => e - if e.message =~ /Neither PUB key nor PRIV key/ - raise OpenSSL::PKey::PKeyError, "Could not parse PKey: no start line" - else - raise e - end - end + OpenSSL::PKey.read(pem, password) end # Load the private key password. diff --git a/spec/fixtures/ssl/ec-key-openssl.pem b/spec/fixtures/ssl/ec-key-openssl.pem new file mode 100644 index 00000000000..accf4cad4d3 --- /dev/null +++ b/spec/fixtures/ssl/ec-key-openssl.pem @@ -0,0 +1,8 @@ +-----BEGIN EC PARAMETERS----- +BggqhkjOPQMBBw== +-----END EC PARAMETERS----- +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIC1xD81Rha4nzXM4OrG/eLlh3KzmClXOUlOeE975dZ8loAoGCCqGSM49 +AwEHoUQDQgAEUFW3mhj/TNMWNrctybN7Dho5ro/437/9luPrrPqkP5ucfZ+ftClN +8yHzPyf4l770aFB0jf4r1BkdBmQ16fzE3g== +-----END EC PRIVATE KEY----- diff --git a/spec/fixtures/ssl/ec-key-pk8.pem b/spec/fixtures/ssl/ec-key-pk8.pem new file mode 100644 index 00000000000..b425475fc56 --- /dev/null +++ b/spec/fixtures/ssl/ec-key-pk8.pem @@ -0,0 +1,5 @@ +-----BEGIN PRIVATE KEY----- +MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgrSK9I6zVGCuBNUcc +J4KS6WOdfeE4SnfK02vhMzWXWl+hRANCAASh/nwXGgRbniDHt3fUKq6Odqokxqn3 +62kj/zH0oSYC3eJIaEaw9kwYb1cSD9mHDlrisWSRFX66i/LrXGTKAVtd +-----END PRIVATE KEY----- diff --git a/spec/unit/ssl/ssl_provider_spec.rb b/spec/unit/ssl/ssl_provider_spec.rb index e149fd82130..093f3abfc72 100644 --- a/spec/unit/ssl/ssl_provider_spec.rb +++ b/spec/unit/ssl/ssl_provider_spec.rb @@ -505,28 +505,30 @@ }.to raise_error(Puppet::Error, /The client certificate is missing from/) end - it 'loads the private key and client cert' do - ssl_context = subject.load_context + context 'loading private keys', unless: RUBY_PLATFORM == 'java' do + it 'loads the private key and client cert' do + ssl_context = subject.load_context - expect(ssl_context.private_key).to be_an(OpenSSL::PKey::RSA) - expect(ssl_context.client_cert).to be_an(OpenSSL::X509::Certificate) - end + expect(ssl_context.private_key).to be_an(OpenSSL::PKey::RSA) + expect(ssl_context.client_cert).to be_an(OpenSSL::X509::Certificate) + end - it 'loads a password protected key and client cert' do - FileUtils.cp(File.join(PuppetSpec::FIXTURE_DIR, 'ssl', 'encrypted-key.pem'), File.join(Puppet[:privatekeydir], 'signed.pem')) + it 'loads a password protected key and client cert' do + FileUtils.cp(File.join(PuppetSpec::FIXTURE_DIR, 'ssl', 'encrypted-key.pem'), File.join(Puppet[:privatekeydir], 'signed.pem')) - ssl_context = subject.load_context(password: '74695716c8b6') + ssl_context = subject.load_context(password: '74695716c8b6') - expect(ssl_context.private_key).to be_an(OpenSSL::PKey::RSA) - expect(ssl_context.client_cert).to be_an(OpenSSL::X509::Certificate) - end + expect(ssl_context.private_key).to be_an(OpenSSL::PKey::RSA) + expect(ssl_context.client_cert).to be_an(OpenSSL::X509::Certificate) + end - it 'raises if the password is incorrect' do - FileUtils.cp(File.join(PuppetSpec::FIXTURE_DIR, 'ssl', 'encrypted-key.pem'), File.join(Puppet[:privatekeydir], 'signed.pem')) + it 'raises if the password is incorrect' do + FileUtils.cp(File.join(PuppetSpec::FIXTURE_DIR, 'ssl', 'encrypted-key.pem'), File.join(Puppet[:privatekeydir], 'signed.pem')) - expect { - subject.load_context(password: 'wrongpassword') - }.to raise_error(Puppet::SSL::SSLError, /Failed to load private key for host 'signed': Could not parse PKey/) + expect { + subject.load_context(password: 'wrongpassword') + }.to raise_error(Puppet::SSL::SSLError, /Failed to load private key for host 'signed': Could not parse PKey/) + end end end diff --git a/spec/unit/x509/cert_provider_spec.rb b/spec/unit/x509/cert_provider_spec.rb index 13e598a7590..fe4044a4028 100644 --- a/spec/unit/x509/cert_provider_spec.rb +++ b/spec/unit/x509/cert_provider_spec.rb @@ -223,7 +223,7 @@ def expects_private_file(path) end context 'when loading' do - context 'private keys' do + context 'private keys', unless: RUBY_PLATFORM == 'java' do let(:provider) { create_provider(privatekeydir: fixture_dir) } let(:password) { '74695716c8b6' } @@ -298,6 +298,14 @@ def expects_private_file(path) expect(provider.load_private_key('ec-key')).to be_a(OpenSSL::PKey::EC) end + it 'returns an EC key from PKCS#8 format' do + expect(provider.load_private_key('ec-key-pk8')).to be_a(OpenSSL::PKey::EC) + end + + it 'returns an EC key from openssl format' do + expect(provider.load_private_key('ec-key-openssl')).to be_a(OpenSSL::PKey::EC) + end + it 'decrypts an EC key using the password' do ec = provider.load_private_key('encrypted-ec-key', password: password) expect(ec).to be_a(OpenSSL::PKey::EC) From 5e8d183a4fa7b0cf931e40d7c4a04f705b145a50 Mon Sep 17 00:00:00 2001 From: Maggie Dreyer Date: Wed, 16 Jun 2021 09:33:43 -0700 Subject: [PATCH 397/731] (maint) Update GH Action JRuby version to 9.2.17.0 --- .github/workflows/rspec_tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rspec_tests.yaml b/.github/workflows/rspec_tests.yaml index 89b3d1aaa51..7d91377015f 100644 --- a/.github/workflows/rspec_tests.yaml +++ b/.github/workflows/rspec_tests.yaml @@ -17,7 +17,7 @@ jobs: - {os: ubuntu-18.04, ruby: 2.6} - {os: ubuntu-18.04, ruby: 2.7} - {os: ubuntu-18.04, ruby: 3.0} - - {os: ubuntu-18.04, ruby: jruby-9.2.9.0} + - {os: ubuntu-18.04, ruby: jruby-9.2.17.0} - {os: windows-2016, ruby: 2.5} - {os: windows-2016, ruby: 2.6} - {os: windows-2016, ruby: 2.7} From ce2087e7e7da95fb96c9ba1c11b3338324a5019b Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Fri, 18 Jun 2021 10:42:40 +0200 Subject: [PATCH 398/731] (maint) remove deprecated --[no-]tests install option fbd859fd02d176137cc9102854be50c04f2912a2 deprecated this parameter back in 2012. That's a long enough deprecation period for packagers to migrate and can be safely removed by now. --- install.rb | 4 ---- 1 file changed, 4 deletions(-) diff --git a/install.rb b/install.rb index 869c33a2af1..0101df6da31 100755 --- a/install.rb +++ b/install.rb @@ -159,10 +159,6 @@ def prepare_installation opts.on('--[no-]ri', 'Prevents the creation of RI output.', 'Default off on mswin32.') do |onri| InstallOptions.ri = onri end - opts.on('--[no-]tests', 'Prevents the execution of unit tests.', 'Default off.') do |ontest| - InstallOptions.tests = ontest - warn "The tests flag is no longer functional in Puppet and is deprecated as of Dec 19, 2012. It will be removed in a future version of Puppet." - end opts.on('--[no-]configs', 'Prevents the installation of config files', 'Default off.') do |ontest| InstallOptions.configs = ontest end From e75e7a73d3768c26bf8075b1ca675b7fbf3491fc Mon Sep 17 00:00:00 2001 From: Maggie Dreyer Date: Tue, 22 Jun 2021 17:04:03 -0700 Subject: [PATCH 399/731] (PUP-7785) Ensure `keylength` setting is treated as an int A recent change to the way numerical settings are munged made it necessary to specify the type of a setting that should be converted to a number, rather than automatically converting all strings that look like numbers. This commit adds the `integer` type to the `keylength` setting, to ensure it is converted to an int and not passed as a string. --- lib/puppet/defaults.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb index 1c808d455c5..513f00fcc69 100644 --- a/lib/puppet/defaults.rb +++ b/lib/puppet/defaults.rb @@ -1197,6 +1197,7 @@ def self.initialize_default_settings!(settings) }, :keylength => { :default => 4096, + :type => :integer, :desc => "The bit length of keys.", }, :cert_inventory => { From 9fdb0ab59613a9a6e9f3503be7e8b564bf6c1768 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Wed, 9 Jun 2021 13:07:58 -0700 Subject: [PATCH 400/731] (PUP-3995) Raise if a node and hostclass name conflict Node and class scopes are both added to the topscope, so given a manifest like: node 'abc' { include abc } We will add the node scope, but not the class scope, because we think it's already been added. As a result the class is ignored, making it difficult to debug. This also occurs when using hiera lookup/include: node 'abc' { lookup('classes').include } This adds dup checks when adding a node or hostclass to the type collection, similar to our existing checks. As a result, we will now fail compilation and the error message will indicate where the node or hostclass was first defined and where the redefinition was attempted. Error: Class 'mynode' is already defined (file: manifest.pp, line: 1); \ cannot redefine (file: manifest.pp, line: 2) on node mynode It also adds tests that show how a conflicting node can be specified as a regexp, but a node as a string cannot. --- lib/puppet/resource/type_collection.rb | 2 ++ spec/unit/parser/compiler_spec.rb | 29 ++++++++++++++++++++++ spec/unit/resource/type_collection_spec.rb | 16 ++++++++++++ spec/unit/resource/type_spec.rb | 4 +-- 4 files changed, 49 insertions(+), 2 deletions(-) diff --git a/lib/puppet/resource/type_collection.rb b/lib/puppet/resource/type_collection.rb index d7e5224af27..e12f32286da 100644 --- a/lib/puppet/resource/type_collection.rb +++ b/lib/puppet/resource/type_collection.rb @@ -61,6 +61,7 @@ def add(instance) def add_hostclass(instance) handle_hostclass_merge(instance) dupe_check(instance, @hostclasses) { |dupe| _("Class '%{klass}' is already defined%{error}; cannot redefine") % { klass: instance.name, error: dupe.error_context } } + dupe_check(instance, @nodes) { |dupe| _("Node '%{klass}' is already defined%{error}; cannot be redefined as a class") % { klass: instance.name, error: dupe.error_context } } dupe_check(instance, @definitions) { |dupe| _("Definition '%{klass}' is already defined%{error}; cannot be redefined as a class") % { klass: instance.name, error: dupe.error_context } } @hostclasses[instance.name] = instance @@ -93,6 +94,7 @@ def hostclass(name) def add_node(instance) dupe_check(instance, @nodes) { |dupe| _("Node '%{name}' is already defined%{error}; cannot redefine") % { name: instance.name, error: dupe.error_context } } + dupe_check(instance, @hostclasses) { |dupe| _("Class '%{klass}' is already defined%{error}; cannot be redefined as a node") % { klass: instance.name, error: dupe.error_context } } @node_list << instance @nodes[instance.name] = instance diff --git a/spec/unit/parser/compiler_spec.rb b/spec/unit/parser/compiler_spec.rb index f5d494f860b..8094fe207c9 100644 --- a/spec/unit/parser/compiler_spec.rb +++ b/spec/unit/parser/compiler_spec.rb @@ -862,6 +862,35 @@ class something {} expect(catalog.resource('Class', 'Something')).not_to be_nil end + + it "raises if the class name is the same as the node definition" do + name = node.name + node.classes = [name] + + expect { + compile_to_catalog(<<-MANIFEST, node) + class #{name} {} + node #{name} { + include #{name} + } + MANIFEST + }.to raise_error(Puppet::Error, /Class '#{name}' is already defined \(line: 1\); cannot be redefined as a node \(line: 2\) on node #{name}/) + end + + it "evaluates the class if the node definition uses a regexp" do + name = node.name + node.classes = [name] + + catalog = compile_to_catalog(<<-MANIFEST, node) + class #{name} {} + node /#{name}/ { + include #{name} + } + MANIFEST + + expect(@logs).to be_empty + expect(catalog.resource('Class', node.name.capitalize)).to_not be_nil + end end it "should fail if the class doesn't exist" do diff --git a/spec/unit/resource/type_collection_spec.rb b/spec/unit/resource/type_collection_spec.rb index d18f7461664..7ed06fd9d4b 100644 --- a/spec/unit/resource/type_collection_spec.rb +++ b/spec/unit/resource/type_collection_spec.rb @@ -43,6 +43,14 @@ end.to raise_error(Puppet::ParseError, /cannot redefine/) end + it "should fail if a hostclass duplicates a node" do + @code.add(Puppet::Resource::Type.new(:node, "foo")) + + expect do + @code.add(Puppet::Resource::Type.new(:hostclass, "foo")) + end.to raise_error(Puppet::ParseError, /Node 'foo' is already defined; cannot be redefined as a class/) + end + it "should store hostclasses as hostclasses" do klass = Puppet::Resource::Type.new(:hostclass, "foo") @@ -60,6 +68,14 @@ }.to raise_error(/.*is already defined; cannot redefine/) end + it "should fail if a node duplicates a hostclass" do + @code.add(Puppet::Resource::Type.new(:hostclass, "foo")) + + expect do + @code.add(Puppet::Resource::Type.new(:node, "foo")) + end.to raise_error(Puppet::ParseError, /Class 'foo' is already defined; cannot be redefined as a node/) + end + it "should store definitions as definitions" do define = Puppet::Resource::Type.new(:definition, "foo") diff --git a/spec/unit/resource/type_spec.rb b/spec/unit/resource/type_spec.rb index 90648d0dfe3..701a49b814f 100644 --- a/spec/unit/resource/type_spec.rb +++ b/spec/unit/resource/type_spec.rb @@ -462,9 +462,9 @@ def matchref_expression(number) end it "should be able to find parent nodes" do - parent = Puppet::Resource::Type.new(:node, "bar") + parent = Puppet::Resource::Type.new(:node, "node_bar") @krt.add parent - child = Puppet::Resource::Type.new(:node, "foo", :parent => "bar") + child = Puppet::Resource::Type.new(:node, "node_foo", :parent => "node_bar") @krt.add child expect(child.parent_type(@scope)).to equal(parent) From 1d62b5a4fae9a5386a11342e29947acfec148846 Mon Sep 17 00:00:00 2001 From: Justin Stoller Date: Thu, 24 Jun 2021 15:40:24 -0700 Subject: [PATCH 401/731] (maint) Provide types for possible integer settings defaults The change in eeb61d1c6 allowed settings to be strings containing digits and to remain strings (helpful for numeric certnames for example). However, several settings depended on the automatic conversion of strings that contain digits to Integer. This adds type specification to any defaults that match / \d+,/ in the defaults.rb. All are given the type `:integer` unless the setting contains the word "port" in which case they gain the type `:port`. A notable exception being the ldapport setting, which depends on being a string and now is explicitly a string in the defaults. Additional searches for ttl & priority didn't reveal any defaults that needed changing. Nor did a search for strings containing wholy digits. --- lib/puppet/defaults.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb index 513f00fcc69..0bac0e1ee47 100644 --- a/lib/puppet/defaults.rb +++ b/lib/puppet/defaults.rb @@ -478,6 +478,7 @@ def self.initialize_default_settings!(settings) }, :maximum_uid => { :default => 4294967290, + :type => :integer, :desc => "The maximum allowed UID. Some platforms use negative UIDs but then ship with tools that do not know how to handle signed ints, so the UIDs show up as huge numbers that can then not be fed back into @@ -615,6 +616,7 @@ def self.initialize_default_settings!(settings) }, :http_proxy_port => { :default => 3128, + :type => :port, :desc => "The HTTP proxy port to use for outgoing connections", }, :http_proxy_user => { @@ -2023,7 +2025,7 @@ def self.initialize_default_settings!(settings) :desc => "The LDAP server.", }, :ldapport => { - :default => 389, + :default => "389", :desc => "The LDAP port.", }, @@ -2107,6 +2109,7 @@ def self.initialize_default_settings!(settings) settings.define_settings(:parser, :max_errors => { :default => 10, + :type => :integer, :desc => <<-'EOT' Sets the max number of logged/displayed parser validation errors in case multiple errors have been detected. A value of 0 is the same as a value of 1; a @@ -2115,6 +2118,7 @@ def self.initialize_default_settings!(settings) }, :max_warnings => { :default => 10, + :type => :integer, :desc => <<-'EOT' Sets the max number of logged/displayed parser validation warnings in case multiple warnings have been detected. A value of 0 blocks logging of @@ -2123,6 +2127,7 @@ def self.initialize_default_settings!(settings) }, :max_deprecations => { :default => 10, + :type => :integer, :desc => <<-'EOT' Sets the max number of logged/displayed parser validation deprecation warnings in case multiple deprecation warnings have been detected. A value of 0 From bfc7d6f9f4eb6f526dd4ccea75a4ecabea664a76 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Mon, 28 Jun 2021 08:22:47 +0000 Subject: [PATCH 402/731] (packaging) Updating the puppet.pot file --- locales/puppet.pot | 168 ++++++++++++++++++++++++--------------------- 1 file changed, 90 insertions(+), 78 deletions(-) diff --git a/locales/puppet.pot b/locales/puppet.pot index a074c5cede3..e8746207d8b 100644 --- a/locales/puppet.pot +++ b/locales/puppet.pot @@ -6,11 +6,11 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Puppet automation framework 7.8.0-32-gdd314abb53\n" +"Project-Id-Version: Puppet automation framework 7.8.0-73-gd8c14c22bc\n" "\n" "Report-Msgid-Bugs-To: https://tickets.puppetlabs.com\n" -"POT-Creation-Date: 2021-06-16 12:52+0000\n" -"PO-Revision-Date: 2021-06-16 12:52+0000\n" +"POT-Creation-Date: 2021-06-28 08:22+0000\n" +"PO-Revision-Date: 2021-06-28 08:22+0000\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -348,31 +348,31 @@ msgstr "" msgid "Try 'puppet help %{face} %{action}' for usage" msgstr "" -#: ../lib/puppet/application/filebucket.rb:16 +#: ../lib/puppet/application/filebucket.rb:17 msgid "Store and retrieve files in a filebucket" msgstr "" -#: ../lib/puppet/application/filebucket.rb:225 +#: ../lib/puppet/application/filebucket.rb:226 msgid "You must specify a file to back up" msgstr "" -#: ../lib/puppet/application/filebucket.rb:229 +#: ../lib/puppet/application/filebucket.rb:230 msgid "%{file}: no such file" msgstr "" -#: ../lib/puppet/application/filebucket.rb:233 +#: ../lib/puppet/application/filebucket.rb:234 msgid "%{file}: cannot read file" msgstr "" -#: ../lib/puppet/application/filebucket.rb:255 ../lib/puppet/application/filebucket.rb:278 +#: ../lib/puppet/application/filebucket.rb:256 ../lib/puppet/application/filebucket.rb:279 msgid "Need exactly two arguments: filebucket diff " msgstr "" -#: ../lib/puppet/application/filebucket.rb:275 +#: ../lib/puppet/application/filebucket.rb:276 msgid "Comparing %{checksum_a} %{checksum_b} %{file_a} %{file_b}" msgstr "" -#: ../lib/puppet/application/filebucket.rb:289 +#: ../lib/puppet/application/filebucket.rb:290 msgid "Cancelling" msgstr "" @@ -450,55 +450,55 @@ msgstr "" msgid "An action must be specified." msgstr "" -#: ../lib/puppet/application/ssl.rb:129 ../lib/puppet/application/ssl.rb:136 +#: ../lib/puppet/application/ssl.rb:130 ../lib/puppet/application/ssl.rb:137 msgid "The certificate for '%{name}' has not yet been signed" msgstr "" -#: ../lib/puppet/application/ssl.rb:147 +#: ../lib/puppet/application/ssl.rb:148 msgid "Completed SSL initialization" msgstr "" -#: ../lib/puppet/application/ssl.rb:151 +#: ../lib/puppet/application/ssl.rb:152 msgid "Unknown action '%{action}'" msgstr "" -#: ../lib/puppet/application/ssl.rb:165 ../lib/puppet/ssl/state_machine.rb:180 +#: ../lib/puppet/application/ssl.rb:166 ../lib/puppet/ssl/state_machine.rb:180 msgid "Creating a new EC SSL key for %{name} using curve %{curve}" msgstr "" -#: ../lib/puppet/application/ssl.rb:168 +#: ../lib/puppet/application/ssl.rb:169 msgid "Creating a new SSL key for %{name}" msgstr "" -#: ../lib/puppet/application/ssl.rb:178 +#: ../lib/puppet/application/ssl.rb:179 msgid "Submitted certificate request for '%{name}' to %{url}" msgstr "" -#: ../lib/puppet/application/ssl.rb:181 +#: ../lib/puppet/application/ssl.rb:182 msgid "Could not submit certificate request for '%{name}' to %{url} due to a conflict on the server" msgstr "" -#: ../lib/puppet/application/ssl.rb:183 ../lib/puppet/application/ssl.rb:186 +#: ../lib/puppet/application/ssl.rb:184 ../lib/puppet/application/ssl.rb:187 msgid "Failed to submit certificate request: %{message}" msgstr "" -#: ../lib/puppet/application/ssl.rb:194 +#: ../lib/puppet/application/ssl.rb:195 msgid "Downloading certificate '%{name}' from %{url}" msgstr "" -#: ../lib/puppet/application/ssl.rb:198 +#: ../lib/puppet/application/ssl.rb:199 msgid "Downloaded certificate '%{name}' with fingerprint %{fingerprint}" msgstr "" -#: ../lib/puppet/application/ssl.rb:211 ../lib/puppet/application/ssl.rb:214 +#: ../lib/puppet/application/ssl.rb:212 ../lib/puppet/application/ssl.rb:215 msgid "Failed to download certificate: %{message}" msgstr "" -#: ../lib/puppet/application/ssl.rb:243 ../lib/puppet/application/ssl.rb:246 +#: ../lib/puppet/application/ssl.rb:244 ../lib/puppet/application/ssl.rb:247 msgid "Failed to connect to the CA to determine if certificate %{certname} has been cleaned" msgstr "" -#: ../lib/puppet/application/ssl.rb:250 +#: ../lib/puppet/application/ssl.rb:251 msgid "" "The certificate %{certname} must be cleaned from the CA first. To fix this,\n" "run the following commands on the CA:\n" @@ -506,7 +506,7 @@ msgid "" " puppet ssl clean\n" msgstr "" -#: ../lib/puppet/application/ssl.rb:273 +#: ../lib/puppet/application/ssl.rb:274 msgid "Removed %{label} %{path}" msgstr "" @@ -720,7 +720,7 @@ msgid "Invalid value '%{value}' for parameter %{name}. Allowed values are '%{all msgstr "" #. TRANSLATORS 'pluginsync' is a setting and should not be translated -#: ../lib/puppet/defaults.rb:1916 +#: ../lib/puppet/defaults.rb:1917 msgid "Setting 'pluginsync' is deprecated." msgstr "" @@ -2905,43 +2905,43 @@ msgid "Face summary should be a single line; put the long text in 'description' msgstr "" #. TRANSLATORS 'author' is an attribute name and should not be translated -#: ../lib/puppet/interface/documentation.rb:205 +#: ../lib/puppet/interface/documentation.rb:206 msgid "author must be a string; use multiple statements for multiple authors" msgstr "" #. TRANSLATORS 'author' is an attribute name and should not be translated -#: ../lib/puppet/interface/documentation.rb:210 +#: ../lib/puppet/interface/documentation.rb:211 msgid "author should be a single line; use multiple statements for multiple authors" msgstr "" #. TRANSLATORS 'author' is an attribute name and should not be translated -#: ../lib/puppet/interface/documentation.rb:230 +#: ../lib/puppet/interface/documentation.rb:231 msgid "author should be a single line; use multiple statements" msgstr "" #. TRANSLATORS 'copyright' is an attribute name and should not be translated -#: ../lib/puppet/interface/documentation.rb:251 +#: ../lib/puppet/interface/documentation.rb:252 msgid "copyright takes the owners names, then the years covered" msgstr "" #. TRANSLATORS 'copyright' is an attribute name and should not be translated -#: ../lib/puppet/interface/documentation.rb:275 +#: ../lib/puppet/interface/documentation.rb:276 msgid "copyright owner must be a string or an array of strings" msgstr "" #. TRANSLATORS 'copyright' is an attribute name and should not be translated -#: ../lib/puppet/interface/documentation.rb:312 +#: ../lib/puppet/interface/documentation.rb:313 msgid "copyright with a year %{value} is very strange; did you accidentally add or subtract two years?" msgstr "" #. TRANSLATORS 'copyright' is an attribute name and should not be translated #. TRANSLATORS 'copyright' is an attribute name and should not be translated -#: ../lib/puppet/interface/documentation.rb:328 ../lib/puppet/interface/documentation.rb:333 +#: ../lib/puppet/interface/documentation.rb:329 ../lib/puppet/interface/documentation.rb:334 msgid "%{value} is not a good copyright year or range" msgstr "" #. TRANSLATORS 'copyright' is an attribute name and should not be translated -#: ../lib/puppet/interface/documentation.rb:352 +#: ../lib/puppet/interface/documentation.rb:353 msgid "%{value} is not a good copyright year, set, or range" msgstr "" @@ -3202,19 +3202,19 @@ msgstr "" msgid "No file containing checksums found." msgstr "" -#: ../lib/puppet/module_tool/applications/installer.rb:84 ../lib/puppet/module_tool/applications/upgrader.rb:102 +#: ../lib/puppet/module_tool/applications/installer.rb:88 ../lib/puppet/module_tool/applications/upgrader.rb:102 msgid "Downloading from %{host} ..." msgstr "" -#: ../lib/puppet/module_tool/applications/installer.rb:132 ../lib/puppet/module_tool/applications/upgrader.rb:140 +#: ../lib/puppet/module_tool/applications/installer.rb:136 ../lib/puppet/module_tool/applications/upgrader.rb:140 msgid "Resolving dependencies ..." msgstr "" -#: ../lib/puppet/module_tool/applications/installer.rb:208 +#: ../lib/puppet/module_tool/applications/installer.rb:212 msgid "Preparing to install ..." msgstr "" -#: ../lib/puppet/module_tool/applications/installer.rb:211 +#: ../lib/puppet/module_tool/applications/installer.rb:215 msgid "Installing -- do not interrupt ..." msgstr "" @@ -3333,7 +3333,7 @@ msgstr "" msgid "Could not %{action} '%{module_name}' (%{version}); no version satisfies all dependencies" msgstr "" -#: ../lib/puppet/module_tool/errors/shared.rb:17 ../lib/puppet/module_tool/errors/shared.rb:186 ../lib/puppet/module_tool/errors/upgrader.rb:58 +#: ../lib/puppet/module_tool/errors/shared.rb:17 ../lib/puppet/module_tool/errors/shared.rb:203 ../lib/puppet/module_tool/errors/upgrader.rb:58 msgid "Could not %{action} module '%{module_name}' (%{version})" msgstr "" @@ -3423,68 +3423,80 @@ msgid " No version of '%{module_name}' will satisfy dependencies" msgstr "" #: ../lib/puppet/module_tool/errors/shared.rb:135 -msgid "Could not %{action} '%{module_name}'; module is not installed" +msgid "Could not %{action} '%{module_name}', did you mean '%{suggestion}'?" msgstr "" -#: ../lib/puppet/module_tool/errors/shared.rb:140 ../lib/puppet/module_tool/errors/shared.rb:163 ../lib/puppet/module_tool/errors/shared.rb:204 +#: ../lib/puppet/module_tool/errors/shared.rb:140 ../lib/puppet/module_tool/errors/shared.rb:157 ../lib/puppet/module_tool/errors/shared.rb:180 ../lib/puppet/module_tool/errors/shared.rb:221 msgid "Could not %{action} module '%{module_name}'" msgstr "" #: ../lib/puppet/module_tool/errors/shared.rb:141 +msgid " The name '%{module_name}' is invalid" +msgstr "" + +#: ../lib/puppet/module_tool/errors/shared.rb:142 +msgid " Did you mean `puppet module %{action} %{suggestion}`?" +msgstr "" + +#: ../lib/puppet/module_tool/errors/shared.rb:152 +msgid "Could not %{action} '%{module_name}'; module is not installed" +msgstr "" + +#: ../lib/puppet/module_tool/errors/shared.rb:158 msgid " Module '%{module_name}' is not installed" msgstr "" #. TRANSLATORS `puppet module %{action} %{suggestion}` is a command line and should not be translated -#: ../lib/puppet/module_tool/errors/shared.rb:144 +#: ../lib/puppet/module_tool/errors/shared.rb:161 msgid " You may have meant `puppet module %{action} %{suggestion}`" msgstr "" #. TRANSLATORS `puppet module install` is a command line and should not be translated -#: ../lib/puppet/module_tool/errors/shared.rb:147 +#: ../lib/puppet/module_tool/errors/shared.rb:164 msgid " Use `puppet module install` to install this module" msgstr "" #. TRANSLATORS "module path" refers to a set of directories where modules may be installed -#: ../lib/puppet/module_tool/errors/shared.rb:158 +#: ../lib/puppet/module_tool/errors/shared.rb:175 msgid "Could not %{action} '%{module_name}'; module appears in multiple places in the module path" msgstr "" -#: ../lib/puppet/module_tool/errors/shared.rb:164 +#: ../lib/puppet/module_tool/errors/shared.rb:181 msgid " Module '%{module_name}' appears multiple places in the module path" msgstr "" #. TRANSLATORS This is repeats as separate lines as a list under "Module '%{module_name}' appears multiple places in the module path" -#: ../lib/puppet/module_tool/errors/shared.rb:167 +#: ../lib/puppet/module_tool/errors/shared.rb:184 msgid " '%{module_name}' (%{version}) was found in %{path}" msgstr "" #. TRANSLATORS `--modulepath` is command line option and should not be translated -#: ../lib/puppet/module_tool/errors/shared.rb:170 +#: ../lib/puppet/module_tool/errors/shared.rb:187 msgid " Use the `--modulepath` option to limit the search to specific directories" msgstr "" -#: ../lib/puppet/module_tool/errors/shared.rb:181 +#: ../lib/puppet/module_tool/errors/shared.rb:198 msgid "Could not %{action} '%{module_name}'; module has had changes made locally" msgstr "" -#: ../lib/puppet/module_tool/errors/shared.rb:187 +#: ../lib/puppet/module_tool/errors/shared.rb:204 msgid " Installed module has had changes made locally" msgstr "" #. TRANSLATORS `puppet module %{action} --ignore-changes` is a command line and should not be translated -#: ../lib/puppet/module_tool/errors/shared.rb:189 +#: ../lib/puppet/module_tool/errors/shared.rb:206 msgid " Use `puppet module %{action} --ignore-changes` to %{action} this module anyway" msgstr "" -#: ../lib/puppet/module_tool/errors/shared.rb:199 +#: ../lib/puppet/module_tool/errors/shared.rb:216 msgid "Could not %{action} '%{module_name}'; %{error}" msgstr "" -#: ../lib/puppet/module_tool/errors/shared.rb:205 +#: ../lib/puppet/module_tool/errors/shared.rb:222 msgid " Failure trying to parse metadata" msgstr "" -#: ../lib/puppet/module_tool/errors/shared.rb:206 +#: ../lib/puppet/module_tool/errors/shared.rb:223 msgid " Original message was: %{message}" msgstr "" @@ -7222,15 +7234,15 @@ msgstr "" msgid "(See https://puppet.com/docs/puppet/latest/environments_about.html)" msgstr "" -#: ../lib/puppet/settings/config_file.rb:138 +#: ../lib/puppet/settings/config_file.rb:131 msgid "Invalid file option '%{parameter}'" msgstr "" -#: ../lib/puppet/settings/config_file.rb:142 +#: ../lib/puppet/settings/config_file.rb:135 msgid "File modes must be numbers" msgstr "" -#: ../lib/puppet/settings/config_file.rb:145 +#: ../lib/puppet/settings/config_file.rb:138 msgid "Could not parse '%{string}'" msgstr "" @@ -7299,7 +7311,7 @@ msgstr "" msgid "%{name} has not declared what class it wraps" msgstr "" -#: ../lib/puppet/ssl/base.rb:31 ../lib/puppet/x509/cert_provider.rb:367 +#: ../lib/puppet/ssl/base.rb:31 ../lib/puppet/x509/cert_provider.rb:352 msgid "Certname %{name} must not contain unprintable or non-ASCII characters" msgstr "" @@ -9421,7 +9433,7 @@ msgstr "" msgid "An attempt to set mode %{mode} on item %{path} would result in the group, SYSTEM, to have less than Full Control rights. This attempt has been corrected to Full Control" msgstr "" -#: ../lib/puppet/util/windows/security.rb:433 ../lib/puppet/util/windows/security.rb:450 ../lib/puppet/util/windows/sid.rb:157 ../lib/puppet/util/windows/sid.rb:219 ../lib/puppet/util/windows/user.rb:59 +#: ../lib/puppet/util/windows/security.rb:433 ../lib/puppet/util/windows/security.rb:450 ../lib/puppet/util/windows/sid.rb:159 ../lib/puppet/util/windows/sid.rb:221 ../lib/puppet/util/windows/user.rb:59 msgid "Invalid SID" msgstr "" @@ -9577,19 +9589,19 @@ msgstr "" msgid "Timed out while waiting for the pending transition from %{pending_state} to %{final_state} to finish. The current state is %{current_state}." msgstr "" -#: ../lib/puppet/util/windows/sid.rb:96 +#: ../lib/puppet/util/windows/sid.rb:98 msgid "Octet string must be an array of bytes" msgstr "" -#: ../lib/puppet/util/windows/sid.rb:163 +#: ../lib/puppet/util/windows/sid.rb:165 msgid "Failed to convert binary SID" msgstr "" -#: ../lib/puppet/util/windows/sid.rb:168 +#: ../lib/puppet/util/windows/sid.rb:170 msgid "ConvertSidToStringSidW failed to allocate buffer for sid" msgstr "" -#: ../lib/puppet/util/windows/sid.rb:188 +#: ../lib/puppet/util/windows/sid.rb:190 msgid "Failed to convert string SID: %{string_sid}" msgstr "" @@ -9613,72 +9625,72 @@ msgstr "" msgid "Failed to unload user profile %{user}" msgstr "" -#: ../lib/puppet/x509/cert_provider.rb:45 +#: ../lib/puppet/x509/cert_provider.rb:44 msgid "Failed to save CA certificates to '%{capath}'" msgstr "" -#: ../lib/puppet/x509/cert_provider.rb:59 +#: ../lib/puppet/x509/cert_provider.rb:58 msgid "The CA certificates are missing from '%{path}'" msgstr "" -#: ../lib/puppet/x509/cert_provider.rb:63 +#: ../lib/puppet/x509/cert_provider.rb:62 msgid "Failed to load CA certificates from '%{capath}'" msgstr "" #. TRANSLATORS 'PEM' is an acronym and shouldn't be translated -#: ../lib/puppet/x509/cert_provider.rb:75 +#: ../lib/puppet/x509/cert_provider.rb:74 msgid "Failed to parse CA certificates as PEM" msgstr "" -#: ../lib/puppet/x509/cert_provider.rb:91 +#: ../lib/puppet/x509/cert_provider.rb:90 msgid "Failed to save CRLs to '%{crlpath}'" msgstr "" -#: ../lib/puppet/x509/cert_provider.rb:105 +#: ../lib/puppet/x509/cert_provider.rb:104 msgid "The CRL is missing from '%{path}'" msgstr "" -#: ../lib/puppet/x509/cert_provider.rb:109 +#: ../lib/puppet/x509/cert_provider.rb:108 msgid "Failed to load CRLs from '%{crlpath}'" msgstr "" #. TRANSLATORS 'PEM' is an acronym and shouldn't be translated -#: ../lib/puppet/x509/cert_provider.rb:121 +#: ../lib/puppet/x509/cert_provider.rb:120 msgid "Failed to parse CRLs as PEM" msgstr "" -#: ../lib/puppet/x509/cert_provider.rb:171 +#: ../lib/puppet/x509/cert_provider.rb:170 msgid "Failed to save private key for '%{name}'" msgstr "" -#: ../lib/puppet/x509/cert_provider.rb:191 +#: ../lib/puppet/x509/cert_provider.rb:190 msgid "The private key is missing from '%{path}'" msgstr "" -#: ../lib/puppet/x509/cert_provider.rb:195 +#: ../lib/puppet/x509/cert_provider.rb:194 msgid "Failed to load private key for '%{name}'" msgstr "" -#: ../lib/puppet/x509/cert_provider.rb:252 +#: ../lib/puppet/x509/cert_provider.rb:237 msgid "Failed to save client certificate for '%{name}'" msgstr "" -#: ../lib/puppet/x509/cert_provider.rb:268 +#: ../lib/puppet/x509/cert_provider.rb:253 msgid "The client certificate is missing from '%{path}'" msgstr "" -#: ../lib/puppet/x509/cert_provider.rb:272 +#: ../lib/puppet/x509/cert_provider.rb:257 msgid "Failed to load client certificate for '%{name}'" msgstr "" -#: ../lib/puppet/x509/cert_provider.rb:321 +#: ../lib/puppet/x509/cert_provider.rb:306 msgid "Failed to save certificate request for '%{name}'" msgstr "" -#: ../lib/puppet/x509/cert_provider.rb:337 +#: ../lib/puppet/x509/cert_provider.rb:322 msgid "Failed to load certificate request for '%{name}'" msgstr "" -#: ../lib/puppet/x509/cert_provider.rb:350 +#: ../lib/puppet/x509/cert_provider.rb:335 msgid "Failed to delete certificate request for '%{name}'" msgstr "" From abedda4bfecb1a63cf9597292c4d38fedb385600 Mon Sep 17 00:00:00 2001 From: Maggie Dreyer Date: Mon, 28 Jun 2021 12:56:18 -0700 Subject: [PATCH 403/731] (maint) Give `:ldappport` setting a `:port` type --- lib/puppet/defaults.rb | 3 ++- spec/unit/util/ldap/connection_spec.rb | 20 ++++++++++---------- spec/unit/util/ldap/manager_spec.rb | 4 ++-- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb index 0bac0e1ee47..6c706cfdc68 100644 --- a/lib/puppet/defaults.rb +++ b/lib/puppet/defaults.rb @@ -2025,7 +2025,8 @@ def self.initialize_default_settings!(settings) :desc => "The LDAP server.", }, :ldapport => { - :default => "389", + :default => 389, + :type => :port, :desc => "The LDAP port.", }, diff --git a/spec/unit/util/ldap/connection_spec.rb b/spec/unit/util/ldap/connection_spec.rb index 36088d63f27..be06f6dc3c1 100644 --- a/spec/unit/util/ldap/connection_spec.rb +++ b/spec/unit/util/ldap/connection_spec.rb @@ -29,7 +29,7 @@ class SSLConn < Conn; end allow(LDAP::Conn).to receive(:new).and_return(@ldapconn) allow(LDAP::SSLConn).to receive(:new).and_return(@ldapconn) - @connection = Puppet::Util::Ldap::Connection.new("host", "port") + @connection = Puppet::Util::Ldap::Connection.new("host", 1234) end @@ -39,31 +39,31 @@ class SSLConn < Conn; end end it "should allow specification of a user and password" do - expect { Puppet::Util::Ldap::Connection.new("myhost", "myport", :user => "blah", :password => "boo") }.not_to raise_error + expect { Puppet::Util::Ldap::Connection.new("myhost", 1234, :user => "blah", :password => "boo") }.not_to raise_error end it "should allow specification of ssl" do - expect { Puppet::Util::Ldap::Connection.new("myhost", "myport", :ssl => :tsl) }.not_to raise_error + expect { Puppet::Util::Ldap::Connection.new("myhost", 1234, :ssl => :tsl) }.not_to raise_error end it "should support requiring a new connection" do - expect { Puppet::Util::Ldap::Connection.new("myhost", "myport", :reset => true) }.not_to raise_error + expect { Puppet::Util::Ldap::Connection.new("myhost", 1234, :reset => true) }.not_to raise_error end it "should fail if ldap is unavailable" do expect(Puppet.features).to receive(:ldap?).and_return(false) - expect { Puppet::Util::Ldap::Connection.new("host", "port") }.to raise_error(Puppet::Error) + expect { Puppet::Util::Ldap::Connection.new("host", 1234) }.to raise_error(Puppet::Error) end it "should use neither ssl nor tls by default" do - expect(LDAP::Conn).to receive(:new).with("host", "port").and_return(@ldapconn) + expect(LDAP::Conn).to receive(:new).with("host", 1234).and_return(@ldapconn) @connection.start end it "should use LDAP::SSLConn if ssl is requested" do - expect(LDAP::SSLConn).to receive(:new).with("host", "port").and_return(@ldapconn) + expect(LDAP::SSLConn).to receive(:new).with("host", 1234).and_return(@ldapconn) @connection.ssl = true @@ -71,7 +71,7 @@ class SSLConn < Conn; end end it "should use LDAP::SSLConn and tls if tls is requested" do - expect(LDAP::SSLConn).to receive(:new).with("host", "port", true).and_return(@ldapconn) + expect(LDAP::SSLConn).to receive(:new).with("host", 1234, true).and_return(@ldapconn) @connection.ssl = :tls @@ -121,8 +121,8 @@ class SSLConn < Conn; end end it "should use the :ldapport setting to determine the port" do - Puppet[:ldapport] = "456" - expect(Puppet::Util::Ldap::Connection).to receive(:new).with(anything, "456", anything) + Puppet[:ldapport] = 456 + expect(Puppet::Util::Ldap::Connection).to receive(:new).with(anything, 456, anything) Puppet::Util::Ldap::Connection.instance end diff --git a/spec/unit/util/ldap/manager_spec.rb b/spec/unit/util/ldap/manager_spec.rb index e0aacf642a8..687f6840fbb 100644 --- a/spec/unit/util/ldap/manager_spec.rb +++ b/spec/unit/util/ldap/manager_spec.rb @@ -245,8 +245,8 @@ end it "should open the connection with its port set to the :ldapport" do - Puppet[:ldapport] = "28" - expect(Puppet::Util::Ldap::Connection).to receive(:new).with(anything, "28", anything).and_return(@conn) + Puppet[:ldapport] = 28 + expect(Puppet::Util::Ldap::Connection).to receive(:new).with(anything, 28, anything).and_return(@conn) @manager.connect { |c| } end From ff76c6b8dfe77c0ca800c6a5f75436fa10794929 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Wed, 30 Jun 2021 12:22:42 +0000 Subject: [PATCH 404/731] (packaging) Updating the puppet.pot file --- locales/puppet.pot | 88 +++++++++++++++++++++++----------------------- 1 file changed, 44 insertions(+), 44 deletions(-) diff --git a/locales/puppet.pot b/locales/puppet.pot index e8746207d8b..ee56bf7df75 100644 --- a/locales/puppet.pot +++ b/locales/puppet.pot @@ -6,11 +6,11 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Puppet automation framework 7.8.0-73-gd8c14c22bc\n" +"Project-Id-Version: Puppet automation framework 7.8.0-92-g2cca41ff49\n" "\n" "Report-Msgid-Bugs-To: https://tickets.puppetlabs.com\n" -"POT-Creation-Date: 2021-06-28 08:22+0000\n" -"PO-Revision-Date: 2021-06-28 08:22+0000\n" +"POT-Creation-Date: 2021-06-30 12:22+0000\n" +"PO-Revision-Date: 2021-06-30 12:22+0000\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -282,11 +282,11 @@ msgstr "" msgid "starting applying configuration to %{target} at %{scheme}%{url_host}%{port}%{url_path}" msgstr "" -#: ../lib/puppet/application/device.rb:390 ../lib/puppet/application/resource.rb:197 +#: ../lib/puppet/application/device.rb:390 ../lib/puppet/application/resource.rb:201 msgid "You must specify the type to display" msgstr "" -#: ../lib/puppet/application/device.rb:391 ../lib/puppet/application/resource.rb:198 +#: ../lib/puppet/application/device.rb:391 ../lib/puppet/application/resource.rb:202 msgid "Could not find type %{type}" msgstr "" @@ -414,19 +414,19 @@ msgstr "" msgid "Incorrect formatted data in %{fact_file} given via the --facts flag" msgstr "" -#: ../lib/puppet/application/resource.rb:32 +#: ../lib/puppet/application/resource.rb:34 msgid "The resource abstraction layer shell" msgstr "" -#: ../lib/puppet/application/resource.rb:141 +#: ../lib/puppet/application/resource.rb:145 msgid "Editing with Yaml output is not supported" msgstr "" -#: ../lib/puppet/application/resource.rb:205 +#: ../lib/puppet/application/resource.rb:209 msgid "Invalid parameter setting %{setting}" msgstr "" -#: ../lib/puppet/application/resource.rb:227 +#: ../lib/puppet/application/resource.rb:240 msgid "Listing all file instances is not supported. Please specify a file or directory, e.g. puppet resource file /etc" msgstr "" @@ -697,30 +697,30 @@ msgid "Valid values are '%{values}'." msgstr "" #. TRANSLATORS 'data_binding_terminus' is a setting and should not be translated -#: ../lib/puppet/defaults.rb:538 +#: ../lib/puppet/defaults.rb:539 msgid "Setting 'data_binding_terminus' is deprecated." msgstr "" #. TRANSLATORS 'hiera' should not be translated -#: ../lib/puppet/defaults.rb:540 +#: ../lib/puppet/defaults.rb:541 msgid "Convert custom terminus to hiera 5 API." msgstr "" #. TRANSLATORS 'environment_data_provider' is a setting and should not be translated -#: ../lib/puppet/defaults.rb:733 +#: ../lib/puppet/defaults.rb:735 msgid "Setting 'environment_data_provider' is deprecated." msgstr "" -#: ../lib/puppet/defaults.rb:818 +#: ../lib/puppet/defaults.rb:820 msgid "Certificate names must be lower case" msgstr "" -#: ../lib/puppet/defaults.rb:1077 ../lib/puppet/settings/enum_setting.rb:13 ../lib/puppet/settings/symbolic_enum_setting.rb:14 +#: ../lib/puppet/defaults.rb:1079 ../lib/puppet/settings/enum_setting.rb:13 ../lib/puppet/settings/symbolic_enum_setting.rb:14 msgid "Invalid value '%{value}' for parameter %{name}. Allowed values are '%{allowed_values}'" msgstr "" #. TRANSLATORS 'pluginsync' is a setting and should not be translated -#: ../lib/puppet/defaults.rb:1917 +#: ../lib/puppet/defaults.rb:1919 msgid "Setting 'pluginsync' is deprecated." msgstr "" @@ -2027,7 +2027,7 @@ msgstr "" msgid "The given data requires an Integer index at %{walked_path}, got '%{type}'" msgstr "" -#: ../lib/puppet/functions/empty.rb:74 +#: ../lib/puppet/functions/empty.rb:82 msgid "Calling function empty() with %{arg_type} value is deprecated." msgstr "" @@ -6202,15 +6202,15 @@ msgstr "" msgid "'%{exe}' is not qualified and no path was specified. Please qualify the command or specify a path." msgstr "" -#: ../lib/puppet/provider/exec/posix.rb:21 ../lib/puppet/provider/exec/posix.rb:38 ../lib/puppet/provider/exec/windows.rb:40 ../lib/puppet/provider/exec/windows.rb:53 +#: ../lib/puppet/provider/exec/posix.rb:33 ../lib/puppet/provider/exec/posix.rb:50 ../lib/puppet/provider/exec/windows.rb:40 ../lib/puppet/provider/exec/windows.rb:53 msgid "Could not find command '%{exe}'" msgstr "" -#: ../lib/puppet/provider/exec/posix.rb:23 ../lib/puppet/provider/exec/windows.rb:42 +#: ../lib/puppet/provider/exec/posix.rb:35 ../lib/puppet/provider/exec/windows.rb:42 msgid "'%{exe}' is a %{klass}, not a file" msgstr "" -#: ../lib/puppet/provider/exec/posix.rb:25 +#: ../lib/puppet/provider/exec/posix.rb:37 msgid "'%{exe}' is not executable" msgstr "" @@ -7115,49 +7115,49 @@ msgstr "" msgid "Cannot manage group permissions, because the provider for '%{name}' is not functional" msgstr "" -#: ../lib/puppet/settings.rb:919 +#: ../lib/puppet/settings.rb:926 msgid "Unknown searchpath case: %{source_type} for the %{source} settings path element." msgstr "" -#: ../lib/puppet/settings.rb:992 +#: ../lib/puppet/settings.rb:1007 msgid "setting definition for '%{name}' is not a hash!" msgstr "" -#: ../lib/puppet/settings.rb:997 +#: ../lib/puppet/settings.rb:1012 msgid "Setting %{name} is already defined" msgstr "" -#: ../lib/puppet/settings.rb:1003 +#: ../lib/puppet/settings.rb:1018 msgid "Setting %{name} is already using short name '%{short}'" msgstr "" -#: ../lib/puppet/settings.rb:1274 +#: ../lib/puppet/settings.rb:1289 msgid "Setting %{name} is deprecated." msgstr "" #. TRANSLATORS 'puppet.conf' is a file name and should not be translated -#: ../lib/puppet/settings.rb:1279 +#: ../lib/puppet/settings.rb:1294 msgid "Setting %{name} is deprecated in puppet.conf." msgstr "" -#: ../lib/puppet/settings.rb:1466 +#: ../lib/puppet/settings.rb:1481 msgid "Error converting value for param '%{name}': %{detail}" msgstr "" -#: ../lib/puppet/settings.rb:1490 +#: ../lib/puppet/settings.rb:1505 msgid "Could not find value for %{expression}" msgstr "" #. TRANSLATORS '$environment' is a Puppet specific variable and should not be translated -#: ../lib/puppet/settings.rb:1500 +#: ../lib/puppet/settings.rb:1515 msgid "You cannot interpolate $environment within '%{setting_name}' when using directory environments." msgstr "" -#: ../lib/puppet/settings.rb:1501 +#: ../lib/puppet/settings.rb:1516 msgid "Its value will remain %{value}." msgstr "" -#: ../lib/puppet/settings.rb:1532 +#: ../lib/puppet/settings.rb:1547 msgid "Attempt to assign a value to unknown setting %{name}" msgstr "" @@ -7968,56 +7968,56 @@ msgstr "" msgid "'%{cmd}' returned %{status} instead of one of [%{expected}]" msgstr "" -#: ../lib/puppet/type/exec.rb:204 -msgid "Command must be a String, got value of class %{klass}" +#: ../lib/puppet/type/exec.rb:205 +msgid "Command must be a String or Array, got value of class %{klass}" msgstr "" -#: ../lib/puppet/type/exec.rb:236 +#: ../lib/puppet/type/exec.rb:238 msgid "Unable to execute commands as other users on Windows" msgstr "" -#: ../lib/puppet/type/exec.rb:238 +#: ../lib/puppet/type/exec.rb:240 msgid "Only root can execute commands as other users" msgstr "" -#: ../lib/puppet/type/exec.rb:294 +#: ../lib/puppet/type/exec.rb:296 msgid "Invalid environment setting '%{value}'" msgstr "" -#: ../lib/puppet/type/exec.rb:307 +#: ../lib/puppet/type/exec.rb:309 msgid "The umask specification is invalid: %{value}" msgstr "" -#: ../lib/puppet/type/exec.rb:323 +#: ../lib/puppet/type/exec.rb:325 msgid "The timeout must be a number." msgstr "" -#: ../lib/puppet/type/exec.rb:340 +#: ../lib/puppet/type/exec.rb:342 msgid "Tries must be an integer" msgstr "" -#: ../lib/puppet/type/exec.rb:344 +#: ../lib/puppet/type/exec.rb:346 msgid "Tries must be an integer >= 1" msgstr "" -#: ../lib/puppet/type/exec.rb:357 +#: ../lib/puppet/type/exec.rb:359 msgid "try_sleep must be a number" msgstr "" -#: ../lib/puppet/type/exec.rb:361 +#: ../lib/puppet/type/exec.rb:363 msgid "try_sleep cannot be a negative number" msgstr "" #. TRANSLATORS 'creates' is a parameter name and should not be translated -#: ../lib/puppet/type/exec.rb:433 +#: ../lib/puppet/type/exec.rb:435 msgid "Checking that 'creates' path '%{creates_path}' exists" msgstr "" -#: ../lib/puppet/type/exec.rb:478 ../lib/puppet/type/exec.rb:534 +#: ../lib/puppet/type/exec.rb:484 ../lib/puppet/type/exec.rb:544 msgid "Check %{value} exceeded timeout" msgstr "" -#: ../lib/puppet/type/exec.rb:623 +#: ../lib/puppet/type/exec.rb:636 msgid "'%{cmd}' won't be executed because of failed check '%{check}'" msgstr "" From adff6280c0e489f35a0dd96945a25bde97b20ff2 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Wed, 30 Jun 2021 15:24:28 -0700 Subject: [PATCH 405/731] (maint) Update tests to match more strict settings behavior Prior to eeb61d1c64, puppet automatically coerced settings whose values were all digits to an integer. Puppet no longer does that, instead it stores the value that was set, and converts the value when it is looked up, based on the settings' type, e.g. :integer, :enum, etc. The facter_spec change is because `serverport` is a `:port` setting so trying to set it to "baz" is invalid. It's not a breaking change, because running `puppet agent -t --serverport baz` would never have worked. The setting_spec change is because we no longer coerce the string to an integer. --- spec/integration/indirector/facts/facter_spec.rb | 2 +- spec/unit/settings_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/integration/indirector/facts/facter_spec.rb b/spec/integration/indirector/facts/facter_spec.rb index 8fc02a09579..cf50b98369e 100644 --- a/spec/integration/indirector/facts/facter_spec.rb +++ b/spec/integration/indirector/facts/facter_spec.rb @@ -127,7 +127,7 @@ it "prefers agent_specified_environment from agent if set in multiple sections" do set_puppet_conf(Puppet[:confdir], <<~CONF) [main] - serverport=baz + serverport=80 [agent] environment=bar diff --git a/spec/unit/settings_spec.rb b/spec/unit/settings_spec.rb index 8cef07852f5..d8d213e8ead 100644 --- a/spec/unit/settings_spec.rb +++ b/spec/unit/settings_spec.rb @@ -277,7 +277,7 @@ def stub_config_with(content) it "should retrieve numeric settings from the CLI" do @settings.handlearg("--myval", "12") - expect(@settings.set_by_cli(:myval)).to eq(12) + expect(@settings.set_by_cli(:myval)).to eq("12") expect(@settings.set_by_cli?(:myval)).to be true end From 4f6c2b48bec49c02ba4dd47e242efa535aeb19a4 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Wed, 30 Jun 2021 23:07:39 +0000 Subject: [PATCH 406/731] (packaging) Updating the puppet.pot file --- locales/puppet.pot | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/locales/puppet.pot b/locales/puppet.pot index ee56bf7df75..667a6367475 100644 --- a/locales/puppet.pot +++ b/locales/puppet.pot @@ -6,11 +6,11 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Puppet automation framework 7.8.0-92-g2cca41ff49\n" +"Project-Id-Version: Puppet automation framework 7.8.0-95-gc6923c49e6\n" "\n" "Report-Msgid-Bugs-To: https://tickets.puppetlabs.com\n" -"POT-Creation-Date: 2021-06-30 12:22+0000\n" -"PO-Revision-Date: 2021-06-30 12:22+0000\n" +"POT-Creation-Date: 2021-06-30 23:07+0000\n" +"PO-Revision-Date: 2021-06-30 23:07+0000\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -7064,26 +7064,34 @@ msgid "Class '%{klass}' is already defined%{error}; cannot redefine" msgstr "" #: ../lib/puppet/resource/type_collection.rb:64 +msgid "Node '%{klass}' is already defined%{error}; cannot be redefined as a class" +msgstr "" + +#: ../lib/puppet/resource/type_collection.rb:65 msgid "Definition '%{klass}' is already defined%{error}; cannot be redefined as a class" msgstr "" -#: ../lib/puppet/resource/type_collection.rb:95 +#: ../lib/puppet/resource/type_collection.rb:96 msgid "Node '%{name}' is already defined%{error}; cannot redefine" msgstr "" -#: ../lib/puppet/resource/type_collection.rb:130 +#: ../lib/puppet/resource/type_collection.rb:97 +msgid "Class '%{klass}' is already defined%{error}; cannot be redefined as a node" +msgstr "" + +#: ../lib/puppet/resource/type_collection.rb:132 msgid "'%{name}' is already defined%{error} as a class; cannot redefine as a definition" msgstr "" -#: ../lib/puppet/resource/type_collection.rb:131 +#: ../lib/puppet/resource/type_collection.rb:133 msgid "Definition '%{name}' is already defined%{error}; cannot be redefined" msgstr "" -#: ../lib/puppet/resource/type_collection.rb:175 +#: ../lib/puppet/resource/type_collection.rb:177 msgid "Execution of config_version command `%{cmd}` failed: %{message}" msgstr "" -#: ../lib/puppet/resource/type_collection.rb:196 +#: ../lib/puppet/resource/type_collection.rb:198 msgid "Not attempting to load %{type} %{fqname} as this object was missing during a prior compilation" msgstr "" From 9a99060c97cc81e84b83d4df868361b3506cd742 Mon Sep 17 00:00:00 2001 From: Gabriel Nagy Date: Thu, 1 Jul 2021 10:13:38 +0300 Subject: [PATCH 407/731] (maint) Fix typo in environment spec --- spec/integration/indirector/facts/facter_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/integration/indirector/facts/facter_spec.rb b/spec/integration/indirector/facts/facter_spec.rb index cf50b98369e..5a69f8cd8c5 100644 --- a/spec/integration/indirector/facts/facter_spec.rb +++ b/spec/integration/indirector/facts/facter_spec.rb @@ -127,7 +127,7 @@ it "prefers agent_specified_environment from agent if set in multiple sections" do set_puppet_conf(Puppet[:confdir], <<~CONF) [main] - serverport=80 + environment=baz [agent] environment=bar From 30ade2bb899482cfa52592a0e4ba74f169613579 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Thu, 1 Jul 2021 08:10:12 +0000 Subject: [PATCH 408/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 2 +- man/man8/puppet-agent.8 | 2 +- man/man8/puppet-apply.8 | 2 +- man/man8/puppet-catalog.8 | 2 +- man/man8/puppet-config.8 | 2 +- man/man8/puppet-describe.8 | 2 +- man/man8/puppet-device.8 | 2 +- man/man8/puppet-doc.8 | 2 +- man/man8/puppet-epp.8 | 2 +- man/man8/puppet-facts.8 | 2 +- man/man8/puppet-filebucket.8 | 2 +- man/man8/puppet-generate.8 | 2 +- man/man8/puppet-help.8 | 2 +- man/man8/puppet-lookup.8 | 2 +- man/man8/puppet-module.8 | 2 +- man/man8/puppet-node.8 | 2 +- man/man8/puppet-parser.8 | 2 +- man/man8/puppet-plugin.8 | 2 +- man/man8/puppet-report.8 | 2 +- man/man8/puppet-resource.8 | 2 +- man/man8/puppet-script.8 | 2 +- man/man8/puppet-ssl.8 | 2 +- man/man8/puppet.8 | 2 +- 23 files changed, 23 insertions(+), 23 deletions(-) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index c2a17fa0845..6fd562af7d5 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPETCONF" "5" "June 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPETCONF" "5" "July 2021" "Puppet, Inc." "Puppet manual" \fBThis page is autogenerated; any changes will get overwritten\fR . .SH "Configuration settings" diff --git a/man/man8/puppet-agent.8 b/man/man8/puppet-agent.8 index 6954b43325c..d4efa281753 100644 --- a/man/man8/puppet-agent.8 +++ b/man/man8/puppet-agent.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-AGENT" "8" "June 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-AGENT" "8" "July 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-agent\fR \- The puppet agent daemon diff --git a/man/man8/puppet-apply.8 b/man/man8/puppet-apply.8 index 6d39315043b..e46175fa844 100644 --- a/man/man8/puppet-apply.8 +++ b/man/man8/puppet-apply.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-APPLY" "8" "June 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-APPLY" "8" "July 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-apply\fR \- Apply Puppet manifests locally diff --git a/man/man8/puppet-catalog.8 b/man/man8/puppet-catalog.8 index 5984ef40c31..fcb3081e6de 100644 --- a/man/man8/puppet-catalog.8 +++ b/man/man8/puppet-catalog.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-CATALOG" "8" "June 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-CATALOG" "8" "July 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-catalog\fR \- Compile, save, view, and convert catalogs\. diff --git a/man/man8/puppet-config.8 b/man/man8/puppet-config.8 index 087891f0a70..aa826da0835 100644 --- a/man/man8/puppet-config.8 +++ b/man/man8/puppet-config.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-CONFIG" "8" "June 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-CONFIG" "8" "July 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-config\fR \- Interact with Puppet\'s settings\. diff --git a/man/man8/puppet-describe.8 b/man/man8/puppet-describe.8 index 3998cd0896b..32a07d7a872 100644 --- a/man/man8/puppet-describe.8 +++ b/man/man8/puppet-describe.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-DESCRIBE" "8" "June 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-DESCRIBE" "8" "July 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-describe\fR \- Display help about resource types diff --git a/man/man8/puppet-device.8 b/man/man8/puppet-device.8 index ac528032f4c..1caf5cadb37 100644 --- a/man/man8/puppet-device.8 +++ b/man/man8/puppet-device.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-DEVICE" "8" "June 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-DEVICE" "8" "July 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-device\fR \- Manage remote network devices diff --git a/man/man8/puppet-doc.8 b/man/man8/puppet-doc.8 index 9524c2e0f45..b8fbbec0d15 100644 --- a/man/man8/puppet-doc.8 +++ b/man/man8/puppet-doc.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-DOC" "8" "June 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-DOC" "8" "July 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-doc\fR \- Generate Puppet references diff --git a/man/man8/puppet-epp.8 b/man/man8/puppet-epp.8 index 9403650347d..ca2f34a32c5 100644 --- a/man/man8/puppet-epp.8 +++ b/man/man8/puppet-epp.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-EPP" "8" "June 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-EPP" "8" "July 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-epp\fR \- Interact directly with the EPP template parser/renderer\. diff --git a/man/man8/puppet-facts.8 b/man/man8/puppet-facts.8 index 2591510b82d..b1ce9fd3f9d 100644 --- a/man/man8/puppet-facts.8 +++ b/man/man8/puppet-facts.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-FACTS" "8" "June 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-FACTS" "8" "July 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-facts\fR \- Retrieve and store facts\. diff --git a/man/man8/puppet-filebucket.8 b/man/man8/puppet-filebucket.8 index a615ada256e..b667d673ffb 100644 --- a/man/man8/puppet-filebucket.8 +++ b/man/man8/puppet-filebucket.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-FILEBUCKET" "8" "June 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-FILEBUCKET" "8" "July 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-filebucket\fR \- Store and retrieve files in a filebucket diff --git a/man/man8/puppet-generate.8 b/man/man8/puppet-generate.8 index aac9ec46894..f31cf9d632f 100644 --- a/man/man8/puppet-generate.8 +++ b/man/man8/puppet-generate.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-GENERATE" "8" "June 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-GENERATE" "8" "July 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-generate\fR \- Generates Puppet code from Ruby definitions\. diff --git a/man/man8/puppet-help.8 b/man/man8/puppet-help.8 index eadb8b01e27..7f5d5ec9d51 100644 --- a/man/man8/puppet-help.8 +++ b/man/man8/puppet-help.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-HELP" "8" "June 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-HELP" "8" "July 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-help\fR \- Display Puppet help\. diff --git a/man/man8/puppet-lookup.8 b/man/man8/puppet-lookup.8 index 267a7cdbc09..229235cc650 100644 --- a/man/man8/puppet-lookup.8 +++ b/man/man8/puppet-lookup.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-LOOKUP" "8" "June 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-LOOKUP" "8" "July 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-lookup\fR \- Interactive Hiera lookup diff --git a/man/man8/puppet-module.8 b/man/man8/puppet-module.8 index f09ba5c5a68..025360f4e99 100644 --- a/man/man8/puppet-module.8 +++ b/man/man8/puppet-module.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-MODULE" "8" "June 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-MODULE" "8" "July 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-module\fR \- Creates, installs and searches for modules on the Puppet Forge\. diff --git a/man/man8/puppet-node.8 b/man/man8/puppet-node.8 index 7754ca72bb1..e05f3f65d97 100644 --- a/man/man8/puppet-node.8 +++ b/man/man8/puppet-node.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-NODE" "8" "June 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-NODE" "8" "July 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-node\fR \- View and manage node definitions\. diff --git a/man/man8/puppet-parser.8 b/man/man8/puppet-parser.8 index 5ae92f28ae7..5d213e05612 100644 --- a/man/man8/puppet-parser.8 +++ b/man/man8/puppet-parser.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-PARSER" "8" "June 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-PARSER" "8" "July 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-parser\fR \- Interact directly with the parser\. diff --git a/man/man8/puppet-plugin.8 b/man/man8/puppet-plugin.8 index a0752581363..693dd897a19 100644 --- a/man/man8/puppet-plugin.8 +++ b/man/man8/puppet-plugin.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-PLUGIN" "8" "June 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-PLUGIN" "8" "July 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-plugin\fR \- Interact with the Puppet plugin system\. diff --git a/man/man8/puppet-report.8 b/man/man8/puppet-report.8 index f9d453d7f50..70e9d4e8e85 100644 --- a/man/man8/puppet-report.8 +++ b/man/man8/puppet-report.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-REPORT" "8" "June 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-REPORT" "8" "July 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-report\fR \- Create, display, and submit reports\. diff --git a/man/man8/puppet-resource.8 b/man/man8/puppet-resource.8 index 7c41ac05061..52810f031c5 100644 --- a/man/man8/puppet-resource.8 +++ b/man/man8/puppet-resource.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-RESOURCE" "8" "June 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-RESOURCE" "8" "July 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-resource\fR \- The resource abstraction layer shell diff --git a/man/man8/puppet-script.8 b/man/man8/puppet-script.8 index 3bf7a70e77d..796fea8665b 100644 --- a/man/man8/puppet-script.8 +++ b/man/man8/puppet-script.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-SCRIPT" "8" "June 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-SCRIPT" "8" "July 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-script\fR \- Run a puppet manifests as a script without compiling a catalog diff --git a/man/man8/puppet-ssl.8 b/man/man8/puppet-ssl.8 index dffbbc2c24d..a9118fb172d 100644 --- a/man/man8/puppet-ssl.8 +++ b/man/man8/puppet-ssl.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-SSL" "8" "June 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-SSL" "8" "July 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-ssl\fR \- Manage SSL keys and certificates for puppet SSL clients diff --git a/man/man8/puppet.8 b/man/man8/puppet.8 index 8659e452672..a20ffcf6bdd 100644 --- a/man/man8/puppet.8 +++ b/man/man8/puppet.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET" "8" "June 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET" "8" "July 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\fR From 2cb83ae8eed73031d95862b130e32007d47a802c Mon Sep 17 00:00:00 2001 From: Lightning Date: Thu, 1 Jul 2021 11:31:02 +0200 Subject: [PATCH 409/731] (PUP-11131) Honor explicitly configured "purge_ssh_keys: false" this makes an explicitly configured "purge_ssh_keys: false" in type "user" bypass the whole purging mechanism as expected --- lib/puppet/type/user.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/puppet/type/user.rb b/lib/puppet/type/user.rb index c064bc76bd1..1543eb1eb0f 100644 --- a/lib/puppet/type/user.rb +++ b/lib/puppet/type/user.rb @@ -695,7 +695,7 @@ def delimiter end def generate - if !self[:purge_ssh_keys].empty? + if !self[:purge_ssh_keys].empty? && self[:purge_ssh_keys] != :false return [] if self[:ensure] == :present && !provider.exists? if Puppet::Type.type(:ssh_authorized_key).nil? warning _("Ssh_authorized_key type is not available. Cannot purge SSH keys.") From 159b06614b52fd32a58f3f2a6d3eed64a9a0cd9b Mon Sep 17 00:00:00 2001 From: Dorin Pleava Date: Wed, 23 Jun 2021 14:13:41 +0300 Subject: [PATCH 410/731] (PUP-3317) Windows exe packages can be sourced from URL Windows exe packages can now be install from a URL source. It downloads the package locally, and runs the file with the command options. --- lib/puppet/provider/package/windows.rb | 15 ++++++++- .../provider/package/windows/exe_package.rb | 31 ++++++++++++++++++- .../provider/package/windows/package.rb | 3 +- .../package/windows/exe_package_spec.rb | 17 ++++++++++ 4 files changed, 63 insertions(+), 3 deletions(-) diff --git a/lib/puppet/provider/package/windows.rb b/lib/puppet/provider/package/windows.rb index aec8b45493d..69b6ad82190 100644 --- a/lib/puppet/provider/package/windows.rb +++ b/lib/puppet/provider/package/windows.rb @@ -30,6 +30,19 @@ has_feature :versionable attr_accessor :package + class << self + attr_accessor :paths + end + + def self.post_resource_eval + @paths.each do |path| + begin + Puppet::FileSystem.unlink(path) + rescue => detail + raise Puppet::Error.new(_("Error when unlinking %{path}: %{detail}") % { path: path ,detail: detail.message}, detail) + end + end if @paths + end # Return an array of provider instances def self.instances @@ -64,7 +77,7 @@ def install command = [installer.install_command(resource), install_options].flatten.compact.join(' ') working_dir = File.dirname(resource[:source]) - if !Puppet::FileSystem.exist?(working_dir) && resource[:source] =~ /\.msi"?\Z/i + unless Puppet::FileSystem.exist?(working_dir) working_dir = nil end output = execute(command, :failonfail => false, :combine => true, :cwd => working_dir, :suppress_window => true) diff --git a/lib/puppet/provider/package/windows/exe_package.rb b/lib/puppet/provider/package/windows/exe_package.rb index b5406af7a27..ff264dd8802 100644 --- a/lib/puppet/provider/package/windows/exe_package.rb +++ b/lib/puppet/provider/package/windows/exe_package.rb @@ -17,6 +17,11 @@ class ExePackage < Puppet::Provider::Package::Windows::Package 'WindowsInstaller', ] + def self.register(path) + Puppet::Type::Package::ProviderWindows.paths ||= [] + Puppet::Type::Package::ProviderWindows.paths << path + end + # Return an instance of the package from the registry, or nil def self.from_registry(name, values) if valid?(name, values) @@ -55,7 +60,31 @@ def match?(resource) end def self.install_command(resource) - munge(resource[:source]) + file_location = resource[:source] + if file_location.start_with?('http://', 'https://') + tempfile = Tempfile.new(['','.exe']) + begin + uri = URI(Puppet::Util.uri_encode(file_location)) + client = Puppet.runtime[:http] + client.get(uri, options: { include_system_store: true }) do |response| + raise Puppet::HTTP::ResponseError.new(response) unless response.success? + + File.open(tempfile.path, 'wb') do |file| + response.read_body do |data| + file.write(data) + end + end + end + rescue => detail + raise Puppet::Error.new(_("Error when installing %{package}: %{detail}") % { package: resource[:name] ,detail: detail.message}, detail) + ensure + self.register(tempfile.path) + tempfile.close() + file_location = tempfile.path + end + end + + munge(file_location) end def uninstall_command diff --git a/lib/puppet/provider/package/windows/package.rb b/lib/puppet/provider/package/windows/package.rb index cb31c89299f..78748c13c40 100644 --- a/lib/puppet/provider/package/windows/package.rb +++ b/lib/puppet/provider/package/windows/package.rb @@ -67,7 +67,8 @@ def self.installer_class(resource) # REMIND: what about msp, etc MsiPackage when /\.exe"?\Z/i - fail(_("The source does not exist: '%{source}'") % { source: resource[:source] }) unless Puppet::FileSystem.exist?(resource[:source]) + fail(_("The source does not exist: '%{source}'") % { source: resource[:source] }) unless + Puppet::FileSystem.exist?(resource[:source]) || resource[:source].start_with?('http://', 'https://') ExePackage else fail(_("Don't know how to install '%{source}'") % { source: resource[:source] }) diff --git a/spec/unit/provider/package/windows/exe_package_spec.rb b/spec/unit/provider/package/windows/exe_package_spec.rb index 9c6e1acffaa..405bedf1992 100644 --- a/spec/unit/provider/package/windows/exe_package_spec.rb +++ b/spec/unit/provider/package/windows/exe_package_spec.rb @@ -1,5 +1,6 @@ require 'spec_helper' require 'puppet/provider/package/windows/exe_package' +require 'puppet/provider/package/windows' describe Puppet::Provider::Package::Windows::ExePackage do let (:name) { 'Git version 1.7.11' } @@ -71,10 +72,26 @@ context '#install_command' do it 'should install using the source' do + allow(Puppet::FileSystem).to receive(:exist?).with(source).and_return(true) cmd = described_class.install_command({:source => source}) expect(cmd).to eq(source) end + + it 'should raise error when URI is invalid' do + web_source = 'https://www.t e s t.test/test.exe' + + expect do + described_class.install_command({:source => web_source, :name => name}) + end.to raise_error(Puppet::Error, /Error when installing #{name}:/) + end + + it 'should download package from source file before installing', if: Puppet::Util::Platform.windows? do + web_source = 'https://www.test.test/test.exe' + stub_request(:get, web_source).to_return(status: 200, body: 'package binaries') + cmd = described_class.install_command({:source => web_source}) + expect(File.read(cmd)).to eq('package binaries') + end end context '#uninstall_command' do From 5d562099d4cae6bfa53ca8f0eea71c8ba34114ba Mon Sep 17 00:00:00 2001 From: Ciprian Badescu Date: Thu, 1 Jul 2021 17:37:40 +0300 Subject: [PATCH 411/731] Revert "(PUP-10955) Normalize environment name to symbol before caching" This reverts commit 0d8c1d5a1b70674450fd80e919d198ab919bcb46. --- lib/puppet/environments.rb | 3 -- spec/unit/environments_spec.rb | 64 ----------------------------- spec/unit/functions/logging_spec.rb | 1 - 3 files changed, 68 deletions(-) diff --git a/lib/puppet/environments.rb b/lib/puppet/environments.rb index c38db48bdf8..e10a080de5a 100644 --- a/lib/puppet/environments.rb +++ b/lib/puppet/environments.rb @@ -379,7 +379,6 @@ def get(name) # This strategy favors smaller memory footprint over environment # retrieval time. clear_all_expired - name = name.to_sym result = @cache[name] if result Puppet.debug {"Found in cache '#{name}' #{result.label}"} @@ -414,7 +413,6 @@ def clear_entry(name, entry) # Clears the cache of the environment with the given name. # (The intention is that this could be used from a MANUAL cache eviction command (TBD) def clear(name) - name = name.to_sym entry = @cache[name] clear_entry(name, entry) if entry end @@ -464,7 +462,6 @@ def clear_if_expired(name, entry, t = Time.now) # # @!macro loader_get_conf def get_conf(name) - name = name.to_sym clear_if_expired(name, @cache[name]) @loader.get_conf(name) end diff --git a/spec/unit/environments_spec.rb b/spec/unit/environments_spec.rb index 8b1882ca7bf..a97d415ad58 100644 --- a/spec/unit/environments_spec.rb +++ b/spec/unit/environments_spec.rb @@ -607,51 +607,6 @@ cached.get(:cached) end - it "normalizes environment name to symbol" do - env = Puppet::Node::Environment.create(:cached, []) - mocked_loader = double('loader') - - expect(mocked_loader).not_to receive(:get).with('cached') - expect(mocked_loader).to receive(:get).with(:cached).and_return(env).once - expect(mocked_loader).to receive(:get_conf).with(:cached).and_return(Puppet::Settings::EnvironmentConf.static_for(env, 20)).once - - cached = Puppet::Environments::Cached.new(mocked_loader) - cached.get('cached') - cached.get(:cached) - end - - it "caches environment name as symbol and only once" do - mocked_loader = double('loader') - - env = Puppet::Node::Environment.create(:cached, []) - allow(mocked_loader).to receive(:get).with(:cached).and_return(env) - allow(mocked_loader).to receive(:get_conf).with(:cached).and_return(Puppet::Settings::EnvironmentConf.static_for(env, 20)) - - cached = Puppet::Environments::Cached.new(mocked_loader) - cached.get(:cached) - cached.get('cached') - - expect(cached.instance_variable_get(:@cache).keys).to eq([:cached]) - end - - it "is able to cache multiple environments" do - mocked_loader = double('loader') - - env1 = Puppet::Node::Environment.create(:env1, []) - allow(mocked_loader).to receive(:get).with(:env1).and_return(env1) - allow(mocked_loader).to receive(:get_conf).with(:env1).and_return(Puppet::Settings::EnvironmentConf.static_for(env1, 20)) - - env2 = Puppet::Node::Environment.create(:env2, []) - allow(mocked_loader).to receive(:get).with(:env2).and_return(env2) - allow(mocked_loader).to receive(:get_conf).with(:env2).and_return(Puppet::Settings::EnvironmentConf.static_for(env2, 20)) - - cached = Puppet::Environments::Cached.new(mocked_loader) - cached.get('env1') - cached.get('env2') - - expect(cached.instance_variable_get(:@cache).keys).to eq([:env1, :env2]) - end - it "returns nil if env not found" do cached_loader_from(:filesystem => [directory_tree], :directory => directory_tree.children.first) do |loader| expect(loader.get(:doesnotexist)).to be_nil @@ -707,17 +662,6 @@ cached.get_conf(:cached) end - it "normalizes environment name to symbol" do - env = Puppet::Node::Environment.create(:cached, []) - mocked_loader = double('loader') - expect(mocked_loader).to receive(:get_conf).with(:cached).and_return(Puppet::Settings::EnvironmentConf.static_for(env, 20)).twice - - cached = Puppet::Environments::Cached.new(mocked_loader) - - cached.get_conf('cached') - cached.get_conf(:cached) - end - it "returns nil if environment is not found" do cached_loader_from(:filesystem => [directory_tree], :directory => directory_tree.children.first) do |loader| expect(loader.get_conf(:doesnotexist)).to be_nil @@ -819,14 +763,6 @@ expect(service.evicted_envs).to eq([:an_environment]) end - - it "normalizes environment name to symbol" do - with_environment_loaded(service) do |cached| - cached.clear('an_environment') - end - - expect(service.evicted_envs).to eq([:an_environment]) - end end context '#clear_all' do diff --git a/spec/unit/functions/logging_spec.rb b/spec/unit/functions/logging_spec.rb index 65b0c1bbedd..63f556194e2 100644 --- a/spec/unit/functions/logging_spec.rb +++ b/spec/unit/functions/logging_spec.rb @@ -6,7 +6,6 @@ def collect_logs(code) Puppet[:code] = code - Puppet[:environment_timeout] = 10 node = Puppet::Node.new('logtest') compiler = Puppet::Parser::Compiler.new(node) node.environment.check_for_reparse From 118d5a8c501e97bb7ce0bf7773e2f312e2955d23 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Tue, 6 Jul 2021 12:22:50 +0000 Subject: [PATCH 412/731] (packaging) Updating the puppet.pot file --- locales/puppet.pot | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/locales/puppet.pot b/locales/puppet.pot index 667a6367475..6e0ae506dd4 100644 --- a/locales/puppet.pot +++ b/locales/puppet.pot @@ -6,11 +6,11 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Puppet automation framework 7.8.0-95-gc6923c49e6\n" +"Project-Id-Version: Puppet automation framework 7.8.0-115-g2e290b736f\n" "\n" "Report-Msgid-Bugs-To: https://tickets.puppetlabs.com\n" -"POT-Creation-Date: 2021-06-30 23:07+0000\n" -"PO-Revision-Date: 2021-06-30 23:07+0000\n" +"POT-Creation-Date: 2021-07-06 12:22+0000\n" +"PO-Revision-Date: 2021-07-06 12:22+0000\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -2117,7 +2117,7 @@ msgstr "" msgid "slice(): block must define one parameter, or the same number of parameters as the given size of the slice (%{slice_size}). Block has %{serving_size}; %{parameter_names}" msgstr "" -#: ../lib/puppet/functions/strftime.rb:207 +#: ../lib/puppet/functions/strftime.rb:208 msgid "The argument signature (String format, [String timezone]) is deprecated for #strftime. See #strftime documentation and Timespan type for more info" msgstr "" @@ -6685,22 +6685,30 @@ msgstr "" msgid "Package %{name} was not present after trying to install it" msgstr "" -#: ../lib/puppet/provider/package/windows.rb:97 +#: ../lib/puppet/provider/package/windows.rb:42 +msgid "Error when unlinking %{path}: %{detail}" +msgstr "" + +#: ../lib/puppet/provider/package/windows.rb:110 msgid "The package %{operation}ed successfully and the system is rebooting now." msgstr "" -#: ../lib/puppet/provider/package/windows.rb:99 +#: ../lib/puppet/provider/package/windows.rb:112 msgid "The package %{operation}ed successfully, but the system must be rebooted." msgstr "" -#: ../lib/puppet/provider/package/windows.rb:101 +#: ../lib/puppet/provider/package/windows.rb:114 msgid "Failed to %{operation}" msgstr "" -#: ../lib/puppet/provider/package/windows.rb:107 +#: ../lib/puppet/provider/package/windows.rb:120 msgid "The source parameter cannot be empty when using the Windows provider." msgstr "" +#: ../lib/puppet/provider/package/windows/exe_package.rb:79 +msgid "Error when installing %{package}: %{detail}" +msgstr "" + #: ../lib/puppet/provider/package/windows/package.rb:62 msgid "The source parameter is required when using the Windows provider." msgstr "" @@ -6709,7 +6717,7 @@ msgstr "" msgid "The source does not exist: '%{source}'" msgstr "" -#: ../lib/puppet/provider/package/windows/package.rb:73 +#: ../lib/puppet/provider/package/windows/package.rb:74 msgid "Don't know how to install '%{source}'" msgstr "" From 100f7a3c166ea797eb8a9eb42133f5ac2dc1b0ed Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Thu, 8 Jul 2021 12:59:14 +0000 Subject: [PATCH 413/731] (packaging) Bump to version '7.10.0' [no-promote] --- .gemspec | 2 +- lib/puppet/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gemspec b/.gemspec index ad779e0fcf2..4fd6d52aa56 100644 --- a/.gemspec +++ b/.gemspec @@ -13,7 +13,7 @@ Gem::Specification.new do |s| s.name = "puppet" - version = "7.9.0" + version = "7.10.0" mdata = version.match(/(\d+\.\d+\.\d+)/) s.version = mdata ? mdata[1] : version diff --git a/lib/puppet/version.rb b/lib/puppet/version.rb index 2de9925aee1..e99f8af9369 100644 --- a/lib/puppet/version.rb +++ b/lib/puppet/version.rb @@ -6,7 +6,7 @@ # Raketasks and such to set the version based on the output of `git describe` module Puppet - PUPPETVERSION = '7.9.0' + PUPPETVERSION = '7.10.0' ## # version is a public API method intended to always provide a fast and From aa1df95ab3c8ee5bd8f007ba45cca422b1de2498 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Thu, 8 Jul 2021 13:08:51 +0000 Subject: [PATCH 414/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 2 +- man/man8/puppet.8 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index 6fd562af7d5..5ac9e4f1401 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -913,7 +913,7 @@ The time to wait for data to be read from an HTTP connection\. If nothing is rea The HTTP User\-Agent string to send when making network requests\. . .IP "\(bu" 4 -\fIDefault\fR: \fBPuppet/7\.9\.0 Ruby/2\.5\.1\-p57 (x86_64\-linux)\fR +\fIDefault\fR: \fBPuppet/7\.10\.0 Ruby/2\.5\.1\-p57 (x86_64\-linux)\fR . .IP "" 0 . diff --git a/man/man8/puppet.8 b/man/man8/puppet.8 index a20ffcf6bdd..c05fac50b45 100644 --- a/man/man8/puppet.8 +++ b/man/man8/puppet.8 @@ -25,4 +25,4 @@ Specialized: 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 . .P -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\.9\.0 +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\.10\.0 From 347aeb42dd88e7d25b42b884ab6d027e0b1825ec Mon Sep 17 00:00:00 2001 From: Tu2607 Date: Thu, 8 Jul 2021 16:00:22 -0700 Subject: [PATCH 415/731] (maint) Fix a bug with the logger in clean.rb This bug arose from adding the option to use debug logging to the puppetserver-ca gem. The error happened when the test for Puppet's 'clean' face in 6.x is ran. The reason behind the error is because we did not have a 'debug' option in our 'LoggerIO' class in 'clean' face. Thus, the solution to the bug is to include the 'debug' option in our logger by adding a debug function in the LoggerIO class. Furthermore, we decided to include the 'warn' option for the logger similar to Puppet's 'clean' face in 7.x so that it's less of a hassle when merging and having a uniform code base. --- lib/puppet/face/node/clean.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/puppet/face/node/clean.rb b/lib/puppet/face/node/clean.rb index 08dce8e4ab6..31256a0d62e 100644 --- a/lib/puppet/face/node/clean.rb +++ b/lib/puppet/face/node/clean.rb @@ -52,7 +52,7 @@ def debug(message) end def warn(message) - Puppet.warning(message) + Puppet.warning(message) unless message =~ /cadir is currently configured to be inside/ end def err(message) From 09aa69bbfafb88d8ca660e4d07de56f8811fdff2 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Thu, 15 Jul 2021 08:40:20 +0000 Subject: [PATCH 416/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index 5ac9e4f1401..7abbbb0bdbe 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -438,6 +438,14 @@ This setting has been deprecated\. Use of any value other than \'hiera\' should . .IP "" 0 . +.SS "default_agent_environment" +The default environment for puppet agent\. Set by default to \'production\', and is the fallback environment in case the agent runs in an environment not available on the server\. +. +.IP "\(bu" 4 +\fIDefault\fR: \fBproduction\fR +. +.IP "" 0 +. .SS "default_file_terminus" The default source for files if no server is given in a uri, e\.g\. puppet:///file\. The default of \fBrest\fR causes the file to be retrieved using the \fBserver\fR setting\. When running \fBapply\fR the default is \fBfile_server\fR, causing requests to be filled locally\. . From b6e983bef76b7d6825c30da3a812de7d5c998d4e Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Sat, 17 Jul 2021 09:24:35 +0000 Subject: [PATCH 417/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 8 -------- 1 file changed, 8 deletions(-) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index 7abbbb0bdbe..5ac9e4f1401 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -438,14 +438,6 @@ This setting has been deprecated\. Use of any value other than \'hiera\' should . .IP "" 0 . -.SS "default_agent_environment" -The default environment for puppet agent\. Set by default to \'production\', and is the fallback environment in case the agent runs in an environment not available on the server\. -. -.IP "\(bu" 4 -\fIDefault\fR: \fBproduction\fR -. -.IP "" 0 -. .SS "default_file_terminus" The default source for files if no server is given in a uri, e\.g\. puppet:///file\. The default of \fBrest\fR causes the file to be retrieved using the \fBserver\fR setting\. When running \fBapply\fR the default is \fBfile_server\fR, causing requests to be filled locally\. . From a68574e063d74eda66d7e26ad493ad8372a3803d Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Mon, 26 Jul 2021 05:24:07 +0000 Subject: [PATCH 418/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 46 ++++++++++++++++++++-------------------- man/man8/puppet-module.8 | 4 ++-- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index 5ac9e4f1401..b2d0c3ddcf6 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -82,7 +82,7 @@ Whether log files should always flush to disk\. .IP "" 0 . .SS "autosign" -Whether (and how) to autosign certificate requests\. This setting is only relevant on a puppet master acting as a certificate authority (CA)\. +Whether (and how) to autosign certificate requests\. This setting is only relevant on a Puppet Server acting as a certificate authority (CA)\. . .P Valid values are true (autosigns all certificate requests; not recommended), false (disables autosigning certificates), or the absolute path to a file\. @@ -91,7 +91,7 @@ Valid values are true (autosigns all certificate requests; not recommended), fal The file specified in this setting may be either a \fBconfiguration file\fR or a \fBcustom policy executable\.\fR Puppet will automatically determine what it is: If the Puppet user (see the \fBuser\fR setting) can execute the file, it will be treated as a policy executable; otherwise, it will be treated as a config file\. . .P -If a custom policy executable is configured, the CA puppet master will run it every time it receives a CSR\. The executable will be passed the subject CN of the request \fIas a command line argument,\fR and the contents of the CSR in PEM format \fIon stdin\.\fR It should exit with a status of 0 if the cert should be autosigned and non\-zero if the cert should not be autosigned\. +If a custom policy executable is configured, the CA Puppet Server will run it every time it receives a CSR\. The executable will be passed the subject CN of the request \fIas a command line argument,\fR and the contents of the CSR in PEM format \fIon stdin\.\fR It should exit with a status of 0 if the cert should be autosigned and non\-zero if the cert should not be autosigned\. . .P If a certificate request is not autosigned, it will persist for review\. An admin user can use the \fBpuppetserver ca sign\fR command to manually sign it, or can delete the request\. @@ -264,7 +264,7 @@ When certificate_revocation is set to \'false\', Puppet disables all certificate .IP "" 0 . .SS "certname" -The name to use when handling certificates\. When a node requests a certificate from the CA puppet master, it uses the value of the \fBcertname\fR setting as its requested Subject CN\. +The name to use when handling certificates\. When a node requests a certificate from the CA Puppet Server, it uses the value of the \fBcertname\fR setting as its requested Subject CN\. . .P This is the name used when managing a node\'s permissions in Puppet Server\'s auth\.conf \fIhttps://puppet\.com/docs/puppetserver/latest/config_file_auth\.html\fR\. In most cases, it is also used as the node\'s name when matching node definitions \fIhttps://puppet\.com/docs/puppet/latest/lang_node_definitions\.html\fR and requesting data from an ENC\. (This can be changed with the \fBnode_name_value\fR and \fBnode_name_fact\fR settings, although you should only do so if you have a compelling reason\.) @@ -398,7 +398,7 @@ If the agent downloads a new CRL, the agent will use it for subsequent network r .IP "" 0 . .SS "csr_attributes" -An optional file containing custom attributes to add to certificate signing requests (CSRs)\. You should ensure that this file does not exist on your CA puppet master; if it does, unwanted certificate extensions may leak into certificates created with the \fBpuppetserver ca generate\fR command\. +An optional file containing custom attributes to add to certificate signing requests (CSRs)\. You should ensure that this file does not exist on your CA Puppet Server; if it does, unwanted certificate extensions may leak into certificates created with the \fBpuppetserver ca generate\fR command\. . .P If present, this file must be a YAML hash containing a \fBcustom_attributes\fR key and/or an \fBextension_requests\fR key\. The value of each key must be a hash, where each key is a valid OID and each value is an object that can be cast to a string\. @@ -579,10 +579,10 @@ Whether to document all resources when using \fBpuppet doc\fR to generate manife .IP "" 0 . .SS "environment" -The environment in which Puppet is running\. For clients, such as \fBpuppet agent\fR, this determines the environment itself, which Puppet uses to find modules and much more\. For servers, such as \fBpuppet master\fR, this provides the default environment for nodes that Puppet knows nothing about\. +The environment in which Puppet is running\. For clients, such as \fBpuppet agent\fR, this determines the environment itself, which Puppet uses to find modules and much more\. For servers, such as \fBpuppet server\fR, this provides the default environment for nodes that Puppet knows nothing about\. . .P -When defining an environment in the \fB[agent]\fR section, this refers to the environment that the agent requests from the master\. The environment doesn\'t have to exist on the local filesystem because the agent fetches it from the master\. This definition is used when running \fBpuppet agent\fR\. +When defining an environment in the \fB[agent]\fR section, this refers to the environment that the agent requests from the primary server\. The environment doesn\'t have to exist on the local filesystem because the agent fetches it from the primary server\. This definition is used when running \fBpuppet agent\fR\. . .P When defined in the \fB[user]\fR section, the environment refers to the path that Puppet uses to search for code and modules related to its execution\. This requires the environment to exist locally on the filesystem where puppet is being executed\. Puppet subcommands, including \fBpuppet module\fR and \fBpuppet apply\fR, use this definition\. @@ -851,7 +851,7 @@ Whether to write HTTP request and responses to stderr\. This should never be use .IP "" 0 . .SS "http_extra_headers" -The list of extra headers that will be sent with http requests to the master\. The header definition consists of a name and a value separated by a colon\. +The list of extra headers that will be sent with http requests to the primary server\. The header definition consists of a name and a value separated by a colon\. . .IP "\(bu" 4 \fIDefault\fR: \fB[]\fR @@ -926,7 +926,7 @@ Whether the puppet run should ignore errors during pluginsync\. If the setting i .IP "" 0 . .SS "ignoremissingtypes" -Skip searching for classes and definitions that were missing during a prior compilation\. The list of missing objects is maintained per\-environment and persists until the environment is cleared or the master is restarted\. +Skip searching for classes and definitions that were missing during a prior compilation\. The list of missing objects is maintained per\-environment and persists until the environment is cleared or the primary server is restarted\. . .IP "\(bu" 4 \fIDefault\fR: \fBfalse\fR @@ -1143,7 +1143,7 @@ Whether Puppet should manage the owner, group, and mode of files it uses interna .IP "" 0 . .SS "manifest" -The entry\-point manifest for puppet master\. This can be one file or a directory of manifests to be evaluated in alphabetical order\. Puppet manages this path as a directory if one exists or if the path ends with a / or \. +The entry\-point manifest for the primary server\. This can be one file or a directory of manifests to be evaluated in alphabetical order\. Puppet manages this path as a directory if one exists or if the path ends with a / or \. . .P Setting a global value for \fBmanifest\fR in puppet\.conf is not allowed (but it can be overridden from the commandline)\. Please use directory environments instead\. If you need to use something other than the environment\'s \fBmanifests\fR directory as the main manifest, you can set \fBmanifest\fR in environment\.conf\. For more info, see \fIhttps://puppet\.com/docs/puppet/latest/environments_about\.html\fR @@ -1294,10 +1294,10 @@ How to store cached nodes\. Valid values are (none), \'json\', \'msgpack\', or \ .IP "" 0 . .SS "node_name_fact" -The fact name used to determine the node name used for all requests the agent makes to the master\. WARNING: This setting is mutually exclusive with node_name_value\. Changing this setting also requires changes to Puppet Server\'s default auth\.conf \fIhttps://puppet\.com/docs/puppetserver/latest/config_file_auth\.html\fR\. +The fact name used to determine the node name used for all requests the agent makes to the primary server\. WARNING: This setting is mutually exclusive with node_name_value\. Changing this setting also requires changes to Puppet Server\'s default auth\.conf \fIhttps://puppet\.com/docs/puppetserver/latest/config_file_auth\.html\fR\. . .SS "node_name_value" -The explicit value used for the node name for all requests the agent makes to the master\. WARNING: This setting is mutually exclusive with node_name_fact\. Changing this setting also requires changes to Puppet Server\'s default auth\.conf \fIhttps://puppet\.com/docs/puppetserver/latest/config_file_auth\.html\fR\. +The explicit value used for the node name for all requests the agent makes to the primary server\. WARNING: This setting is mutually exclusive with node_name_fact\. Changing this setting also requires changes to Puppet Server\'s default auth\.conf \fIhttps://puppet\.com/docs/puppetserver/latest/config_file_auth\.html\fR\. . .IP "\(bu" 4 \fIDefault\fR: \fB$certname\fR @@ -1342,7 +1342,7 @@ The three main node data plugins are: Whether to apply catalogs in noop mode, which allows Puppet to partially simulate a normal run\. This setting affects puppet agent and puppet apply\. . .P -When running in noop mode, Puppet will check whether each resource is in sync, like it does when running normally\. However, if a resource attribute is not in the desired state (as declared in the catalog), Puppet will take no action, and will instead report the changes it \fIwould\fR have made\. These simulated changes will appear in the report sent to the puppet master, or be shown on the console if running puppet agent or puppet apply in the foreground\. The simulated changes will not send refresh events to any subscribing or notified resources, although Puppet will log that a refresh event \fIwould\fR have been sent\. +When running in noop mode, Puppet will check whether each resource is in sync, like it does when running normally\. However, if a resource attribute is not in the desired state (as declared in the catalog), Puppet will take no action, and will instead report the changes it \fIwould\fR have made\. These simulated changes will appear in the report sent to the primary Puppet server, or be shown on the console if running puppet agent or puppet apply in the foreground\. The simulated changes will not send refresh events to any subscribing or notified resources, although Puppet will log that a refresh event \fIwould\fR have been sent\. . .P \fBImportant note:\fR The \fBnoop\fR metaparameter \fIhttps://puppet\.com/docs/puppet/latest/metaparameter\.html#noop\fR allows you to apply individual resources in noop mode, and will override the global value of the \fBnoop\fR setting\. This means a resource with \fBnoop => false\fR \fIwill\fR be changed if necessary, even when running puppet agent with \fBnoop = true\fR or \fB\-\-noop\fR\. (Conversely, a resource with \fBnoop => true\fR will only be simulated, even when noop mode is globally disabled\.) @@ -1517,10 +1517,10 @@ Whether to print the Puppet stack trace on some errors\. This is a noop if \fBtr The fallback log file\. This is only used when the \fB\-\-logdest\fR option is not specified AND Puppet is running on an operating system where both the POSIX syslog service and the Windows Event Log are unavailable\. (Currently, no supported operating systems match that description\.) . .P -Despite the name, both puppet agent and puppet master will use this file as the fallback logging destination\. +Despite the name, both puppet agent and puppet server will use this file as the fallback logging destination\. . .P -For control over logging destinations, see the \fB\-\-logdest\fR command line option in the manual pages for puppet master, puppet agent, and puppet apply\. You can see man pages by running \fBpuppet \-\-help\fR, or read them online at https://puppet\.com/docs/puppet/latest/man/\. +For control over logging destinations, see the \fB\-\-logdest\fR command line option in the manual pages for puppet server, puppet agent, and puppet apply\. You can see man pages by running \fBpuppet \-\-help\fR, or read them online at https://puppet\.com/docs/puppet/latest/man/\. . .IP "\(bu" 4 \fIDefault\fR: \fB$logdir/puppetd\.log\fR @@ -1571,7 +1571,7 @@ The directory in which to store reports\. Each node gets a separate subdirectory The list of report handlers to use\. When using multiple report handlers, their names should be comma\-separated, with whitespace allowed\. (For example, \fBreports = http, store\fR\.) . .P -This setting is relevant to puppet master and puppet apply\. The puppet master will call these report handlers with the reports it receives from agent nodes, and puppet apply will call them with its own report\. (In all cases, the node applying the catalog must have \fBreport = true\fR\.) +This setting is relevant to puppet server and puppet apply\. The primary Puppet server will call these report handlers with the reports it receives from agent nodes, and puppet apply will call them with its own report\. (In all cases, the node applying the catalog must have \fBreport = true\fR\.) . .P See the report reference for information on the built\-in report handlers; custom report handlers can also be loaded from modules\. (Report handlers are loaded from the lib directory, at \fBpuppet/reports/NAME\.rb\fR\.) @@ -1665,7 +1665,7 @@ Where the serial number for certificates is stored\. .IP "" 0 . .SS "server" -The puppet master server to which the puppet agent should connect\. +The primary Puppet server to which the Puppet agent should connect\. . .IP "\(bu" 4 \fIDefault\fR: \fBpuppet\fR @@ -1681,7 +1681,7 @@ The directory in which serialized data is stored, usually in a subdirectory\. .IP "" 0 . .SS "server_list" -The list of Puppet master servers to which the Puppet agent should connect, 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\. +The list of primary Puppet servers to which the Puppet agent should connect, 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\. . .IP "\(bu" 4 \fIDefault\fR: \fB[]\fR @@ -1741,7 +1741,7 @@ For example, assume a default 30\-minute \fB$runinterval\fR, \fBsplay\fR set to With \fBsplay\fR enabled, it waits any amount of time up to its \fB$splaylimit\fR before its first run\. For example, it might randomly wait 8 minutes, then start its first run at :08 past the hour\. With the \fB$runinterval\fR at its default 30 minutes, its next run will be at :38 past the hour\. . .P -If you restart an agent\'s puppet service with \fBsplay\fR enabled, it recalculates its splay period and delays its first agent run after restarting for this new period\. If you simultaneously restart a group of puppet agents with \fBsplay\fR enabled, their checkins to your puppet masters can be distributed more evenly\. +If you restart an agent\'s puppet service with \fBsplay\fR enabled, it recalculates its splay period and delays its first agent run after restarting for this new period\. If you simultaneously restart a group of puppet agents with \fBsplay\fR enabled, their checkins to your primary servers can be distributed more evenly\. . .IP "\(bu" 4 \fIDefault\fR: \fBfalse\fR @@ -1819,7 +1819,7 @@ The directory where Puppet state is stored\. Generally, this directory can be re .IP "" 0 . .SS "statefile" -Where puppet agent and puppet master store state associated with the running configuration\. In the case of puppet master, this file reflects the state discovered through interacting with clients\. +Where Puppet agent and Puppet Server store state associated with the running configuration\. In the case of Puppet Server, this file reflects the state discovered through interacting with clients\. . .IP "\(bu" 4 \fIDefault\fR: \fB$statedir/state\.yaml\fR @@ -1838,7 +1838,7 @@ This setting affects the usage of \fBschedule\fR resources, as the information a .IP "" 0 . .SS "static_catalogs" -Whether to compile a static catalog \fIhttps://puppet\.com/docs/puppet/latest/static_catalogs\.html#enabling\-or\-disabling\-static\-catalogs\fR, which occurs only on a Puppet Server master when the \fBcode\-id\-command\fR and \fBcode\-content\-command\fR settings are configured in its \fBpuppetserver\.conf\fR file\. +Whether to compile a static catalog \fIhttps://puppet\.com/docs/puppet/latest/static_catalogs\.html#enabling\-or\-disabling\-static\-catalogs\fR, which occurs only on Puppet Server when the \fBcode\-id\-command\fR and \fBcode\-content\-command\fR settings are configured in its \fBpuppetserver\.conf\fR file\. . .IP "\(bu" 4 \fIDefault\fR: \fBtrue\fR @@ -1882,7 +1882,7 @@ error \- perform extra validation, fail with error .IP "" 0 . .P -The strictness level is for both language semantics and runtime evaluation validation\. In addition to controlling the behavior with this master switch some individual warnings may also be controlled by the disable_warnings setting\. +The strictness level is for both language semantics and runtime evaluation validation\. In addition to controlling the behavior with this primary server switch some individual warnings may also be controlled by the disable_warnings setting\. . .P No new validations will be added to a micro (x\.y\.z) release, but may be added in minor releases (x\.y\.0)\. In major releases it expected that most (if not all) strictness validation become standard behavior\. @@ -1990,7 +1990,7 @@ File that provides mapping between custom SSL oids and user\-friendly names .IP "" 0 . .SS "use_cached_catalog" -Whether to only use the cached catalog rather than compiling a new catalog on every run\. Puppet can be run with this enabled by default and then selectively disabled when a recompile is desired\. Because a Puppet agent using cached catalogs does not contact the master for a new catalog, it also does not upload facts at the beginning of the Puppet run\. +Whether to only use the cached catalog rather than compiling a new catalog on every run\. Puppet can be run with this enabled by default and then selectively disabled when a recompile is desired\. Because a Puppet agent using cached catalogs does not contact the primary server for a new catalog, it also does not upload facts at the beginning of the Puppet run\. . .IP "\(bu" 4 \fIDefault\fR: \fBfalse\fR @@ -2049,7 +2049,7 @@ Whether or not to look for versioned environment directories, symlinked from \fB How frequently puppet agent should ask for a signed certificate\. . .P -When starting for the first time, puppet agent will submit a certificate signing request (CSR) to the server named in the \fBca_server\fR setting (usually the puppet master); this may be autosigned, or may need to be approved by a human, depending on the CA server\'s configuration\. +When starting for the first time, puppet agent will submit a certificate signing request (CSR) to the server named in the \fBca_server\fR setting (usually the primary Puppet server); this may be autosigned, or may need to be approved by a human, depending on the CA server\'s configuration\. . .P Puppet agent cannot apply configurations until its approved certificate is available\. Since the certificate may or may not be available immediately, puppet agent will repeatedly try to fetch it at this interval\. You can turn off waiting for certificates by specifying a time of 0, or a maximum amount of time to wait in the \fBmaxwaitforcert\fR setting, in which case puppet agent will exit if it cannot get a cert\. This setting can be a time interval in seconds (30 or 30s), minutes (30m), hours (6h), days (2d), or years (5y)\. diff --git a/man/man8/puppet-module.8 b/man/man8/puppet-module.8 index 025360f4e99..733236f12c8 100644 --- a/man/man8/puppet-module.8 +++ b/man/man8/puppet-module.8 @@ -32,10 +32,10 @@ Whether to log debug information\. . .TP \-\-environment production -The environment in which Puppet is running\. For clients, such as \fBpuppet agent\fR, this determines the environment itself, which Puppet uses to find modules and much more\. For servers, such as \fBpuppet master\fR, this provides the default environment for nodes that Puppet knows nothing about\. +The environment in which Puppet is running\. For clients, such as \fBpuppet agent\fR, this determines the environment itself, which Puppet uses to find modules and much more\. For servers, such as \fBpuppet server\fR, this provides the default environment for nodes that Puppet knows nothing about\. . .IP -When defining an environment in the \fB[agent]\fR section, this refers to the environment that the agent requests from the master\. The environment doesn\'t have to exist on the local filesystem because the agent fetches it from the master\. This definition is used when running \fBpuppet agent\fR\. +When defining an environment in the \fB[agent]\fR section, this refers to the environment that the agent requests from the primary server\. The environment doesn\'t have to exist on the local filesystem because the agent fetches it from the primary server\. This definition is used when running \fBpuppet agent\fR\. . .IP When defined in the \fB[user]\fR section, the environment refers to the path that Puppet uses to search for code and modules related to its execution\. This requires the environment to exist locally on the filesystem where puppet is being executed\. Puppet subcommands, including \fBpuppet module\fR and \fBpuppet apply\fR, use this definition\. From 56e1c8095dc167e3815cb6a7727b09776acda1ed Mon Sep 17 00:00:00 2001 From: Gabriel Nagy Date: Thu, 29 Jul 2021 11:16:39 +0300 Subject: [PATCH 419/731] (maint) Update expected error message in environment test As we removed the node request, and the default value of `ignore_plugin_errors` is now false, we don't get a 404 error from the server anymore (this could have happened either from the node request or the catalog request). To account for this change, update the expected error message to match the failure. --- acceptance/tests/environment/environment_scenario-bad.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/acceptance/tests/environment/environment_scenario-bad.rb b/acceptance/tests/environment/environment_scenario-bad.rb index 9dc6b2cc4c9..262ef3f863b 100644 --- a/acceptance/tests/environment/environment_scenario-bad.rb +++ b/acceptance/tests/environment/environment_scenario-bad.rb @@ -59,7 +59,7 @@ agents.each do |host| if host['locale'] != 'ja' - expectations[:puppet_agent][:matches] = [%r{(Warning|Error).*(404|400).*Could not find environment '#{env}'}, + expectations[:puppet_agent][:matches] = [%r{Could not evaluate: Could not retrieve information from environment #{env}}, %r{Error: Failed to apply catalog: Failed to retrieve}] end end From 3888d94208fc243e5cb406333f12d17ee4a2d075 Mon Sep 17 00:00:00 2001 From: Justin Stoller Date: Wed, 28 Jul 2021 14:26:43 -0700 Subject: [PATCH 420/731] (maint) Teardown remaining lastrunfile after using tmp env Recent work allowed the agent to skip node requests by inspecting a lastrunfile if it exists and start the agent check-in process with the environment listed there. However, the acceptance tests often create dummy enviroments and do not clean up the lastrunfile. A first pass updated many tests to remove the lastrunfile on all agents if they used a temporary environment. However, several were missed as the agent testing will only test a subset of the server tests. In an attempt to quickly rectify the situation this patch audits all acceptance tests that use, or mention that they should use, `mk_tmp_environment_with_teardown` and extends their teardowns to use the existing pattern for removing the lastrunfile. --- .../cached_catalog_remediate_local_drift.rb | 6 ++++++ .../tests/direct_puppet/static_catalog_env_control.rb | 5 +++++ .../custom_type_provider_from_same_environment.rb | 6 ++++++ .../environment/variables_refreshed_each_compilation.rb | 8 ++++++++ acceptance/tests/face/parser_validate.rb | 8 ++++++++ acceptance/tests/i18n/modules/puppet_agent.rb | 5 +++++ .../tests/i18n/modules/puppet_agent_cached_catalog.rb | 5 +++++ .../modules/puppet_agent_with_multiple_environments.rb | 5 +++++ acceptance/tests/language/binary_data_type.rb | 8 ++++++++ acceptance/tests/language/exported_resources.rb | 5 +++++ .../tests/language/functions_in_puppet_language.rb | 6 ++++++ .../tests/language/pcore_generate_env_isolation.rb | 8 ++++++++ acceptance/tests/language/sensitive_data_type.rb | 7 +++++++ acceptance/tests/language/server_set_facts.rb | 8 ++++++++ .../tests/loader/autoload_from_resource_type_decl.rb | 4 ++++ acceptance/tests/loader/resource_triggers_autoload.rb | 8 ++++++++ acceptance/tests/lookup/config3_interpolation.rb | 5 +++++ acceptance/tests/lookup/config5_interpolation.rb | 8 ++++++++ acceptance/tests/lookup/hiera3_custom_backend.rb | 6 ++++++ acceptance/tests/lookup/lookup.rb | 8 ++++++++ acceptance/tests/lookup/lookup_rich_values.rb | 8 ++++++++ acceptance/tests/lookup/merge_strategies.rb | 6 ++++++ acceptance/tests/lookup/v3_config_and_data.rb | 6 ++++++ acceptance/tests/lookup/v4_hieradata_with_v5_configs.rb | 6 ++++++ .../feature/pluginsync_should_sync_features.rb | 8 ++++++++ .../tests/reports/corrective_change_new_resource.rb | 5 +++++ .../tests/reports/corrective_change_outside_puppet.rb | 4 ++++ .../resource/file/ticket_6448_file_with_utf8_source.rb | 9 +++++++-- 28 files changed, 179 insertions(+), 2 deletions(-) diff --git a/acceptance/tests/direct_puppet/cached_catalog_remediate_local_drift.rb b/acceptance/tests/direct_puppet/cached_catalog_remediate_local_drift.rb index e449db63575..f76e28be8be 100644 --- a/acceptance/tests/direct_puppet/cached_catalog_remediate_local_drift.rb +++ b/acceptance/tests/direct_puppet/cached_catalog_remediate_local_drift.rb @@ -27,6 +27,12 @@ teardown do cleanup_puppetserver_code_id_scripts(master, basedir) on master, "rm -rf #{basedir}" + + agents.each do |agent| + on(agent, puppet('config print lastrunfile')) do |command_result| + agent.rm_rf(command_result.stdout) + end + end end step "Create a module and a file with content representing the first code_id version" do diff --git a/acceptance/tests/direct_puppet/static_catalog_env_control.rb b/acceptance/tests/direct_puppet/static_catalog_env_control.rb index e3dca4c20c4..cb751bb92b0 100644 --- a/acceptance/tests/direct_puppet/static_catalog_env_control.rb +++ b/acceptance/tests/direct_puppet/static_catalog_env_control.rb @@ -169,6 +169,11 @@ teardown do on(master, "mv #{@confdir}/puppetserver.conf.bak #{@confdir}/puppetserver.conf") on(master, "rm -rf #{@testroot}") + agents.each do |agent| + on(agent, puppet('config print lastrunfile')) do |command_result| + agent.rm_rf(command_result.stdout) + end + end end step 'apply main manifest, static_catalogs unspecified in global scope, unspecified in production environment, disabled in canary environment' diff --git a/acceptance/tests/environment/custom_type_provider_from_same_environment.rb b/acceptance/tests/environment/custom_type_provider_from_same_environment.rb index 9f3f9f1467b..56b2632e2ee 100644 --- a/acceptance/tests/environment/custom_type_provider_from_same_environment.rb +++ b/acceptance/tests/environment/custom_type_provider_from_same_environment.rb @@ -21,6 +21,12 @@ step 'clean out file resources' do on(hosts, "rm #{file_correct} #{file_wrong}", :accept_all_exit_codes => true) end + + agents.each do |agent| + on(agent, puppet('config print lastrunfile')) do |command_result| + agent.rm_rf(command_result.stdout) + end + end end step "create a custom type and provider in each of production and #{tmp_environment}" do diff --git a/acceptance/tests/environment/variables_refreshed_each_compilation.rb b/acceptance/tests/environment/variables_refreshed_each_compilation.rb index 0aab349ba41..7b1fa57247b 100644 --- a/acceptance/tests/environment/variables_refreshed_each_compilation.rb +++ b/acceptance/tests/environment/variables_refreshed_each_compilation.rb @@ -8,6 +8,14 @@ 'audit:integration', 'server' + teardown do + agents.each do |agent| + on(agent, puppet('config print lastrunfile')) do |command_result| + agent.rm_rf(command_result.stdout) + end + end + end + app_type = File.basename(__FILE__, '.*') tmp_environment = mk_tmp_environment_with_teardown(master, app_type) fq_tmp_environmentpath = "#{environmentpath}/#{tmp_environment}" diff --git a/acceptance/tests/face/parser_validate.rb b/acceptance/tests/face/parser_validate.rb index d24cd49adba..f913eb67b68 100644 --- a/acceptance/tests/face/parser_validate.rb +++ b/acceptance/tests/face/parser_validate.rb @@ -11,6 +11,14 @@ app_type = File.basename(__FILE__, '.*') + teardown do + agents.each do |agent| + on(agent, puppet('config print lastrunfile')) do |command_result| + agent.rm_rf(command_result.stdout) + end + end + end + agents.each do |agent| skip_test('this test fails on windows French due to Cygwin/UTF Issues - PUP-8319,IMAGES-492') if agent['platform'] =~ /windows/ && agent['locale'] == 'fr' diff --git a/acceptance/tests/i18n/modules/puppet_agent.rb b/acceptance/tests/i18n/modules/puppet_agent.rb index db7580a32ca..bd2a2ef51f6 100644 --- a/acceptance/tests/i18n/modules/puppet_agent.rb +++ b/acceptance/tests/i18n/modules/puppet_agent.rb @@ -41,6 +41,11 @@ end uninstall_i18n_demo_module(master) end + agents.each do |agent| + on(agent, puppet('config print lastrunfile')) do |command_result| + agent.rm_rf(command_result.stdout) + end + end end agents.each do |agent| diff --git a/acceptance/tests/i18n/modules/puppet_agent_cached_catalog.rb b/acceptance/tests/i18n/modules/puppet_agent_cached_catalog.rb index 46785dcb886..8df68f2a41b 100644 --- a/acceptance/tests/i18n/modules/puppet_agent_cached_catalog.rb +++ b/acceptance/tests/i18n/modules/puppet_agent_cached_catalog.rb @@ -41,6 +41,11 @@ end uninstall_i18n_demo_module(master) end + agents.each do |agent| + on(agent, puppet('config print lastrunfile')) do |command_result| + agent.rm_rf(command_result.stdout) + end + end end agents.each do |agent| diff --git a/acceptance/tests/i18n/modules/puppet_agent_with_multiple_environments.rb b/acceptance/tests/i18n/modules/puppet_agent_with_multiple_environments.rb index 5ec98de58a2..94856e6a925 100644 --- a/acceptance/tests/i18n/modules/puppet_agent_with_multiple_environments.rb +++ b/acceptance/tests/i18n/modules/puppet_agent_with_multiple_environments.rb @@ -49,6 +49,11 @@ on(master, puppet("config set disable_i18n #{ disable_i18n_default_master }")) reset_master_system_locale end + agents.each do |agent| + on(agent, puppet('config print lastrunfile')) do |command_result| + agent.rm_rf(command_result.stdout) + end + end end agents.each do |agent| diff --git a/acceptance/tests/language/binary_data_type.rb b/acceptance/tests/language/binary_data_type.rb index cee0adbf582..6bf68b1e9e5 100644 --- a/acceptance/tests/language/binary_data_type.rb +++ b/acceptance/tests/language/binary_data_type.rb @@ -9,6 +9,14 @@ # should not be OS sensitive. 'server' + teardown do + agents.each do |agent| + on(agent, puppet('config print lastrunfile')) do |command_result| + agent.rm_rf(command_result.stdout) + end + end + end + app_type = File.basename(__FILE__, '.*') tmp_environment = mk_tmp_environment_with_teardown(master, app_type) diff --git a/acceptance/tests/language/exported_resources.rb b/acceptance/tests/language/exported_resources.rb index 0aed8da19f1..045cd6bcb4f 100644 --- a/acceptance/tests/language/exported_resources.rb +++ b/acceptance/tests/language/exported_resources.rb @@ -26,6 +26,11 @@ step 'clean out collected resources' do on(hosts, puppet_resource("user #{exported_username} ensure=absent"), :accept_all_exit_codes => true) end + agents.each do |agent| + on(agent, puppet('config print lastrunfile')) do |command_result| + agent.rm_rf(command_result.stdout) + end + end end storeconfigs_backend_name = 'pson_storeconfigs' diff --git a/acceptance/tests/language/functions_in_puppet_language.rb b/acceptance/tests/language/functions_in_puppet_language.rb index 288ef329aee..8ce841502f3 100644 --- a/acceptance/tests/language/functions_in_puppet_language.rb +++ b/acceptance/tests/language/functions_in_puppet_language.rb @@ -10,6 +10,12 @@ on master, 'rm -rf /etc/puppetlabs/code/environments/tommy' on master, 'rm -rf /etc/puppetlabs/code/environments/production/modules/one' on master, 'rm -rf /etc/puppetlabs/code/environments/production/modules/three' + + agents.each do |agent| + on(agent, puppet('config print lastrunfile')) do |command_result| + agent.rm_rf(command_result.stdout) + end + end end step 'Create some functions' do diff --git a/acceptance/tests/language/pcore_generate_env_isolation.rb b/acceptance/tests/language/pcore_generate_env_isolation.rb index d0a999b6971..3468711bc75 100644 --- a/acceptance/tests/language/pcore_generate_env_isolation.rb +++ b/acceptance/tests/language/pcore_generate_env_isolation.rb @@ -6,6 +6,14 @@ 'audit:integration', 'server' + teardown do + agents.each do |agent| + on(agent, puppet('config print lastrunfile')) do |command_result| + agent.rm_rf(command_result.stdout) + end + end + end + app_type = File.basename(__FILE__, '.*') tmp_environment = mk_tmp_environment_with_teardown(master, app_type) tmp_environment2 = mk_tmp_environment_with_teardown(master, app_type) diff --git a/acceptance/tests/language/sensitive_data_type.rb b/acceptance/tests/language/sensitive_data_type.rb index 9bb34be459a..c0b48f3a43b 100644 --- a/acceptance/tests/language/sensitive_data_type.rb +++ b/acceptance/tests/language/sensitive_data_type.rb @@ -9,6 +9,13 @@ # written logs. 'server' + teardown do + agents.each do |agent| + on(agent, puppet('config print lastrunfile')) do |command_result| + agent.rm_rf(command_result.stdout) + end + end + end app_type = File.basename(__FILE__, '.*') tmp_environment = mk_tmp_environment_with_teardown(master, app_type) diff --git a/acceptance/tests/language/server_set_facts.rb b/acceptance/tests/language/server_set_facts.rb index ec522fd3c6c..af6a455c264 100644 --- a/acceptance/tests/language/server_set_facts.rb +++ b/acceptance/tests/language/server_set_facts.rb @@ -6,6 +6,14 @@ 'audit:acceptance', # Validating server/client interaction 'server' + teardown do + agents.each do |agent| + on(agent, puppet('config print lastrunfile')) do |command_result| + agent.rm_rf(command_result.stdout) + end + end + end + app_type = File.basename(__FILE__, '.*') tmp_environment = mk_tmp_environment_with_teardown(master, app_type) diff --git a/acceptance/tests/loader/autoload_from_resource_type_decl.rb b/acceptance/tests/loader/autoload_from_resource_type_decl.rb index 708aa1254e3..332ce54e427 100644 --- a/acceptance/tests/loader/autoload_from_resource_type_decl.rb +++ b/acceptance/tests/loader/autoload_from_resource_type_decl.rb @@ -30,6 +30,10 @@ def empty_execution_log_file(host, path) on(master, "rm -f '#{execution_log[agent_to_fqdn(master)]}'") agents.each do |agent| on(agent, "rm -f '#{execution_log[agent_to_fqdn(agent)]}'") + + on(agent, puppet('config print lastrunfile')) do |command_result| + agent.rm_rf(command_result.stdout) + end end end diff --git a/acceptance/tests/loader/resource_triggers_autoload.rb b/acceptance/tests/loader/resource_triggers_autoload.rb index 1adb64d53e1..cfa193cb6d8 100644 --- a/acceptance/tests/loader/resource_triggers_autoload.rb +++ b/acceptance/tests/loader/resource_triggers_autoload.rb @@ -8,6 +8,14 @@ tmp_environment = mk_tmp_environment_with_teardown(master, app_type) fq_tmp_environmentpath = "#{environmentpath}/#{tmp_environment}" + teardown do + agents.each do |agent| + on(agent, puppet('config print lastrunfile')) do |command_result| + agent.rm_rf(command_result.stdout) + end + end + end + relative_define_type_dir = 'modules/one/manifests' relative_define_type_1_path = "#{relative_define_type_dir}/tst1.pp" relative_define_type_2_path = "#{relative_define_type_dir}/tst2.pp" diff --git a/acceptance/tests/lookup/config3_interpolation.rb b/acceptance/tests/lookup/config3_interpolation.rb index 9332249cdff..002fc231621 100644 --- a/acceptance/tests/lookup/config3_interpolation.rb +++ b/acceptance/tests/lookup/config3_interpolation.rb @@ -22,6 +22,11 @@ teardown do on(master, "mv #{hiera_conf_backup} #{master_confdir}/hiera.yaml", :acceptable_exit_codes => [0,1]) + agents.each do |agent| + on(agent, puppet('config print lastrunfile')) do |command_result| + agent.rm_rf(command_result.stdout) + end + end end step "create hiera configs in #{tmp_environment} and global" do diff --git a/acceptance/tests/lookup/config5_interpolation.rb b/acceptance/tests/lookup/config5_interpolation.rb index 6ee1646a1b6..078c4c59f95 100644 --- a/acceptance/tests/lookup/config5_interpolation.rb +++ b/acceptance/tests/lookup/config5_interpolation.rb @@ -13,6 +13,14 @@ tmp_environment = mk_tmp_environment_with_teardown(master, app_type + '1') fq_tmp_environmentpath = "#{environmentpath}/#{tmp_environment}" + teardown do + agents.each do |agent| + on(agent, puppet('config print lastrunfile')) do |command_result| + agent.rm_rf(command_result.stdout) + end + end + end + step "create environment hiera5.yaml and environment data" do create_remote_file(master, "#{fq_tmp_environmentpath}/hiera.yaml", <<-HIERA) diff --git a/acceptance/tests/lookup/hiera3_custom_backend.rb b/acceptance/tests/lookup/hiera3_custom_backend.rb index 6b28d368f7c..1a2c9062d6a 100644 --- a/acceptance/tests/lookup/hiera3_custom_backend.rb +++ b/acceptance/tests/lookup/hiera3_custom_backend.rb @@ -27,6 +27,12 @@ on(master, "rm #{existing_loadpath}/hiera/backend/custom_backend.rb", :acceptable_exit_codes => [0,1]) on(master, "mv #{hiera_conf_backup} #{confdir}/hiera.yaml", :acceptable_exit_codes => [0,1]) end + + agents.each do |agent| + on(agent, puppet('config print lastrunfile')) do |command_result| + agent.rm_rf(command_result.stdout) + end + end end step "create hiera v5 config and v3 custom backend" do diff --git a/acceptance/tests/lookup/lookup.rb b/acceptance/tests/lookup/lookup.rb index eea6c52e671..795c804d2b0 100644 --- a/acceptance/tests/lookup/lookup.rb +++ b/acceptance/tests/lookup/lookup.rb @@ -111,6 +111,14 @@ def mod_manifest_metadata_json(module_name = nil, testdir) end end + teardown do + agents.each do |agent| + on(agent, puppet('config print lastrunfile')) do |command_result| + agent.rm_rf(command_result.stdout) + end + end + end + module_manifest1 = mod_manifest_entry(module_name, testdir, module_data_implied_key, module_data_implied_value, module_data_key, module_data_value, hash_name, module_hash_key, module_hash_value, array_key, diff --git a/acceptance/tests/lookup/lookup_rich_values.rb b/acceptance/tests/lookup/lookup_rich_values.rb index a568302b424..2b3af46060a 100644 --- a/acceptance/tests/lookup/lookup_rich_values.rb +++ b/acceptance/tests/lookup/lookup_rich_values.rb @@ -21,6 +21,14 @@ sensitive_value_pp = 'toe, no step' sensitive_value_pp2 = 'toe, no module' + teardown do + agents.each do |agent| + on(agent, puppet('config print lastrunfile')) do |command_result| + agent.rm_rf(command_result.stdout) + end + end + end + step "create ruby lookup function in #{tmp_environment}" do on(master, "mkdir -p #{fq_tmp_environmentpath}/lib/puppet/functions/environment") create_remote_file(master, "#{fq_tmp_environmentpath}/hiera.yaml", <<-HIERA) diff --git a/acceptance/tests/lookup/merge_strategies.rb b/acceptance/tests/lookup/merge_strategies.rb index 4035a59a576..2a3fc431acc 100644 --- a/acceptance/tests/lookup/merge_strategies.rb +++ b/acceptance/tests/lookup/merge_strategies.rb @@ -20,6 +20,12 @@ step "restore default global hiera.yaml" do on(master, "mv #{hiera_conf_backup} #{master_confdir}/hiera.yaml", :acceptable_exit_codes => [0,1]) end + + agents.each do |agent| + on(agent, puppet('config print lastrunfile')) do |command_result| + agent.rm_rf(command_result.stdout) + end + end end step "create global hiera.yaml and environment data" do diff --git a/acceptance/tests/lookup/v3_config_and_data.rb b/acceptance/tests/lookup/v3_config_and_data.rb index a86c7512e03..dd713b02d08 100644 --- a/acceptance/tests/lookup/v3_config_and_data.rb +++ b/acceptance/tests/lookup/v3_config_and_data.rb @@ -24,6 +24,12 @@ step "restore global hiera.yaml" do on(master, "mv #{hiera_conf_backup} #{confdir}/hiera.yaml", :acceptable_exit_codes => [0,1]) end + + agents.each do |agent| + on(agent, puppet('config print lastrunfile')) do |command_result| + agent.rm_rf(command_result.stdout) + end + end end step "create global hiera.yaml and module data" do diff --git a/acceptance/tests/lookup/v4_hieradata_with_v5_configs.rb b/acceptance/tests/lookup/v4_hieradata_with_v5_configs.rb index d75cf20f69f..c2082c3f0fa 100644 --- a/acceptance/tests/lookup/v4_hieradata_with_v5_configs.rb +++ b/acceptance/tests/lookup/v4_hieradata_with_v5_configs.rb @@ -22,6 +22,12 @@ step "restore global hiera.yaml" do on(master, "mv #{hiera_conf_backup} #{confdir}/hiera.yaml", :acceptable_exit_codes => [0,1]) end + + agents.each do |agent| + on(agent, puppet('config print lastrunfile')) do |command_result| + agent.rm_rf(command_result.stdout) + end + end end step "create global hiera.yaml and data" do diff --git a/acceptance/tests/pluginsync/feature/pluginsync_should_sync_features.rb b/acceptance/tests/pluginsync/feature/pluginsync_should_sync_features.rb index 0eb01cff21c..0e73c46de82 100644 --- a/acceptance/tests/pluginsync/feature/pluginsync_should_sync_features.rb +++ b/acceptance/tests/pluginsync/feature/pluginsync_should_sync_features.rb @@ -17,6 +17,14 @@ require 'puppet/acceptance/temp_file_utils' extend Puppet::Acceptance::TempFileUtils + teardown do + agents.each do |agent| + on(agent, puppet('config print lastrunfile')) do |command_result| + agent.rm_rf(command_result.stdout) + end + end + end + module_name = 'superbogus' tmp_environment = mk_tmp_environment_with_teardown(master, 'sync') master_module_dir = "#{environmentpath}/#{tmp_environment}/modules" diff --git a/acceptance/tests/reports/corrective_change_new_resource.rb b/acceptance/tests/reports/corrective_change_new_resource.rb index 116935f2b09..a3abf5103dd 100644 --- a/acceptance/tests/reports/corrective_change_new_resource.rb +++ b/acceptance/tests/reports/corrective_change_new_resource.rb @@ -26,6 +26,11 @@ if tmp_file.has_key?(agent_to_fqdn(agent)) && tmp_file[agent_to_fqdn(agent)] != '' on(agent, "rm '#{tmp_file[agent_to_fqdn(agent)]}'", :accept_all_exit_codes => true) end + + + on(agent, puppet('config print lastrunfile')) do |command_result| + agent.rm_rf(command_result.stdout) + end end end end diff --git a/acceptance/tests/reports/corrective_change_outside_puppet.rb b/acceptance/tests/reports/corrective_change_outside_puppet.rb index 53c4a2743c4..eba9a96c880 100644 --- a/acceptance/tests/reports/corrective_change_outside_puppet.rb +++ b/acceptance/tests/reports/corrective_change_outside_puppet.rb @@ -27,6 +27,10 @@ if tmp_file.has_key?(agent_to_fqdn(agent)) && tmp_file[agent_to_fqdn(agent)] != '' on(agent, "rm '#{tmp_file[agent_to_fqdn(agent)]}'", :accept_all_exit_codes => true) end + + on(agent, puppet('config print lastrunfile')) do |command_result| + agent.rm_rf(command_result.stdout) + end end end end diff --git a/acceptance/tests/resource/file/ticket_6448_file_with_utf8_source.rb b/acceptance/tests/resource/file/ticket_6448_file_with_utf8_source.rb index bcb307dfee6..8c65378f02d 100644 --- a/acceptance/tests/resource/file/ticket_6448_file_with_utf8_source.rb +++ b/acceptance/tests/resource/file/ticket_6448_file_with_utf8_source.rb @@ -18,10 +18,15 @@ end teardown do + # note - master teardown is registered by #mk_tmp_environment_with_teardown step 'remove all test files on agents' do - agents.each {|agent| on(agent, "rm -r '#{agent_tmp_dirs[agent_to_fqdn(agent)]}'", :accept_all_exit_codes => true)} + agents.each do |agent| + on(agent, "rm -r '#{agent_tmp_dirs[agent_to_fqdn(agent)]}'", :accept_all_exit_codes => true) + on(agent, puppet('config print lastrunfile')) do |command_result| + agent.rm_rf(command_result.stdout) + end + end end - # note - master teardown is registered by #mk_tmp_environment_with_teardown end step 'create unicode source file served via module on master' do From e787198b62d03359d7c87d709dd36c086e76b772 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Thu, 29 Jul 2021 10:22:00 +0000 Subject: [PATCH 421/731] (packaging) Updating the puppet.pot file --- locales/puppet.pot | 74 +++++++++++++++++++++++----------------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/locales/puppet.pot b/locales/puppet.pot index 6e0ae506dd4..05b9bcb000f 100644 --- a/locales/puppet.pot +++ b/locales/puppet.pot @@ -6,11 +6,11 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Puppet automation framework 7.8.0-115-g2e290b736f\n" +"Project-Id-Version: Puppet automation framework 7.8.0-228-g8ae36471c0\n" "\n" "Report-Msgid-Bugs-To: https://tickets.puppetlabs.com\n" -"POT-Creation-Date: 2021-07-06 12:22+0000\n" -"PO-Revision-Date: 2021-07-06 12:22+0000\n" +"POT-Creation-Date: 2021-07-29 10:21+0000\n" +"PO-Revision-Date: 2021-07-29 10:21+0000\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -559,68 +559,68 @@ msgstr "" msgid "Local environment: '%{local_env}' doesn't match the environment of the cached catalog '%{catalog_env}', switching agent to '%{catalog_env}'." msgstr "" -#: ../lib/puppet/configurer.rb:320 -msgid "Local environment: '%{local_env}' doesn't match server specified node environment '%{node_env}', switching agent to '%{node_env}'." +#: ../lib/puppet/configurer.rb:298 +msgid "No environment configured, attempting to find out the last used environment" msgstr "" -#: ../lib/puppet/configurer.rb:335 -msgid "Using configured environment '%{env}'" -msgstr "" - -#: ../lib/puppet/configurer.rb:339 -msgid "Unable to fetch my node definition, but the agent run will continue:" -msgstr "" - -#: ../lib/puppet/configurer.rb:367 +#: ../lib/puppet/configurer.rb:327 msgid "Not using catalog because its environment '%{catalog_env}' does not match agent specified environment '%{local_env}' and strict_environment_mode is set" msgstr "" -#: ../lib/puppet/configurer.rb:378 +#: ../lib/puppet/configurer.rb:338 msgid "Catalog environment didn't stabilize after %{tries} fetches, aborting run" msgstr "" -#: ../lib/puppet/configurer.rb:380 +#: ../lib/puppet/configurer.rb:340 msgid "Local environment: '%{local_env}' doesn't match server specified environment '%{catalog_env}', restarting agent run with environment '%{catalog_env}'" msgstr "" -#: ../lib/puppet/configurer.rb:434 +#: ../lib/puppet/configurer.rb:403 msgid "Failed to apply catalog: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:463 ../lib/puppet/http/resolver/server_list.rb:64 ../lib/puppet/http/resolver/server_list.rb:68 +#: ../lib/puppet/configurer.rb:432 ../lib/puppet/http/resolver/server_list.rb:64 ../lib/puppet/http/resolver/server_list.rb:68 msgid "Puppet server %{host}:%{port} is unavailable: %{code} %{reason}" msgstr "" #. TRANSLATORS 'server_list' is the name of a setting and should not be translated -#: ../lib/puppet/configurer.rb:467 ../lib/puppet/http/resolver/server_list.rb:73 ../lib/puppet/http/resolver/server_list.rb:76 +#: ../lib/puppet/configurer.rb:436 ../lib/puppet/http/resolver/server_list.rb:73 ../lib/puppet/http/resolver/server_list.rb:76 msgid "Unable to connect to server from server_list setting: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:478 ../lib/puppet/face/report.rb:47 +#: ../lib/puppet/configurer.rb:450 +msgid "Found last used environment: %{environment}" +msgstr "" + +#: ../lib/puppet/configurer.rb:453 +msgid "Unable to get last used environment: %{detail}" +msgstr "" + +#: ../lib/puppet/configurer.rb:463 ../lib/puppet/face/report.rb:47 msgid "Could not send report: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:487 +#: ../lib/puppet/configurer.rb:472 msgid "Could not save last run local report: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:506 +#: ../lib/puppet/configurer.rb:491 msgid "Uploading facts for %{node} to %{server}" msgstr "" -#: ../lib/puppet/configurer.rb:514 +#: ../lib/puppet/configurer.rb:499 msgid "Failed to submit facts: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:529 +#: ../lib/puppet/configurer.rb:514 msgid "Could not run command from %{setting}: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:547 +#: ../lib/puppet/configurer.rb:532 msgid "Could not retrieve catalog from cache: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:568 +#: ../lib/puppet/configurer.rb:553 msgid "Could not retrieve catalog from remote server: %{detail}" msgstr "" @@ -1589,15 +1589,15 @@ msgstr "" msgid "Relative paths must not be fully qualified" msgstr "" -#: ../lib/puppet/file_serving/configuration.rb:55 +#: ../lib/puppet/file_serving/configuration.rb:56 msgid "Cannot find file: Invalid mount '%{mount_name}'" msgstr "" -#: ../lib/puppet/file_serving/configuration.rb:56 +#: ../lib/puppet/file_serving/configuration.rb:57 msgid "Cannot find file: Invalid relative path '%{path}'" msgstr "" -#: ../lib/puppet/file_serving/configuration.rb:104 +#: ../lib/puppet/file_serving/configuration.rb:106 msgid "Error parsing fileserver configuration: %{detail}; using old configuration" msgstr "" @@ -1625,11 +1625,11 @@ msgstr "" msgid "%{mount} is already mounted at %{name} at %{error_location}" msgstr "" -#: ../lib/puppet/file_serving/configuration/parser.rb:98 +#: ../lib/puppet/file_serving/configuration/parser.rb:100 msgid "Removing mount \"%{mount}\": %{detail}" msgstr "" -#: ../lib/puppet/file_serving/configuration/parser.rb:102 +#: ../lib/puppet/file_serving/configuration/parser.rb:104 msgid "The '%{mount}' module can not have a path. Ignoring attempt to set it" msgstr "" @@ -1719,7 +1719,7 @@ msgstr "" msgid "No client; expanding '%{path}' with local host" msgstr "" -#: ../lib/puppet/file_serving/mount/modules.rb:8 +#: ../lib/puppet/file_serving/mount/modules.rb:8 ../lib/puppet/file_serving/mount/scripts.rb:6 msgid "No module specified" msgstr "" @@ -3884,7 +3884,7 @@ msgstr "" msgid "The 'disable_per_environment_manifest' setting is true, and the '%{env_name}' environment has an environment.conf manifest that conflicts with the 'default_manifest' setting." msgstr "" -#: ../lib/puppet/node/environment.rb:575 ../lib/puppet/pops/loaders.rb:301 +#: ../lib/puppet/node/environment.rb:570 ../lib/puppet/pops/loaders.rb:301 msgid "Could not parse for environment %{env}: %{detail}" msgstr "" @@ -6592,19 +6592,19 @@ msgstr "" msgid "Implicit version %{should} has %{n} possible matches" msgstr "" -#: ../lib/puppet/provider/package/pkg.rb:170 +#: ../lib/puppet/provider/package/pkg.rb:177 msgid "Selecting version '%{version}' for implicit '%{should}'" msgstr "" -#: ../lib/puppet/provider/package/pkg.rb:175 +#: ../lib/puppet/provider/package/pkg.rb:182 msgid "No version of %{name} matching %{should} is installable, even though the package is currently installed" msgstr "" -#: ../lib/puppet/provider/package/pkg.rb:194 +#: ../lib/puppet/provider/package/pkg.rb:201 msgid "pkg warning: %{warnings}" msgstr "" -#: ../lib/puppet/provider/package/pkg.rb:238 ../lib/puppet/provider/package/pkg.rb:264 +#: ../lib/puppet/provider/package/pkg.rb:245 ../lib/puppet/provider/package/pkg.rb:271 msgid "Unable to update %{package}" msgstr "" From dff2519acc08f35b9a8fc961f5ccd83b01ea01ea Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Wed, 4 Aug 2021 08:52:52 +0000 Subject: [PATCH 422/731] (packaging) Updating the puppet.pot file --- locales/puppet.pot | 104 +++++++++++++++++++++++---------------------- 1 file changed, 54 insertions(+), 50 deletions(-) diff --git a/locales/puppet.pot b/locales/puppet.pot index 05b9bcb000f..5b20c4c6464 100644 --- a/locales/puppet.pot +++ b/locales/puppet.pot @@ -6,11 +6,11 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Puppet automation framework 7.8.0-228-g8ae36471c0\n" +"Project-Id-Version: Puppet automation framework 7.8.0-252-ge00b7f3214\n" "\n" "Report-Msgid-Bugs-To: https://tickets.puppetlabs.com\n" -"POT-Creation-Date: 2021-07-29 10:21+0000\n" -"PO-Revision-Date: 2021-07-29 10:21+0000\n" +"POT-Creation-Date: 2021-08-04 08:52+0000\n" +"PO-Revision-Date: 2021-08-04 08:52+0000\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -563,64 +563,68 @@ msgstr "" msgid "No environment configured, attempting to find out the last used environment" msgstr "" -#: ../lib/puppet/configurer.rb:327 +#: ../lib/puppet/configurer.rb:334 msgid "Not using catalog because its environment '%{catalog_env}' does not match agent specified environment '%{local_env}' and strict_environment_mode is set" msgstr "" -#: ../lib/puppet/configurer.rb:338 +#: ../lib/puppet/configurer.rb:345 msgid "Catalog environment didn't stabilize after %{tries} fetches, aborting run" msgstr "" -#: ../lib/puppet/configurer.rb:340 +#: ../lib/puppet/configurer.rb:347 msgid "Local environment: '%{local_env}' doesn't match server specified environment '%{catalog_env}', restarting agent run with environment '%{catalog_env}'" msgstr "" -#: ../lib/puppet/configurer.rb:403 +#: ../lib/puppet/configurer.rb:410 msgid "Failed to apply catalog: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:432 ../lib/puppet/http/resolver/server_list.rb:64 ../lib/puppet/http/resolver/server_list.rb:68 +#: ../lib/puppet/configurer.rb:441 +msgid "Environment '%{environment}' not found on server, skipping initial pluginsync." +msgstr "" + +#: ../lib/puppet/configurer.rb:458 ../lib/puppet/http/resolver/server_list.rb:64 ../lib/puppet/http/resolver/server_list.rb:68 msgid "Puppet server %{host}:%{port} is unavailable: %{code} %{reason}" msgstr "" #. TRANSLATORS 'server_list' is the name of a setting and should not be translated -#: ../lib/puppet/configurer.rb:436 ../lib/puppet/http/resolver/server_list.rb:73 ../lib/puppet/http/resolver/server_list.rb:76 +#: ../lib/puppet/configurer.rb:462 ../lib/puppet/http/resolver/server_list.rb:73 ../lib/puppet/http/resolver/server_list.rb:76 msgid "Unable to connect to server from server_list setting: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:450 +#: ../lib/puppet/configurer.rb:476 msgid "Found last used environment: %{environment}" msgstr "" -#: ../lib/puppet/configurer.rb:453 +#: ../lib/puppet/configurer.rb:479 msgid "Unable to get last used environment: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:463 ../lib/puppet/face/report.rb:47 +#: ../lib/puppet/configurer.rb:489 ../lib/puppet/face/report.rb:47 msgid "Could not send report: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:472 +#: ../lib/puppet/configurer.rb:498 msgid "Could not save last run local report: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:491 +#: ../lib/puppet/configurer.rb:517 msgid "Uploading facts for %{node} to %{server}" msgstr "" -#: ../lib/puppet/configurer.rb:499 +#: ../lib/puppet/configurer.rb:525 msgid "Failed to submit facts: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:514 +#: ../lib/puppet/configurer.rb:540 msgid "Could not run command from %{setting}: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:532 +#: ../lib/puppet/configurer.rb:558 msgid "Could not retrieve catalog from cache: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:553 +#: ../lib/puppet/configurer.rb:579 msgid "Could not retrieve catalog from remote server: %{detail}" msgstr "" @@ -2284,120 +2288,120 @@ msgstr "" msgid "Catalog for %{request} was requested with fact definition for the wrong node (%{fact_name})." msgstr "" -#: ../lib/puppet/indirector/catalog/compiler.rb:71 +#: ../lib/puppet/indirector/catalog/compiler.rb:77 msgid "Setup server facts for compiling" msgstr "" -#: ../lib/puppet/indirector/catalog/compiler.rb:95 +#: ../lib/puppet/indirector/catalog/compiler.rb:105 msgid "Unsupported facts format" msgstr "" #. TRANSLATORS Inlining refers to adding additional metadata (in this case we are not inlining) -#: ../lib/puppet/indirector/catalog/compiler.rb:136 +#: ../lib/puppet/indirector/catalog/compiler.rb:146 msgid "Not inlining absent resource" msgstr "" #. TRANSLATORS Inlining refers to adding additional metadata (in this case we are not inlining) -#: ../lib/puppet/indirector/catalog/compiler.rb:139 +#: ../lib/puppet/indirector/catalog/compiler.rb:149 msgid "Not inlining resource without sources" msgstr "" #. TRANSLATORS Inlining refers to adding additional metadata (in this case we are not inlining) -#: ../lib/puppet/indirector/catalog/compiler.rb:142 +#: ../lib/puppet/indirector/catalog/compiler.rb:152 msgid "Not inlining unsupported source scheme" msgstr "" #. TRANSLATORS Inlining refers to adding additional metadata (in this case we are not inlining) -#: ../lib/puppet/indirector/catalog/compiler.rb:164 +#: ../lib/puppet/indirector/catalog/compiler.rb:174 msgid "Not inlining file outside environment" msgstr "" #. TRANSLATORS Inlining refers to adding additional metadata -#: ../lib/puppet/indirector/catalog/compiler.rb:170 +#: ../lib/puppet/indirector/catalog/compiler.rb:180 msgid "Inlining file metadata" msgstr "" -#: ../lib/puppet/indirector/catalog/compiler.rb:260 +#: ../lib/puppet/indirector/catalog/compiler.rb:270 msgid "Could not get metadata for %{resource}" msgstr "" -#: ../lib/puppet/indirector/catalog/compiler.rb:281 +#: ../lib/puppet/indirector/catalog/compiler.rb:291 msgid "Unable to find a common checksum type between agent '%{agent_type}' and master '%{master_type}'." msgstr "" -#: ../lib/puppet/indirector/catalog/compiler.rb:288 +#: ../lib/puppet/indirector/catalog/compiler.rb:298 msgid "Compiled static catalog for %{node} in environment %{environment} in %%{seconds} seconds" msgstr "" -#: ../lib/puppet/indirector/catalog/compiler.rb:289 +#: ../lib/puppet/indirector/catalog/compiler.rb:299 msgid "Compiled static catalog for %{node} in environment %{environment}" msgstr "" -#: ../lib/puppet/indirector/catalog/compiler.rb:291 +#: ../lib/puppet/indirector/catalog/compiler.rb:301 msgid "Compiled static catalog for %{node} in %%{seconds} seconds" msgstr "" -#: ../lib/puppet/indirector/catalog/compiler.rb:292 +#: ../lib/puppet/indirector/catalog/compiler.rb:302 msgid "Compiled static catalog for %{node}" msgstr "" -#: ../lib/puppet/indirector/catalog/compiler.rb:297 +#: ../lib/puppet/indirector/catalog/compiler.rb:307 msgid "Compiled catalog for %{node} in environment %{environment} in %%{seconds} seconds" msgstr "" -#: ../lib/puppet/indirector/catalog/compiler.rb:298 +#: ../lib/puppet/indirector/catalog/compiler.rb:308 msgid "Compiled catalog for %{node} in environment %{environment}" msgstr "" -#: ../lib/puppet/indirector/catalog/compiler.rb:300 +#: ../lib/puppet/indirector/catalog/compiler.rb:310 msgid "Compiled catalog for %{node} in %%{seconds} seconds" msgstr "" -#: ../lib/puppet/indirector/catalog/compiler.rb:301 +#: ../lib/puppet/indirector/catalog/compiler.rb:311 msgid "Compiled catalog for %{node}" msgstr "" #. TRANSLATORS Inlined refers to adding additional metadata -#: ../lib/puppet/indirector/catalog/compiler.rb:323 +#: ../lib/puppet/indirector/catalog/compiler.rb:333 msgid "Inlined resource metadata into static catalog for %{node} in environment %{environment} in %%{seconds} seconds" msgstr "" #. TRANSLATORS Inlined refers to adding additional metadata -#: ../lib/puppet/indirector/catalog/compiler.rb:325 +#: ../lib/puppet/indirector/catalog/compiler.rb:335 msgid "Inlined resource metadata into static catalog for %{node} in environment %{environment}" msgstr "" #. TRANSLATORS Inlined refers to adding additional metadata -#: ../lib/puppet/indirector/catalog/compiler.rb:328 +#: ../lib/puppet/indirector/catalog/compiler.rb:338 msgid "Inlined resource metadata into static catalog for %{node} in %%{seconds} seconds" msgstr "" #. TRANSLATORS Inlined refers to adding additional metadata -#: ../lib/puppet/indirector/catalog/compiler.rb:330 +#: ../lib/puppet/indirector/catalog/compiler.rb:340 msgid "Inlined resource metadata into static catalog for %{node}" msgstr "" -#: ../lib/puppet/indirector/catalog/compiler.rb:347 +#: ../lib/puppet/indirector/catalog/compiler.rb:357 msgid "Found node information" msgstr "" -#: ../lib/puppet/indirector/catalog/compiler.rb:355 +#: ../lib/puppet/indirector/catalog/compiler.rb:365 msgid "Failed when searching for node %{name}: %{detail}" msgstr "" -#: ../lib/puppet/indirector/catalog/compiler.rb:375 +#: ../lib/puppet/indirector/catalog/compiler.rb:385 msgid "Invalid option use_node for a remote request" msgstr "" -#: ../lib/puppet/indirector/catalog/compiler.rb:394 +#: ../lib/puppet/indirector/catalog/compiler.rb:404 msgid "Could not find node '%{name}'; cannot compile" msgstr "" -#: ../lib/puppet/indirector/catalog/compiler.rb:427 +#: ../lib/puppet/indirector/catalog/compiler.rb:437 msgid "Could not retrieve fact servername" msgstr "" -#: ../lib/puppet/indirector/catalog/compiler.rb:436 +#: ../lib/puppet/indirector/catalog/compiler.rb:446 msgid "Could not retrieve either serverip or serverip6 fact" msgstr "" @@ -2780,11 +2784,11 @@ msgstr "" msgid "Cannot create instances of abstract terminus types" msgstr "" -#: ../lib/puppet/indirector/terminus.rb:163 +#: ../lib/puppet/indirector/terminus.rb:167 msgid "Instance name %{name} does not match requested key %{key}" msgstr "" -#: ../lib/puppet/indirector/terminus.rb:169 +#: ../lib/puppet/indirector/terminus.rb:173 msgid "Invalid instance type %{klass}, expected %{model_type}" msgstr "" @@ -3210,11 +3214,11 @@ msgstr "" msgid "Resolving dependencies ..." msgstr "" -#: ../lib/puppet/module_tool/applications/installer.rb:212 +#: ../lib/puppet/module_tool/applications/installer.rb:216 msgid "Preparing to install ..." msgstr "" -#: ../lib/puppet/module_tool/applications/installer.rb:215 +#: ../lib/puppet/module_tool/applications/installer.rb:219 msgid "Installing -- do not interrupt ..." msgstr "" @@ -3884,7 +3888,7 @@ msgstr "" msgid "The 'disable_per_environment_manifest' setting is true, and the '%{env_name}' environment has an environment.conf manifest that conflicts with the 'default_manifest' setting." msgstr "" -#: ../lib/puppet/node/environment.rb:570 ../lib/puppet/pops/loaders.rb:301 +#: ../lib/puppet/node/environment.rb:574 ../lib/puppet/pops/loaders.rb:301 msgid "Could not parse for environment %{env}: %{detail}" msgstr "" From d3bd53d7b7c82039b66a4b17b7c75f1095025b68 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Wed, 4 Aug 2021 08:55:13 +0000 Subject: [PATCH 423/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 2 +- man/man8/puppet-agent.8 | 2 +- man/man8/puppet-apply.8 | 2 +- man/man8/puppet-catalog.8 | 2 +- man/man8/puppet-config.8 | 2 +- man/man8/puppet-describe.8 | 2 +- man/man8/puppet-device.8 | 2 +- man/man8/puppet-doc.8 | 2 +- man/man8/puppet-epp.8 | 2 +- man/man8/puppet-facts.8 | 2 +- man/man8/puppet-filebucket.8 | 2 +- man/man8/puppet-generate.8 | 2 +- man/man8/puppet-help.8 | 2 +- man/man8/puppet-lookup.8 | 2 +- man/man8/puppet-module.8 | 2 +- man/man8/puppet-node.8 | 2 +- man/man8/puppet-parser.8 | 2 +- man/man8/puppet-plugin.8 | 2 +- man/man8/puppet-report.8 | 2 +- man/man8/puppet-resource.8 | 2 +- man/man8/puppet-script.8 | 2 +- man/man8/puppet-ssl.8 | 2 +- man/man8/puppet.8 | 2 +- 23 files changed, 23 insertions(+), 23 deletions(-) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index b2d0c3ddcf6..adee867c41a 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPETCONF" "5" "July 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPETCONF" "5" "August 2021" "Puppet, Inc." "Puppet manual" \fBThis page is autogenerated; any changes will get overwritten\fR . .SH "Configuration settings" diff --git a/man/man8/puppet-agent.8 b/man/man8/puppet-agent.8 index d4efa281753..a6603f43dc5 100644 --- a/man/man8/puppet-agent.8 +++ b/man/man8/puppet-agent.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-AGENT" "8" "July 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-AGENT" "8" "August 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-agent\fR \- The puppet agent daemon diff --git a/man/man8/puppet-apply.8 b/man/man8/puppet-apply.8 index e46175fa844..e558cd40d18 100644 --- a/man/man8/puppet-apply.8 +++ b/man/man8/puppet-apply.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-APPLY" "8" "July 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-APPLY" "8" "August 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-apply\fR \- Apply Puppet manifests locally diff --git a/man/man8/puppet-catalog.8 b/man/man8/puppet-catalog.8 index fcb3081e6de..7a5d5b1774a 100644 --- a/man/man8/puppet-catalog.8 +++ b/man/man8/puppet-catalog.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-CATALOG" "8" "July 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-CATALOG" "8" "August 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-catalog\fR \- Compile, save, view, and convert catalogs\. diff --git a/man/man8/puppet-config.8 b/man/man8/puppet-config.8 index aa826da0835..c72d476c0b3 100644 --- a/man/man8/puppet-config.8 +++ b/man/man8/puppet-config.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-CONFIG" "8" "July 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-CONFIG" "8" "August 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-config\fR \- Interact with Puppet\'s settings\. diff --git a/man/man8/puppet-describe.8 b/man/man8/puppet-describe.8 index 32a07d7a872..44a7904895e 100644 --- a/man/man8/puppet-describe.8 +++ b/man/man8/puppet-describe.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-DESCRIBE" "8" "July 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-DESCRIBE" "8" "August 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-describe\fR \- Display help about resource types diff --git a/man/man8/puppet-device.8 b/man/man8/puppet-device.8 index 1caf5cadb37..58d6b3ac6e0 100644 --- a/man/man8/puppet-device.8 +++ b/man/man8/puppet-device.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-DEVICE" "8" "July 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-DEVICE" "8" "August 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-device\fR \- Manage remote network devices diff --git a/man/man8/puppet-doc.8 b/man/man8/puppet-doc.8 index b8fbbec0d15..a2589632397 100644 --- a/man/man8/puppet-doc.8 +++ b/man/man8/puppet-doc.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-DOC" "8" "July 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-DOC" "8" "August 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-doc\fR \- Generate Puppet references diff --git a/man/man8/puppet-epp.8 b/man/man8/puppet-epp.8 index ca2f34a32c5..e76f03623f4 100644 --- a/man/man8/puppet-epp.8 +++ b/man/man8/puppet-epp.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-EPP" "8" "July 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-EPP" "8" "August 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-epp\fR \- Interact directly with the EPP template parser/renderer\. diff --git a/man/man8/puppet-facts.8 b/man/man8/puppet-facts.8 index b1ce9fd3f9d..a2c4063b7f3 100644 --- a/man/man8/puppet-facts.8 +++ b/man/man8/puppet-facts.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-FACTS" "8" "July 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-FACTS" "8" "August 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-facts\fR \- Retrieve and store facts\. diff --git a/man/man8/puppet-filebucket.8 b/man/man8/puppet-filebucket.8 index b667d673ffb..ce9077a4358 100644 --- a/man/man8/puppet-filebucket.8 +++ b/man/man8/puppet-filebucket.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-FILEBUCKET" "8" "July 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-FILEBUCKET" "8" "August 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-filebucket\fR \- Store and retrieve files in a filebucket diff --git a/man/man8/puppet-generate.8 b/man/man8/puppet-generate.8 index f31cf9d632f..19c3c56edb1 100644 --- a/man/man8/puppet-generate.8 +++ b/man/man8/puppet-generate.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-GENERATE" "8" "July 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-GENERATE" "8" "August 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-generate\fR \- Generates Puppet code from Ruby definitions\. diff --git a/man/man8/puppet-help.8 b/man/man8/puppet-help.8 index 7f5d5ec9d51..5126e3872b5 100644 --- a/man/man8/puppet-help.8 +++ b/man/man8/puppet-help.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-HELP" "8" "July 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-HELP" "8" "August 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-help\fR \- Display Puppet help\. diff --git a/man/man8/puppet-lookup.8 b/man/man8/puppet-lookup.8 index 229235cc650..4b753aad5b0 100644 --- a/man/man8/puppet-lookup.8 +++ b/man/man8/puppet-lookup.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-LOOKUP" "8" "July 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-LOOKUP" "8" "August 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-lookup\fR \- Interactive Hiera lookup diff --git a/man/man8/puppet-module.8 b/man/man8/puppet-module.8 index 733236f12c8..10b0fd65978 100644 --- a/man/man8/puppet-module.8 +++ b/man/man8/puppet-module.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-MODULE" "8" "July 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-MODULE" "8" "August 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-module\fR \- Creates, installs and searches for modules on the Puppet Forge\. diff --git a/man/man8/puppet-node.8 b/man/man8/puppet-node.8 index e05f3f65d97..a4efba79ac2 100644 --- a/man/man8/puppet-node.8 +++ b/man/man8/puppet-node.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-NODE" "8" "July 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-NODE" "8" "August 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-node\fR \- View and manage node definitions\. diff --git a/man/man8/puppet-parser.8 b/man/man8/puppet-parser.8 index 5d213e05612..f1a05f9ab44 100644 --- a/man/man8/puppet-parser.8 +++ b/man/man8/puppet-parser.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-PARSER" "8" "July 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-PARSER" "8" "August 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-parser\fR \- Interact directly with the parser\. diff --git a/man/man8/puppet-plugin.8 b/man/man8/puppet-plugin.8 index 693dd897a19..91238f05b3a 100644 --- a/man/man8/puppet-plugin.8 +++ b/man/man8/puppet-plugin.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-PLUGIN" "8" "July 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-PLUGIN" "8" "August 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-plugin\fR \- Interact with the Puppet plugin system\. diff --git a/man/man8/puppet-report.8 b/man/man8/puppet-report.8 index 70e9d4e8e85..874ce5ab09a 100644 --- a/man/man8/puppet-report.8 +++ b/man/man8/puppet-report.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-REPORT" "8" "July 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-REPORT" "8" "August 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-report\fR \- Create, display, and submit reports\. diff --git a/man/man8/puppet-resource.8 b/man/man8/puppet-resource.8 index 52810f031c5..76fd3c6a896 100644 --- a/man/man8/puppet-resource.8 +++ b/man/man8/puppet-resource.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-RESOURCE" "8" "July 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-RESOURCE" "8" "August 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-resource\fR \- The resource abstraction layer shell diff --git a/man/man8/puppet-script.8 b/man/man8/puppet-script.8 index 796fea8665b..673b29f0e71 100644 --- a/man/man8/puppet-script.8 +++ b/man/man8/puppet-script.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-SCRIPT" "8" "July 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-SCRIPT" "8" "August 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-script\fR \- Run a puppet manifests as a script without compiling a catalog diff --git a/man/man8/puppet-ssl.8 b/man/man8/puppet-ssl.8 index a9118fb172d..4ca6cc172d8 100644 --- a/man/man8/puppet-ssl.8 +++ b/man/man8/puppet-ssl.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-SSL" "8" "July 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-SSL" "8" "August 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-ssl\fR \- Manage SSL keys and certificates for puppet SSL clients diff --git a/man/man8/puppet.8 b/man/man8/puppet.8 index c05fac50b45..609aca797e7 100644 --- a/man/man8/puppet.8 +++ b/man/man8/puppet.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET" "8" "July 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET" "8" "August 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\fR From d249f57f69e3e8da6aaad2542595a7650d87662e Mon Sep 17 00:00:00 2001 From: Bobosila Victor Date: Tue, 29 Jun 2021 15:51:07 +0300 Subject: [PATCH 424/731] (PUP-11088) Check all limits on top level facts Puppet doesn't warn the user when the facts exceed certain limits. This commit adds checks for the number of top level facts and for the lengths of either the names or values of the said facts. Options for the user to change the values for these limits were also added. --- lib/puppet/configurer.rb | 90 ++++++++++++++++++++++++++ lib/puppet/defaults.rb | 25 ++++++++ spec/unit/configurer_spec.rb | 120 +++++++++++++++++++++++++++++++++++ 3 files changed, 235 insertions(+) diff --git a/lib/puppet/configurer.rb b/lib/puppet/configurer.rb index 612e4b8ef65..fa227eb7946 100644 --- a/lib/puppet/configurer.rb +++ b/lib/puppet/configurer.rb @@ -126,6 +126,94 @@ def convert_catalog(result, duration, facts, options = {}) catalog end + def warn_number_of_facts(size, max_number) + Puppet.warning _("The current total number of facts: %{size} exceeds the number of facts limit: %{max_size}") % { size: size, max_size: max_number } + end + + def warn_fact_name_length(name, max_length) + Puppet.warning _("Fact %{name} with length: '%{length}' exceeds the length limit: %{limit}") % { name: name, length: name.to_s.bytesize, limit: max_length } + end + + def warn_number_of_top_level_facts(size, max_number) + Puppet.warning _("The current number of top level facts: %{size} exceeds the top facts limit: %{max_size}") % { size: size, max_size: max_number } + end + + def warn_fact_value_length(value, max_length) + Puppet.warning _("Fact value '%{value}' with the value length: '%{length}' exceeds the value length limit: %{max_length}") % { value: value, length:value.to_s.bytesize, max_length: max_length } + end + + def warn_fact_payload_size(payload, max_size) + Puppet.warning _("Payload with the current size of: '%{payload}' exceeds the payload size limit: %{max_size}") % { payload: payload, max_size: max_size } + end + + def check_fact_name_length(name, number_of_dots) + max_length = Puppet[:fact_name_length_soft_limit] + return if max_length.zero? + + # rough byte size estimations of fact path as a postgresql btree index + size_as_btree_index = 8 + (number_of_dots * 2) + name.to_s.bytesize + warn_fact_name_length(name, max_length) if size_as_btree_index > max_length + end + + def check_fact_values_length(values) + max_length = Puppet[:fact_value_length_soft_limit] + return if max_length.zero? + + warn_fact_value_length(values, max_length) if values.to_s.bytesize > max_length + end + + def check_top_level_number_limit(size) + max_size = Puppet[:top_level_facts_soft_limit] + return if max_size.zero? + + warn_number_of_top_level_facts(size, max_size) if size > max_size + end + + def check_total_number_limit(size) + max_size = Puppet[:number_of_facts_soft_limit] + return if max_size.zero? + + warn_number_of_facts(size, max_size) if size > max_size + end + + def check_payload_size(payload) + max_size = Puppet[:payload_soft_limit] + return if max_size.zero? + + warn_fact_payload_size(payload, max_size) if payload > max_size + Puppet.debug _("The size of the payload is %{payload}") % {payload: payload} + end + + def parse_fact_name_and_value_limits(object, path = []) + case object + when Hash + object.each do |key, value| + path.push(key) + parse_fact_name_and_value_limits(value, path) + path.pop + @number_of_facts += 1 + end + when Array + object.each_with_index do |e, idx| + path.push(idx) + parse_fact_name_and_value_limits(e, path) + path.pop + end + else + check_fact_name_length(path.join(), path.size) + check_fact_values_length(object) + end + end + + def check_facts_limits(facts) + @number_of_facts = 0 + check_top_level_number_limit(facts.size) + + parse_fact_name_and_value_limits(facts) + check_total_number_limit(@number_of_facts) + Puppet.debug _("The total number of facts registered is %{number_of_facts}") % {number_of_facts: @number_of_facts} + end + def get_facts(options) if options[:pluginsync] plugin_sync_time = thinmark do @@ -148,7 +236,9 @@ def get_facts(options) # facts_for_uploading may set Puppet[:node_name_value] as a side effect facter_time = thinmark do facts = find_facts + check_facts_limits(facts.to_data_hash['values']) facts_hash = encode_facts(facts) # encode for uploading # was: facts_for_uploading + check_payload_size(facts_hash[:facts].bytesize) end options[:report].add_times(:fact_generation, facter_time) if options[:report] end diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb index 28af52e280c..29f2921ae98 100644 --- a/lib/puppet/defaults.rb +++ b/lib/puppet/defaults.rb @@ -1689,6 +1689,31 @@ def self.initialize_default_settings!(settings) new configurations, where you want to fix the broken configuration rather than reverting to a known-good one.", }, + :fact_name_length_soft_limit => { + :default => 2560, + :type => :integer, + :desc => "The soft limit for the length of a fact name.", + }, + :fact_value_length_soft_limit => { + :default => 4096, + :type => :integer, + :desc => "The soft limit for the length of a fact value.", + }, + :top_level_facts_soft_limit => { + :default => 512, + :type => :integer, + :desc => "The soft limit for the number of top level facts.", + }, + :number_of_facts_soft_limit => { + :default => 2048, + :type => :integer, + :desc => "The soft limit for the total number of facts.", + }, + :payload_soft_limit => { + :default => 16 * 1024 * 1024, + :type => :integer, + :desc => "The soft limit for the size of the payload.", + }, :use_cached_catalog => { :default => false, :type => :boolean, diff --git a/spec/unit/configurer_spec.rb b/spec/unit/configurer_spec.rb index 786a3c349c3..a57a58f6b49 100644 --- a/spec/unit/configurer_spec.rb +++ b/spec/unit/configurer_spec.rb @@ -151,6 +151,126 @@ expect(report.host).to eq('node_name_from_fact') end + it "should warn the user when the fact value length limits are exceeded" do + Puppet[:fact_name_length_soft_limit] = 0 + Puppet[:fact_value_length_soft_limit] = 1 + Puppet[:top_level_facts_soft_limit] = 0 + Puppet[:number_of_facts_soft_limit] = 0 + Puppet[:payload_soft_limit] = 0 + + facts.values = { 'processors' => { + 'cores' => 1, + 'count' => 2, + 'isa' => "i386", + 'models' => [ + "CPU1 @ 2.80GHz" + ], + 'physicalcount' => 4 } + } + Puppet::Node::Facts.indirection.save(facts) + + expect(Puppet).to receive(:warning).with(/Fact value '.+' with the value length: '[1-9]*' exceeds the value length limit: [1-9]*/).twice + configurer.run + end + + it "should warn the user when the payload limits are exceeded" do + Puppet[:fact_name_length_soft_limit] = 0 + Puppet[:fact_value_length_soft_limit] = 0 + Puppet[:top_level_facts_soft_limit] = 0 + Puppet[:number_of_facts_soft_limit] = 0 + Puppet[:payload_soft_limit] = 1 + + facts.values = { 'processors' => { + 'cores' => 1, + 'count' => 2, + 'isa' => "i386", + 'models' => [ + "CPU1 @ 2.80GHz" + ], + 'physicalcount' => 4 } + } + Puppet::Node::Facts.indirection.save(facts) + + expect(Puppet).to receive(:warning).with(/Payload with the current size of: '[1-9]*' exceeds the payload size limit: [1-9]*/) + configurer.run + end + + it "should warn the user when the total number of facts limit is exceeded" do + Puppet[:fact_name_length_soft_limit] = 0 + Puppet[:fact_value_length_soft_limit] = 0 + Puppet[:top_level_facts_soft_limit] = 0 + Puppet[:number_of_facts_soft_limit] = 1 + Puppet[:payload_soft_limit] = 0 + + facts.values = { + 'processors' => { + 'cores' => 1, + 'count' => 2, + 'isa' => "i386", + 'models' => [ + "CPU1 @ 2.80GHz", + "CPU1 @ 2.80GHz", + "CPU1 @ 2.80GHz", + "CPU1 @ 2.80GHz", + "CPU1 @ 2.80GHz", + { + 'processors' => { + 'cores' => [1,2] + } + } + ], + 'physicalcount' => 4 + } + } + Puppet::Node::Facts.indirection.save(facts) + + expect(Puppet).to receive(:warning).with(/The current total number of facts: [1-9]* exceeds the number of facts limit: [1-9]*/) + configurer.run + end + + it "should warn the user when the top level facts size limits are exceeded" do + Puppet[:fact_name_length_soft_limit] = 0 + Puppet[:fact_value_length_soft_limit] = 0 + Puppet[:top_level_facts_soft_limit] = 1 + Puppet[:number_of_facts_soft_limit] = 0 + Puppet[:payload_soft_limit] = 0 + + facts.values = {'my_new_fact_name' => 'my_new_fact_value', + 'my_new_fact_name2' => 'my_new_fact_value2'} + Puppet::Node::Facts.indirection.save(facts) + + expect(Puppet).to receive(:warning).with(/The current number of top level facts: [1-9]* exceeds the top facts limit: [1-9]*/) + configurer.run + end + + it "should warn the user when the fact name length limits are exceeded" do + Puppet[:fact_name_length_soft_limit] = 1 + Puppet[:fact_value_length_soft_limit] = 0 + Puppet[:top_level_facts_soft_limit] = 0 + Puppet[:number_of_facts_soft_limit] = 0 + Puppet[:payload_soft_limit] = 0 + + facts.values = {'my_new_fact_name' => 'my_new_fact_value'} + Puppet::Node::Facts.indirection.save(facts) + + expect(Puppet).to receive(:warning).with(/Fact .+ with length: '[1-9]*' exceeds the length limit: [1-9]*/) + configurer.run + end + + it "shouldn't warn the user when the fact limit settings are set to 0" do + Puppet[:fact_name_length_soft_limit] = 0 + Puppet[:fact_value_length_soft_limit] = 0 + Puppet[:top_level_facts_soft_limit] = 0 + Puppet[:number_of_facts_soft_limit] = 0 + Puppet[:payload_soft_limit] = 0 + + facts.values = {'my_new_fact_name' => 'my_new_fact_value'} + Puppet::Node::Facts.indirection.save(facts) + + expect(Puppet).not_to receive(:warning) + configurer.run + end + it "creates a new report when applying the catalog" do options = {} configurer.run(options) From 577b712baf38ad8cd3d15ce718245f52a03f92d7 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Wed, 4 Aug 2021 13:22:34 +0000 Subject: [PATCH 425/731] (packaging) Updating the puppet.pot file --- locales/puppet.pot | 82 +++++++++++++++++++++++++++++++--------------- 1 file changed, 55 insertions(+), 27 deletions(-) diff --git a/locales/puppet.pot b/locales/puppet.pot index 5b20c4c6464..7d17edffe5e 100644 --- a/locales/puppet.pot +++ b/locales/puppet.pot @@ -6,11 +6,11 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Puppet automation framework 7.8.0-252-ge00b7f3214\n" +"Project-Id-Version: Puppet automation framework 7.8.0-256-gdfafa3442e\n" "\n" "Report-Msgid-Bugs-To: https://tickets.puppetlabs.com\n" -"POT-Creation-Date: 2021-08-04 08:52+0000\n" -"PO-Revision-Date: 2021-08-04 08:52+0000\n" +"POT-Creation-Date: 2021-08-04 13:22+0000\n" +"PO-Revision-Date: 2021-08-04 13:22+0000\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -534,97 +534,125 @@ msgstr "" msgid "Not using cached catalog because its environment '%{catalog_env}' does not match '%{local_env}'" msgstr "" -#: ../lib/puppet/configurer.rb:100 ../lib/puppet/configurer.rb:182 +#: ../lib/puppet/configurer.rb:100 ../lib/puppet/configurer.rb:272 msgid "Using cached catalog from environment '%{catalog_env}'" msgstr "" -#: ../lib/puppet/configurer.rb:175 +#: ../lib/puppet/configurer.rb:130 +msgid "The current total number of facts: %{size} exceeds the number of facts limit: %{max_size}" +msgstr "" + +#: ../lib/puppet/configurer.rb:134 +msgid "Fact %{name} with length: '%{length}' exceeds the length limit: %{limit}" +msgstr "" + +#: ../lib/puppet/configurer.rb:138 +msgid "The current number of top level facts: %{size} exceeds the top facts limit: %{max_size}" +msgstr "" + +#: ../lib/puppet/configurer.rb:142 +msgid "Fact value '%{value}' with the value length: '%{length}' exceeds the value length limit: %{max_length}" +msgstr "" + +#: ../lib/puppet/configurer.rb:146 +msgid "Payload with the current size of: '%{payload}' exceeds the payload size limit: %{max_size}" +msgstr "" + +#: ../lib/puppet/configurer.rb:184 +msgid "The size of the payload is %{payload}" +msgstr "" + +#: ../lib/puppet/configurer.rb:214 +msgid "The total number of facts registered is %{number_of_facts}" +msgstr "" + +#: ../lib/puppet/configurer.rb:265 msgid "Could not retrieve catalog; skipping run" msgstr "" -#: ../lib/puppet/configurer.rb:191 +#: ../lib/puppet/configurer.rb:281 msgid "Applied catalog in %{seconds} seconds" msgstr "" -#: ../lib/puppet/configurer.rb:225 +#: ../lib/puppet/configurer.rb:315 msgid "Could not select a functional puppet server from server_list: '%{server_list}'" msgstr "" #. TRANSLATORS 'server_list' is the name of a setting and should not be translated -#: ../lib/puppet/configurer.rb:239 +#: ../lib/puppet/configurer.rb:329 msgid "Selected puppet server from the `server_list` setting: %{server}:%{port}" msgstr "" -#: ../lib/puppet/configurer.rb:275 +#: ../lib/puppet/configurer.rb:365 msgid "Local environment: '%{local_env}' doesn't match the environment of the cached catalog '%{catalog_env}', switching agent to '%{catalog_env}'." msgstr "" -#: ../lib/puppet/configurer.rb:298 +#: ../lib/puppet/configurer.rb:388 msgid "No environment configured, attempting to find out the last used environment" msgstr "" -#: ../lib/puppet/configurer.rb:334 +#: ../lib/puppet/configurer.rb:424 msgid "Not using catalog because its environment '%{catalog_env}' does not match agent specified environment '%{local_env}' and strict_environment_mode is set" msgstr "" -#: ../lib/puppet/configurer.rb:345 +#: ../lib/puppet/configurer.rb:435 msgid "Catalog environment didn't stabilize after %{tries} fetches, aborting run" msgstr "" -#: ../lib/puppet/configurer.rb:347 +#: ../lib/puppet/configurer.rb:437 msgid "Local environment: '%{local_env}' doesn't match server specified environment '%{catalog_env}', restarting agent run with environment '%{catalog_env}'" msgstr "" -#: ../lib/puppet/configurer.rb:410 +#: ../lib/puppet/configurer.rb:500 msgid "Failed to apply catalog: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:441 +#: ../lib/puppet/configurer.rb:531 msgid "Environment '%{environment}' not found on server, skipping initial pluginsync." msgstr "" -#: ../lib/puppet/configurer.rb:458 ../lib/puppet/http/resolver/server_list.rb:64 ../lib/puppet/http/resolver/server_list.rb:68 +#: ../lib/puppet/configurer.rb:548 ../lib/puppet/http/resolver/server_list.rb:64 ../lib/puppet/http/resolver/server_list.rb:68 msgid "Puppet server %{host}:%{port} is unavailable: %{code} %{reason}" msgstr "" #. TRANSLATORS 'server_list' is the name of a setting and should not be translated -#: ../lib/puppet/configurer.rb:462 ../lib/puppet/http/resolver/server_list.rb:73 ../lib/puppet/http/resolver/server_list.rb:76 +#: ../lib/puppet/configurer.rb:552 ../lib/puppet/http/resolver/server_list.rb:73 ../lib/puppet/http/resolver/server_list.rb:76 msgid "Unable to connect to server from server_list setting: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:476 +#: ../lib/puppet/configurer.rb:566 msgid "Found last used environment: %{environment}" msgstr "" -#: ../lib/puppet/configurer.rb:479 +#: ../lib/puppet/configurer.rb:569 msgid "Unable to get last used environment: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:489 ../lib/puppet/face/report.rb:47 +#: ../lib/puppet/configurer.rb:579 ../lib/puppet/face/report.rb:47 msgid "Could not send report: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:498 +#: ../lib/puppet/configurer.rb:588 msgid "Could not save last run local report: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:517 +#: ../lib/puppet/configurer.rb:607 msgid "Uploading facts for %{node} to %{server}" msgstr "" -#: ../lib/puppet/configurer.rb:525 +#: ../lib/puppet/configurer.rb:615 msgid "Failed to submit facts: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:540 +#: ../lib/puppet/configurer.rb:630 msgid "Could not run command from %{setting}: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:558 +#: ../lib/puppet/configurer.rb:648 msgid "Could not retrieve catalog from cache: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:579 +#: ../lib/puppet/configurer.rb:669 msgid "Could not retrieve catalog from remote server: %{detail}" msgstr "" @@ -724,7 +752,7 @@ msgid "Invalid value '%{value}' for parameter %{name}. Allowed values are '%{all msgstr "" #. TRANSLATORS 'pluginsync' is a setting and should not be translated -#: ../lib/puppet/defaults.rb:1919 +#: ../lib/puppet/defaults.rb:1944 msgid "Setting 'pluginsync' is deprecated." msgstr "" From ef15dd4368290a5f05e62a5a7f2c8e75b06e4b54 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Wed, 4 Aug 2021 13:24:35 +0000 Subject: [PATCH 426/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index adee867c41a..aaa7f945697 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -689,6 +689,22 @@ For more info, see the ENC documentation \fIhttps://puppet\.com/docs/puppet/late . .IP "" 0 . +.SS "fact_name_length_soft_limit" +The soft limit for the length of a fact name\. +. +.IP "\(bu" 4 +\fIDefault\fR: \fB2560\fR +. +.IP "" 0 +. +.SS "fact_value_length_soft_limit" +The soft limit for the length of a fact value\. +. +.IP "\(bu" 4 +\fIDefault\fR: \fB4096\fR +. +.IP "" 0 +. .SS "factpath" Where Puppet should look for facts\. Multiple directories should be separated by the system path separator character\. (The POSIX path separator is \':\', and the Windows path separator is \';\'\.) . @@ -1352,6 +1368,14 @@ When running in noop mode, Puppet will check whether each resource is in sync, l . .IP "" 0 . +.SS "number_of_facts_soft_limit" +The soft limit for the total number of facts\. +. +.IP "\(bu" 4 +\fIDefault\fR: \fB2048\fR +. +.IP "" 0 +. .SS "onetime" Perform one configuration run and exit, rather than spawning a long\-running daemon\. This is useful for interactively running puppet agent, or running puppet agent from cron\. . @@ -1379,6 +1403,14 @@ This setting can only be set in the \fB[main]\fR section of puppet\.conf; it can . .IP "" 0 . +.SS "payload_soft_limit" +The soft limit for the size of the payload\. +. +.IP "\(bu" 4 +\fIDefault\fR: \fB16777216\fR +. +.IP "" 0 +. .SS "pidfile" The file containing the PID of a running process\. This file is intended to be used by service management frameworks and monitoring systems to determine if a puppet process is still in the process table\. . @@ -1943,6 +1975,14 @@ Turns on experimental support for tasks and plans in the puppet language\. This . .IP "" 0 . +.SS "top_level_facts_soft_limit" +The soft limit for the number of top level facts\. +. +.IP "\(bu" 4 +\fIDefault\fR: \fB512\fR +. +.IP "" 0 +. .SS "trace" Whether to print stack traces on some errors\. Will print internal Ruby stack trace interleaved with Puppet function frames\. . From 2471aa37b04e169794429dfcb8c5f1efc9eb6cd7 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Wed, 11 Aug 2021 13:52:25 +0000 Subject: [PATCH 427/731] (packaging) Updating the puppet.pot file --- locales/puppet.pot | 156 ++++++++++++++++++++++++--------------------- 1 file changed, 82 insertions(+), 74 deletions(-) diff --git a/locales/puppet.pot b/locales/puppet.pot index 7d17edffe5e..d294cf493a3 100644 --- a/locales/puppet.pot +++ b/locales/puppet.pot @@ -6,11 +6,11 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Puppet automation framework 7.8.0-256-gdfafa3442e\n" +"Project-Id-Version: Puppet automation framework 7.9.0-154-gc8aa8b2175\n" "\n" "Report-Msgid-Bugs-To: https://tickets.puppetlabs.com\n" -"POT-Creation-Date: 2021-08-04 13:22+0000\n" -"PO-Revision-Date: 2021-08-04 13:22+0000\n" +"POT-Creation-Date: 2021-08-11 13:52+0000\n" +"PO-Revision-Date: 2021-08-11 13:52+0000\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -583,76 +583,84 @@ msgstr "" msgid "Selected puppet server from the `server_list` setting: %{server}:%{port}" msgstr "" -#: ../lib/puppet/configurer.rb:365 +#: ../lib/puppet/configurer.rb:366 msgid "Local environment: '%{local_env}' doesn't match the environment of the cached catalog '%{catalog_env}', switching agent to '%{catalog_env}'." msgstr "" -#: ../lib/puppet/configurer.rb:388 -msgid "No environment configured, attempting to find out the last used environment" +#: ../lib/puppet/configurer.rb:389 +msgid "Environment not passed via CLI and no catalog was given, attempting to find out the last server-specified environment" msgstr "" -#: ../lib/puppet/configurer.rb:424 +#: ../lib/puppet/configurer.rb:394 +msgid "Could not find a usable environment in the lastrunfile. Either the file does not exist, does not have the required keys, or the values of 'initial_environment' and 'converged_environment' are identical." +msgstr "" + +#: ../lib/puppet/configurer.rb:398 +msgid "Using environment '%{env}'" +msgstr "" + +#: ../lib/puppet/configurer.rb:429 msgid "Not using catalog because its environment '%{catalog_env}' does not match agent specified environment '%{local_env}' and strict_environment_mode is set" msgstr "" -#: ../lib/puppet/configurer.rb:435 +#: ../lib/puppet/configurer.rb:440 msgid "Catalog environment didn't stabilize after %{tries} fetches, aborting run" msgstr "" -#: ../lib/puppet/configurer.rb:437 +#: ../lib/puppet/configurer.rb:442 msgid "Local environment: '%{local_env}' doesn't match server specified environment '%{catalog_env}', restarting agent run with environment '%{catalog_env}'" msgstr "" -#: ../lib/puppet/configurer.rb:500 +#: ../lib/puppet/configurer.rb:505 msgid "Failed to apply catalog: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:531 +#: ../lib/puppet/configurer.rb:536 msgid "Environment '%{environment}' not found on server, skipping initial pluginsync." msgstr "" -#: ../lib/puppet/configurer.rb:548 ../lib/puppet/http/resolver/server_list.rb:64 ../lib/puppet/http/resolver/server_list.rb:68 +#: ../lib/puppet/configurer.rb:553 ../lib/puppet/http/resolver/server_list.rb:64 ../lib/puppet/http/resolver/server_list.rb:68 msgid "Puppet server %{host}:%{port} is unavailable: %{code} %{reason}" msgstr "" #. TRANSLATORS 'server_list' is the name of a setting and should not be translated -#: ../lib/puppet/configurer.rb:552 ../lib/puppet/http/resolver/server_list.rb:73 ../lib/puppet/http/resolver/server_list.rb:76 +#: ../lib/puppet/configurer.rb:557 ../lib/puppet/http/resolver/server_list.rb:73 ../lib/puppet/http/resolver/server_list.rb:76 msgid "Unable to connect to server from server_list setting: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:566 -msgid "Found last used environment: %{environment}" +#: ../lib/puppet/configurer.rb:573 +msgid "Found last server-specified environment: %{environment}" msgstr "" -#: ../lib/puppet/configurer.rb:569 -msgid "Unable to get last used environment: %{detail}" +#: ../lib/puppet/configurer.rb:576 +msgid "Could not find last server-specified environment: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:579 ../lib/puppet/face/report.rb:47 +#: ../lib/puppet/configurer.rb:586 ../lib/puppet/face/report.rb:47 msgid "Could not send report: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:588 +#: ../lib/puppet/configurer.rb:595 msgid "Could not save last run local report: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:607 +#: ../lib/puppet/configurer.rb:614 msgid "Uploading facts for %{node} to %{server}" msgstr "" -#: ../lib/puppet/configurer.rb:615 +#: ../lib/puppet/configurer.rb:622 msgid "Failed to submit facts: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:630 +#: ../lib/puppet/configurer.rb:637 msgid "Could not run command from %{setting}: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:648 +#: ../lib/puppet/configurer.rb:655 msgid "Could not retrieve catalog from cache: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:669 +#: ../lib/puppet/configurer.rb:677 msgid "Could not retrieve catalog from remote server: %{detail}" msgstr "" @@ -2316,120 +2324,120 @@ msgstr "" msgid "Catalog for %{request} was requested with fact definition for the wrong node (%{fact_name})." msgstr "" -#: ../lib/puppet/indirector/catalog/compiler.rb:77 +#: ../lib/puppet/indirector/catalog/compiler.rb:85 msgid "Setup server facts for compiling" msgstr "" -#: ../lib/puppet/indirector/catalog/compiler.rb:105 +#: ../lib/puppet/indirector/catalog/compiler.rb:113 msgid "Unsupported facts format" msgstr "" #. TRANSLATORS Inlining refers to adding additional metadata (in this case we are not inlining) -#: ../lib/puppet/indirector/catalog/compiler.rb:146 +#: ../lib/puppet/indirector/catalog/compiler.rb:154 msgid "Not inlining absent resource" msgstr "" #. TRANSLATORS Inlining refers to adding additional metadata (in this case we are not inlining) -#: ../lib/puppet/indirector/catalog/compiler.rb:149 +#: ../lib/puppet/indirector/catalog/compiler.rb:157 msgid "Not inlining resource without sources" msgstr "" #. TRANSLATORS Inlining refers to adding additional metadata (in this case we are not inlining) -#: ../lib/puppet/indirector/catalog/compiler.rb:152 +#: ../lib/puppet/indirector/catalog/compiler.rb:160 msgid "Not inlining unsupported source scheme" msgstr "" #. TRANSLATORS Inlining refers to adding additional metadata (in this case we are not inlining) -#: ../lib/puppet/indirector/catalog/compiler.rb:174 +#: ../lib/puppet/indirector/catalog/compiler.rb:182 msgid "Not inlining file outside environment" msgstr "" #. TRANSLATORS Inlining refers to adding additional metadata -#: ../lib/puppet/indirector/catalog/compiler.rb:180 +#: ../lib/puppet/indirector/catalog/compiler.rb:188 msgid "Inlining file metadata" msgstr "" -#: ../lib/puppet/indirector/catalog/compiler.rb:270 +#: ../lib/puppet/indirector/catalog/compiler.rb:278 msgid "Could not get metadata for %{resource}" msgstr "" -#: ../lib/puppet/indirector/catalog/compiler.rb:291 +#: ../lib/puppet/indirector/catalog/compiler.rb:299 msgid "Unable to find a common checksum type between agent '%{agent_type}' and master '%{master_type}'." msgstr "" -#: ../lib/puppet/indirector/catalog/compiler.rb:298 +#: ../lib/puppet/indirector/catalog/compiler.rb:306 msgid "Compiled static catalog for %{node} in environment %{environment} in %%{seconds} seconds" msgstr "" -#: ../lib/puppet/indirector/catalog/compiler.rb:299 +#: ../lib/puppet/indirector/catalog/compiler.rb:307 msgid "Compiled static catalog for %{node} in environment %{environment}" msgstr "" -#: ../lib/puppet/indirector/catalog/compiler.rb:301 +#: ../lib/puppet/indirector/catalog/compiler.rb:309 msgid "Compiled static catalog for %{node} in %%{seconds} seconds" msgstr "" -#: ../lib/puppet/indirector/catalog/compiler.rb:302 +#: ../lib/puppet/indirector/catalog/compiler.rb:310 msgid "Compiled static catalog for %{node}" msgstr "" -#: ../lib/puppet/indirector/catalog/compiler.rb:307 +#: ../lib/puppet/indirector/catalog/compiler.rb:315 msgid "Compiled catalog for %{node} in environment %{environment} in %%{seconds} seconds" msgstr "" -#: ../lib/puppet/indirector/catalog/compiler.rb:308 +#: ../lib/puppet/indirector/catalog/compiler.rb:316 msgid "Compiled catalog for %{node} in environment %{environment}" msgstr "" -#: ../lib/puppet/indirector/catalog/compiler.rb:310 +#: ../lib/puppet/indirector/catalog/compiler.rb:318 msgid "Compiled catalog for %{node} in %%{seconds} seconds" msgstr "" -#: ../lib/puppet/indirector/catalog/compiler.rb:311 +#: ../lib/puppet/indirector/catalog/compiler.rb:319 msgid "Compiled catalog for %{node}" msgstr "" #. TRANSLATORS Inlined refers to adding additional metadata -#: ../lib/puppet/indirector/catalog/compiler.rb:333 +#: ../lib/puppet/indirector/catalog/compiler.rb:341 msgid "Inlined resource metadata into static catalog for %{node} in environment %{environment} in %%{seconds} seconds" msgstr "" #. TRANSLATORS Inlined refers to adding additional metadata -#: ../lib/puppet/indirector/catalog/compiler.rb:335 +#: ../lib/puppet/indirector/catalog/compiler.rb:343 msgid "Inlined resource metadata into static catalog for %{node} in environment %{environment}" msgstr "" #. TRANSLATORS Inlined refers to adding additional metadata -#: ../lib/puppet/indirector/catalog/compiler.rb:338 +#: ../lib/puppet/indirector/catalog/compiler.rb:346 msgid "Inlined resource metadata into static catalog for %{node} in %%{seconds} seconds" msgstr "" #. TRANSLATORS Inlined refers to adding additional metadata -#: ../lib/puppet/indirector/catalog/compiler.rb:340 +#: ../lib/puppet/indirector/catalog/compiler.rb:348 msgid "Inlined resource metadata into static catalog for %{node}" msgstr "" -#: ../lib/puppet/indirector/catalog/compiler.rb:357 +#: ../lib/puppet/indirector/catalog/compiler.rb:365 msgid "Found node information" msgstr "" -#: ../lib/puppet/indirector/catalog/compiler.rb:365 +#: ../lib/puppet/indirector/catalog/compiler.rb:373 msgid "Failed when searching for node %{name}: %{detail}" msgstr "" -#: ../lib/puppet/indirector/catalog/compiler.rb:385 +#: ../lib/puppet/indirector/catalog/compiler.rb:393 msgid "Invalid option use_node for a remote request" msgstr "" -#: ../lib/puppet/indirector/catalog/compiler.rb:404 +#: ../lib/puppet/indirector/catalog/compiler.rb:412 msgid "Could not find node '%{name}'; cannot compile" msgstr "" -#: ../lib/puppet/indirector/catalog/compiler.rb:437 +#: ../lib/puppet/indirector/catalog/compiler.rb:445 msgid "Could not retrieve fact servername" msgstr "" -#: ../lib/puppet/indirector/catalog/compiler.rb:446 +#: ../lib/puppet/indirector/catalog/compiler.rb:454 msgid "Could not retrieve either serverip or serverip6 fact" msgstr "" @@ -2441,7 +2449,7 @@ msgstr "" msgid "Unable to serialize catalog to json, retrying with pson" msgstr "" -#: ../lib/puppet/indirector/catalog/rest.rb:32 ../lib/puppet/indirector/facts/rest.rb:20 ../lib/puppet/indirector/file_content/rest.rb:29 ../lib/puppet/indirector/file_metadata/rest.rb:26 ../lib/puppet/indirector/node/rest.rb:23 +#: ../lib/puppet/indirector/catalog/rest.rb:33 ../lib/puppet/indirector/facts/rest.rb:20 ../lib/puppet/indirector/file_content/rest.rb:29 ../lib/puppet/indirector/file_metadata/rest.rb:26 ../lib/puppet/indirector/node/rest.rb:23 msgid "Find %{uri} resulted in 404 with the message: %{body}" msgstr "" @@ -2885,8 +2893,8 @@ msgstr "" msgid "Option %{option} conflicts with existing option %{conflict} on %{face}" msgstr "" -#. TRANSLATORS 'Puppet.settings' references to the Puppet settings options and should not be translated #. TRANSLATORS 'Puppet.settings' should not be translated +#. TRANSLATORS 'Puppet.settings' references to the Puppet settings options and should not be translated #: ../lib/puppet/interface/action.rb:315 ../lib/puppet/interface/option_manager.rb:14 msgid "Global option %{option} does not exist in Puppet.settings" msgstr "" @@ -3126,19 +3134,19 @@ msgstr "" msgid "Plan %{plan_name} not found in module %{module_name}." msgstr "" -#: ../lib/puppet/module/plan.rb:64 +#: ../lib/puppet/module/plan.rb:63 msgid "Plan names must start with a lowercase letter and be composed of only lowercase letters, numbers, and underscores" msgstr "" -#: ../lib/puppet/module/plan.rb:66 +#: ../lib/puppet/module/plan.rb:65 msgid "Plan name cannot have extension %{ext}, must be .pp or .yaml" msgstr "" -#: ../lib/puppet/module/plan.rb:69 +#: ../lib/puppet/module/plan.rb:68 msgid "Plan name cannot be a reserved word, but was '%{name}'" msgstr "" -#: ../lib/puppet/module/plan.rb:72 +#: ../lib/puppet/module/plan.rb:71 msgid "Plan name cannot be a Puppet data type, but was '%{name}'" msgstr "" @@ -8000,72 +8008,72 @@ msgstr "" msgid "Could not set %{attribute} on %{class_name}: %{detail}" msgstr "" -#: ../lib/puppet/type/exec.rb:118 +#: ../lib/puppet/type/exec.rb:121 msgid "executed successfully" msgstr "" -#: ../lib/puppet/type/exec.rb:152 +#: ../lib/puppet/type/exec.rb:155 msgid "Command exceeded timeout" msgstr "" -#: ../lib/puppet/type/exec.rb:181 +#: ../lib/puppet/type/exec.rb:184 msgid "[command redacted] returned %{status} instead of one of [%{expected}]" msgstr "" -#: ../lib/puppet/type/exec.rb:183 +#: ../lib/puppet/type/exec.rb:186 msgid "'%{cmd}' returned %{status} instead of one of [%{expected}]" msgstr "" -#: ../lib/puppet/type/exec.rb:205 +#: ../lib/puppet/type/exec.rb:208 msgid "Command must be a String or Array, got value of class %{klass}" msgstr "" -#: ../lib/puppet/type/exec.rb:238 +#: ../lib/puppet/type/exec.rb:241 msgid "Unable to execute commands as other users on Windows" msgstr "" -#: ../lib/puppet/type/exec.rb:240 +#: ../lib/puppet/type/exec.rb:243 msgid "Only root can execute commands as other users" msgstr "" -#: ../lib/puppet/type/exec.rb:296 +#: ../lib/puppet/type/exec.rb:299 msgid "Invalid environment setting '%{value}'" msgstr "" -#: ../lib/puppet/type/exec.rb:309 +#: ../lib/puppet/type/exec.rb:312 msgid "The umask specification is invalid: %{value}" msgstr "" -#: ../lib/puppet/type/exec.rb:325 +#: ../lib/puppet/type/exec.rb:328 msgid "The timeout must be a number." msgstr "" -#: ../lib/puppet/type/exec.rb:342 +#: ../lib/puppet/type/exec.rb:345 msgid "Tries must be an integer" msgstr "" -#: ../lib/puppet/type/exec.rb:346 +#: ../lib/puppet/type/exec.rb:349 msgid "Tries must be an integer >= 1" msgstr "" -#: ../lib/puppet/type/exec.rb:359 +#: ../lib/puppet/type/exec.rb:362 msgid "try_sleep must be a number" msgstr "" -#: ../lib/puppet/type/exec.rb:363 +#: ../lib/puppet/type/exec.rb:366 msgid "try_sleep cannot be a negative number" msgstr "" #. TRANSLATORS 'creates' is a parameter name and should not be translated -#: ../lib/puppet/type/exec.rb:435 +#: ../lib/puppet/type/exec.rb:438 msgid "Checking that 'creates' path '%{creates_path}' exists" msgstr "" -#: ../lib/puppet/type/exec.rb:484 ../lib/puppet/type/exec.rb:544 +#: ../lib/puppet/type/exec.rb:490 ../lib/puppet/type/exec.rb:553 msgid "Check %{value} exceeded timeout" msgstr "" -#: ../lib/puppet/type/exec.rb:636 +#: ../lib/puppet/type/exec.rb:645 msgid "'%{cmd}' won't be executed because of failed check '%{check}'" msgstr "" From 174e6a1c82feb897441810238dd7bbfaea617a25 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Fri, 13 Aug 2021 08:48:40 +0000 Subject: [PATCH 428/731] (packaging) Bump to version '7.11.0' [no-promote] --- .gemspec | 2 +- lib/puppet/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gemspec b/.gemspec index 4fd6d52aa56..ec289f80b4b 100644 --- a/.gemspec +++ b/.gemspec @@ -13,7 +13,7 @@ Gem::Specification.new do |s| s.name = "puppet" - version = "7.10.0" + version = "7.11.0" mdata = version.match(/(\d+\.\d+\.\d+)/) s.version = mdata ? mdata[1] : version diff --git a/lib/puppet/version.rb b/lib/puppet/version.rb index e99f8af9369..9996cea26c3 100644 --- a/lib/puppet/version.rb +++ b/lib/puppet/version.rb @@ -6,7 +6,7 @@ # Raketasks and such to set the version based on the output of `git describe` module Puppet - PUPPETVERSION = '7.10.0' + PUPPETVERSION = '7.11.0' ## # version is a public API method intended to always provide a fast and From 1156ac702c369930434bed2cedacdfe3a30a50e9 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Fri, 13 Aug 2021 08:54:06 +0000 Subject: [PATCH 429/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 2 +- man/man8/puppet.8 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index aaa7f945697..7692d42962e 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -929,7 +929,7 @@ The time to wait for data to be read from an HTTP connection\. If nothing is rea The HTTP User\-Agent string to send when making network requests\. . .IP "\(bu" 4 -\fIDefault\fR: \fBPuppet/7\.10\.0 Ruby/2\.5\.1\-p57 (x86_64\-linux)\fR +\fIDefault\fR: \fBPuppet/7\.11\.0 Ruby/2\.5\.1\-p57 (x86_64\-linux)\fR . .IP "" 0 . diff --git a/man/man8/puppet.8 b/man/man8/puppet.8 index 609aca797e7..090d7ca8d1b 100644 --- a/man/man8/puppet.8 +++ b/man/man8/puppet.8 @@ -25,4 +25,4 @@ Specialized: 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 . .P -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\.10\.0 +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\.11\.0 From b72264659bcbca77eb859dd2130b2e867f7d409c Mon Sep 17 00:00:00 2001 From: gimmy Date: Mon, 23 Aug 2021 14:58:54 +0300 Subject: [PATCH 430/731] (PUP-11205) add snyk monitor --- .github/workflows/snyk_monitor.yaml | 33 +++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/snyk_monitor.yaml diff --git a/.github/workflows/snyk_monitor.yaml b/.github/workflows/snyk_monitor.yaml new file mode 100644 index 00000000000..d2b9a0771dc --- /dev/null +++ b/.github/workflows/snyk_monitor.yaml @@ -0,0 +1,33 @@ +--- +name: Snyk Monitor +on: + schedule: + - cron: '0 6 * * 1-5' + push: + branches: + - main +jobs: + snyk_monitor: + if: ${{ github.repository_owner == 'puppetlabs' }} + runs-on: ubuntu-latest + name: Snyk Monitor + steps: + - name: Checkout current PR + uses: actions/checkout@v2 + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.7 + - name: Install dependencies + run: bundle install --jobs 3 --retry 3 + - name: Extract branch name + shell: bash + run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" + id: extract_branch + - name: Run Snyk to check for vulnerabilities + uses: snyk/actions/ruby@master + env: + SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} + with: + command: monitor + args: --org=puppet-foss --project-name=${{ github.repository }}#${{ steps.extract_branch.outputs.branch }} From b974236be0f62a53a4a59c84a555bb0065a2c53c Mon Sep 17 00:00:00 2001 From: Ben Ford Date: Mon, 23 Aug 2021 11:14:50 -0700 Subject: [PATCH 431/731] (PUP-5704) This adds docs for parameterized exec commands --- lib/puppet/type/exec.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/puppet/type/exec.rb b/lib/puppet/type/exec.rb index a207bd1fe94..f78c997864f 100644 --- a/lib/puppet/type/exec.rb +++ b/lib/puppet/type/exec.rb @@ -201,7 +201,15 @@ def sync any output is logged at the `err` log level. Multiple `exec` resources can use the same `command` value; Puppet - only uses the resource title to ensure `exec`s are unique." + only uses the resource title to ensure `exec`s are unique. + + On *nix platforms, the command can be specified as an array of + strings and Puppet will invoke it using the more secure method of + parameterized system calls. For example, rather than executing the + malicious injected code, this command will echo it out: + + command => ['/bin/echo', 'hello world; rm -rf /'] + " validate do |command| unless command.is_a?(String) || command.is_a?(Array) From 1fc405605582399bdbe0c1fd56024ca4f2d9a5ac Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Mon, 30 Aug 2021 15:33:27 -0700 Subject: [PATCH 432/731] (maint) Accept 0 digit CI was failing due to a fact of size 410 not matching the regex [1-9]*. Use \d to match digits. --- spec/unit/configurer_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/unit/configurer_spec.rb b/spec/unit/configurer_spec.rb index f4a98ed6eba..00cfccc13dc 100644 --- a/spec/unit/configurer_spec.rb +++ b/spec/unit/configurer_spec.rb @@ -191,7 +191,7 @@ } Puppet::Node::Facts.indirection.save(facts) - expect(Puppet).to receive(:warning).with(/Payload with the current size of: '[1-9]*' exceeds the payload size limit: [1-9]*/) + expect(Puppet).to receive(:warning).with(/Payload with the current size of: '\d*' exceeds the payload size limit: \d*/) configurer.run end From dad17cef891e1c574c7b64b355da29391fc923d0 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Thu, 2 Sep 2021 17:07:38 +0000 Subject: [PATCH 433/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 2 +- man/man8/puppet-agent.8 | 2 +- man/man8/puppet-apply.8 | 2 +- man/man8/puppet-catalog.8 | 2 +- man/man8/puppet-config.8 | 2 +- man/man8/puppet-describe.8 | 2 +- man/man8/puppet-device.8 | 2 +- man/man8/puppet-doc.8 | 2 +- man/man8/puppet-epp.8 | 2 +- man/man8/puppet-facts.8 | 2 +- man/man8/puppet-filebucket.8 | 2 +- man/man8/puppet-generate.8 | 2 +- man/man8/puppet-help.8 | 2 +- man/man8/puppet-lookup.8 | 2 +- man/man8/puppet-module.8 | 2 +- man/man8/puppet-node.8 | 2 +- man/man8/puppet-parser.8 | 2 +- man/man8/puppet-plugin.8 | 2 +- man/man8/puppet-report.8 | 2 +- man/man8/puppet-resource.8 | 2 +- man/man8/puppet-script.8 | 2 +- man/man8/puppet-ssl.8 | 2 +- man/man8/puppet.8 | 2 +- 23 files changed, 23 insertions(+), 23 deletions(-) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index 7692d42962e..09250a210b0 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPETCONF" "5" "August 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPETCONF" "5" "September 2021" "Puppet, Inc." "Puppet manual" \fBThis page is autogenerated; any changes will get overwritten\fR . .SH "Configuration settings" diff --git a/man/man8/puppet-agent.8 b/man/man8/puppet-agent.8 index a6603f43dc5..aa5063c7ccf 100644 --- a/man/man8/puppet-agent.8 +++ b/man/man8/puppet-agent.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-AGENT" "8" "August 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-AGENT" "8" "September 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-agent\fR \- The puppet agent daemon diff --git a/man/man8/puppet-apply.8 b/man/man8/puppet-apply.8 index e558cd40d18..f2ca2d35f79 100644 --- a/man/man8/puppet-apply.8 +++ b/man/man8/puppet-apply.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-APPLY" "8" "August 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-APPLY" "8" "September 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-apply\fR \- Apply Puppet manifests locally diff --git a/man/man8/puppet-catalog.8 b/man/man8/puppet-catalog.8 index 7a5d5b1774a..453c2138070 100644 --- a/man/man8/puppet-catalog.8 +++ b/man/man8/puppet-catalog.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-CATALOG" "8" "August 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-CATALOG" "8" "September 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-catalog\fR \- Compile, save, view, and convert catalogs\. diff --git a/man/man8/puppet-config.8 b/man/man8/puppet-config.8 index c72d476c0b3..e8f2fd84241 100644 --- a/man/man8/puppet-config.8 +++ b/man/man8/puppet-config.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-CONFIG" "8" "August 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-CONFIG" "8" "September 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-config\fR \- Interact with Puppet\'s settings\. diff --git a/man/man8/puppet-describe.8 b/man/man8/puppet-describe.8 index 44a7904895e..49bc7efebf2 100644 --- a/man/man8/puppet-describe.8 +++ b/man/man8/puppet-describe.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-DESCRIBE" "8" "August 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-DESCRIBE" "8" "September 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-describe\fR \- Display help about resource types diff --git a/man/man8/puppet-device.8 b/man/man8/puppet-device.8 index 58d6b3ac6e0..6a03eaf14d6 100644 --- a/man/man8/puppet-device.8 +++ b/man/man8/puppet-device.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-DEVICE" "8" "August 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-DEVICE" "8" "September 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-device\fR \- Manage remote network devices diff --git a/man/man8/puppet-doc.8 b/man/man8/puppet-doc.8 index a2589632397..bfb194e511d 100644 --- a/man/man8/puppet-doc.8 +++ b/man/man8/puppet-doc.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-DOC" "8" "August 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-DOC" "8" "September 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-doc\fR \- Generate Puppet references diff --git a/man/man8/puppet-epp.8 b/man/man8/puppet-epp.8 index e76f03623f4..766fcea7938 100644 --- a/man/man8/puppet-epp.8 +++ b/man/man8/puppet-epp.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-EPP" "8" "August 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-EPP" "8" "September 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-epp\fR \- Interact directly with the EPP template parser/renderer\. diff --git a/man/man8/puppet-facts.8 b/man/man8/puppet-facts.8 index a2c4063b7f3..e60cfe16651 100644 --- a/man/man8/puppet-facts.8 +++ b/man/man8/puppet-facts.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-FACTS" "8" "August 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-FACTS" "8" "September 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-facts\fR \- Retrieve and store facts\. diff --git a/man/man8/puppet-filebucket.8 b/man/man8/puppet-filebucket.8 index ce9077a4358..33d1ebad173 100644 --- a/man/man8/puppet-filebucket.8 +++ b/man/man8/puppet-filebucket.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-FILEBUCKET" "8" "August 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-FILEBUCKET" "8" "September 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-filebucket\fR \- Store and retrieve files in a filebucket diff --git a/man/man8/puppet-generate.8 b/man/man8/puppet-generate.8 index 19c3c56edb1..5b9f22cd4b4 100644 --- a/man/man8/puppet-generate.8 +++ b/man/man8/puppet-generate.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-GENERATE" "8" "August 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-GENERATE" "8" "September 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-generate\fR \- Generates Puppet code from Ruby definitions\. diff --git a/man/man8/puppet-help.8 b/man/man8/puppet-help.8 index 5126e3872b5..5d5f53203ad 100644 --- a/man/man8/puppet-help.8 +++ b/man/man8/puppet-help.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-HELP" "8" "August 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-HELP" "8" "September 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-help\fR \- Display Puppet help\. diff --git a/man/man8/puppet-lookup.8 b/man/man8/puppet-lookup.8 index 4b753aad5b0..d2d5e89e2ac 100644 --- a/man/man8/puppet-lookup.8 +++ b/man/man8/puppet-lookup.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-LOOKUP" "8" "August 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-LOOKUP" "8" "September 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-lookup\fR \- Interactive Hiera lookup diff --git a/man/man8/puppet-module.8 b/man/man8/puppet-module.8 index 10b0fd65978..75ca215f2d8 100644 --- a/man/man8/puppet-module.8 +++ b/man/man8/puppet-module.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-MODULE" "8" "August 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-MODULE" "8" "September 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-module\fR \- Creates, installs and searches for modules on the Puppet Forge\. diff --git a/man/man8/puppet-node.8 b/man/man8/puppet-node.8 index a4efba79ac2..42cd55b7540 100644 --- a/man/man8/puppet-node.8 +++ b/man/man8/puppet-node.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-NODE" "8" "August 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-NODE" "8" "September 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-node\fR \- View and manage node definitions\. diff --git a/man/man8/puppet-parser.8 b/man/man8/puppet-parser.8 index f1a05f9ab44..37b31eebbf6 100644 --- a/man/man8/puppet-parser.8 +++ b/man/man8/puppet-parser.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-PARSER" "8" "August 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-PARSER" "8" "September 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-parser\fR \- Interact directly with the parser\. diff --git a/man/man8/puppet-plugin.8 b/man/man8/puppet-plugin.8 index 91238f05b3a..0c74c0f98df 100644 --- a/man/man8/puppet-plugin.8 +++ b/man/man8/puppet-plugin.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-PLUGIN" "8" "August 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-PLUGIN" "8" "September 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-plugin\fR \- Interact with the Puppet plugin system\. diff --git a/man/man8/puppet-report.8 b/man/man8/puppet-report.8 index 874ce5ab09a..32e703687b9 100644 --- a/man/man8/puppet-report.8 +++ b/man/man8/puppet-report.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-REPORT" "8" "August 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-REPORT" "8" "September 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-report\fR \- Create, display, and submit reports\. diff --git a/man/man8/puppet-resource.8 b/man/man8/puppet-resource.8 index 76fd3c6a896..aab116d2fa4 100644 --- a/man/man8/puppet-resource.8 +++ b/man/man8/puppet-resource.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-RESOURCE" "8" "August 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-RESOURCE" "8" "September 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-resource\fR \- The resource abstraction layer shell diff --git a/man/man8/puppet-script.8 b/man/man8/puppet-script.8 index 673b29f0e71..aed9e79b583 100644 --- a/man/man8/puppet-script.8 +++ b/man/man8/puppet-script.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-SCRIPT" "8" "August 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-SCRIPT" "8" "September 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-script\fR \- Run a puppet manifests as a script without compiling a catalog diff --git a/man/man8/puppet-ssl.8 b/man/man8/puppet-ssl.8 index 4ca6cc172d8..73896a3782c 100644 --- a/man/man8/puppet-ssl.8 +++ b/man/man8/puppet-ssl.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-SSL" "8" "August 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-SSL" "8" "September 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-ssl\fR \- Manage SSL keys and certificates for puppet SSL clients diff --git a/man/man8/puppet.8 b/man/man8/puppet.8 index 090d7ca8d1b..a5535fb75c8 100644 --- a/man/man8/puppet.8 +++ b/man/man8/puppet.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET" "8" "August 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET" "8" "September 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\fR From 9e420916e8ef30a42e5f1bfe89e4c51837e8bdac Mon Sep 17 00:00:00 2001 From: Gabriel Nagy Date: Mon, 6 Sep 2021 12:31:32 +0300 Subject: [PATCH 434/731] (maint) Remove redundant freeze statements --- lib/puppet/parser/scope.rb | 14 ++++++------- lib/puppet/pops/model/factory.rb | 26 ++++++++++++------------- lib/puppet/pops/parser/lexer2.rb | 2 +- lib/puppet/pops/types/type_formatter.rb | 6 +++--- lib/puppet/resource/type_collection.rb | 2 +- 5 files changed, 25 insertions(+), 25 deletions(-) diff --git a/lib/puppet/parser/scope.rb b/lib/puppet/parser/scope.rb index 5161c8a4f1f..e3cf8284fff 100644 --- a/lib/puppet/parser/scope.rb +++ b/lib/puppet/parser/scope.rb @@ -16,7 +16,7 @@ class Puppet::Parser::Scope extend Forwardable # Variables that always exist with nil value even if not set - BUILT_IN_VARS = ['module_name'.freeze, 'caller_module_name'.freeze].freeze + BUILT_IN_VARS = ['module_name', 'caller_module_name'].freeze EMPTY_HASH = {}.freeze Puppet::Util.logmethods(self) @@ -513,7 +513,7 @@ def lookupvar(name, options = EMPTY_HASH) end end - UNDEFINED_VARIABLES_KIND = 'undefined_variables'.freeze + UNDEFINED_VARIABLES_KIND = 'undefined_variables' # The exception raised when a throw is uncaught is different in different versions # of ruby. In >=2.2.0 it is UncaughtThrowError (which did not exist prior to this) @@ -747,12 +747,12 @@ def transform_setting(val) end private :transform_setting - VARNAME_TRUSTED = 'trusted'.freeze - VARNAME_FACTS = 'facts'.freeze - VARNAME_SERVER_FACTS = 'server_facts'.freeze + VARNAME_TRUSTED = 'trusted' + VARNAME_FACTS = 'facts' + VARNAME_SERVER_FACTS = 'server_facts' RESERVED_VARIABLE_NAMES = [VARNAME_TRUSTED, VARNAME_FACTS].freeze - TYPENAME_CLASS = 'Class'.freeze - TYPENAME_NODE = 'Node'.freeze + TYPENAME_CLASS = 'Class' + TYPENAME_NODE = 'Node' # Set a variable in the current scope. This will override settings # in scopes above, but will not allow variables in the current scope diff --git a/lib/puppet/pops/model/factory.rb b/lib/puppet/pops/model/factory.rb index 71d4a2eb3c6..6ce9f37fa49 100644 --- a/lib/puppet/pops/model/factory.rb +++ b/lib/puppet/pops/model/factory.rb @@ -12,19 +12,19 @@ module Model class Factory # Shared build_visitor, since there are many instances of Factory being used - KEY_LENGTH = 'length'.freeze - KEY_OFFSET = 'offset'.freeze - KEY_LOCATOR = 'locator'.freeze - KEY_OPERATOR = 'operator'.freeze - - KEY_VALUE = 'value'.freeze - KEY_KEYS = 'keys'.freeze - KEY_NAME = 'name'.freeze - KEY_BODY = 'body'.freeze - KEY_EXPR = 'expr'.freeze - KEY_LEFT_EXPR = 'left_expr'.freeze - KEY_RIGHT_EXPR = 'right_expr'.freeze - KEY_PARAMETERS = 'parameters'.freeze + KEY_LENGTH = 'length' + KEY_OFFSET = 'offset' + KEY_LOCATOR = 'locator' + KEY_OPERATOR = 'operator' + + KEY_VALUE = 'value' + KEY_KEYS = 'keys' + KEY_NAME = 'name' + KEY_BODY = 'body' + KEY_EXPR = 'expr' + KEY_LEFT_EXPR = 'left_expr' + KEY_RIGHT_EXPR = 'right_expr' + KEY_PARAMETERS = 'parameters' BUILD_VISITOR = Visitor.new(self, 'build') INFER_VISITOR = Visitor.new(self, 'infer') diff --git a/lib/puppet/pops/parser/lexer2.rb b/lib/puppet/pops/parser/lexer2.rb index 832f9701042..0a62484096c 100644 --- a/lib/puppet/pops/parser/lexer2.rb +++ b/lib/puppet/pops/parser/lexer2.rb @@ -176,7 +176,7 @@ class Lexer2 # PERFORMANCE NOTE: # Comparison against a frozen string is faster (than unfrozen). # - STRING_BSLASH_SLASH = '\/'.freeze + STRING_BSLASH_SLASH = '\/' attr_reader :locator diff --git a/lib/puppet/pops/types/type_formatter.rb b/lib/puppet/pops/types/type_formatter.rb index 76b388c18a8..9ca066f1149 100644 --- a/lib/puppet/pops/types/type_formatter.rb +++ b/lib/puppet/pops/types/type_formatter.rb @@ -635,7 +635,7 @@ def to_s '[a TypeFormatter]' end - NAME_SEGMENT_SEPARATOR = '::'.freeze + NAME_SEGMENT_SEPARATOR = '::' STARTS_WITH_ASCII_CAPITAL = /^[A-Z]/ # Capitalizes each segment in a name separated with the {NAME_SEPARATOR} conditionally. The name @@ -662,9 +662,9 @@ def capitalize_segments(qualified_name) private - COMMA_SEP = ', '.freeze + COMMA_SEP = ', ' - HASH_ENTRY_OP = ' => '.freeze + HASH_ENTRY_OP = ' => ' def is_short_array?(t) t.empty? || 100 - @indent * @indent_width > t.inject(0) do |sum, elem| diff --git a/lib/puppet/resource/type_collection.rb b/lib/puppet/resource/type_collection.rb index 843e62e4778..46d0dd1bf3d 100644 --- a/lib/puppet/resource/type_collection.rb +++ b/lib/puppet/resource/type_collection.rb @@ -180,7 +180,7 @@ def version private - COLON_COLON = "::".freeze + COLON_COLON = "::" # Resolve namespaces and find the given object. Autoload it if # necessary. From c1f6610b3b47f7e3aecf56f9e5191475f2a13832 Mon Sep 17 00:00:00 2001 From: gimmy Date: Tue, 7 Sep 2021 14:42:49 +0300 Subject: [PATCH 435/731] (maint) regenerate eparser --- lib/puppet/pops/parser/eparser.rb | 1505 ++++++++++++++--------------- 1 file changed, 752 insertions(+), 753 deletions(-) diff --git a/lib/puppet/pops/parser/eparser.rb b/lib/puppet/pops/parser/eparser.rb index dd1ac31699e..a78c29593b3 100644 --- a/lib/puppet/pops/parser/eparser.rb +++ b/lib/puppet/pops/parser/eparser.rb @@ -1,7 +1,7 @@ # # DO NOT MODIFY!!!! -# This file is automatically generated by Racc 1.4.9 -# from Racc grammer file "". +# This file is automatically generated by Racc 1.5.2 +# from Racc grammar file "". # require 'racc/parser.rb' @@ -30,140 +30,98 @@ class Parser < Racc::Parser ##### State transition tables begin ### clist = [ -'69,72,-279,110,70,64,141,65,-281,281,368,324,110,163,64,-267,65,112', -'-276,115,248,-145,-225,111,20,19,112,141,115,144,282,51,111,54,400,60', -'127,269,57,43,46,90,53,44,114,-279,164,141,77,18,144,-281,45,114,325', -'16,17,77,-267,92,93,-276,249,78,-145,372,91,270,125,52,144,402,122,42', -'73,91,75,76,261,260,373,58,48,61,62,55,56,69,72,63,82,70,64,281,65,428', -'281,300,63,110,485,83,84,85,124,423,77,302,121,77,303,20,19,112,282', -'115,123,282,51,111,54,409,60,12,281,57,43,46,314,53,44,10,11,305,304', -'77,18,77,440,45,114,424,16,17,410,282,423,441,261,260,78,86,88,87,89', -'436,52,435,-226,274,42,73,91,75,76,436,322,435,58,48,61,62,55,56,69', -'72,63,323,70,64,413,65,175,338,217,337,218,300,335,220,339,392,332,65', -'334,336,69,72,20,19,70,416,221,216,340,51,294,54,333,60,12,110,57,43', -'46,368,53,44,10,11,219,341,77,18,368,112,45,115,147,16,17,111,425,344', -'342,345,343,78,316,317,261,260,426,52,261,260,293,42,73,429,75,76,114', -'430,433,138,137,61,62,55,56,69,72,63,437,70,64,439,65,272,338,217,337', -'218,268,335,220,339,267,332,448,334,336,449,451,20,19,147,453,221,216', -'340,51,322,54,333,60,12,264,57,43,46,-225,53,44,10,11,219,341,77,18', -'263,262,45,457,459,16,17,322,90,344,342,345,343,78,462,463,125,125,125', -'52,122,122,122,42,73,90,75,76,74,250,465,58,48,61,62,55,56,69,72,63', -'82,70,64,187,65,184,469,439,471,182,473,474,124,124,124,475,121,121', -'121,476,166,20,19,155,123,123,123,125,51,330,54,122,60,12,481,57,43', -'46,482,53,44,10,11,483,484,77,18,148,147,45,90,82,16,17,125,69,72,495', -'122,70,78,118,496,124,125,497,52,121,122,79,42,73,499,75,76,123,500', -'501,58,48,61,62,55,56,69,72,63,502,70,64,124,65,349,359,121,163,353', -'349,160,347,124,125,123,363,121,122,125,365,20,19,122,77,123,368,369', -'51,281,54,78,60,127,346,57,43,46,330,53,44,164,73,382,383,77,18,356', -'264,45,124,387,16,17,121,124,281,419,322,121,78,272,123,393,125,90,52', -'123,122,77,42,73,395,75,76,90,90,282,58,48,61,62,55,56,69,72,63,,70', -'64,,65,,,,,,,,,124,,,,121,,,,20,19,,,123,,,51,,54,,60,12,110,57,43,46', -',53,44,10,11,,,77,18,,112,45,115,,16,17,111,69,72,,,70,78,,,,,,52,,', -',42,73,,75,76,114,,,138,137,61,62,55,56,69,72,63,,70,64,110,65,,,,163', -',,160,,,,,,112,,115,,20,19,111,,,,,51,,54,78,60,127,110,57,43,46,,53', -'44,164,73,,114,77,18,,112,45,115,,16,17,111,69,72,,,70,78,,,,,,52,,', -',42,73,,75,76,114,,,58,48,61,62,55,56,69,72,63,,70,64,,65,,,,163,,,160', -',,,,,,,,,20,19,,,,,,51,,54,78,60,127,,57,43,46,,53,44,164,73,,,77,18', -',,45,,,16,17,,69,72,,,70,78,,,,,,52,,,,42,73,,75,76,,,,58,48,61,62,55', -'56,69,72,63,,70,64,,65,,,,163,,,160,,,,,,,,,,20,19,,,354,,,51,,54,78', -'60,127,281,57,43,46,,53,44,164,73,,,77,18,77,,45,,,16,17,,282,,,,,78', -',,,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69,72,63,110,70,64,,65', -',,,,,,,,,112,,115,,,,111,20,19,,,,,,51,,54,,60,127,,57,43,46,,53,44', -'114,,,,77,18,,,45,,,16,17,,,92,93,,,78,,,91,,,52,,,,42,73,,75,76,,,', -'58,48,61,62,55,56,69,72,63,110,70,64,,65,,,,,,,,,,112,,115,,,,111,20', -'19,,,,,,51,,54,,60,127,,57,43,46,,53,44,114,,,,77,18,,,45,,,16,17,,', -'92,93,,,78,,,91,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69,72,63,', -'70,64,,65,,338,217,337,218,,335,220,339,,332,,334,336,,,20,19,,,221', -'216,340,51,,54,333,60,127,,57,43,46,,53,44,,,219,341,77,18,,,45,,,16', -'17,,,344,342,345,343,78,,,,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56', -'69,72,63,,70,64,,65,,338,217,337,218,,335,220,339,,332,,334,336,,,20', -'19,,,221,216,340,51,,54,333,60,12,,57,43,46,,53,44,10,11,219,341,77', -'18,,,45,,,16,17,,,344,342,345,343,78,,,,,,52,,,,42,73,,75,76,,,,58,48', +'69,72,281,-267,70,64,79,65,83,84,85,64,110,65,-276,372,302,163,392,303', +'65,-145,324,282,20,19,112,-281,115,-279,373,51,111,54,82,60,12,248,57', +'43,46,269,53,44,10,11,-267,90,77,18,164,147,45,114,77,16,17,-276,86', +'88,87,89,125,78,-145,325,122,141,148,52,-281,270,-279,42,73,91,75,76', +'74,249,155,58,48,61,62,55,56,69,72,63,144,70,64,281,65,63,440,125,124', +'110,166,122,121,281,118,441,77,436,182,435,123,20,19,112,282,115,77', +'125,51,111,54,122,60,12,282,57,43,46,80,53,44,10,11,124,184,77,18,121', +'274,45,114,424,16,17,141,123,423,485,187,436,78,435,423,124,141,82,52', +'121,261,260,42,73,91,75,76,123,250,144,58,48,61,62,55,56,69,72,63,144', +'70,64,281,65,90,338,217,337,218,90,335,220,339,262,332,77,334,336,69', +'72,20,19,70,282,221,216,340,51,263,54,333,60,12,110,57,43,46,314,53', +'44,10,11,219,341,77,18,-225,112,45,115,264,16,17,111,147,344,342,345', +'343,78,261,260,125,125,125,52,122,122,122,42,73,267,75,76,114,261,260', +'58,48,61,62,55,56,69,72,63,268,70,64,272,65,261,260,305,304,316,317', +'293,124,124,124,294,121,121,121,300,-226,20,19,300,123,123,123,125,51', +'82,54,122,60,12,90,57,43,46,90,53,44,10,11,90,90,77,18,322,330,45,346', +'347,16,17,125,69,72,125,122,70,78,122,349,124,125,353,52,121,122,359', +'42,73,363,75,76,123,365,77,58,48,61,62,55,56,69,72,63,368,70,64,124', +'65,369,124,121,163,281,121,160,382,124,383,123,264,121,123,387,419,20', +'19,272,393,123,395,368,51,-225,54,78,60,127,110,57,43,46,400,53,44,164', +'73,402,409,77,18,410,112,45,115,322,16,17,111,69,72,323,413,70,78,416', +'368,368,147,425,52,426,429,430,42,73,433,75,76,114,437,439,58,48,61', +'62,55,56,69,72,63,448,70,64,110,65,449,451,453,163,322,457,160,459,322', +'462,463,465,112,469,115,439,20,19,111,471,473,474,475,51,476,54,78,60', +'127,110,57,43,46,330,53,44,164,73,481,114,77,18,482,112,45,115,483,16', +'17,111,69,72,484,495,70,78,496,497,499,500,501,52,502,349,,42,73,,75', +'76,114,,,58,48,61,62,55,56,69,72,63,,70,64,,65,,,,163,,,160,,,,,,,,', +',20,19,,,354,,,51,356,54,78,60,127,281,57,43,46,281,53,44,164,73,,,77', +'18,77,,45,,77,16,17,,282,,,,282,78,,,,,,52,,,,42,73,,75,76,,,,58,48', +'61,62,55,56,69,72,63,,70,64,,65,,338,217,337,218,,335,220,339,,332,', +'334,336,,,20,19,,,221,216,340,51,,54,333,60,12,,57,43,46,,53,44,10,11', +'219,341,77,18,,,45,,,16,17,,,344,342,345,343,78,,,,,,52,,,,42,73,,75', +'76,,,,58,48,61,62,55,56,69,72,63,,70,64,,65,,338,217,337,218,,335,220', +'339,,332,,334,336,,,20,19,,,221,216,340,51,,54,333,60,12,,57,43,46,', +'53,44,10,11,219,341,77,18,,,45,,,16,17,,,344,342,345,343,78,,,,,,52', +',,,42,73,,75,76,,,,58,48,61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,', +',,,,,20,19,136,,,,,51,,54,,60,12,,57,43,46,,53,44,10,11,,,77,18,,,45', +',,16,17,,69,72,,,70,78,,,,,,52,,,,42,73,,75,76,,,,138,137,61,62,55,56', +'69,72,63,,70,64,,65,,,,163,,,160,,,,,,,,,,20,19,,,,,,51,,54,78,60,127', +',57,43,46,,53,44,164,73,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42', +'73,,75,76,,,,58,48,61,62,55,56,69,72,63,110,70,64,,65,,,,,,,,,,112,', +'115,,,,111,20,19,,,,,,51,,54,,60,127,,57,43,46,,53,44,114,,,,77,18,', +',45,,,16,17,,,92,93,,,78,,,91,,,52,,,,42,73,,75,76,,,,58,48,61,62,55', +'56,69,72,63,110,70,64,,65,,,,,,,,,,112,,115,,,,111,20,19,,,,,,51,,54', +',60,127,,57,43,46,,53,44,114,,,,77,18,,,45,,,16,17,,,92,93,,,78,,,91', +',,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69,72,63,,70,64,168,65,,338', +'217,337,218,,335,220,339,,332,,334,336,,,20,19,,,221,216,340,51,,54', +'333,60,12,,57,43,46,,53,44,10,11,219,341,77,18,,,45,,,16,17,,,344,342', +'345,343,78,,,,,,52,,,,42,73,,75,76,,,,138,137,61,62,55,56,69,72,63,', +'70,64,173,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,12,,57,43,46,,53', +'44,10,11,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,138', +'137,61,62,55,56,69,72,63,,70,64,,65,175,,,,,,,,,,,,,,,,20,19,,,,,,51', +',54,,60,12,,57,43,46,,53,44,10,11,,,77,18,,,45,,,16,17,,,,,,,78,,,,', +',52,,,,42,73,,75,76,,,,138,137,61,62,55,56,69,72,63,,70,64,,65,,,,,', +',,,,,,,,,,,20,19,,,,,,51,,54,,60,12,,57,43,46,,53,44,10,11,,,77,18,', +',45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69', +'72,63,110,70,64,,186,,,,,,,,,,112,,115,,,,111,20,19,,,,,,51,,54,,60', +'127,,57,43,46,,53,44,114,,,,77,18,,,45,,,16,17,,,92,93,,,78,,,91,,,52', +',,,42,73,,75,76,,,,58,48,61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,', +',,,,,20,19,,,,,,51,,54,,60,12,,57,43,46,,53,44,10,11,,,77,18,,,45,,', +'16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69,72,63', +',70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,12,,57,43,46,,53,44', +'10,11,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58,48', '61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60', '12,,57,43,46,,53,44,10,11,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42', '73,,75,76,,,,58,48,61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20', -'19,136,,,,,51,,54,,60,12,,57,43,46,,53,44,10,11,,,77,18,,,45,,,16,17', -',,,,,,78,,,,,,52,,,,42,73,,75,76,,,,138,137,61,62,55,56,69,72,63,,70', -'64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,12,,57,43,46,80,53,44,10', -'11,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58,48,61', -'62,55,56,69,72,63,,70,64,,65,489,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60', -'12,,57,43,46,,53,44,10,11,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42', -'73,,75,76,,,,58,48,61,62,55,56,69,72,63,,70,64,,65,487,,,,,,,,,,,,,', -',,20,19,,,,,,51,,54,,60,12,,57,43,46,,53,44,10,11,,,77,18,,,45,,,16', -'17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69,72,63,,70', -'64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,127,,57,43,46,,53,44,,', -',,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58,48,61,62', -'55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,127', -',57,43,46,,53,44,,,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75', -'76,,,,58,48,61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,', -',,,51,,54,,60,127,,57,43,46,,53,44,,,,,77,18,,,45,,,16,17,,,,,,,78,', -',,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69,72,63,,70,64,,65,375', -',,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,12,,57,43,46,,53,44,10,11,,,77', -'18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56', -'69,72,63,,70,64,,65,377,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,12,,57', -'43,46,,53,44,10,11,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75', -'76,,,,58,48,61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,', -',,,51,,54,,60,12,,57,43,46,,53,44,10,11,,,77,18,,,45,,,16,17,,,,,,,78', -',,,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69,72,63,,70,64,,65,,,', -',,,,,,,,,,,,,20,19,,,,,,51,,54,,60,127,,57,43,46,,53,44,,,,,77,18,,', -'45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69', -'72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,127,,57,43,46', -',53,44,,,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58', -'48,61,62,55,56,69,72,63,,70,64,,65,478,,,,,,,,,,,,,,,,20,19,,,,,,51', -',54,,60,12,,57,43,46,,53,44,10,11,,,77,18,,,45,,,16,17,,,,,,,78,,,,', -',52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69,72,63,,70,64,168,65,,,,', -',,,,,,,,,,,,20,19,,,,,,51,,54,,60,12,,57,43,46,,53,44,10,11,,,77,18', -',,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,138,137,61,62,55,56', -'69,72,63,,70,64,173,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,12,,57', -'43,46,,53,44,10,11,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75', -'76,,,,138,137,61,62,55,56,69,72,63,,70,64,,65,175,,,,,,,,,,,,,,,,20', '19,,,,,,51,,54,,60,12,,57,43,46,,53,44,10,11,,,77,18,,,45,,,16,17,,', -',,,,78,,,,,,52,,,,42,73,,75,76,,,,138,137,61,62,55,56,69,72,63,,70,64', +',,,,78,,,,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69,72,63,,70,64', ',65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,12,,57,43,46,,53,44,10,11', ',,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58,48,61,62', -'55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,127', -',57,43,46,,53,44,,,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75', -'76,,,,58,48,61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,', -',,,51,,54,,60,127,,57,43,46,,53,44,,,,,77,18,,,45,,,16,17,,,,,,,78,', -',,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69,72,63,,70,64,,186,,,', -',,,,,,,,,,,,,20,19,,,,,,51,,54,,60,127,,57,43,46,,53,44,,,,,77,18,,', -'45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69', -'72,63,,70,64,,65,494,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,12,,57,43', -'46,,53,44,10,11,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76', -',,,58,48,61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,', -'51,,54,,60,12,,57,43,46,,53,44,10,11,,,77,18,,,45,,,16,17,,,,,,,78,', -',,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69,72,63,,70,64,,65,,,,', -',,,,,,,,,,,,20,19,,,,,,51,,54,,60,12,,57,43,46,,53,44,10,11,,,77,18', -',,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,138,137,61,62,55,56', +'55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,12,', +'57,43,46,,53,44,10,11,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73', +',75,76,,,,58,48,61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19', +',,,,,51,,54,,60,12,,57,43,46,,53,44,10,11,,,77,18,,,45,,,16,17,,,,,', +',78,,,,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69,72,63,,70,64,,65', +',,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,12,,57,43,46,,53,44,10,11,,,77', +'18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56', '69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,12,,57,43', '46,,53,44,10,11,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76', ',,,58,48,61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,', -'51,,54,,60,12,,57,43,46,,53,44,10,11,,,77,18,,,45,,,16,17,,,,,,,78,', -',,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69,72,63,,70,64,,65,,,,', -',,,,,,,,,,,,20,19,,,,,,51,,54,,60,12,,57,43,46,,53,44,10,11,,,77,18', -',,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69', -'72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,12,,57,43,46', -',53,44,10,11,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,', -',,58,48,61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51', -',54,,60,12,,57,43,46,,53,44,10,11,,,77,18,,,45,,,16,17,,,,,,,78,,,,', +'204,217,210,218,60,211,220,212,43,202,,206,200,,,,,77,18,221,216,201', +',,16,199,,,,,,,78,,,,,219,205,,,,42,73,,75,76,,,,213,203,214,215,55', +'56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,127,,57', +'43,46,,53,44,,,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76', +',,,58,48,61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,', +'51,,54,,60,127,,57,43,46,,53,44,,,,,77,18,,,45,,,16,17,,,,,,,78,,,,', ',52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69,72,63,,70,64,,65,,,,,,,', -',,,,,,,,,20,19,,,,,,51,,54,,60,12,,57,43,46,,53,44,10,11,,,77,18,,,45', -',,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69,72', -'63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,12,,57,43,46,,53', -'44,10,11,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58', -'48,61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54', -',60,12,,57,43,46,,53,44,10,11,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52', -',,,42,73,,75,76,,,,58,48,61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,', -',,,,,20,19,,,,,,204,217,210,218,60,211,220,212,43,202,,206,200,,,,,77', -'18,221,216,201,,,16,199,,,,,,,78,,,,,219,205,,,,42,73,,75,76,,,,213', -'203,214,215,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51', -',54,,60,127,,57,43,46,,53,44,,,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52', -',,,42,73,,75,76,,,,58,48,61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,', -',,,,,20,19,,,,,,51,,54,,60,127,,57,43,46,,53,44,,,,,77,18,,,45,,,16', -'17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69,72,63,,70', -'64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,127,,57,43,46,,53,44,,', -',,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58,48,61,62', -'55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,127', +',,,,,,,,,20,19,,,,,,51,,54,,60,127,,57,43,46,,53,44,,,,,77,18,,,45,', +',16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69,72,63', +',70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,127,,57,43,46,,53,44', +',,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58,48,61', +'62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,127', ',57,43,46,,53,44,,,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75', '76,,,,58,48,61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,', ',,,51,,54,,60,127,,57,43,46,,53,44,,,,,77,18,,,45,,,16,17,,,,,,,78,', @@ -196,124 +154,165 @@ class Parser < Racc::Parser ',,,,,20,19,,,,,,51,,54,,60,127,,57,43,46,,53,44,,,,,77,18,,,45,,,16', '17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69,72,63,,70', '64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,127,,57,43,46,,53,44,,', -',,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58,48,61,62', -'55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,127', -',57,43,46,,53,44,,,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,243,42,73', -',75,76,,,,58,48,61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19', -',,,,,51,,54,,60,12,,57,43,46,,53,44,10,11,,,77,18,,,45,,,16,17,,,,,', -',78,,,,,,52,,,,42,73,,75,76,,,,138,137,61,62,55,56,69,72,63,,70,64,', -'65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,127,,57,43,46,,53,44,,,,,77', -'18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56', -'69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,12,,57,43', -'46,,53,44,10,11,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76', -',,,58,48,61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,', -'51,,54,,60,127,,57,43,46,,53,44,,,,,77,18,,,45,,,16,17,,,,,,,78,,,,', -',52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69,72,63,,70,64,,65,,,,,,,', -',,,,,,,,,20,19,,,,,,51,,54,,60,127,,57,43,46,,53,44,,,,,77,18,,,45,', -',16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69,72,63', -',70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,12,,57,43,46,,53,44', -'10,11,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,138,137', -'61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60', -'12,,57,43,46,,53,44,10,11,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42', -'73,,75,76,,,,58,48,61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20', +',,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,243,42,73,,75,76,,,,58,48,61', +'62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,12', +',57,43,46,,53,44,10,11,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73', +',75,76,,,,138,137,61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20', '19,,,,,,51,,54,,60,127,,57,43,46,,53,44,,,,,77,18,,,45,,,16,17,,,,,', ',78,,,,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69,72,63,,70,64,,65', ',,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,127,,57,43,46,,53,44,,,,,77,18', ',,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69', '72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,127,,57,43,46', ',53,44,,,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58', -'48,61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54', -',60,127,,57,43,46,,53,44,,,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,', -'42,73,,75,76,,,,58,48,61,62,55,56,69,72,63,,70,64,,65,,,323,,,,,,,,', +'48,61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,285,,,,,51', +',54,,60,12,,57,43,46,,53,44,10,11,,,77,18,,,45,,,16,17,,,,,,,78,,,,', +',52,,,,42,73,,75,76,,,,138,137,61,62,55,56,69,72,63,,70,64,,65,,,,,', +',,,,,,,,,,,20,19,,,,,,51,,54,,60,12,,57,43,46,,53,44,10,11,,,77,18,', +',45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,138,137,61,62,55,56', +'69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,12,,57,43', +'46,,53,44,10,11,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76', +',,,58,48,61,62,55,56,69,72,63,,70,64,,65,175,,,,,,,,,,,,,,,,20,19,,', +',,,51,,54,,60,12,,57,43,46,,53,44,10,11,,,77,18,,,45,,,16,17,,,,,,,78', +',,,,,52,,,,42,73,,75,76,,,,138,137,61,62,55,56,69,72,63,,70,64,,65,', +',323,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,127,,57,43,46,,53,44,,,,,77', +'18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56', +'69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,127,,57,43', +'46,,53,44,,,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,', +',58,48,61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51', +',54,,60,127,,57,43,46,,53,44,,,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52', +',,,42,73,,75,76,,,,58,48,61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,', ',,,,,20,19,,,,,,51,,54,,60,127,,57,43,46,,53,44,,,,,77,18,,,45,,,16', '17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69,72,63,,70', -'64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,12,,57,43,46,,53,44,10', -'11,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,138,137', -'61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60', -'12,,57,43,46,,53,44,10,11,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42', -'73,,75,76,,,,138,137,61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,', -',20,19,,,,,,51,,54,,60,12,,57,43,46,,53,44,10,11,,,77,18,,,45,,,16,17', -',,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69,72,63,,70,64', +'64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,127,,57,43,46,,53,44,,', +',,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58,48,61,62', +'55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,12,', +'57,43,46,,53,44,10,11,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73', +',75,76,,,,138,137,61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20', +'19,,,,,,51,,54,,60,12,,57,43,46,,53,44,10,11,,,77,18,,,45,,,16,17,,', +',,,,78,,,,,,52,,,,42,73,,75,76,,,,138,137,61,62,55,56,69,72,63,,70,64', ',65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,12,,57,43,46,,53,44,10,11', ',,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,138,137,61', '62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,12', ',57,43,46,,53,44,10,11,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73', -',75,76,,,,138,137,61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20', -'19,,,,,,51,,54,,60,12,,57,43,46,,53,44,10,11,,,77,18,,,45,,,16,17,,', -',,,,78,,,,,,52,,,,42,73,,75,76,,,,138,137,61,62,55,56,69,72,63,,70,64', -',65,396,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,12,,57,43,46,,53,44,10', -'11,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,138,137', -'61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60', -'12,,57,43,46,,53,44,10,11,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42', -'73,,75,76,,,,58,48,61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20', +',75,76,,,,58,48,61,62,55,56,69,72,63,,70,64,,65,375,,,,,,,,,,,,,,,,20', '19,,,,,,51,,54,,60,12,,57,43,46,,53,44,10,11,,,77,18,,,45,,,16,17,,', ',,,,78,,,,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69,72,63,,70,64', -',65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,12,,57,43,46,,53,44,10,11', -',,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58,48,61,62', -'55,56,69,72,63,,70,64,,65,442,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,127', +',65,377,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,12,,57,43,46,,53,44,10', +'11,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58,48,61', +'62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,127', ',57,43,46,,53,44,,,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75', '76,,,,58,48,61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,', ',,,51,,54,,60,12,,57,43,46,,53,44,10,11,,,77,18,,,45,,,16,17,,,,,,,78', -',,,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69,72,63,,70,64,,65,,,', -',,,,,,,,,,,,,20,19,,,,,,51,,54,,60,127,,57,43,46,,53,44,,,,,77,18,,', +',,,,,52,,,,42,73,,75,76,,,,138,137,61,62,55,56,69,72,63,,70,64,,65,396', +',,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,12,,57,43,46,,53,44,10,11,,,77', +'18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,138,137,61,62,55', +'56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,12,,57', +'43,46,,53,44,10,11,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75', +'76,,,,58,48,61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,', +',,,51,,54,,60,127,,57,43,46,,53,44,,,,,77,18,,,45,,,16,17,,,,,,,78,', +',,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69,72,63,,70,64,,65,,,,', +',,,,,,,,,,,,20,19,,,,,,51,,54,,60,127,,57,43,46,,53,44,,,,,77,18,,,45', +',,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69,72', +'63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,127,,57,43,46,,53', +'44,,,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58,48', +'61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60', +'127,,57,43,46,,53,44,,,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73', +',75,76,,,,58,48,61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19', +',,,,,51,,54,,60,12,,57,43,46,,53,44,10,11,,,77,18,,,45,,,16,17,,,,,', +',78,,,,,,52,,,,42,73,,75,76,,,,138,137,61,62,55,56,69,72,63,,70,64,', +'65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,127,,57,43,46,,53,44,,,,,77', +'18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56', +'69,72,63,,70,64,,65,428,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,12,,57', +'43,46,,53,44,10,11,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75', +'76,,,,58,48,61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,', +',,,51,,54,,60,127,,57,43,46,,53,44,,,,,77,18,,,45,,,16,17,,,,,,,78,', +',,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69,72,63,,70,64,,65,,,,', +',,,,,,,,,,,,20,19,,,,,,51,,54,,60,12,,57,43,46,,53,44,10,11,,,77,18', +',,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,138,137,61,62,55,56', +'69,72,63,,70,64,,65,442,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,127,,57', +'43,46,,53,44,,,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76', +',,,58,48,61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,', +'51,,54,,60,12,,57,43,46,,53,44,10,11,,,77,18,,,45,,,16,17,,,,,,,78,', +',,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69,72,63,,70,64,,65,,,,', +',,,,,,,,,,,,20,19,,,,,,51,,54,,60,12,,57,43,46,,53,44,10,11,,,77,18', +',,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69', +'72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,12,,57,43,46', +',53,44,10,11,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,', +',,138,137,61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,', +',51,,54,,60,127,,57,43,46,,53,44,,,,,77,18,,,45,,,16,17,,,,,,,78,,,', +',,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69,72,63,,70,64,,65,,,,,,', +',,,,,,,,,,20,19,,,,,,51,,54,,60,12,,57,43,46,,53,44,10,11,,,77,18,,', '45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69', -'72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,285,,,,,51,,54,,60,12,,57,43', -'46,,53,44,10,11,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76', -',,,138,137,61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,', -',,51,,54,,60,12,,57,43,46,,53,44,10,11,,,77,18,,,45,,,16,17,,,,,,,78', +'72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,12,,57,43,46', +',53,44,10,11,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,', +',,138,137,61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,', +',51,,54,,60,12,,57,43,46,,53,44,10,11,,,77,18,,,45,,,16,17,,,,,,,78', ',,,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69,72,63,,70,64,,65,,,', ',,,,,,,,,,,,,20,19,,,,,,51,,54,,60,12,,57,43,46,,53,44,10,11,,,77,18', +',,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,138,137,61,62,55,56', +'69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,127,,57,43', +'46,,53,44,,,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,', +',58,48,61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51', +',54,,60,127,,57,43,46,,53,44,,,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52', +',,,42,73,,75,76,,,,58,48,61,62,55,56,69,72,63,,70,64,,65,478,,,,,,,', +',,,,,,,,20,19,,,,,,51,,54,,60,12,,57,43,46,,53,44,10,11,,,77,18,,,45', +',,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69,72', +'63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,12,,57,43,46,,53', +'44,10,11,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58', +'48,61,62,55,56,69,72,63,,70,64,,65,487,,,,,,,,,,,,,,,,20,19,,,,,,51', +',54,,60,12,,57,43,46,,53,44,10,11,,,77,18,,,45,,,16,17,,,,,,,78,,,,', +',52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69,72,63,,70,64,,65,489,,,', +',,,,,,,,,,,,20,19,,,,,,51,,54,,60,12,,57,43,46,,53,44,10,11,,,77,18', ',,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69', -'72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,127,,57,43,46', -',53,44,,,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,,,,58', -'48,61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54', -',60,12,,57,43,46,,53,44,10,11,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52', -',,,42,73,,75,76,,,,138,137,61,62,55,56,69,72,63,,70,64,,65,,,,,,,,,', -',,,,,,,20,19,,,,,,51,,54,,60,12,,57,43,46,,53,44,10,11,,,77,18,,,45', -',,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,110,,,138,137,61,62,55,56,', -',63,106,101,112,,115,,109,,111,,102,104,103,105,,,,,,,,,,,,,,,,114,', -',,108,107,,110,94,95,97,96,99,100,,92,93,,,106,101,112,91,115,,109,', -'111,,102,104,103,105,,,,,,,,,,,,,98,,,114,,,,108,107,,110,94,95,97,96', -'99,100,,92,93,,,106,101,112,91,115,,109,,111,,102,104,103,105,,,,,,', -',,,,,,98,,,114,,,,108,107,,110,94,95,97,96,99,100,,92,93,,,106,101,112', -'91,115,,109,,111,,102,104,103,105,,,,,,,,,,,,,98,,,114,,,,108,107,,110', -'94,95,97,96,99,100,,92,93,,,106,101,112,91,115,,109,,111,,102,104,103', -'105,,,,,,,,,,,,,98,,,114,,,,108,107,,110,94,95,97,96,99,100,,92,93,', -',106,101,112,91,115,,109,,111,,102,104,103,105,,,,,,,,,,,,,98,,,114', -',,,108,107,,110,94,95,97,96,99,100,,92,93,,,106,101,112,91,115,,109', -',111,,102,104,103,105,,,,,,,,,,,,,98,,,114,,,,108,107,,110,94,95,97', +'72,63,,70,64,,65,,,,,,,,,,,,,,,,,20,19,,,,,,51,,54,,60,12,,57,43,46', +',53,44,10,11,,,77,18,,,45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,', +',,58,48,61,62,55,56,69,72,63,,70,64,,65,494,,,,,,,,,,,,,,,,20,19,,,', +',,51,,54,,60,12,,57,43,46,,53,44,10,11,,,77,18,,,45,,,16,17,,,,,,,78', +',,,,,52,,,,42,73,,75,76,,,,58,48,61,62,55,56,69,72,63,,70,64,,65,,,', +',,,,,,,,,,,,,20,19,,,,,,51,,54,,60,127,,57,43,46,,53,44,,,,,77,18,,', +'45,,,16,17,,,,,,,78,,,,,,52,,,,42,73,,75,76,110,,,58,48,61,62,55,56', +',,63,106,101,112,,115,,109,,111,,102,104,103,105,,,,,,,,,,,,,,,,114', +',,,108,107,,,94,95,97,96,99,100,,92,93,110,,286,,,91,,,,,,,106,101,112', +',115,,109,,111,,102,104,103,105,,,98,,,,,,,,,,,,,114,,,,108,107,,,94', +'95,97,96,99,100,,92,93,110,,287,,,91,,,,,,,106,101,112,,115,,109,,111', +',102,104,103,105,,,98,,,,,,,,,,,,,114,,,,108,107,,,94,95,97,96,99,100', +',92,93,110,,288,,,91,,,,,,,106,101,112,,115,,109,,111,,102,104,103,105', +',,98,,,,,,,,,,,,,114,,,,108,107,,110,94,95,97,96,99,100,,92,93,,,106', +'101,112,91,115,,109,,111,,102,104,103,105,,,,,,,,,,,,,98,,,114,,,,108', +'107,,,94,95,97,96,99,100,,92,93,,,,,,91,,110,,,,,,,,,316,317,,106,101', +'112,320,115,110,109,,111,98,102,104,103,105,,,,,,112,,115,,,,111,,,', +'114,,,,108,107,,,94,95,97,96,99,100,,92,93,114,,,110,,91,,,,,97,96,', +',,92,93,112,,115,110,,91,111,,,,,98,,,,,,112,,115,,,,111,,,,114,98,', +',,,,,,,97,96,,,,92,93,114,,,110,,91,,,94,95,97,96,,,,92,93,112,,115', +'110,,91,111,,,,,98,,,,,,112,,115,,,,111,,,,114,98,,,,,,,94,95,97,96', +',,,92,93,114,,,110,,91,,,94,95,97,96,99,100,,92,93,112,,115,110,,91', +'111,,,,,98,,,,,101,112,,115,,,,111,,102,,114,98,,,,,,,94,95,97,96,99', +'100,,92,93,114,,,,,91,,110,94,95,97,96,99,100,,92,93,,,,101,112,91,115', +'110,,,111,98,102,,,,,,,,101,112,,115,,,,111,98,102,,114,,,,,,,,94,95', +'97,96,99,100,,92,93,114,,,,,91,,110,94,95,97,96,99,100,,92,93,,,,101', +'112,91,115,,,,111,98,102,,,,,,,,,,,,,,,,98,,,114,,,,,110,,,94,95,97', +'96,99,100,,92,93,106,101,112,,115,91,109,,111,,102,104,103,105,,,,,', +',,,,,,,,,98,114,,,,,110,,,94,95,97,96,99,100,,92,93,106,101,112,,115', +'91,109,,111,,102,104,103,105,,,,,,,,,,,,,,,98,114,,,,,107,,,94,95,97', +'96,99,100,110,92,93,,,326,,,91,,,,106,101,112,,115,,109,,111,,102,104', +'103,105,,,,,,98,,,,,,,,,,114,,,,108,107,,,94,95,97,96,99,100,,92,93', +'110,-65,,,,91,-65,,,,,,106,101,112,,115,,109,,111,,102,104,103,105,', +',98,,,,,,,,,,,,,114,,,,108,107,,110,94,95,97,96,99,100,,92,93,,,106', +'101,112,91,115,,109,,111,,102,104,103,105,,,,,,,,,,,,,98,,,114,,,,108', +'107,,,94,95,97,96,99,100,110,92,93,,,,,,91,,,,106,101,112,350,115,,109', +',111,,102,104,103,105,,,,,,98,,,,,,,,,,114,,,,108,107,,110,94,95,97', '96,99,100,,92,93,,,106,101,112,91,115,,109,,111,,102,104,103,105,,,', -',,,,,,,,,98,,,114,,,,108,107,,,94,95,97,96,99,100,,92,93,110,,286,,', -'91,,,,,,,106,101,112,,115,,109,,111,,102,104,103,105,,,98,,,,,,,,,,', -',,114,,,,108,107,,,94,95,97,96,99,100,,92,93,110,,287,,,91,,,,,,,106', -'101,112,,115,,109,,111,,102,104,103,105,,,98,,,,,,,,,,,,,114,,,,108', -'107,,,94,95,97,96,99,100,,92,93,110,,288,,,91,,,,,,,106,101,112,,115', -',109,,111,,102,104,103,105,,,98,,,,,,,,,,,,,114,,,,108,107,,110,94,95', +',,,,,,,,,98,,,114,,,,108,107,,110,94,95,97,96,99,100,,92,93,,,106,101', +'112,91,115,,109,,111,,102,104,103,105,,,,,,,,,,,,,98,,,114,,,,108,107', +',110,94,95,97,96,99,100,,92,93,,,106,101,112,91,115,,109,,111,,102,104', +'103,105,,,,,,,,,,,,,98,,,114,,,,108,107,,110,94,95,97,96,99,100,,92', +'93,,,106,101,112,91,115,,109,,111,,102,104,103,105,,,,,,,,,,,,,98,,', +'114,,,,108,107,,110,94,95,97,96,99,100,,92,93,,,106,101,112,91,115,', +'109,,111,,102,104,103,105,,,,,,,,,,,,,98,,,114,,,,108,107,,110,94,95', '97,96,99,100,,92,93,,,106,101,112,91,115,,109,,111,,102,104,103,105', -',,,,,,,,,,,,98,,,114,,,,108,107,,,94,95,97,96,99,100,,92,93,,,,,,91', -',110,,,,,,,,,316,317,,106,101,112,320,115,110,109,,111,98,102,104,103', -'105,,,,,,112,,115,,,,111,,,,114,,,,108,107,,,94,95,97,96,99,100,,92', -'93,114,,,110,,91,,,,,97,96,,,,92,93,112,,115,110,,91,111,,,,,98,,,,', -',112,,115,,,,111,,,,114,98,,,,,,,,,97,96,,,,92,93,114,,,110,,91,,,94', -'95,97,96,,,,92,93,112,,115,110,,91,111,,,,,98,,,,,,112,,115,,,,111,', -',,114,98,,,,,,,94,95,97,96,,,,92,93,114,,,110,,91,,,94,95,97,96,99,100', -',92,93,112,,115,110,,91,111,,,,,98,,,,,101,112,,115,,,,111,,102,,114', -'98,,,,,,,94,95,97,96,99,100,,92,93,114,,,,,91,,110,94,95,97,96,99,100', -',92,93,,,,101,112,91,115,110,,,111,98,102,,,,,,,,101,112,,115,,,,111', -'98,102,,114,,,,,,,,94,95,97,96,99,100,,92,93,114,,,,,91,,110,94,95,97', -'96,99,100,,92,93,,,,101,112,91,115,,,,111,98,102,,,,,,,,,,,,,,,,98,', -',114,,,,,110,,,94,95,97,96,99,100,,92,93,106,101,112,,115,91,109,,111', -',102,104,103,105,,,,,,,,,,,,,,,98,114,,,,,110,,,94,95,97,96,99,100,', -'92,93,106,101,112,,115,91,109,,111,,102,104,103,105,,,,,,,,,,,,,,,98', -'114,,,,,107,,,94,95,97,96,99,100,110,92,93,,,326,,,91,,,,106,101,112', -',115,,109,,111,,102,104,103,105,,,,,,98,,,,,,,,,,114,,,,108,107,,,94', -'95,97,96,99,100,,92,93,110,-65,,,,91,-65,,,,,,106,101,112,,115,,109', -',111,,102,104,103,105,,,98,,,,,,,,,,,,,114,,,,108,107,,110,94,95,97', -'96,99,100,,92,93,,,106,101,112,91,115,,109,,111,,102,104,103,105,,,', -',,,,,,,,,98,,,114,,,,108,107,,,94,95,97,96,99,100,110,92,93,,,,,,91', -',,,106,101,112,350,115,,109,,111,,102,104,103,105,,,,,,98,,,,,,,,,,114', -',,,108,107,,,94,95,97,96,99,100,,92,93,,,,,,91,,,,,,,,,,,,,,,,,,,,,', -',98' ] +',,,,,,,,,,,,98,,,114,,,,108,107,,110,94,95,97,96,99,100,,92,93,,,106', +'101,112,91,115,,109,,111,,102,104,103,105,,,,,,,,,,,,,98,,,114,,,,108', +'107,,,94,95,97,96,99,100,,92,93,,,,,,91,,,,,,,,,,,,,,,,,,,,,,,98' ] racc_action_table = arr = ::Array.new(9761, nil) idx = 0 clist.each do |str| @@ -324,97 +323,53 @@ class Parser < Racc::Parser end clist = [ -'369,369,215,229,369,369,48,369,214,283,313,209,223,294,166,200,166,229', -'201,229,112,202,318,229,369,369,223,203,223,48,283,369,223,369,319,369', -'369,144,369,369,369,193,369,369,229,215,294,137,369,369,203,214,369', -'223,209,369,369,166,200,229,229,201,112,369,202,284,229,144,58,369,137', -'321,58,369,369,223,369,369,165,165,284,369,369,369,369,369,369,365,365', -'369,188,365,365,184,365,365,368,172,166,224,466,7,7,7,58,466,184,174', -'58,368,174,365,365,224,184,224,58,368,365,224,365,327,365,365,147,365', -'365,365,184,365,365,365,365,179,179,365,365,147,379,365,224,361,365', -'365,329,147,361,379,119,119,365,7,7,7,7,433,365,433,170,147,365,365', -'224,365,365,375,331,375,365,365,365,365,365,365,186,186,365,333,186', -'186,348,186,186,250,250,250,250,167,250,250,250,296,250,296,250,250', -'182,182,186,186,182,351,250,250,250,186,158,186,250,186,186,129,186', -'186,186,355,186,186,186,186,250,250,186,186,357,129,186,129,359,186', -'186,129,362,250,250,250,250,186,400,400,154,154,363,186,153,153,156', -'186,186,366,186,186,129,367,374,186,186,186,186,186,186,0,0,186,376', -'0,0,377,0,146,322,322,322,322,142,322,322,322,139,322,384,322,322,385', -'390,0,0,136,399,322,322,322,0,401,0,322,0,0,135,0,0,0,132,0,0,0,0,322', -'322,0,0,131,130,0,408,412,0,0,415,117,322,322,322,322,0,420,421,210', -'211,213,0,210,211,213,0,0,116,0,0,0,113,427,0,0,0,0,0,0,183,183,0,81', -'183,183,79,183,74,436,437,439,73,441,444,210,211,213,447,210,211,213', -'448,59,183,183,56,210,211,213,54,183,452,183,54,183,183,455,183,183', -'183,456,183,183,183,183,461,464,183,183,50,49,183,8,5,183,183,12,387', -'387,477,12,387,183,12,479,54,55,480,183,54,55,1,183,183,486,183,183', -'54,488,490,183,183,183,183,183,183,349,349,183,493,349,349,12,349,498', -'265,12,387,258,255,387,254,55,353,12,270,55,353,138,271,349,349,138', -'272,55,275,281,349,282,349,387,349,349,252,349,349,349,245,349,349,387', -'387,289,290,349,349,261,291,349,353,292,349,349,353,138,261,353,198', -'138,349,295,353,299,127,196,349,138,127,261,349,349,301,349,349,195', -'194,261,349,349,349,349,349,349,330,330,349,,330,330,,330,,,,,,,,,127', -',,,127,,,,330,330,,,127,,,330,,330,,330,330,222,330,330,330,,330,330', -'330,330,,,330,330,,222,330,222,,330,330,222,293,293,,,293,330,,,,,,330', -',,,330,330,,330,330,222,,,330,330,330,330,330,330,326,326,330,,326,326', -'126,326,,,,293,,,293,,,,,,126,,126,,326,326,126,,,,,326,,326,293,326', -'326,128,326,326,326,,326,326,293,293,,126,326,326,,128,326,128,,326', -'326,128,57,57,,,57,326,,,,,,326,,,,326,326,,326,326,128,,,326,326,326', -'326,326,326,325,325,326,,325,325,,325,,,,57,,,57,,,,,,,,,,325,325,,', -',,,325,,325,57,325,325,,325,325,325,,325,325,57,57,,,325,325,,,325,', -',325,325,,212,212,,,212,325,,,,,,325,,,,325,325,,325,325,,,,325,325', -'325,325,325,325,324,324,325,,324,324,,324,,,,212,,,212,,,,,,,,,,324', -'324,,,260,,,324,,324,212,324,324,260,324,324,324,,324,324,212,212,,', -'324,324,260,,324,,,324,324,,260,,,,,324,,,,,,324,,,,324,324,,324,324', -',,,324,324,324,324,324,324,323,323,324,227,323,323,,323,,,,,,,,,,227', -',227,,,,227,323,323,,,,,,323,,323,,323,323,,323,323,323,,323,323,227', -',,,323,323,,,323,,,323,323,,,227,227,,,323,,,227,,,323,,,,323,323,,323', -'323,,,,323,323,323,323,323,323,17,17,323,228,17,17,,17,,,,,,,,,,228', -',228,,,,228,17,17,,,,,,17,,17,,17,17,,17,17,17,,17,17,228,,,,17,17,', -',17,,,17,17,,,228,228,,,17,,,228,,,17,,,,17,17,,17,17,,,,17,17,17,17', -'17,17,18,18,17,,18,18,,18,,320,320,320,320,,320,320,320,,320,,320,320', -',,18,18,,,320,320,320,18,,18,320,18,18,,18,18,18,,18,18,,,320,320,18', -'18,,,18,,,18,18,,,320,320,320,320,18,,,,,,18,,,,18,18,,18,18,,,,18,18', -'18,18,18,18,19,19,18,,19,19,,19,,350,350,350,350,,350,350,350,,350,', -'350,350,,,19,19,,,350,350,350,19,,19,350,19,19,,19,19,19,,19,19,19,19', -'350,350,19,19,,,19,,,19,19,,,350,350,350,350,19,,,,,,19,,,,19,19,,19', -'19,,,,19,19,19,19,19,19,20,20,19,,20,20,,20,,,,,,,,,,,,,,,,,20,20,,', -',,,20,,20,,20,20,,20,20,20,,20,20,20,20,,,20,20,,,20,,,20,20,,,,,,,20', -',,,,,20,,,,20,20,,20,20,,,,20,20,20,20,20,20,47,47,20,,47,47,,47,,,', -',,,,,,,,,,,,,47,47,47,,,,,47,,47,,47,47,,47,47,47,,47,47,47,47,,,47', -'47,,,47,,,47,47,,,,,,,47,,,,,,47,,,,47,47,,47,47,,,,47,47,47,47,47,47', -'4,4,47,,4,4,,4,,,,,,,,,,,,,,,,,4,4,,,,,,4,,4,,4,4,,4,4,4,4,4,4,4,4,', -',4,4,,,4,,,4,4,,,,,,,4,,,,,,4,,,,4,4,,4,4,,,,4,4,4,4,4,4,471,471,4,', -'471,471,,471,471,,,,,,,,,,,,,,,,471,471,,,,,,471,,471,,471,471,,471', -'471,471,,471,471,471,471,,,471,471,,,471,,,471,471,,,,,,,471,,,,,,471', -',,,471,471,,471,471,,,,471,471,471,471,471,471,469,469,471,,469,469', -',469,469,,,,,,,,,,,,,,,,469,469,,,,,,469,,469,,469,469,,469,469,469', -',469,469,469,469,,,469,469,,,469,,,469,469,,,,,,,469,,,,,,469,,,,469', -'469,,469,469,,,,469,469,469,469,469,469,51,51,469,,51,51,,51,,,,,,,', -',,,,,,,,,51,51,,,,,,51,,51,,51,51,,51,51,51,,51,51,,,,,51,51,,,51,,', -'51,51,,,,,,,51,,,,,,51,,,,51,51,,51,51,,,,51,51,51,51,51,51,52,52,51', -',52,52,,52,,,,,,,,,,,,,,,,,52,52,,,,,,52,,52,,52,52,,52,52,52,,52,52', -',,,,52,52,,,52,,,52,52,,,,,,,52,,,,,,52,,,,52,52,,52,52,,,,52,52,52', -'52,52,52,53,53,52,,53,53,,53,,,,,,,,,,,,,,,,,53,53,,,,,,53,,53,,53,53', -',53,53,53,,53,53,,,,,53,53,,,53,,,53,53,,,,,,,53,,,,,,53,,,,53,53,,53', -'53,,,,53,53,53,53,53,53,286,286,53,,286,286,,286,286,,,,,,,,,,,,,,,', -'286,286,,,,,,286,,286,,286,286,,286,286,286,,286,286,286,286,,,286,286', -',,286,,,286,286,,,,,,,286,,,,,,286,,,,286,286,,286,286,,,,286,286,286', -'286,286,286,287,287,286,,287,287,,287,287,,,,,,,,,,,,,,,,287,287,,,', -',,287,,287,,287,287,,287,287,287,,287,287,287,287,,,287,287,,,287,,', -'287,287,,,,,,,287,,,,,,287,,,,287,287,,287,287,,,,287,287,287,287,287', -'287,451,451,287,,451,451,,451,,,,,,,,,,,,,,,,,451,451,,,,,,451,,451', -',451,451,,451,451,451,,451,451,451,451,,,451,451,,,451,,,451,451,,,', -',,,451,,,,,,451,,,,451,451,,451,451,,,,451,451,451,451,451,451,243,243', -'451,,243,243,,243,,,,,,,,,,,,,,,,,243,243,,,,,,243,,243,,243,243,,243', -'243,243,,243,243,,,,,243,243,,,243,,,243,243,,,,,,,243,,,,,,243,,,,243', -'243,,243,243,,,,243,243,243,243,243,243,206,206,243,,206,206,,206,,', -',,,,,,,,,,,,,,206,206,,,,,,206,,206,,206,206,,206,206,206,,206,206,', -',,,206,206,,,206,,,206,206,,,,,,,206,,,,,,206,,,,206,206,,206,206,,', -',206,206,206,206,206,206,449,449,206,,449,449,,449,449,,,,,,,,,,,,,', -',,449,449,,,,,,449,,449,,449,449,,449,449,449,,449,449,449,449,,,449', -'449,,,449,,,449,449,,,,,,,449,,,,,,449,,,,449,449,,449,449,,,,449,449', -'449,449,449,449,63,63,449,,63,63,63,63,,,,,,,,,,,,,,,,,63,63,,,,,,63', -',63,,63,63,,63,63,63,,63,63,63,63,,,63,63,,,63,,,63,63,,,,,,,63,,,,', +'0,0,283,200,0,0,1,0,7,7,7,166,223,166,201,284,174,294,296,174,296,202', +'209,283,0,0,223,214,223,215,284,0,223,0,5,0,0,112,0,0,0,144,0,0,0,0', +'200,8,0,0,294,49,0,223,166,0,0,201,7,7,7,7,54,0,202,209,54,48,50,0,214', +'144,215,0,0,223,0,0,0,112,56,0,0,0,0,0,0,4,4,0,48,4,4,368,4,166,379', +'12,54,224,59,12,54,147,12,379,368,375,73,375,54,4,4,224,368,224,147', +'55,4,224,4,55,4,4,147,4,4,4,4,4,4,4,4,12,74,4,4,12,147,4,224,361,4,4', +'137,12,361,466,79,433,4,433,466,55,203,81,4,55,119,119,4,4,224,4,4,55', +'113,137,4,4,4,4,4,4,10,10,4,203,10,10,184,10,116,250,250,250,250,117', +'250,250,250,130,250,184,250,250,182,182,10,10,182,184,250,250,250,10', +'131,10,250,10,10,126,10,10,10,184,10,10,10,10,250,250,10,10,132,126', +'10,126,135,10,10,126,136,250,250,250,250,10,153,153,58,127,138,10,58', +'127,138,10,10,139,10,10,126,154,154,10,10,10,10,10,10,11,11,10,142,11', +'11,146,11,165,165,179,179,400,400,156,58,127,138,158,58,127,138,167', +'170,11,11,172,58,127,138,210,11,188,11,210,11,11,193,11,11,11,194,11', +'11,11,11,195,196,11,11,198,245,11,252,254,11,11,211,57,57,213,211,57', +'11,213,255,210,353,258,11,210,353,265,11,11,270,11,11,210,271,272,11', +'11,11,11,11,11,16,16,11,275,16,16,211,16,281,213,211,57,282,213,57,289', +'353,290,211,291,353,213,292,353,16,16,295,299,353,301,313,16,318,16', +'57,16,16,128,16,16,16,319,16,16,57,57,321,327,16,16,329,128,16,128,331', +'16,16,128,212,212,333,348,212,16,351,355,357,359,362,16,363,366,367', +'16,16,374,16,16,128,376,377,16,16,16,16,16,16,17,17,16,384,17,17,129', +'17,385,390,399,212,401,408,212,412,415,420,421,427,129,436,129,437,17', +'17,129,439,441,444,447,17,448,17,212,17,17,222,17,17,17,452,17,17,212', +'212,455,129,17,17,456,222,17,222,461,17,17,222,293,293,464,477,293,17', +'479,480,486,488,490,17,493,498,,17,17,,17,17,222,,,17,17,17,17,17,17', +'18,18,17,,18,18,,18,,,,293,,,293,,,,,,,,,,18,18,,,260,,,18,261,18,293', +'18,18,260,18,18,18,261,18,18,293,293,,,18,18,260,,18,,261,18,18,,260', +',,,261,18,,,,,,18,,,,18,18,,18,18,,,,18,18,18,18,18,18,19,19,18,,19', +'19,,19,,320,320,320,320,,320,320,320,,320,,320,320,,,19,19,,,320,320', +'320,19,,19,320,19,19,,19,19,19,,19,19,19,19,320,320,19,19,,,19,,,19', +'19,,,320,320,320,320,19,,,,,,19,,,,19,19,,19,19,,,,19,19,19,19,19,19', +'20,20,19,,20,20,,20,,322,322,322,322,,322,322,322,,322,,322,322,,,20', +'20,,,322,322,322,20,,20,322,20,20,,20,20,20,,20,20,20,20,322,322,20', +'20,,,20,,,20,20,,,322,322,322,322,20,,,,,,20,,,,20,20,,20,20,,,,20,20', +'20,20,20,20,47,47,20,,47,47,,47,,,,,,,,,,,,,,,,,47,47,47,,,,,47,,47', +',47,47,,47,47,47,,47,47,47,47,,,47,47,,,47,,,47,47,,387,387,,,387,47', +',,,,,47,,,,47,47,,47,47,,,,47,47,47,47,47,47,51,51,47,,51,51,,51,,,', +'387,,,387,,,,,,,,,,51,51,,,,,,51,,51,387,51,51,,51,51,51,,51,51,387', +'387,,,51,51,,,51,,,51,51,,,,,,,51,,,,,,51,,,,51,51,,51,51,,,,51,51,51', +'51,51,51,52,52,51,227,52,52,,52,,,,,,,,,,227,,227,,,,227,52,52,,,,,', +'52,,52,,52,52,,52,52,52,,52,52,227,,,,52,52,,,52,,,52,52,,,227,227,', +',52,,,227,,,52,,,,52,52,,52,52,,,,52,52,52,52,52,52,53,53,52,228,53', +'53,,53,,,,,,,,,,228,,228,,,,228,53,53,,,,,,53,,53,,53,53,,53,53,53,', +'53,53,228,,,,53,53,,,53,,,53,53,,,228,228,,,53,,,228,,,53,,,,53,53,', +'53,53,,,,53,53,53,53,53,53,63,63,53,,63,63,63,63,,350,350,350,350,,350', +'350,350,,350,,350,350,,,63,63,,,350,350,350,63,,63,350,63,63,,63,63', +'63,,63,63,63,63,350,350,63,63,,,63,,,63,63,,,350,350,350,350,63,,,,', ',63,,,,63,63,,63,63,,,,63,63,63,63,63,63,64,64,63,,64,64,64,64,,,,,', ',,,,,,,,,,,64,64,,,,,,64,,64,,64,64,,64,64,64,,64,64,64,64,,,64,64,', ',64,,,64,64,,,,,,,64,,,,,,64,,,,64,64,,64,64,,,,64,64,64,64,64,64,65', @@ -422,72 +377,61 @@ class Parser < Racc::Parser ',65,65,65,65,,,65,65,,,65,,,65,65,,,,,,,65,,,,,,65,,,,65,65,,65,65,', ',,65,65,65,65,65,65,71,71,65,,71,71,,71,,,,,,,,,,,,,,,,,71,71,,,,,,71', ',71,,71,71,,71,71,71,,71,71,71,71,,,71,71,,,71,,,71,71,,,,,,,71,,,,', -',71,,,,71,71,,71,71,,,,71,71,71,71,71,71,440,440,71,,440,440,,440,,', -',,,,,,,,,,,,,,440,440,,,,,,440,,440,,440,440,,440,440,440,,440,440,', -',,,440,440,,,440,,,440,440,,,,,,,440,,,,,,440,,,,440,440,,440,440,,', -',440,440,440,440,440,440,435,435,440,,435,435,,435,,,,,,,,,,,,,,,,,435', -'435,,,,,,435,,435,,435,435,,435,435,435,,435,435,,,,,435,435,,,435,', -',435,435,,,,,,,435,,,,,,435,,,,435,435,,435,435,,,,435,435,435,435,435', -'435,76,76,435,,76,76,,76,,,,,,,,,,,,,,,,,76,76,,,,,,76,,76,,76,76,,76', -'76,76,,76,76,,,,,76,76,,,76,,,76,76,,,,,,,76,,,,,,76,,,,76,76,,76,76', -',,,76,76,76,76,76,76,476,476,76,,476,476,,476,476,,,,,,,,,,,,,,,,476', -'476,,,,,,476,,476,,476,476,,476,476,476,,476,476,476,476,,,476,476,', -',476,,,476,476,,,,,,,476,,,,,,476,,,,476,476,,476,476,,,,476,476,476', -'476,476,476,80,80,476,,80,80,,80,,,,,,,,,,,,,,,,,80,80,,,,,,80,,80,', -'80,80,,80,80,80,,80,80,80,80,,,80,80,,,80,,,80,80,,,,,,,80,,,,,,80,', -',,80,80,,80,80,,,,80,80,80,80,80,80,429,429,80,,429,429,,429,,,,,,,', -',,,,,,,,,429,429,,,,,,429,,429,,429,429,,429,429,429,,429,429,429,429', -',,429,429,,,429,,,429,429,,,,,,,429,,,,,,429,,,,429,429,,429,429,,,', -'429,429,429,429,429,429,82,82,429,,82,82,,82,,,,,,,,,,,,,,,,,82,82,', -',,,,82,,82,,82,82,,82,82,82,,82,82,82,82,,,82,82,,,82,,,82,82,,,,,,', -'82,,,,,,82,,,,82,82,,82,82,,,,82,82,82,82,82,82,83,83,82,,83,83,,83', -',,,,,,,,,,,,,,,,83,83,,,,,,83,,83,,83,83,,83,83,83,,83,83,83,83,,,83', -'83,,,83,,,83,83,,,,,,,83,,,,,,83,,,,83,83,,83,83,,,,83,83,83,83,83,83', -'84,84,83,,84,84,,84,,,,,,,,,,,,,,,,,84,84,,,,,,84,,84,,84,84,,84,84', -'84,,84,84,84,84,,,84,84,,,84,,,84,84,,,,,,,84,,,,,,84,,,,84,84,,84,84', -',,,84,84,84,84,84,84,85,85,84,,85,85,,85,,,,,,,,,,,,,,,,,85,85,,,,,', -'85,,85,,85,85,,85,85,85,,85,85,85,85,,,85,85,,,85,,,85,85,,,,,,,85,', -',,,,85,,,,85,85,,85,85,,,,85,85,85,85,85,85,86,86,85,,86,86,,86,,,,', -',,,,,,,,,,,,86,86,,,,,,86,,86,,86,86,,86,86,86,,86,86,86,86,,,86,86', -',,86,,,86,86,,,,,,,86,,,,,,86,,,,86,86,,86,86,,,,86,86,86,86,86,86,87', -'87,86,,87,87,,87,,,,,,,,,,,,,,,,,87,87,,,,,,87,,87,,87,87,,87,87,87', -',87,87,87,87,,,87,87,,,87,,,87,87,,,,,,,87,,,,,,87,,,,87,87,,87,87,', -',,87,87,87,87,87,87,88,88,87,,88,88,,88,,,,,,,,,,,,,,,,,88,88,,,,,,88', -',88,,88,88,,88,88,88,,88,88,88,88,,,88,88,,,88,,,88,88,,,,,,,88,,,,', -',88,,,,88,88,,88,88,,,,88,88,88,88,88,88,89,89,88,,89,89,,89,,,,,,,', -',,,,,,,,,89,89,,,,,,89,,89,,89,89,,89,89,89,,89,89,89,89,,,89,89,,,89', -',,89,89,,,,,,,89,,,,,,89,,,,89,89,,89,89,,,,89,89,89,89,89,89,90,90', -'89,,90,90,,90,,,,,,,,,,,,,,,,,90,90,,,,,,90,90,90,90,90,90,90,90,90', -'90,,90,90,,,,,90,90,90,90,90,,,90,90,,,,,,,90,,,,,90,90,,,,90,90,,90', -'90,,,,90,90,90,90,90,90,91,91,90,,91,91,,91,,,,,,,,,,,,,,,,,91,91,,', -',,,91,,91,,91,91,,91,91,91,,91,91,,,,,91,91,,,91,,,91,91,,,,,,,91,,', -',,,91,,,,91,91,,91,91,,,,91,91,91,91,91,91,92,92,91,,92,92,,92,,,,,', -',,,,,,,,,,,92,92,,,,,,92,,92,,92,92,,92,92,92,,92,92,,,,,92,92,,,92', -',,92,92,,,,,,,92,,,,,,92,,,,92,92,,92,92,,,,92,92,92,92,92,92,93,93', -'92,,93,93,,93,,,,,,,,,,,,,,,,,93,93,,,,,,93,,93,,93,93,,93,93,93,,93', -'93,,,,,93,93,,,93,,,93,93,,,,,,,93,,,,,,93,,,,93,93,,93,93,,,,93,93', -'93,93,93,93,94,94,93,,94,94,,94,,,,,,,,,,,,,,,,,94,94,,,,,,94,,94,,94', -'94,,94,94,94,,94,94,,,,,94,94,,,94,,,94,94,,,,,,,94,,,,,,94,,,,94,94', -',94,94,,,,94,94,94,94,94,94,95,95,94,,95,95,,95,,,,,,,,,,,,,,,,,95,95', -',,,,,95,,95,,95,95,,95,95,95,,95,95,,,,,95,95,,,95,,,95,95,,,,,,,95', -',,,,,95,,,,95,95,,95,95,,,,95,95,95,95,95,95,96,96,95,,96,96,,96,,,', -',,,,,,,,,,,,,96,96,,,,,,96,,96,,96,96,,96,96,96,,96,96,,,,,96,96,,,96', -',,96,96,,,,,,,96,,,,,,96,,,,96,96,,96,96,,,,96,96,96,96,96,96,97,97', -'96,,97,97,,97,,,,,,,,,,,,,,,,,97,97,,,,,,97,,97,,97,97,,97,97,97,,97', -'97,,,,,97,97,,,97,,,97,97,,,,,,,97,,,,,,97,,,,97,97,,97,97,,,,97,97', -'97,97,97,97,98,98,97,,98,98,,98,,,,,,,,,,,,,,,,,98,98,,,,,,98,,98,,98', -'98,,98,98,98,,98,98,,,,,98,98,,,98,,,98,98,,,,,,,98,,,,,,98,,,,98,98', -',98,98,,,,98,98,98,98,98,98,99,99,98,,99,99,,99,,,,,,,,,,,,,,,,,99,99', -',,,,,99,,99,,99,99,,99,99,99,,99,99,,,,,99,99,,,99,,,99,99,,,,,,,99', -',,,,,99,,,,99,99,,99,99,,,,99,99,99,99,99,99,100,100,99,,100,100,,100', -',,,,,,,,,,,,,,,,100,100,,,,,,100,,100,,100,100,,100,100,100,,100,100', -',,,,100,100,,,100,,,100,100,,,,,,,100,,,,,,100,,,,100,100,,100,100,', -',,100,100,100,100,100,100,101,101,100,,101,101,,101,,,,,,,,,,,,,,,,', -'101,101,,,,,,101,,101,,101,101,,101,101,101,,101,101,,,,,101,101,,,101', -',,101,101,,,,,,,101,,,,,,101,,,,101,101,,101,101,,,,101,101,101,101', -'101,101,102,102,101,,102,102,,102,,,,,,,,,,,,,,,,,102,102,,,,,,102,', -'102,,102,102,,102,102,102,,102,102,,,,,102,102,,,102,,,102,102,,,,,', -',102,,,,,,102,,,,102,102,,102,102,,,,102,102,102,102,102,102,103,103', +',71,,,,71,71,,71,71,,,,71,71,71,71,71,71,76,76,71,229,76,76,,76,,,,', +',,,,,229,,229,,,,229,76,76,,,,,,76,,76,,76,76,,76,76,76,,76,76,229,', +',,76,76,,,76,,,76,76,,,229,229,,,76,,,229,,,76,,,,76,76,,76,76,,,,76', +'76,76,76,76,76,80,80,76,,80,80,,80,,,,,,,,,,,,,,,,,80,80,,,,,,80,,80', +',80,80,,80,80,80,,80,80,80,80,,,80,80,,,80,,,80,80,,,,,,,80,,,,,,80', +',,,80,80,,80,80,,,,80,80,80,80,80,80,82,82,80,,82,82,,82,,,,,,,,,,,', +',,,,,82,82,,,,,,82,,82,,82,82,,82,82,82,,82,82,82,82,,,82,82,,,82,,', +'82,82,,,,,,,82,,,,,,82,,,,82,82,,82,82,,,,82,82,82,82,82,82,83,83,82', +',83,83,,83,,,,,,,,,,,,,,,,,83,83,,,,,,83,,83,,83,83,,83,83,83,,83,83', +'83,83,,,83,83,,,83,,,83,83,,,,,,,83,,,,,,83,,,,83,83,,83,83,,,,83,83', +'83,83,83,83,84,84,83,,84,84,,84,,,,,,,,,,,,,,,,,84,84,,,,,,84,,84,,84', +'84,,84,84,84,,84,84,84,84,,,84,84,,,84,,,84,84,,,,,,,84,,,,,,84,,,,84', +'84,,84,84,,,,84,84,84,84,84,84,85,85,84,,85,85,,85,,,,,,,,,,,,,,,,,85', +'85,,,,,,85,,85,,85,85,,85,85,85,,85,85,85,85,,,85,85,,,85,,,85,85,,', +',,,,85,,,,,,85,,,,85,85,,85,85,,,,85,85,85,85,85,85,86,86,85,,86,86', +',86,,,,,,,,,,,,,,,,,86,86,,,,,,86,,86,,86,86,,86,86,86,,86,86,86,86', +',,86,86,,,86,,,86,86,,,,,,,86,,,,,,86,,,,86,86,,86,86,,,,86,86,86,86', +'86,86,87,87,86,,87,87,,87,,,,,,,,,,,,,,,,,87,87,,,,,,87,,87,,87,87,', +'87,87,87,,87,87,87,87,,,87,87,,,87,,,87,87,,,,,,,87,,,,,,87,,,,87,87', +',87,87,,,,87,87,87,87,87,87,88,88,87,,88,88,,88,,,,,,,,,,,,,,,,,88,88', +',,,,,88,,88,,88,88,,88,88,88,,88,88,88,88,,,88,88,,,88,,,88,88,,,,,', +',88,,,,,,88,,,,88,88,,88,88,,,,88,88,88,88,88,88,89,89,88,,89,89,,89', +',,,,,,,,,,,,,,,,89,89,,,,,,89,,89,,89,89,,89,89,89,,89,89,89,89,,,89', +'89,,,89,,,89,89,,,,,,,89,,,,,,89,,,,89,89,,89,89,,,,89,89,89,89,89,89', +'90,90,89,,90,90,,90,,,,,,,,,,,,,,,,,90,90,,,,,,90,90,90,90,90,90,90', +'90,90,90,,90,90,,,,,90,90,90,90,90,,,90,90,,,,,,,90,,,,,90,90,,,,90', +'90,,90,90,,,,90,90,90,90,90,90,91,91,90,,91,91,,91,,,,,,,,,,,,,,,,,91', +'91,,,,,,91,,91,,91,91,,91,91,91,,91,91,,,,,91,91,,,91,,,91,91,,,,,,', +'91,,,,,,91,,,,91,91,,91,91,,,,91,91,91,91,91,91,92,92,91,,92,92,,92', +',,,,,,,,,,,,,,,,92,92,,,,,,92,,92,,92,92,,92,92,92,,92,92,,,,,92,92', +',,92,,,92,92,,,,,,,92,,,,,,92,,,,92,92,,92,92,,,,92,92,92,92,92,92,93', +'93,92,,93,93,,93,,,,,,,,,,,,,,,,,93,93,,,,,,93,,93,,93,93,,93,93,93', +',93,93,,,,,93,93,,,93,,,93,93,,,,,,,93,,,,,,93,,,,93,93,,93,93,,,,93', +'93,93,93,93,93,94,94,93,,94,94,,94,,,,,,,,,,,,,,,,,94,94,,,,,,94,,94', +',94,94,,94,94,94,,94,94,,,,,94,94,,,94,,,94,94,,,,,,,94,,,,,,94,,,,94', +'94,,94,94,,,,94,94,94,94,94,94,95,95,94,,95,95,,95,,,,,,,,,,,,,,,,,95', +'95,,,,,,95,,95,,95,95,,95,95,95,,95,95,,,,,95,95,,,95,,,95,95,,,,,,', +'95,,,,,,95,,,,95,95,,95,95,,,,95,95,95,95,95,95,96,96,95,,96,96,,96', +',,,,,,,,,,,,,,,,96,96,,,,,,96,,96,,96,96,,96,96,96,,96,96,,,,,96,96', +',,96,,,96,96,,,,,,,96,,,,,,96,,,,96,96,,96,96,,,,96,96,96,96,96,96,97', +'97,96,,97,97,,97,,,,,,,,,,,,,,,,,97,97,,,,,,97,,97,,97,97,,97,97,97', +',97,97,,,,,97,97,,,97,,,97,97,,,,,,,97,,,,,,97,,,,97,97,,97,97,,,,97', +'97,97,97,97,97,98,98,97,,98,98,,98,,,,,,,,,,,,,,,,,98,98,,,,,,98,,98', +',98,98,,98,98,98,,98,98,,,,,98,98,,,98,,,98,98,,,,,,,98,,,,,,98,,,,98', +'98,,98,98,,,,98,98,98,98,98,98,99,99,98,,99,99,,99,,,,,,,,,,,,,,,,,99', +'99,,,,,,99,,99,,99,99,,99,99,99,,99,99,,,,,99,99,,,99,,,99,99,,,,,,', +'99,,,,,,99,,,,99,99,,99,99,,,,99,99,99,99,99,99,100,100,99,,100,100', +',100,,,,,,,,,,,,,,,,,100,100,,,,,,100,,100,,100,100,,100,100,100,,100', +'100,,,,,100,100,,,100,,,100,100,,,,,,,100,,,,,,100,,,,100,100,,100,100', +',,,100,100,100,100,100,100,101,101,100,,101,101,,101,,,,,,,,,,,,,,,', +',101,101,,,,,,101,,101,,101,101,,101,101,101,,101,101,,,,,101,101,,', +'101,,,101,101,,,,,,,101,,,,,,101,,,,101,101,,101,101,,,,101,101,101', +'101,101,101,102,102,101,,102,102,,102,,,,,,,,,,,,,,,,,102,102,,,,,,102', +',102,,102,102,,102,102,102,,102,102,,,,,102,102,,,102,,,102,102,,,,', +',,102,,,,,,102,,,,102,102,,102,102,,,,102,102,102,102,102,102,103,103', '102,,103,103,,103,,,,,,,,,,,,,,,,,103,103,,,,,,103,,103,,103,103,,103', '103,103,,103,103,,,,,103,103,,,103,,,103,103,,,,,,,103,,,,,,103,,,,103', '103,,103,103,,,,103,103,103,103,103,103,104,104,103,,104,104,,104,,', @@ -509,134 +453,189 @@ class Parser < Racc::Parser ',,,,,,109,,,,,,109,,,109,109,109,,109,109,,,,109,109,109,109,109,109', '110,110,109,,110,110,,110,,,,,,,,,,,,,,,,,110,110,,,,,,110,,110,,110', '110,,110,110,110,,110,110,110,110,,,110,110,,,110,,,110,110,,,,,,,110', -',,,,,110,,,,110,110,,110,110,,,,110,110,110,110,110,110,205,205,110', -',205,205,,205,,,,,,,,,,,,,,,,,205,205,,,,,,205,,205,,205,205,,205,205', -'205,,205,205,,,,,205,205,,,205,,,205,205,,,,,,,205,,,,,,205,,,,205,205', -',205,205,,,,205,205,205,205,205,205,426,426,205,,426,426,,426,,,,,,', -',,,,,,,,,,426,426,,,,,,426,,426,,426,426,,426,426,426,,426,426,426,426', -',,426,426,,,426,,,426,426,,,,,,,426,,,,,,426,,,,426,426,,426,426,,,', -'426,426,426,426,426,426,114,114,426,,114,114,,114,,,,,,,,,,,,,,,,,114', -'114,,,,,,114,,114,,114,114,,114,114,114,,114,114,,,,,114,114,,,114,', -',114,114,,,,,,,114,,,,,,114,,,,114,114,,114,114,,,,114,114,114,114,114', -'114,115,115,114,,115,115,,115,,,,,,,,,,,,,,,,,115,115,,,,,,115,,115', -',115,115,,115,115,115,,115,115,,,,,115,115,,,115,,,115,115,,,,,,,115', -',,,,,115,,,,115,115,,115,115,,,,115,115,115,115,115,115,423,423,115', -',423,423,,423,,,,,,,,,,,,,,,,,423,423,,,,,,423,,423,,423,423,,423,423', -'423,,423,423,423,423,,,423,423,,,423,,,423,423,,,,,,,423,,,,,,423,,', -',423,423,,423,423,,,,423,423,423,423,423,423,416,416,423,,416,416,,416', -',,,,,,,,,,,,,,,,416,416,,,,,,416,,416,,416,416,,416,416,416,,416,416', -'416,416,,,416,416,,,416,,,416,416,,,,,,,416,,,,,,416,,,,416,416,,416', -'416,,,,416,416,416,416,416,416,118,118,416,,118,118,,118,,,,,,,,,,,', -',,,,,118,118,,,,,,118,,118,,118,118,,118,118,118,,118,118,,,,,118,118', -',,118,,,118,118,,,,,,,118,,,,,,118,,,,118,118,,118,118,,,,118,118,118', -'118,118,118,409,409,118,,409,409,,409,,,,,,,,,,,,,,,,,409,409,,,,,,409', -',409,,409,409,,409,409,409,,409,409,,,,,409,409,,,409,,,409,409,,,,', -',,409,,,,,,409,,,,409,409,,409,409,,,,409,409,409,409,409,409,204,204', -'409,,204,204,,204,,,,,,,,,,,,,,,,,204,204,,,,,,204,,204,,204,204,,204', -'204,204,,204,204,,,,,204,204,,,204,,,204,204,,,,,,,204,,,,,,204,,,,204', -'204,,204,204,,,,204,204,204,204,204,204,288,288,204,,288,288,,288,,', -',,,,,,,,,,,,,,288,288,,,,,,288,,288,,288,288,,288,288,288,,288,288,', -',,,288,288,,,288,,,288,288,,,,,,,288,,,,,,288,,,,288,288,,288,288,,', -',288,288,288,288,288,288,199,199,288,,199,199,,199,,,199,,,,,,,,,,,', -',,199,199,,,,,,199,,199,,199,199,,199,199,199,,199,199,,,,,199,199,', -',199,,,199,199,,,,,,,199,,,,,,199,,,,199,199,,199,199,,,,199,199,199', -'199,199,199,300,300,199,,300,300,,300,,,,,,,,,,,,,,,,,300,300,,,,,,300', -',300,,300,300,,300,300,300,,300,300,300,300,,,300,300,,,300,,,300,300', -',,,,,,300,,,,,,300,,,,300,300,,300,300,,,,300,300,300,300,300,300,268', -'268,300,,268,268,,268,,,,,,,,,,,,,,,,,268,268,,,,,,268,,268,,268,268', -',268,268,268,,268,268,268,268,,,268,268,,,268,,,268,268,,,,,,,268,,', -',,,268,,,,268,268,,268,268,,,,268,268,268,268,268,268,473,473,268,,473', -'473,,473,,,,,,,,,,,,,,,,,473,473,,,,,,473,,473,,473,473,,473,473,473', -',473,473,473,473,,,473,473,,,473,,,473,473,,,,,,,473,,,,,,473,,,,473', -'473,,473,473,,,,473,473,473,473,473,473,267,267,473,,267,267,,267,,', -',,,,,,,,,,,,,,267,267,,,,,,267,,267,,267,267,,267,267,267,,267,267,267', -'267,,,267,267,,,267,,,267,267,,,,,,,267,,,,,,267,,,,267,267,,267,267', -',,,267,267,267,267,267,267,264,264,267,,264,264,,264,,,,,,,,,,,,,,,', -',264,264,,,,,,264,,264,,264,264,,264,264,264,,264,264,264,264,,,264', -'264,,,264,,,264,264,,,,,,,264,,,,,,264,,,,264,264,,264,264,,,,264,264', -'264,264,264,264,392,392,264,,392,392,,392,,,,,,,,,,,,,,,,,392,392,,', -',,,392,,392,,392,392,,392,392,392,,392,392,392,392,,,392,392,,,392,', -',392,392,,,,,,,392,,,,,,392,,,,392,392,,392,392,,,,392,392,392,392,392', -'392,303,303,392,,303,303,,303,303,,,,,,,,,,,,,,,,303,303,,,,,,303,,303', -',303,303,,303,303,303,,303,303,303,303,,,303,303,,,303,,,303,303,,,', -',,,303,,,,,,303,,,,303,303,,303,303,,,,303,303,303,303,303,303,308,308', -'303,,308,308,,308,,,,,,,,,,,,,,,,,308,308,,,,,,308,,308,,308,308,,308', -'308,308,,308,308,308,308,,,308,308,,,308,,,308,308,,,,,,,308,,,,,,308', -',,,308,308,,308,308,,,,308,308,308,308,308,308,383,383,308,,383,383', -',383,,,,,,,,,,,,,,,,,383,383,,,,,,383,,383,,383,383,,383,383,383,,383', -'383,383,383,,,383,383,,,383,,,383,383,,,,,,,383,,,,,,383,,,,383,383', -',383,383,,,,383,383,383,383,383,383,382,382,383,,382,382,,382,,,,,,', -',,,,,,,,,,382,382,,,,,,382,,382,,382,382,,382,382,382,,382,382,382,382', -',,382,382,,,382,,,382,382,,,,,,,382,,,,,,382,,,,382,382,,382,382,,,', -'382,382,382,382,382,382,380,380,382,,380,380,,380,380,,,,,,,,,,,,,,', -',380,380,,,,,,380,,380,,380,380,,380,380,380,,380,380,,,,,380,380,,', -'380,,,380,380,,,,,,,380,,,,,,380,,,,380,380,,380,380,,,,380,380,380', -'380,380,380,10,10,380,,10,10,,10,,,,,,,,,,,,,,,,,10,10,,,,,,10,,10,', -'10,10,,10,10,10,,10,10,10,10,,,10,10,,,10,,,10,10,,,,,,,10,,,,,,10,', -',,10,10,,10,10,,,,10,10,10,10,10,10,482,482,10,,482,482,,482,,,,,,,', -',,,,,,,,,482,482,,,,,,482,,482,,482,482,,482,482,482,,482,482,,,,,482', -'482,,,482,,,482,482,,,,,,,482,,,,,,482,,,,482,482,,482,482,,,,482,482', -'482,482,482,482,148,148,482,,148,148,,148,,,,,,,,,,,,,,,,,148,148,148', -',,,,148,,148,,148,148,,148,148,148,,148,148,148,148,,,148,148,,,148', -',,148,148,,,,,,,148,,,,,,148,,,,148,148,,148,148,,,,148,148,148,148', -'148,148,11,11,148,,11,11,,11,,,,,,,,,,,,,,,,,11,11,,,,,,11,,11,,11,11', -',11,11,11,,11,11,11,11,,,11,11,,,11,,,11,11,,,,,,,11,,,,,,11,,,,11,11', -',11,11,,,,11,11,11,11,11,11,269,269,11,,269,269,,269,,,,,,,,,,,,,,,', -',269,269,,,,,,269,,269,,269,269,,269,269,269,,269,269,269,269,,,269', -'269,,,269,,,269,269,,,,,,,269,,,,,,269,,,,269,269,,269,269,,,,269,269', -'269,269,269,269,16,16,269,,16,16,,16,,,,,,,,,,,,,,,,,16,16,,,,,,16,', -'16,,16,16,,16,16,16,,16,16,,,,,16,16,,,16,,,16,16,,,,,,,16,,,,,,16,', -',,16,16,,16,16,,,,16,16,16,16,16,16,372,372,16,,372,372,,372,,,,,,,', +',,,,,110,,,,110,110,,110,110,,,,110,110,110,110,110,110,114,114,110', +',114,114,,114,,,,,,,,,,,,,,,,,114,114,,,,,,114,,114,,114,114,,114,114', +'114,,114,114,,,,,114,114,,,114,,,114,114,,,,,,,114,,,,,,114,,,,114,114', +',114,114,,,,114,114,114,114,114,114,115,115,114,,115,115,,115,,,,,,', +',,,,,,,,,,115,115,,,,,,115,,115,,115,115,,115,115,115,,115,115,,,,,115', +'115,,,115,,,115,115,,,,,,,115,,,,,,115,,,,115,115,,115,115,,,,115,115', +'115,115,115,115,118,118,115,,118,118,,118,,,,,,,,,,,,,,,,,118,118,,', +',,,118,,118,,118,118,,118,118,118,,118,118,,,,,118,118,,,118,,,118,118', +',,,,,,118,,,,,,118,,,,118,118,,118,118,,,,118,118,118,118,118,118,148', +'148,118,,148,148,,148,,,,,,,,,,,,,,,,,148,148,148,,,,,148,,148,,148', +'148,,148,148,148,,148,148,148,148,,,148,148,,,148,,,148,148,,,,,,,148', +',,,,,148,,,,148,148,,148,148,,,,148,148,148,148,148,148,155,155,148', +',155,155,,155,,,,,,,,,,,,,,,,,155,155,,,,,,155,,155,,155,155,,155,155', +'155,,155,155,155,155,,,155,155,,,155,,,155,155,,,,,,,155,,,,,,155,,', +',155,155,,155,155,,,,155,155,155,155,155,155,183,183,155,,183,183,,183', +',,,,,,,,,,,,,,,,183,183,,,,,,183,,183,,183,183,,183,183,183,,183,183', +'183,183,,,183,183,,,183,,,183,183,,,,,,,183,,,,,,183,,,,183,183,,183', +'183,,,,183,183,183,183,183,183,186,186,183,,186,186,,186,186,,,,,,,', +',,,,,,,,186,186,,,,,,186,,186,,186,186,,186,186,186,,186,186,186,186', +',,186,186,,,186,,,186,186,,,,,,,186,,,,,,186,,,,186,186,,186,186,,,', +'186,186,186,186,186,186,199,199,186,,199,199,,199,,,199,,,,,,,,,,,,', +',199,199,,,,,,199,,199,,199,199,,199,199,199,,199,199,,,,,199,199,,', +'199,,,199,199,,,,,,,199,,,,,,199,,,,199,199,,199,199,,,,199,199,199', +'199,199,199,204,204,199,,204,204,,204,,,,,,,,,,,,,,,,,204,204,,,,,,204', +',204,,204,204,,204,204,204,,204,204,,,,,204,204,,,204,,,204,204,,,,', +',,204,,,,,,204,,,,204,204,,204,204,,,,204,204,204,204,204,204,205,205', +'204,,205,205,,205,,,,,,,,,,,,,,,,,205,205,,,,,,205,,205,,205,205,,205', +'205,205,,205,205,,,,,205,205,,,205,,,205,205,,,,,,,205,,,,,,205,,,,205', +'205,,205,205,,,,205,205,205,205,205,205,206,206,205,,206,206,,206,,', +',,,,,,,,,,,,,,206,206,,,,,,206,,206,,206,206,,206,206,206,,206,206,', +',,,206,206,,,206,,,206,206,,,,,,,206,,,,,,206,,,,206,206,,206,206,,', +',206,206,206,206,206,206,243,243,206,,243,243,,243,,,,,,,,,,,,,,,,,243', +'243,,,,,,243,,243,,243,243,,243,243,243,,243,243,,,,,243,243,,,243,', +',243,243,,,,,,,243,,,,,,243,,,,243,243,,243,243,,,,243,243,243,243,243', +'243,264,264,243,,264,264,,264,,,,,,,,,,,,,,,,,264,264,,,,,,264,,264', +',264,264,,264,264,264,,264,264,264,264,,,264,264,,,264,,,264,264,,,', +',,,264,,,,,,264,,,,264,264,,264,264,,,,264,264,264,264,264,264,267,267', +'264,,267,267,,267,,,,,,,,,,,,,,,,,267,267,,,,,,267,,267,,267,267,,267', +'267,267,,267,267,267,267,,,267,267,,,267,,,267,267,,,,,,,267,,,,,,267', +',,,267,267,,267,267,,,,267,267,267,267,267,267,268,268,267,,268,268', +',268,,,,,,,,,,,,,,,,,268,268,,,,,,268,,268,,268,268,,268,268,268,,268', +'268,268,268,,,268,268,,,268,,,268,268,,,,,,,268,,,,,,268,,,,268,268', +',268,268,,,,268,268,268,268,268,268,269,269,268,,269,269,,269,,,,,,', +',,,,,,,,,,269,269,,,,,,269,,269,,269,269,,269,269,269,,269,269,269,269', +',,269,269,,,269,,,269,269,,,,,,,269,,,,,,269,,,,269,269,,269,269,,,', +'269,269,269,269,269,269,286,286,269,,286,286,,286,286,,,,,,,,,,,,,,', +',286,286,,,,,,286,,286,,286,286,,286,286,286,,286,286,286,286,,,286', +'286,,,286,,,286,286,,,,,,,286,,,,,,286,,,,286,286,,286,286,,,,286,286', +'286,286,286,286,287,287,286,,287,287,,287,287,,,,,,,,,,,,,,,,287,287', +',,,,,287,,287,,287,287,,287,287,287,,287,287,287,287,,,287,287,,,287', +',,287,287,,,,,,,287,,,,,,287,,,,287,287,,287,287,,,,287,287,287,287', +'287,287,288,288,287,,288,288,,288,,,,,,,,,,,,,,,,,288,288,,,,,,288,', +'288,,288,288,,288,288,288,,288,288,,,,,288,288,,,288,,,288,288,,,,,', +',288,,,,,,288,,,,288,288,,288,288,,,,288,288,288,288,288,288,300,300', +'288,,300,300,,300,,,,,,,,,,,,,,,,,300,300,,,,,,300,,300,,300,300,,300', +'300,300,,300,300,300,300,,,300,300,,,300,,,300,300,,,,,,,300,,,,,,300', +',,,300,300,,300,300,,,,300,300,300,300,300,300,303,303,300,,303,303', +',303,303,,,,,,,,,,,,,,,,303,303,,,,,,303,,303,,303,303,,303,303,303', +',303,303,303,303,,,303,303,,,303,,,303,303,,,,,,,303,,,,,,303,,,,303', +'303,,303,303,,,,303,303,303,303,303,303,308,308,303,,308,308,,308,,', +',,,,,,,,,,,,,,308,308,,,,,,308,,308,,308,308,,308,308,308,,308,308,308', +'308,,,308,308,,,308,,,308,308,,,,,,,308,,,,,,308,,,,308,308,,308,308', +',,,308,308,308,308,308,308,323,323,308,,323,323,,323,,,,,,,,,,,,,,,', +',323,323,,,,,,323,,323,,323,323,,323,323,323,,323,323,,,,,323,323,,', +'323,,,323,323,,,,,,,323,,,,,,323,,,,323,323,,323,323,,,,323,323,323', +'323,323,323,324,324,323,,324,324,,324,,,,,,,,,,,,,,,,,324,324,,,,,,324', +',324,,324,324,,324,324,324,,324,324,,,,,324,324,,,324,,,324,324,,,,', +',,324,,,,,,324,,,,324,324,,324,324,,,,324,324,324,324,324,324,325,325', +'324,,325,325,,325,,,,,,,,,,,,,,,,,325,325,,,,,,325,,325,,325,325,,325', +'325,325,,325,325,,,,,325,325,,,325,,,325,325,,,,,,,325,,,,,,325,,,,325', +'325,,325,325,,,,325,325,325,325,325,325,326,326,325,,326,326,,326,,', +',,,,,,,,,,,,,,326,326,,,,,,326,,326,,326,326,,326,326,326,,326,326,', +',,,326,326,,,326,,,326,326,,,,,,,326,,,,,,326,,,,326,326,,326,326,,', +',326,326,326,326,326,326,330,330,326,,330,330,,330,,,,,,,,,,,,,,,,,330', +'330,,,,,,330,,330,,330,330,,330,330,330,,330,330,330,330,,,330,330,', +',330,,,330,330,,,,,,,330,,,,,,330,,,,330,330,,330,330,,,,330,330,330', +'330,330,330,349,349,330,,349,349,,349,,,,,,,,,,,,,,,,,349,349,,,,,,349', +',349,,349,349,,349,349,349,,349,349,,,,,349,349,,,349,,,349,349,,,,', +',,349,,,,,,349,,,,349,349,,349,349,,,,349,349,349,349,349,349,365,365', +'349,,365,365,,365,365,,,,,,,,,,,,,,,,365,365,,,,,,365,,365,,365,365', +',365,365,365,,365,365,365,365,,,365,365,,,365,,,365,365,,,,,,,365,,', +',,,365,,,,365,365,,365,365,,,,365,365,365,365,365,365,369,369,365,,369', +'369,,369,,,,,,,,,,,,,,,,,369,369,,,,,,369,,369,,369,369,,369,369,369', +',369,369,,,,,369,369,,,369,,,369,369,,,,,,,369,,,,,,369,,,,369,369,', +'369,369,,,,369,369,369,369,369,369,372,372,369,,372,372,,372,,,,,,,', ',,,,,,,,,372,372,,,,,,372,,372,,372,372,,372,372,372,,372,372,372,372', ',,372,372,,,372,,,372,372,,,,,,,372,,,,,,372,,,,372,372,,372,372,,,', -'372,372,372,372,372,372,155,155,372,,155,155,,155,,,,,,,,,,,,,,,,,155', -'155,,,,,,155,,155,,155,155,,155,155,155,,155,155,155,155,,,155,155,', -',155,,,155,155,,,,,,,155,,,,,,155,,,,155,155,,155,155,405,,,155,155', -'155,155,155,155,,,155,405,405,405,,405,,405,,405,,405,405,405,405,,', -',,,,,,,,,,,,,405,,,,405,405,,9,405,405,405,405,405,405,,405,405,,,9', -'9,9,405,9,,9,,9,,9,9,9,9,,,,,,,,,,,,,405,,,9,,,,9,9,,472,9,9,9,9,9,9', -',9,9,,,472,472,472,9,472,,472,,472,,472,472,472,472,,,,,,,,,,,,,9,,', -'472,,,,472,472,,432,472,472,472,472,472,472,,472,472,,,432,432,432,472', -'432,,432,,432,,432,432,432,432,,,,,,,,,,,,,472,,,432,,,,432,432,,407', -'432,432,432,432,432,432,,432,432,,,407,407,407,432,407,,407,,407,,407', -'407,407,407,,,,,,,,,,,,,432,,,407,,,,407,407,,406,407,407,407,407,407', -'407,,407,407,,,406,406,406,407,406,,406,,406,,406,406,406,406,,,,,,', -',,,,,,407,,,406,,,,406,406,,404,406,406,406,406,406,406,,406,406,,,404', -'404,404,406,404,,404,,404,,404,404,404,404,,,,,,,,,,,,,406,,,404,,,', -'404,404,,378,404,404,404,404,404,404,,404,404,,,378,378,378,404,378', -',378,,378,,378,378,378,378,,,,,,,,,,,,,404,,,378,,,,378,378,,,378,378', -'378,378,378,378,,378,378,149,,149,,,378,,,,,,,149,149,149,,149,,149', -',149,,149,149,149,149,,,378,,,,,,,,,,,,,149,,,,149,149,,,149,149,149', -'149,149,149,,149,149,151,,151,,,149,,,,,,,151,151,151,,151,,151,,151', -',151,151,151,151,,,149,,,,,,,,,,,,,151,,,,151,151,,,151,151,151,151', -'151,151,,151,151,152,,152,,,151,,,,,,,152,152,152,,152,,152,,152,,152', -'152,152,152,,,151,,,,,,,,,,,,,152,,,,152,152,,185,152,152,152,152,152', -'152,,152,152,,,185,185,185,152,185,,185,,185,,185,185,185,185,,,,,,', -',,,,,,152,,,185,,,,185,185,,,185,185,185,185,185,185,,185,185,,,,,,185', -',197,,,,,,,,,185,185,,197,197,197,197,197,225,197,,197,185,197,197,197', -'197,,,,,,225,,225,,,,225,,,,197,,,,197,197,,,197,197,197,197,197,197', -',197,197,225,,,226,,197,,,,,225,225,,,,225,225,226,,226,230,,225,226', -',,,,197,,,,,,230,,230,,,,230,,,,226,225,,,,,,,,,226,226,,,,226,226,230', -',,231,,226,,,230,230,230,230,,,,230,230,231,,231,232,,230,231,,,,,226', -',,,,,232,,232,,,,232,,,,231,230,,,,,,,231,231,231,231,,,,231,231,232', -',,233,,231,,,232,232,232,232,232,232,,232,232,233,,233,234,,232,233', -',,,,231,,,,,234,234,,234,,,,234,,234,,233,232,,,,,,,233,233,233,233', -'233,233,,233,233,234,,,,,233,,235,234,234,234,234,234,234,,234,234,', -',,235,235,234,235,236,,,235,233,235,,,,,,,,236,236,,236,,,,236,234,236', -',235,,,,,,,,235,235,235,235,235,235,,235,235,236,,,,,235,,237,236,236', -'236,236,236,236,,236,236,,,,237,237,236,237,,,,237,235,237,,,,,,,,,', -',,,,,,236,,,237,,,,,238,,,237,237,237,237,237,237,,237,237,238,238,238', -',238,237,238,,238,,238,238,238,238,,,,,,,,,,,,,,,237,238,,,,,239,,,238', -'238,238,238,238,238,,238,238,239,239,239,,239,238,239,,239,,239,239', -'239,239,,,,,,,,,,,,,,,238,239,,,,,239,,,239,239,239,239,239,239,240', -'239,239,,,240,,,239,,,,240,240,240,,240,,240,,240,,240,240,240,240,', -',,,,239,,,,,,,,,,240,,,,240,240,,,240,240,240,240,240,240,,240,240,244', -'244,,,,240,244,,,,,,244,244,244,,244,,244,,244,,244,244,244,244,,,240', -',,,,,,,,,,,,244,,,,244,244,,251,244,244,244,244,244,244,,244,244,,,251', -'251,251,244,251,,251,,251,,251,251,251,251,,,,,,,,,,,,,244,,,251,,,', -'251,251,,,251,251,251,251,251,251,256,251,251,,,,,,251,,,,256,256,256', -'256,256,,256,,256,,256,256,256,256,,,,,,251,,,,,,,,,,256,,,,256,256', -',,256,256,256,256,256,256,,256,256,,,,,,256,,,,,,,,,,,,,,,,,,,,,,,256' ] +'372,372,372,372,372,372,380,380,372,,380,380,,380,380,,,,,,,,,,,,,,', +',380,380,,,,,,380,,380,,380,380,,380,380,380,,380,380,,,,,380,380,,', +'380,,,380,380,,,,,,,380,,,,,,380,,,,380,380,,380,380,,,,380,380,380', +'380,380,380,382,382,380,,382,382,,382,,,,,,,,,,,,,,,,,382,382,,,,,,382', +',382,,382,382,,382,382,382,,382,382,382,382,,,382,382,,,382,,,382,382', +',,,,,,382,,,,,,382,,,,382,382,,382,382,,,,382,382,382,382,382,382,383', +'383,382,,383,383,,383,,,,,,,,,,,,,,,,,383,383,,,,,,383,,383,,383,383', +',383,383,383,,383,383,383,383,,,383,383,,,383,,,383,383,,,,,,,383,,', +',,,383,,,,383,383,,383,383,,,,383,383,383,383,383,383,392,392,383,,392', +'392,,392,,,,,,,,,,,,,,,,,392,392,,,,,,392,,392,,392,392,,392,392,392', +',392,392,392,392,,,392,392,,,392,,,392,392,,,,,,,392,,,,,,392,,,,392', +'392,,392,392,,,,392,392,392,392,392,392,409,409,392,,409,409,,409,,', +',,,,,,,,,,,,,,409,409,,,,,,409,,409,,409,409,,409,409,409,,409,409,', +',,,409,409,,,409,,,409,409,,,,,,,409,,,,,,409,,,,409,409,,409,409,,', +',409,409,409,409,409,409,416,416,409,,416,416,,416,,,,,,,,,,,,,,,,,416', +'416,,,,,,416,,416,,416,416,,416,416,416,,416,416,416,416,,,416,416,', +',416,,,416,416,,,,,,,416,,,,,,416,,,,416,416,,416,416,,,,416,416,416', +'416,416,416,423,423,416,,423,423,,423,,,,,,,,,,,,,,,,,423,423,,,,,,423', +',423,,423,423,,423,423,423,,423,423,423,423,,,423,423,,,423,,,423,423', +',,,,,,423,,,,,,423,,,,423,423,,423,423,,,,423,423,423,423,423,423,426', +'426,423,,426,426,,426,,,,,,,,,,,,,,,,,426,426,,,,,,426,,426,,426,426', +',426,426,426,,426,426,426,426,,,426,426,,,426,,,426,426,,,,,,,426,,', +',,,426,,,,426,426,,426,426,,,,426,426,426,426,426,426,429,429,426,,429', +'429,,429,,,,,,,,,,,,,,,,,429,429,,,,,,429,,429,,429,429,,429,429,429', +',429,429,429,429,,,429,429,,,429,,,429,429,,,,,,,429,,,,,,429,,,,429', +'429,,429,429,,,,429,429,429,429,429,429,435,435,429,,435,435,,435,,', +',,,,,,,,,,,,,,435,435,,,,,,435,,435,,435,435,,435,435,435,,435,435,', +',,,435,435,,,435,,,435,435,,,,,,,435,,,,,,435,,,,435,435,,435,435,,', +',435,435,435,435,435,435,440,440,435,,440,440,,440,,,,,,,,,,,,,,,,,440', +'440,,,,,,440,,440,,440,440,,440,440,440,,440,440,,,,,440,440,,,440,', +',440,440,,,,,,,440,,,,,,440,,,,440,440,,440,440,,,,440,440,440,440,440', +'440,449,449,440,,449,449,,449,449,,,,,,,,,,,,,,,,449,449,,,,,,449,,449', +',449,449,,449,449,449,,449,449,449,449,,,449,449,,,449,,,449,449,,,', +',,,449,,,,,,449,,,,449,449,,449,449,,,,449,449,449,449,449,449,451,451', +'449,,451,451,,451,,,,,,,,,,,,,,,,,451,451,,,,,,451,,451,,451,451,,451', +'451,451,,451,451,451,451,,,451,451,,,451,,,451,451,,,,,,,451,,,,,,451', +',,,451,451,,451,451,,,,451,451,451,451,451,451,469,469,451,,469,469', +',469,469,,,,,,,,,,,,,,,,469,469,,,,,,469,,469,,469,469,,469,469,469', +',469,469,469,469,,,469,469,,,469,,,469,469,,,,,,,469,,,,,,469,,,,469', +'469,,469,469,,,,469,469,469,469,469,469,471,471,469,,471,471,,471,471', +',,,,,,,,,,,,,,,471,471,,,,,,471,,471,,471,471,,471,471,471,,471,471', +'471,471,,,471,471,,,471,,,471,471,,,,,,,471,,,,,,471,,,,471,471,,471', +'471,,,,471,471,471,471,471,471,473,473,471,,473,473,,473,,,,,,,,,,,', +',,,,,473,473,,,,,,473,,473,,473,473,,473,473,473,,473,473,473,473,,', +'473,473,,,473,,,473,473,,,,,,,473,,,,,,473,,,,473,473,,473,473,,,,473', +'473,473,473,473,473,476,476,473,,476,476,,476,476,,,,,,,,,,,,,,,,476', +'476,,,,,,476,,476,,476,476,,476,476,476,,476,476,476,476,,,476,476,', +',476,,,476,476,,,,,,,476,,,,,,476,,,,476,476,,476,476,,,,476,476,476', +'476,476,476,482,482,476,,482,482,,482,,,,,,,,,,,,,,,,,482,482,,,,,,482', +',482,,482,482,,482,482,482,,482,482,,,,,482,482,,,482,,,482,482,,,,', +',,482,,,,,,482,,,,482,482,,482,482,9,,,482,482,482,482,482,482,,,482', +'9,9,9,,9,,9,,9,,9,9,9,9,,,,,,,,,,,,,,,,9,,,,9,9,,,9,9,9,9,9,9,,9,9,149', +',149,,,9,,,,,,,149,149,149,,149,,149,,149,,149,149,149,149,,,9,,,,,', +',,,,,,,149,,,,149,149,,,149,149,149,149,149,149,,149,149,151,,151,,', +'149,,,,,,,151,151,151,,151,,151,,151,,151,151,151,151,,,149,,,,,,,,', +',,,,151,,,,151,151,,,151,151,151,151,151,151,,151,151,152,,152,,,151', +',,,,,,152,152,152,,152,,152,,152,,152,152,152,152,,,151,,,,,,,,,,,,', +'152,,,,152,152,,185,152,152,152,152,152,152,,152,152,,,185,185,185,152', +'185,,185,,185,,185,185,185,185,,,,,,,,,,,,,152,,,185,,,,185,185,,,185', +'185,185,185,185,185,,185,185,,,,,,185,,197,,,,,,,,,185,185,,197,197', +'197,197,197,225,197,,197,185,197,197,197,197,,,,,,225,,225,,,,225,,', +',197,,,,197,197,,,197,197,197,197,197,197,,197,197,225,,,226,,197,,', +',,225,225,,,,225,225,226,,226,230,,225,226,,,,,197,,,,,,230,,230,,,', +'230,,,,226,225,,,,,,,,,226,226,,,,226,226,230,,,231,,226,,,230,230,230', +'230,,,,230,230,231,,231,232,,230,231,,,,,226,,,,,,232,,232,,,,232,,', +',231,230,,,,,,,231,231,231,231,,,,231,231,232,,,233,,231,,,232,232,232', +'232,232,232,,232,232,233,,233,234,,232,233,,,,,231,,,,,234,234,,234', +',,,234,,234,,233,232,,,,,,,233,233,233,233,233,233,,233,233,234,,,,', +'233,,235,234,234,234,234,234,234,,234,234,,,,235,235,234,235,236,,,235', +'233,235,,,,,,,,236,236,,236,,,,236,234,236,,235,,,,,,,,235,235,235,235', +'235,235,,235,235,236,,,,,235,,237,236,236,236,236,236,236,,236,236,', +',,237,237,236,237,,,,237,235,237,,,,,,,,,,,,,,,,236,,,237,,,,,238,,', +'237,237,237,237,237,237,,237,237,238,238,238,,238,237,238,,238,,238', +'238,238,238,,,,,,,,,,,,,,,237,238,,,,,239,,,238,238,238,238,238,238', +',238,238,239,239,239,,239,238,239,,239,,239,239,239,239,,,,,,,,,,,,', +',,238,239,,,,,239,,,239,239,239,239,239,239,240,239,239,,,240,,,239', +',,,240,240,240,,240,,240,,240,,240,240,240,240,,,,,,239,,,,,,,,,,240', +',,,240,240,,,240,240,240,240,240,240,,240,240,244,244,,,,240,244,,,', +',,244,244,244,,244,,244,,244,,244,244,244,244,,,240,,,,,,,,,,,,,244', +',,,244,244,,251,244,244,244,244,244,244,,244,244,,,251,251,251,244,251', +',251,,251,,251,251,251,251,,,,,,,,,,,,,244,,,251,,,,251,251,,,251,251', +'251,251,251,251,256,251,251,,,,,,251,,,,256,256,256,256,256,,256,,256', +',256,256,256,256,,,,,,251,,,,,,,,,,256,,,,256,256,,378,256,256,256,256', +'256,256,,256,256,,,378,378,378,256,378,,378,,378,,378,378,378,378,,', +',,,,,,,,,,256,,,378,,,,378,378,,404,378,378,378,378,378,378,,378,378', +',,404,404,404,378,404,,404,,404,,404,404,404,404,,,,,,,,,,,,,378,,,404', +',,,404,404,,405,404,404,404,404,404,404,,404,404,,,405,405,405,404,405', +',405,,405,,405,405,405,405,,,,,,,,,,,,,404,,,405,,,,405,405,,406,405', +'405,405,405,405,405,,405,405,,,406,406,406,405,406,,406,,406,,406,406', +'406,406,,,,,,,,,,,,,405,,,406,,,,406,406,,407,406,406,406,406,406,406', +',406,406,,,407,407,407,406,407,,407,,407,,407,407,407,407,,,,,,,,,,', +',,406,,,407,,,,407,407,,432,407,407,407,407,407,407,,407,407,,,432,432', +'432,407,432,,432,,432,,432,432,432,432,,,,,,,,,,,,,407,,,432,,,,432', +'432,,472,432,432,432,432,432,432,,432,432,,,472,472,472,432,472,,472', +',472,,472,472,472,472,,,,,,,,,,,,,432,,,472,,,,472,472,,,472,472,472', +'472,472,472,,472,472,,,,,,472,,,,,,,,,,,,,,,,,,,,,,,472' ] racc_action_check = arr = ::Array.new(9761, nil) idx = 0 clist.each do |str| @@ -647,56 +646,56 @@ class Parser < Racc::Parser end racc_action_pointer = [ - 259, 420, nil, nil, 1390, 389, nil, 85, 392, 8471, - 7741, 8002, 403, nil, nil, nil, 8176, 955, 1042, 1129, - 1216, nil, nil, nil, nil, nil, nil, nil, nil, nil, + -2, 6, nil, nil, 85, 21, nil, -8, 38, 8423, + 172, 259, 95, nil, nil, nil, 346, 433, 520, 607, + 694, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - nil, nil, nil, nil, nil, nil, nil, 1303, -21, 327, - 371, 1651, 1738, 1825, 376, 413, 347, 665, 66, 355, - nil, nil, nil, 2434, 2521, 2608, nil, nil, nil, nil, - nil, 2695, nil, 283, 284, nil, 2956, nil, nil, 354, - 3130, 338, 3304, 3391, 3478, 3565, 3652, 3739, 3826, 3913, - 4000, 4087, 4174, 4261, 4348, 4435, 4522, 4609, 4696, 4783, - 4870, 4957, 5044, 5131, 5218, 5305, 5392, 5479, 5566, 5653, - 5740, nil, -22, 331, 6001, 6088, 327, 310, 6349, 122, - nil, nil, nil, nil, nil, nil, 608, 500, 639, 204, - 284, 283, 290, nil, nil, 285, 215, 20, 455, 266, - nil, nil, 267, nil, 28, nil, 208, 87, 7915, 8817, - nil, 8875, 8933, 218, 214, 8350, 233, nil, 185, nil, - nil, nil, nil, nil, nil, 52, 7, 174, nil, nil, - 146, nil, 84, nil, 97, nil, nil, nil, nil, 129, - nil, nil, 194, 346, 56, 8981, 172, nil, 77, nil, - nil, nil, nil, 32, 505, 504, 494, 9046, 483, 6697, - 3, 6, 9, 0, 6523, 5827, 2260, nil, nil, -1, - 325, 326, 752, 327, -4, -10, nil, nil, nil, nil, - nil, nil, 552, 5, 92, 9063, 9107, 866, 953, -4, - 9124, 9168, 9185, 9229, 9246, 9294, 9311, 9359, 9405, 9451, - 9506, nil, nil, 2173, 9564, 463, nil, nil, nil, nil, - 150, 9612, 423, nil, 426, 405, 9667, nil, 408, nil, - 783, 457, nil, nil, 7132, 416, nil, 7045, 6871, 8089, - 404, 449, 412, nil, nil, 451, nil, nil, nil, nil, - nil, 449, 430, -28, 52, nil, 1912, 1999, 6610, 472, - 473, 473, 450, 578, -29, 438, 184, nil, nil, 493, - 6784, 502, nil, 7306, nil, nil, nil, nil, 7393, nil, - nil, nil, nil, -3, nil, nil, nil, nil, 10, 24, - 1020, 61, 237, 868, 781, 694, 607, 108, nil, 136, - 520, 153, nil, 165, nil, nil, nil, nil, nil, nil, - nil, nil, nil, nil, nil, nil, nil, nil, 170, 433, - 1107, 192, nil, 450, nil, 202, nil, 211, nil, 156, - nil, 133, 222, 233, nil, 85, 242, 181, 59, -2, - nil, nil, 8263, nil, 244, 131, 254, 233, 8759, 125, - 7654, nil, 7567, 7480, 252, 274, nil, 404, nil, nil, - 275, nil, 7219, nil, nil, nil, nil, nil, nil, 216, - 157, 280, nil, nil, 8711, 8423, 8663, 8615, 304, 6436, - nil, nil, 305, nil, nil, 305, 6262, nil, nil, nil, - 297, 298, nil, 6175, nil, nil, 5914, 331, nil, 3217, - nil, nil, 8567, 121, nil, 2869, 348, 324, nil, 350, - 2782, 352, nil, nil, 352, nil, nil, 356, 361, 2347, - nil, 2086, 367, nil, nil, 375, 346, nil, nil, nil, - nil, 384, nil, nil, 385, nil, 92, nil, nil, 1564, - nil, 1477, 8519, 6958, nil, nil, 3043, 398, nil, 403, - 408, nil, 7828, nil, nil, nil, 413, nil, 417, nil, - 418, nil, nil, 428, nil, nil, nil, nil, 400, nil, + nil, nil, nil, nil, nil, nil, nil, 781, 40, -21, + 41, 868, 955, 1042, 60, 115, 53, 317, 238, 84, + nil, nil, nil, 1129, 1216, 1303, nil, nil, nil, nil, + nil, 1390, nil, 31, 62, nil, 1477, nil, nil, 148, + 1564, 142, 1651, 1738, 1825, 1912, 1999, 2086, 2173, 2260, + 2347, 2434, 2521, 2608, 2695, 2782, 2869, 2956, 3043, 3130, + 3217, 3304, 3391, 3478, 3565, 3652, 3739, 3826, 3913, 4000, + 4087, nil, -5, 157, 4174, 4261, 173, 178, 4348, 132, + nil, nil, nil, nil, nil, nil, 204, 239, 378, 434, + 163, 178, 212, nil, nil, 215, 160, 117, 240, 237, + nil, nil, 257, nil, 32, nil, 206, 66, 4435, 8481, + nil, 8539, 8597, 212, 227, 4522, 262, nil, 258, nil, + nil, nil, nil, nil, nil, 243, 4, 270, nil, nil, + 272, nil, 274, nil, 6, nil, nil, nil, nil, 267, + nil, nil, 194, 4609, 143, 8645, 4696, nil, 280, nil, + nil, nil, nil, 289, 293, 298, 299, 8710, 298, 4783, + -9, 2, 9, 127, 4870, 4957, 5044, nil, nil, 10, + 289, 316, 404, 319, 15, 17, nil, nil, nil, nil, + nil, nil, 465, 5, 92, 8727, 8771, 953, 1040, 1475, + 8788, 8832, 8849, 8893, 8910, 8958, 8975, 9023, 9069, 9115, + 9170, nil, nil, 5131, 9228, 299, nil, nil, nil, nil, + 150, 9276, 265, nil, 291, 283, 9331, nil, 290, nil, + 522, 526, nil, nil, 5218, 305, nil, 5305, 5392, 5479, + 286, 331, 291, nil, nil, 338, nil, nil, nil, nil, + nil, 340, 323, -35, 2, nil, 5566, 5653, 5740, 354, + 356, 354, 331, 491, -25, 313, 11, nil, nil, 367, + 5827, 369, nil, 5914, nil, nil, nil, nil, 6001, nil, + nil, nil, nil, 365, nil, nil, nil, nil, 368, 379, + 585, 384, 672, 6088, 6175, 6262, 6349, 382, nil, 390, + 6436, 389, nil, 396, nil, nil, nil, nil, nil, nil, + nil, nil, nil, nil, nil, nil, nil, nil, 399, 6523, + 1107, 403, nil, 326, nil, 400, nil, 401, nil, 343, + nil, 133, 406, 409, nil, 6610, 412, 348, 56, 6697, + nil, nil, 6784, nil, 413, 73, 417, 394, 9379, 83, + 6871, nil, 6958, 7045, 410, 434, nil, 839, nil, nil, + 435, nil, 7132, nil, nil, nil, nil, nil, nil, 373, + 192, 434, nil, nil, 9427, 9475, 9523, 9571, 438, 7219, + nil, nil, 440, nil, nil, 438, 7306, nil, nil, nil, + 424, 425, nil, 7393, nil, nil, 7480, 444, nil, 7567, + nil, nil, 9619, 115, nil, 7654, 447, 424, nil, 453, + 7741, 454, nil, nil, 454, nil, nil, 455, 458, 7828, + nil, 7915, 463, nil, nil, 471, 442, nil, nil, nil, + nil, 479, nil, nil, 485, nil, 139, nil, nil, 8002, + nil, 8089, 9667, 8176, nil, nil, 8263, 486, nil, 489, + 492, nil, 8350, nil, nil, nil, 491, nil, 492, nil, + 493, nil, nil, 495, nil, nil, nil, nil, 463, nil, nil, nil, nil, nil ] racc_action_default = [ @@ -756,7 +755,7 @@ class Parser < Racc::Parser 2, 161, 176, 255, 126, 128, 129, 245, 159, 130, 131, 198, 142, 169, 169, 242, 348, 145, 178, 311, 271, 297, 275, 170, 170, 153, 253, 253, 315, 165, - 143, 135, 388, 309, 411, 3, 381, 132, 81, 149, + 143, 135, 388, 1, 411, 3, 381, 132, 81, 149, 151, 152, 455, 444, 447, 252, 254, 247, 438, 434, 167, 172, 414, 132, 132, 177, 241, 298, 273, 313, 364, 180, 468, 380, 185, 116, 117, 490, 327, 403, @@ -765,7 +764,7 @@ class Parser < Racc::Parser 233, 234, 235, 236, 237, 238, 239, 240, 244, 385, 177, 142, 251, 251, 266, 362, 256, 467, 470, 165, 389, 142, 479, 431, 188, 371, 370, 360, 258, 143, - 394, 1, 310, 176, 307, 265, 450, 411, 443, 308, + 394, 309, 310, 176, 307, 265, 450, 411, 443, 308, 296, 306, 284, 181, 183, 355, 357, nil, 132, 291, nil, 193, 194, 195, 196, 132, 292, nil, 142, 328, nil, 391, 289, 290, nil, nil, 161, 299, nil, nil, @@ -806,7 +805,7 @@ class Parser < Racc::Parser 2, 44, 9, 15, 12, 12, 12, 23, 45, 6, 6, 13, 46, 8, 8, 62, 16, 48, 97, 87, 52, 43, 54, 92, 92, 69, 61, 61, 104, 69, - 85, 10, 77, 93, 24, 3, 59, 6, 5, 12, + 85, 10, 77, 1, 24, 3, 59, 6, 5, 12, 12, 12, 14, 71, 71, 65, 65, 9, 57, 56, 88, 88, 18, 6, 6, 6, 22, 42, 61, 54, 53, 6, 55, 58, 12, 11, 11, 60, 63, 66, @@ -815,7 +814,7 @@ class Parser < Racc::Parser 12, 12, 12, 12, 12, 12, 12, 12, 12, 76, 6, 46, 12, 12, 48, 87, 12, 56, 57, 69, 79, 46, 71, 80, 5, 81, 83, 90, 70, 85, - 91, 1, 94, 9, 98, 17, 77, 24, 59, 99, + 91, 93, 94, 9, 98, 17, 77, 24, 59, 99, 46, 101, 10, 102, 103, 54, 54, nil, 6, 10, nil, 11, 11, 11, 11, 6, 17, nil, 46, 62, nil, 43, 70, 70, nil, nil, 44, 17, nil, nil, @@ -853,7 +852,7 @@ class Parser < Racc::Parser 12, 2, nil, 2, nil, nil, 2 ] racc_goto_pointer = [ - nil, 121, 0, 35, nil, 34, -10, nil, -50, -63, + nil, 33, 0, 35, nil, 34, -10, nil, -50, -63, -16, 55, -12, -79, -359, -115, -239, -10, -297, nil, nil, nil, -53, -103, -296, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, @@ -862,7 +861,7 @@ class Parser < Racc::Parser -406, -88, -94, -175, nil, -69, -253, nil, nil, -29, -1, -339, 15, -187, -277, nil, -193, -261, nil, -184, -255, -168, nil, -166, nil, -18, nil, -164, -13, nil, - -150, -180, -40, -149, -60, nil, nil, -53, -55, -50, + -150, -180, -40, -61, -60, nil, nil, -53, -55, -50, nil, -48, 60, 60, -157 ] racc_goto_default = [ @@ -1492,28 +1491,28 @@ class Parser < Racc::Parser module_eval(<<'.,.,', 'egrammar.ra', 67) def _reduce_1(val, _values, result) - result = create_program(Factory.block_or_expression(val[0])) + result = create_program(Factory.block_or_expression(val[0])) result end .,., module_eval(<<'.,.,', 'egrammar.ra', 68) def _reduce_2(val, _values, result) - result = create_program(val[0]) + result = create_program(val[0]) result end .,., module_eval(<<'.,.,', 'egrammar.ra', 69) def _reduce_3(val, _values, result) - result = create_empty_program + result = create_empty_program result end .,., module_eval(<<'.,.,', 'egrammar.ra', 73) def _reduce_4(val, _values, result) - result = transform_calls(val[0]) + result = transform_calls(val[0]) result end .,., @@ -1527,28 +1526,28 @@ def _reduce_5(val, _values, result) module_eval(<<'.,.,', 'egrammar.ra', 81) def _reduce_6(val, _values, result) - result = val[0].push val[2] + result = val[0].push val[2] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 82) def _reduce_7(val, _values, result) - result = val[0].push val[1] + result = val[0].push val[1] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 89) def _reduce_8(val, _values, result) - result = val[0] + result = val[0] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 90) def _reduce_9(val, _values, result) - result = aryfy(val[0]).push(val[1]).push(val[2]) + result = aryfy(val[0]).push(val[1]).push(val[2]) result end .,., @@ -1557,21 +1556,21 @@ def _reduce_9(val, _values, result) module_eval(<<'.,.,', 'egrammar.ra', 95) def _reduce_11(val, _values, result) - result = val[0].set(val[2]) ; loc result, val[1] + result = val[0].set(val[2]) ; loc result, val[1] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 96) def _reduce_12(val, _values, result) - result = val[0].plus_set(val[2]) ; loc result, val[1] + result = val[0].plus_set(val[2]) ; loc result, val[1] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 97) def _reduce_13(val, _values, result) - result = val[0].minus_set(val[2]); loc result, val[1] + result = val[0].minus_set(val[2]); loc result, val[1] result end .,., @@ -1580,21 +1579,21 @@ def _reduce_13(val, _values, result) module_eval(<<'.,.,', 'egrammar.ra', 102) def _reduce_15(val, _values, result) - result = Factory.HASH_UNFOLDED([val[0]]); loc result, val[0] + result = Factory.HASH_UNFOLDED([val[0]]); loc result, val[0] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 106) def _reduce_16(val, _values, result) - result = [val[0]] + result = [val[0]] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 107) def _reduce_17(val, _values, result) - result = Factory.ARGUMENTS(val[0], val[2]) + result = Factory.ARGUMENTS(val[0], val[2]) result end .,., @@ -1603,28 +1602,28 @@ def _reduce_17(val, _values, result) module_eval(<<'.,.,', 'egrammar.ra', 111) def _reduce_19(val, _values, result) - result = val[0].relop(val[1][:value], val[2]); loc result, val[1] + result = val[0].relop(val[1][:value], val[2]); loc result, val[1] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 112) def _reduce_20(val, _values, result) - result = val[0].relop(val[1][:value], val[2]); loc result, val[1] + result = val[0].relop(val[1][:value], val[2]); loc result, val[1] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 113) def _reduce_21(val, _values, result) - result = val[0].relop(val[1][:value], val[2]); loc result, val[1] + result = val[0].relop(val[1][:value], val[2]); loc result, val[1] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 114) def _reduce_22(val, _values, result) - result = val[0].relop(val[1][:value], val[2]); loc result, val[1] + result = val[0].relop(val[1][:value], val[2]); loc result, val[1] result end .,., @@ -1640,7 +1639,7 @@ def _reduce_24(val, _values, result) end # relocate the result loc result, val[0], val[1] - + result end .,., @@ -1654,7 +1653,7 @@ def _reduce_25(val, _values, result) end # relocate the result loc result, val[0], val[1] - + result end .,., @@ -1664,7 +1663,7 @@ def _reduce_26(val, _values, result) bodies = [Factory.RESOURCE_BODY(val[2], val[4])] + val[5] result = Factory.RESOURCE(val[0], bodies) loc result, val[0], val[6] - + result end .,., @@ -1673,7 +1672,7 @@ def _reduce_26(val, _values, result) def _reduce_27(val, _values, result) result = Factory.RESOURCE(Factory.fqn(token_text(val[0])), val[2]) loc result, val[0], val[4] - + result end .,., @@ -1699,49 +1698,49 @@ def _reduce_28(val, _values, result) error val[0], "Expression is not valid as a resource, resource-default, or resource-override" end loc result, val[0], val[4] - + result end .,., module_eval(<<'.,.,', 'egrammar.ra', 183) def _reduce_29(val, _values, result) - result = Factory.RESOURCE_BODY(val[0], val[2]) + result = Factory.RESOURCE_BODY(val[0], val[2]) result end .,., module_eval(<<'.,.,', 'egrammar.ra', 186) def _reduce_30(val, _values, result) - result = [val[0]] + result = [val[0]] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 187) def _reduce_31(val, _values, result) - result = val[0].push val[2] + result = val[0].push val[2] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 193) def _reduce_32(val, _values, result) - result = [] + result = [] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 194) def _reduce_33(val, _values, result) - result = [] + result = [] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 195) def _reduce_34(val, _values, result) - result = val[2] + result = val[2] result end .,., @@ -1754,189 +1753,189 @@ def _reduce_34(val, _values, result) module_eval(<<'.,.,', 'egrammar.ra', 203) def _reduce_38(val, _values, result) - result = val[0].in val[2] ; loc result, val[1] + result = val[0].in val[2] ; loc result, val[1] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 204) def _reduce_39(val, _values, result) - result = val[0] =~ val[2] ; loc result, val[1] + result = val[0] =~ val[2] ; loc result, val[1] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 205) def _reduce_40(val, _values, result) - result = val[0].mne val[2] ; loc result, val[1] + result = val[0].mne val[2] ; loc result, val[1] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 206) def _reduce_41(val, _values, result) - result = val[0] + val[2] ; loc result, val[1] + result = val[0] + val[2] ; loc result, val[1] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 207) def _reduce_42(val, _values, result) - result = val[0] - val[2] ; loc result, val[1] + result = val[0] - val[2] ; loc result, val[1] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 208) def _reduce_43(val, _values, result) - result = val[0] / val[2] ; loc result, val[1] + result = val[0] / val[2] ; loc result, val[1] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 209) def _reduce_44(val, _values, result) - result = val[0] * val[2] ; loc result, val[1] + result = val[0] * val[2] ; loc result, val[1] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 210) def _reduce_45(val, _values, result) - result = val[0] % val[2] ; loc result, val[1] + result = val[0] % val[2] ; loc result, val[1] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 211) def _reduce_46(val, _values, result) - result = val[0] << val[2] ; loc result, val[1] + result = val[0] << val[2] ; loc result, val[1] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 212) def _reduce_47(val, _values, result) - result = val[0] >> val[2] ; loc result, val[1] + result = val[0] >> val[2] ; loc result, val[1] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 213) def _reduce_48(val, _values, result) - result = val[1].minus ; loc result, val[0] + result = val[1].minus ; loc result, val[0] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 214) def _reduce_49(val, _values, result) - result = val[1].unfold ; loc result, val[0] + result = val[1].unfold ; loc result, val[0] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 215) def _reduce_50(val, _values, result) - result = val[0].ne val[2] ; loc result, val[1] + result = val[0].ne val[2] ; loc result, val[1] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 216) def _reduce_51(val, _values, result) - result = val[0].eq val[2] ; loc result, val[1] + result = val[0].eq val[2] ; loc result, val[1] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 217) def _reduce_52(val, _values, result) - result = val[0] > val[2] ; loc result, val[1] + result = val[0] > val[2] ; loc result, val[1] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 218) def _reduce_53(val, _values, result) - result = val[0] >= val[2] ; loc result, val[1] + result = val[0] >= val[2] ; loc result, val[1] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 219) def _reduce_54(val, _values, result) - result = val[0] < val[2] ; loc result, val[1] + result = val[0] < val[2] ; loc result, val[1] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 220) def _reduce_55(val, _values, result) - result = val[0] <= val[2] ; loc result, val[1] + result = val[0] <= val[2] ; loc result, val[1] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 221) def _reduce_56(val, _values, result) - result = val[1].not ; loc result, val[0] + result = val[1].not ; loc result, val[0] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 222) def _reduce_57(val, _values, result) - result = val[0].and val[2] ; loc result, val[1] + result = val[0].and val[2] ; loc result, val[1] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 223) def _reduce_58(val, _values, result) - result = val[0].or val[2] ; loc result, val[1] + result = val[0].or val[2] ; loc result, val[1] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 224) def _reduce_59(val, _values, result) - result = val[0].select(*val[2]) ; loc result, val[0] + result = val[0].select(*val[2]) ; loc result, val[0] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 225) def _reduce_60(val, _values, result) - result = val[1].paren ; loc result, val[0] + result = val[1].paren ; loc result, val[0] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 226) def _reduce_61(val, _values, result) - result = val[1].paren ; loc result, val[0] + result = val[1].paren ; loc result, val[0] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 229) def _reduce_62(val, _values, result) - result = val[0].access(val[2]); loc result, val[0], val[4] + result = val[0].access(val[2]); loc result, val[0], val[4] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 232) def _reduce_63(val, _values, result) - result = [val[0]] + result = [val[0]] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 233) def _reduce_64(val, _values, result) - result = Factory.ARGUMENTS(val[0], val[2]) + result = Factory.ARGUMENTS(val[0], val[2]) result end .,., @@ -1945,21 +1944,21 @@ def _reduce_64(val, _values, result) module_eval(<<'.,.,', 'egrammar.ra', 237) def _reduce_66(val, _values, result) - result = Factory.HASH_UNFOLDED([val[0]]); loc result, val[0] + result = Factory.HASH_UNFOLDED([val[0]]); loc result, val[0] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 246) def _reduce_67(val, _values, result) - result = [val[0]] + result = [val[0]] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 247) def _reduce_68(val, _values, result) - result = val[0].push(val[2]) + result = val[0].push(val[2]) result end .,., @@ -2008,35 +2007,35 @@ def _reduce_68(val, _values, result) module_eval(<<'.,.,', 'egrammar.ra', 271) def _reduce_90(val, _values, result) - result = Factory.NUMBER(val[0][:value]) ; loc result, val[0] + result = Factory.NUMBER(val[0][:value]) ; loc result, val[0] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 272) def _reduce_91(val, _values, result) - result = Factory.literal(val[0][:value]) ; loc result, val[0] + result = Factory.literal(val[0][:value]) ; loc result, val[0] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 273) def _reduce_92(val, _values, result) - result = Factory.literal(:default) ; loc result, val[0] + result = Factory.literal(:default) ; loc result, val[0] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 274) def _reduce_93(val, _values, result) - result = Factory.literal(:undef) ; loc result, val[0] + result = Factory.literal(:undef) ; loc result, val[0] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 275) def _reduce_94(val, _values, result) - result = Factory.QNAME_OR_NUMBER(val[0][:value]) ; loc result, val[0] + result = Factory.QNAME_OR_NUMBER(val[0][:value]) ; loc result, val[0] result end .,., @@ -2045,7 +2044,7 @@ def _reduce_94(val, _values, result) def _reduce_95(val, _values, result) result = Factory.CALL_NAMED(val[0], true, val[1]) loc result, val[0], val[3] - + result end .,., @@ -2054,7 +2053,7 @@ def _reduce_95(val, _values, result) def _reduce_96(val, _values, result) result = Factory.CALL_NAMED(val[0], true, []) loc result, val[0], val[1] - + result end .,., @@ -2064,7 +2063,7 @@ def _reduce_97(val, _values, result) result = Factory.CALL_NAMED(val[0], true, val[1]) loc result, val[0], val[4] result.lambda = val[4] - + result end .,., @@ -2074,56 +2073,56 @@ def _reduce_98(val, _values, result) result = Factory.CALL_NAMED(val[0], true, []) loc result, val[0], val[2] result.lambda = val[2] - + result end .,., module_eval(<<'.,.,', 'egrammar.ra', 303) def _reduce_99(val, _values, result) - result = val[0] + result = val[0] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 304) def _reduce_100(val, _values, result) - result = Factory.QNAME(val[0][:value]); loc result, val[0] + result = Factory.QNAME(val[0][:value]); loc result, val[0] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 309) def _reduce_101(val, _values, result) - result = val[0] + result = val[0] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 310) def _reduce_102(val, _values, result) - result = val[0]; val[0].lambda = val[1] + result = val[0]; val[0].lambda = val[1] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 313) def _reduce_103(val, _values, result) - result = Factory.CALL_METHOD(val[0], val[2]); loc result, val[1], val[3] + result = Factory.CALL_METHOD(val[0], val[2]); loc result, val[1], val[3] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 314) def _reduce_104(val, _values, result) - result = Factory.CALL_METHOD(val[0], []); loc result, val[1], val[3] + result = Factory.CALL_METHOD(val[0], []); loc result, val[1], val[3] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 315) def _reduce_105(val, _values, result) - result = Factory.CALL_METHOD(val[0], []); loc result, val[0] + result = Factory.CALL_METHOD(val[0], []); loc result, val[0] result end .,., @@ -2132,7 +2131,7 @@ def _reduce_105(val, _values, result) def _reduce_106(val, _values, result) result = val[0].dot(Factory.fqn(val[2][:value])) loc result, val[1], val[2] - + result end .,., @@ -2141,7 +2140,7 @@ def _reduce_106(val, _values, result) def _reduce_107(val, _values, result) result = val[0].dot(Factory.fqn(val[2][:value])) loc result, val[1], val[2] - + result end .,., @@ -2150,35 +2149,35 @@ def _reduce_107(val, _values, result) def _reduce_108(val, _values, result) result = Factory.LAMBDA(val[0][:value], val[2][:value], val[1]) loc result, val[0][:start], val[2][:end] - + result end .,., module_eval(<<'.,.,', 'egrammar.ra', 336) def _reduce_109(val, _values, result) - result = {:end => val[2], :value =>val[1] } + result = {:end => val[2], :value =>val[1] } result end .,., module_eval(<<'.,.,', 'egrammar.ra', 337) def _reduce_110(val, _values, result) - result = {:end => val[1], :value => nil } + result = {:end => val[1], :value => nil } result end .,., module_eval(<<'.,.,', 'egrammar.ra', 341) def _reduce_111(val, _values, result) - result = {:start => val[0], :value => [] } + result = {:start => val[0], :value => [] } result end .,., module_eval(<<'.,.,', 'egrammar.ra', 342) def _reduce_112(val, _values, result) - result = {:start => val[0], :value => val[1] } + result = {:start => val[0], :value => val[1] } result end .,., @@ -2187,7 +2186,7 @@ def _reduce_112(val, _values, result) def _reduce_113(val, _values, result) result = val[1] loc(result, val[0], val[1]) - + result end .,., @@ -2196,7 +2195,7 @@ def _reduce_113(val, _values, result) def _reduce_114(val, _values, result) result = Factory.IF(val[0], Factory.block_or_expression(val[2], val[1], val[3]), val[4]) loc(result, val[0], (val[4] ? val[4] : val[3])) - + result end .,., @@ -2205,7 +2204,7 @@ def _reduce_114(val, _values, result) def _reduce_115(val, _values, result) result = Factory.IF(val[0], nil, val[3]) loc(result, val[0], (val[3] ? val[3] : val[2])) - + result end .,., @@ -2216,7 +2215,7 @@ def _reduce_115(val, _values, result) def _reduce_117(val, _values, result) result = val[1] loc(result, val[0], val[1]) - + result end .,., @@ -2224,7 +2223,7 @@ def _reduce_117(val, _values, result) module_eval(<<'.,.,', 'egrammar.ra', 373) def _reduce_118(val, _values, result) result = Factory.block_or_expression(val[2], val[1], val[3]) - + result end .,., @@ -2232,7 +2231,7 @@ def _reduce_118(val, _values, result) module_eval(<<'.,.,', 'egrammar.ra', 376) def _reduce_119(val, _values, result) result = nil # don't think a nop is needed here either - + result end .,., @@ -2241,7 +2240,7 @@ def _reduce_119(val, _values, result) def _reduce_120(val, _values, result) result = Factory.UNLESS(val[1], Factory.block_or_expression(val[3], val[2], val[4]), val[5]) loc result, val[0], val[4] - + result end .,., @@ -2250,7 +2249,7 @@ def _reduce_120(val, _values, result) def _reduce_121(val, _values, result) result = Factory.UNLESS(val[1], nil, val[4]) loc result, val[0], val[4] - + result end .,., @@ -2260,7 +2259,7 @@ def _reduce_121(val, _values, result) module_eval(<<'.,.,', 'egrammar.ra', 397) def _reduce_123(val, _values, result) result = Factory.block_or_expression(val[2], val[1], val[3]) - + result end .,., @@ -2268,7 +2267,7 @@ def _reduce_123(val, _values, result) module_eval(<<'.,.,', 'egrammar.ra', 400) def _reduce_124(val, _values, result) result = nil # don't think a nop is needed here either - + result end .,., @@ -2277,21 +2276,21 @@ def _reduce_124(val, _values, result) def _reduce_125(val, _values, result) result = Factory.CASE(val[1], *val[3]) loc result, val[0], val[4] - + result end .,., module_eval(<<'.,.,', 'egrammar.ra', 413) def _reduce_126(val, _values, result) - result = [val[0]] + result = [val[0]] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 414) def _reduce_127(val, _values, result) - result = val[0].push val[1] + result = val[0].push val[1] result end .,., @@ -2299,7 +2298,7 @@ def _reduce_127(val, _values, result) module_eval(<<'.,.,', 'egrammar.ra', 419) def _reduce_128(val, _values, result) result = Factory.WHEN(val[0], val[3]); loc result, val[1], val[4] - + result end .,., @@ -2313,28 +2312,28 @@ def _reduce_128(val, _values, result) module_eval(<<'.,.,', 'egrammar.ra', 435) def _reduce_132(val, _values, result) result = val[1] - + result end .,., module_eval(<<'.,.,', 'egrammar.ra', 440) def _reduce_133(val, _values, result) - result = [val[0]] + result = [val[0]] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 441) def _reduce_134(val, _values, result) - result = val[0].push val[2] + result = val[0].push val[2] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 446) def _reduce_135(val, _values, result) - result = Factory.MAP(val[0], val[2]) ; loc result, val[1] + result = Factory.MAP(val[0], val[2]) ; loc result, val[1] result end .,., @@ -2343,7 +2342,7 @@ def _reduce_135(val, _values, result) def _reduce_136(val, _values, result) result = Factory.COLLECT(val[0], val[1], val[3]) loc result, val[0], val[5] - + result end .,., @@ -2352,21 +2351,21 @@ def _reduce_136(val, _values, result) def _reduce_137(val, _values, result) result = Factory.COLLECT(val[0], val[1], []) loc result, val[0], val[1] - + result end .,., module_eval(<<'.,.,', 'egrammar.ra', 465) def _reduce_138(val, _values, result) - result = Factory.VIRTUAL_QUERY(val[1]) ; loc result, val[0], val[2] + result = Factory.VIRTUAL_QUERY(val[1]) ; loc result, val[0], val[2] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 466) def _reduce_139(val, _values, result) - result = Factory.EXPORTED_QUERY(val[1]) ; loc result, val[0], val[2] + result = Factory.EXPORTED_QUERY(val[1]) ; loc result, val[0], val[2] result end .,., @@ -2377,21 +2376,21 @@ def _reduce_139(val, _values, result) module_eval(<<'.,.,', 'egrammar.ra', 475) def _reduce_142(val, _values, result) - result = [] + result = [] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 476) def _reduce_143(val, _values, result) - result = [val[0]] + result = [val[0]] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 477) def _reduce_144(val, _values, result) - result = val[0].push(val[2]) + result = val[0].push(val[2]) result end .,., @@ -2404,7 +2403,7 @@ def _reduce_144(val, _values, result) def _reduce_147(val, _values, result) result = Factory.ATTRIBUTE_OP(val[0][:value], '=>', val[2]) loc result, val[0], val[2] - + result end .,., @@ -2413,7 +2412,7 @@ def _reduce_147(val, _values, result) def _reduce_148(val, _values, result) result = Factory.ATTRIBUTE_OP(val[0][:value], '+>', val[2]) loc result, val[0], val[2] - + result end .,., @@ -2421,7 +2420,7 @@ def _reduce_148(val, _values, result) module_eval(<<'.,.,', 'egrammar.ra', 500) def _reduce_149(val, _values, result) result = Factory.ATTRIBUTES_OP(val[2]) ; loc result, val[0], val[2] - + result end .,., @@ -2435,7 +2434,7 @@ def _reduce_150(val, _values, result) if @lexer.respond_to?(:'indefine=') @lexer.indefine = false end - + result end .,., @@ -2447,7 +2446,7 @@ def _reduce_151(val, _values, result) definition = Factory.PLAN(classname(val[1][:value]), val[2], val[4]) loc(definition, val[0], val[5]) result = add_definition(definition) - + result end .,., @@ -2456,7 +2455,7 @@ def _reduce_151(val, _values, result) def _reduce_152(val, _values, result) result = Factory.APPLY(val[2], Factory.APPLY_BLOCK(val[6])) loc result, val[0], val[7] - + result end .,., @@ -2465,7 +2464,7 @@ def _reduce_152(val, _values, result) def _reduce_153(val, _values, result) result = Factory.APPLY(val[2], Factory.APPLY_BLOCK([])) loc result, val[0], val[6] - + result end .,., @@ -2477,14 +2476,14 @@ def _reduce_154(val, _values, result) definition = Factory.HOSTCLASS(classname(val[1][:value]), val[2], token_text(val[3]), val[5]) loc(definition, val[0], val[6]) result = add_definition(definition) - + result end .,., module_eval(<<'.,.,', 'egrammar.ra', 555) def _reduce_155(val, _values, result) - namestack(val[0][:value]) ; result = val[0] + namestack(val[0][:value]) ; result = val[0] result end .,., @@ -2497,7 +2496,7 @@ def _reduce_155(val, _values, result) module_eval(<<'.,.,', 'egrammar.ra', 564) def _reduce_159(val, _values, result) - result = val[1] + result = val[1] result end .,., @@ -2511,7 +2510,7 @@ def _reduce_162(val, _values, result) definition = Factory.NODE(val[1], val[3], val[5]) loc(definition, val[0], val[6]) result = add_definition(definition) - + result end .,., @@ -2521,21 +2520,21 @@ def _reduce_163(val, _values, result) definition = Factory.NODE(val[1], val[3], nil) loc(definition, val[0], val[5]) result = add_definition(definition) - + result end .,., module_eval(<<'.,.,', 'egrammar.ra', 597) def _reduce_164(val, _values, result) - result = [result] + result = [result] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 598) def _reduce_165(val, _values, result) - result = val[0].push(val[2]) + result = val[0].push(val[2]) result end .,., @@ -2546,7 +2545,7 @@ def _reduce_165(val, _values, result) module_eval(<<'.,.,', 'egrammar.ra', 605) def _reduce_168(val, _values, result) - result = Factory.literal(:default); loc result, val[0] + result = Factory.literal(:default); loc result, val[0] result end .,., @@ -2555,14 +2554,14 @@ def _reduce_168(val, _values, result) module_eval(<<'.,.,', 'egrammar.ra', 609) def _reduce_170(val, _values, result) - result = Factory.literal(val[0][:value]); loc result, val[0] + result = Factory.literal(val[0][:value]); loc result, val[0] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 610) def _reduce_171(val, _values, result) - result = Factory.concat(val[0], '.', val[2][:value]); loc result, val[0], val[2] + result = Factory.concat(val[0], '.', val[2][:value]); loc result, val[0], val[2] result end .,., @@ -2575,7 +2574,7 @@ def _reduce_171(val, _values, result) module_eval(<<'.,.,', 'egrammar.ra', 619) def _reduce_175(val, _values, result) - result = val[1] + result = val[1] result end .,., @@ -2585,21 +2584,21 @@ def _reduce_176(val, _values, result) definition = Factory.FUNCTION(val[1][:value], val[2], val[5], val[3]) loc(definition, val[0], val[6]) result = add_definition(definition) - + result end .,., module_eval(<<'.,.,', 'egrammar.ra', 631) def _reduce_177(val, _values, result) - result = val[1] + result = val[1] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 632) def _reduce_178(val, _values, result) - result = val[1].access(val[3]) ; loc result, val[1], val[4] + result = val[1].access(val[3]) ; loc result, val[1], val[4] result end .,., @@ -2614,63 +2613,63 @@ def _reduce_178(val, _values, result) module_eval(<<'.,.,', 'egrammar.ra', 642) def _reduce_183(val, _values, result) - error val[0], "'class' keyword not allowed at this location" + error val[0], "'class' keyword not allowed at this location" result end .,., module_eval(<<'.,.,', 'egrammar.ra', 643) def _reduce_184(val, _values, result) - error val[0], "A quoted string is not valid as a name here" + error val[0], "A quoted string is not valid as a name here" result end .,., module_eval(<<'.,.,', 'egrammar.ra', 647) def _reduce_185(val, _values, result) - result = [] + result = [] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 648) def _reduce_186(val, _values, result) - result = [] + result = [] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 649) def _reduce_187(val, _values, result) - result = [] + result = [] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 650) def _reduce_188(val, _values, result) - result = val[1] + result = val[1] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 651) def _reduce_189(val, _values, result) - result = val[1] + result = val[1] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 655) def _reduce_190(val, _values, result) - result = [val[0]] + result = [val[0]] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 656) def _reduce_191(val, _values, result) - result = val[0].push(val[2]) + result = val[0].push(val[2]) result end .,., @@ -2685,42 +2684,42 @@ def _reduce_191(val, _values, result) module_eval(<<'.,.,', 'egrammar.ra', 668) def _reduce_196(val, _values, result) - result = Factory.PARAM(val[0][:value], val[2]) ; loc result, val[0] + result = Factory.PARAM(val[0][:value], val[2]) ; loc result, val[0] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 669) def _reduce_197(val, _values, result) - result = Factory.PARAM(val[0][:value]); loc result, val[0] + result = Factory.PARAM(val[0][:value]); loc result, val[0] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 672) def _reduce_198(val, _values, result) - result = val[1]; val[1].captures_rest + result = val[1]; val[1].captures_rest result end .,., module_eval(<<'.,.,', 'egrammar.ra', 675) def _reduce_199(val, _values, result) - val[1].type_expr(val[0]) ; result = val[1] + val[1].type_expr(val[0]) ; result = val[1] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 678) def _reduce_200(val, _values, result) - result = val[0] + result = val[0] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 679) def _reduce_201(val, _values, result) - result = val[0].access(val[2]) ; loc result, val[0], val[3] + result = val[0].access(val[2]) ; loc result, val[0], val[3] result end .,., @@ -2730,7 +2729,7 @@ def _reduce_202(val, _values, result) definition = Factory.TYPE_ASSIGNMENT(val[0], Factory.KEY_ENTRY(val[2], val[3])) loc(definition, val[0], val[3]) result = add_definition(definition) - + result end .,., @@ -2740,7 +2739,7 @@ def _reduce_203(val, _values, result) definition = Factory.TYPE_ASSIGNMENT(val[0], val[2].access(val[4])) loc(definition, val[0], val[5]) result = add_definition(definition) - + result end .,., @@ -2750,7 +2749,7 @@ def _reduce_204(val, _values, result) definition = Factory.TYPE_ASSIGNMENT(val[0], val[2]) loc(definition, val[0], val[2]) result = add_definition(definition) - + result end .,., @@ -2760,7 +2759,7 @@ def _reduce_205(val, _values, result) definition = Factory.TYPE_ASSIGNMENT(val[0], val[2]) loc(definition, val[0], val[2]) result = add_definition(definition) - + result end .,., @@ -2770,14 +2769,14 @@ def _reduce_206(val, _values, result) definition = Factory.TYPE_ASSIGNMENT(val[0], val[2]) loc(definition, val[0], val[4]) result = add_definition(definition) - + result end .,., module_eval(<<'.,.,', 'egrammar.ra', 710) def _reduce_207(val, _values, result) - result = val[1] + result = val[1] result end .,., @@ -2787,7 +2786,7 @@ def _reduce_208(val, _values, result) definition = Factory.TYPE_DEFINITION(val[1][:value], nil, val[3]) loc(definition, val[0], val[4]) result = add_definition(definition) - + result end .,., @@ -2797,7 +2796,7 @@ def _reduce_209(val, _values, result) definition = Factory.TYPE_DEFINITION(val[1][:value], val[3][:value], val[5]) loc(definition, val[0], val[6]) result = add_definition(definition) - + result end .,., @@ -2810,91 +2809,91 @@ def _reduce_210(val, _values, result) fqn['length'] -= 1 result = fqn.var loc(result, val[0]) - + result end .,., module_eval(<<'.,.,', 'egrammar.ra', 741) def _reduce_211(val, _values, result) - result = Factory.RESERVED(val[0][:value]) ; loc result, val[0] + result = Factory.RESERVED(val[0][:value]) ; loc result, val[0] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 742) def _reduce_212(val, _values, result) - result = Factory.RESERVED(val[0][:value]) ; loc result, val[0] + result = Factory.RESERVED(val[0][:value]) ; loc result, val[0] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 748) def _reduce_213(val, _values, result) - result = Factory.LIST(val[1]); loc result, val[0], val[3] + result = Factory.LIST(val[1]); loc result, val[0], val[3] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 749) def _reduce_214(val, _values, result) - result = Factory.literal([]) ; loc result, val[0], val[1] + result = Factory.literal([]) ; loc result, val[0], val[1] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 750) def _reduce_215(val, _values, result) - result = Factory.LIST(val[1]); loc result, val[0], val[3] + result = Factory.LIST(val[1]); loc result, val[0], val[3] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 751) def _reduce_216(val, _values, result) - result = Factory.literal([]) ; loc result, val[0], val[1] + result = Factory.literal([]) ; loc result, val[0], val[1] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 754) def _reduce_217(val, _values, result) - result = Factory.HASH(val[1]); loc result, val[0], val[2] + result = Factory.HASH(val[1]); loc result, val[0], val[2] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 755) def _reduce_218(val, _values, result) - result = Factory.HASH(val[1]); loc result, val[0], val[3] + result = Factory.HASH(val[1]); loc result, val[0], val[3] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 756) def _reduce_219(val, _values, result) - result = Factory.literal({}) ; loc result, val[0], val[1] + result = Factory.literal({}) ; loc result, val[0], val[1] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 759) def _reduce_220(val, _values, result) - result = [val[0]] + result = [val[0]] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 760) def _reduce_221(val, _values, result) - result = val[0].push val[2] + result = val[0].push val[2] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 763) def _reduce_222(val, _values, result) - result = Factory.KEY_ENTRY(val[0], val[2]); loc result, val[1] + result = Factory.KEY_ENTRY(val[0], val[2]); loc result, val[1] result end .,., @@ -2903,7 +2902,7 @@ def _reduce_222(val, _values, result) module_eval(<<'.,.,', 'egrammar.ra', 767) def _reduce_224(val, _values, result) - result = Factory.literal(val[0][:value]) ; loc result, val[0] + result = Factory.literal(val[0][:value]) ; loc result, val[0] result end .,., @@ -2912,21 +2911,21 @@ def _reduce_224(val, _values, result) module_eval(<<'.,.,', 'egrammar.ra', 772) def _reduce_226(val, _values, result) - result = Factory.literal(val[0][:value]) ; loc result, val[0] + result = Factory.literal(val[0][:value]) ; loc result, val[0] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 775) def _reduce_227(val, _values, result) - result = [val[0]] + result = [val[0]] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 776) def _reduce_228(val, _values, result) - result = Factory.ARGUMENTS(val[0], val[2]) + result = Factory.ARGUMENTS(val[0], val[2]) result end .,., @@ -2943,98 +2942,98 @@ def _reduce_228(val, _values, result) module_eval(<<'.,.,', 'egrammar.ra', 789) def _reduce_234(val, _values, result) - result = Factory.literal(val[0][:value]) ; loc result, val[0] + result = Factory.literal(val[0][:value]) ; loc result, val[0] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 790) def _reduce_235(val, _values, result) - result = Factory.literal(val[0][:value]) ; loc result, val[0] + result = Factory.literal(val[0][:value]) ; loc result, val[0] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 792) def _reduce_236(val, _values, result) - result = Factory.STRING(val[0], *val[1]) ; loc result, val[0], val[1][-1] + result = Factory.STRING(val[0], *val[1]) ; loc result, val[0], val[1][-1] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 793) def _reduce_237(val, _values, result) - result = Factory.literal(val[0][:value]); loc result, val[0] + result = Factory.literal(val[0][:value]); loc result, val[0] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 794) def _reduce_238(val, _values, result) - result = Factory.literal(val[0][:value]); loc result, val[0] + result = Factory.literal(val[0][:value]); loc result, val[0] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 795) def _reduce_239(val, _values, result) - result = Factory.literal(val[0][:value]); loc result, val[0] + result = Factory.literal(val[0][:value]); loc result, val[0] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 796) def _reduce_240(val, _values, result) - result = [val[0]] + val[1] + result = [val[0]] + val[1] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 797) def _reduce_241(val, _values, result) - result = Factory.TEXT(val[0]) + result = Factory.TEXT(val[0]) result end .,., module_eval(<<'.,.,', 'egrammar.ra', 800) def _reduce_242(val, _values, result) - result = [val[0]] + result = [val[0]] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 801) def _reduce_243(val, _values, result) - result = [val[0]] + val[1] + result = [val[0]] + val[1] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 804) def _reduce_244(val, _values, result) - result = Factory.HEREDOC(val[0][:value], val[1]); loc result, val[0] + result = Factory.HEREDOC(val[0][:value], val[1]); loc result, val[0] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 807) def _reduce_245(val, _values, result) - result = Factory.SUBLOCATE(val[0], val[1]); + result = Factory.SUBLOCATE(val[0], val[1]); result end .,., module_eval(<<'.,.,', 'egrammar.ra', 808) def _reduce_246(val, _values, result) - result = Factory.SUBLOCATE(val[0], val[1]); + result = Factory.SUBLOCATE(val[0], val[1]); result end .,., module_eval(<<'.,.,', 'egrammar.ra', 811) def _reduce_247(val, _values, result) - result = Factory.EPP(val[1], val[2]); loc result, val[0] + result = Factory.EPP(val[1], val[2]); loc result, val[0] result end .,., @@ -3045,42 +3044,42 @@ def _reduce_247(val, _values, result) module_eval(<<'.,.,', 'egrammar.ra', 818) def _reduce_250(val, _values, result) - result = nil + result = nil result end .,., module_eval(<<'.,.,', 'egrammar.ra', 819) def _reduce_251(val, _values, result) - result = [] + result = [] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 820) def _reduce_252(val, _values, result) - result = val[1] + result = val[1] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 823) def _reduce_253(val, _values, result) - result = Factory.RENDER_STRING(val[0][:value]); loc result, val[0] + result = Factory.RENDER_STRING(val[0][:value]); loc result, val[0] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 824) def _reduce_254(val, _values, result) - result = Factory.RENDER_EXPR(val[1]); loc result, val[0], val[2] + result = Factory.RENDER_EXPR(val[1]); loc result, val[0], val[2] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 825) def _reduce_255(val, _values, result) - result = Factory.RENDER_EXPR(Factory.block_or_expression(val[2], val[1], val[3])); loc result, val[0], val[4] + result = Factory.RENDER_EXPR(Factory.block_or_expression(val[2], val[1], val[3])); loc result, val[0], val[4] result end .,., @@ -3091,14 +3090,14 @@ def _reduce_255(val, _values, result) module_eval(<<'.,.,', 'egrammar.ra', 831) def _reduce_258(val, _values, result) - result = Factory.QREF(val[0][:value]) ; loc result, val[0] + result = Factory.QREF(val[0][:value]) ; loc result, val[0] result end .,., module_eval(<<'.,.,', 'egrammar.ra', 834) def _reduce_259(val, _values, result) - result = Factory.literal(val[0][:value]); loc result, val[0] + result = Factory.literal(val[0][:value]); loc result, val[0] result end .,., @@ -3107,7 +3106,7 @@ def _reduce_259(val, _values, result) module_eval(<<'.,.,', 'egrammar.ra', 840) def _reduce_261(val, _values, result) - result = nil + result = nil result end .,., @@ -3164,6 +3163,6 @@ def _reduce_none(val, _values, result) end end # class Parser - end # module Parser - end # module Pops - end # module Puppet + end # module Parser + end # module Pops +end # module Puppet From 5716581df2e27b118aa99b58f60656cf5a078702 Mon Sep 17 00:00:00 2001 From: Gabriel Nagy Date: Wed, 8 Sep 2021 14:08:18 +0300 Subject: [PATCH 436/731] (maint) Use require_relative in egrammar.ra --- lib/puppet/pops/parser/egrammar.ra | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/puppet/pops/parser/egrammar.ra b/lib/puppet/pops/parser/egrammar.ra index ecc69431c13..83c37578e33 100644 --- a/lib/puppet/pops/parser/egrammar.ra +++ b/lib/puppet/pops/parser/egrammar.ra @@ -870,8 +870,8 @@ nil end ---- header ---- -require 'puppet' -require 'puppet/pops' +require_relative '../../../puppet' +require_relative '../../../puppet/pops' module Puppet class ParseError < Puppet::Error; end From 22ce9d7281c7493143cdf7a9895015234ff1953f Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Mon, 30 Aug 2021 14:13:07 -0700 Subject: [PATCH 437/731] (PUP-3817) Remove unused create_files File-based settings used to support a `create` option, but that was removed awhile ago. Remove the unused accessor. Directories on the other hand are always created/managed, since they are often the parent of a file-based setting. --- lib/puppet/settings/file_setting.rb | 11 +++-------- spec/unit/settings/file_setting_spec.rb | 17 ++++++++++------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/lib/puppet/settings/file_setting.rb b/lib/puppet/settings/file_setting.rb index e0b40331887..65731febf32 100644 --- a/lib/puppet/settings/file_setting.rb +++ b/lib/puppet/settings/file_setting.rb @@ -53,7 +53,7 @@ def safe_to_use_settings_value? end end - attr_accessor :mode, :create + attr_accessor :mode def initialize(args) @group = Unspecified.new @@ -61,11 +61,6 @@ def initialize(args) super(args) end - # Should we create files, rather than just directories? - def create_files? - create - end - # @param value [String] the group to use on the created file (can only be "root" or "service") # @api public def group=(value) @@ -135,8 +130,8 @@ def to_resource # Make sure the paths are fully qualified. path = File.expand_path(path) - return nil unless type == :directory or create_files? or Puppet::FileSystem.exist?(path) - return nil if path =~ /^\/dev/ or path =~ /^[A-Z]:\/dev/i + return nil unless type == :directory || Puppet::FileSystem.exist?(path) + return nil if path =~ /^\/dev/ || path =~ /^[A-Z]:\/dev/i resource = Puppet::Resource.new(:file, path) diff --git a/spec/unit/settings/file_setting_spec.rb b/spec/unit/settings/file_setting_spec.rb index 0c9735b3fea..17b6166a526 100644 --- a/spec/unit/settings/file_setting_spec.rb +++ b/spec/unit/settings/file_setting_spec.rb @@ -125,9 +125,10 @@ def settings(wanted_values = {}) describe "when being converted to a resource" do before do @basepath = make_absolute("/somepath") + allow(Puppet::FileSystem).to receive(:exist?).and_call_original + allow(Puppet::FileSystem).to receive(:exist?).with(@basepath).and_return(true) @settings = double('settings') @file = Puppet::Settings::FileSetting.new(:settings => @settings, :desc => "eh", :name => :myfile, :section => "mysect") - allow(@file).to receive(:create_files?).and_return(true) allow(@settings).to receive(:value).with(:myfile, nil, false).and_return(@basepath) end @@ -135,18 +136,19 @@ def settings(wanted_values = {}) expect(@file.type).to eq(:file) end - it "should skip non-existent files if 'create_files' is not enabled" do - expect(@file).to receive(:create_files?).and_return(false) + it "skips non-existent files" do expect(@file).to receive(:type).and_return(:file) expect(Puppet::FileSystem).to receive(:exist?).with(@basepath).and_return(false) expect(@file.to_resource).to be_nil end - it "should manage existent files even if 'create_files' is not enabled" do - expect(@file).to receive(:create_files?).and_return(false) + it "manages existing files" do expect(@file).to receive(:type).and_return(:file) - allow(Puppet::FileSystem).to receive(:exist?) - expect(Puppet::FileSystem).to receive(:exist?).with(@basepath).and_return(true) + expect(@file.to_resource).to be_instance_of(Puppet::Resource) + end + + it "always manages directories" do + expect(@file).to receive(:type).and_return(:directory) expect(@file.to_resource).to be_instance_of(Puppet::Resource) end @@ -177,6 +179,7 @@ def settings(wanted_values = {}) it "should fully qualified returned files if necessary (#795)" do allow(@settings).to receive(:value).with(:myfile, nil, false).and_return("myfile") path = File.expand_path('myfile') + allow(Puppet::FileSystem).to receive(:exist?).with(path).and_return(true) expect(@file.to_resource.title).to eq(path) end From 0862f5e80d228082fdb8291243471de22613fdbf Mon Sep 17 00:00:00 2001 From: Anton Emelyanov Date: Thu, 9 Sep 2021 14:56:58 +0300 Subject: [PATCH 438/731] (docs) Fix incorrect comments in simple_graph.rb --- lib/puppet/graph/simple_graph.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/puppet/graph/simple_graph.rb b/lib/puppet/graph/simple_graph.rb index 9b416736d36..0739f490fec 100644 --- a/lib/puppet/graph/simple_graph.rb +++ b/lib/puppet/graph/simple_graph.rb @@ -38,11 +38,12 @@ def clear @downstream_from.clear end - # Which resources depend upon the given resource. + # Which resources the given resource depends on. def dependencies(resource) vertex?(resource) ? upstream_from_vertex(resource).keys : [] end + # Which resources depend upon the given resource. def dependents(resource) vertex?(resource) ? downstream_from_vertex(resource).keys : [] end @@ -351,7 +352,7 @@ def adjacent(v, options = {}) # Just walk the tree and pass each edge. def walk(source, direction) - # Use an iterative, breadth-first traversal of the graph. One could do + # Use an iterative, depth-first traversal of the graph. One could do # this recursively, but Ruby's slow function calls and even slower # recursion make the shorter, recursive algorithm cost-prohibitive. stack = [source] From 5446fb47f265ace24b94a838d6d5864cff0642cb Mon Sep 17 00:00:00 2001 From: gimmy Date: Fri, 10 Sep 2021 11:35:09 +0300 Subject: [PATCH 439/731] (PUP-11217) do not eager load http_client https://github.com/puppetlabs/puppet/pull/8749/files#diff-91bcbee7bf547ed6ab2546124a1a87c5e34d8189ef781252293b65725ea40bddR145 introduced a change on how we load runtime services, setting them upfront before running any tests. This breaks the ability to mock the implementations, and enforces specific implementations to be injected when Puppet is initialized. To avoid breaking other projects, do not load the HttpClient for now, but let it be lazy initailized as it was before #8749. --- lib/puppet/test/test_helper.rb | 3 ++- spec/unit/network/http/connection_spec.rb | 1 - spec/unit/network/http_pool_spec.rb | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/puppet/test/test_helper.rb b/lib/puppet/test/test_helper.rb index 15252fd0737..980775a965b 100644 --- a/lib/puppet/test/test_helper.rb +++ b/lib/puppet/test/test_helper.rb @@ -142,7 +142,8 @@ def self.before_each_test() }, "Context for specs") - Puppet.runtime.load_services + # trigger `require 'facter'` + Puppet.runtime[:facter] Puppet::Parser::Functions.reset Puppet::Application.clear! diff --git a/spec/unit/network/http/connection_spec.rb b/spec/unit/network/http/connection_spec.rb index 039489a25a5..2eb6fb9a5cf 100644 --- a/spec/unit/network/http/connection_spec.rb +++ b/spec/unit/network/http/connection_spec.rb @@ -543,7 +543,6 @@ def retry_after(datetime) end it "should sleep for no more than the Puppet runinterval" do - Puppet.runtime.clear retry_after('60') Puppet[:runinterval] = 30 diff --git a/spec/unit/network/http_pool_spec.rb b/spec/unit/network/http_pool_spec.rb index f6feffe4b78..e041baf9da8 100644 --- a/spec/unit/network/http_pool_spec.rb +++ b/spec/unit/network/http_pool_spec.rb @@ -37,7 +37,6 @@ def initialize(host, port, options = {}) end it "switches to the external client implementation" do - Puppet.runtime.clear Puppet::Network::HttpPool.http_client_class = http_impl expect(Puppet.runtime[:http]).to be_an_instance_of(Puppet::HTTP::ExternalClient) From 30c37cb98e0a2e8d6b450c61e27807eb16e64102 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Fri, 10 Sep 2021 16:27:35 +0000 Subject: [PATCH 440/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index 09250a210b0..5f52181a59c 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -2110,6 +2110,14 @@ This argument is by default disabled (value set to 0)\. In this case puppet agen . .IP "" 0 . +.SS "write_catalog_summary" +Whether to write the \fBclassfile\fR and \fBresourcefile\fR after applying the catalog\. It is enabled by default, except when running \fBpuppet apply\fR\. +. +.IP "\(bu" 4 +\fIDefault\fR: \fBtrue\fR +. +.IP "" 0 +. .SS "yamldir" The directory in which YAML data is stored, usually in a subdirectory\. . From 5af795b64e311a95bd70b1dfbf3d9a10b0c6f10c Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Mon, 13 Sep 2021 11:02:18 +0000 Subject: [PATCH 441/731] (packaging) Bump to version '7.12.0' [no-promote] --- .gemspec | 2 +- lib/puppet/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gemspec b/.gemspec index ec289f80b4b..bfa0178d9f3 100644 --- a/.gemspec +++ b/.gemspec @@ -13,7 +13,7 @@ Gem::Specification.new do |s| s.name = "puppet" - version = "7.11.0" + version = "7.12.0" mdata = version.match(/(\d+\.\d+\.\d+)/) s.version = mdata ? mdata[1] : version diff --git a/lib/puppet/version.rb b/lib/puppet/version.rb index 9996cea26c3..403480deda0 100644 --- a/lib/puppet/version.rb +++ b/lib/puppet/version.rb @@ -6,7 +6,7 @@ # Raketasks and such to set the version based on the output of `git describe` module Puppet - PUPPETVERSION = '7.11.0' + PUPPETVERSION = '7.12.0' ## # version is a public API method intended to always provide a fast and From 75a372458d5e81ae39e3d658b46c57e97b006298 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Mon, 13 Sep 2021 11:11:42 +0000 Subject: [PATCH 442/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 2 +- man/man8/puppet.8 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index 5f52181a59c..0c39c157c08 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -929,7 +929,7 @@ The time to wait for data to be read from an HTTP connection\. If nothing is rea The HTTP User\-Agent string to send when making network requests\. . .IP "\(bu" 4 -\fIDefault\fR: \fBPuppet/7\.11\.0 Ruby/2\.5\.1\-p57 (x86_64\-linux)\fR +\fIDefault\fR: \fBPuppet/7\.12\.0 Ruby/2\.5\.1\-p57 (x86_64\-linux)\fR . .IP "" 0 . diff --git a/man/man8/puppet.8 b/man/man8/puppet.8 index a5535fb75c8..7a66fc7c2d1 100644 --- a/man/man8/puppet.8 +++ b/man/man8/puppet.8 @@ -25,4 +25,4 @@ Specialized: 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 . .P -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\.11\.0 +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\.12\.0 From e0602f707e98529c1340190b3b9cf40e19cc6b06 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Fri, 24 Sep 2021 12:03:58 -0700 Subject: [PATCH 443/731] (maint) Remove overstubbing Dir.glob behaves differently across platforms and ruby versions, don't stub it. --- spec/unit/util/autoload_spec.rb | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/spec/unit/util/autoload_spec.rb b/spec/unit/util/autoload_spec.rb index 3a03d12af85..be3e8a79b1f 100644 --- a/spec/unit/util/autoload_spec.rb +++ b/spec/unit/util/autoload_spec.rb @@ -178,15 +178,14 @@ def with_libdir(libdir) end describe "when loading all files" do + let(:basedir) { tmpdir('autoloader') } + let(:path) { File.join(basedir, @autoload.path, 'file.rb') } + before do - allow(@autoload.class).to receive(:search_directories).and_return([make_absolute("/a")]) - allow(FileTest).to receive(:directory?).and_return(true) - allow(Dir).to receive(:glob).and_return([make_absolute("/a/foo/file.rb")]) - allow(Puppet::FileSystem).to receive(:exist?).and_return(true) - @time_a = Time.utc(2010, 'jan', 1, 6, 30) - allow(File).to receive(:mtime).and_return(@time_a) + FileUtils.mkdir_p(File.dirname(path)) + FileUtils.touch(path) - allow(@autoload.class).to receive(:loaded?).and_return(false) + allow(@autoload.class).to receive(:search_directories).and_return([basedir]) end [RuntimeError, LoadError, SyntaxError].each do |error| @@ -198,7 +197,7 @@ def with_libdir(libdir) end it "should require the full path to the file" do - expect(Kernel).to receive(:load).with(make_absolute("/a/foo/file.rb"), any_args) + expect(Kernel).to receive(:load).with(path, any_args) @autoload.loadall(env) end From ca7fac811fbd905ca5e61db79b48b2be21cf2188 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Fri, 17 Sep 2021 15:12:07 -0700 Subject: [PATCH 444/731] (PUP-11184) Return relative paths contained within the directory Previously, puppet failed to load if the current working directory was a short Windows path. This was due to trying to require `Puppet::Util::Uniquefile` using its long and short path. This regression was introduced with the move to require_relative. The `Autoload.files_in_dir` method is expected to return relative paths that are contained within the `dir` argument. For example, returning an array containing `puppet/provider/exec/posix`. However, if the `dir` argument contained a short Windows path and the short path wasn't the last directory component, then the `files_in_dir` method returned a relative path of the form, because `Dir.glob` always returns long paths: ../../../../../../../Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/provider/exec/posix Later the autoloader joined `Puppet[:libdir]` and the relative path above, resulting in a non-canonical path: C:/ProgramData/PuppetLabs/puppet/cache/lib/../../../../../../../Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/provider/exec/posix.rb The autoloader then called `Kernel.load` with the long path: C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/puppet/provider/exec/posix.rb Which eventually tried to require relatively uniquefile using a long path. However, that would fail because it had already been required using its 8.3 path: irb(main):002:0> $LOADED_FEATURES.grep(/\/uniquefile/) => ["C:/PROGRA~1/PUPPET~1/Puppet/puppet/lib/ruby/vendor_ruby/puppet/file_system/uniquefile.rb"] This issue wasn't an issue prior to require_relative, because we called `require 'puppet/util/uniquefile'` and ruby knew it had already required that file. This commit modifies `files_in_dir` to convert the base `dir` to a long path, so that `dir` is always a prefix for the globbed child. --- lib/puppet/file_system.rb | 3 ++- lib/puppet/util/autoload.rb | 2 +- spec/unit/util/autoload_spec.rb | 18 ++++++++++++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/lib/puppet/file_system.rb b/lib/puppet/file_system.rb index b3676ee7aca..0600aafdcbb 100644 --- a/lib/puppet/file_system.rb +++ b/lib/puppet/file_system.rb @@ -345,7 +345,8 @@ def self.pathname(path) # value ~ will be expanded to something like /Users/Foo # # This method exists primarlily to resolve a Ruby deficiency where - # File.expand_path doesn't handle ~ in each segment on a Windows path + # File.expand_path doesn't convert short paths to long paths, which is + # important when resolving the path to load. # # @param path [Object] a path handle produced by {#pathname} # @return [String] a string representation of the path diff --git a/lib/puppet/util/autoload.rb b/lib/puppet/util/autoload.rb index e032c1dab63..800a96cfa3f 100644 --- a/lib/puppet/util/autoload.rb +++ b/lib/puppet/util/autoload.rb @@ -117,7 +117,7 @@ def files_to_load(path, env) # @api private def files_in_dir(dir, path) - dir = Pathname.new(File.expand_path(dir)) + dir = Pathname.new(Puppet::FileSystem.expand_path(dir)) Dir.glob(File.join(dir, path, "*.rb")).collect do |file| Pathname.new(file).relative_path_from(dir).to_s end diff --git a/spec/unit/util/autoload_spec.rb b/spec/unit/util/autoload_spec.rb index be3e8a79b1f..803e195cbd0 100644 --- a/spec/unit/util/autoload_spec.rb +++ b/spec/unit/util/autoload_spec.rb @@ -201,6 +201,24 @@ def with_libdir(libdir) @autoload.loadall(env) end + + it "autoloads from a directory whose ancestor is Windows 8.3", if: Puppet::Util::Platform.windows? do + # File.expand_path will expand ~ in the last directory component only(!) + # so create an ancestor directory with a long path + dir = File.join(tmpdir('longpath'), 'short') + path = File.join(dir, @autoload.path, 'file.rb') + + FileUtils.mkdir_p(File.dirname(path)) + FileUtils.touch(path) + + dir83 = File.join(File.dirname(basedir), 'longpa~1', 'short') + path83 = File.join(dir83, @autoload.path, 'file.rb') + + allow(@autoload.class).to receive(:search_directories).and_return([dir83]) + expect(Kernel).to receive(:load).with(path83, any_args) + + @autoload.loadall(env) + end end describe "when reloading files" do From e57934737c6484d663fd665cae7838b775fa445b Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Wed, 29 Sep 2021 16:37:09 +0000 Subject: [PATCH 445/731] (packaging) Updating the puppet.pot file --- locales/puppet.pot | 362 +++++++++++++++++++++++---------------------- 1 file changed, 183 insertions(+), 179 deletions(-) diff --git a/locales/puppet.pot b/locales/puppet.pot index d294cf493a3..16c303e88b6 100644 --- a/locales/puppet.pot +++ b/locales/puppet.pot @@ -6,11 +6,11 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Puppet automation framework 7.9.0-154-gc8aa8b2175\n" +"Project-Id-Version: Puppet automation framework 7.11.0-22-gd1463bbc0c\n" "\n" "Report-Msgid-Bugs-To: https://tickets.puppetlabs.com\n" -"POT-Creation-Date: 2021-08-11 13:52+0000\n" -"PO-Revision-Date: 2021-08-11 13:52+0000\n" +"POT-Creation-Date: 2021-09-29 16:36+0000\n" +"PO-Revision-Date: 2021-09-29 16:36+0000\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -28,11 +28,11 @@ msgstr "" msgid "See https://puppet.com/docs/puppet/%{minor_version}/deprecated_language.html" msgstr "" -#: ../lib/hiera/scope.rb:46 ../lib/puppet/parser/scope.rb:534 +#: ../lib/hiera/scope.rb:46 ../lib/puppet/parser/scope.rb:535 msgid "Variable: %{name}" msgstr "" -#: ../lib/hiera/scope.rb:47 ../lib/hiera/scope.rb:49 ../lib/puppet/parser/scope.rb:535 ../lib/puppet/parser/scope.rb:537 +#: ../lib/hiera/scope.rb:47 ../lib/hiera/scope.rb:49 ../lib/puppet/parser/scope.rb:536 ../lib/puppet/parser/scope.rb:538 msgid "Undefined variable '%{name}'; %{reason}" msgstr "" @@ -48,21 +48,21 @@ msgstr "" msgid "Config file %{hiera_config} not found, using Hiera defaults" msgstr "" -#: ../lib/puppet.rb:138 +#: ../lib/puppet.rb:134 msgid "Support for ruby version %{version} is deprecated and will be removed in a future release. See https://puppet.com/docs/puppet/latest/system_requirements.html for a list of supported ruby versions." msgstr "" -#: ../lib/puppet.rb:224 +#: ../lib/puppet.rb:220 msgid "The environmentpath setting cannot be empty or nil." msgstr "" #. TRANSLATORS: `message` is an already translated string of why SSL failed to initialize -#: ../lib/puppet.rb:250 +#: ../lib/puppet.rb:246 msgid "Failed to initialize SSL: %{message}" msgstr "" #. TRANSLATORS: `puppet agent -t` is a command and should not be translated -#: ../lib/puppet.rb:252 +#: ../lib/puppet.rb:248 msgid "Run `puppet agent -t`" msgstr "" @@ -184,57 +184,57 @@ msgstr "" msgid "The puppet agent daemon" msgstr "" -#: ../lib/puppet/application/agent.rb:422 +#: ../lib/puppet/application/agent.rb:426 msgid "Fingerprint asked but neither the certificate, nor the certificate request have been issued" msgstr "" -#: ../lib/puppet/application/agent.rb:427 +#: ../lib/puppet/application/agent.rb:431 msgid "Failed to generate fingerprint: %{message}" msgstr "" -#: ../lib/puppet/application/agent.rb:450 +#: ../lib/puppet/application/agent.rb:454 msgid "Starting Puppet client version %{version}" msgstr "" -#: ../lib/puppet/application/agent.rb:466 +#: ../lib/puppet/application/agent.rb:470 msgid "The puppet agent command does not take parameters" msgstr "" -#: ../lib/puppet/application/apply.rb:35 +#: ../lib/puppet/application/apply.rb:37 msgid "Apply Puppet manifests locally" msgstr "" #. TRANSLATORS "puppet apply" is a program command and should not be translated #. TRANSLATORS "puppet apply" is a program command and should not be translated -#: ../lib/puppet/application/apply.rb:209 ../lib/puppet/application/apply.rb:322 +#: ../lib/puppet/application/apply.rb:212 ../lib/puppet/application/apply.rb:340 msgid "For puppet apply" msgstr "" -#: ../lib/puppet/application/apply.rb:217 +#: ../lib/puppet/application/apply.rb:220 msgid "%{file} is not readable" msgstr "" -#: ../lib/puppet/application/apply.rb:288 ../lib/puppet/application/script.rb:241 +#: ../lib/puppet/application/apply.rb:306 ../lib/puppet/application/script.rb:241 msgid "Exiting" msgstr "" -#: ../lib/puppet/application/apply.rb:332 +#: ../lib/puppet/application/apply.rb:350 msgid "Could not deserialize catalog from %{format}: %{detail}" msgstr "" -#: ../lib/puppet/application/apply.rb:353 ../lib/puppet/application/script.rb:146 +#: ../lib/puppet/application/apply.rb:371 ../lib/puppet/application/script.rb:146 msgid "Could not find facts for %{node}" msgstr "" -#: ../lib/puppet/application/apply.rb:365 ../lib/puppet/application/script.rb:154 +#: ../lib/puppet/application/apply.rb:383 ../lib/puppet/application/script.rb:154 msgid "Could not find node %{node}" msgstr "" -#: ../lib/puppet/application/apply.rb:378 ../lib/puppet/application/script.rb:139 +#: ../lib/puppet/application/apply.rb:396 ../lib/puppet/application/script.rb:139 msgid "Could not find file %{manifest}" msgstr "" -#: ../lib/puppet/application/apply.rb:379 +#: ../lib/puppet/application/apply.rb:397 msgid "Only one file can be applied per run. Skipping %{files}" msgstr "" @@ -426,7 +426,7 @@ msgstr "" msgid "Invalid parameter setting %{setting}" msgstr "" -#: ../lib/puppet/application/resource.rb:240 +#: ../lib/puppet/application/resource.rb:241 msgid "Listing all file instances is not supported. Please specify a file or directory, e.g. puppet resource file /etc" msgstr "" @@ -534,133 +534,133 @@ msgstr "" msgid "Not using cached catalog because its environment '%{catalog_env}' does not match '%{local_env}'" msgstr "" -#: ../lib/puppet/configurer.rb:100 ../lib/puppet/configurer.rb:272 +#: ../lib/puppet/configurer.rb:100 ../lib/puppet/configurer.rb:275 msgid "Using cached catalog from environment '%{catalog_env}'" msgstr "" -#: ../lib/puppet/configurer.rb:130 +#: ../lib/puppet/configurer.rb:133 msgid "The current total number of facts: %{size} exceeds the number of facts limit: %{max_size}" msgstr "" -#: ../lib/puppet/configurer.rb:134 +#: ../lib/puppet/configurer.rb:137 msgid "Fact %{name} with length: '%{length}' exceeds the length limit: %{limit}" msgstr "" -#: ../lib/puppet/configurer.rb:138 +#: ../lib/puppet/configurer.rb:141 msgid "The current number of top level facts: %{size} exceeds the top facts limit: %{max_size}" msgstr "" -#: ../lib/puppet/configurer.rb:142 +#: ../lib/puppet/configurer.rb:145 msgid "Fact value '%{value}' with the value length: '%{length}' exceeds the value length limit: %{max_length}" msgstr "" -#: ../lib/puppet/configurer.rb:146 +#: ../lib/puppet/configurer.rb:149 msgid "Payload with the current size of: '%{payload}' exceeds the payload size limit: %{max_size}" msgstr "" -#: ../lib/puppet/configurer.rb:184 +#: ../lib/puppet/configurer.rb:187 msgid "The size of the payload is %{payload}" msgstr "" -#: ../lib/puppet/configurer.rb:214 +#: ../lib/puppet/configurer.rb:217 msgid "The total number of facts registered is %{number_of_facts}" msgstr "" -#: ../lib/puppet/configurer.rb:265 +#: ../lib/puppet/configurer.rb:268 msgid "Could not retrieve catalog; skipping run" msgstr "" -#: ../lib/puppet/configurer.rb:281 +#: ../lib/puppet/configurer.rb:284 msgid "Applied catalog in %{seconds} seconds" msgstr "" -#: ../lib/puppet/configurer.rb:315 +#: ../lib/puppet/configurer.rb:318 msgid "Could not select a functional puppet server from server_list: '%{server_list}'" msgstr "" #. TRANSLATORS 'server_list' is the name of a setting and should not be translated -#: ../lib/puppet/configurer.rb:329 +#: ../lib/puppet/configurer.rb:332 msgid "Selected puppet server from the `server_list` setting: %{server}:%{port}" msgstr "" -#: ../lib/puppet/configurer.rb:366 +#: ../lib/puppet/configurer.rb:369 msgid "Local environment: '%{local_env}' doesn't match the environment of the cached catalog '%{catalog_env}', switching agent to '%{catalog_env}'." msgstr "" -#: ../lib/puppet/configurer.rb:389 +#: ../lib/puppet/configurer.rb:392 msgid "Environment not passed via CLI and no catalog was given, attempting to find out the last server-specified environment" msgstr "" -#: ../lib/puppet/configurer.rb:394 +#: ../lib/puppet/configurer.rb:399 msgid "Could not find a usable environment in the lastrunfile. Either the file does not exist, does not have the required keys, or the values of 'initial_environment' and 'converged_environment' are identical." msgstr "" -#: ../lib/puppet/configurer.rb:398 +#: ../lib/puppet/configurer.rb:403 msgid "Using environment '%{env}'" msgstr "" -#: ../lib/puppet/configurer.rb:429 +#: ../lib/puppet/configurer.rb:427 msgid "Not using catalog because its environment '%{catalog_env}' does not match agent specified environment '%{local_env}' and strict_environment_mode is set" msgstr "" -#: ../lib/puppet/configurer.rb:440 +#: ../lib/puppet/configurer.rb:438 msgid "Catalog environment didn't stabilize after %{tries} fetches, aborting run" msgstr "" -#: ../lib/puppet/configurer.rb:442 +#: ../lib/puppet/configurer.rb:440 msgid "Local environment: '%{local_env}' doesn't match server specified environment '%{catalog_env}', restarting agent run with environment '%{catalog_env}'" msgstr "" -#: ../lib/puppet/configurer.rb:505 +#: ../lib/puppet/configurer.rb:496 msgid "Failed to apply catalog: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:536 +#: ../lib/puppet/configurer.rb:527 msgid "Environment '%{environment}' not found on server, skipping initial pluginsync." msgstr "" -#: ../lib/puppet/configurer.rb:553 ../lib/puppet/http/resolver/server_list.rb:64 ../lib/puppet/http/resolver/server_list.rb:68 +#: ../lib/puppet/configurer.rb:544 ../lib/puppet/http/resolver/server_list.rb:64 ../lib/puppet/http/resolver/server_list.rb:68 msgid "Puppet server %{host}:%{port} is unavailable: %{code} %{reason}" msgstr "" #. TRANSLATORS 'server_list' is the name of a setting and should not be translated -#: ../lib/puppet/configurer.rb:557 ../lib/puppet/http/resolver/server_list.rb:73 ../lib/puppet/http/resolver/server_list.rb:76 +#: ../lib/puppet/configurer.rb:548 ../lib/puppet/http/resolver/server_list.rb:73 ../lib/puppet/http/resolver/server_list.rb:76 msgid "Unable to connect to server from server_list setting: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:573 +#: ../lib/puppet/configurer.rb:564 msgid "Found last server-specified environment: %{environment}" msgstr "" -#: ../lib/puppet/configurer.rb:576 +#: ../lib/puppet/configurer.rb:567 msgid "Could not find last server-specified environment: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:586 ../lib/puppet/face/report.rb:47 +#: ../lib/puppet/configurer.rb:584 ../lib/puppet/face/report.rb:47 msgid "Could not send report: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:595 +#: ../lib/puppet/configurer.rb:593 msgid "Could not save last run local report: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:614 +#: ../lib/puppet/configurer.rb:612 msgid "Uploading facts for %{node} to %{server}" msgstr "" -#: ../lib/puppet/configurer.rb:622 +#: ../lib/puppet/configurer.rb:620 msgid "Failed to submit facts: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:637 +#: ../lib/puppet/configurer.rb:635 msgid "Could not run command from %{setting}: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:655 +#: ../lib/puppet/configurer.rb:664 msgid "Could not retrieve catalog from cache: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:677 +#: ../lib/puppet/configurer.rb:686 msgid "Could not retrieve catalog from remote server: %{detail}" msgstr "" @@ -700,7 +700,7 @@ msgstr "" msgid "TrustedInformation expected a certificate, but none was given." msgstr "" -#: ../lib/puppet/context/trusted_information.rb:104 ../lib/puppet/parser/scope.rb:835 +#: ../lib/puppet/context/trusted_information.rb:104 ../lib/puppet/parser/scope.rb:836 msgid "Unsupported data type: '%{klass}'" msgstr "" @@ -760,7 +760,7 @@ msgid "Invalid value '%{value}' for parameter %{name}. Allowed values are '%{all msgstr "" #. TRANSLATORS 'pluginsync' is a setting and should not be translated -#: ../lib/puppet/defaults.rb:1944 +#: ../lib/puppet/defaults.rb:1950 msgid "Setting 'pluginsync' is deprecated." msgstr "" @@ -2893,8 +2893,8 @@ msgstr "" msgid "Option %{option} conflicts with existing option %{conflict} on %{face}" msgstr "" -#. TRANSLATORS 'Puppet.settings' should not be translated #. TRANSLATORS 'Puppet.settings' references to the Puppet settings options and should not be translated +#. TRANSLATORS 'Puppet.settings' should not be translated #: ../lib/puppet/interface/action.rb:315 ../lib/puppet/interface/option_manager.rb:14 msgid "Global option %{option} does not exist in Puppet.settings" msgstr "" @@ -4353,111 +4353,111 @@ msgstr "" msgid "Duplicate parameter '%{param}' for on %{resource}" msgstr "" -#: ../lib/puppet/parser/scope.rb:155 +#: ../lib/puppet/parser/scope.rb:156 msgid "Numerical variables cannot be changed. Attempt to set $%{name}" msgstr "" -#: ../lib/puppet/parser/scope.rb:160 +#: ../lib/puppet/parser/scope.rb:161 msgid "Numerical variables cannot be deleted: Attempt to delete: $%{name}" msgstr "" -#: ../lib/puppet/parser/scope.rb:214 +#: ../lib/puppet/parser/scope.rb:215 msgid "%{callee}: expects a value for parameter $%{to}" msgstr "" -#: ../lib/puppet/parser/scope.rb:215 +#: ../lib/puppet/parser/scope.rb:216 msgid "%{callee}: default expression for $%{from} tries to illegally access not yet evaluated $%{to}" msgstr "" -#: ../lib/puppet/parser/scope.rb:234 +#: ../lib/puppet/parser/scope.rb:235 msgid "Attempt to assign variable %{name} when evaluating parameters" msgstr "" -#: ../lib/puppet/parser/scope.rb:377 +#: ../lib/puppet/parser/scope.rb:378 msgid "you must pass a compiler instance to a new scope object" msgstr "" -#: ../lib/puppet/parser/scope.rb:493 +#: ../lib/puppet/parser/scope.rb:494 msgid "Scope variable name %{name} is a %{klass}, not a string" msgstr "" -#: ../lib/puppet/parser/scope.rb:655 +#: ../lib/puppet/parser/scope.rb:656 msgid "class %{classname} could not be found" msgstr "" -#: ../lib/puppet/parser/scope.rb:657 +#: ../lib/puppet/parser/scope.rb:658 msgid "class %{classname} has not been evaluated" msgstr "" -#: ../lib/puppet/parser/scope.rb:703 +#: ../lib/puppet/parser/scope.rb:704 msgid "Default already defined for %{type} { %{param} }; cannot redefine" msgstr "" -#: ../lib/puppet/parser/scope.rb:763 +#: ../lib/puppet/parser/scope.rb:764 msgid "Cannot assign to a numeric match result variable '$%{name}'" msgstr "" -#: ../lib/puppet/parser/scope.rb:766 +#: ../lib/puppet/parser/scope.rb:767 msgid "Scope variable name %{name} is a %{class_type}, not a string" msgstr "" -#: ../lib/puppet/parser/scope.rb:771 ../lib/puppet/parser/scope.rb:776 +#: ../lib/puppet/parser/scope.rb:772 ../lib/puppet/parser/scope.rb:777 msgid "Attempt to assign to a reserved variable name: '%{name}'" msgstr "" -#: ../lib/puppet/parser/scope.rb:781 +#: ../lib/puppet/parser/scope.rb:782 msgid "Cannot reassign variable '$%{name}'" msgstr "" -#: ../lib/puppet/parser/scope.rb:1012 +#: ../lib/puppet/parser/scope.rb:1013 msgid "Invalid regex match data. Got a %{klass}" msgstr "" -#: ../lib/puppet/parser/scope.rb:1020 +#: ../lib/puppet/parser/scope.rb:1021 msgid "Scope#find_resource_type() is no longer supported, use Puppet::Pops::Evaluator::Runtime3ResourceSupport instead" msgstr "" -#: ../lib/puppet/parser/scope.rb:1025 +#: ../lib/puppet/parser/scope.rb:1026 msgid "Scope#find_builtin_resource_type() is no longer supported, use Puppet::Pops::Evaluator::Runtime3ResourceSupport instead" msgstr "" -#: ../lib/puppet/parser/scope.rb:1030 +#: ../lib/puppet/parser/scope.rb:1031 msgid "Scope#find_defined_resource_type() is no longer supported, use Puppet::Pops::Evaluator::Runtime3ResourceSupport instead" msgstr "" -#: ../lib/puppet/parser/scope.rb:1044 +#: ../lib/puppet/parser/scope.rb:1045 msgid "Function %{name} not defined despite being loaded!" msgstr "" -#: ../lib/puppet/parser/scope.rb:1051 +#: ../lib/puppet/parser/scope.rb:1052 msgid "Scope#resolve_type_and_title() is no longer supported, use Puppet::Pops::Evaluator::Runtime3ResourceSupport instead" msgstr "" -#: ../lib/puppet/parser/scope.rb:1071 +#: ../lib/puppet/parser/scope.rb:1072 msgid "Cannot use undef as a class name" msgstr "" -#: ../lib/puppet/parser/scope.rb:1073 +#: ../lib/puppet/parser/scope.rb:1074 msgid "Cannot use empty string as a class name" msgstr "" #. TRANSLATORS "Class" and "Type" are Puppet keywords and should not be translated -#: ../lib/puppet/parser/scope.rb:1082 +#: ../lib/puppet/parser/scope.rb:1083 msgid "Cannot use an unspecific Class[] Type" msgstr "" #. TRANSLATORS "Resource" is a class name and should not be translated -#: ../lib/puppet/parser/scope.rb:1109 +#: ../lib/puppet/parser/scope.rb:1110 msgid "Cannot use an unspecific Resource[] where a Resource['class', name] is expected" msgstr "" #. TRANSLATORS "Resource" is a class name and should not be translated -#: ../lib/puppet/parser/scope.rb:1113 +#: ../lib/puppet/parser/scope.rb:1114 msgid "Cannot use a Resource[%{type_name}] where a Resource['class', name] is expected" msgstr "" #. TRANSLATORS "Resource" is a class name and should not be translated -#: ../lib/puppet/parser/scope.rb:1117 +#: ../lib/puppet/parser/scope.rb:1118 msgid "Cannot use an unspecific Resource['class'] where a Resource['class', name] is expected" msgstr "" @@ -4470,15 +4470,15 @@ msgstr "" msgid "having multiple named scopes is not supported when scripting" msgstr "" -#: ../lib/puppet/parser/templatewrapper.rb:66 +#: ../lib/puppet/parser/templatewrapper.rb:67 msgid "Could not find template '%{filename}'" msgstr "" -#: ../lib/puppet/parser/templatewrapper.rb:83 +#: ../lib/puppet/parser/templatewrapper.rb:84 msgid "Bound template variables for %{template_source} in %%{seconds} seconds" msgstr "" -#: ../lib/puppet/parser/templatewrapper.rb:91 +#: ../lib/puppet/parser/templatewrapper.rb:92 msgid "Interpolated template %{template_source} in %%{seconds} seconds" msgstr "" @@ -5618,47 +5618,47 @@ msgstr "" msgid "Lookup of key '%{key}' failed: %{detail}" msgstr "" -#: ../lib/puppet/pops/lookup/lookup_adapter.rb:295 +#: ../lib/puppet/pops/lookup/lookup_adapter.rb:296 msgid "value of %{opts} must be a hash" msgstr "" -#: ../lib/puppet/pops/lookup/lookup_adapter.rb:302 +#: ../lib/puppet/pops/lookup/lookup_adapter.rb:303 msgid "all %{opts} patterns must match a key starting with module name '%{module_name}'" msgstr "" -#: ../lib/puppet/pops/lookup/lookup_adapter.rb:306 +#: ../lib/puppet/pops/lookup/lookup_adapter.rb:307 msgid "all %{opts} keys must start with module name '%{module_name}'" msgstr "" -#: ../lib/puppet/pops/lookup/lookup_adapter.rb:431 +#: ../lib/puppet/pops/lookup/lookup_adapter.rb:432 msgid "Defining \"data_provider\": \"%{name}\" in metadata.json is deprecated. It is ignored since a '%{config}' with version >= 5 is present" msgstr "" -#: ../lib/puppet/pops/lookup/lookup_adapter.rb:441 +#: ../lib/puppet/pops/lookup/lookup_adapter.rb:442 msgid "Defining \"data_provider\": \"%{name}\" in metadata.json is deprecated." msgstr "" -#: ../lib/puppet/pops/lookup/lookup_adapter.rb:442 ../lib/puppet/pops/lookup/lookup_adapter.rb:496 +#: ../lib/puppet/pops/lookup/lookup_adapter.rb:443 ../lib/puppet/pops/lookup/lookup_adapter.rb:497 msgid "A '%{hiera_config}' file should be used instead" msgstr "" -#: ../lib/puppet/pops/lookup/lookup_adapter.rb:456 +#: ../lib/puppet/pops/lookup/lookup_adapter.rb:457 msgid "Environment '%{env}', cannot find module_data_provider '%{provider}'" msgstr "" -#: ../lib/puppet/pops/lookup/lookup_adapter.rb:480 +#: ../lib/puppet/pops/lookup/lookup_adapter.rb:481 msgid "Defining environment_data_provider='%{provider_name}' in environment.conf is deprecated" msgstr "" -#: ../lib/puppet/pops/lookup/lookup_adapter.rb:484 +#: ../lib/puppet/pops/lookup/lookup_adapter.rb:485 msgid "The environment_data_provider='%{provider_name}' setting is ignored since '%{config_path}' version >= 5" msgstr "" -#: ../lib/puppet/pops/lookup/lookup_adapter.rb:495 +#: ../lib/puppet/pops/lookup/lookup_adapter.rb:496 msgid "Defining environment_data_provider='%{provider_name}' in environment.conf is deprecated." msgstr "" -#: ../lib/puppet/pops/lookup/lookup_adapter.rb:511 +#: ../lib/puppet/pops/lookup/lookup_adapter.rb:512 msgid "Environment '%{env}', cannot find environment_data_provider '%{provider}'" msgstr "" @@ -5713,11 +5713,11 @@ msgid "Unacceptable transform - found an Object without a rule: %{klass}" msgstr "" #. TRANSLATORS 'NUMBER' refers to a method name and the 'name_or_numeric' was the passed in value and should not be translated -#: ../lib/puppet/pops/model/factory.rb:812 +#: ../lib/puppet/pops/model/factory.rb:813 msgid "Internal Error, NUMBER token does not contain a valid number, %{name_or_numeric}" msgstr "" -#: ../lib/puppet/pops/model/factory.rb:1121 +#: ../lib/puppet/pops/model/factory.rb:1122 msgid "can only concatenate strings, got %{class_name}" msgstr "" @@ -6287,11 +6287,11 @@ msgstr "" msgid "No AIX group exists with a group name or gid of %{group}!" msgstr "" -#: ../lib/puppet/provider/group/groupadd.rb:11 ../lib/puppet/provider/group/pw.rb:14 +#: ../lib/puppet/provider/group/groupadd.rb:14 ../lib/puppet/provider/group/pw.rb:14 msgid "GID must be an integer" msgstr "" -#: ../lib/puppet/provider/group/groupadd.rb:44 +#: ../lib/puppet/provider/group/groupadd.rb:47 msgid "GID %{resource} already exists, use allowdupe to force group creation" msgstr "" @@ -6644,7 +6644,11 @@ msgstr "" msgid "pkg warning: %{warnings}" msgstr "" -#: ../lib/puppet/provider/package/pkg.rb:245 ../lib/puppet/provider/package/pkg.rb:271 +#: ../lib/puppet/provider/package/pkg.rb:245 +msgid "Pkg could not install %{name} after %{tries} tries. Aborting run" +msgstr "" + +#: ../lib/puppet/provider/package/pkg.rb:255 ../lib/puppet/provider/package/pkg.rb:281 msgid "Unable to update %{package}" msgstr "" @@ -7107,39 +7111,39 @@ msgstr "" msgid "%{param} is a metaparameter; please choose another parameter name in the %{name} definition" msgstr "" -#: ../lib/puppet/resource/type_collection.rb:63 +#: ../lib/puppet/resource/type_collection.rb:64 msgid "Class '%{klass}' is already defined%{error}; cannot redefine" msgstr "" -#: ../lib/puppet/resource/type_collection.rb:64 +#: ../lib/puppet/resource/type_collection.rb:65 msgid "Node '%{klass}' is already defined%{error}; cannot be redefined as a class" msgstr "" -#: ../lib/puppet/resource/type_collection.rb:65 +#: ../lib/puppet/resource/type_collection.rb:66 msgid "Definition '%{klass}' is already defined%{error}; cannot be redefined as a class" msgstr "" -#: ../lib/puppet/resource/type_collection.rb:96 +#: ../lib/puppet/resource/type_collection.rb:97 msgid "Node '%{name}' is already defined%{error}; cannot redefine" msgstr "" -#: ../lib/puppet/resource/type_collection.rb:97 +#: ../lib/puppet/resource/type_collection.rb:98 msgid "Class '%{klass}' is already defined%{error}; cannot be redefined as a node" msgstr "" -#: ../lib/puppet/resource/type_collection.rb:132 +#: ../lib/puppet/resource/type_collection.rb:133 msgid "'%{name}' is already defined%{error} as a class; cannot redefine as a definition" msgstr "" -#: ../lib/puppet/resource/type_collection.rb:133 +#: ../lib/puppet/resource/type_collection.rb:134 msgid "Definition '%{name}' is already defined%{error}; cannot be redefined" msgstr "" -#: ../lib/puppet/resource/type_collection.rb:177 +#: ../lib/puppet/resource/type_collection.rb:178 msgid "Execution of config_version command `%{cmd}` failed: %{message}" msgstr "" -#: ../lib/puppet/resource/type_collection.rb:198 +#: ../lib/puppet/resource/type_collection.rb:199 msgid "Not attempting to load %{type} %{fqname} as this object was missing during a prior compilation" msgstr "" @@ -7323,11 +7327,11 @@ msgstr "" msgid "Invalid settings in environment.conf at '%{path_to_conf_file}'. The following unknown setting(s) are being ignored: %{ignored_settings}" msgstr "" -#: ../lib/puppet/settings/file_setting.rb:183 +#: ../lib/puppet/settings/file_setting.rb:178 msgid "Settings parameter '%{name}' is undefined" msgstr "" -#: ../lib/puppet/settings/file_setting.rb:219 +#: ../lib/puppet/settings/file_setting.rb:214 msgid "The %{parameter} parameter for the setting '%{name}' must be either 'root' or 'service', not '%{value}'" msgstr "" @@ -8024,56 +8028,56 @@ msgstr "" msgid "'%{cmd}' returned %{status} instead of one of [%{expected}]" msgstr "" -#: ../lib/puppet/type/exec.rb:208 +#: ../lib/puppet/type/exec.rb:216 msgid "Command must be a String or Array, got value of class %{klass}" msgstr "" -#: ../lib/puppet/type/exec.rb:241 +#: ../lib/puppet/type/exec.rb:249 msgid "Unable to execute commands as other users on Windows" msgstr "" -#: ../lib/puppet/type/exec.rb:243 +#: ../lib/puppet/type/exec.rb:251 msgid "Only root can execute commands as other users" msgstr "" -#: ../lib/puppet/type/exec.rb:299 +#: ../lib/puppet/type/exec.rb:307 msgid "Invalid environment setting '%{value}'" msgstr "" -#: ../lib/puppet/type/exec.rb:312 +#: ../lib/puppet/type/exec.rb:320 msgid "The umask specification is invalid: %{value}" msgstr "" -#: ../lib/puppet/type/exec.rb:328 +#: ../lib/puppet/type/exec.rb:336 msgid "The timeout must be a number." msgstr "" -#: ../lib/puppet/type/exec.rb:345 +#: ../lib/puppet/type/exec.rb:353 msgid "Tries must be an integer" msgstr "" -#: ../lib/puppet/type/exec.rb:349 +#: ../lib/puppet/type/exec.rb:357 msgid "Tries must be an integer >= 1" msgstr "" -#: ../lib/puppet/type/exec.rb:362 +#: ../lib/puppet/type/exec.rb:370 msgid "try_sleep must be a number" msgstr "" -#: ../lib/puppet/type/exec.rb:366 +#: ../lib/puppet/type/exec.rb:374 msgid "try_sleep cannot be a negative number" msgstr "" #. TRANSLATORS 'creates' is a parameter name and should not be translated -#: ../lib/puppet/type/exec.rb:438 +#: ../lib/puppet/type/exec.rb:446 msgid "Checking that 'creates' path '%{creates_path}' exists" msgstr "" -#: ../lib/puppet/type/exec.rb:490 ../lib/puppet/type/exec.rb:553 +#: ../lib/puppet/type/exec.rb:498 ../lib/puppet/type/exec.rb:561 msgid "Check %{value} exceeded timeout" msgstr "" -#: ../lib/puppet/type/exec.rb:645 +#: ../lib/puppet/type/exec.rb:653 msgid "'%{cmd}' won't be executed because of failed check '%{check}'" msgstr "" @@ -8218,11 +8222,11 @@ msgstr "" msgid "Could not create %{type} filebucket: %{detail}" msgstr "" -#: ../lib/puppet/type/group.rb:60 +#: ../lib/puppet/type/group.rb:59 msgid "GID cannot be deleted" msgstr "" -#: ../lib/puppet/type/group.rb:72 +#: ../lib/puppet/type/group.rb:71 msgid "Invalid GID %{gid}" msgstr "" @@ -8310,15 +8314,15 @@ msgstr "" msgid "%{value} is not a valid day of the week" msgstr "" -#: ../lib/puppet/type/service.rb:151 ../lib/puppet/type/user.rb:272 +#: ../lib/puppet/type/service.rb:151 ../lib/puppet/type/user.rb:271 msgid "Passwords cannot include ':'" msgstr "" -#: ../lib/puppet/type/service.rb:278 +#: ../lib/puppet/type/service.rb:283 msgid "\"%{value}\" is not a positive integer: the timeout parameter must be specified as a positive integer" msgstr "" -#: ../lib/puppet/type/service.rb:300 +#: ../lib/puppet/type/service.rb:305 msgid "The 'logonaccount' parameter is mandatory when setting 'logonpassword'." msgstr "" @@ -8353,81 +8357,81 @@ msgstr "" msgid "File does not exist" msgstr "" -#: ../lib/puppet/type/user.rb:183 +#: ../lib/puppet/type/user.rb:182 msgid "Could not find group(s) %{groups}" msgstr "" -#: ../lib/puppet/type/user.rb:292 +#: ../lib/puppet/type/user.rb:291 msgid "Password minimum age must be provided as a number." msgstr "" -#: ../lib/puppet/type/user.rb:311 +#: ../lib/puppet/type/user.rb:310 msgid "Password maximum age must be provided as a number." msgstr "" -#: ../lib/puppet/type/user.rb:342 +#: ../lib/puppet/type/user.rb:341 msgid "Group names must be provided, not GID numbers." msgstr "" -#: ../lib/puppet/type/user.rb:344 +#: ../lib/puppet/type/user.rb:343 msgid "Group names must be provided as an array, not a comma-separated list." msgstr "" -#: ../lib/puppet/type/user.rb:345 +#: ../lib/puppet/type/user.rb:344 msgid "Group names must not be empty. If you want to specify \"no groups\" pass an empty array" msgstr "" -#: ../lib/puppet/type/user.rb:438 +#: ../lib/puppet/type/user.rb:437 msgid "User provider %{name} can not manage home directories" msgstr "" #. TRANSLATORS YYYY-MM-DD represents a date with a four-digit year, a two-digit month, and a two-digit day, #. TRANSLATORS separated by dashes. -#: ../lib/puppet/type/user.rb:455 +#: ../lib/puppet/type/user.rb:454 msgid "Expiry dates must be YYYY-MM-DD or the string \"absent\"" msgstr "" -#: ../lib/puppet/type/user.rb:522 +#: ../lib/puppet/type/user.rb:521 msgid "Role names must be provided, not numbers" msgstr "" -#: ../lib/puppet/type/user.rb:524 +#: ../lib/puppet/type/user.rb:523 msgid "Role names must be provided as an array, not a comma-separated list" msgstr "" -#: ../lib/puppet/type/user.rb:561 +#: ../lib/puppet/type/user.rb:560 msgid "Auth names must be provided, not numbers" msgstr "" -#: ../lib/puppet/type/user.rb:563 +#: ../lib/puppet/type/user.rb:562 msgid "Auth names must be provided as an array, not a comma-separated list" msgstr "" -#: ../lib/puppet/type/user.rb:587 +#: ../lib/puppet/type/user.rb:586 msgid "Profile names must be provided, not numbers" msgstr "" -#: ../lib/puppet/type/user.rb:589 +#: ../lib/puppet/type/user.rb:588 msgid "Profile names must be provided as an array, not a comma-separated list" msgstr "" -#: ../lib/puppet/type/user.rb:701 +#: ../lib/puppet/type/user.rb:700 msgid "Ssh_authorized_key type is not available. Cannot purge SSH keys." msgstr "" -#: ../lib/puppet/type/user.rb:739 +#: ../lib/puppet/type/user.rb:738 msgid "Each entry for purge_ssh_keys must be a string, not a %{klass}" msgstr "" -#: ../lib/puppet/type/user.rb:742 +#: ../lib/puppet/type/user.rb:741 msgid "Paths to keyfiles must be absolute, not %{entry}" msgstr "" -#: ../lib/puppet/type/user.rb:746 +#: ../lib/puppet/type/user.rb:745 msgid "purge_ssh_keys must be true, false, or an array of file names, not %{value}" msgstr "" -#: ../lib/puppet/type/user.rb:755 +#: ../lib/puppet/type/user.rb:754 msgid "Class name must be provided." msgstr "" @@ -8961,60 +8965,60 @@ msgid "Failed to set process priority to '%{priority}'" msgstr "" #. TRANSLATORS "Log.close_all" is a method name and should not be translated -#: ../lib/puppet/util/log.rb:67 +#: ../lib/puppet/util/log.rb:66 msgid "Log.close_all failed to close %{destinations}" msgstr "" -#: ../lib/puppet/util/log.rb:86 +#: ../lib/puppet/util/log.rb:85 msgid "Logs require a level" msgstr "" -#: ../lib/puppet/util/log.rb:87 ../lib/puppet/util/log.rb:378 ../lib/puppet/util/windows/eventlog.rb:99 +#: ../lib/puppet/util/log.rb:86 ../lib/puppet/util/log.rb:377 ../lib/puppet/util/windows/eventlog.rb:99 msgid "Invalid log level %{level}" msgstr "" -#: ../lib/puppet/util/log.rb:109 +#: ../lib/puppet/util/log.rb:108 msgid "Invalid loglevel %{level}" msgstr "" -#: ../lib/puppet/util/log.rb:136 +#: ../lib/puppet/util/log.rb:135 msgid "Unknown destination type %{dest}" msgstr "" -#: ../lib/puppet/util/log.rb:176 +#: ../lib/puppet/util/log.rb:175 msgid "Received a Log attribute with invalid encoding:%{log_message}" msgstr "" -#: ../lib/puppet/util/log.rb:178 +#: ../lib/puppet/util/log.rb:177 msgid "" "Backtrace:\n" "%{backtrace}" msgstr "" -#: ../lib/puppet/util/log.rb:232 +#: ../lib/puppet/util/log.rb:231 msgid "Reopening log files" msgstr "" #. TRANSLATORS 'Puppet::Util::Log' refers to a Puppet source code class -#: ../lib/puppet/util/log.rb:368 +#: ../lib/puppet/util/log.rb:367 msgid "Puppet::Util::Log requires a message" msgstr "" #. TRANSLATORS 'Puppet::Util::Log' refers to a Puppet source code class -#: ../lib/puppet/util/log.rb:374 +#: ../lib/puppet/util/log.rb:373 msgid "Puppet::Util::Log requires a log level" msgstr "" #. TRANSLATORS 'Puppet::Util::Log' refers to a Puppet source code class -#: ../lib/puppet/util/log.rb:376 +#: ../lib/puppet/util/log.rb:375 msgid "Puppet::Util::Log requires a symbol or string" msgstr "" -#: ../lib/puppet/util/log.rb:407 +#: ../lib/puppet/util/log.rb:406 msgid "Could not parse for environment %{environment}: %{msg}" msgstr "" -#: ../lib/puppet/util/log.rb:409 +#: ../lib/puppet/util/log.rb:408 msgid "%{msg} on node %{node}" msgstr "" @@ -9026,20 +9030,20 @@ msgstr "" msgid "Creating log directory %{dir}" msgstr "" -#: ../lib/puppet/util/logging.rb:81 ../lib/puppet/util/logging.rb:105 +#: ../lib/puppet/util/logging.rb:79 ../lib/puppet/util/logging.rb:103 msgid "Wrapped exception:" msgstr "" #. TRANSLATORS the literals ":file", ":line", and ":key" should not be translated -#: ../lib/puppet/util/logging.rb:162 +#: ../lib/puppet/util/logging.rb:160 msgid "Need either :file and :line, or :key" msgstr "" -#: ../lib/puppet/util/logging.rb:192 +#: ../lib/puppet/util/logging.rb:190 msgid "(file & line not available)" msgstr "" -#: ../lib/puppet/util/logging.rb:294 +#: ../lib/puppet/util/logging.rb:270 msgid "(location: %{location})" msgstr "" @@ -9207,19 +9211,19 @@ msgstr "" msgid "Creating state file %{file}" msgstr "" -#: ../lib/puppet/util/suidmanager.rb:104 +#: ../lib/puppet/util/suidmanager.rb:103 msgid "No such group %{group}" msgstr "" -#: ../lib/puppet/util/suidmanager.rb:120 +#: ../lib/puppet/util/suidmanager.rb:119 msgid "No such user %{user}" msgstr "" -#: ../lib/puppet/util/suidmanager.rb:148 +#: ../lib/puppet/util/suidmanager.rb:147 msgid "Invalid id type %{type}" msgstr "" -#: ../lib/puppet/util/suidmanager.rb:151 +#: ../lib/puppet/util/suidmanager.rb:150 msgid "Invalid %{klass}: %{id}" msgstr "" @@ -9259,7 +9263,7 @@ msgstr "" msgid "%{error}%{rest} in symbolic mode %{modification}" msgstr "" -#: ../lib/puppet/util/tagging.rb:27 +#: ../lib/puppet/util/tagging.rb:28 msgid "Invalid tag '%{name}'" msgstr "" @@ -9489,7 +9493,7 @@ msgstr "" msgid "An attempt to set mode %{mode} on item %{path} would result in the group, SYSTEM, to have less than Full Control rights. This attempt has been corrected to Full Control" msgstr "" -#: ../lib/puppet/util/windows/security.rb:433 ../lib/puppet/util/windows/security.rb:450 ../lib/puppet/util/windows/sid.rb:159 ../lib/puppet/util/windows/sid.rb:221 ../lib/puppet/util/windows/user.rb:59 +#: ../lib/puppet/util/windows/security.rb:433 ../lib/puppet/util/windows/security.rb:450 ../lib/puppet/util/windows/sid.rb:159 ../lib/puppet/util/windows/sid.rb:221 ../lib/puppet/util/windows/user.rb:58 msgid "Invalid SID" msgstr "" @@ -9661,23 +9665,23 @@ msgstr "" msgid "Failed to convert string SID: %{string_sid}" msgstr "" -#: ../lib/puppet/util/windows/user.rb:54 +#: ../lib/puppet/util/windows/user.rb:53 msgid "Failed to create administrators SID" msgstr "" -#: ../lib/puppet/util/windows/user.rb:64 +#: ../lib/puppet/util/windows/user.rb:63 msgid "Failed to check membership" msgstr "" -#: ../lib/puppet/util/windows/user.rb:104 +#: ../lib/puppet/util/windows/user.rb:103 msgid "Failed to logon user %{name}" msgstr "" -#: ../lib/puppet/util/windows/user.rb:135 +#: ../lib/puppet/util/windows/user.rb:134 msgid "Failed to load user profile %{user}" msgstr "" -#: ../lib/puppet/util/windows/user.rb:141 +#: ../lib/puppet/util/windows/user.rb:140 msgid "Failed to unload user profile %{user}" msgstr "" From a410e2fbe9b5f896608d40573bf10af4866925d3 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Wed, 29 Sep 2021 15:10:42 -0700 Subject: [PATCH 446/731] (maint) Return ProcessOutput instead of using CHILD_STATUS The package tests in main don't rely on CHILD_STATUS anymore, so adapt the test to return ProcessOutput explicitly. --- spec/unit/provider/package/pkg_spec.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/spec/unit/provider/package/pkg_spec.rb b/spec/unit/provider/package/pkg_spec.rb index 6504e8334f7..b2345387b3a 100644 --- a/spec/unit/provider/package/pkg_spec.rb +++ b/spec/unit/provider/package/pkg_spec.rb @@ -414,16 +414,17 @@ def self.it_should_respond_to(*actions) .and_return(Puppet::Util::Execution::ProcessOutput.new('', 0)) provider.insync?(is) end - + it "should try 5 times to install and fail when all tries failed" do allow_any_instance_of(Kernel).to receive(:sleep) - + expect(provider).to receive(:query).and_return({:ensure => :absent}) expect(provider).to receive(:properties).and_return({:mark => :hold}) expect(provider).to receive(:unhold) expect(Puppet::Util::Execution).to receive(:execute) - .with(['/bin/pkg', 'install', *hash[:flags], 'dummy'], {:failonfail => false, :combine => true}).exactly(5).times - allow($CHILD_STATUS).to receive(:exitstatus).and_return(7) + .with(['/bin/pkg', 'install', *hash[:flags], 'dummy'], {:failonfail => false, :combine => true}) + .and_return(Puppet::Util::Execution::ProcessOutput.new('', 7)) + .exactly(5).times expect { provider.update }.to raise_error(Puppet::Error, /Pkg could not install dummy after 5 tries. Aborting run/) From ba1e8af0717c6116f77d8665db115887d30c2ff1 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Fri, 1 Oct 2021 07:32:44 +0000 Subject: [PATCH 447/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 2 +- man/man8/puppet-agent.8 | 2 +- man/man8/puppet-apply.8 | 2 +- man/man8/puppet-catalog.8 | 2 +- man/man8/puppet-config.8 | 2 +- man/man8/puppet-describe.8 | 2 +- man/man8/puppet-device.8 | 2 +- man/man8/puppet-doc.8 | 2 +- man/man8/puppet-epp.8 | 2 +- man/man8/puppet-facts.8 | 2 +- man/man8/puppet-filebucket.8 | 2 +- man/man8/puppet-generate.8 | 2 +- man/man8/puppet-help.8 | 2 +- man/man8/puppet-lookup.8 | 2 +- man/man8/puppet-module.8 | 2 +- man/man8/puppet-node.8 | 2 +- man/man8/puppet-parser.8 | 2 +- man/man8/puppet-plugin.8 | 2 +- man/man8/puppet-report.8 | 2 +- man/man8/puppet-resource.8 | 2 +- man/man8/puppet-script.8 | 2 +- man/man8/puppet-ssl.8 | 2 +- man/man8/puppet.8 | 2 +- 23 files changed, 23 insertions(+), 23 deletions(-) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index 0c39c157c08..cf1c441f9ec 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPETCONF" "5" "September 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPETCONF" "5" "October 2021" "Puppet, Inc." "Puppet manual" \fBThis page is autogenerated; any changes will get overwritten\fR . .SH "Configuration settings" diff --git a/man/man8/puppet-agent.8 b/man/man8/puppet-agent.8 index 4208ec9800a..7ba8d3b3a7c 100644 --- a/man/man8/puppet-agent.8 +++ b/man/man8/puppet-agent.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-AGENT" "8" "September 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-AGENT" "8" "October 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-agent\fR \- The puppet agent daemon diff --git a/man/man8/puppet-apply.8 b/man/man8/puppet-apply.8 index f2ca2d35f79..9f6ac1c0512 100644 --- a/man/man8/puppet-apply.8 +++ b/man/man8/puppet-apply.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-APPLY" "8" "September 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-APPLY" "8" "October 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-apply\fR \- Apply Puppet manifests locally diff --git a/man/man8/puppet-catalog.8 b/man/man8/puppet-catalog.8 index 453c2138070..aa28dc75893 100644 --- a/man/man8/puppet-catalog.8 +++ b/man/man8/puppet-catalog.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-CATALOG" "8" "September 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-CATALOG" "8" "October 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-catalog\fR \- Compile, save, view, and convert catalogs\. diff --git a/man/man8/puppet-config.8 b/man/man8/puppet-config.8 index e8f2fd84241..baf499aa5ac 100644 --- a/man/man8/puppet-config.8 +++ b/man/man8/puppet-config.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-CONFIG" "8" "September 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-CONFIG" "8" "October 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-config\fR \- Interact with Puppet\'s settings\. diff --git a/man/man8/puppet-describe.8 b/man/man8/puppet-describe.8 index 49bc7efebf2..aeabfac69eb 100644 --- a/man/man8/puppet-describe.8 +++ b/man/man8/puppet-describe.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-DESCRIBE" "8" "September 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-DESCRIBE" "8" "October 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-describe\fR \- Display help about resource types diff --git a/man/man8/puppet-device.8 b/man/man8/puppet-device.8 index 6a03eaf14d6..bfe91103ca3 100644 --- a/man/man8/puppet-device.8 +++ b/man/man8/puppet-device.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-DEVICE" "8" "September 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-DEVICE" "8" "October 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-device\fR \- Manage remote network devices diff --git a/man/man8/puppet-doc.8 b/man/man8/puppet-doc.8 index bfb194e511d..5c972d36b5c 100644 --- a/man/man8/puppet-doc.8 +++ b/man/man8/puppet-doc.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-DOC" "8" "September 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-DOC" "8" "October 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-doc\fR \- Generate Puppet references diff --git a/man/man8/puppet-epp.8 b/man/man8/puppet-epp.8 index 766fcea7938..6ca1eb80b12 100644 --- a/man/man8/puppet-epp.8 +++ b/man/man8/puppet-epp.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-EPP" "8" "September 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-EPP" "8" "October 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-epp\fR \- Interact directly with the EPP template parser/renderer\. diff --git a/man/man8/puppet-facts.8 b/man/man8/puppet-facts.8 index e60cfe16651..136934967f3 100644 --- a/man/man8/puppet-facts.8 +++ b/man/man8/puppet-facts.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-FACTS" "8" "September 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-FACTS" "8" "October 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-facts\fR \- Retrieve and store facts\. diff --git a/man/man8/puppet-filebucket.8 b/man/man8/puppet-filebucket.8 index 33d1ebad173..ef419f02a10 100644 --- a/man/man8/puppet-filebucket.8 +++ b/man/man8/puppet-filebucket.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-FILEBUCKET" "8" "September 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-FILEBUCKET" "8" "October 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-filebucket\fR \- Store and retrieve files in a filebucket diff --git a/man/man8/puppet-generate.8 b/man/man8/puppet-generate.8 index 5b9f22cd4b4..1dcbaa90120 100644 --- a/man/man8/puppet-generate.8 +++ b/man/man8/puppet-generate.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-GENERATE" "8" "September 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-GENERATE" "8" "October 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-generate\fR \- Generates Puppet code from Ruby definitions\. diff --git a/man/man8/puppet-help.8 b/man/man8/puppet-help.8 index 5d5f53203ad..894765e691f 100644 --- a/man/man8/puppet-help.8 +++ b/man/man8/puppet-help.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-HELP" "8" "September 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-HELP" "8" "October 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-help\fR \- Display Puppet help\. diff --git a/man/man8/puppet-lookup.8 b/man/man8/puppet-lookup.8 index d2d5e89e2ac..ae36a301ab1 100644 --- a/man/man8/puppet-lookup.8 +++ b/man/man8/puppet-lookup.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-LOOKUP" "8" "September 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-LOOKUP" "8" "October 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-lookup\fR \- Interactive Hiera lookup diff --git a/man/man8/puppet-module.8 b/man/man8/puppet-module.8 index 75ca215f2d8..2c7bcf6656e 100644 --- a/man/man8/puppet-module.8 +++ b/man/man8/puppet-module.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-MODULE" "8" "September 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-MODULE" "8" "October 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-module\fR \- Creates, installs and searches for modules on the Puppet Forge\. diff --git a/man/man8/puppet-node.8 b/man/man8/puppet-node.8 index 42cd55b7540..96bdedd2d62 100644 --- a/man/man8/puppet-node.8 +++ b/man/man8/puppet-node.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-NODE" "8" "September 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-NODE" "8" "October 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-node\fR \- View and manage node definitions\. diff --git a/man/man8/puppet-parser.8 b/man/man8/puppet-parser.8 index 37b31eebbf6..a3b08017fae 100644 --- a/man/man8/puppet-parser.8 +++ b/man/man8/puppet-parser.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-PARSER" "8" "September 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-PARSER" "8" "October 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-parser\fR \- Interact directly with the parser\. diff --git a/man/man8/puppet-plugin.8 b/man/man8/puppet-plugin.8 index 0c74c0f98df..f5d72dcef26 100644 --- a/man/man8/puppet-plugin.8 +++ b/man/man8/puppet-plugin.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-PLUGIN" "8" "September 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-PLUGIN" "8" "October 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-plugin\fR \- Interact with the Puppet plugin system\. diff --git a/man/man8/puppet-report.8 b/man/man8/puppet-report.8 index 32e703687b9..84bd2a6dd29 100644 --- a/man/man8/puppet-report.8 +++ b/man/man8/puppet-report.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-REPORT" "8" "September 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-REPORT" "8" "October 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-report\fR \- Create, display, and submit reports\. diff --git a/man/man8/puppet-resource.8 b/man/man8/puppet-resource.8 index aab116d2fa4..30721ae317b 100644 --- a/man/man8/puppet-resource.8 +++ b/man/man8/puppet-resource.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-RESOURCE" "8" "September 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-RESOURCE" "8" "October 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-resource\fR \- The resource abstraction layer shell diff --git a/man/man8/puppet-script.8 b/man/man8/puppet-script.8 index aed9e79b583..beefd2b878e 100644 --- a/man/man8/puppet-script.8 +++ b/man/man8/puppet-script.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-SCRIPT" "8" "September 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-SCRIPT" "8" "October 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-script\fR \- Run a puppet manifests as a script without compiling a catalog diff --git a/man/man8/puppet-ssl.8 b/man/man8/puppet-ssl.8 index 73896a3782c..25ab1bb78bc 100644 --- a/man/man8/puppet-ssl.8 +++ b/man/man8/puppet-ssl.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-SSL" "8" "September 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-SSL" "8" "October 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-ssl\fR \- Manage SSL keys and certificates for puppet SSL clients diff --git a/man/man8/puppet.8 b/man/man8/puppet.8 index 7a66fc7c2d1..0cd8890da27 100644 --- a/man/man8/puppet.8 +++ b/man/man8/puppet.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET" "8" "September 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET" "8" "October 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\fR From bda1e273234d2952a15f68c4d1e4afea22521f7d Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Thu, 30 Sep 2021 16:55:42 -0700 Subject: [PATCH 448/731] (PUP-11311) Add 10 role manifests to each module Adds 10 role manifests to each module in the many_module benchmark as it provides a better gauge for Pathname usage. --- benchmarks/many_modules/benchmarker.rb | 13 ++++++++++++- benchmarks/many_modules/module/init.pp.erb | 3 +++ benchmarks/many_modules/module/role.pp.erb | 3 +++ 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 benchmarks/many_modules/module/role.pp.erb diff --git a/benchmarks/many_modules/benchmarker.rb b/benchmarks/many_modules/benchmarker.rb index aac13d96ef9..cb80fee5baa 100644 --- a/benchmarks/many_modules/benchmarker.rb +++ b/benchmarks/many_modules/benchmarker.rb @@ -70,13 +70,24 @@ def generate ) end + roles = 0.upto(10).to_a + render(File.join(templates, 'module', 'init.pp.erb'), File.join(manifests, 'init.pp'), - :name => module_name) + :name => module_name, + :roles => roles + ) render(File.join(templates, 'module', 'internal.pp.erb'), File.join(manifests, 'internal.pp'), :name => module_name) + + roles.each do |j| + render(File.join(templates, 'module', 'role.pp.erb'), + File.join(manifests, "role#{i}.pp"), + :name => module_name, + :index => j) + end end render(File.join(templates, 'puppet.conf.erb'), diff --git a/benchmarks/many_modules/module/init.pp.erb b/benchmarks/many_modules/module/init.pp.erb index 49fca07ba57..758527f2eb0 100644 --- a/benchmarks/many_modules/module/init.pp.erb +++ b/benchmarks/many_modules/module/init.pp.erb @@ -1,3 +1,6 @@ class <%= name %> { class { "<%= name %>::internal": } + <% roles.each do |role| %> + class { "<%= name %>::role<%= role %>": } + <% end %> } diff --git a/benchmarks/many_modules/module/role.pp.erb b/benchmarks/many_modules/module/role.pp.erb new file mode 100644 index 00000000000..ef23fed82a5 --- /dev/null +++ b/benchmarks/many_modules/module/role.pp.erb @@ -0,0 +1,3 @@ +class <%= name %>::role<%= index %> { + notify { "<%= name %>::role<%= index %>": } +} From 26de1243fdcceab2bf5e1091e1c035b946562d9d Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Fri, 1 Oct 2021 10:55:04 -0700 Subject: [PATCH 449/731] (PUP-11311) Monkey patch Pathname#absolute? and relative? The unoptimized version makes N+1 substrings where N is the number of path components: /a/b/c /a/b /a '' It's worse on Windows due to the long install path. The optimization was released in Ruby 3, so make it conditional. --- lib/puppet/util/monkey_patches.rb | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/lib/puppet/util/monkey_patches.rb b/lib/puppet/util/monkey_patches.rb index 71415e10f39..5bbe1822e8f 100644 --- a/lib/puppet/util/monkey_patches.rb +++ b/lib/puppet/util/monkey_patches.rb @@ -29,6 +29,28 @@ def daemonize end end +if RUBY_VERSION.to_f < 3.0 + # absolute/relative were optimized to avoid chop_basename in ruby 3 + # see https://github.com/ruby/ruby/commit/39312cf4d6c2ab3f07d688ad1a467c8f84b58db0 + require 'pathname' + class Pathname + if File.dirname('A:') == 'A:.' # DOSish drive letter + ABSOLUTE_PATH = /\A(?:[A-Za-z]:|#{SEPARATOR_PAT})/o + else + ABSOLUTE_PATH = /\A#{SEPARATOR_PAT}/o + end + private_constant :ABSOLUTE_PATH + + def absolute? + ABSOLUTE_PATH.match? @path + end + + def relative? + !absolute? + end + end +end + # (#19151) Reject all SSLv2 ciphers and handshakes require_relative '../../puppet/ssl/openssl_loader' unless Puppet::Util::Platform.jruby_fips? From 176609f7687319b160689fe56a7749a2567e9127 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Mon, 4 Oct 2021 12:27:14 +0000 Subject: [PATCH 450/731] (packaging) Bump to version '7.12.1' [no-promote] --- .gemspec | 2 +- lib/puppet/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gemspec b/.gemspec index bfa0178d9f3..c80f38e6abb 100644 --- a/.gemspec +++ b/.gemspec @@ -13,7 +13,7 @@ Gem::Specification.new do |s| s.name = "puppet" - version = "7.12.0" + version = "7.12.1" mdata = version.match(/(\d+\.\d+\.\d+)/) s.version = mdata ? mdata[1] : version diff --git a/lib/puppet/version.rb b/lib/puppet/version.rb index 403480deda0..25b85f7aa9e 100644 --- a/lib/puppet/version.rb +++ b/lib/puppet/version.rb @@ -6,7 +6,7 @@ # Raketasks and such to set the version based on the output of `git describe` module Puppet - PUPPETVERSION = '7.12.0' + PUPPETVERSION = '7.12.1' ## # version is a public API method intended to always provide a fast and From 50d3184fba4f43957a371e57ad09cadaf1b7a268 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Mon, 4 Oct 2021 12:39:05 +0000 Subject: [PATCH 451/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 2 +- man/man8/puppet.8 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index cf1c441f9ec..3edc407fc7c 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -929,7 +929,7 @@ The time to wait for data to be read from an HTTP connection\. If nothing is rea The HTTP User\-Agent string to send when making network requests\. . .IP "\(bu" 4 -\fIDefault\fR: \fBPuppet/7\.12\.0 Ruby/2\.5\.1\-p57 (x86_64\-linux)\fR +\fIDefault\fR: \fBPuppet/7\.12\.1 Ruby/2\.5\.1\-p57 (x86_64\-linux)\fR . .IP "" 0 . diff --git a/man/man8/puppet.8 b/man/man8/puppet.8 index 0cd8890da27..5184fc2ee1f 100644 --- a/man/man8/puppet.8 +++ b/man/man8/puppet.8 @@ -25,4 +25,4 @@ Specialized: 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 . .P -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\.12\.0 +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\.12\.1 From d3a2ea9f5d825037ec3e5f72c26f6199ad121bd5 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Tue, 28 Sep 2021 15:59:42 -0700 Subject: [PATCH 452/731] (PUP-9561) Optimize parameter validation for blocks Puppet used to infer types for arguments passed to a block. This was slow for several reasons: * Type inference is generally slow for large collections (hash/array) * Iterable functions like `reduce` pass an accumulator to the block for each iteration, so we inferred the accumulator's type multiple times. * When building a collection using `reduce`, the accumulator increases in size each time. So constructions like the following infer the type of an accumulator of size 0, 1, ..., N-1, which is equivalent to inferring the type of an accumulator of size N(N-1)/2: Integer[1, N].reduce([]) |$memo, $value| { $memo << $value} However, block arguments are often defined without a type, e.g. `$memo`, so the type inference was wasted effort. This commit switches from `callable?` to `callable_with?`. So rather than inferring the type of all arguments, and checking if those types are assignable to the parameter's type, we instead check if each argument is an instance of the parameter's type. For example, we check if the Ruby Hash {} is an instance of the `PAnyType`, which is always true[1]. The `callable_with?` method also checks required and optional parameters and return types, like the `callable?` method does. Note the `callable_with?` method was introduced in 2edd30e0 to address similar type inference slowness. [1] https://github.com/puppetlabs/puppet/blob/7.11.0/lib/puppet/pops/types/types.rb#L268 --- lib/puppet/pops/evaluator/closure.rb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/puppet/pops/evaluator/closure.rb b/lib/puppet/pops/evaluator/closure.rb index c560c9250fb..546204837db 100644 --- a/lib/puppet/pops/evaluator/closure.rb +++ b/lib/puppet/pops/evaluator/closure.rb @@ -219,16 +219,15 @@ def enclosing_scope def call_with_scope(scope, args) variable_bindings = combine_values_with_parameters(scope, args) - tc = Types::TypeCalculator.singleton - final_args = tc.infer_set(parameters.reduce([]) do |tmp_args, param| + final_args = parameters.reduce([]) do |tmp_args, param| if param.captures_rest tmp_args.concat(variable_bindings[param.name]) else tmp_args << variable_bindings[param.name] end - end) + end - if type.callable?(final_args) + if type.callable_with?(final_args, block_type) result = catch(:next) do @evaluator.evaluate_block_with_bindings(scope, variable_bindings, @model.body) end @@ -236,7 +235,9 @@ def call_with_scope(scope, args) "value returned from #{closure_name}" end else - raise ArgumentError, Types::TypeMismatchDescriber.describe_signatures(closure_name, [self], final_args) + tc = Types::TypeCalculator.singleton + args_type = tc.infer_set(final_args) + raise ArgumentError, Types::TypeMismatchDescriber.describe_signatures(closure_name, [self], args_type) end end @@ -309,6 +310,7 @@ def create_callable_type() to += param_range[1] end param_types = Types::PTupleType.new(types, Types::PIntegerType.new(from, to)) + # The block_type for a Closure is always nil for now, see comment in block_name above Types::PCallableType.new(param_types, nil, return_type) end From cf693bff692424a987deecc544daa69fdf1ff96f Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Fri, 8 Oct 2021 20:06:35 -0700 Subject: [PATCH 453/731] (maint) Ensure benchmark's manifest matches class name Use j not i when naming the manifest, so the name matches the class. --- benchmarks/many_modules/benchmarker.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/benchmarks/many_modules/benchmarker.rb b/benchmarks/many_modules/benchmarker.rb index cb80fee5baa..d94ae39b65f 100644 --- a/benchmarks/many_modules/benchmarker.rb +++ b/benchmarks/many_modules/benchmarker.rb @@ -84,7 +84,7 @@ def generate roles.each do |j| render(File.join(templates, 'module', 'role.pp.erb'), - File.join(manifests, "role#{i}.pp"), + File.join(manifests, "role#{j}.pp"), :name => module_name, :index => j) end From 9a8d3ef017cf63ce0f848ec64394f7bad287e825 Mon Sep 17 00:00:00 2001 From: Dorin Pleava Date: Fri, 27 Aug 2021 15:17:00 +0300 Subject: [PATCH 454/731] (PUP-11188) Do not add auth and cookie header when redirecting When following HTTP redirects the authentication and cookie header is passed to different hosts, which may leak sensitive information. Now the authentication and cookie header is not added when redirecting to different hosts. The headers are added when redirecting to the same host, or when adding the new Puppet setting `:location_trusted`. --- lib/puppet/defaults.rb | 6 ++++ lib/puppet/http/client.rb | 2 +- lib/puppet/http/redirector.rb | 5 +++ spec/unit/http/client_spec.rb | 59 ++++++++++++++++++++++++++++++++++- 4 files changed, 70 insertions(+), 2 deletions(-) diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb index 07a7e8b51a0..907a8a98ce5 100644 --- a/lib/puppet/defaults.rb +++ b/lib/puppet/defaults.rb @@ -761,6 +761,12 @@ def self.initialize_default_settings!(settings) :owner => "service", :group => "service", :desc => "The directory where catalog previews per node are generated." + }, + :location_trusted => { + :default => false, + :type => :boolean, + :desc => "This will allow sending the name + password and the cookie header to all hosts that puppet may redirect to. + 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." } ) diff --git a/lib/puppet/http/client.rb b/lib/puppet/http/client.rb index 15b47af4446..8effcb1f2aa 100644 --- a/lib/puppet/http/client.rb +++ b/lib/puppet/http/client.rb @@ -346,7 +346,7 @@ def execute_streaming(request, options: {}, &block) while !done do connect(request.uri, options: options) do |http| - apply_auth(request, basic_auth) + apply_auth(request, basic_auth) if redirects.zero? # don't call return within the `request` block http.request(request) do |nethttp| diff --git a/lib/puppet/http/redirector.rb b/lib/puppet/http/redirector.rb index 0b1c6fef80e..ef1a61e6e78 100644 --- a/lib/puppet/http/redirector.rb +++ b/lib/puppet/http/redirector.rb @@ -49,6 +49,11 @@ def redirect_to(request, response, redirects) new_request = request.class.new(url) new_request.body = request.body request.each do |header, value| + unless Puppet[:location_trusted] + # skip adding potentially sensitive header to other hosts + next if header.casecmp('Authorization').zero? && request.uri.host.casecmp(location.host) != 0 + next if header.casecmp('Cookie').zero? && request.uri.host.casecmp(location.host) != 0 + end new_request[header] = value end diff --git a/spec/unit/http/client_spec.rb b/spec/unit/http/client_spec.rb index a4fa2b06dfd..d9f05d3ae58 100644 --- a/spec/unit/http/client_spec.rb +++ b/spec/unit/http/client_spec.rb @@ -597,11 +597,68 @@ def redirect_to(status: 302, url:) expect(response).to be_success end - it "preserves basic authorization" do + it "does not preserve basic authorization when redirecting to different hosts" do + stub_request(:get, start_url).with(basic_auth: credentials).to_return(redirect_to(url: other_host)) + stub_request(:get, other_host).to_return(status: 200) + + client.get(start_url, options: {basic_auth: {user: 'user', password: 'pass'}}) + expect(a_request(:get, other_host). + with{ |req| !req.headers.key?('Authorization')}).to have_been_made + end + + it "does preserve basic authorization when redirecting to the same hosts" do + stub_request(:get, start_url).with(basic_auth: credentials).to_return(redirect_to(url: bar_url)) + stub_request(:get, bar_url).with(basic_auth: credentials).to_return(status: 200) + + client.get(start_url, options: {basic_auth: {user: 'user', password: 'pass'}}) + expect(a_request(:get, bar_url). + with{ |req| req.headers.key?('Authorization')}).to have_been_made + end + + it "does not preserve cookie header when redirecting to different hosts" do + headers = { 'Cookie' => 'TEST_COOKIE'} + + stub_request(:get, start_url).with(headers: headers).to_return(redirect_to(url: other_host)) + stub_request(:get, other_host).to_return(status: 200) + + client.get(start_url, headers: headers) + expect(a_request(:get, other_host). + with{ |req| !req.headers.key?('Cookie')}).to have_been_made + end + + it "does preserve cookie header when redirecting to the same hosts" do + headers = { 'Cookie' => 'TEST_COOKIE'} + + stub_request(:get, start_url).with(headers: headers).to_return(redirect_to(url: bar_url)) + stub_request(:get, bar_url).with(headers: headers).to_return(status: 200) + + client.get(start_url, headers: headers) + expect(a_request(:get, bar_url). + with{ |req| req.headers.key?('Cookie')}).to have_been_made + end + + it "does preserves cookie header and basic authentication when Puppet[:location_trusted] is true redirecting to different hosts" do + headers = { 'cookie' => 'TEST_COOKIE'} + Puppet[:location_trusted] = true + + stub_request(:get, start_url).with(headers: headers, basic_auth: credentials).to_return(redirect_to(url: other_host)) + stub_request(:get, other_host).with(headers: headers, basic_auth: credentials).to_return(status: 200) + + client.get(start_url, headers: headers, options: {basic_auth: {user: 'user', password: 'pass'}}) + expect(a_request(:get, other_host). + with{ |req| req.headers.key?('Authorization') && req.headers.key?('Cookie')}).to have_been_made + end + + it "treats hosts as case-insensitive" do + start_url = URI("https://www.EXAmple.com:8140/Start") + bar_url = "https://www.example.com:8140/bar" + stub_request(:get, start_url).with(basic_auth: credentials).to_return(redirect_to(url: bar_url)) stub_request(:get, bar_url).with(basic_auth: credentials).to_return(status: 200) client.get(start_url, options: {basic_auth: {user: 'user', password: 'pass'}}) + expect(a_request(:get, bar_url). + with{ |req| req.headers.key?('Authorization')}).to have_been_made end it "redirects given a relative location" do From 0e189e9988c4969280134d043b871851928caa41 Mon Sep 17 00:00:00 2001 From: Bobosila Victor Date: Mon, 30 Aug 2021 15:13:47 +0300 Subject: [PATCH 455/731] (PUP-11209) Puppet agent silently skips unknown resources. Previously all unknown resources were converted into a component (Puppet::Type::Component) and silently skipped. This commit adds a new resource attribute (:kind) that specifies the resource kind, which is used to differentiate between built-in types and user defined types. When converting the catalog to a RAL catalog, this new attribute is used to to check whether a resource should use the resource type's :new method, or create a component, and in the case where the server considers a resource to be compilable, but the agent can't resolve it, then we raise an error --- .../agent_fails_with_unknown_resource.rb | 77 +++++++++++++++++++ api/schemas/catalog.json | 3 + benchmarks/serialization/catalog.json | 2 +- lib/puppet/parser/resource.rb | 2 +- .../evaluator/runtime3_resource_support.rb | 1 + lib/puppet/resource.rb | 43 +++++++++-- lib/puppet/resource/catalog.rb | 2 +- .../agent/cached_deferred_catalog.json | 3 +- .../integration/parser/pcore_resource_spec.rb | 10 +++ spec/unit/configurer_spec.rb | 2 +- spec/unit/resource/catalog_spec.rb | 15 +++- spec/unit/resource_spec.rb | 60 ++++++++++++++- 12 files changed, 207 insertions(+), 13 deletions(-) create mode 100644 acceptance/tests/agent/agent_fails_with_unknown_resource.rb diff --git a/acceptance/tests/agent/agent_fails_with_unknown_resource.rb b/acceptance/tests/agent/agent_fails_with_unknown_resource.rb new file mode 100644 index 00000000000..01c114c5a95 --- /dev/null +++ b/acceptance/tests/agent/agent_fails_with_unknown_resource.rb @@ -0,0 +1,77 @@ +test_name "agent run should fail if it finds an unknown resource type" do + tag 'audit:high', + 'audit:integration' + + require 'puppet/acceptance/common_utils' + + require 'puppet/acceptance/environment_utils' + extend Puppet::Acceptance::EnvironmentUtils + + require 'puppet/acceptance/temp_file_utils' + extend Puppet::Acceptance::TempFileUtils + + step "agent should fail when it can't find a resource" do + vendor_modules_path = master.tmpdir('vendor_modules') + tmp_environment = mk_tmp_environment_with_teardown(master, 'tmp') + + site_pp_content = <<-SITEPP + define foocreateresource($one) { + $msg = 'hello' + notify { $name: message => $msg } + } + class example($x) { + if $x == undef or $x == [] or $x == '' { + notice 'foo' + return() + } + notice 'bar' + } + node default { + class { example: x => [] } + create_resources('foocreateresource', {'blah'=>{'one'=>'two'}}) + mycustomtype{'foobar':} + } + SITEPP + manifests_path = "/tmp/#{tmp_environment}/manifests" + on(master, "mkdir -p '#{manifests_path}'") + create_remote_file(master, "#{manifests_path}/site.pp", site_pp_content) + + custom_type_content = <<-CUSTOMTYPE + Puppet::Type.newtype(:mycustomtype) do + @doc = "Create a new mycustomtype thing." + + newparam(:name, :namevar => true) do + desc "Name of mycustomtype instance" + end + + def refresh + end + end + CUSTOMTYPE + type_path = "#{vendor_modules_path}/foo/lib/puppet/type" + on(master, "mkdir -p '#{type_path}'") + create_remote_file(master, "#{type_path}/mycustomtype.rb", custom_type_content) + + on(master, "chmod -R 750 '#{vendor_modules_path}' '/tmp/#{tmp_environment}'") + on(master, "chown -R #{master.puppet['user']}:#{master.puppet['group']} '#{vendor_modules_path}' '/tmp/#{tmp_environment}'") + + master_opts = { + 'main' => { + 'environment' => tmp_environment, + 'vendormoduledir' => vendor_modules_path + } + } + + with_puppet_running_on(master, master_opts) do + agents.each do |agent| + teardown do + agent.rm_rf(vendor_modules_path) + end + + on(agent, puppet('agent', '-t', '--environment', tmp_environment), acceptable_exit_codes: [1]) do |result| + assert_match(/Error: Failed to apply catalog: Resource type 'Mycustomtype' was not found/, result.stderr) + end + end + end + end +end diff --git a/api/schemas/catalog.json b/api/schemas/catalog.json index 06d51dde556..091d470b997 100644 --- a/api/schemas/catalog.json +++ b/api/schemas/catalog.json @@ -45,6 +45,9 @@ "line": { "type": "integer" }, + "kind": { + "type": "string" + }, "file": { "type": "string" }, diff --git a/benchmarks/serialization/catalog.json b/benchmarks/serialization/catalog.json index 37b9967549b..a773581e487 100644 --- a/benchmarks/serialization/catalog.json +++ b/benchmarks/serialization/catalog.json @@ -118,7 +118,7 @@ "version": 1492108311, "code_id": null, "catalog_uuid": "c85cdf7e-f56d-4fc7-b513-3a00532cee91", - "catalog_format": 1, + "catalog_format": 2, "environment": "production", "resources": [ { diff --git a/lib/puppet/parser/resource.rb b/lib/puppet/parser/resource.rb index e76a4a5250c..06059b514e8 100644 --- a/lib/puppet/parser/resource.rb +++ b/lib/puppet/parser/resource.rb @@ -13,7 +13,7 @@ class Puppet::Parser::Resource < Puppet::Resource attr_accessor :source, :scope, :collector_id attr_accessor :virtual, :override, :translated, :catalog, :evaluated - attr_accessor :file, :line + attr_accessor :file, :line, :kind attr_reader :exported, :parameters diff --git a/lib/puppet/pops/evaluator/runtime3_resource_support.rb b/lib/puppet/pops/evaluator/runtime3_resource_support.rb index 08dfb871777..abd1c5920ed 100644 --- a/lib/puppet/pops/evaluator/runtime3_resource_support.rb +++ b/lib/puppet/pops/evaluator/runtime3_resource_support.rb @@ -40,6 +40,7 @@ def self.create_resources(file, line, scope, virtual, exported, type_name, resou :parameters => evaluated_parameters, :file => file, :line => line, + :kind => Puppet::Resource.to_kind(resolved_type), :exported => exported, :virtual => virtual, # WTF is this? Which source is this? The file? The name of the context ? diff --git a/lib/puppet/resource.rb b/lib/puppet/resource.rb index ca484a327f8..466f94bd716 100644 --- a/lib/puppet/resource.rb +++ b/lib/puppet/resource.rb @@ -11,7 +11,7 @@ class Puppet::Resource include Puppet::Util::PsychSupport include Enumerable - attr_accessor :file, :line, :catalog, :exported, :virtual, :strict + attr_accessor :file, :line, :catalog, :exported, :virtual, :strict, :kind attr_reader :type, :title, :parameters # @!attribute [rw] sensitive_parameters @@ -29,10 +29,15 @@ class Puppet::Resource EMPTY_ARRAY = [].freeze EMPTY_HASH = {}.freeze - ATTRIBUTES = [:file, :line, :exported].freeze + ATTRIBUTES = [:file, :line, :exported, :kind].freeze TYPE_CLASS = 'Class'.freeze TYPE_NODE = 'Node'.freeze + CLASS_STRING = 'class'.freeze + DEFINED_TYPE_STRING = 'defined_type'.freeze + COMPILABLE_TYPE_STRING = 'compilable_type'.freeze + UNKNOWN_TYPE_STRING = 'unknown'.freeze + PCORE_TYPE_KEY = '__ptype'.freeze VALUE_KEY = 'value'.freeze @@ -193,6 +198,18 @@ def builtin_type? resource_type.is_a?(Puppet::CompilableResourceType) end + def self.to_kind(resource_type) + if resource_type == CLASS_STRING + CLASS_STRING + elsif resource_type.is_a?(Puppet::Resource::Type) && resource_type.type == :definition + DEFINED_TYPE_STRING + elsif resource_type.is_a?(Puppet::CompilableResourceType) + COMPILABLE_TYPE_STRING + else + UNKNOWN_TYPE_STRING + end + end + # Iterate over each param/value pair, as required for Enumerable. def each parameters.each { |p,v| yield p, v } @@ -247,6 +264,7 @@ def initialize(type, title = nil, attributes = EMPTY_HASH) src = type self.file = src.file self.line = src.line + self.kind = src.kind self.exported = src.exported self.virtual = src.virtual self.set_tags(src) @@ -309,6 +327,7 @@ def initialize(type, title = nil, attributes = EMPTY_HASH) rt = resource_type + self.kind = self.class.to_kind(rt) unless kind if strict? && rt.nil? if self.class? raise ArgumentError, _("Could not find declared class %{title}") % { title: title } @@ -468,10 +487,24 @@ def to_ref ref end - # Convert our resource to a RAL resource instance. Creates component - # instances for resource types that don't exist. + # Convert our resource to a RAL resource instance. Creates component + # instances for resource types that are not of a compilable_type kind. In case + # the resource doesn’t exist and it’s compilable_type kind, raise an error. + # There are certain cases where a resource won't be in a catalog, such as + # when we create a resource directly by using Puppet::Resource.new(...), so we + # must check its kind before deciding whether the catalog format is of an older + # version or not. def to_ral - typeklass = Puppet::Type.type(self.type) || Puppet::Type.type(:component) + if self.kind == COMPILABLE_TYPE_STRING + typeklass = Puppet::Type.type(self.type) + elsif self.catalog && self.catalog.catalog_format >= 2 + typeklass = Puppet::Type.type(:component) + else + typeklass = Puppet::Type.type(self.type) || Puppet::Type.type(:component) + end + + raise(Puppet::Error, "Resource type '#{self.type}' was not found") unless typeklass + typeklass.new(self) end diff --git a/lib/puppet/resource/catalog.rb b/lib/puppet/resource/catalog.rb index ce210914bce..1e27a18c867 100644 --- a/lib/puppet/resource/catalog.rb +++ b/lib/puppet/resource/catalog.rb @@ -313,7 +313,7 @@ def initialize(name = nil, environment = Puppet::Node::Environment::NONE, code_i super() @name = name @catalog_uuid = SecureRandom.uuid - @catalog_format = 1 + @catalog_format = 2 @metadata = {} @recursive_metadata = {} @classes = [] diff --git a/spec/fixtures/integration/application/agent/cached_deferred_catalog.json b/spec/fixtures/integration/application/agent/cached_deferred_catalog.json index a81b9cbf200..35e772e8f9f 100644 --- a/spec/fixtures/integration/application/agent/cached_deferred_catalog.json +++ b/spec/fixtures/integration/application/agent/cached_deferred_catalog.json @@ -6,7 +6,7 @@ "version": 1607629733, "code_id": null, "catalog_uuid": "afc8472a-306b-4b24-b060-e956dffb79b8", - "catalog_format": 1, + "catalog_format": 2, "environment": "production", "resources": [ { @@ -50,6 +50,7 @@ ], "file": "", "line": 1, + "kind": "compilable_type", "exported": false, "parameters": { "message": { diff --git a/spec/integration/parser/pcore_resource_spec.rb b/spec/integration/parser/pcore_resource_spec.rb index c86b6e2b7b9..edc2af3d1e3 100644 --- a/spec/integration/parser/pcore_resource_spec.rb +++ b/spec/integration/parser/pcore_resource_spec.rb @@ -122,6 +122,16 @@ def self.title_patterns expect(catalog.resource(:test3, "x/y")['message']).to eq('x/y works') end + it 'considers Pcore types to be builtin ' do + genface.types + catalog = compile_to_catalog(<<-MANIFEST) + test1 { 'a': + message => 'a works' + } + MANIFEST + expect(catalog.resource(:test1, "a").kind).to eq('compilable_type') + end + it 'the validity of attribute names are checked' do genface.types expect do diff --git a/spec/unit/configurer_spec.rb b/spec/unit/configurer_spec.rb index b87157bb4fe..54b1536cefc 100644 --- a/spec/unit/configurer_spec.rb +++ b/spec/unit/configurer_spec.rb @@ -866,7 +866,7 @@ def expects_neither_new_or_cached_catalog expect(configurer.run).to be_nil end - it "should proceed with the cached catalog if its environment matchs the local environment" do + it "should proceed with the cached catalog if its environment matches the local environment" do expects_cached_catalog_only(catalog) expect(configurer.run).to eq(0) diff --git a/spec/unit/resource/catalog_spec.rb b/spec/unit/resource/catalog_spec.rb index e93b77a1d22..c65ec4bde83 100644 --- a/spec/unit/resource/catalog_spec.rb +++ b/spec/unit/resource/catalog_spec.rb @@ -104,7 +104,7 @@ it "should include the current catalog_format" do catalog = Puppet::Resource::Catalog.new("host") - expect(catalog.catalog_format).to eq(1) + expect(catalog.catalog_format).to eq(2) end describe "when compiling" do @@ -178,6 +178,7 @@ @original.add_edge(@middle, @bottom) @original.add_edge(@bottom, @bottomobject) + @original.catalog_format = 1 @catalog = @original.to_ral end @@ -190,6 +191,18 @@ end end + it "should raise if an unknown resource is being converted" do + @new_res = Puppet::Resource.new "Unknown", "type", :kind => 'compilable_type' + @resource_array = [@new_res] + + @original.add_resource(*@resource_array) + @original.add_edge(@bottomobject, @new_res) + + @original.catalog_format = 2 + + expect { @original.to_ral }.to raise_error(Puppet::Error, "Resource type 'Unknown' was not found") + end + it "should copy the tag list to the new catalog" do expect(@catalog.tags.sort).to eq(@original.tags.sort) end diff --git a/spec/unit/resource_spec.rb b/spec/unit/resource_spec.rb index 498442f865c..c527358e3f6 100644 --- a/spec/unit/resource_spec.rb +++ b/spec/unit/resource_spec.rb @@ -638,19 +638,68 @@ def inject_and_set_defaults(resource, scope) it "should use the resource type's :new method to create the resource if the resource is of a builtin type" do resource = Puppet::Resource.new("file", basepath+"/my/file") result = resource.to_ral + expect(result).to be_instance_of(Puppet::Type.type(:file)) expect(result[:path]).to eq(basepath+"/my/file") end - it "should convert to a component instance if the resource type is not of a builtin type" do + it "should convert to a component instance if the resource is not a compilable_type" do resource = Puppet::Resource.new("foobar", "somename") result = resource.to_ral expect(result).to be_instance_of(Puppet::Type.type(:component)) expect(result.title).to eq("Foobar[somename]") end - end + it "should convert to a component instance if the resource is a class" do + resource = Puppet::Resource.new("Class", "somename") + result = resource.to_ral + + expect(result).to be_instance_of(Puppet::Type.type(:component)) + expect(result.title).to eq("Class[Somename]") + end + + it "should convert to component when the resource is a defined_type" do + resource = Puppet::Resource.new("Unknown", "type", :kind => 'defined_type') + + result = resource.to_ral + expect(result).to be_instance_of(Puppet::Type.type(:component)) + end + + it "should raise if a resource type is a compilable_type and it wasn't found" do + resource = Puppet::Resource.new("Unknown", "type", :kind => 'compilable_type') + + expect { resource.to_ral }.to raise_error(Puppet::Error, "Resource type 'Unknown' was not found") + end + + it "should use the old behaviour when the catalog_format is equal to 1" do + resource = Puppet::Resource.new("Unknown", "type") + catalog = Puppet::Resource::Catalog.new("mynode") + + resource.catalog = catalog + resource.catalog.catalog_format = 1 + + result = resource.to_ral + expect(result).to be_instance_of(Puppet::Type.type(:component)) + end + + it "should use the new behaviour and fail when the catalog_format is greater than 1" do + resource = Puppet::Resource.new("Unknown", "type", :kind => 'compilable_type') + catalog = Puppet::Resource::Catalog.new("mynode") + + resource.catalog = catalog + resource.catalog.catalog_format = 2 + + expect { resource.to_ral }.to raise_error(Puppet::Error, "Resource type 'Unknown' was not found") + end + + it "should use the resource type when the resource doesn't respond to kind and the resource type can be found" do + resource = Puppet::Resource.new("file", basepath+"/my/file") + + result = resource.to_ral + expect(result).to be_instance_of(Puppet::Type.type(:file)) + end + end describe "when converting to puppet code" do before do @resource = Puppet::Resource.new("one::two", "/my/file", @@ -766,6 +815,13 @@ def inject_and_set_defaults(resource, scope) expect(Puppet::Resource.from_data_hash(JSON.parse(resource.to_json)).line).to eq(50) end + it "should include the kind if one is set" do + resource = Puppet::Resource.new("File", "/foo") + resource.kind = 'im_a_file' + + expect(Puppet::Resource.from_data_hash(JSON.parse(resource.to_json)).kind).to eq('im_a_file') + end + it "should include the 'exported' value if one is set" do resource = Puppet::Resource.new("File", "/foo") resource.exported = true From d06ee317e75d6e0bd25cf9bcc53ebbc3cfdda0bc Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Mon, 4 Oct 2021 12:27:14 +0000 Subject: [PATCH 456/731] (packaging) Bump to version '7.12.1' [no-promote] --- .gemspec | 2 +- lib/puppet/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gemspec b/.gemspec index bfa0178d9f3..c80f38e6abb 100644 --- a/.gemspec +++ b/.gemspec @@ -13,7 +13,7 @@ Gem::Specification.new do |s| s.name = "puppet" - version = "7.12.0" + version = "7.12.1" mdata = version.match(/(\d+\.\d+\.\d+)/) s.version = mdata ? mdata[1] : version diff --git a/lib/puppet/version.rb b/lib/puppet/version.rb index 403480deda0..25b85f7aa9e 100644 --- a/lib/puppet/version.rb +++ b/lib/puppet/version.rb @@ -6,7 +6,7 @@ # Raketasks and such to set the version based on the output of `git describe` module Puppet - PUPPETVERSION = '7.12.0' + PUPPETVERSION = '7.12.1' ## # version is a public API method intended to always provide a fast and From 51e1f429cab4785fb799edc8ee6481cbe1515b11 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Mon, 4 Oct 2021 12:39:05 +0000 Subject: [PATCH 457/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 2 +- man/man8/puppet.8 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index cf1c441f9ec..3edc407fc7c 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -929,7 +929,7 @@ The time to wait for data to be read from an HTTP connection\. If nothing is rea The HTTP User\-Agent string to send when making network requests\. . .IP "\(bu" 4 -\fIDefault\fR: \fBPuppet/7\.12\.0 Ruby/2\.5\.1\-p57 (x86_64\-linux)\fR +\fIDefault\fR: \fBPuppet/7\.12\.1 Ruby/2\.5\.1\-p57 (x86_64\-linux)\fR . .IP "" 0 . diff --git a/man/man8/puppet.8 b/man/man8/puppet.8 index 0cd8890da27..5184fc2ee1f 100644 --- a/man/man8/puppet.8 +++ b/man/man8/puppet.8 @@ -25,4 +25,4 @@ Specialized: 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 . .P -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\.12\.0 +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\.12\.1 From d4bc144b1a320fc77b39b386057be3592daed59e Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Wed, 13 Oct 2021 09:47:01 +0000 Subject: [PATCH 458/731] (packaging) Bump to version '7.13.0' [no-promote] --- .gemspec | 2 +- lib/puppet/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gemspec b/.gemspec index c80f38e6abb..628660a5278 100644 --- a/.gemspec +++ b/.gemspec @@ -13,7 +13,7 @@ Gem::Specification.new do |s| s.name = "puppet" - version = "7.12.1" + version = "7.13.0" mdata = version.match(/(\d+\.\d+\.\d+)/) s.version = mdata ? mdata[1] : version diff --git a/lib/puppet/version.rb b/lib/puppet/version.rb index 25b85f7aa9e..2602a95bbaa 100644 --- a/lib/puppet/version.rb +++ b/lib/puppet/version.rb @@ -6,7 +6,7 @@ # Raketasks and such to set the version based on the output of `git describe` module Puppet - PUPPETVERSION = '7.12.1' + PUPPETVERSION = '7.13.0' ## # version is a public API method intended to always provide a fast and From 7eeeefef7e54a16c62437d6061ce94762ebfab24 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Wed, 13 Oct 2021 09:54:09 +0000 Subject: [PATCH 459/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 2 +- man/man8/puppet.8 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index 3edc407fc7c..f33234c96fa 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -929,7 +929,7 @@ The time to wait for data to be read from an HTTP connection\. If nothing is rea The HTTP User\-Agent string to send when making network requests\. . .IP "\(bu" 4 -\fIDefault\fR: \fBPuppet/7\.12\.1 Ruby/2\.5\.1\-p57 (x86_64\-linux)\fR +\fIDefault\fR: \fBPuppet/7\.13\.0 Ruby/2\.5\.1\-p57 (x86_64\-linux)\fR . .IP "" 0 . diff --git a/man/man8/puppet.8 b/man/man8/puppet.8 index 5184fc2ee1f..91e4c9e369f 100644 --- a/man/man8/puppet.8 +++ b/man/man8/puppet.8 @@ -25,4 +25,4 @@ Specialized: 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 . .P -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\.12\.1 +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\.13\.0 From 722efd4d9847affaf1dfc16927ebcb2e73088ac1 Mon Sep 17 00:00:00 2001 From: Luchian Nemes Date: Thu, 14 Oct 2021 14:11:26 +0300 Subject: [PATCH 460/731] (PUP-11319) Move `DEFAULT_TIMEOUT` constant for Windows services This commit moves the `DEFAULT_TIMEOUT` constant from `lib/puppet/util/windows/service.rb` to `lib/puppet/util/windows.rb` to avoid `unitialized constant` errors when compiling catalogs on nonWindows OS. --- lib/puppet/util/windows.rb | 3 +++ lib/puppet/util/windows/service.rb | 5 ----- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/puppet/util/windows.rb b/lib/puppet/util/windows.rb index cdacc53cc7e..2abe97a86ec 100644 --- a/lib/puppet/util/windows.rb +++ b/lib/puppet/util/windows.rb @@ -10,6 +10,9 @@ class Group < ADSIObject; end module File; end module Registry end + module Service + DEFAULT_TIMEOUT = 30 + end module SID class Principal; end end diff --git a/lib/puppet/util/windows/service.rb b/lib/puppet/util/windows/service.rb index 7601b304ba3..af32f2611f4 100644 --- a/lib/puppet/util/windows/service.rb +++ b/lib/puppet/util/windows/service.rb @@ -18,11 +18,6 @@ module Service include Puppet::FFI::Windows::Functions extend Puppet::FFI::Windows::Functions - # integer value of the floor for timeouts when waiting for service pending states. - # puppet will wait the length of dwWaitHint if it is longer than this value, but - # no shorter - DEFAULT_TIMEOUT = 30 - # Returns true if the service exists, false otherwise. # # @param [String] service_name name of the service From bb8ecbde394acad2c0a8cf9208287ae01ffdbbfa Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Wed, 27 Oct 2021 03:22:29 +0000 Subject: [PATCH 461/731] (packaging) Updating the puppet.pot file --- locales/puppet.pot | 172 ++++++++++++++++++++++++--------------------- 1 file changed, 93 insertions(+), 79 deletions(-) diff --git a/locales/puppet.pot b/locales/puppet.pot index 16c303e88b6..638d5cb3aa9 100644 --- a/locales/puppet.pot +++ b/locales/puppet.pot @@ -6,11 +6,11 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Puppet automation framework 7.11.0-22-gd1463bbc0c\n" +"Project-Id-Version: Puppet automation framework 7.12.0-60-g118756370f\n" "\n" "Report-Msgid-Bugs-To: https://tickets.puppetlabs.com\n" -"POT-Creation-Date: 2021-09-29 16:36+0000\n" -"PO-Revision-Date: 2021-09-29 16:36+0000\n" +"POT-Creation-Date: 2021-10-27 03:22+0000\n" +"PO-Revision-Date: 2021-10-27 03:22+0000\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -380,38 +380,32 @@ msgstr "" msgid "Run 'puppet lookup --help' for more details" msgstr "" -#: ../lib/puppet/application/lookup.rb:60 -msgid "" -"The --fact file only accepts yaml and json files.\n" -"%{run_help}" -msgstr "" - -#: ../lib/puppet/application/lookup.rb:105 +#: ../lib/puppet/application/lookup.rb:101 msgid "Interactive Hiera lookup" msgstr "" -#: ../lib/puppet/application/lookup.rb:272 +#: ../lib/puppet/application/lookup.rb:268 msgid "" "The options %{deep_merge_opts} are only available with '--merge deep'\n" "%{run_help}" msgstr "" -#: ../lib/puppet/application/lookup.rb:283 +#: ../lib/puppet/application/lookup.rb:279 msgid "" "The --merge option only accepts %{strategies}, or %{last_strategy}\n" "%{run_help}" msgstr "" -#: ../lib/puppet/application/lookup.rb:308 +#: ../lib/puppet/application/lookup.rb:304 msgid "No keys were given to lookup." msgstr "" -#: ../lib/puppet/application/lookup.rb:316 +#: ../lib/puppet/application/lookup.rb:312 msgid "Unknown rendering format '%{format}'" msgstr "" -#: ../lib/puppet/application/lookup.rb:366 ../lib/puppet/face/epp.rb:530 -msgid "Incorrect formatted data in %{fact_file} given via the --facts flag" +#: ../lib/puppet/application/lookup.rb:365 +msgid "Incorrectly formatted data in %{fact_file} given via the --facts flag (only accepts yaml and json files)" msgstr "" #: ../lib/puppet/application/resource.rb:34 @@ -591,76 +585,92 @@ msgstr "" msgid "Environment not passed via CLI and no catalog was given, attempting to find out the last server-specified environment" msgstr "" -#: ../lib/puppet/configurer.rb:399 +#: ../lib/puppet/configurer.rb:396 +msgid "Requesting environment from the server" +msgstr "" + +#: ../lib/puppet/configurer.rb:406 msgid "Could not find a usable environment in the lastrunfile. Either the file does not exist, does not have the required keys, or the values of 'initial_environment' and 'converged_environment' are identical." msgstr "" -#: ../lib/puppet/configurer.rb:403 +#: ../lib/puppet/configurer.rb:410 msgid "Using environment '%{env}'" msgstr "" -#: ../lib/puppet/configurer.rb:427 +#: ../lib/puppet/configurer.rb:434 msgid "Not using catalog because its environment '%{catalog_env}' does not match agent specified environment '%{local_env}' and strict_environment_mode is set" msgstr "" -#: ../lib/puppet/configurer.rb:438 +#: ../lib/puppet/configurer.rb:445 msgid "Catalog environment didn't stabilize after %{tries} fetches, aborting run" msgstr "" -#: ../lib/puppet/configurer.rb:440 +#: ../lib/puppet/configurer.rb:447 msgid "Local environment: '%{local_env}' doesn't match server specified environment '%{catalog_env}', restarting agent run with environment '%{catalog_env}'" msgstr "" -#: ../lib/puppet/configurer.rb:496 +#: ../lib/puppet/configurer.rb:503 msgid "Failed to apply catalog: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:527 +#: ../lib/puppet/configurer.rb:534 msgid "Environment '%{environment}' not found on server, skipping initial pluginsync." msgstr "" -#: ../lib/puppet/configurer.rb:544 ../lib/puppet/http/resolver/server_list.rb:64 ../lib/puppet/http/resolver/server_list.rb:68 +#: ../lib/puppet/configurer.rb:551 ../lib/puppet/http/resolver/server_list.rb:64 ../lib/puppet/http/resolver/server_list.rb:68 msgid "Puppet server %{host}:%{port} is unavailable: %{code} %{reason}" msgstr "" #. TRANSLATORS 'server_list' is the name of a setting and should not be translated -#: ../lib/puppet/configurer.rb:548 ../lib/puppet/http/resolver/server_list.rb:73 ../lib/puppet/http/resolver/server_list.rb:76 +#: ../lib/puppet/configurer.rb:555 ../lib/puppet/http/resolver/server_list.rb:73 ../lib/puppet/http/resolver/server_list.rb:76 msgid "Unable to connect to server from server_list setting: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:564 +#: ../lib/puppet/configurer.rb:580 +msgid "Successfully loaded last environment from the lastrunfile" +msgstr "" + +#: ../lib/puppet/configurer.rb:584 msgid "Found last server-specified environment: %{environment}" msgstr "" -#: ../lib/puppet/configurer.rb:567 +#: ../lib/puppet/configurer.rb:587 msgid "Could not find last server-specified environment: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:584 ../lib/puppet/face/report.rb:47 +#: ../lib/puppet/configurer.rb:617 +msgid "Local environment: '%{local_env}' doesn't match server specified node environment '%{node_env}', switching agent to '%{node_env}'." +msgstr "" + +#: ../lib/puppet/configurer.rb:625 +msgid "Unable to fetch my node definition, but the agent run will continue:" +msgstr "" + +#: ../lib/puppet/configurer.rb:644 ../lib/puppet/face/report.rb:47 msgid "Could not send report: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:593 +#: ../lib/puppet/configurer.rb:653 msgid "Could not save last run local report: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:612 +#: ../lib/puppet/configurer.rb:672 msgid "Uploading facts for %{node} to %{server}" msgstr "" -#: ../lib/puppet/configurer.rb:620 +#: ../lib/puppet/configurer.rb:680 msgid "Failed to submit facts: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:635 +#: ../lib/puppet/configurer.rb:695 msgid "Could not run command from %{setting}: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:664 +#: ../lib/puppet/configurer.rb:724 msgid "Could not retrieve catalog from cache: %{detail}" msgstr "" -#: ../lib/puppet/configurer.rb:686 +#: ../lib/puppet/configurer.rb:746 msgid "Could not retrieve catalog from remote server: %{detail}" msgstr "" @@ -1043,6 +1053,10 @@ msgstr "" msgid "--values option must evaluate to a Hash or undef, got: '%{values_class}'" msgstr "" +#: ../lib/puppet/face/epp.rb:530 +msgid "Incorrect formatted data in %{fact_file} given via the --facts flag" +msgstr "" + #: ../lib/puppet/face/facts.rb:8 msgid "Retrieve and store facts." msgstr "" @@ -2209,16 +2223,16 @@ msgstr "" msgid "appears to have a negative number of dependencies" msgstr "" -#: ../lib/puppet/graph/simple_graph.rb:66 +#: ../lib/puppet/graph/simple_graph.rb:67 msgid "Got an event from invalid vertex %{source}" msgstr "" #. TRANSLATORS "negative or zero" refers to the count of paths -#: ../lib/puppet/graph/simple_graph.rb:200 +#: ../lib/puppet/graph/simple_graph.rb:201 msgid "negative or zero max_paths" msgstr "" -#: ../lib/puppet/graph/simple_graph.rb:232 +#: ../lib/puppet/graph/simple_graph.rb:233 msgid "" "Found %{num} dependency cycle:\n" msgid_plural "" @@ -2226,12 +2240,12 @@ msgid_plural "" msgstr[0] "" msgstr[1] "" -#: ../lib/puppet/graph/simple_graph.rb:241 +#: ../lib/puppet/graph/simple_graph.rb:242 msgid "Cycle graph written to %{filename}." msgstr "" #. TRANSLATORS '--graph' refers to a command line option and OmniGraffle and GraphViz are program names and should not be translated -#: ../lib/puppet/graph/simple_graph.rb:244 +#: ../lib/puppet/graph/simple_graph.rb:245 msgid "Try the '--graph' option and opening the resulting '.dot' file in OmniGraffle or GraphViz" msgstr "" @@ -8973,52 +8987,52 @@ msgstr "" msgid "Logs require a level" msgstr "" -#: ../lib/puppet/util/log.rb:86 ../lib/puppet/util/log.rb:377 ../lib/puppet/util/windows/eventlog.rb:99 +#: ../lib/puppet/util/log.rb:86 ../lib/puppet/util/log.rb:382 ../lib/puppet/util/windows/eventlog.rb:99 msgid "Invalid log level %{level}" msgstr "" -#: ../lib/puppet/util/log.rb:108 +#: ../lib/puppet/util/log.rb:110 msgid "Invalid loglevel %{level}" msgstr "" -#: ../lib/puppet/util/log.rb:135 +#: ../lib/puppet/util/log.rb:140 msgid "Unknown destination type %{dest}" msgstr "" -#: ../lib/puppet/util/log.rb:175 +#: ../lib/puppet/util/log.rb:180 msgid "Received a Log attribute with invalid encoding:%{log_message}" msgstr "" -#: ../lib/puppet/util/log.rb:177 +#: ../lib/puppet/util/log.rb:182 msgid "" "Backtrace:\n" "%{backtrace}" msgstr "" -#: ../lib/puppet/util/log.rb:231 +#: ../lib/puppet/util/log.rb:236 msgid "Reopening log files" msgstr "" #. TRANSLATORS 'Puppet::Util::Log' refers to a Puppet source code class -#: ../lib/puppet/util/log.rb:367 +#: ../lib/puppet/util/log.rb:372 msgid "Puppet::Util::Log requires a message" msgstr "" #. TRANSLATORS 'Puppet::Util::Log' refers to a Puppet source code class -#: ../lib/puppet/util/log.rb:373 +#: ../lib/puppet/util/log.rb:378 msgid "Puppet::Util::Log requires a log level" msgstr "" #. TRANSLATORS 'Puppet::Util::Log' refers to a Puppet source code class -#: ../lib/puppet/util/log.rb:375 +#: ../lib/puppet/util/log.rb:380 msgid "Puppet::Util::Log requires a symbol or string" msgstr "" -#: ../lib/puppet/util/log.rb:406 +#: ../lib/puppet/util/log.rb:411 msgid "Could not parse for environment %{environment}: %{msg}" msgstr "" -#: ../lib/puppet/util/log.rb:408 +#: ../lib/puppet/util/log.rb:413 msgid "%{msg} on node %{node}" msgstr "" @@ -9533,119 +9547,119 @@ msgstr "" msgid "Failed to set security information" msgstr "" -#: ../lib/puppet/util/windows/service.rb:44 +#: ../lib/puppet/util/windows/service.rb:39 msgid "Starting the %{service_name} service. Timeout set to: %{timeout} seconds" msgstr "" -#: ../lib/puppet/util/windows/service.rb:54 +#: ../lib/puppet/util/windows/service.rb:49 msgid "Failed to start the service" msgstr "" -#: ../lib/puppet/util/windows/service.rb:58 +#: ../lib/puppet/util/windows/service.rb:53 msgid "Successfully started the %{service_name} service" msgstr "" -#: ../lib/puppet/util/windows/service.rb:67 +#: ../lib/puppet/util/windows/service.rb:62 msgid "Stopping the %{service_name} service. Timeout set to: %{timeout} seconds" msgstr "" -#: ../lib/puppet/util/windows/service.rb:75 +#: ../lib/puppet/util/windows/service.rb:70 msgid "Successfully stopped the %{service_name} service" msgstr "" -#: ../lib/puppet/util/windows/service.rb:84 +#: ../lib/puppet/util/windows/service.rb:79 msgid "Resuming the %{service_name} service. Timeout set to: %{timeout} seconds" msgstr "" -#: ../lib/puppet/util/windows/service.rb:100 +#: ../lib/puppet/util/windows/service.rb:95 msgid "Successfully resumed the %{service_name} service" msgstr "" -#: ../lib/puppet/util/windows/service.rb:116 +#: ../lib/puppet/util/windows/service.rb:111 msgid "Unknown Service state '%{current_state}' for '%{service_name}'" msgstr "" -#: ../lib/puppet/util/windows/service.rb:143 +#: ../lib/puppet/util/windows/service.rb:138 msgid "Unknown start type '%{start_type}' for '%{service_name}'" msgstr "" -#: ../lib/puppet/util/windows/service.rb:193 +#: ../lib/puppet/util/windows/service.rb:188 msgid "Failed to update service configuration" msgstr "" -#: ../lib/puppet/util/windows/service.rb:258 +#: ../lib/puppet/util/windows/service.rb:253 msgid "Failed to fetch services" msgstr "" -#: ../lib/puppet/util/windows/service.rb:307 +#: ../lib/puppet/util/windows/service.rb:302 msgid "Failed to open a handle to the service" msgstr "" -#: ../lib/puppet/util/windows/service.rb:324 +#: ../lib/puppet/util/windows/service.rb:319 msgid "Failed to open a handle to the service control manager" msgstr "" -#: ../lib/puppet/util/windows/service.rb:347 +#: ../lib/puppet/util/windows/service.rb:342 msgid "The service is already in the %{final_state} state. No further work needs to be done." msgstr "" -#: ../lib/puppet/util/windows/service.rb:359 +#: ../lib/puppet/util/windows/service.rb:354 msgid "The service must be in one of the %{valid_initial_states} states to perform this transition. It is currently in the %{current_state} state." msgstr "" -#: ../lib/puppet/util/windows/service.rb:370 +#: ../lib/puppet/util/windows/service.rb:365 msgid "There is already a pending transition to the %{final_state} state for the %{service_name} service." msgstr "" -#: ../lib/puppet/util/windows/service.rb:386 +#: ../lib/puppet/util/windows/service.rb:381 msgid "The service is in the %{pending_state} state, which is an unsafe pending state." msgstr "" -#: ../lib/puppet/util/windows/service.rb:391 +#: ../lib/puppet/util/windows/service.rb:386 msgid "Transitioning the %{service_name} service from %{initial_state} to %{final_state}" msgstr "" -#: ../lib/puppet/util/windows/service.rb:395 +#: ../lib/puppet/util/windows/service.rb:390 msgid "Waiting for the transition to finish" msgstr "" -#: ../lib/puppet/util/windows/service.rb:400 +#: ../lib/puppet/util/windows/service.rb:395 msgid "Failed to transition the %{service_name} service to the %{final_state} state. Detail: %{detail}" msgstr "" -#: ../lib/puppet/util/windows/service.rb:439 ../lib/puppet/util/windows/service.rb:475 +#: ../lib/puppet/util/windows/service.rb:434 ../lib/puppet/util/windows/service.rb:470 msgid "Service query failed" msgstr "" -#: ../lib/puppet/util/windows/service.rb:518 +#: ../lib/puppet/util/windows/service.rb:513 msgid "Service query for %{parameter_name} failed" msgstr "" -#: ../lib/puppet/util/windows/service.rb:541 +#: ../lib/puppet/util/windows/service.rb:536 msgid "Failed to update service %{change} configuration" msgstr "" -#: ../lib/puppet/util/windows/service.rb:568 +#: ../lib/puppet/util/windows/service.rb:563 msgid "Failed to send the %{control_signal} signal to the service. Its current state is %{current_state}. Reason for failure:" msgstr "" -#: ../lib/puppet/util/windows/service.rb:603 +#: ../lib/puppet/util/windows/service.rb:598 msgid "The service transitioned to the %{pending_state} state." msgstr "" -#: ../lib/puppet/util/windows/service.rb:617 +#: ../lib/puppet/util/windows/service.rb:612 msgid "Timed out while waiting for the service to transition from %{initial_state} to %{final_state} OR from %{initial_state} to %{pending_state} to %{final_state}. The service's current state is %{current_state}." msgstr "" -#: ../lib/puppet/util/windows/service.rb:632 +#: ../lib/puppet/util/windows/service.rb:627 msgid "Waiting for the pending transition to the %{final_state} state to finish." msgstr "" -#: ../lib/puppet/util/windows/service.rb:646 +#: ../lib/puppet/util/windows/service.rb:641 msgid "Unexpected transition to the %{current_state} state while waiting for the pending transition from %{pending_state} to %{final_state} to finish." msgstr "" -#: ../lib/puppet/util/windows/service.rb:660 +#: ../lib/puppet/util/windows/service.rb:655 msgid "Timed out while waiting for the pending transition from %{pending_state} to %{final_state} to finish. The current state is %{current_state}." msgstr "" From b02a82325277ffd8254f5ea2d673328d5c32b622 Mon Sep 17 00:00:00 2001 From: Gabriel Nagy Date: Mon, 25 Oct 2021 15:07:29 -0700 Subject: [PATCH 462/731] (PUP-11328) Fallback to node request in configurer If we can't load our last server specified environment, then fallback to making a node request like we used to. This way if we're supposed to use a server specified environment and we upgrade, then we don't revert to "production" and redownload plugins. A node request will not be made if the `initial_environment` and the `converged_environment` in the lastrunfile are identical, and the `run_mode` is `agent`. The logic is similar to what was removed in commit 39df438ef except we're using `fail_on_404` so `Puppet::Node.indirection.find` will raise instead of returning nil. We also don't clear facts/query_options. Co-authored-by: Josh Cooper --- lib/puppet/configurer.rb | 68 +++++++++++++--- spec/integration/application/agent_spec.rb | 21 +++++ spec/unit/configurer_spec.rb | 93 ++++++++++++++++------ 3 files changed, 150 insertions(+), 32 deletions(-) diff --git a/lib/puppet/configurer.rb b/lib/puppet/configurer.rb index 7b819054ca7..76f4a7c2899 100644 --- a/lib/puppet/configurer.rb +++ b/lib/puppet/configurer.rb @@ -390,9 +390,16 @@ def run_internal(options) # We only need to find out the environment to run in if we don't already have a catalog unless (cached_catalog || options[:catalog] || Puppet.settings.set_by_cli?(:environment) || Puppet[:strict_environment_mode]) Puppet.debug(_("Environment not passed via CLI and no catalog was given, attempting to find out the last server-specified environment")) - if last_server_specified_environment - @environment = last_server_specified_environment - report.environment = last_server_specified_environment + initial_environment, loaded_last_environment = last_server_specified_environment + + unless loaded_last_environment + Puppet.debug(_("Requesting environment from the server")) + initial_environment = current_server_specified_environment(@environment, configured_environment, options) + end + + if initial_environment + @environment = initial_environment + report.environment = initial_environment push_current_environment_and_loaders else @@ -551,24 +558,67 @@ def find_functional_server end private :find_functional_server + # + # @api private + # + # Read the last server-specified environment from the lastrunfile. The + # environment is considered to be server-specified if the values of + # `initial_environment` and `converged_environment` are different. + # + # @return [String, Boolean] An array containing a string with the environment + # read from the lastrunfile in case the server is authoritative, and a + # boolean marking whether the last environment was correctly loaded. def last_server_specified_environment - return @last_server_specified_environment if @last_server_specified_environment + return @last_server_specified_environment, @loaded_last_environment if @last_server_specified_environment + if Puppet::FileSystem.exist?(Puppet[:lastrunfile]) summary = Puppet::Util::Yaml.safe_load_file(Puppet[:lastrunfile]) - return unless summary.dig('application', 'run_mode') == 'agent' - initial_environment = summary.dig('application', 'initial_environment') - converged_environment = summary.dig('application', 'converged_environment') + return [nil, nil] unless summary['application']['run_mode'] == 'agent' + initial_environment = summary['application']['initial_environment'] + converged_environment = summary['application']['converged_environment'] @last_server_specified_environment = converged_environment if initial_environment != converged_environment + Puppet.debug(_("Successfully loaded last environment from the lastrunfile")) + @loaded_last_environment = true end Puppet.debug(_("Found last server-specified environment: %{environment}") % { environment: @last_server_specified_environment }) if @last_server_specified_environment - @last_server_specified_environment + [@last_server_specified_environment, @loaded_last_environment] rescue => detail Puppet.debug(_("Could not find last server-specified environment: %{detail}") % { detail: detail }) - nil + [nil, nil] end private :last_server_specified_environment + def current_server_specified_environment(current_environment, configured_environment, options) + return @server_specified_environment if @server_specified_environment + + begin + node_retr_time = thinmark do + node = Puppet::Node.indirection.find(Puppet[:node_name_value], + :environment => Puppet::Node::Environment.remote(current_environment), + :configured_environment => configured_environment, + :ignore_cache => true, + :transaction_uuid => @transaction_uuid, + :fail_on_404 => true) + + @server_specified_environment = node.environment.name.to_s + + if @server_specified_environment != @environment + Puppet.notice _("Local environment: '%{local_env}' doesn't match server specified node environment '%{node_env}', switching agent to '%{node_env}'.") % { local_env: @environment, node_env: @server_specified_environment } + end + end + + options[:report].add_times(:node_retrieval, node_retr_time) + + @server_specified_environment + rescue => detail + Puppet.warning(_("Unable to fetch my node definition, but the agent run will continue:")) + Puppet.warning(detail) + nil + end + end + private :current_server_specified_environment + def send_report(report) puts report.summary if Puppet[:summarize] save_last_run_summary(report) diff --git a/spec/integration/application/agent_spec.rb b/spec/integration/application/agent_spec.rb index 1d03f019bde..85a985792f8 100644 --- a/spec/integration/application/agent_spec.rb +++ b/spec/integration/application/agent_spec.rb @@ -645,6 +645,27 @@ def with_another_agent_running(&block) end context "environment convergence" do + it "falls back to making a node request if the last server-specified environment cannot be loaded" do + server.start_server do |port| + Puppet[:serverport] = port + Puppet[:log_level] = 'debug' + + expect { + agent.command_line.args << '--test' + agent.run + }.to exit_with(0) + .and output(a_string_matching(%r{Debug: Requesting environment from the server})).to_stdout + + Puppet::Application.clear! + + expect { + agent.command_line.args << '--test' + agent.run + }.to exit_with(0) + .and output(a_string_matching(%r{Debug: Successfully loaded last environment from the lastrunfile})).to_stdout + end + end + it "switches to 'newenv' environment and retries the run" do first_run = true libdir = File.join(my_fixture_dir, 'lib') diff --git a/spec/unit/configurer_spec.rb b/spec/unit/configurer_spec.rb index 54b1536cefc..bfa4ec7bdc5 100644 --- a/spec/unit/configurer_spec.rb +++ b/spec/unit/configurer_spec.rb @@ -1239,6 +1239,9 @@ def expects_neither_new_or_cached_catalog converged_environment: #{last_server_specified_environment} run_mode: agent SUMMARY + + expect(Puppet::Node.indirection).not_to receive(:find) + .with(anything, hash_including(:ignore_cache => true, :fail_on_404 => true)) end it "prefers the environment set via cli" do @@ -1248,26 +1251,27 @@ def expects_neither_new_or_cached_catalog expect(configurer.environment).to eq('usethis') end - it "prefers the environment set via config" do + it "prefers the environment set via lastrunfile over config" do FileUtils.mkdir_p(Puppet[:confdir]) set_puppet_conf(Puppet[:confdir], <<~CONF) [main] environment = usethis + lastrunfile = #{Puppet[:lastrunfile]} CONF Puppet.initialize_settings configurer.run - expect(configurer.environment).to eq('usethis') + expect(configurer.environment).to eq(last_server_specified_environment) end - it "uses environment from Puppet[:environment] if given a catalog" do + it "uses the environment from Puppet[:environment] if given a catalog" do configurer.run(catalog: catalog) expect(configurer.environment).to eq(Puppet[:environment]) end - it "uses environment from Puppet[:environment] if use_cached_catalog = true" do + it "uses the environment from Puppet[:environment] if use_cached_catalog = true" do Puppet[:use_cached_catalog] = true expects_cached_catalog_only(catalog) configurer.run @@ -1296,14 +1300,14 @@ def expects_neither_new_or_cached_catalog configurer.run end - it "uses environment from Puppet[:environment] if strict_environment_mode is set" do + it "uses the environment from Puppet[:environment] if strict_environment_mode is set" do Puppet[:strict_environment_mode] = true configurer.run expect(configurer.environment).to eq(Puppet[:environment]) end - it "uses environment from Puppet[:environment] if initial_environment is the same as converged_environment" do + it "uses the environment from Puppet[:environment] if initial_environment is the same as converged_environment" do Puppet[:lastrunfile] = file_containing('last_run_summary.yaml', <<~SUMMARY) --- version: @@ -1318,41 +1322,84 @@ def expects_neither_new_or_cached_catalog expect(configurer.environment).to eq(Puppet[:environment]) end + end + end + + describe "when the last used environment is not available" do + describe "when the node request succeeds" do + let(:node_environment) { Puppet::Node::Environment.remote(:salam) } + let(:node) { double(Puppet::Node, :environment => node_environment) } + let(:last_server_specified_environment) { 'development' } + + before do + allow(Puppet::Node.indirection).to receive(:find) + allow(Puppet::Node.indirection).to receive(:find) + .with(anything, hash_including(:ignore_cache => true, :fail_on_404 => true)) + .and_return(node) + end - it "uses environment from Puppet[:environment] if the run mode doesn't match" do + it "uses the environment from the node request if the run mode doesn't match" do Puppet[:lastrunfile] = file_containing('last_run_summary.yaml', <<~SUMMARY) - --- - version: - config: 1624882680 - puppet: 6.24.0 - application: - initial_environment: #{Puppet[:environment]} - converged_environment: #{last_server_specified_environment} - run_mode: user + --- + version: + config: 1624882680 + puppet: 6.24.0 + application: + initial_environment: #{Puppet[:environment]} + converged_environment: #{last_server_specified_environment} + run_mode: user SUMMARY configurer.run - expect(configurer.environment).to eq(Puppet[:environment]) + expect(configurer.environment).to eq(node_environment.name.to_s) end - it "uses environment from Puppet[:environment] if lastrunfile is invalid YAML" do + it "uses the environment from the node request if lastrunfile does not contain the expected keys" do Puppet[:lastrunfile] = file_containing('last_run_summary.yaml', <<~SUMMARY) - Key: 'this is my very very very ' + - 'long string' + --- + version: + config: 1624882680 + puppet: 6.24.0 SUMMARY configurer.run - expect(configurer.environment).to eq(Puppet[:environment]) + expect(configurer.environment).to eq(node_environment.name.to_s) end - it "uses environment from Puppet[:environment] if lastrunfile exists but is empty" do + it "uses the environment from the node request if lastrunfile is invalid YAML" do + Puppet[:lastrunfile] = file_containing('last_run_summary.yaml', <<~SUMMARY) + Key: 'this is my very very very ' + + 'long string' + SUMMARY + configurer.run + + expect(configurer.environment).to eq(node_environment.name.to_s) + end + + it "uses the environment from the node request if lastrunfile exists but is empty" do Puppet[:lastrunfile] = file_containing('last_run_summary.yaml', '') configurer.run - expect(configurer.environment).to eq(Puppet[:environment]) + expect(configurer.environment).to eq(node_environment.name.to_s) + end + + it "uses the environment from the node request if the last used one cannot be found" do + Puppet[:lastrunfile] = tmpfile('last_run_summary.yaml') + configurer.run + + expect(configurer.environment).to eq(node_environment.name.to_s) + end + end + + describe "when the node request fails" do + before do + allow(Puppet::Node.indirection).to receive(:find).and_call_original + allow(Puppet::Node.indirection).to receive(:find) + .with(anything, hash_including(:ignore_cache => true, :fail_on_404 => true)) + .and_raise(Puppet::Error) end - it "uses environment from Puppet[:environment] if the last used one cannot be found" do + it "uses the environment from Puppet[:environment] if the last used one cannot be found" do Puppet[:lastrunfile] = tmpfile('last_run_summary.yaml') configurer.run From 7f266c2fe266a4a4eb9b0b335d61d515f11c0e0b Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Tue, 26 Oct 2021 14:30:24 -0700 Subject: [PATCH 463/731] (PUP-11328) Get the environment's name without loading the environment The previous commit added back the node request as a fallback, but it was calling `Node#environment`, which will try to load the environment from disk. Since the server-assigned environment likely doesn't exist on the agent, the run printed the following warning and continued using "production" Warning: Could not find a directory environment named 'xxx' anywhere in the path ... Does the directory exist? To complicate matters, node termini set the environment on the node differently. The :rest terminus returns a node with an environment_name, but not an instance. The :plain terminus returns a node with an environment instance, but not an environment_name. To avoid breaking things, retrieve the environment name the same way we did before[1]. [1] https://github.com/puppetlabs/puppet/blob/6.24.0/lib/puppet/configurer.rb#L315-L319 --- lib/puppet/configurer.rb | 12 +++++++++++- spec/integration/application/agent_spec.rb | 9 ++++++++- spec/unit/configurer_spec.rb | 18 ++++++++++++++++-- 3 files changed, 35 insertions(+), 4 deletions(-) diff --git a/lib/puppet/configurer.rb b/lib/puppet/configurer.rb index 76f4a7c2899..4336b0e60ab 100644 --- a/lib/puppet/configurer.rb +++ b/lib/puppet/configurer.rb @@ -601,7 +601,17 @@ def current_server_specified_environment(current_environment, configured_environ :transaction_uuid => @transaction_uuid, :fail_on_404 => true) - @server_specified_environment = node.environment.name.to_s + # The :rest node terminus returns a node with an environment_name, but not an + # environment instance. Attempting to get the environment instance will load + # it from disk, which will likely fail. So create a remote environment. + # + # The :plain node terminus returns a node with an environment, but not an + # environment_name. + if !node.has_environment_instance? && node.environment_name + node.environment = Puppet::Node::Environment.remote(node.environment_name) + end + + @server_specified_environment = node.environment.to_s if @server_specified_environment != @environment Puppet.notice _("Local environment: '%{local_env}' doesn't match server specified node environment '%{node_env}', switching agent to '%{node_env}'.") % { local_env: @environment, node_env: @server_specified_environment } diff --git a/spec/integration/application/agent_spec.rb b/spec/integration/application/agent_spec.rb index 85a985792f8..6147b5b0b35 100644 --- a/spec/integration/application/agent_spec.rb +++ b/spec/integration/application/agent_spec.rb @@ -646,7 +646,14 @@ def with_another_agent_running(&block) context "environment convergence" do it "falls back to making a node request if the last server-specified environment cannot be loaded" do - server.start_server do |port| + mounts = {} + mounts[:node] = -> (req, res) { + node = Puppet::Node.new('test', environment: Puppet::Node::Environment.remote('doesnotexistonagent')) + res.body = formatter.render(node) + res['Content-Type'] = formatter.mime + } + + server.start_server(mounts: mounts) do |port| Puppet[:serverport] = port Puppet[:log_level] = 'debug' diff --git a/spec/unit/configurer_spec.rb b/spec/unit/configurer_spec.rb index bfa4ec7bdc5..606e679a956 100644 --- a/spec/unit/configurer_spec.rb +++ b/spec/unit/configurer_spec.rb @@ -2,6 +2,8 @@ require 'puppet/configurer' describe Puppet::Configurer do + include PuppetSpec::Files + before do Puppet[:server] = "puppetmaster" Puppet[:report] = true @@ -10,6 +12,17 @@ allow_any_instance_of(described_class).to( receive(:valid_server_environment?).and_return(true) ) + + Puppet[:lastrunfile] = file_containing('last_run_summary.yaml', <<~SUMMARY) + --- + version: + config: 1624882680 + puppet: #{Puppet.version} + application: + initial_environment: #{Puppet[:environment]} + converged_environment: #{Puppet[:environment]} + run_mode: agent + SUMMARY end let(:node_name) { Puppet[:node_name_value] } @@ -1222,7 +1235,6 @@ def expects_neither_new_or_cached_catalog end describe "when selecting an environment" do - include PuppetSpec::Files include PuppetSpec::Settings describe "when the last used environment is available" do @@ -1328,10 +1340,12 @@ def expects_neither_new_or_cached_catalog describe "when the last used environment is not available" do describe "when the node request succeeds" do let(:node_environment) { Puppet::Node::Environment.remote(:salam) } - let(:node) { double(Puppet::Node, :environment => node_environment) } + let(:node) { Puppet::Node.new(Puppet[:node_name_value]) } let(:last_server_specified_environment) { 'development' } before do + node.environment = node_environment + allow(Puppet::Node.indirection).to receive(:find) allow(Puppet::Node.indirection).to receive(:find) .with(anything, hash_including(:ignore_cache => true, :fail_on_404 => true)) From 6b48e0414f33f4b866303812494d54e84b3522e9 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Wed, 27 Oct 2021 23:37:53 +0000 Subject: [PATCH 464/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index f33234c96fa..982069271c6 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -1102,6 +1102,14 @@ From where to retrieve translation files\. The standard Puppet \fBfile\fR type i . .IP "" 0 . +.SS "location_trusted" +This will allow sending the name + password and the cookie header to all hosts that puppet may redirect to\. 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\. +. +.IP "\(bu" 4 +\fIDefault\fR: \fBfalse\fR +. +.IP "" 0 +. .SS "log_level" Default logging level for messages from Puppet\. Allowed values are: . From a43b524113b8272d74ac3847f425c0821e535a49 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Fri, 29 Oct 2021 13:43:03 -0700 Subject: [PATCH 465/731] (maint) Revert comment change --- lib/puppet/graph/simple_graph.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/puppet/graph/simple_graph.rb b/lib/puppet/graph/simple_graph.rb index 0739f490fec..921a51155cd 100644 --- a/lib/puppet/graph/simple_graph.rb +++ b/lib/puppet/graph/simple_graph.rb @@ -352,7 +352,7 @@ def adjacent(v, options = {}) # Just walk the tree and pass each edge. def walk(source, direction) - # Use an iterative, depth-first traversal of the graph. One could do + # Use an iterative, breadth-first traversal of the graph. One could do # this recursively, but Ruby's slow function calls and even slower # recursion make the shorter, recursive algorithm cost-prohibitive. stack = [source] From 7de433f56e73b5cb6faa91aa4a4cb01385c58183 Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 28 Oct 2021 13:01:54 +0200 Subject: [PATCH 466/731] (maint) Allow fast_gettext 2.x dependency --- .gemspec | 2 +- ext/project_data.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gemspec b/.gemspec index 628660a5278..8ceecf1f35f 100644 --- a/.gemspec +++ b/.gemspec @@ -34,7 +34,7 @@ Gem::Specification.new do |s| s.add_runtime_dependency(%q, [">= 2.4.0", "< 5"]) s.add_runtime_dependency(%q, [">= 3.2.1", "< 4"]) s.add_runtime_dependency(%q, "~> 1.0") - s.add_runtime_dependency(%q, "~> 1.1") + s.add_runtime_dependency(%q, ">= 1.1", "< 3") s.add_runtime_dependency(%q, "~> 2.1") s.add_runtime_dependency(%q, "~> 1.13") s.add_runtime_dependency(%q, "~> 1.0") diff --git a/ext/project_data.yaml b/ext/project_data.yaml index 0470a6af128..a91912d1fea 100644 --- a/ext/project_data.yaml +++ b/ext/project_data.yaml @@ -21,7 +21,7 @@ gem_runtime_dependencies: facter: ['> 2.0.1', '< 5'] hiera: ['>= 3.2.1', '< 4'] semantic_puppet: '~> 1.0' - fast_gettext: '~> 1.1' + fast_gettext: ['>= 1.1', '< 3'] locale: '~> 2.1' multi_json: '~> 1.10' puppet-resource_api: '~>1.5' From abad705af9e2688274a0d50cf84c1889355694f4 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Tue, 2 Nov 2021 00:49:56 +0000 Subject: [PATCH 467/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 2 +- man/man8/puppet-agent.8 | 2 +- man/man8/puppet-apply.8 | 2 +- man/man8/puppet-catalog.8 | 2 +- man/man8/puppet-config.8 | 2 +- man/man8/puppet-describe.8 | 2 +- man/man8/puppet-device.8 | 2 +- man/man8/puppet-doc.8 | 2 +- man/man8/puppet-epp.8 | 2 +- man/man8/puppet-facts.8 | 2 +- man/man8/puppet-filebucket.8 | 2 +- man/man8/puppet-generate.8 | 2 +- man/man8/puppet-help.8 | 2 +- man/man8/puppet-lookup.8 | 2 +- man/man8/puppet-module.8 | 2 +- man/man8/puppet-node.8 | 2 +- man/man8/puppet-parser.8 | 2 +- man/man8/puppet-plugin.8 | 2 +- man/man8/puppet-report.8 | 2 +- man/man8/puppet-resource.8 | 2 +- man/man8/puppet-script.8 | 2 +- man/man8/puppet-ssl.8 | 2 +- man/man8/puppet.8 | 2 +- 23 files changed, 23 insertions(+), 23 deletions(-) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index 982069271c6..70cf932f329 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPETCONF" "5" "October 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPETCONF" "5" "November 2021" "Puppet, Inc." "Puppet manual" \fBThis page is autogenerated; any changes will get overwritten\fR . .SH "Configuration settings" diff --git a/man/man8/puppet-agent.8 b/man/man8/puppet-agent.8 index 7ba8d3b3a7c..9ba9f0c33fc 100644 --- a/man/man8/puppet-agent.8 +++ b/man/man8/puppet-agent.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-AGENT" "8" "October 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-AGENT" "8" "November 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-agent\fR \- The puppet agent daemon diff --git a/man/man8/puppet-apply.8 b/man/man8/puppet-apply.8 index 9f6ac1c0512..7ec292a6f1e 100644 --- a/man/man8/puppet-apply.8 +++ b/man/man8/puppet-apply.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-APPLY" "8" "October 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-APPLY" "8" "November 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-apply\fR \- Apply Puppet manifests locally diff --git a/man/man8/puppet-catalog.8 b/man/man8/puppet-catalog.8 index aa28dc75893..6e046a6a34e 100644 --- a/man/man8/puppet-catalog.8 +++ b/man/man8/puppet-catalog.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-CATALOG" "8" "October 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-CATALOG" "8" "November 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-catalog\fR \- Compile, save, view, and convert catalogs\. diff --git a/man/man8/puppet-config.8 b/man/man8/puppet-config.8 index baf499aa5ac..1056b6bb139 100644 --- a/man/man8/puppet-config.8 +++ b/man/man8/puppet-config.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-CONFIG" "8" "October 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-CONFIG" "8" "November 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-config\fR \- Interact with Puppet\'s settings\. diff --git a/man/man8/puppet-describe.8 b/man/man8/puppet-describe.8 index aeabfac69eb..cd134c6b3d4 100644 --- a/man/man8/puppet-describe.8 +++ b/man/man8/puppet-describe.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-DESCRIBE" "8" "October 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-DESCRIBE" "8" "November 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-describe\fR \- Display help about resource types diff --git a/man/man8/puppet-device.8 b/man/man8/puppet-device.8 index bfe91103ca3..aaedee45746 100644 --- a/man/man8/puppet-device.8 +++ b/man/man8/puppet-device.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-DEVICE" "8" "October 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-DEVICE" "8" "November 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-device\fR \- Manage remote network devices diff --git a/man/man8/puppet-doc.8 b/man/man8/puppet-doc.8 index 5c972d36b5c..72598a133ea 100644 --- a/man/man8/puppet-doc.8 +++ b/man/man8/puppet-doc.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-DOC" "8" "October 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-DOC" "8" "November 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-doc\fR \- Generate Puppet references diff --git a/man/man8/puppet-epp.8 b/man/man8/puppet-epp.8 index 6ca1eb80b12..c5704cdad35 100644 --- a/man/man8/puppet-epp.8 +++ b/man/man8/puppet-epp.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-EPP" "8" "October 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-EPP" "8" "November 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-epp\fR \- Interact directly with the EPP template parser/renderer\. diff --git a/man/man8/puppet-facts.8 b/man/man8/puppet-facts.8 index 136934967f3..ebc5f44b746 100644 --- a/man/man8/puppet-facts.8 +++ b/man/man8/puppet-facts.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-FACTS" "8" "October 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-FACTS" "8" "November 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-facts\fR \- Retrieve and store facts\. diff --git a/man/man8/puppet-filebucket.8 b/man/man8/puppet-filebucket.8 index ef419f02a10..7c08dfd567a 100644 --- a/man/man8/puppet-filebucket.8 +++ b/man/man8/puppet-filebucket.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-FILEBUCKET" "8" "October 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-FILEBUCKET" "8" "November 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-filebucket\fR \- Store and retrieve files in a filebucket diff --git a/man/man8/puppet-generate.8 b/man/man8/puppet-generate.8 index 1dcbaa90120..8b02d8396e7 100644 --- a/man/man8/puppet-generate.8 +++ b/man/man8/puppet-generate.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-GENERATE" "8" "October 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-GENERATE" "8" "November 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-generate\fR \- Generates Puppet code from Ruby definitions\. diff --git a/man/man8/puppet-help.8 b/man/man8/puppet-help.8 index 894765e691f..049203b1d76 100644 --- a/man/man8/puppet-help.8 +++ b/man/man8/puppet-help.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-HELP" "8" "October 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-HELP" "8" "November 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-help\fR \- Display Puppet help\. diff --git a/man/man8/puppet-lookup.8 b/man/man8/puppet-lookup.8 index ae36a301ab1..831ded805b7 100644 --- a/man/man8/puppet-lookup.8 +++ b/man/man8/puppet-lookup.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-LOOKUP" "8" "October 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-LOOKUP" "8" "November 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-lookup\fR \- Interactive Hiera lookup diff --git a/man/man8/puppet-module.8 b/man/man8/puppet-module.8 index 2c7bcf6656e..5fb8a64bb61 100644 --- a/man/man8/puppet-module.8 +++ b/man/man8/puppet-module.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-MODULE" "8" "October 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-MODULE" "8" "November 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-module\fR \- Creates, installs and searches for modules on the Puppet Forge\. diff --git a/man/man8/puppet-node.8 b/man/man8/puppet-node.8 index 96bdedd2d62..62cbdec4951 100644 --- a/man/man8/puppet-node.8 +++ b/man/man8/puppet-node.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-NODE" "8" "October 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-NODE" "8" "November 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-node\fR \- View and manage node definitions\. diff --git a/man/man8/puppet-parser.8 b/man/man8/puppet-parser.8 index a3b08017fae..689bff41fa3 100644 --- a/man/man8/puppet-parser.8 +++ b/man/man8/puppet-parser.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-PARSER" "8" "October 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-PARSER" "8" "November 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-parser\fR \- Interact directly with the parser\. diff --git a/man/man8/puppet-plugin.8 b/man/man8/puppet-plugin.8 index f5d72dcef26..bf497b8cf4a 100644 --- a/man/man8/puppet-plugin.8 +++ b/man/man8/puppet-plugin.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-PLUGIN" "8" "October 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-PLUGIN" "8" "November 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-plugin\fR \- Interact with the Puppet plugin system\. diff --git a/man/man8/puppet-report.8 b/man/man8/puppet-report.8 index 84bd2a6dd29..29772ef6a43 100644 --- a/man/man8/puppet-report.8 +++ b/man/man8/puppet-report.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-REPORT" "8" "October 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-REPORT" "8" "November 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-report\fR \- Create, display, and submit reports\. diff --git a/man/man8/puppet-resource.8 b/man/man8/puppet-resource.8 index 30721ae317b..abc33cf29d1 100644 --- a/man/man8/puppet-resource.8 +++ b/man/man8/puppet-resource.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-RESOURCE" "8" "October 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-RESOURCE" "8" "November 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-resource\fR \- The resource abstraction layer shell diff --git a/man/man8/puppet-script.8 b/man/man8/puppet-script.8 index beefd2b878e..156d686b50d 100644 --- a/man/man8/puppet-script.8 +++ b/man/man8/puppet-script.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-SCRIPT" "8" "October 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-SCRIPT" "8" "November 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-script\fR \- Run a puppet manifests as a script without compiling a catalog diff --git a/man/man8/puppet-ssl.8 b/man/man8/puppet-ssl.8 index 25ab1bb78bc..34ab666ccfa 100644 --- a/man/man8/puppet-ssl.8 +++ b/man/man8/puppet-ssl.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-SSL" "8" "October 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-SSL" "8" "November 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-ssl\fR \- Manage SSL keys and certificates for puppet SSL clients diff --git a/man/man8/puppet.8 b/man/man8/puppet.8 index 91e4c9e369f..937e18b09d8 100644 --- a/man/man8/puppet.8 +++ b/man/man8/puppet.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET" "8" "October 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET" "8" "November 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\fR From 2d779e0f23e2c94d883b6c94285fa6140b23aece Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Thu, 4 Nov 2021 09:52:54 +0000 Subject: [PATCH 468/731] (packaging) Updating the puppet.pot file --- locales/puppet.pot | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/locales/puppet.pot b/locales/puppet.pot index 638d5cb3aa9..70ec4a49017 100644 --- a/locales/puppet.pot +++ b/locales/puppet.pot @@ -6,11 +6,11 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Puppet automation framework 7.12.0-60-g118756370f\n" +"Project-Id-Version: Puppet automation framework 7.12.0-88-g22bab01e35\n" "\n" "Report-Msgid-Bugs-To: https://tickets.puppetlabs.com\n" -"POT-Creation-Date: 2021-10-27 03:22+0000\n" -"PO-Revision-Date: 2021-10-27 03:22+0000\n" +"POT-Creation-Date: 2021-11-04 09:52+0000\n" +"PO-Revision-Date: 2021-11-04 09:52+0000\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -404,10 +404,14 @@ msgstr "" msgid "Unknown rendering format '%{format}'" msgstr "" -#: ../lib/puppet/application/lookup.rb:365 +#: ../lib/puppet/application/lookup.rb:353 msgid "Incorrectly formatted data in %{fact_file} given via the --facts flag (only accepts yaml and json files)" msgstr "" +#: ../lib/puppet/application/lookup.rb:364 +msgid "No facts available for target node: %{node}" +msgstr "" + #: ../lib/puppet/application/resource.rb:34 msgid "The resource abstraction layer shell" msgstr "" @@ -761,16 +765,16 @@ msgstr "" msgid "Setting 'environment_data_provider' is deprecated." msgstr "" -#: ../lib/puppet/defaults.rb:820 +#: ../lib/puppet/defaults.rb:826 msgid "Certificate names must be lower case" msgstr "" -#: ../lib/puppet/defaults.rb:1079 ../lib/puppet/settings/enum_setting.rb:13 ../lib/puppet/settings/symbolic_enum_setting.rb:14 +#: ../lib/puppet/defaults.rb:1085 ../lib/puppet/settings/enum_setting.rb:13 ../lib/puppet/settings/symbolic_enum_setting.rb:14 msgid "Invalid value '%{value}' for parameter %{name}. Allowed values are '%{allowed_values}'" msgstr "" #. TRANSLATORS 'pluginsync' is a setting and should not be translated -#: ../lib/puppet/defaults.rb:1950 +#: ../lib/puppet/defaults.rb:1956 msgid "Setting 'pluginsync' is deprecated." msgstr "" @@ -2285,11 +2289,11 @@ msgstr "" msgid "Failed to close connection for %{site}: %{detail}" msgstr "" -#: ../lib/puppet/http/redirector.rb:70 +#: ../lib/puppet/http/redirector.rb:75 msgid "Location response header is missing" msgstr "" -#: ../lib/puppet/http/redirector.rb:74 +#: ../lib/puppet/http/redirector.rb:79 msgid "Location URI is invalid: %{detail}" msgstr "" @@ -6986,40 +6990,40 @@ msgstr "" msgid "Invalid node name %{host}" msgstr "" -#: ../lib/puppet/resource.rb:47 +#: ../lib/puppet/resource.rb:52 msgid "No resource type provided in serialized data" msgstr "" -#: ../lib/puppet/resource.rb:49 +#: ../lib/puppet/resource.rb:54 msgid "No resource title provided in serialized data" msgstr "" #. TRANSLATORS 'Puppet::Resource.new' should not be translated -#: ../lib/puppet/resource.rb:276 +#: ../lib/puppet/resource.rb:294 msgid "Puppet::Resource.new does not take a hash as the first argument." msgstr "" -#: ../lib/puppet/resource.rb:277 +#: ../lib/puppet/resource.rb:295 msgid "Did you mean (%{type}, %{title}) ?" msgstr "" -#: ../lib/puppet/resource.rb:314 +#: ../lib/puppet/resource.rb:333 msgid "Could not find declared class %{title}" msgstr "" -#: ../lib/puppet/resource.rb:316 +#: ../lib/puppet/resource.rb:335 msgid "Invalid resource type %{type}" msgstr "" -#: ../lib/puppet/resource.rb:502 +#: ../lib/puppet/resource.rb:535 msgid "no parameter named '%{name}'" msgstr "" -#: ../lib/puppet/resource.rb:547 +#: ../lib/puppet/resource.rb:580 msgid "No title provided and %{type} is not a valid resource reference" msgstr "" -#: ../lib/puppet/resource.rb:621 +#: ../lib/puppet/resource.rb:654 msgid "No set of title patterns matched the title \"%{title}\"." msgstr "" From d5cbf54689d5d670db84b727f8e764a5b0b023c9 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Thu, 4 Nov 2021 17:20:07 -0700 Subject: [PATCH 469/731] Revert "(maint) Merge up 7f266c2 to main" This reverts commit 35121d8b87890fd3595c9c10622f626bde921ecb, reversing changes made to 8a990e1be01c3f0f02dfe7d411cac68f7c91a859. --- .../agent_fails_with_unknown_resource.rb | 77 ------------------- api/schemas/catalog.json | 3 - benchmarks/serialization/catalog.json | 2 +- lib/puppet/defaults.rb | 6 -- lib/puppet/http/client.rb | 2 +- lib/puppet/http/redirector.rb | 5 -- lib/puppet/parser/resource.rb | 2 +- .../evaluator/runtime3_resource_support.rb | 1 - lib/puppet/resource.rb | 43 ++--------- lib/puppet/resource/catalog.rb | 2 +- .../agent/cached_deferred_catalog.json | 3 +- .../integration/parser/pcore_resource_spec.rb | 10 --- spec/unit/configurer_spec.rb | 2 +- spec/unit/http/client_spec.rb | 59 +------------- spec/unit/resource/catalog_spec.rb | 15 +--- spec/unit/resource_spec.rb | 60 +-------------- 16 files changed, 15 insertions(+), 277 deletions(-) delete mode 100644 acceptance/tests/agent/agent_fails_with_unknown_resource.rb diff --git a/acceptance/tests/agent/agent_fails_with_unknown_resource.rb b/acceptance/tests/agent/agent_fails_with_unknown_resource.rb deleted file mode 100644 index 01c114c5a95..00000000000 --- a/acceptance/tests/agent/agent_fails_with_unknown_resource.rb +++ /dev/null @@ -1,77 +0,0 @@ -test_name "agent run should fail if it finds an unknown resource type" do - tag 'audit:high', - 'audit:integration' - - require 'puppet/acceptance/common_utils' - - require 'puppet/acceptance/environment_utils' - extend Puppet::Acceptance::EnvironmentUtils - - require 'puppet/acceptance/temp_file_utils' - extend Puppet::Acceptance::TempFileUtils - - step "agent should fail when it can't find a resource" do - vendor_modules_path = master.tmpdir('vendor_modules') - tmp_environment = mk_tmp_environment_with_teardown(master, 'tmp') - - site_pp_content = <<-SITEPP - define foocreateresource($one) { - $msg = 'hello' - notify { $name: message => $msg } - } - class example($x) { - if $x == undef or $x == [] or $x == '' { - notice 'foo' - return() - } - notice 'bar' - } - node default { - class { example: x => [] } - create_resources('foocreateresource', {'blah'=>{'one'=>'two'}}) - mycustomtype{'foobar':} - } - SITEPP - manifests_path = "/tmp/#{tmp_environment}/manifests" - on(master, "mkdir -p '#{manifests_path}'") - create_remote_file(master, "#{manifests_path}/site.pp", site_pp_content) - - custom_type_content = <<-CUSTOMTYPE - Puppet::Type.newtype(:mycustomtype) do - @doc = "Create a new mycustomtype thing." - - newparam(:name, :namevar => true) do - desc "Name of mycustomtype instance" - end - - def refresh - end - end - CUSTOMTYPE - type_path = "#{vendor_modules_path}/foo/lib/puppet/type" - on(master, "mkdir -p '#{type_path}'") - create_remote_file(master, "#{type_path}/mycustomtype.rb", custom_type_content) - - on(master, "chmod -R 750 '#{vendor_modules_path}' '/tmp/#{tmp_environment}'") - on(master, "chown -R #{master.puppet['user']}:#{master.puppet['group']} '#{vendor_modules_path}' '/tmp/#{tmp_environment}'") - - master_opts = { - 'main' => { - 'environment' => tmp_environment, - 'vendormoduledir' => vendor_modules_path - } - } - - with_puppet_running_on(master, master_opts) do - agents.each do |agent| - teardown do - agent.rm_rf(vendor_modules_path) - end - - on(agent, puppet('agent', '-t', '--environment', tmp_environment), acceptable_exit_codes: [1]) do |result| - assert_match(/Error: Failed to apply catalog: Resource type 'Mycustomtype' was not found/, result.stderr) - end - end - end - end -end diff --git a/api/schemas/catalog.json b/api/schemas/catalog.json index 091d470b997..06d51dde556 100644 --- a/api/schemas/catalog.json +++ b/api/schemas/catalog.json @@ -45,9 +45,6 @@ "line": { "type": "integer" }, - "kind": { - "type": "string" - }, "file": { "type": "string" }, diff --git a/benchmarks/serialization/catalog.json b/benchmarks/serialization/catalog.json index a773581e487..37b9967549b 100644 --- a/benchmarks/serialization/catalog.json +++ b/benchmarks/serialization/catalog.json @@ -118,7 +118,7 @@ "version": 1492108311, "code_id": null, "catalog_uuid": "c85cdf7e-f56d-4fc7-b513-3a00532cee91", - "catalog_format": 2, + "catalog_format": 1, "environment": "production", "resources": [ { diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb index c9c51ba99f6..8b0359fd161 100644 --- a/lib/puppet/defaults.rb +++ b/lib/puppet/defaults.rb @@ -761,12 +761,6 @@ def self.initialize_default_settings!(settings) :owner => "service", :group => "service", :desc => "The directory where catalog previews per node are generated." - }, - :location_trusted => { - :default => false, - :type => :boolean, - :desc => "This will allow sending the name + password and the cookie header to all hosts that puppet may redirect to. - 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." } ) diff --git a/lib/puppet/http/client.rb b/lib/puppet/http/client.rb index 8effcb1f2aa..15b47af4446 100644 --- a/lib/puppet/http/client.rb +++ b/lib/puppet/http/client.rb @@ -346,7 +346,7 @@ def execute_streaming(request, options: {}, &block) while !done do connect(request.uri, options: options) do |http| - apply_auth(request, basic_auth) if redirects.zero? + apply_auth(request, basic_auth) # don't call return within the `request` block http.request(request) do |nethttp| diff --git a/lib/puppet/http/redirector.rb b/lib/puppet/http/redirector.rb index ef1a61e6e78..0b1c6fef80e 100644 --- a/lib/puppet/http/redirector.rb +++ b/lib/puppet/http/redirector.rb @@ -49,11 +49,6 @@ def redirect_to(request, response, redirects) new_request = request.class.new(url) new_request.body = request.body request.each do |header, value| - unless Puppet[:location_trusted] - # skip adding potentially sensitive header to other hosts - next if header.casecmp('Authorization').zero? && request.uri.host.casecmp(location.host) != 0 - next if header.casecmp('Cookie').zero? && request.uri.host.casecmp(location.host) != 0 - end new_request[header] = value end diff --git a/lib/puppet/parser/resource.rb b/lib/puppet/parser/resource.rb index 06059b514e8..e76a4a5250c 100644 --- a/lib/puppet/parser/resource.rb +++ b/lib/puppet/parser/resource.rb @@ -13,7 +13,7 @@ class Puppet::Parser::Resource < Puppet::Resource attr_accessor :source, :scope, :collector_id attr_accessor :virtual, :override, :translated, :catalog, :evaluated - attr_accessor :file, :line, :kind + attr_accessor :file, :line attr_reader :exported, :parameters diff --git a/lib/puppet/pops/evaluator/runtime3_resource_support.rb b/lib/puppet/pops/evaluator/runtime3_resource_support.rb index abd1c5920ed..08dfb871777 100644 --- a/lib/puppet/pops/evaluator/runtime3_resource_support.rb +++ b/lib/puppet/pops/evaluator/runtime3_resource_support.rb @@ -40,7 +40,6 @@ def self.create_resources(file, line, scope, virtual, exported, type_name, resou :parameters => evaluated_parameters, :file => file, :line => line, - :kind => Puppet::Resource.to_kind(resolved_type), :exported => exported, :virtual => virtual, # WTF is this? Which source is this? The file? The name of the context ? diff --git a/lib/puppet/resource.rb b/lib/puppet/resource.rb index 466f94bd716..ca484a327f8 100644 --- a/lib/puppet/resource.rb +++ b/lib/puppet/resource.rb @@ -11,7 +11,7 @@ class Puppet::Resource include Puppet::Util::PsychSupport include Enumerable - attr_accessor :file, :line, :catalog, :exported, :virtual, :strict, :kind + attr_accessor :file, :line, :catalog, :exported, :virtual, :strict attr_reader :type, :title, :parameters # @!attribute [rw] sensitive_parameters @@ -29,15 +29,10 @@ class Puppet::Resource EMPTY_ARRAY = [].freeze EMPTY_HASH = {}.freeze - ATTRIBUTES = [:file, :line, :exported, :kind].freeze + ATTRIBUTES = [:file, :line, :exported].freeze TYPE_CLASS = 'Class'.freeze TYPE_NODE = 'Node'.freeze - CLASS_STRING = 'class'.freeze - DEFINED_TYPE_STRING = 'defined_type'.freeze - COMPILABLE_TYPE_STRING = 'compilable_type'.freeze - UNKNOWN_TYPE_STRING = 'unknown'.freeze - PCORE_TYPE_KEY = '__ptype'.freeze VALUE_KEY = 'value'.freeze @@ -198,18 +193,6 @@ def builtin_type? resource_type.is_a?(Puppet::CompilableResourceType) end - def self.to_kind(resource_type) - if resource_type == CLASS_STRING - CLASS_STRING - elsif resource_type.is_a?(Puppet::Resource::Type) && resource_type.type == :definition - DEFINED_TYPE_STRING - elsif resource_type.is_a?(Puppet::CompilableResourceType) - COMPILABLE_TYPE_STRING - else - UNKNOWN_TYPE_STRING - end - end - # Iterate over each param/value pair, as required for Enumerable. def each parameters.each { |p,v| yield p, v } @@ -264,7 +247,6 @@ def initialize(type, title = nil, attributes = EMPTY_HASH) src = type self.file = src.file self.line = src.line - self.kind = src.kind self.exported = src.exported self.virtual = src.virtual self.set_tags(src) @@ -327,7 +309,6 @@ def initialize(type, title = nil, attributes = EMPTY_HASH) rt = resource_type - self.kind = self.class.to_kind(rt) unless kind if strict? && rt.nil? if self.class? raise ArgumentError, _("Could not find declared class %{title}") % { title: title } @@ -487,24 +468,10 @@ def to_ref ref end - # Convert our resource to a RAL resource instance. Creates component - # instances for resource types that are not of a compilable_type kind. In case - # the resource doesn’t exist and it’s compilable_type kind, raise an error. - # There are certain cases where a resource won't be in a catalog, such as - # when we create a resource directly by using Puppet::Resource.new(...), so we - # must check its kind before deciding whether the catalog format is of an older - # version or not. + # Convert our resource to a RAL resource instance. Creates component + # instances for resource types that don't exist. def to_ral - if self.kind == COMPILABLE_TYPE_STRING - typeklass = Puppet::Type.type(self.type) - elsif self.catalog && self.catalog.catalog_format >= 2 - typeklass = Puppet::Type.type(:component) - else - typeklass = Puppet::Type.type(self.type) || Puppet::Type.type(:component) - end - - raise(Puppet::Error, "Resource type '#{self.type}' was not found") unless typeklass - + typeklass = Puppet::Type.type(self.type) || Puppet::Type.type(:component) typeklass.new(self) end diff --git a/lib/puppet/resource/catalog.rb b/lib/puppet/resource/catalog.rb index 1e27a18c867..ce210914bce 100644 --- a/lib/puppet/resource/catalog.rb +++ b/lib/puppet/resource/catalog.rb @@ -313,7 +313,7 @@ def initialize(name = nil, environment = Puppet::Node::Environment::NONE, code_i super() @name = name @catalog_uuid = SecureRandom.uuid - @catalog_format = 2 + @catalog_format = 1 @metadata = {} @recursive_metadata = {} @classes = [] diff --git a/spec/fixtures/integration/application/agent/cached_deferred_catalog.json b/spec/fixtures/integration/application/agent/cached_deferred_catalog.json index 35e772e8f9f..a81b9cbf200 100644 --- a/spec/fixtures/integration/application/agent/cached_deferred_catalog.json +++ b/spec/fixtures/integration/application/agent/cached_deferred_catalog.json @@ -6,7 +6,7 @@ "version": 1607629733, "code_id": null, "catalog_uuid": "afc8472a-306b-4b24-b060-e956dffb79b8", - "catalog_format": 2, + "catalog_format": 1, "environment": "production", "resources": [ { @@ -50,7 +50,6 @@ ], "file": "", "line": 1, - "kind": "compilable_type", "exported": false, "parameters": { "message": { diff --git a/spec/integration/parser/pcore_resource_spec.rb b/spec/integration/parser/pcore_resource_spec.rb index edc2af3d1e3..c86b6e2b7b9 100644 --- a/spec/integration/parser/pcore_resource_spec.rb +++ b/spec/integration/parser/pcore_resource_spec.rb @@ -122,16 +122,6 @@ def self.title_patterns expect(catalog.resource(:test3, "x/y")['message']).to eq('x/y works') end - it 'considers Pcore types to be builtin ' do - genface.types - catalog = compile_to_catalog(<<-MANIFEST) - test1 { 'a': - message => 'a works' - } - MANIFEST - expect(catalog.resource(:test1, "a").kind).to eq('compilable_type') - end - it 'the validity of attribute names are checked' do genface.types expect do diff --git a/spec/unit/configurer_spec.rb b/spec/unit/configurer_spec.rb index 606e679a956..613978fdc27 100644 --- a/spec/unit/configurer_spec.rb +++ b/spec/unit/configurer_spec.rb @@ -879,7 +879,7 @@ def expects_neither_new_or_cached_catalog expect(configurer.run).to be_nil end - it "should proceed with the cached catalog if its environment matches the local environment" do + it "should proceed with the cached catalog if its environment matchs the local environment" do expects_cached_catalog_only(catalog) expect(configurer.run).to eq(0) diff --git a/spec/unit/http/client_spec.rb b/spec/unit/http/client_spec.rb index d9f05d3ae58..a4fa2b06dfd 100644 --- a/spec/unit/http/client_spec.rb +++ b/spec/unit/http/client_spec.rb @@ -597,68 +597,11 @@ def redirect_to(status: 302, url:) expect(response).to be_success end - it "does not preserve basic authorization when redirecting to different hosts" do - stub_request(:get, start_url).with(basic_auth: credentials).to_return(redirect_to(url: other_host)) - stub_request(:get, other_host).to_return(status: 200) - - client.get(start_url, options: {basic_auth: {user: 'user', password: 'pass'}}) - expect(a_request(:get, other_host). - with{ |req| !req.headers.key?('Authorization')}).to have_been_made - end - - it "does preserve basic authorization when redirecting to the same hosts" do - stub_request(:get, start_url).with(basic_auth: credentials).to_return(redirect_to(url: bar_url)) - stub_request(:get, bar_url).with(basic_auth: credentials).to_return(status: 200) - - client.get(start_url, options: {basic_auth: {user: 'user', password: 'pass'}}) - expect(a_request(:get, bar_url). - with{ |req| req.headers.key?('Authorization')}).to have_been_made - end - - it "does not preserve cookie header when redirecting to different hosts" do - headers = { 'Cookie' => 'TEST_COOKIE'} - - stub_request(:get, start_url).with(headers: headers).to_return(redirect_to(url: other_host)) - stub_request(:get, other_host).to_return(status: 200) - - client.get(start_url, headers: headers) - expect(a_request(:get, other_host). - with{ |req| !req.headers.key?('Cookie')}).to have_been_made - end - - it "does preserve cookie header when redirecting to the same hosts" do - headers = { 'Cookie' => 'TEST_COOKIE'} - - stub_request(:get, start_url).with(headers: headers).to_return(redirect_to(url: bar_url)) - stub_request(:get, bar_url).with(headers: headers).to_return(status: 200) - - client.get(start_url, headers: headers) - expect(a_request(:get, bar_url). - with{ |req| req.headers.key?('Cookie')}).to have_been_made - end - - it "does preserves cookie header and basic authentication when Puppet[:location_trusted] is true redirecting to different hosts" do - headers = { 'cookie' => 'TEST_COOKIE'} - Puppet[:location_trusted] = true - - stub_request(:get, start_url).with(headers: headers, basic_auth: credentials).to_return(redirect_to(url: other_host)) - stub_request(:get, other_host).with(headers: headers, basic_auth: credentials).to_return(status: 200) - - client.get(start_url, headers: headers, options: {basic_auth: {user: 'user', password: 'pass'}}) - expect(a_request(:get, other_host). - with{ |req| req.headers.key?('Authorization') && req.headers.key?('Cookie')}).to have_been_made - end - - it "treats hosts as case-insensitive" do - start_url = URI("https://www.EXAmple.com:8140/Start") - bar_url = "https://www.example.com:8140/bar" - + it "preserves basic authorization" do stub_request(:get, start_url).with(basic_auth: credentials).to_return(redirect_to(url: bar_url)) stub_request(:get, bar_url).with(basic_auth: credentials).to_return(status: 200) client.get(start_url, options: {basic_auth: {user: 'user', password: 'pass'}}) - expect(a_request(:get, bar_url). - with{ |req| req.headers.key?('Authorization')}).to have_been_made end it "redirects given a relative location" do diff --git a/spec/unit/resource/catalog_spec.rb b/spec/unit/resource/catalog_spec.rb index c65ec4bde83..e93b77a1d22 100644 --- a/spec/unit/resource/catalog_spec.rb +++ b/spec/unit/resource/catalog_spec.rb @@ -104,7 +104,7 @@ it "should include the current catalog_format" do catalog = Puppet::Resource::Catalog.new("host") - expect(catalog.catalog_format).to eq(2) + expect(catalog.catalog_format).to eq(1) end describe "when compiling" do @@ -178,7 +178,6 @@ @original.add_edge(@middle, @bottom) @original.add_edge(@bottom, @bottomobject) - @original.catalog_format = 1 @catalog = @original.to_ral end @@ -191,18 +190,6 @@ end end - it "should raise if an unknown resource is being converted" do - @new_res = Puppet::Resource.new "Unknown", "type", :kind => 'compilable_type' - @resource_array = [@new_res] - - @original.add_resource(*@resource_array) - @original.add_edge(@bottomobject, @new_res) - - @original.catalog_format = 2 - - expect { @original.to_ral }.to raise_error(Puppet::Error, "Resource type 'Unknown' was not found") - end - it "should copy the tag list to the new catalog" do expect(@catalog.tags.sort).to eq(@original.tags.sort) end diff --git a/spec/unit/resource_spec.rb b/spec/unit/resource_spec.rb index c527358e3f6..498442f865c 100644 --- a/spec/unit/resource_spec.rb +++ b/spec/unit/resource_spec.rb @@ -638,68 +638,19 @@ def inject_and_set_defaults(resource, scope) it "should use the resource type's :new method to create the resource if the resource is of a builtin type" do resource = Puppet::Resource.new("file", basepath+"/my/file") result = resource.to_ral - expect(result).to be_instance_of(Puppet::Type.type(:file)) expect(result[:path]).to eq(basepath+"/my/file") end - it "should convert to a component instance if the resource is not a compilable_type" do + it "should convert to a component instance if the resource type is not of a builtin type" do resource = Puppet::Resource.new("foobar", "somename") result = resource.to_ral expect(result).to be_instance_of(Puppet::Type.type(:component)) expect(result.title).to eq("Foobar[somename]") end - - it "should convert to a component instance if the resource is a class" do - resource = Puppet::Resource.new("Class", "somename") - result = resource.to_ral - - expect(result).to be_instance_of(Puppet::Type.type(:component)) - expect(result.title).to eq("Class[Somename]") - end - - it "should convert to component when the resource is a defined_type" do - resource = Puppet::Resource.new("Unknown", "type", :kind => 'defined_type') - - result = resource.to_ral - expect(result).to be_instance_of(Puppet::Type.type(:component)) - end - - it "should raise if a resource type is a compilable_type and it wasn't found" do - resource = Puppet::Resource.new("Unknown", "type", :kind => 'compilable_type') - - expect { resource.to_ral }.to raise_error(Puppet::Error, "Resource type 'Unknown' was not found") - end - - it "should use the old behaviour when the catalog_format is equal to 1" do - resource = Puppet::Resource.new("Unknown", "type") - catalog = Puppet::Resource::Catalog.new("mynode") - - resource.catalog = catalog - resource.catalog.catalog_format = 1 - - result = resource.to_ral - expect(result).to be_instance_of(Puppet::Type.type(:component)) - end - - it "should use the new behaviour and fail when the catalog_format is greater than 1" do - resource = Puppet::Resource.new("Unknown", "type", :kind => 'compilable_type') - catalog = Puppet::Resource::Catalog.new("mynode") - - resource.catalog = catalog - resource.catalog.catalog_format = 2 - - expect { resource.to_ral }.to raise_error(Puppet::Error, "Resource type 'Unknown' was not found") - end - - it "should use the resource type when the resource doesn't respond to kind and the resource type can be found" do - resource = Puppet::Resource.new("file", basepath+"/my/file") - - result = resource.to_ral - expect(result).to be_instance_of(Puppet::Type.type(:file)) - end end + describe "when converting to puppet code" do before do @resource = Puppet::Resource.new("one::two", "/my/file", @@ -815,13 +766,6 @@ def inject_and_set_defaults(resource, scope) expect(Puppet::Resource.from_data_hash(JSON.parse(resource.to_json)).line).to eq(50) end - it "should include the kind if one is set" do - resource = Puppet::Resource.new("File", "/foo") - resource.kind = 'im_a_file' - - expect(Puppet::Resource.from_data_hash(JSON.parse(resource.to_json)).kind).to eq('im_a_file') - end - it "should include the 'exported' value if one is set" do resource = Puppet::Resource.new("File", "/foo") resource.exported = true From 047c84e72b617d36a4e0b9c8599c8d953e39c906 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Fri, 5 Nov 2021 03:24:42 +0000 Subject: [PATCH 470/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 8 -------- 1 file changed, 8 deletions(-) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index 70cf932f329..ed4a53f656b 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -1102,14 +1102,6 @@ From where to retrieve translation files\. The standard Puppet \fBfile\fR type i . .IP "" 0 . -.SS "location_trusted" -This will allow sending the name + password and the cookie header to all hosts that puppet may redirect to\. 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\. -. -.IP "\(bu" 4 -\fIDefault\fR: \fBfalse\fR -. -.IP "" 0 -. .SS "log_level" Default logging level for messages from Puppet\. Allowed values are: . From fd6784c30a96012a7ac324d9e5e3036f8265f55b Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Mon, 4 Oct 2021 17:19:24 -0700 Subject: [PATCH 471/731] (PUP-11312) Avoid unnecessary to_s copies Convert `child_dir` from a Pathname to a String outside of the `modulepath_directories.find` loop. --- lib/puppet/pops/validation/checker4_0.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/puppet/pops/validation/checker4_0.rb b/lib/puppet/pops/validation/checker4_0.rb index 47db54466a3..1f6bd4d749f 100644 --- a/lib/puppet/pops/validation/checker4_0.rb +++ b/lib/puppet/pops/validation/checker4_0.rb @@ -614,20 +614,25 @@ def initial_manifest?(path, manifest_setting) string_path == manifest_setting || string_path.start_with?(manifest_setting) end + # Get the path of +file_path+ relative to the first directory in + # +modulepath_directories+ that is an ancestor of +file_path+. Return NO_PATH + # if none is found. def get_module_relative_path(file_path, modulepath_directories) - clean_file = file_path.cleanpath + clean_file = file_path.cleanpath.to_s parent_path = modulepath_directories.find { |path_dir| is_parent_dir_of(path_dir, clean_file) } return NO_PATH if parent_path.nil? file_path.relative_path_from(Pathname.new(parent_path)) end + private :get_module_relative_path def is_parent_dir_of(parent_dir, child_dir) parent_dir_path = Pathname.new(parent_dir) clean_parent = parent_dir_path.cleanpath.to_s + File::SEPARATOR - return child_dir.to_s.start_with?(clean_parent) + return child_dir.start_with?(clean_parent) end + private :is_parent_dir_of def dir_to_names(relative_path) # Downcasing here because check is case-insensitive From ba6823e9b48afeb1f5cc97f4cd84a0f55f03fcef Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Mon, 18 Oct 2021 16:15:39 -0700 Subject: [PATCH 472/731] (PUP-11312) Eliminate repeated Pathname#to_s calls Each PathPattern instance called `Pathname#to_s` 4 times during validation and more when globbing. Eliminate these extra calls by caching the `pathstr` from the validated Pathname. --- lib/puppet/file_system/path_pattern.rb | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/puppet/file_system/path_pattern.rb b/lib/puppet/file_system/path_pattern.rb index c7f0efcc76f..27690613aa7 100644 --- a/lib/puppet/file_system/path_pattern.rb +++ b/lib/puppet/file_system/path_pattern.rb @@ -32,11 +32,11 @@ def prefix_with(prefix) end def glob - Dir.glob(pathname.to_s) + Dir.glob(@pathstr) end def to_s - pathname.to_s + @pathstr end protected @@ -51,8 +51,7 @@ def validate raise(InvalidPattern, _("PathPatterns cannot be created with directory traversals.")) end end - case @pathname.to_s - when CURRENT_DRIVE_RELATIVE_WINDOWS + if @pathstr.match?(CURRENT_DRIVE_RELATIVE_WINDOWS) raise(InvalidPattern, _("A PathPattern cannot be a Windows current drive relative path.")) end end @@ -60,6 +59,7 @@ def validate def initialize(pattern) begin @pathname = Pathname.new(pattern.strip) + @pathstr = @pathname.to_s rescue ArgumentError => error raise InvalidPattern.new(_("PathPatterns cannot be created with a zero byte."), error) end @@ -74,10 +74,9 @@ def absolute? def validate super - case @pathname.to_s - when ABSOLUTE_WINDOWS + if @pathstr.match?(ABSOLUTE_WINDOWS) raise(InvalidPattern, _("A relative PathPattern cannot be prefixed with a drive.")) - when ABSOLUTE_UNIX + elsif @pathstr.match?(ABSOLUTE_UNIX) raise(InvalidPattern, _("A relative PathPattern cannot be an absolute path.")) end end @@ -90,7 +89,7 @@ def absolute? def validate super - if @pathname.to_s !~ ABSOLUTE_UNIX and @pathname.to_s !~ ABSOLUTE_WINDOWS + if !@pathstr.match?(ABSOLUTE_UNIX) && !@pathstr.match?(ABSOLUTE_WINDOWS) raise(InvalidPattern, _("An absolute PathPattern cannot be a relative path.")) end end From a96dda461705cd40524234a05a9324c1953640af Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Mon, 18 Oct 2021 16:23:00 -0700 Subject: [PATCH 473/731] (PUP-11312) Avoid Pathname.chop_basename Pathname#each_filename is implemented using chop_basename. Since we want to know if any pathname component contains .. split it using Pathname#SEPARATOR_PAT[1], as that is the pattern for file separators on the local system, i.e. includes File::ALT_SEPARATOR on Windows. [1] https://github.com/ruby/ruby/blob/v2_7_3/ext/pathname/lib/pathname.rb#L30-L36 --- lib/puppet/file_system/path_pattern.rb | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/lib/puppet/file_system/path_pattern.rb b/lib/puppet/file_system/path_pattern.rb index 27690613aa7..2d23c0e6875 100644 --- a/lib/puppet/file_system/path_pattern.rb +++ b/lib/puppet/file_system/path_pattern.rb @@ -5,10 +5,9 @@ module Puppet::FileSystem class PathPattern class InvalidPattern < Puppet::Error; end - TRAVERSAL = /^\.\.$/ + DOTDOT = '..'.freeze ABSOLUTE_UNIX = /^\// ABSOLUTE_WINDOWS = /^[a-z]:/i - #ABSOLUT_VODKA #notappearinginthisclass CURRENT_DRIVE_RELATIVE_WINDOWS = /^\\/ def self.relative(pattern) @@ -46,12 +45,9 @@ def to_s private def validate - @pathname.each_filename do |e| - if e =~ TRAVERSAL - raise(InvalidPattern, _("PathPatterns cannot be created with directory traversals.")) - end - end - if @pathstr.match?(CURRENT_DRIVE_RELATIVE_WINDOWS) + if @pathstr.split(Pathname::SEPARATOR_PAT).any? { |f| f == DOTDOT } + raise(InvalidPattern, _("PathPatterns cannot be created with directory traversals.")) + elsif @pathstr.match?(CURRENT_DRIVE_RELATIVE_WINDOWS) raise(InvalidPattern, _("A PathPattern cannot be a Windows current drive relative path.")) end end From 9ff70a230b60d7d57fc2453e62c7aa7e37e3fb48 Mon Sep 17 00:00:00 2001 From: Luchian Nemes Date: Wed, 10 Nov 2021 11:24:04 +0200 Subject: [PATCH 474/731] Revert "Merge pull request #8809 from joshcooper/revert_35121d8b87" This reverts commit 845033b31caa3234801d155727c39dcbb26cbd93, reversing changes made to 3b2acd0f1cf855706d67cd340d1b3277ba04c88f. --- .../agent_fails_with_unknown_resource.rb | 77 +++++++++++++++++++ api/schemas/catalog.json | 3 + benchmarks/serialization/catalog.json | 2 +- lib/puppet/defaults.rb | 6 ++ lib/puppet/http/client.rb | 2 +- lib/puppet/http/redirector.rb | 5 ++ lib/puppet/parser/resource.rb | 2 +- .../evaluator/runtime3_resource_support.rb | 1 + lib/puppet/resource.rb | 43 +++++++++-- lib/puppet/resource/catalog.rb | 2 +- .../agent/cached_deferred_catalog.json | 3 +- .../integration/parser/pcore_resource_spec.rb | 10 +++ spec/unit/configurer_spec.rb | 2 +- spec/unit/http/client_spec.rb | 59 +++++++++++++- spec/unit/resource/catalog_spec.rb | 15 +++- spec/unit/resource_spec.rb | 60 ++++++++++++++- 16 files changed, 277 insertions(+), 15 deletions(-) create mode 100644 acceptance/tests/agent/agent_fails_with_unknown_resource.rb diff --git a/acceptance/tests/agent/agent_fails_with_unknown_resource.rb b/acceptance/tests/agent/agent_fails_with_unknown_resource.rb new file mode 100644 index 00000000000..01c114c5a95 --- /dev/null +++ b/acceptance/tests/agent/agent_fails_with_unknown_resource.rb @@ -0,0 +1,77 @@ +test_name "agent run should fail if it finds an unknown resource type" do + tag 'audit:high', + 'audit:integration' + + require 'puppet/acceptance/common_utils' + + require 'puppet/acceptance/environment_utils' + extend Puppet::Acceptance::EnvironmentUtils + + require 'puppet/acceptance/temp_file_utils' + extend Puppet::Acceptance::TempFileUtils + + step "agent should fail when it can't find a resource" do + vendor_modules_path = master.tmpdir('vendor_modules') + tmp_environment = mk_tmp_environment_with_teardown(master, 'tmp') + + site_pp_content = <<-SITEPP + define foocreateresource($one) { + $msg = 'hello' + notify { $name: message => $msg } + } + class example($x) { + if $x == undef or $x == [] or $x == '' { + notice 'foo' + return() + } + notice 'bar' + } + node default { + class { example: x => [] } + create_resources('foocreateresource', {'blah'=>{'one'=>'two'}}) + mycustomtype{'foobar':} + } + SITEPP + manifests_path = "/tmp/#{tmp_environment}/manifests" + on(master, "mkdir -p '#{manifests_path}'") + create_remote_file(master, "#{manifests_path}/site.pp", site_pp_content) + + custom_type_content = <<-CUSTOMTYPE + Puppet::Type.newtype(:mycustomtype) do + @doc = "Create a new mycustomtype thing." + + newparam(:name, :namevar => true) do + desc "Name of mycustomtype instance" + end + + def refresh + end + end + CUSTOMTYPE + type_path = "#{vendor_modules_path}/foo/lib/puppet/type" + on(master, "mkdir -p '#{type_path}'") + create_remote_file(master, "#{type_path}/mycustomtype.rb", custom_type_content) + + on(master, "chmod -R 750 '#{vendor_modules_path}' '/tmp/#{tmp_environment}'") + on(master, "chown -R #{master.puppet['user']}:#{master.puppet['group']} '#{vendor_modules_path}' '/tmp/#{tmp_environment}'") + + master_opts = { + 'main' => { + 'environment' => tmp_environment, + 'vendormoduledir' => vendor_modules_path + } + } + + with_puppet_running_on(master, master_opts) do + agents.each do |agent| + teardown do + agent.rm_rf(vendor_modules_path) + end + + on(agent, puppet('agent', '-t', '--environment', tmp_environment), acceptable_exit_codes: [1]) do |result| + assert_match(/Error: Failed to apply catalog: Resource type 'Mycustomtype' was not found/, result.stderr) + end + end + end + end +end diff --git a/api/schemas/catalog.json b/api/schemas/catalog.json index 06d51dde556..091d470b997 100644 --- a/api/schemas/catalog.json +++ b/api/schemas/catalog.json @@ -45,6 +45,9 @@ "line": { "type": "integer" }, + "kind": { + "type": "string" + }, "file": { "type": "string" }, diff --git a/benchmarks/serialization/catalog.json b/benchmarks/serialization/catalog.json index 37b9967549b..a773581e487 100644 --- a/benchmarks/serialization/catalog.json +++ b/benchmarks/serialization/catalog.json @@ -118,7 +118,7 @@ "version": 1492108311, "code_id": null, "catalog_uuid": "c85cdf7e-f56d-4fc7-b513-3a00532cee91", - "catalog_format": 1, + "catalog_format": 2, "environment": "production", "resources": [ { diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb index 8b0359fd161..c9c51ba99f6 100644 --- a/lib/puppet/defaults.rb +++ b/lib/puppet/defaults.rb @@ -761,6 +761,12 @@ def self.initialize_default_settings!(settings) :owner => "service", :group => "service", :desc => "The directory where catalog previews per node are generated." + }, + :location_trusted => { + :default => false, + :type => :boolean, + :desc => "This will allow sending the name + password and the cookie header to all hosts that puppet may redirect to. + 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." } ) diff --git a/lib/puppet/http/client.rb b/lib/puppet/http/client.rb index 15b47af4446..8effcb1f2aa 100644 --- a/lib/puppet/http/client.rb +++ b/lib/puppet/http/client.rb @@ -346,7 +346,7 @@ def execute_streaming(request, options: {}, &block) while !done do connect(request.uri, options: options) do |http| - apply_auth(request, basic_auth) + apply_auth(request, basic_auth) if redirects.zero? # don't call return within the `request` block http.request(request) do |nethttp| diff --git a/lib/puppet/http/redirector.rb b/lib/puppet/http/redirector.rb index 0b1c6fef80e..ef1a61e6e78 100644 --- a/lib/puppet/http/redirector.rb +++ b/lib/puppet/http/redirector.rb @@ -49,6 +49,11 @@ def redirect_to(request, response, redirects) new_request = request.class.new(url) new_request.body = request.body request.each do |header, value| + unless Puppet[:location_trusted] + # skip adding potentially sensitive header to other hosts + next if header.casecmp('Authorization').zero? && request.uri.host.casecmp(location.host) != 0 + next if header.casecmp('Cookie').zero? && request.uri.host.casecmp(location.host) != 0 + end new_request[header] = value end diff --git a/lib/puppet/parser/resource.rb b/lib/puppet/parser/resource.rb index e76a4a5250c..06059b514e8 100644 --- a/lib/puppet/parser/resource.rb +++ b/lib/puppet/parser/resource.rb @@ -13,7 +13,7 @@ class Puppet::Parser::Resource < Puppet::Resource attr_accessor :source, :scope, :collector_id attr_accessor :virtual, :override, :translated, :catalog, :evaluated - attr_accessor :file, :line + attr_accessor :file, :line, :kind attr_reader :exported, :parameters diff --git a/lib/puppet/pops/evaluator/runtime3_resource_support.rb b/lib/puppet/pops/evaluator/runtime3_resource_support.rb index 08dfb871777..abd1c5920ed 100644 --- a/lib/puppet/pops/evaluator/runtime3_resource_support.rb +++ b/lib/puppet/pops/evaluator/runtime3_resource_support.rb @@ -40,6 +40,7 @@ def self.create_resources(file, line, scope, virtual, exported, type_name, resou :parameters => evaluated_parameters, :file => file, :line => line, + :kind => Puppet::Resource.to_kind(resolved_type), :exported => exported, :virtual => virtual, # WTF is this? Which source is this? The file? The name of the context ? diff --git a/lib/puppet/resource.rb b/lib/puppet/resource.rb index ca484a327f8..466f94bd716 100644 --- a/lib/puppet/resource.rb +++ b/lib/puppet/resource.rb @@ -11,7 +11,7 @@ class Puppet::Resource include Puppet::Util::PsychSupport include Enumerable - attr_accessor :file, :line, :catalog, :exported, :virtual, :strict + attr_accessor :file, :line, :catalog, :exported, :virtual, :strict, :kind attr_reader :type, :title, :parameters # @!attribute [rw] sensitive_parameters @@ -29,10 +29,15 @@ class Puppet::Resource EMPTY_ARRAY = [].freeze EMPTY_HASH = {}.freeze - ATTRIBUTES = [:file, :line, :exported].freeze + ATTRIBUTES = [:file, :line, :exported, :kind].freeze TYPE_CLASS = 'Class'.freeze TYPE_NODE = 'Node'.freeze + CLASS_STRING = 'class'.freeze + DEFINED_TYPE_STRING = 'defined_type'.freeze + COMPILABLE_TYPE_STRING = 'compilable_type'.freeze + UNKNOWN_TYPE_STRING = 'unknown'.freeze + PCORE_TYPE_KEY = '__ptype'.freeze VALUE_KEY = 'value'.freeze @@ -193,6 +198,18 @@ def builtin_type? resource_type.is_a?(Puppet::CompilableResourceType) end + def self.to_kind(resource_type) + if resource_type == CLASS_STRING + CLASS_STRING + elsif resource_type.is_a?(Puppet::Resource::Type) && resource_type.type == :definition + DEFINED_TYPE_STRING + elsif resource_type.is_a?(Puppet::CompilableResourceType) + COMPILABLE_TYPE_STRING + else + UNKNOWN_TYPE_STRING + end + end + # Iterate over each param/value pair, as required for Enumerable. def each parameters.each { |p,v| yield p, v } @@ -247,6 +264,7 @@ def initialize(type, title = nil, attributes = EMPTY_HASH) src = type self.file = src.file self.line = src.line + self.kind = src.kind self.exported = src.exported self.virtual = src.virtual self.set_tags(src) @@ -309,6 +327,7 @@ def initialize(type, title = nil, attributes = EMPTY_HASH) rt = resource_type + self.kind = self.class.to_kind(rt) unless kind if strict? && rt.nil? if self.class? raise ArgumentError, _("Could not find declared class %{title}") % { title: title } @@ -468,10 +487,24 @@ def to_ref ref end - # Convert our resource to a RAL resource instance. Creates component - # instances for resource types that don't exist. + # Convert our resource to a RAL resource instance. Creates component + # instances for resource types that are not of a compilable_type kind. In case + # the resource doesn’t exist and it’s compilable_type kind, raise an error. + # There are certain cases where a resource won't be in a catalog, such as + # when we create a resource directly by using Puppet::Resource.new(...), so we + # must check its kind before deciding whether the catalog format is of an older + # version or not. def to_ral - typeklass = Puppet::Type.type(self.type) || Puppet::Type.type(:component) + if self.kind == COMPILABLE_TYPE_STRING + typeklass = Puppet::Type.type(self.type) + elsif self.catalog && self.catalog.catalog_format >= 2 + typeklass = Puppet::Type.type(:component) + else + typeklass = Puppet::Type.type(self.type) || Puppet::Type.type(:component) + end + + raise(Puppet::Error, "Resource type '#{self.type}' was not found") unless typeklass + typeklass.new(self) end diff --git a/lib/puppet/resource/catalog.rb b/lib/puppet/resource/catalog.rb index ce210914bce..1e27a18c867 100644 --- a/lib/puppet/resource/catalog.rb +++ b/lib/puppet/resource/catalog.rb @@ -313,7 +313,7 @@ def initialize(name = nil, environment = Puppet::Node::Environment::NONE, code_i super() @name = name @catalog_uuid = SecureRandom.uuid - @catalog_format = 1 + @catalog_format = 2 @metadata = {} @recursive_metadata = {} @classes = [] diff --git a/spec/fixtures/integration/application/agent/cached_deferred_catalog.json b/spec/fixtures/integration/application/agent/cached_deferred_catalog.json index a81b9cbf200..35e772e8f9f 100644 --- a/spec/fixtures/integration/application/agent/cached_deferred_catalog.json +++ b/spec/fixtures/integration/application/agent/cached_deferred_catalog.json @@ -6,7 +6,7 @@ "version": 1607629733, "code_id": null, "catalog_uuid": "afc8472a-306b-4b24-b060-e956dffb79b8", - "catalog_format": 1, + "catalog_format": 2, "environment": "production", "resources": [ { @@ -50,6 +50,7 @@ ], "file": "", "line": 1, + "kind": "compilable_type", "exported": false, "parameters": { "message": { diff --git a/spec/integration/parser/pcore_resource_spec.rb b/spec/integration/parser/pcore_resource_spec.rb index c86b6e2b7b9..edc2af3d1e3 100644 --- a/spec/integration/parser/pcore_resource_spec.rb +++ b/spec/integration/parser/pcore_resource_spec.rb @@ -122,6 +122,16 @@ def self.title_patterns expect(catalog.resource(:test3, "x/y")['message']).to eq('x/y works') end + it 'considers Pcore types to be builtin ' do + genface.types + catalog = compile_to_catalog(<<-MANIFEST) + test1 { 'a': + message => 'a works' + } + MANIFEST + expect(catalog.resource(:test1, "a").kind).to eq('compilable_type') + end + it 'the validity of attribute names are checked' do genface.types expect do diff --git a/spec/unit/configurer_spec.rb b/spec/unit/configurer_spec.rb index 613978fdc27..606e679a956 100644 --- a/spec/unit/configurer_spec.rb +++ b/spec/unit/configurer_spec.rb @@ -879,7 +879,7 @@ def expects_neither_new_or_cached_catalog expect(configurer.run).to be_nil end - it "should proceed with the cached catalog if its environment matchs the local environment" do + it "should proceed with the cached catalog if its environment matches the local environment" do expects_cached_catalog_only(catalog) expect(configurer.run).to eq(0) diff --git a/spec/unit/http/client_spec.rb b/spec/unit/http/client_spec.rb index a4fa2b06dfd..d9f05d3ae58 100644 --- a/spec/unit/http/client_spec.rb +++ b/spec/unit/http/client_spec.rb @@ -597,11 +597,68 @@ def redirect_to(status: 302, url:) expect(response).to be_success end - it "preserves basic authorization" do + it "does not preserve basic authorization when redirecting to different hosts" do + stub_request(:get, start_url).with(basic_auth: credentials).to_return(redirect_to(url: other_host)) + stub_request(:get, other_host).to_return(status: 200) + + client.get(start_url, options: {basic_auth: {user: 'user', password: 'pass'}}) + expect(a_request(:get, other_host). + with{ |req| !req.headers.key?('Authorization')}).to have_been_made + end + + it "does preserve basic authorization when redirecting to the same hosts" do + stub_request(:get, start_url).with(basic_auth: credentials).to_return(redirect_to(url: bar_url)) + stub_request(:get, bar_url).with(basic_auth: credentials).to_return(status: 200) + + client.get(start_url, options: {basic_auth: {user: 'user', password: 'pass'}}) + expect(a_request(:get, bar_url). + with{ |req| req.headers.key?('Authorization')}).to have_been_made + end + + it "does not preserve cookie header when redirecting to different hosts" do + headers = { 'Cookie' => 'TEST_COOKIE'} + + stub_request(:get, start_url).with(headers: headers).to_return(redirect_to(url: other_host)) + stub_request(:get, other_host).to_return(status: 200) + + client.get(start_url, headers: headers) + expect(a_request(:get, other_host). + with{ |req| !req.headers.key?('Cookie')}).to have_been_made + end + + it "does preserve cookie header when redirecting to the same hosts" do + headers = { 'Cookie' => 'TEST_COOKIE'} + + stub_request(:get, start_url).with(headers: headers).to_return(redirect_to(url: bar_url)) + stub_request(:get, bar_url).with(headers: headers).to_return(status: 200) + + client.get(start_url, headers: headers) + expect(a_request(:get, bar_url). + with{ |req| req.headers.key?('Cookie')}).to have_been_made + end + + it "does preserves cookie header and basic authentication when Puppet[:location_trusted] is true redirecting to different hosts" do + headers = { 'cookie' => 'TEST_COOKIE'} + Puppet[:location_trusted] = true + + stub_request(:get, start_url).with(headers: headers, basic_auth: credentials).to_return(redirect_to(url: other_host)) + stub_request(:get, other_host).with(headers: headers, basic_auth: credentials).to_return(status: 200) + + client.get(start_url, headers: headers, options: {basic_auth: {user: 'user', password: 'pass'}}) + expect(a_request(:get, other_host). + with{ |req| req.headers.key?('Authorization') && req.headers.key?('Cookie')}).to have_been_made + end + + it "treats hosts as case-insensitive" do + start_url = URI("https://www.EXAmple.com:8140/Start") + bar_url = "https://www.example.com:8140/bar" + stub_request(:get, start_url).with(basic_auth: credentials).to_return(redirect_to(url: bar_url)) stub_request(:get, bar_url).with(basic_auth: credentials).to_return(status: 200) client.get(start_url, options: {basic_auth: {user: 'user', password: 'pass'}}) + expect(a_request(:get, bar_url). + with{ |req| req.headers.key?('Authorization')}).to have_been_made end it "redirects given a relative location" do diff --git a/spec/unit/resource/catalog_spec.rb b/spec/unit/resource/catalog_spec.rb index e93b77a1d22..c65ec4bde83 100644 --- a/spec/unit/resource/catalog_spec.rb +++ b/spec/unit/resource/catalog_spec.rb @@ -104,7 +104,7 @@ it "should include the current catalog_format" do catalog = Puppet::Resource::Catalog.new("host") - expect(catalog.catalog_format).to eq(1) + expect(catalog.catalog_format).to eq(2) end describe "when compiling" do @@ -178,6 +178,7 @@ @original.add_edge(@middle, @bottom) @original.add_edge(@bottom, @bottomobject) + @original.catalog_format = 1 @catalog = @original.to_ral end @@ -190,6 +191,18 @@ end end + it "should raise if an unknown resource is being converted" do + @new_res = Puppet::Resource.new "Unknown", "type", :kind => 'compilable_type' + @resource_array = [@new_res] + + @original.add_resource(*@resource_array) + @original.add_edge(@bottomobject, @new_res) + + @original.catalog_format = 2 + + expect { @original.to_ral }.to raise_error(Puppet::Error, "Resource type 'Unknown' was not found") + end + it "should copy the tag list to the new catalog" do expect(@catalog.tags.sort).to eq(@original.tags.sort) end diff --git a/spec/unit/resource_spec.rb b/spec/unit/resource_spec.rb index 498442f865c..c527358e3f6 100644 --- a/spec/unit/resource_spec.rb +++ b/spec/unit/resource_spec.rb @@ -638,19 +638,68 @@ def inject_and_set_defaults(resource, scope) it "should use the resource type's :new method to create the resource if the resource is of a builtin type" do resource = Puppet::Resource.new("file", basepath+"/my/file") result = resource.to_ral + expect(result).to be_instance_of(Puppet::Type.type(:file)) expect(result[:path]).to eq(basepath+"/my/file") end - it "should convert to a component instance if the resource type is not of a builtin type" do + it "should convert to a component instance if the resource is not a compilable_type" do resource = Puppet::Resource.new("foobar", "somename") result = resource.to_ral expect(result).to be_instance_of(Puppet::Type.type(:component)) expect(result.title).to eq("Foobar[somename]") end - end + it "should convert to a component instance if the resource is a class" do + resource = Puppet::Resource.new("Class", "somename") + result = resource.to_ral + + expect(result).to be_instance_of(Puppet::Type.type(:component)) + expect(result.title).to eq("Class[Somename]") + end + + it "should convert to component when the resource is a defined_type" do + resource = Puppet::Resource.new("Unknown", "type", :kind => 'defined_type') + + result = resource.to_ral + expect(result).to be_instance_of(Puppet::Type.type(:component)) + end + + it "should raise if a resource type is a compilable_type and it wasn't found" do + resource = Puppet::Resource.new("Unknown", "type", :kind => 'compilable_type') + + expect { resource.to_ral }.to raise_error(Puppet::Error, "Resource type 'Unknown' was not found") + end + + it "should use the old behaviour when the catalog_format is equal to 1" do + resource = Puppet::Resource.new("Unknown", "type") + catalog = Puppet::Resource::Catalog.new("mynode") + + resource.catalog = catalog + resource.catalog.catalog_format = 1 + + result = resource.to_ral + expect(result).to be_instance_of(Puppet::Type.type(:component)) + end + + it "should use the new behaviour and fail when the catalog_format is greater than 1" do + resource = Puppet::Resource.new("Unknown", "type", :kind => 'compilable_type') + catalog = Puppet::Resource::Catalog.new("mynode") + + resource.catalog = catalog + resource.catalog.catalog_format = 2 + + expect { resource.to_ral }.to raise_error(Puppet::Error, "Resource type 'Unknown' was not found") + end + + it "should use the resource type when the resource doesn't respond to kind and the resource type can be found" do + resource = Puppet::Resource.new("file", basepath+"/my/file") + + result = resource.to_ral + expect(result).to be_instance_of(Puppet::Type.type(:file)) + end + end describe "when converting to puppet code" do before do @resource = Puppet::Resource.new("one::two", "/my/file", @@ -766,6 +815,13 @@ def inject_and_set_defaults(resource, scope) expect(Puppet::Resource.from_data_hash(JSON.parse(resource.to_json)).line).to eq(50) end + it "should include the kind if one is set" do + resource = Puppet::Resource.new("File", "/foo") + resource.kind = 'im_a_file' + + expect(Puppet::Resource.from_data_hash(JSON.parse(resource.to_json)).kind).to eq('im_a_file') + end + it "should include the 'exported' value if one is set" do resource = Puppet::Resource.new("File", "/foo") resource.exported = true From 8171a5358ff4352770598f91be31863fe455564a Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Wed, 10 Nov 2021 12:54:27 +0000 Subject: [PATCH 475/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index ed4a53f656b..70cf932f329 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -1102,6 +1102,14 @@ From where to retrieve translation files\. The standard Puppet \fBfile\fR type i . .IP "" 0 . +.SS "location_trusted" +This will allow sending the name + password and the cookie header to all hosts that puppet may redirect to\. 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\. +. +.IP "\(bu" 4 +\fIDefault\fR: \fBfalse\fR +. +.IP "" 0 +. .SS "log_level" Default logging level for messages from Puppet\. Allowed values are: . From e6e78b181459ad49b20b057781d888341b8d6556 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Wed, 10 Nov 2021 22:39:26 -0800 Subject: [PATCH 476/731] (PUP-3907) Don't require the file owner/group to exist in noop If the file owner or group can't be resolved and we're running in noop, then return false, so puppet knows the properties' current and desired states don't match. --- lib/puppet/type/file/group.rb | 9 ++++++++- lib/puppet/type/file/owner.rb | 9 ++++++++- spec/unit/type/file/group_spec.rb | 7 +++++++ spec/unit/type/file/owner_spec.rb | 7 +++++++ 4 files changed, 30 insertions(+), 2 deletions(-) diff --git a/lib/puppet/type/file/group.rb b/lib/puppet/type/file/group.rb index 3a20673b0bf..bce763e3868 100644 --- a/lib/puppet/type/file/group.rb +++ b/lib/puppet/type/file/group.rb @@ -23,7 +23,14 @@ def insync?(current) # evaluate this property, because they might be added during the catalog # apply. @should.map! do |val| - provider.name2gid(val) or raise "Could not find group #{val}" + gid = provider.name2gid(val) + if gid + gid + elsif provider.resource.noop? + return false + else + raise "Could not find group #{val}" + end end @should.include?(current) diff --git a/lib/puppet/type/file/owner.rb b/lib/puppet/type/file/owner.rb index ec75449f82c..859c8269713 100644 --- a/lib/puppet/type/file/owner.rb +++ b/lib/puppet/type/file/owner.rb @@ -18,7 +18,14 @@ def insync?(current) # evaluate this property, because they might be added during the catalog # apply. @should.map! do |val| - provider.name2uid(val) or raise "Could not find user #{val}" + uid = provider.name2uid(val) + if uid + uid + elsif provider.resource.noop? + return false + else + raise "Could not find user #{val}" + end end return true if @should.include?(current) diff --git a/spec/unit/type/file/group_spec.rb b/spec/unit/type/file/group_spec.rb index 8d0dae5399c..4458327c343 100644 --- a/spec/unit/type/file/group_spec.rb +++ b/spec/unit/type/file/group_spec.rb @@ -27,6 +27,13 @@ expect { group.insync?(5) }.to raise_error(/Could not find group foos/) end + it "should return false if a group's id can't be found by name in noop" do + Puppet[:noop] = true + allow(resource.provider).to receive(:name2gid).and_return(nil) + + expect(group.insync?('notcreatedyet')).to eq(false) + end + it "should use the id for comparisons, not the name" do expect(group.insync?('foos')).to be_falsey end diff --git a/spec/unit/type/file/owner_spec.rb b/spec/unit/type/file/owner_spec.rb index dace73370bd..9205d7f455a 100644 --- a/spec/unit/type/file/owner_spec.rb +++ b/spec/unit/type/file/owner_spec.rb @@ -25,6 +25,13 @@ expect { owner.insync?(5) }.to raise_error(/Could not find user foo/) end + it "should return false if an owner's id can't be found by name in noop" do + Puppet[:noop] = true + allow(resource.provider).to receive(:name2uid).and_return(nil) + + expect(owner.insync?('notcreatedyet')).to eq(false) + end + it "should use the id for comparisons, not the name" do expect(owner.insync?('foo')).to be_falsey end From ef8d5bf2d6d72fff79e11e7322bcf3ce4bf1694f Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Wed, 17 Nov 2021 13:22:20 +0000 Subject: [PATCH 477/731] (packaging) Updating the puppet.pot file --- locales/puppet.pot | 42 +++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/locales/puppet.pot b/locales/puppet.pot index 70ec4a49017..ef32f25d18c 100644 --- a/locales/puppet.pot +++ b/locales/puppet.pot @@ -6,11 +6,11 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Puppet automation framework 7.12.0-88-g22bab01e35\n" +"Project-Id-Version: Puppet automation framework 7.12.1-124-gf8ceb05064\n" "\n" "Report-Msgid-Bugs-To: https://tickets.puppetlabs.com\n" -"POT-Creation-Date: 2021-11-04 09:52+0000\n" -"PO-Revision-Date: 2021-11-04 09:52+0000\n" +"POT-Creation-Date: 2021-11-17 13:22+0000\n" +"PO-Revision-Date: 2021-11-17 13:22+0000\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -380,35 +380,39 @@ msgstr "" msgid "Run 'puppet lookup --help' for more details" msgstr "" -#: ../lib/puppet/application/lookup.rb:101 +#: ../lib/puppet/application/lookup.rb:102 msgid "Interactive Hiera lookup" msgstr "" -#: ../lib/puppet/application/lookup.rb:268 +#: ../lib/puppet/application/lookup.rb:269 msgid "" "The options %{deep_merge_opts} are only available with '--merge deep'\n" "%{run_help}" msgstr "" -#: ../lib/puppet/application/lookup.rb:279 +#: ../lib/puppet/application/lookup.rb:280 msgid "" "The --merge option only accepts %{strategies}, or %{last_strategy}\n" "%{run_help}" msgstr "" -#: ../lib/puppet/application/lookup.rb:304 +#: ../lib/puppet/application/lookup.rb:305 msgid "No keys were given to lookup." msgstr "" -#: ../lib/puppet/application/lookup.rb:312 +#: ../lib/puppet/application/lookup.rb:313 msgid "Unknown rendering format '%{format}'" msgstr "" -#: ../lib/puppet/application/lookup.rb:353 +#: ../lib/puppet/application/lookup.rb:354 msgid "Incorrectly formatted data in %{fact_file} given via the --facts flag (only accepts yaml and json files)" msgstr "" -#: ../lib/puppet/application/lookup.rb:364 +#: ../lib/puppet/application/lookup.rb:359 +msgid "When overriding any of the %{trusted_facts_list} facts with %{fact_file} given via the --facts flag, they must all be overridden." +msgstr "" + +#: ../lib/puppet/application/lookup.rb:372 msgid "No facts available for target node: %{node}" msgstr "" @@ -6990,40 +6994,40 @@ msgstr "" msgid "Invalid node name %{host}" msgstr "" -#: ../lib/puppet/resource.rb:52 +#: ../lib/puppet/resource.rb:57 msgid "No resource type provided in serialized data" msgstr "" -#: ../lib/puppet/resource.rb:54 +#: ../lib/puppet/resource.rb:59 msgid "No resource title provided in serialized data" msgstr "" #. TRANSLATORS 'Puppet::Resource.new' should not be translated -#: ../lib/puppet/resource.rb:294 +#: ../lib/puppet/resource.rb:299 msgid "Puppet::Resource.new does not take a hash as the first argument." msgstr "" -#: ../lib/puppet/resource.rb:295 +#: ../lib/puppet/resource.rb:300 msgid "Did you mean (%{type}, %{title}) ?" msgstr "" -#: ../lib/puppet/resource.rb:333 +#: ../lib/puppet/resource.rb:338 msgid "Could not find declared class %{title}" msgstr "" -#: ../lib/puppet/resource.rb:335 +#: ../lib/puppet/resource.rb:340 msgid "Invalid resource type %{type}" msgstr "" -#: ../lib/puppet/resource.rb:535 +#: ../lib/puppet/resource.rb:540 msgid "no parameter named '%{name}'" msgstr "" -#: ../lib/puppet/resource.rb:580 +#: ../lib/puppet/resource.rb:585 msgid "No title provided and %{type} is not a valid resource reference" msgstr "" -#: ../lib/puppet/resource.rb:654 +#: ../lib/puppet/resource.rb:659 msgid "No set of title patterns matched the title \"%{title}\"." msgstr "" From d8eceead3e6d51accb4e08842e3515acda52101e Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Wed, 17 Nov 2021 15:49:20 -0800 Subject: [PATCH 478/731] (maint) Remove duplicate constants Remove constant redefinition warnings introduced in automerge f8ceb05064 --- lib/puppet/resource.rb | 5 ----- 1 file changed, 5 deletions(-) diff --git a/lib/puppet/resource.rb b/lib/puppet/resource.rb index 7500aa4a513..466f94bd716 100644 --- a/lib/puppet/resource.rb +++ b/lib/puppet/resource.rb @@ -38,11 +38,6 @@ class Puppet::Resource COMPILABLE_TYPE_STRING = 'compilable_type'.freeze UNKNOWN_TYPE_STRING = 'unknown'.freeze - CLASS_STRING = 'class'.freeze - DEFINED_TYPE_STRING = 'defined_type'.freeze - COMPILABLE_TYPE_STRING = 'compilable_type'.freeze - UNKNOWN_TYPE_STRING = 'unknown'.freeze - PCORE_TYPE_KEY = '__ptype'.freeze VALUE_KEY = 'value'.freeze From 030f8331e77e1582ee9483e817f982ad4764e423 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Thu, 18 Nov 2021 12:27:58 -0800 Subject: [PATCH 479/731] (PUP-5800) Pass parent directory separately from basename Previously, the test passed an absolute path as the `basename` like: (byebug) basename "C:/Users/josh/AppData/Local/Temp/rspecrun20211118-9072-1d9v4lq/uniquefile20211118-9072-bushud/path/to/lock" And relied on Uniquefile to normalize two absolute paths using `File.expand_path` (byebug) tmpdir "C:/Users/josh/AppData/Local/Temp/rspecrun20211118-9072-1d9v4lq" (byebug) make_tmpname(basename, n) "C:/Users/josh/AppData/Local/Temp/rspecrun20211118-9072-1d9v4lq/uniquefile20211118-9072-bushud/path/to/lock20211118-9072-1rudrmf" (byebug) File.expand_path(make_tmpname(basename, n), tmpdir) "C:/Users/josh/AppData/Local/Temp/rspecrun20211118-9072-1d9v4lq/uniquefile20211118-9072-bushud/path/to/lock20211118-9072-1rudrmf" Newer ruby versions restrict which characters[1][2] can be passed as the `basename`, so adapt the test to pass the parent directory as the second argument, which is really what we're trying to test. [1] https://github.com/ruby/ruby/commit/10b96900b90914b0cc1dba36f9736c038db2859d [2] https://github.com/ruby/ruby/commit/59cfa0b1346067e36ae11fc6c317693ce4b9833a --- spec/unit/file_system/uniquefile_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/unit/file_system/uniquefile_spec.rb b/spec/unit/file_system/uniquefile_spec.rb index 67a8a4810a5..ba663f5a44d 100644 --- a/spec/unit/file_system/uniquefile_spec.rb +++ b/spec/unit/file_system/uniquefile_spec.rb @@ -80,7 +80,7 @@ lock = File.join(dir, 'path', 'to', 'lock') expect { - Puppet::FileSystem::Uniquefile.open_tmp(lock) { |tmp| } + Puppet::FileSystem::Uniquefile.new('foo', lock) { |tmp| } }.to raise_error(Errno::ENOENT, %r{No such file or directory - A directory component in .* does not exist or is a dangling symbolic link}) end From f916a175f626758d2b143beb46e9d8bcdd3c7177 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Thu, 18 Nov 2021 08:29:40 -0800 Subject: [PATCH 480/731] (PUP-5800) Don't file expand uniquefile's prefix Uniquefile is based on Ruby's Tempfile and it was already fixed in Ruby[1] [1] https://github.com/ruby/ruby/commit/6f8bce9eff15b527c87e1b13312db2fbf0b504f4 --- lib/puppet/file_system/uniquefile.rb | 2 +- spec/unit/file_system/uniquefile_spec.rb | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/puppet/file_system/uniquefile.rb b/lib/puppet/file_system/uniquefile.rb index b7616eb935c..5a225f952d9 100644 --- a/lib/puppet/file_system/uniquefile.rb +++ b/lib/puppet/file_system/uniquefile.rb @@ -127,7 +127,7 @@ def create_tmpname(basename, *rest) tmpdir ||= tmpdir() n = nil begin - path = File.expand_path(make_tmpname(basename, n), tmpdir) + path = File.join(tmpdir, make_tmpname(basename, n)) yield(path, n, *opts) rescue Errno::EEXIST n ||= 0 diff --git a/spec/unit/file_system/uniquefile_spec.rb b/spec/unit/file_system/uniquefile_spec.rb index ba663f5a44d..7aa4ed661fa 100644 --- a/spec/unit/file_system/uniquefile_spec.rb +++ b/spec/unit/file_system/uniquefile_spec.rb @@ -102,6 +102,12 @@ expect(filename).to eq(temp_rune_utf8) end + it "preserves tilde characters" do + Puppet::FileSystem::Uniquefile.open_tmp('~foo') do |file| + expect(File.basename(file.path)).to start_with('~foo') + end + end + context "Ruby 1.9.3 Tempfile tests" do # the remaining tests in this file are ported directly from the ruby 1.9.3 source, # since most of this file was ported from there From bd47bdd08c0f6e32649052cde80cefea1f6250d2 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Thu, 2 Dec 2021 01:38:52 +0000 Subject: [PATCH 481/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 2 +- man/man8/puppet-agent.8 | 2 +- man/man8/puppet-apply.8 | 2 +- man/man8/puppet-catalog.8 | 2 +- man/man8/puppet-config.8 | 2 +- man/man8/puppet-describe.8 | 2 +- man/man8/puppet-device.8 | 2 +- man/man8/puppet-doc.8 | 2 +- man/man8/puppet-epp.8 | 2 +- man/man8/puppet-facts.8 | 2 +- man/man8/puppet-filebucket.8 | 2 +- man/man8/puppet-generate.8 | 2 +- man/man8/puppet-help.8 | 2 +- man/man8/puppet-lookup.8 | 2 +- man/man8/puppet-module.8 | 2 +- man/man8/puppet-node.8 | 2 +- man/man8/puppet-parser.8 | 2 +- man/man8/puppet-plugin.8 | 2 +- man/man8/puppet-report.8 | 2 +- man/man8/puppet-resource.8 | 2 +- man/man8/puppet-script.8 | 2 +- man/man8/puppet-ssl.8 | 2 +- man/man8/puppet.8 | 2 +- 23 files changed, 23 insertions(+), 23 deletions(-) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index 70cf932f329..d130925123b 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPETCONF" "5" "November 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPETCONF" "5" "December 2021" "Puppet, Inc." "Puppet manual" \fBThis page is autogenerated; any changes will get overwritten\fR . .SH "Configuration settings" diff --git a/man/man8/puppet-agent.8 b/man/man8/puppet-agent.8 index 9ba9f0c33fc..c03427e7081 100644 --- a/man/man8/puppet-agent.8 +++ b/man/man8/puppet-agent.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-AGENT" "8" "November 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-AGENT" "8" "December 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-agent\fR \- The puppet agent daemon diff --git a/man/man8/puppet-apply.8 b/man/man8/puppet-apply.8 index 7ec292a6f1e..98fb098674d 100644 --- a/man/man8/puppet-apply.8 +++ b/man/man8/puppet-apply.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-APPLY" "8" "November 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-APPLY" "8" "December 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-apply\fR \- Apply Puppet manifests locally diff --git a/man/man8/puppet-catalog.8 b/man/man8/puppet-catalog.8 index 6e046a6a34e..73e5a1423ad 100644 --- a/man/man8/puppet-catalog.8 +++ b/man/man8/puppet-catalog.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-CATALOG" "8" "November 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-CATALOG" "8" "December 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-catalog\fR \- Compile, save, view, and convert catalogs\. diff --git a/man/man8/puppet-config.8 b/man/man8/puppet-config.8 index 1056b6bb139..0c43edf6e84 100644 --- a/man/man8/puppet-config.8 +++ b/man/man8/puppet-config.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-CONFIG" "8" "November 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-CONFIG" "8" "December 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-config\fR \- Interact with Puppet\'s settings\. diff --git a/man/man8/puppet-describe.8 b/man/man8/puppet-describe.8 index cd134c6b3d4..0d97eaadf9d 100644 --- a/man/man8/puppet-describe.8 +++ b/man/man8/puppet-describe.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-DESCRIBE" "8" "November 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-DESCRIBE" "8" "December 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-describe\fR \- Display help about resource types diff --git a/man/man8/puppet-device.8 b/man/man8/puppet-device.8 index aaedee45746..70dc58cd12f 100644 --- a/man/man8/puppet-device.8 +++ b/man/man8/puppet-device.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-DEVICE" "8" "November 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-DEVICE" "8" "December 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-device\fR \- Manage remote network devices diff --git a/man/man8/puppet-doc.8 b/man/man8/puppet-doc.8 index 72598a133ea..f5e3187727a 100644 --- a/man/man8/puppet-doc.8 +++ b/man/man8/puppet-doc.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-DOC" "8" "November 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-DOC" "8" "December 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-doc\fR \- Generate Puppet references diff --git a/man/man8/puppet-epp.8 b/man/man8/puppet-epp.8 index c5704cdad35..bf3a9b361f0 100644 --- a/man/man8/puppet-epp.8 +++ b/man/man8/puppet-epp.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-EPP" "8" "November 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-EPP" "8" "December 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-epp\fR \- Interact directly with the EPP template parser/renderer\. diff --git a/man/man8/puppet-facts.8 b/man/man8/puppet-facts.8 index ebc5f44b746..f323814b8a5 100644 --- a/man/man8/puppet-facts.8 +++ b/man/man8/puppet-facts.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-FACTS" "8" "November 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-FACTS" "8" "December 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-facts\fR \- Retrieve and store facts\. diff --git a/man/man8/puppet-filebucket.8 b/man/man8/puppet-filebucket.8 index 7c08dfd567a..d6da82272f1 100644 --- a/man/man8/puppet-filebucket.8 +++ b/man/man8/puppet-filebucket.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-FILEBUCKET" "8" "November 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-FILEBUCKET" "8" "December 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-filebucket\fR \- Store and retrieve files in a filebucket diff --git a/man/man8/puppet-generate.8 b/man/man8/puppet-generate.8 index 8b02d8396e7..b7dc3fc7660 100644 --- a/man/man8/puppet-generate.8 +++ b/man/man8/puppet-generate.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-GENERATE" "8" "November 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-GENERATE" "8" "December 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-generate\fR \- Generates Puppet code from Ruby definitions\. diff --git a/man/man8/puppet-help.8 b/man/man8/puppet-help.8 index 049203b1d76..21718d26d64 100644 --- a/man/man8/puppet-help.8 +++ b/man/man8/puppet-help.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-HELP" "8" "November 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-HELP" "8" "December 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-help\fR \- Display Puppet help\. diff --git a/man/man8/puppet-lookup.8 b/man/man8/puppet-lookup.8 index 8f7e734970a..da371599261 100644 --- a/man/man8/puppet-lookup.8 +++ b/man/man8/puppet-lookup.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-LOOKUP" "8" "November 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-LOOKUP" "8" "December 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-lookup\fR \- Interactive Hiera lookup diff --git a/man/man8/puppet-module.8 b/man/man8/puppet-module.8 index 5fb8a64bb61..76a3b66b1c2 100644 --- a/man/man8/puppet-module.8 +++ b/man/man8/puppet-module.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-MODULE" "8" "November 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-MODULE" "8" "December 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-module\fR \- Creates, installs and searches for modules on the Puppet Forge\. diff --git a/man/man8/puppet-node.8 b/man/man8/puppet-node.8 index 62cbdec4951..e247ba10150 100644 --- a/man/man8/puppet-node.8 +++ b/man/man8/puppet-node.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-NODE" "8" "November 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-NODE" "8" "December 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-node\fR \- View and manage node definitions\. diff --git a/man/man8/puppet-parser.8 b/man/man8/puppet-parser.8 index 689bff41fa3..a2760ac54e1 100644 --- a/man/man8/puppet-parser.8 +++ b/man/man8/puppet-parser.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-PARSER" "8" "November 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-PARSER" "8" "December 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-parser\fR \- Interact directly with the parser\. diff --git a/man/man8/puppet-plugin.8 b/man/man8/puppet-plugin.8 index bf497b8cf4a..145d5b2a4e3 100644 --- a/man/man8/puppet-plugin.8 +++ b/man/man8/puppet-plugin.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-PLUGIN" "8" "November 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-PLUGIN" "8" "December 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-plugin\fR \- Interact with the Puppet plugin system\. diff --git a/man/man8/puppet-report.8 b/man/man8/puppet-report.8 index 29772ef6a43..f10c3682b4d 100644 --- a/man/man8/puppet-report.8 +++ b/man/man8/puppet-report.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-REPORT" "8" "November 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-REPORT" "8" "December 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-report\fR \- Create, display, and submit reports\. diff --git a/man/man8/puppet-resource.8 b/man/man8/puppet-resource.8 index abc33cf29d1..0a21664f8a3 100644 --- a/man/man8/puppet-resource.8 +++ b/man/man8/puppet-resource.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-RESOURCE" "8" "November 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-RESOURCE" "8" "December 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-resource\fR \- The resource abstraction layer shell diff --git a/man/man8/puppet-script.8 b/man/man8/puppet-script.8 index 156d686b50d..03016e5e51f 100644 --- a/man/man8/puppet-script.8 +++ b/man/man8/puppet-script.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-SCRIPT" "8" "November 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-SCRIPT" "8" "December 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-script\fR \- Run a puppet manifests as a script without compiling a catalog diff --git a/man/man8/puppet-ssl.8 b/man/man8/puppet-ssl.8 index 34ab666ccfa..9184e770e1d 100644 --- a/man/man8/puppet-ssl.8 +++ b/man/man8/puppet-ssl.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-SSL" "8" "November 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-SSL" "8" "December 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-ssl\fR \- Manage SSL keys and certificates for puppet SSL clients diff --git a/man/man8/puppet.8 b/man/man8/puppet.8 index 937e18b09d8..3081a0d9e54 100644 --- a/man/man8/puppet.8 +++ b/man/man8/puppet.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET" "8" "November 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET" "8" "December 2021" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\fR From 0a626f14ac8ed7717f443aa021150373f78283a4 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Wed, 1 Dec 2021 20:34:02 -0800 Subject: [PATCH 482/731] (PUP-11373) Always lock the environment before its type collection Puppetserver in MT mode can deadlock if one thread calls into the loaders, which locks the environment, and then tries to lock the type_collection: - waiting to lock <3f27e688> (a org.jruby.gen.RubyObject0) owned by "qtp346358872-131" t@131 /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/resource/type_collection.rb:188 /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/resource/type_collection.rb:152 /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/resource/type_collection.rb:152 /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/loader/runtime3_type_loader.rb:79 ... /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/concurrent/lock.rb:10 /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/loader/loader.rb:153 While another thread locks the type_collection and tries to lock the environment: - waiting to lock (a org.jruby.gen.RubyObject0) owned by "qtp346358872-67" t@76 /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/node/environment.rb:248 /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/parser/type_loader.rb:131 ... /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/resource/type_collection.rb:203 /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/concurrent/lock.rb:10 /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/resource/type_collection.rb:188 This commit orders locking so we always acquire the environment lock before its type collection lock. --- lib/puppet/resource/type_collection.rb | 38 ++++++++++++++------------ 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/lib/puppet/resource/type_collection.rb b/lib/puppet/resource/type_collection.rb index 46d0dd1bf3d..49014653520 100644 --- a/lib/puppet/resource/type_collection.rb +++ b/lib/puppet/resource/type_collection.rb @@ -24,6 +24,7 @@ def initialize(env) @definitions = {} @nodes = {} @notfound = {} + # always lock the environment before acquiring this lock @lock = Puppet::Concurrent::Lock.new # So we can keep a list and match the first-defined regex @@ -185,26 +186,29 @@ def version # Resolve namespaces and find the given object. Autoload it if # necessary. def find_or_load(name, type) - @lock.synchronize do - # Name is always absolute, but may start with :: which must be removed - fqname = (name[0,2] == COLON_COLON ? name[2..-1] : name) - - result = send(type, fqname) - unless result - if @notfound[ fqname ] && Puppet[ :ignoremissingtypes ] - # do not try to autoload if we already tried and it wasn't conclusive - # as this is a time consuming operation. Warn the user. - # Check first if debugging is on since the call to debug_once is expensive - if Puppet[:debug] - debug_once _("Not attempting to load %{type} %{fqname} as this object was missing during a prior compilation") % { type: type, fqname: fqname } + # always lock the environment before locking the type collection + @environment.lock.synchronize do + @lock.synchronize do + # Name is always absolute, but may start with :: which must be removed + fqname = (name[0,2] == COLON_COLON ? name[2..-1] : name) + + result = send(type, fqname) + unless result + if @notfound[ fqname ] && Puppet[ :ignoremissingtypes ] + # do not try to autoload if we already tried and it wasn't conclusive + # as this is a time consuming operation. Warn the user. + # Check first if debugging is on since the call to debug_once is expensive + if Puppet[:debug] + debug_once _("Not attempting to load %{type} %{fqname} as this object was missing during a prior compilation") % { type: type, fqname: fqname } + end + else + fqname = munge_name(fqname) + result = loader.try_load_fqname(type, fqname) + @notfound[ fqname ] = result.nil? end - else - fqname = munge_name(fqname) - result = loader.try_load_fqname(type, fqname) - @notfound[ fqname ] = result.nil? end + result end - result end end From 45797777c6a163be00014c30bdffd6ab18ea09af Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Tue, 7 Dec 2021 18:16:30 +0000 Subject: [PATCH 483/731] (packaging) Bump to version '7.14.0' [no-promote] --- .gemspec | 2 +- lib/puppet/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gemspec b/.gemspec index b3a4730b460..8b6c1095a0e 100644 --- a/.gemspec +++ b/.gemspec @@ -13,7 +13,7 @@ Gem::Specification.new do |s| s.name = "puppet" - version = "7.13.0" + version = "7.14.0" mdata = version.match(/(\d+\.\d+\.\d+)/) s.version = mdata ? mdata[1] : version diff --git a/lib/puppet/version.rb b/lib/puppet/version.rb index 2602a95bbaa..b097461c9d3 100644 --- a/lib/puppet/version.rb +++ b/lib/puppet/version.rb @@ -6,7 +6,7 @@ # Raketasks and such to set the version based on the output of `git describe` module Puppet - PUPPETVERSION = '7.13.0' + PUPPETVERSION = '7.14.0' ## # version is a public API method intended to always provide a fast and From 4b53e1cfe7fe3697dc17d2e9ebc5cb73693cf294 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Tue, 7 Dec 2021 18:23:13 +0000 Subject: [PATCH 484/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 2 +- man/man8/puppet.8 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index d130925123b..e3b16b12e87 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -929,7 +929,7 @@ The time to wait for data to be read from an HTTP connection\. If nothing is rea The HTTP User\-Agent string to send when making network requests\. . .IP "\(bu" 4 -\fIDefault\fR: \fBPuppet/7\.13\.0 Ruby/2\.5\.1\-p57 (x86_64\-linux)\fR +\fIDefault\fR: \fBPuppet/7\.14\.0 Ruby/2\.5\.1\-p57 (x86_64\-linux)\fR . .IP "" 0 . diff --git a/man/man8/puppet.8 b/man/man8/puppet.8 index 3081a0d9e54..0f9468e4b82 100644 --- a/man/man8/puppet.8 +++ b/man/man8/puppet.8 @@ -25,4 +25,4 @@ Specialized: 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 . .P -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\.13\.0 +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 From 8b09b16bc27f754ae2a50136965ec4905cd17d99 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Wed, 8 Dec 2021 16:39:24 -0800 Subject: [PATCH 485/731] (packaging) Bump to version '7.13.1' [no-promote] --- .gemspec | 2 +- lib/puppet/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gemspec b/.gemspec index b3a4730b460..62ab42988b8 100644 --- a/.gemspec +++ b/.gemspec @@ -13,7 +13,7 @@ Gem::Specification.new do |s| s.name = "puppet" - version = "7.13.0" + version = "7.13.1" mdata = version.match(/(\d+\.\d+\.\d+)/) s.version = mdata ? mdata[1] : version diff --git a/lib/puppet/version.rb b/lib/puppet/version.rb index 2602a95bbaa..92bbd90ee85 100644 --- a/lib/puppet/version.rb +++ b/lib/puppet/version.rb @@ -6,7 +6,7 @@ # Raketasks and such to set the version based on the output of `git describe` module Puppet - PUPPETVERSION = '7.13.0' + PUPPETVERSION = '7.13.1' ## # version is a public API method intended to always provide a fast and From 17bdc37ad32dae3527e8f367de0b12beba426734 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Wed, 8 Dec 2021 17:10:09 -0800 Subject: [PATCH 486/731] Revert "(PUP-11320) Move `ssh_authorized_key` resources creation at the end" This reverts commit 0343d57302956e9338eaf83ddfd90dce30794993. --- ...ld_correctly_ensure_depending_resources.rb | 43 ------------------- lib/puppet/type/user.rb | 4 +- .../additional_resource_generator_spec.rb | 15 +++++++ 3 files changed, 18 insertions(+), 44 deletions(-) delete mode 100644 acceptance/tests/resource/user/should_correctly_ensure_depending_resources.rb diff --git a/acceptance/tests/resource/user/should_correctly_ensure_depending_resources.rb b/acceptance/tests/resource/user/should_correctly_ensure_depending_resources.rb deleted file mode 100644 index d933df05dcc..00000000000 --- a/acceptance/tests/resource/user/should_correctly_ensure_depending_resources.rb +++ /dev/null @@ -1,43 +0,0 @@ -test_name 'should correctly ensure resource and dependant user' do - tag 'audit:high', - 'audit:acceptance' - - confine :to, :platform => /el-8-x86_64/ - - agents.each do |agent| - teardown do - apply_manifest_on(agent, <<-MANIFEST) do |result| - package { 'abrt': - ensure => 'purged', - } - -> user { 'abrt': - ensure => 'absent', - } - -> group { 'abrt': - ensure => 'absent' - } - MANIFEST - end - end - - step "ensure desired state on package and desired information on dependant user and group" do - apply_manifest_on(agent, <<-MANIFEST, { :catch_failures => true, :debug => true }) do |result| - package { 'abrt': - ensure => 'present', - } - -> group { 'abrt': - ensure => 'present', - gid => '59998', - forcelocal => true, - } - -> user { 'abrt': - ensure => 'present', - uid => '59998', - gid => '59998', - forcelocal => true, - } - MANIFEST - end - end - end -end diff --git a/lib/puppet/type/user.rb b/lib/puppet/type/user.rb index d6b2e3f771d..ed7d798aeda 100644 --- a/lib/puppet/type/user.rb +++ b/lib/puppet/type/user.rb @@ -66,6 +66,7 @@ module Puppet newproperty(:ensure, :parent => Puppet::Property::Ensure) do newvalue(:present, :event => :user_created) do provider.create + @resource.generate end newvalue(:absent, :event => :user_removed) do @@ -692,8 +693,9 @@ def delimiter defaultto false end - def eval_generate + def generate if !self[:purge_ssh_keys].empty? && self[:purge_ssh_keys] != :false + return [] if self[:ensure] == :present && !provider.exists? if Puppet::Type.type(:ssh_authorized_key).nil? warning _("Ssh_authorized_key type is not available. Cannot purge SSH keys.") else diff --git a/spec/unit/transaction/additional_resource_generator_spec.rb b/spec/unit/transaction/additional_resource_generator_spec.rb index 932724c1a28..e961a37260a 100644 --- a/spec/unit/transaction/additional_resource_generator_spec.rb +++ b/spec/unit/transaction/additional_resource_generator_spec.rb @@ -479,6 +479,21 @@ class container { "Notify[goodbye]")) end + it "sets resources_failed_to_generate to true if resource#generate raises an exception" do + catalog = compile_to_ral(<<-MANIFEST) + user { 'foo': + ensure => present, + } + MANIFEST + + allow(catalog.resource("User[foo]")).to receive(:generate).and_raise(RuntimeError) + relationship_graph = relationship_graph_for(catalog) + generator = Puppet::Transaction::AdditionalResourceGenerator.new(catalog, relationship_graph, prioritizer) + generator.generate_additional_resources(catalog.resource("User[foo]")) + + expect(generator.resources_failed_to_generate).to be_truthy + end + def relationships_after_generating(manifest, resource_to_generate) catalog = compile_to_ral(manifest) generate_resources_in(catalog, nil, resource_to_generate) From a4b6339261b8e5ba08ffc65b88a0d8a8c878d45d Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Wed, 8 Dec 2021 17:11:11 -0800 Subject: [PATCH 487/731] Revert "(PUP-11067) Prioritize user type `ensure` before `purge_ssh_keys`" This reverts commit 5c8472ca2b6266cb22cfb896663ac0b191609c63. --- ...ould_manage_purge_ssh_keys_for_new_user.rb | 86 ------------------- lib/puppet/type/user.rb | 58 +++++-------- spec/unit/type/user_spec.rb | 45 ---------- 3 files changed, 20 insertions(+), 169 deletions(-) delete mode 100644 acceptance/tests/resource/user/should_manage_purge_ssh_keys_for_new_user.rb diff --git a/acceptance/tests/resource/user/should_manage_purge_ssh_keys_for_new_user.rb b/acceptance/tests/resource/user/should_manage_purge_ssh_keys_for_new_user.rb deleted file mode 100644 index 63eac3d141d..00000000000 --- a/acceptance/tests/resource/user/should_manage_purge_ssh_keys_for_new_user.rb +++ /dev/null @@ -1,86 +0,0 @@ -test_name 'should manage purge_ssh_keys for new user' do - - tag 'audit:high', - 'audit:acceptance' - - name = "usr#{rand(9999).to_i}" - - agents.each do |agent| - teardown do - on(agent, puppet_resource('user', "#{name}", 'ensure=absent')) - end - - home = agent.tmpdir(name) - authorized_keys_file = agent.tmpfile("authorized_keys") - - step "create user #{name} with ssh keys purged and expect no failure" do - apply_manifest_on(agent, <<-MANIFEST, { :catch_failures => true, :debug => true }) do |result| - user {'#{name}': - ensure => present, - home => '#{home}', - purge_ssh_keys => true - } - MANIFEST - - assert_no_match(/User '#{name}' has no home directory set to purge ssh keys from./, result.stdout) - end - end - - step "remove user #{name} and purge ssh keys purged and expect no failure" do - apply_manifest_on(agent, <<-MANIFEST, { :catch_failures => true, :debug => true }) do |result| - user {'#{name}': - ensure => absent, - home => '#{home}', - purge_ssh_keys => true - } - MANIFEST - - assert_no_match(/User '#{name}' has no home directory set to purge ssh keys from./, result.stdout) - end - end - - # Platforms such as macOS does not support the `managehome` parameter - # which we're expecting to remove homedir when ensure of user is set - # to absent - step "remove homedir" do - agent.rm_rf(home) - end - - step "expect debug log with home directory missing on second run of same manifest" do - apply_manifest_on(agent, <<-MANIFEST, { :catch_failures => true, :debug => true }) do |result| - user {'#{name}': - ensure => absent, - home => '#{home}', - purge_ssh_keys => true - } - MANIFEST - - assert_match(/User '#{name}' has no home directory set to purge ssh keys from./, result.stdout) - end - end - - step "expect debug log with home directory missing when purge_ssh_keys has relative path to home" do - apply_manifest_on(agent, <<-MANIFEST, { :catch_failures => true, :debug => true }) do |result| - user {'#{name}': - ensure => absent, - purge_ssh_keys => '~/authorized_keys' - } - MANIFEST - - assert_match(/User '#{name}' has no home directory set to purge ssh keys from./, result.stdout) - end - end - - step "expect no debug log with home directory missing when purge_ssh_keys has absolute path" do - apply_manifest_on(agent, <<-MANIFEST, { :catch_failures => true, :debug => true }) do |result| - user {'#{name}': - ensure => absent, - purge_ssh_keys => '#{authorized_keys_file}' - } - MANIFEST - - assert_no_match(/User '#{name}' has no home directory set to purge ssh keys from./, result.stdout) - end - end - end -end diff --git a/lib/puppet/type/user.rb b/lib/puppet/type/user.rb index ed7d798aeda..9511e5972da 100644 --- a/lib/puppet/type/user.rb +++ b/lib/puppet/type/user.rb @@ -66,7 +66,6 @@ module Puppet newproperty(:ensure, :parent => Puppet::Property::Ensure) do newvalue(:present, :event => :user_created) do provider.create - @resource.generate end newvalue(:absent, :event => :user_removed) do @@ -695,7 +694,6 @@ def delimiter def generate if !self[:purge_ssh_keys].empty? && self[:purge_ssh_keys] != :false - return [] if self[:ensure] == :present && !provider.exists? if Puppet::Type.type(:ssh_authorized_key).nil? warning _("Ssh_authorized_key type is not available. Cannot purge SSH keys.") else @@ -744,6 +742,25 @@ def generate end raise ArgumentError, _("purge_ssh_keys must be true, false, or an array of file names, not %{value}") % { value: value.inspect } end + + munge do |value| + # Resolve string, boolean and symbol forms of true and false to a + # single representation. + test_sym = value.to_s.intern + value = test_sym if [:true, :false].include? test_sym + + return [] if value == :false + home = resource[:home] || Dir.home(resource[:name]) + + return [ "#{home}/.ssh/authorized_keys" ] if value == :true + # value is an array - munge each value + [ value ].flatten.map do |entry| + # make sure frozen value is duplicated by using a gsub, second mutating gsub! is then ok + entry = entry.gsub(/^~\//, "#{home}/") + entry.gsub!(/^%h\//, "#{home}/") + entry + end + end end newproperty(:loginclass, :required_features => :manages_loginclass) do @@ -765,7 +782,7 @@ def generate # @see generate # @api private def find_unmanaged_keys - munged_unmanaged_keys. + self[:purge_ssh_keys]. select { |f| File.readable?(f) }. map { |f| unknown_keys_in_file(f) }. flatten.each do |res| @@ -777,41 +794,6 @@ def find_unmanaged_keys end end - def munged_unmanaged_keys - value = self[:purge_ssh_keys] - - # Resolve string, boolean and symbol forms of true and false to a - # single representation. - test_sym = value.to_s.intern - value = test_sym if [:true, :false].include? test_sym - - return [] if value == :false - - home = self[:home] - begin - home ||= provider.home - rescue - Puppet.debug("User '#{self[:name]}' does not exist") - end - - if home.to_s.empty? || !Dir.exist?(home.to_s) - if value == :true || [ value ].flatten.any? { |v| v.start_with?('~/', '%h/') } - Puppet.debug("User '#{self[:name]}' has no home directory set to purge ssh keys from.") - return [] - end - end - - return [ "#{home}/.ssh/authorized_keys" ] if value == :true - - # value is an array - munge each value - [ value ].flatten.map do |entry| - # make sure frozen value is duplicated by using a gsub, second mutating gsub! is then ok - entry = entry.gsub(/^~\//, "#{home}/") - entry.gsub!(/^%h\//, "#{home}/") - entry - end - end - # Parse an ssh authorized keys file superficially, extract the comments # on the keys. These are considered names of possible ssh_authorized_keys # resources. Keys that are managed by the present catalog are ignored. diff --git a/spec/unit/type/user_spec.rb b/spec/unit/type/user_spec.rb index 54449a47fbc..c42e935f7db 100644 --- a/spec/unit/type/user_spec.rb +++ b/spec/unit/type/user_spec.rb @@ -174,51 +174,6 @@ def self.instances; []; end end end - describe "when managing the purge_ssh_keys property" do - context "with valid input" do - it "should support a :true value" do - expect { described_class.new(:name => 'foo', :purge_ssh_keys => :true) }.to_not raise_error - end - - it "should support a :false value" do - expect { described_class.new(:name => 'foo', :purge_ssh_keys => :false) }.to_not raise_error - end - - it "should support a String value" do - expect { described_class.new(:name => 'foo', :purge_ssh_keys => File.expand_path('home/foo/.ssh/authorized_keys')) }.to_not raise_error - end - - it "should support an Array value" do - expect { described_class.new(:name => 'foo', :purge_ssh_keys => [File.expand_path('home/foo/.ssh/authorized_keys'), - File.expand_path('custom/authorized_keys')]) }.to_not raise_error - end - end - - context "with faulty input" do - it "should raise error for relative path" do - expect { described_class.new(:name => 'foo', :purge_ssh_keys => 'home/foo/.ssh/authorized_keys') }.to raise_error(Puppet::ResourceError, - /Paths to keyfiles must be absolute/ ) - end - - it "should raise error for invalid type" do - expect { described_class.new(:name => 'foo', :purge_ssh_keys => :invalid) }.to raise_error(Puppet::ResourceError, - /purge_ssh_keys must be true, false, or an array of file names/ ) - end - - it "should raise error for array with relative path" do - expect { described_class.new(:name => 'foo', :purge_ssh_keys => ['home/foo/.ssh/authorized_keys', - File.expand_path('custom/authorized_keys')]) }.to raise_error(Puppet::ResourceError, - /Paths to keyfiles must be absolute/ ) - end - - it "should raise error for array with invalid type" do - expect { described_class.new(:name => 'foo', :purge_ssh_keys => [:invalid, - File.expand_path('custom/authorized_keys')]) }.to raise_error(Puppet::ResourceError, - /Each entry for purge_ssh_keys must be a string/ ) - end - end - end - describe "when managing the uid property" do it "should convert number-looking strings into actual numbers" do expect(described_class.new(:name => 'foo', :uid => '50')[:uid]).to eq(50) From e88f896ee85ebf930d5de8b1af362010dd1681fe Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Wed, 8 Dec 2021 17:14:06 -0800 Subject: [PATCH 488/731] (PUP-11320) Ignore authorized key purging if home doesn't exist yet It wasn't possible to create a user and specifiy "purge_ssh_keys => true" or an explicit path because the user type relies on "generate" to create "ssh_authorized_keys" resources with "ensure" set to "absent". Ideally we would use "eval_generate" to ensure the user is created and its home directory exists before resolving the path to authorized keys. However, that's blocked on PUP-2718. This commit instead ignores the purge logic if the user's home dir doesn't exist and "purge_ssh_keys" depends on the home dir to resolve the authorized_key path. That happens in the case of purge_ssh_keys=true or set to a string or array, where the entry starts with ~/ or %h/. --- lib/puppet/type/user.rb | 44 ++++++++++++++++++++++++++++++----------- 1 file changed, 32 insertions(+), 12 deletions(-) diff --git a/lib/puppet/type/user.rb b/lib/puppet/type/user.rb index 9511e5972da..0c5ff1dbac5 100644 --- a/lib/puppet/type/user.rb +++ b/lib/puppet/type/user.rb @@ -746,20 +746,40 @@ def generate munge do |value| # Resolve string, boolean and symbol forms of true and false to a # single representation. - test_sym = value.to_s.intern - value = test_sym if [:true, :false].include? test_sym + case value + when :false, false, "false" + [] + when :true, true, "true" + home = homedir + home ? [ "#{home}/.ssh/authorized_keys" ] : [] + else + # value can be a string or array - munge each value + [ value ].flatten.map do |entry| + authorized_keys_path(entry) + end.compact + end + end - return [] if value == :false - home = resource[:home] || Dir.home(resource[:name]) + private - return [ "#{home}/.ssh/authorized_keys" ] if value == :true - # value is an array - munge each value - [ value ].flatten.map do |entry| - # make sure frozen value is duplicated by using a gsub, second mutating gsub! is then ok - entry = entry.gsub(/^~\//, "#{home}/") - entry.gsub!(/^%h\//, "#{home}/") - entry - end + def homedir + resource[:home] || Dir.home(resource[:name]) + rescue ArgumentError + Puppet.debug("User '#{resource[:name]}' does not exist") + nil + end + + def authorized_keys_path(entry) + return entry unless entry.match?(%r{^(?:~|%h)/}) + + # if user doesn't exist (yet), ignore nonexistent homedir + home = homedir + return nil unless home + + # compiler freezes "value" so duplicate using a gsub, second mutating gsub! is then ok + entry = entry.gsub(%r{^~/}, "#{home}/") + entry.gsub!(%r{^%h/}, "#{home}/") + entry end end From f641b29a600c30670003787330ecc3d2a2961f63 Mon Sep 17 00:00:00 2001 From: Luchian Nemes Date: Thu, 9 Dec 2021 16:17:04 +0200 Subject: [PATCH 489/731] (PUP-11320) Add user resource with `purge_ssh_keys` parameter tests --- .../user/should_manage_purge_ssh_keys.rb | 127 ++++++++++++++++++ spec/unit/type/user_spec.rb | 67 +++++++++ 2 files changed, 194 insertions(+) create mode 100644 acceptance/tests/resource/user/should_manage_purge_ssh_keys.rb diff --git a/acceptance/tests/resource/user/should_manage_purge_ssh_keys.rb b/acceptance/tests/resource/user/should_manage_purge_ssh_keys.rb new file mode 100644 index 00000000000..b9973a21620 --- /dev/null +++ b/acceptance/tests/resource/user/should_manage_purge_ssh_keys.rb @@ -0,0 +1,127 @@ +test_name 'should manage purge_ssh_keys' do + tag 'audit:high', + 'audit:acceptance' + + # MODULES-11236 + skip_test('This test does not work on Windows nor macOS') if agent['platform'] =~ /windows/ || agent['platform'] =~ /osx/ + + name = "usr#{rand(9999).to_i}" + + agents.each do |agent| + teardown do + agent.rm_rf(home) + on(agent, puppet_resource('user', "#{name}", 'ensure=absent')) + end + + home = agent.tmpdir(name) + authorized_keys_path = "#{home}/.ssh/authorized_keys" + + step "create user #{name} with ssh keys purged" do + apply_manifest_on(agent, <<-MANIFEST, { :catch_failures => true, :debug => true }) do |result| + user {'#{name}': + ensure => present, + home => '#{home}', + purge_ssh_keys => true + } + MANIFEST + end + + on(agent, puppet("resource user #{name} --to_yaml")) do |result| + resource = YAML.load(result.stdout) + assert_match('present', resource['user'][name]['ensure']) + end + end + + step "ensure home ownership" do + on(agent, "chown -R #{name} #{home}") + end + + step "add ssh keys" do + apply_manifest_on(agent, <<-MANIFEST, { :catch_failures => true, :debug => true }) do |result| + ssh_authorized_key { '#{name}@example.com': + ensure => present, + user => '#{name}', + type => 'ssh-rsa', + key => 'my-key' + } + MANIFEST + end + + on(agent, "cat #{authorized_keys_path}") do |result| + assert_match(/ssh-rsa my-key #{name}@example.com/, result.stdout) + end + end + + step "purge ssh keys" do + apply_manifest_on(agent, <<-MANIFEST, { :catch_failures => true, :debug => true }) do |result| + user {'#{name}': + purge_ssh_keys => true + } + MANIFEST + end + + on(agent, "cat #{authorized_keys_path}") do |result| + assert_no_match(/ssh-rsa my-key #{name}@example.com/, result.stdout) + end + end + + step "add ssh keys" do + apply_manifest_on(agent, <<-MANIFEST, { :catch_failures => true, :debug => true }) do |result| + ssh_authorized_key { '#{name}@example.com': + ensure => present, + user => '#{name}', + type => 'ssh-rsa', + key => 'my-key' + } + MANIFEST + end + + on(agent, "cat #{authorized_keys_path}") do |result| + assert_match(/ssh-rsa my-key #{name}@example.com/, result.stdout) + end + end + + step "purge ssh keys when purge_ssh_keys has relative path to home" do + apply_manifest_on(agent, <<-MANIFEST, { :catch_failures => true, :debug => true }) do |result| + user {'#{name}': + purge_ssh_keys => '~/.ssh/authorized_keys' + } + MANIFEST + + end + + on(agent, "cat #{authorized_keys_path}") do |result| + assert_no_match(/ssh-rsa my-key #{name}@example.com/, result.stdout) + end + end + + step "add ssh keys" do + apply_manifest_on(agent, <<-MANIFEST, { :catch_failures => true, :debug => true }) do |result| + ssh_authorized_key { '#{name}@example.com': + ensure => present, + user => '#{name}', + type => 'ssh-rsa', + key => 'my-key' + } + MANIFEST + end + + on(agent, "cat #{authorized_keys_path}") do |result| + assert_match(/ssh-rsa my-key #{name}@example.com/, result.stdout) + end + end + + step "purge ssh keys when purge_ssh_keys has absolute path" do + apply_manifest_on(agent, <<-MANIFEST, { :catch_failures => true, :debug => true }) do |result| + user {'#{name}': + purge_ssh_keys => '#{authorized_keys_path}' + } + MANIFEST + end + + on(agent, "cat #{authorized_keys_path}") do |result| + assert_no_match(/ssh-rsa my-key #{name}@example.com/, result.stdout) + end + end + end +end diff --git a/spec/unit/type/user_spec.rb b/spec/unit/type/user_spec.rb index c42e935f7db..7a9e2e6903e 100644 --- a/spec/unit/type/user_spec.rb +++ b/spec/unit/type/user_spec.rb @@ -289,6 +289,73 @@ def self.instances; []; end end end + describe "when managing the purge_ssh_keys property" do + context "with valid input" do + ['true', :true, true].each do |input| + it "should support #{input} as value" do + expect { described_class.new(:name => 'foo', :purge_ssh_keys => input) }.to_not raise_error + end + end + + ['false', :false, false].each do |input| + it "should support #{input} as value" do + expect { described_class.new(:name => 'foo', :purge_ssh_keys => input) }.to_not raise_error + end + end + + it "should support a String value" do + expect { described_class.new(:name => 'foo', :purge_ssh_keys => File.expand_path('home/foo/.ssh/authorized_keys')) }.to_not raise_error + end + + it "should support an Array value" do + expect { described_class.new(:name => 'foo', :purge_ssh_keys => [File.expand_path('home/foo/.ssh/authorized_keys'), + File.expand_path('custom/authorized_keys')]) }.to_not raise_error + end + end + + context "with faulty input" do + it "should raise error for relative path" do + expect { described_class.new(:name => 'foo', :purge_ssh_keys => 'home/foo/.ssh/authorized_keys') }.to raise_error(Puppet::ResourceError, + /Paths to keyfiles must be absolute/ ) + end + + it "should raise error for invalid type" do + expect { described_class.new(:name => 'foo', :purge_ssh_keys => :invalid) }.to raise_error(Puppet::ResourceError, + /purge_ssh_keys must be true, false, or an array of file names/ ) + end + + it "should raise error for array with relative path" do + expect { described_class.new(:name => 'foo', :purge_ssh_keys => ['home/foo/.ssh/authorized_keys', + File.expand_path('custom/authorized_keys')]) }.to raise_error(Puppet::ResourceError, + /Paths to keyfiles must be absolute/ ) + end + + it "should raise error for array with invalid type" do + expect { described_class.new(:name => 'foo', :purge_ssh_keys => [:invalid, + File.expand_path('custom/authorized_keys')]) }.to raise_error(Puppet::ResourceError, + /Each entry for purge_ssh_keys must be a string/ ) + end + end + + context "homedir retrieval" do + it "should accept the home provided" do + expect(Puppet).not_to receive(:debug).with("User 'foo' does not exist") + described_class.new(:name => 'foo', :purge_ssh_keys => true, :home => '/my_home') + end + + it "should accept the home provided" do + expect(Dir).to receive(:home).with('foo').and_return('/my_home') + expect(Puppet).not_to receive(:debug).with("User 'foo' does not exist") + described_class.new(:name => 'foo', :purge_ssh_keys => true) + end + + it "should output debug message when home directory cannot be retrieved" do + allow(Dir).to receive(:home).with('foo').and_raise(ArgumentError) + expect(Puppet).to receive(:debug).with("User 'foo' does not exist") + described_class.new(:name => 'foo', :purge_ssh_keys => true) + end + end + end describe "when managing expiry" do it "should fail if given an invalid date" do From eacde2be0e23fa76902439d0c212db3b64d58f25 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Tue, 14 Dec 2021 12:42:02 +0100 Subject: [PATCH 490/731] (maint) Update report format version in HTTP report doc The current report format is version 12. It also changes the grammar. --- api/docs/http_report.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/docs/http_report.md b/api/docs/http_report.md index f7f6d286f73..a9e22882dcb 100644 --- a/api/docs/http_report.md +++ b/api/docs/http_report.md @@ -1,7 +1,7 @@ Report ====== This document describes the Puppet master's report endpoint and the schema for -Report Format 6 in technical term. Also see the +Report Format 12 in technical terms. Also see the [documentation](https://puppet.com/docs/puppet/latest/format_report.html). The `report` endpoint allows clients to send reports to the master via `http` From bf1537d452772f7d1722428c687bd366af6800b2 Mon Sep 17 00:00:00 2001 From: Josh Cooper <737664+joshcooper@users.noreply.github.com> Date: Thu, 16 Dec 2021 09:34:45 -0800 Subject: [PATCH 491/731] Update CODEOWNERS --- CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CODEOWNERS b/CODEOWNERS index eff8702cdb6..3326a533996 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -1,5 +1,5 @@ # defaults -* @puppetlabs/platform-core @puppetlabs/puppetserver-maintainers @puppetlabs/night-s-watch +* @puppetlabs/team-phoenix @puppetlabs/puppetserver-maintainers @puppetlabs/night-s-watch # PAL /lib/puppet/pal @puppetlabs/bolt From 89017bd3ddc921b99bdbdfbecaec1324d099fc61 Mon Sep 17 00:00:00 2001 From: Josh Cooper <737664+joshcooper@users.noreply.github.com> Date: Thu, 16 Dec 2021 09:44:15 -0800 Subject: [PATCH 492/731] (maint) Update CODEOWNERS --- CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CODEOWNERS b/CODEOWNERS index 3326a533996..b58a7a7eee0 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -1,5 +1,5 @@ # defaults -* @puppetlabs/team-phoenix @puppetlabs/puppetserver-maintainers @puppetlabs/night-s-watch +* @puppetlabs/phoenix @puppetlabs/puppetserver-maintainers @puppetlabs/night-s-watch # PAL /lib/puppet/pal @puppetlabs/bolt From 5e48ccf57b53271406235f670bc93b26595e2716 Mon Sep 17 00:00:00 2001 From: Ciprian Badescu Date: Mon, 20 Dec 2021 09:45:21 +0200 Subject: [PATCH 493/731] (PUP-11320) acceptance test fix --- .../tests/resource/user/should_manage_purge_ssh_keys.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/acceptance/tests/resource/user/should_manage_purge_ssh_keys.rb b/acceptance/tests/resource/user/should_manage_purge_ssh_keys.rb index b9973a21620..6b08330034d 100644 --- a/acceptance/tests/resource/user/should_manage_purge_ssh_keys.rb +++ b/acceptance/tests/resource/user/should_manage_purge_ssh_keys.rb @@ -8,14 +8,14 @@ name = "usr#{rand(9999).to_i}" agents.each do |agent| + home = agent.tmpdir(name) + authorized_keys_path = "#{home}/.ssh/authorized_keys" + teardown do agent.rm_rf(home) on(agent, puppet_resource('user', "#{name}", 'ensure=absent')) end - home = agent.tmpdir(name) - authorized_keys_path = "#{home}/.ssh/authorized_keys" - step "create user #{name} with ssh keys purged" do apply_manifest_on(agent, <<-MANIFEST, { :catch_failures => true, :debug => true }) do |result| user {'#{name}': From 924d671b557aaa0f5770b50921617f316152cbba Mon Sep 17 00:00:00 2001 From: Luchian Nemes Date: Wed, 5 Jan 2022 13:49:50 +0200 Subject: [PATCH 494/731] (maint) Pin Ruby versions in GHA workflows --- .github/workflows/checks.yaml | 6 +++--- .github/workflows/rspec_tests.yaml | 18 +++++++++--------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/checks.yaml b/.github/workflows/checks.yaml index a9f30898193..88347aa4ef8 100644 --- a/.github/workflows/checks.yaml +++ b/.github/workflows/checks.yaml @@ -13,9 +13,9 @@ jobs: strategy: matrix: cfg: - - {check: rubocop, os: ubuntu-18.04, ruby: 2.5} - - {check: commits, os: ubuntu-18.04, ruby: 2.5} - - {check: warnings, os: ubuntu-18.04, ruby: 2.5} + - {check: rubocop, os: ubuntu-18.04, ruby: '2.5'} + - {check: commits, os: ubuntu-18.04, ruby: '2.5'} + - {check: warnings, os: ubuntu-18.04, ruby: '2.5'} runs-on: ${{ matrix.cfg.os }} steps: diff --git a/.github/workflows/rspec_tests.yaml b/.github/workflows/rspec_tests.yaml index 3e213081477..9f02759a510 100644 --- a/.github/workflows/rspec_tests.yaml +++ b/.github/workflows/rspec_tests.yaml @@ -13,15 +13,15 @@ jobs: strategy: matrix: cfg: - - {os: ubuntu-18.04, ruby: 2.5} - - {os: ubuntu-18.04, ruby: 2.6} - - {os: ubuntu-18.04, ruby: 2.7} - - {os: ubuntu-18.04, ruby: 3.0} - - {os: ubuntu-18.04, ruby: jruby-9.2.17.0} - - {os: windows-2019, ruby: 2.5} - - {os: windows-2019, ruby: 2.6} - - {os: windows-2019, ruby: 2.7} - - {os: windows-2019, ruby: 3.0} + - {os: ubuntu-18.04, ruby: '2.5'} + - {os: ubuntu-18.04, ruby: '2.6'} + - {os: ubuntu-18.04, ruby: '2.7'} + - {os: ubuntu-18.04, ruby: '3.0'} + - {os: ubuntu-18.04, ruby: 'jruby-9.2.17.0'} + - {os: windows-2019, ruby: '2.5'} + - {os: windows-2019, ruby: '2.6'} + - {os: windows-2019, ruby: '2.7'} + - {os: windows-2019, ruby: '3.0'} runs-on: ${{ matrix.cfg.os }} steps: From 8f9992704fc353d5639108bd63761b1736d4d3d2 Mon Sep 17 00:00:00 2001 From: Luchian Nemes Date: Wed, 5 Jan 2022 13:51:29 +0200 Subject: [PATCH 495/731] (maint) Update rubygems and remove unnecessary step This commit updates rubygems to latest version to avoid the following error: ``` Your RubyGems version (2.5.2.3)) has a bug that prevents `required_ruby_version` from working for Bundler. Any scripts that use `gem install bundler` will break as soon as Bundler drops support for your Ruby version. Please upgrade RubyGems... ``` This commit also removes an unnecessary step that installed `bundler` a second time since the `ruby/setup-ruby@v1` action now also installs bundler. --- .github/workflows/checks.yaml | 4 ++-- .github/workflows/rspec_tests.yaml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/checks.yaml b/.github/workflows/checks.yaml index 88347aa4ef8..54ff19bbf57 100644 --- a/.github/workflows/checks.yaml +++ b/.github/workflows/checks.yaml @@ -29,9 +29,9 @@ jobs: with: ruby-version: ${{ matrix.cfg.ruby }} - - name: Install bundler and gems + - name: Update rubygems and install gems run: | - gem install bundler + gem update --system --silent --no-document bundle config set without packaging documentation bundle install --jobs 4 --retry 3 diff --git a/.github/workflows/rspec_tests.yaml b/.github/workflows/rspec_tests.yaml index 9f02759a510..51d5b2f95bd 100644 --- a/.github/workflows/rspec_tests.yaml +++ b/.github/workflows/rspec_tests.yaml @@ -33,9 +33,9 @@ jobs: with: ruby-version: ${{ matrix.cfg.ruby }} - - name: Install bundler and gems + - name: Update rubygems and install gems run: | - gem install bundler + gem update --system --silent --no-document bundle config set without packaging documentation bundle install --jobs 4 --retry 3 From be3776c6246c0a88d83baab566649e4254c7686c Mon Sep 17 00:00:00 2001 From: Luchian Nemes Date: Wed, 5 Jan 2022 13:58:30 +0200 Subject: [PATCH 496/731] (maint) Pin rdoc version in Gemfile --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 965741f6a43..1debb94e811 100644 --- a/Gemfile +++ b/Gemfile @@ -26,7 +26,7 @@ group(:features) do #gem 'ruby-shadow', '~> 2.5', require: false, platforms: [:ruby] gem 'minitar', '~> 0.9', require: false gem 'msgpack', '~> 1.2', require: false - gem 'rdoc', '~> 6.0', require: false, platforms: [:ruby] + gem 'rdoc', ['~> 6.0', '< 6.4.0'], require: false, platforms: [:ruby] # requires native augeas headers/libs # gem 'ruby-augeas', require: false, platforms: [:ruby] # requires native ldap headers/libs From 36076610c94c08eb58f9612720a18807abaf40bd Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Wed, 5 Jan 2022 16:26:20 +0000 Subject: [PATCH 497/731] (packaging) Updating manpage file for main --- man/man5/puppet.conf.5 | 2 +- man/man8/puppet-agent.8 | 2 +- man/man8/puppet-apply.8 | 2 +- man/man8/puppet-catalog.8 | 2 +- man/man8/puppet-config.8 | 2 +- man/man8/puppet-describe.8 | 2 +- man/man8/puppet-device.8 | 2 +- man/man8/puppet-doc.8 | 2 +- man/man8/puppet-epp.8 | 2 +- man/man8/puppet-facts.8 | 2 +- man/man8/puppet-filebucket.8 | 2 +- man/man8/puppet-generate.8 | 2 +- man/man8/puppet-help.8 | 2 +- man/man8/puppet-lookup.8 | 2 +- man/man8/puppet-module.8 | 2 +- man/man8/puppet-node.8 | 2 +- man/man8/puppet-parser.8 | 2 +- man/man8/puppet-plugin.8 | 2 +- man/man8/puppet-report.8 | 2 +- man/man8/puppet-resource.8 | 2 +- man/man8/puppet-script.8 | 2 +- man/man8/puppet-ssl.8 | 2 +- man/man8/puppet.8 | 2 +- 23 files changed, 23 insertions(+), 23 deletions(-) diff --git a/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5 index e3b16b12e87..e761fce5844 100644 --- a/man/man5/puppet.conf.5 +++ b/man/man5/puppet.conf.5 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPETCONF" "5" "December 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPETCONF" "5" "January 2022" "Puppet, Inc." "Puppet manual" \fBThis page is autogenerated; any changes will get overwritten\fR . .SH "Configuration settings" diff --git a/man/man8/puppet-agent.8 b/man/man8/puppet-agent.8 index c03427e7081..01a13778940 100644 --- a/man/man8/puppet-agent.8 +++ b/man/man8/puppet-agent.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-AGENT" "8" "December 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-AGENT" "8" "January 2022" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-agent\fR \- The puppet agent daemon diff --git a/man/man8/puppet-apply.8 b/man/man8/puppet-apply.8 index 98fb098674d..3de252f48f8 100644 --- a/man/man8/puppet-apply.8 +++ b/man/man8/puppet-apply.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-APPLY" "8" "December 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-APPLY" "8" "January 2022" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-apply\fR \- Apply Puppet manifests locally diff --git a/man/man8/puppet-catalog.8 b/man/man8/puppet-catalog.8 index 73e5a1423ad..f8972638f2a 100644 --- a/man/man8/puppet-catalog.8 +++ b/man/man8/puppet-catalog.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-CATALOG" "8" "December 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-CATALOG" "8" "January 2022" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-catalog\fR \- Compile, save, view, and convert catalogs\. diff --git a/man/man8/puppet-config.8 b/man/man8/puppet-config.8 index 0c43edf6e84..273df4d44eb 100644 --- a/man/man8/puppet-config.8 +++ b/man/man8/puppet-config.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-CONFIG" "8" "December 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-CONFIG" "8" "January 2022" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-config\fR \- Interact with Puppet\'s settings\. diff --git a/man/man8/puppet-describe.8 b/man/man8/puppet-describe.8 index 0d97eaadf9d..0973daeadd8 100644 --- a/man/man8/puppet-describe.8 +++ b/man/man8/puppet-describe.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-DESCRIBE" "8" "December 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-DESCRIBE" "8" "January 2022" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-describe\fR \- Display help about resource types diff --git a/man/man8/puppet-device.8 b/man/man8/puppet-device.8 index 70dc58cd12f..3891827fa79 100644 --- a/man/man8/puppet-device.8 +++ b/man/man8/puppet-device.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-DEVICE" "8" "December 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-DEVICE" "8" "January 2022" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-device\fR \- Manage remote network devices diff --git a/man/man8/puppet-doc.8 b/man/man8/puppet-doc.8 index f5e3187727a..37a2dabb749 100644 --- a/man/man8/puppet-doc.8 +++ b/man/man8/puppet-doc.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-DOC" "8" "December 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-DOC" "8" "January 2022" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-doc\fR \- Generate Puppet references diff --git a/man/man8/puppet-epp.8 b/man/man8/puppet-epp.8 index bf3a9b361f0..a3792a2ce34 100644 --- a/man/man8/puppet-epp.8 +++ b/man/man8/puppet-epp.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-EPP" "8" "December 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-EPP" "8" "January 2022" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-epp\fR \- Interact directly with the EPP template parser/renderer\. diff --git a/man/man8/puppet-facts.8 b/man/man8/puppet-facts.8 index f323814b8a5..91f4d72b387 100644 --- a/man/man8/puppet-facts.8 +++ b/man/man8/puppet-facts.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-FACTS" "8" "December 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-FACTS" "8" "January 2022" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-facts\fR \- Retrieve and store facts\. diff --git a/man/man8/puppet-filebucket.8 b/man/man8/puppet-filebucket.8 index d6da82272f1..3cf01afd5d4 100644 --- a/man/man8/puppet-filebucket.8 +++ b/man/man8/puppet-filebucket.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-FILEBUCKET" "8" "December 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-FILEBUCKET" "8" "January 2022" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-filebucket\fR \- Store and retrieve files in a filebucket diff --git a/man/man8/puppet-generate.8 b/man/man8/puppet-generate.8 index b7dc3fc7660..1cf3f8df63b 100644 --- a/man/man8/puppet-generate.8 +++ b/man/man8/puppet-generate.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-GENERATE" "8" "December 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-GENERATE" "8" "January 2022" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-generate\fR \- Generates Puppet code from Ruby definitions\. diff --git a/man/man8/puppet-help.8 b/man/man8/puppet-help.8 index 21718d26d64..2414cdb95a7 100644 --- a/man/man8/puppet-help.8 +++ b/man/man8/puppet-help.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-HELP" "8" "December 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-HELP" "8" "January 2022" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-help\fR \- Display Puppet help\. diff --git a/man/man8/puppet-lookup.8 b/man/man8/puppet-lookup.8 index da371599261..6fe1097bfb0 100644 --- a/man/man8/puppet-lookup.8 +++ b/man/man8/puppet-lookup.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-LOOKUP" "8" "December 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-LOOKUP" "8" "January 2022" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-lookup\fR \- Interactive Hiera lookup diff --git a/man/man8/puppet-module.8 b/man/man8/puppet-module.8 index 76a3b66b1c2..cbc7b1c1dca 100644 --- a/man/man8/puppet-module.8 +++ b/man/man8/puppet-module.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-MODULE" "8" "December 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-MODULE" "8" "January 2022" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-module\fR \- Creates, installs and searches for modules on the Puppet Forge\. diff --git a/man/man8/puppet-node.8 b/man/man8/puppet-node.8 index e247ba10150..101cd1cd2ad 100644 --- a/man/man8/puppet-node.8 +++ b/man/man8/puppet-node.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-NODE" "8" "December 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-NODE" "8" "January 2022" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-node\fR \- View and manage node definitions\. diff --git a/man/man8/puppet-parser.8 b/man/man8/puppet-parser.8 index a2760ac54e1..2c52fe3a604 100644 --- a/man/man8/puppet-parser.8 +++ b/man/man8/puppet-parser.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-PARSER" "8" "December 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-PARSER" "8" "January 2022" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-parser\fR \- Interact directly with the parser\. diff --git a/man/man8/puppet-plugin.8 b/man/man8/puppet-plugin.8 index 145d5b2a4e3..81adbb86c37 100644 --- a/man/man8/puppet-plugin.8 +++ b/man/man8/puppet-plugin.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-PLUGIN" "8" "December 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-PLUGIN" "8" "January 2022" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-plugin\fR \- Interact with the Puppet plugin system\. diff --git a/man/man8/puppet-report.8 b/man/man8/puppet-report.8 index f10c3682b4d..60f53d22d53 100644 --- a/man/man8/puppet-report.8 +++ b/man/man8/puppet-report.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-REPORT" "8" "December 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-REPORT" "8" "January 2022" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-report\fR \- Create, display, and submit reports\. diff --git a/man/man8/puppet-resource.8 b/man/man8/puppet-resource.8 index 0a21664f8a3..d09dddf2461 100644 --- a/man/man8/puppet-resource.8 +++ b/man/man8/puppet-resource.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-RESOURCE" "8" "December 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-RESOURCE" "8" "January 2022" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-resource\fR \- The resource abstraction layer shell diff --git a/man/man8/puppet-script.8 b/man/man8/puppet-script.8 index 03016e5e51f..33a10142acd 100644 --- a/man/man8/puppet-script.8 +++ b/man/man8/puppet-script.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-SCRIPT" "8" "December 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-SCRIPT" "8" "January 2022" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-script\fR \- Run a puppet manifests as a script without compiling a catalog diff --git a/man/man8/puppet-ssl.8 b/man/man8/puppet-ssl.8 index 9184e770e1d..510304078ef 100644 --- a/man/man8/puppet-ssl.8 +++ b/man/man8/puppet-ssl.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET\-SSL" "8" "December 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET\-SSL" "8" "January 2022" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\-ssl\fR \- Manage SSL keys and certificates for puppet SSL clients diff --git a/man/man8/puppet.8 b/man/man8/puppet.8 index 0f9468e4b82..89b5251f6a0 100644 --- a/man/man8/puppet.8 +++ b/man/man8/puppet.8 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "PUPPET" "8" "December 2021" "Puppet, Inc." "Puppet manual" +.TH "PUPPET" "8" "January 2022" "Puppet, Inc." "Puppet manual" . .SH "NAME" \fBpuppet\fR From 59ca76ed6666b082a4acd76cd3af1adc9f5c65f4 Mon Sep 17 00:00:00 2001 From: Jenkins CI Date: Fri, 7 Jan 2022 07:07:31 +0000 Subject: [PATCH 498/731] (packaging) Updating the puppet.pot file --- locales/puppet.pot | 9768 +------------------------------------------- 1 file changed, 5 insertions(+), 9763 deletions(-) diff --git a/locales/puppet.pot b/locales/puppet.pot index ef32f25d18c..ef00bd07fe3 100644 --- a/locales/puppet.pot +++ b/locales/puppet.pot @@ -1,16 +1,16 @@ # SOME DESCRIPTIVE TITLE. -# Copyright (C) 2021 Puppet, Inc. +# Copyright (C) 2022 Puppet, Inc. # This file is distributed under the same license as the Puppet automation framework package. -# FIRST AUTHOR , 2021. +# FIRST AUTHOR , 2022. # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Puppet automation framework 7.12.1-124-gf8ceb05064\n" +"Project-Id-Version: Puppet automation framework 7.13.1-37-g98cfe567e2\n" "\n" "Report-Msgid-Bugs-To: https://tickets.puppetlabs.com\n" -"POT-Creation-Date: 2021-11-17 13:22+0000\n" -"PO-Revision-Date: 2021-11-17 13:22+0000\n" +"POT-Creation-Date: 2022-01-07 07:07+0000\n" +"PO-Revision-Date: 2022-01-07 07:07+0000\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -18,9761 +18,3 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" - -#. TRANSLATORS 'lookup' is a puppet function and should not be translated -#: ../lib/hiera/puppet_function.rb:64 -msgid "The function '%{class_name}' is deprecated in favor of using 'lookup'." -msgstr "" - -#: ../lib/hiera/puppet_function.rb:65 -msgid "See https://puppet.com/docs/puppet/%{minor_version}/deprecated_language.html" -msgstr "" - -#: ../lib/hiera/scope.rb:46 ../lib/puppet/parser/scope.rb:535 -msgid "Variable: %{name}" -msgstr "" - -#: ../lib/hiera/scope.rb:47 ../lib/hiera/scope.rb:49 ../lib/puppet/parser/scope.rb:536 ../lib/puppet/parser/scope.rb:538 -msgid "Undefined variable '%{name}'; %{reason}" -msgstr "" - -#: ../lib/hiera_puppet.rb:14 -msgid "Could not find data item %{key} in any Hiera data file and no default supplied" -msgstr "" - -#: ../lib/hiera_puppet.rb:41 -msgid "Please supply a parameter to perform a Hiera lookup" -msgstr "" - -#: ../lib/hiera_puppet.rb:75 ../lib/puppet/indirector/hiera.rb:85 -msgid "Config file %{hiera_config} not found, using Hiera defaults" -msgstr "" - -#: ../lib/puppet.rb:134 -msgid "Support for ruby version %{version} is deprecated and will be removed in a future release. See https://puppet.com/docs/puppet/latest/system_requirements.html for a list of supported ruby versions." -msgstr "" - -#: ../lib/puppet.rb:220 -msgid "The environmentpath setting cannot be empty or nil." -msgstr "" - -#. TRANSLATORS: `message` is an already translated string of why SSL failed to initialize -#: ../lib/puppet.rb:246 -msgid "Failed to initialize SSL: %{message}" -msgstr "" - -#. TRANSLATORS: `puppet agent -t` is a command and should not be translated -#: ../lib/puppet.rb:248 -msgid "Run `puppet agent -t`" -msgstr "" - -#: ../lib/puppet/agent.rb:41 -msgid "" -"Skipping run of %{client_class}; administratively disabled (Reason: '%{disable_message}');\n" -"Use 'puppet agent --enable' to re-enable." -msgstr "" - -#: ../lib/puppet/agent.rb:68 -msgid "Run of %{client_class} already in progress; skipping (%{lockfile_path} exists)" -msgstr "" - -#: ../lib/puppet/agent.rb:71 -msgid "Exiting now because the maxwaitforlock timeout has been exceeded." -msgstr "" - -#: ../lib/puppet/agent.rb:74 -msgid "Another puppet instance is already running; --waitforlock flag used, waiting for running instance to finish." -msgstr "" - -#: ../lib/puppet/agent.rb:75 ../lib/puppet/ssl/state_machine.rb:279 ../lib/puppet/ssl/state_machine.rb:310 -msgid "Will try again in %{time} seconds." -msgstr "" - -#: ../lib/puppet/agent.rb:80 -msgid "Execution of %{client_class} did not complete within %{runtimeout} seconds and was terminated." -msgstr "" - -#: ../lib/puppet/agent.rb:85 -msgid "Could not run %{client_class}: %{detail}" -msgstr "" - -#: ../lib/puppet/agent.rb:92 -msgid "Shutdown/restart in progress (%{status}); skipping run" -msgstr "" - -#: ../lib/puppet/agent.rb:110 -msgid "puppet agent: applying configuration" -msgstr "" - -#: ../lib/puppet/agent.rb:133 -msgid "Could not create instance of %{client_class}: %{detail}" -msgstr "" - -#: ../lib/puppet/agent/disabler.rb:19 -msgid "Enabling Puppet." -msgstr "" - -#: ../lib/puppet/agent/disabler.rb:26 -msgid "Disabling Puppet." -msgstr "" - -#: ../lib/puppet/agent/locker.rb:26 -msgid "Failed to acquire lock" -msgstr "" - -#: ../lib/puppet/application.rb:231 -msgid "Unable to find application '%{application_name}'. %{error}" -msgstr "" - -#: ../lib/puppet/application.rb:252 -msgid "Unable to load application class '%{class_name}' from file 'puppet/application/%{application_name}.rb'" -msgstr "" - -#: ../lib/puppet/application.rb:305 -msgid "Invalid environment mode '%{mode_name}'" -msgstr "" - -#: ../lib/puppet/application.rb:405 -msgid "Could not get application-specific default settings" -msgstr "" - -#: ../lib/puppet/application.rb:411 -msgid "Could not initialize" -msgstr "" - -#: ../lib/puppet/application.rb:412 -msgid "Could not parse application options" -msgstr "" - -#: ../lib/puppet/application.rb:413 -msgid "Could not prepare for execution" -msgstr "" - -#: ../lib/puppet/application.rb:416 -msgid "`puppet %{name}` is deprecated and will be removed in a future release." -msgstr "" - -#: ../lib/puppet/application.rb:419 -msgid "Could not configure routes from %{route_file}" -msgstr "" - -#: ../lib/puppet/application.rb:420 -msgid "Could not log runtime debug info" -msgstr "" - -#: ../lib/puppet/application.rb:421 -msgid "Could not run" -msgstr "" - -#: ../lib/puppet/application.rb:430 -msgid "No valid command or main" -msgstr "" - -#: ../lib/puppet/application.rb:486 -msgid "Could not set logdest to %{dest}." -msgstr "" - -#: ../lib/puppet/application.rb:580 -msgid "No help available for puppet %{app_name}" -msgstr "" - -#: ../lib/puppet/application/agent.rb:24 ../lib/puppet/application/device.rb:24 -msgid "Cancelling startup" -msgstr "" - -#: ../lib/puppet/application/agent.rb:83 -msgid "The puppet agent daemon" -msgstr "" - -#: ../lib/puppet/application/agent.rb:426 -msgid "Fingerprint asked but neither the certificate, nor the certificate request have been issued" -msgstr "" - -#: ../lib/puppet/application/agent.rb:431 -msgid "Failed to generate fingerprint: %{message}" -msgstr "" - -#: ../lib/puppet/application/agent.rb:454 -msgid "Starting Puppet client version %{version}" -msgstr "" - -#: ../lib/puppet/application/agent.rb:470 -msgid "The puppet agent command does not take parameters" -msgstr "" - -#: ../lib/puppet/application/apply.rb:37 -msgid "Apply Puppet manifests locally" -msgstr "" - -#. TRANSLATORS "puppet apply" is a program command and should not be translated -#. TRANSLATORS "puppet apply" is a program command and should not be translated -#: ../lib/puppet/application/apply.rb:212 ../lib/puppet/application/apply.rb:340 -msgid "For puppet apply" -msgstr "" - -#: ../lib/puppet/application/apply.rb:220 -msgid "%{file} is not readable" -msgstr "" - -#: ../lib/puppet/application/apply.rb:306 ../lib/puppet/application/script.rb:241 -msgid "Exiting" -msgstr "" - -#: ../lib/puppet/application/apply.rb:350 -msgid "Could not deserialize catalog from %{format}: %{detail}" -msgstr "" - -#: ../lib/puppet/application/apply.rb:371 ../lib/puppet/application/script.rb:146 -msgid "Could not find facts for %{node}" -msgstr "" - -#: ../lib/puppet/application/apply.rb:383 ../lib/puppet/application/script.rb:154 -msgid "Could not find node %{node}" -msgstr "" - -#: ../lib/puppet/application/apply.rb:396 ../lib/puppet/application/script.rb:139 -msgid "Could not find file %{manifest}" -msgstr "" - -#: ../lib/puppet/application/apply.rb:397 -msgid "Only one file can be applied per run. Skipping %{files}" -msgstr "" - -#: ../lib/puppet/application/describe.rb:177 -msgid "Display help about resource types" -msgstr "" - -#: ../lib/puppet/application/device.rb:83 -msgid "Manage remote network devices" -msgstr "" - -#: ../lib/puppet/application/device.rb:232 -msgid "resource command requires target" -msgstr "" - -#: ../lib/puppet/application/device.rb:235 -msgid "facts command requires target" -msgstr "" - -#: ../lib/puppet/application/device.rb:238 -msgid "missing argument: --target is required when using --apply" -msgstr "" - -#: ../lib/puppet/application/device.rb:239 -msgid "%{file} does not exist, cannot apply" -msgstr "" - -#: ../lib/puppet/application/device.rb:257 -msgid "Target device / certificate '%{target}' not found in %{config}" -msgstr "" - -#: ../lib/puppet/application/device.rb:259 -msgid "No device found in %{config}" -msgstr "" - -#: ../lib/puppet/application/device.rb:316 -msgid "retrieving resource: %{resource} from %{target} at %{scheme}%{url_host}%{port}%{url_path}" -msgstr "" - -#: ../lib/puppet/application/device.rb:331 -msgid "retrieving facts from %{target} at %{scheme}%{url_host}%{port}%{url_path}" -msgstr "" - -#: ../lib/puppet/application/device.rb:354 -msgid "starting applying configuration to %{target} at %{scheme}%{url_host}%{port}%{url_path}" -msgstr "" - -#: ../lib/puppet/application/device.rb:390 ../lib/puppet/application/resource.rb:201 -msgid "You must specify the type to display" -msgstr "" - -#: ../lib/puppet/application/device.rb:391 ../lib/puppet/application/resource.rb:202 -msgid "Could not find type %{type}" -msgstr "" - -#: ../lib/puppet/application/doc.rb:28 -msgid "Invalid output format %{arg}" -msgstr "" - -#: ../lib/puppet/application/doc.rb:37 -msgid "Invalid output mode %{arg}" -msgstr "" - -#: ../lib/puppet/application/doc.rb:53 -msgid "Generate Puppet references" -msgstr "" - -#: ../lib/puppet/application/doc.rb:135 -msgid "scanning: %{files}" -msgstr "" - -#: ../lib/puppet/application/doc.rb:147 -msgid "Could not generate documentation: %{detail}" -msgstr "" - -#: ../lib/puppet/application/doc.rb:160 -msgid "Could not find reference %{name}" -msgstr "" - -#: ../lib/puppet/application/doc.rb:166 -msgid "Could not generate reference %{name}: %{detail}" -msgstr "" - -#: ../lib/puppet/application/face_base.rb:34 -msgid "I don't know how to render '%{format}'" -msgstr "" - -#: ../lib/puppet/application/face_base.rb:56 -msgid "Cancelling Face" -msgstr "" - -#: ../lib/puppet/application/face_base.rb:135 -msgid "'%{face}' has no %{action} action. See `puppet help %{face}`." -msgstr "" - -#: ../lib/puppet/application/face_base.rb:213 -msgid "%{face} does not respond to action %{arg}" -msgstr "" - -#: ../lib/puppet/application/face_base.rb:246 -msgid "puppet %{face} %{action} takes %{arg_count} argument, but you gave %{given_count}" -msgid_plural "puppet %{face} %{action} takes %{arg_count} arguments, but you gave %{given_count}" -msgstr[0] "" -msgstr[1] "" - -#: ../lib/puppet/application/face_base.rb:251 -msgid "'puppet %{face}' is deprecated and will be removed in a future release" -msgstr "" - -#: ../lib/puppet/application/face_base.rb:270 -msgid "Try 'puppet help %{face} %{action}' for usage" -msgstr "" - -#: ../lib/puppet/application/filebucket.rb:17 -msgid "Store and retrieve files in a filebucket" -msgstr "" - -#: ../lib/puppet/application/filebucket.rb:226 -msgid "You must specify a file to back up" -msgstr "" - -#: ../lib/puppet/application/filebucket.rb:230 -msgid "%{file}: no such file" -msgstr "" - -#: ../lib/puppet/application/filebucket.rb:234 -msgid "%{file}: cannot read file" -msgstr "" - -#: ../lib/puppet/application/filebucket.rb:256 ../lib/puppet/application/filebucket.rb:279 -msgid "Need exactly two arguments: filebucket diff " -msgstr "" - -#: ../lib/puppet/application/filebucket.rb:276 -msgid "Comparing %{checksum_a} %{checksum_b} %{file_a} %{file_b}" -msgstr "" - -#: ../lib/puppet/application/filebucket.rb:290 -msgid "Cancelling" -msgstr "" - -#: ../lib/puppet/application/lookup.rb:8 -msgid "Run 'puppet lookup --help' for more details" -msgstr "" - -#: ../lib/puppet/application/lookup.rb:102 -msgid "Interactive Hiera lookup" -msgstr "" - -#: ../lib/puppet/application/lookup.rb:269 -msgid "" -"The options %{deep_merge_opts} are only available with '--merge deep'\n" -"%{run_help}" -msgstr "" - -#: ../lib/puppet/application/lookup.rb:280 -msgid "" -"The --merge option only accepts %{strategies}, or %{last_strategy}\n" -"%{run_help}" -msgstr "" - -#: ../lib/puppet/application/lookup.rb:305 -msgid "No keys were given to lookup." -msgstr "" - -#: ../lib/puppet/application/lookup.rb:313 -msgid "Unknown rendering format '%{format}'" -msgstr "" - -#: ../lib/puppet/application/lookup.rb:354 -msgid "Incorrectly formatted data in %{fact_file} given via the --facts flag (only accepts yaml and json files)" -msgstr "" - -#: ../lib/puppet/application/lookup.rb:359 -msgid "When overriding any of the %{trusted_facts_list} facts with %{fact_file} given via the --facts flag, they must all be overridden." -msgstr "" - -#: ../lib/puppet/application/lookup.rb:372 -msgid "No facts available for target node: %{node}" -msgstr "" - -#: ../lib/puppet/application/resource.rb:34 -msgid "The resource abstraction layer shell" -msgstr "" - -#: ../lib/puppet/application/resource.rb:145 -msgid "Editing with Yaml output is not supported" -msgstr "" - -#: ../lib/puppet/application/resource.rb:209 -msgid "Invalid parameter setting %{setting}" -msgstr "" - -#: ../lib/puppet/application/resource.rb:241 -msgid "Listing all file instances is not supported. Please specify a file or directory, e.g. puppet resource file /etc" -msgstr "" - -#: ../lib/puppet/application/script.rb:20 -msgid "Run a puppet manifests as a script without compiling a catalog" -msgstr "" - -#: ../lib/puppet/application/script.rb:126 -msgid "Bolt must be installed to use the script application" -msgstr "" - -#: ../lib/puppet/application/script.rb:140 -msgid "Only one file can be used per run. Skipping %{files}" -msgstr "" - -#: ../lib/puppet/application/ssl.rb:9 -msgid "Manage SSL keys and certificates for puppet SSL clients" -msgstr "" - -#: ../lib/puppet/application/ssl.rb:106 -msgid "An action must be specified." -msgstr "" - -#: ../lib/puppet/application/ssl.rb:130 ../lib/puppet/application/ssl.rb:137 -msgid "The certificate for '%{name}' has not yet been signed" -msgstr "" - -#: ../lib/puppet/application/ssl.rb:148 -msgid "Completed SSL initialization" -msgstr "" - -#: ../lib/puppet/application/ssl.rb:152 -msgid "Unknown action '%{action}'" -msgstr "" - -#: ../lib/puppet/application/ssl.rb:166 ../lib/puppet/ssl/state_machine.rb:180 -msgid "Creating a new EC SSL key for %{name} using curve %{curve}" -msgstr "" - -#: ../lib/puppet/application/ssl.rb:169 -msgid "Creating a new SSL key for %{name}" -msgstr "" - -#: ../lib/puppet/application/ssl.rb:179 -msgid "Submitted certificate request for '%{name}' to %{url}" -msgstr "" - -#: ../lib/puppet/application/ssl.rb:182 -msgid "Could not submit certificate request for '%{name}' to %{url} due to a conflict on the server" -msgstr "" - -#: ../lib/puppet/application/ssl.rb:184 ../lib/puppet/application/ssl.rb:187 -msgid "Failed to submit certificate request: %{message}" -msgstr "" - -#: ../lib/puppet/application/ssl.rb:195 -msgid "Downloading certificate '%{name}' from %{url}" -msgstr "" - -#: ../lib/puppet/application/ssl.rb:199 -msgid "Downloaded certificate '%{name}' with fingerprint %{fingerprint}" -msgstr "" - -#: ../lib/puppet/application/ssl.rb:212 ../lib/puppet/application/ssl.rb:215 -msgid "Failed to download certificate: %{message}" -msgstr "" - -#: ../lib/puppet/application/ssl.rb:244 ../lib/puppet/application/ssl.rb:247 -msgid "Failed to connect to the CA to determine if certificate %{certname} has been cleaned" -msgstr "" - -#: ../lib/puppet/application/ssl.rb:251 -msgid "" -"The certificate %{certname} must be cleaned from the CA first. To fix this,\n" -"run the following commands on the CA:\n" -" puppetserver ca clean --certname %{certname}\n" -" puppet ssl clean\n" -msgstr "" - -#: ../lib/puppet/application/ssl.rb:274 -msgid "Removed %{label} %{path}" -msgstr "" - -#: ../lib/puppet/configurer.rb:21 -msgid "Puppet configuration client" -msgstr "" - -#: ../lib/puppet/configurer.rb:44 -msgid "Removing corrupt state file %{file}: %{detail}" -msgstr "" - -#: ../lib/puppet/configurer.rb:49 -msgid "Cannot remove %{file}: %{detail}" -msgstr "" - -#: ../lib/puppet/configurer.rb:80 -msgid "Using cached catalog from environment '%{environment}'" -msgstr "" - -#: ../lib/puppet/configurer.rb:86 -msgid "Not using cache on failed catalog" -msgstr "" - -#: ../lib/puppet/configurer.rb:95 -msgid "Not using cached catalog because its environment '%{catalog_env}' does not match '%{local_env}'" -msgstr "" - -#: ../lib/puppet/configurer.rb:100 ../lib/puppet/configurer.rb:275 -msgid "Using cached catalog from environment '%{catalog_env}'" -msgstr "" - -#: ../lib/puppet/configurer.rb:133 -msgid "The current total number of facts: %{size} exceeds the number of facts limit: %{max_size}" -msgstr "" - -#: ../lib/puppet/configurer.rb:137 -msgid "Fact %{name} with length: '%{length}' exceeds the length limit: %{limit}" -msgstr "" - -#: ../lib/puppet/configurer.rb:141 -msgid "The current number of top level facts: %{size} exceeds the top facts limit: %{max_size}" -msgstr "" - -#: ../lib/puppet/configurer.rb:145 -msgid "Fact value '%{value}' with the value length: '%{length}' exceeds the value length limit: %{max_length}" -msgstr "" - -#: ../lib/puppet/configurer.rb:149 -msgid "Payload with the current size of: '%{payload}' exceeds the payload size limit: %{max_size}" -msgstr "" - -#: ../lib/puppet/configurer.rb:187 -msgid "The size of the payload is %{payload}" -msgstr "" - -#: ../lib/puppet/configurer.rb:217 -msgid "The total number of facts registered is %{number_of_facts}" -msgstr "" - -#: ../lib/puppet/configurer.rb:268 -msgid "Could not retrieve catalog; skipping run" -msgstr "" - -#: ../lib/puppet/configurer.rb:284 -msgid "Applied catalog in %{seconds} seconds" -msgstr "" - -#: ../lib/puppet/configurer.rb:318 -msgid "Could not select a functional puppet server from server_list: '%{server_list}'" -msgstr "" - -#. TRANSLATORS 'server_list' is the name of a setting and should not be translated -#: ../lib/puppet/configurer.rb:332 -msgid "Selected puppet server from the `server_list` setting: %{server}:%{port}" -msgstr "" - -#: ../lib/puppet/configurer.rb:369 -msgid "Local environment: '%{local_env}' doesn't match the environment of the cached catalog '%{catalog_env}', switching agent to '%{catalog_env}'." -msgstr "" - -#: ../lib/puppet/configurer.rb:392 -msgid "Environment not passed via CLI and no catalog was given, attempting to find out the last server-specified environment" -msgstr "" - -#: ../lib/puppet/configurer.rb:396 -msgid "Requesting environment from the server" -msgstr "" - -#: ../lib/puppet/configurer.rb:406 -msgid "Could not find a usable environment in the lastrunfile. Either the file does not exist, does not have the required keys, or the values of 'initial_environment' and 'converged_environment' are identical." -msgstr "" - -#: ../lib/puppet/configurer.rb:410 -msgid "Using environment '%{env}'" -msgstr "" - -#: ../lib/puppet/configurer.rb:434 -msgid "Not using catalog because its environment '%{catalog_env}' does not match agent specified environment '%{local_env}' and strict_environment_mode is set" -msgstr "" - -#: ../lib/puppet/configurer.rb:445 -msgid "Catalog environment didn't stabilize after %{tries} fetches, aborting run" -msgstr "" - -#: ../lib/puppet/configurer.rb:447 -msgid "Local environment: '%{local_env}' doesn't match server specified environment '%{catalog_env}', restarting agent run with environment '%{catalog_env}'" -msgstr "" - -#: ../lib/puppet/configurer.rb:503 -msgid "Failed to apply catalog: %{detail}" -msgstr "" - -#: ../lib/puppet/configurer.rb:534 -msgid "Environment '%{environment}' not found on server, skipping initial pluginsync." -msgstr "" - -#: ../lib/puppet/configurer.rb:551 ../lib/puppet/http/resolver/server_list.rb:64 ../lib/puppet/http/resolver/server_list.rb:68 -msgid "Puppet server %{host}:%{port} is unavailable: %{code} %{reason}" -msgstr "" - -#. TRANSLATORS 'server_list' is the name of a setting and should not be translated -#: ../lib/puppet/configurer.rb:555 ../lib/puppet/http/resolver/server_list.rb:73 ../lib/puppet/http/resolver/server_list.rb:76 -msgid "Unable to connect to server from server_list setting: %{detail}" -msgstr "" - -#: ../lib/puppet/configurer.rb:580 -msgid "Successfully loaded last environment from the lastrunfile" -msgstr "" - -#: ../lib/puppet/configurer.rb:584 -msgid "Found last server-specified environment: %{environment}" -msgstr "" - -#: ../lib/puppet/configurer.rb:587 -msgid "Could not find last server-specified environment: %{detail}" -msgstr "" - -#: ../lib/puppet/configurer.rb:617 -msgid "Local environment: '%{local_env}' doesn't match server specified node environment '%{node_env}', switching agent to '%{node_env}'." -msgstr "" - -#: ../lib/puppet/configurer.rb:625 -msgid "Unable to fetch my node definition, but the agent run will continue:" -msgstr "" - -#: ../lib/puppet/configurer.rb:644 ../lib/puppet/face/report.rb:47 -msgid "Could not send report: %{detail}" -msgstr "" - -#: ../lib/puppet/configurer.rb:653 -msgid "Could not save last run local report: %{detail}" -msgstr "" - -#: ../lib/puppet/configurer.rb:672 -msgid "Uploading facts for %{node} to %{server}" -msgstr "" - -#: ../lib/puppet/configurer.rb:680 -msgid "Failed to submit facts: %{detail}" -msgstr "" - -#: ../lib/puppet/configurer.rb:695 -msgid "Could not run command from %{setting}: %{detail}" -msgstr "" - -#: ../lib/puppet/configurer.rb:724 -msgid "Could not retrieve catalog from cache: %{detail}" -msgstr "" - -#: ../lib/puppet/configurer.rb:746 -msgid "Could not retrieve catalog from remote server: %{detail}" -msgstr "" - -#: ../lib/puppet/configurer/downloader.rb:9 -msgid "Retrieving %{name}" -msgstr "" - -#: ../lib/puppet/configurer/downloader.rb:21 -msgid "Failed to retrieve %{name}: %{detail}" -msgstr "" - -#: ../lib/puppet/configurer/downloader.rb:32 -msgid "Could not retrieve %{name}: %{detail}" -msgstr "" - -#: ../lib/puppet/configurer/fact_handler.rb:24 -msgid "Could not retrieve local facts: %{detail}" -msgstr "" - -#: ../lib/puppet/context.rb:77 -msgid "Mark for '%{name}' already exists" -msgstr "" - -#: ../lib/puppet/context.rb:92 -msgid "Unknown mark '%{name}'" -msgstr "" - -#: ../lib/puppet/context.rb:111 ../lib/puppet/context.rb:169 -msgid "Unable to lookup '%{name}'" -msgstr "" - -#: ../lib/puppet/context.rb:120 -msgid "Attempted to pop, but already at root of the context stack." -msgstr "" - -#: ../lib/puppet/context/trusted_information.rb:53 -msgid "TrustedInformation expected a certificate, but none was given." -msgstr "" - -#: ../lib/puppet/context/trusted_information.rb:104 ../lib/puppet/parser/scope.rb:836 -msgid "Unsupported data type: '%{klass}'" -msgstr "" - -#: ../lib/puppet/daemon.rb:26 -msgid "Daemons must have an agent" -msgstr "" - -#: ../lib/puppet/daemon.rb:81 -msgid "Cannot reexec unless ARGV arguments are set" -msgstr "" - -#: ../lib/puppet/datatypes.rb:133 -msgid "Data Type Load Error for type '%{type_name}': %{message}" -msgstr "" - -#: ../lib/puppet/datatypes.rb:156 -msgid "a data type must have an interface" -msgstr "" - -#: ../lib/puppet/datatypes.rb:195 -msgid "a data type can only have one interface" -msgstr "" - -#: ../lib/puppet/datatypes.rb:200 ../lib/puppet/datatypes.rb:205 -msgid "a data type can only have one implementation" -msgstr "" - -#: ../lib/puppet/defaults.rb:172 -msgid "Cannot disable unrecognized warning types '%{invalid}'." -msgstr "" - -#: ../lib/puppet/defaults.rb:173 -msgid "Valid values are '%{values}'." -msgstr "" - -#. TRANSLATORS 'data_binding_terminus' is a setting and should not be translated -#: ../lib/puppet/defaults.rb:539 -msgid "Setting 'data_binding_terminus' is deprecated." -msgstr "" - -#. TRANSLATORS 'hiera' should not be translated -#: ../lib/puppet/defaults.rb:541 -msgid "Convert custom terminus to hiera 5 API." -msgstr "" - -#. TRANSLATORS 'environment_data_provider' is a setting and should not be translated -#: ../lib/puppet/defaults.rb:735 -msgid "Setting 'environment_data_provider' is deprecated." -msgstr "" - -#: ../lib/puppet/defaults.rb:826 -msgid "Certificate names must be lower case" -msgstr "" - -#: ../lib/puppet/defaults.rb:1085 ../lib/puppet/settings/enum_setting.rb:13 ../lib/puppet/settings/symbolic_enum_setting.rb:14 -msgid "Invalid value '%{value}' for parameter %{name}. Allowed values are '%{allowed_values}'" -msgstr "" - -#. TRANSLATORS 'pluginsync' is a setting and should not be translated -#: ../lib/puppet/defaults.rb:1956 -msgid "Setting 'pluginsync' is deprecated." -msgstr "" - -#: ../lib/puppet/error.rb:77 -msgid "Could not parse for environment %{environment}: %{message}" -msgstr "" - -#: ../lib/puppet/error.rb:78 ../lib/puppet/parser/compiler.rb:40 -msgid "%{message} on node %{node}" -msgstr "" - -#: ../lib/puppet/external/pson/common.rb:46 -msgid "can't find const for unregistered document type %{path}" -msgstr "" - -#: ../lib/puppet/external/pson/common.rb:311 -msgid "exceed depth limit" -msgstr "" - -#: ../lib/puppet/face/catalog.rb:7 -msgid "Compile, save, view, and convert catalogs." -msgstr "" - -#: ../lib/puppet/face/catalog.rb:87 -msgid "Compile a catalog." -msgstr "" - -#: ../lib/puppet/face/catalog/select.rb:4 -msgid "Retrieve a catalog and filter it for resources of a given type." -msgstr "" - -#: ../lib/puppet/face/catalog/select.rb:5 -msgid " " -msgstr "" - -#: ../lib/puppet/face/catalog/select.rb:6 -msgid "" -" A list of resource references (\"Type[title]\"). When used from the API,\n" -" returns an array of Puppet::Resource objects excised from a catalog.\n" -msgstr "" - -#: ../lib/puppet/face/catalog/select.rb:43 -msgid "no matching resources found" -msgstr "" - -#: ../lib/puppet/face/config.rb:7 ../lib/puppet/face/epp.rb:8 ../lib/puppet/face/facts.rb:6 ../lib/puppet/face/generate.rb:7 ../lib/puppet/face/help.rb:9 ../lib/puppet/face/module.rb:9 ../lib/puppet/face/node.rb:4 ../lib/puppet/face/parser.rb:6 ../lib/puppet/face/plugin.rb:6 ../lib/puppet/face/report.rb:5 ../lib/puppet/face/resource.rb:5 -msgid "Apache 2 license; see COPYING" -msgstr "" - -#: ../lib/puppet/face/config.rb:9 -msgid "Interact with Puppet's settings." -msgstr "" - -#: ../lib/puppet/face/config.rb:17 -msgid "SECTION_NAME" -msgstr "" - -#: ../lib/puppet/face/config.rb:19 -msgid "The section of the configuration file to interact with." -msgstr "" - -#: ../lib/puppet/face/config.rb:37 -msgid "Examine Puppet's current settings." -msgstr "" - -#: ../lib/puppet/face/config.rb:38 -msgid "all | [ ...]" -msgstr "" - -#: ../lib/puppet/face/config.rb:99 -msgid "No section specified; defaulting to '%{section_name}'." -msgstr "" - -#. TRANSLATORS '--section' is a command line option and should not be translated -#: ../lib/puppet/face/config.rb:102 -msgid "Set the config section by using the `--section` flag." -msgstr "" - -#. TRANSLATORS `puppet config --section user print foo` is a command line example and should not be translated -#: ../lib/puppet/face/config.rb:104 -msgid "For example, `puppet config --section user print foo`." -msgstr "" - -#: ../lib/puppet/face/config.rb:105 -msgid "For more information, see https://puppet.com/docs/puppet/latest/configuration.html" -msgstr "" - -#: ../lib/puppet/face/config.rb:112 -msgid "Resolving settings from section '%{section_name}' in environment '%{environment_name}'" -msgstr "" - -#: ../lib/puppet/face/config.rb:117 -msgid "Set Puppet's settings." -msgstr "" - -#: ../lib/puppet/face/config.rb:118 -msgid "[setting_name] [setting_value]" -msgstr "" - -#: ../lib/puppet/face/config.rb:146 -msgid "" -"The environment should be set in either the `[user]`, `[agent]`, or `[server]`\n" -"section. Variables set in the `[agent]` section are used when running\n" -"`puppet agent`. Variables set in the `[user]` section are used when running\n" -"various other puppet subcommands, like `puppet apply` and `puppet module`; these\n" -"require the defined environment directory to exist locally. Set the config\n" -"section by using the `--section` flag. For example,\n" -"`puppet config --section user set environment foo`. For more information, see\n" -"https://puppet.com/docs/puppet/latest/configuration.html#environment\n" -msgstr "" - -#: ../lib/puppet/face/config.rb:186 -msgid "Deleted setting from '%{section_name}': '%{setting_string}', and adding it to 'server' section" -msgstr "" - -#: ../lib/puppet/face/config.rb:201 -msgid "Delete a Puppet setting." -msgstr "" - -#: ../lib/puppet/face/config.rb:202 -msgid "" -msgstr "" - -#: ../lib/puppet/face/config.rb:236 ../lib/puppet/face/config.rb:240 ../lib/puppet/face/config.rb:251 -msgid "Deleted setting from '%{section_name}': '%{setting_string}'" -msgstr "" - -#: ../lib/puppet/face/config.rb:254 -msgid "No setting found in configuration file for section '%{section_name}' setting name '%{name}'" -msgstr "" - -#. TRANSLATORS the 'puppet.conf' is a specific file and should not be translated -#: ../lib/puppet/face/config.rb:262 -msgid "The puppet.conf file does not exist %{puppet_conf}" -msgstr "" - -#: ../lib/puppet/face/epp.rb:10 -msgid "Interact directly with the EPP template parser/renderer." -msgstr "" - -#: ../lib/puppet/face/epp.rb:13 -msgid "Validate the syntax of one or more EPP templates." -msgstr "" - -#: ../lib/puppet/face/epp.rb:14 -msgid "[