Skip to content

Commit e846dfe

Browse files
authored
Merge branch 'main' into pdksync_remove_puppet5
2 parents 1152b99 + bc971fc commit e846dfe

File tree

402 files changed

+1360
-653
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

402 files changed

+1360
-653
lines changed

.rubocop.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ Style/TrailingCommaInArrayLiteral:
7171
Style/SymbolArray:
7272
Description: Using percent style obscures symbolic intent of array's contents.
7373
EnforcedStyle: brackets
74-
inherit_from: ".rubocop_todo.yml"
7574
RSpec/MessageSpies:
7675
EnforcedStyle: receive
7776
Style/Documentation:

.rubocop_todo.yml

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,26 @@
1+
# This configuration was generated by
2+
# `rubocop --auto-gen-config`
3+
# on 2020-12-17 20:35:36 UTC using RuboCop version 1.6.1.
4+
# The point is for the user to remove these configuration records
5+
# one by one as the offenses are removed from the code base.
6+
# Note that changes in the inspected code, or installation of new
7+
# versions of RuboCop, may require this file to be generated again.
8+
9+
# Offense count: 6
10+
# Configuration parameters: AllowComments.
11+
Lint/SuppressedException:
12+
Exclude:
13+
- 'lib/facter/facter_dot_d.rb'
14+
- 'lib/puppet/functions/merge.rb'
15+
- 'lib/puppet/parser/functions/getvar.rb'
16+
- 'lib/puppet/parser/functions/has_interface_with.rb'
17+
18+
# Offense count: 62
19+
# Configuration parameters: IgnoreSharedExamples.
120
RSpec/NamedSubject:
221
Enabled: false
3-
Lint/ScriptPermission:
4-
Enabled: false
5-
Style/HashSyntax:
22+
23+
# Offense count: 2
24+
RSpec/SubjectStub:
625
Exclude:
7-
- spec/spec_helper.rb
8-
EnforcedStyle: hash_rockets
9-
Layout/IndentHeredoc:
10-
Enabled: false
26+
- 'spec/unit/facter/facter_dot_d_spec.rb'

.sync.yml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
".gitlab-ci.yml":
33
delete: true
44
".rubocop.yml":
5-
default_configs:
6-
inherit_from: ".rubocop_todo.yml"
5+
include_todos: true
76
".travis.yml":
87
global_env:
98
- HONEYCOMB_WRITEKEY="7f3c63a70eecc61d635917de46bea4e6",HONEYCOMB_DATASET="litmus tests"
@@ -46,16 +45,9 @@ appveyor.yml:
4645
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
4746
simplecov: true
4847
Gemfile:
49-
use_litmus: true
5048
optional:
5149
":development":
5250
- gem: github_changelog_generator
53-
git: https://github.com/skywinder/github-changelog-generator
54-
ref: 20ee04ba1234e9e83eb2ffb5056e23d641c7a018
55-
condition: Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.2.2')
56-
Rakefile:
57-
requires:
58-
- puppet-lint/tasks/puppet-lint
5951
spec/spec_helper.rb:
6052
mock_with: ":rspec"
6153
coverage_report: true

Rakefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ require 'puppet-syntax/tasks/puppet-syntax'
77
require 'puppet_blacksmith/rake_tasks' if Bundler.rubygems.find_name('puppet-blacksmith').any?
88
require 'github_changelog_generator/task' if Bundler.rubygems.find_name('github_changelog_generator').any?
99
require 'puppet-strings/tasks' if Bundler.rubygems.find_name('puppet-strings').any?
10-
require 'puppet-lint/tasks/puppet-lint'
1110

1211
def changelog_user
1312
return unless Rake.application.top_level_tasks.include? "changelog"

lib/facter/package_provider.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
# Fact: package_provider
24
#
35
# Purpose: Returns the default provider Puppet will choose to manage packages
@@ -15,9 +17,9 @@
1517
# Instantiates a dummy package resource and return the provider
1618
setcode do
1719
if defined? Gem && Gem::Version.new(Facter.value(:puppetversion).split(' ')[0]) >= Gem::Version.new('3.6')
18-
Puppet::Type.type(:package).newpackage(:name => 'dummy', :allow_virtual => 'true')[:provider].to_s
20+
Puppet::Type.type(:package).newpackage(name: 'dummy', allow_virtual: 'true')[:provider].to_s
1921
else
20-
Puppet::Type.type(:package).newpackage(:name => 'dummy')[:provider].to_s
22+
Puppet::Type.type(:package).newpackage(name: 'dummy')[:provider].to_s
2123
end
2224
end
2325
end

lib/facter/pe_version.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
# Fact: is_pe, pe_version, pe_major_version, pe_minor_version, pe_patch_version
24
#
35
# Purpose: Return various facts about the PE state of the system
@@ -38,7 +40,7 @@
3840

3941
# Fact: pe_major_version
4042
Facter.add('pe_major_version') do
41-
confine :is_pe => true
43+
confine is_pe: true
4244
setcode do
4345
pe_version = Facter.value(:pe_version)
4446
if pe_version
@@ -49,7 +51,7 @@
4951

5052
# Fact: pe_minor_version
5153
Facter.add('pe_minor_version') do
52-
confine :is_pe => true
54+
confine is_pe: true
5355
setcode do
5456
pe_version = Facter.value(:pe_version)
5557
if pe_version
@@ -60,7 +62,7 @@
6062

6163
# Fact: pe_patch_version
6264
Facter.add('pe_patch_version') do
63-
confine :is_pe => true
65+
confine is_pe: true
6466
setcode do
6567
pe_version = Facter.value(:pe_version)
6668
if pe_version

lib/facter/puppet_settings.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
# These facter facts return the value of the Puppet vardir and environment path
24
# settings for the node running puppet or puppet agent. The intent is to
35
# enable Puppet modules to automatically have insight into a place where they

lib/facter/root_home.rb

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
1+
# frozen_string_literal: true
2+
13
# root_home.rb
24
module Facter::Util::RootHome
35
# @summary
46
# A facter fact to determine the root home directory.
57
# This varies on PE supported platforms and may be
68
# reconfigured by the end user.
79
class << self
8-
# determines the root home directory
9-
def returnt_root_home
10-
root_ent = Facter::Util::Resolution.exec('getent passwd root')
11-
# The home directory is the sixth element in the passwd entry
12-
# If the platform doesn't have getent, root_ent will be nil and we should
13-
# return it straight away.
14-
root_ent && root_ent.split(':')[5]
15-
end
10+
# determines the root home directory
11+
def returnt_root_home
12+
root_ent = Facter::Util::Resolution.exec('getent passwd root')
13+
# The home directory is the sixth element in the passwd entry
14+
# If the platform doesn't have getent, root_ent will be nil and we should
15+
# return it straight away.
16+
root_ent && root_ent.split(':')[5]
17+
end
1618
end
1719
end
1820

@@ -21,7 +23,7 @@ def returnt_root_home
2123
end
2224

2325
Facter.add(:root_home) do
24-
confine :kernel => :darwin
26+
confine kernel: :darwin
2527
setcode do
2628
str = Facter::Util::Resolution.exec('dscacheutil -q user -a name root')
2729
hash = {}
@@ -34,12 +36,12 @@ def returnt_root_home
3436
end
3537

3638
Facter.add(:root_home) do
37-
confine :kernel => :aix
39+
confine kernel: :aix
3840
root_home = nil
3941
setcode do
4042
str = Facter::Util::Resolution.exec('lsuser -c -a home root')
41-
str && str.split("\n").each do |line|
42-
next if line =~ %r{^#}
43+
str&.split("\n")&.each do |line|
44+
next if %r{^#}.match?(line)
4345
root_home = line.split(%r{:})[1]
4446
end
4547
root_home

lib/facter/service_provider.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
# Fact: service_provider
24
#
35
# Purpose: Returns the default provider Puppet will choose to manage services
@@ -12,6 +14,6 @@
1214

1315
Facter.add(:service_provider) do
1416
setcode do
15-
Puppet::Type.type(:service).newservice(:name => 'dummy')[:provider].to_s
17+
Puppet::Type.type(:service).newservice(name: 'dummy')[:provider].to_s
1618
end
1719
end

lib/facter/util/puppet_settings.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
# A method to evaluate a Facter code block if puppet is loaded.
24
module Facter::Util::PuppetSettings
35
# This method is intended to provide a convenient way to evaluate a

lib/puppet/functions/deprecation.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
# Function to print deprecation warnings, Logs a warning once for a given key.
24
#
35
# The uniqueness key - can appear once.
@@ -25,7 +27,7 @@ def deprecation(key, message)
2527
end
2628
# depending on configuration setting of strict
2729
case Puppet.settings[:strict]
28-
when :off # rubocop:disable Lint/EmptyWhen : Is required to prevent false errors
30+
when :off
2931
# do nothing
3032
when :error
3133
raise("deprecation. #{key}. #{message}")

lib/puppet/functions/fact.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
# @summary
24
# Digs into the facts hash using dot-notation
35
#

lib/puppet/functions/is_a.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
# @summary
24
# Boolean check to determine whether a variable is of a given data type.
35
# This is equivalent to the `=~` type checks.
@@ -35,7 +37,7 @@
3537
param 'Type', :type
3638
end
3739

38-
def is_a(value, type) # rubocop:disable Style/PredicateName : Used in to many other places to rename at this time, attempting to refactor caused Rubocop to crash.
40+
def is_a(value, type) # rubocop:disable Naming/PredicateName : Used in to many other places to rename at this time, attempting to refactor caused Rubocop to crash.
3941
# See puppet's lib/puppet/pops/evaluator/evaluator_impl.rb eval_MatchExpression
4042
Puppet::Pops::Types::TypeCalculator.instance?(type, value)
4143
end

lib/puppet/functions/is_absolute_path.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
# @summary
24
# Wrapper that calls the Puppet 3.x function of the same name.
35
Puppet::Functions.create_function(:is_absolute_path) do

lib/puppet/functions/is_array.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
# @summary
24
# Wrapper that calls the Puppet 3.x function of the same name.
35
Puppet::Functions.create_function(:is_array) do

lib/puppet/functions/is_bool.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
# @summary
24
# Wrapper that calls the Puppet 3.x function of the same name.
35
Puppet::Functions.create_function(:is_bool) do

lib/puppet/functions/is_float.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
# @summary
24
# Wrapper that calls the Puppet 3.x function of the same name.
35
Puppet::Functions.create_function(:is_float) do

lib/puppet/functions/is_ip_address.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
# @summary
24
# Wrapper that calls the Puppet 3.x function of the same name.
35
Puppet::Functions.create_function(:is_ip_address) do

lib/puppet/functions/is_ipv4_address.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
# @summary
24
# Wrapper that calls the Puppet 3.x function of the same name.
35
Puppet::Functions.create_function(:is_ipv4_address) do

lib/puppet/functions/is_ipv6_address.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
# @summary
24
# Wrapper that calls the Puppet 3.x function of the same name.
35
Puppet::Functions.create_function(:is_ipv6_address) do

lib/puppet/functions/is_numeric.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
# @summary
24
# Wrapper that calls the Puppet 3.x function of the same name.
35
Puppet::Functions.create_function(:is_numeric) do

lib/puppet/functions/is_string.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
# @summary
24
# Wrapper that calls the Puppet 3.x function of the same name.
35
Puppet::Functions.create_function(:is_string) do

lib/puppet/functions/length.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
# @summary
24
# **Deprecated:** A function to eventually replace the old size() function for stdlib
35
#

lib/puppet/functions/merge.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
# @summary
24
# Merges two or more hashes together or hashes resulting from iteration, and returns
35
# the resulting hash.
@@ -102,7 +104,7 @@ def merge_iterable3(iterable)
102104
accumulator.merge!(r) if r.is_a?(Hash)
103105
index += 1
104106
end
105-
rescue StopIteration # rubocop:disable Lint/HandleExceptions
107+
rescue StopIteration
106108
end
107109
end
108110
accumulator

lib/puppet/functions/os_version_gte.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
# @summary
24
# Checks if the OS version is at least a certain version.
35
# > *Note:*

lib/puppet/functions/seeded_rand_string.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
# @summary
24
# Generates a consistent random string of specific length based on provided seed.
35
#

lib/puppet/functions/sprintf_hash.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
# @summary
24
# Uses sprintf with named references.
35
#

lib/puppet/functions/stdlib/end_with.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
# @summary
24
# Returns true if str ends with one of the prefixes given. Each of the prefixes should be a String.
35
#

lib/puppet/functions/stdlib/extname.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
# @summary
24
# Returns the Extension (the Portion of Filename in Path starting from the
35
# last Period).

lib/puppet/functions/stdlib/ip_in_range.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
# @summary
24
# Returns true if the ipaddress is within the given CIDRs
35
#

lib/puppet/functions/stdlib/start_with.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
# @summary
24
# Returns true if str starts with one of the prefixes given. Each of the prefixes should be a String.
35
#

lib/puppet/functions/to_json.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require 'json'
24
# @summary
35
# Convert a data structure and output to JSON

lib/puppet/functions/to_json_pretty.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require 'json'
24

35
# @summary

lib/puppet/functions/to_yaml.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require 'yaml'
24
# @summary
35
# Convert a data structure and output it as YAML

lib/puppet/functions/type_of.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
# @summary
24
# Returns the type of the passed value.
35
#

lib/puppet/functions/validate_absolute_path.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
# @summary
24
# Validate the string represents an absolute path in the filesystem.
35
Puppet::Functions.create_function(:validate_absolute_path) do

lib/puppet/functions/validate_array.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
# @summary
24
# Validate the passed value represents an array.
35
Puppet::Functions.create_function(:validate_array) do

0 commit comments

Comments
 (0)