Skip to content

Commit d4b6849

Browse files
authored
Merge pull request #368 from puppetlabs/CAT-2254-Remove_puppet_7_support
(CAT-2254) Remove puppet 7 / Ruby 2.7 related code
2 parents fb1bcda + 7a87173 commit d4b6849

24 files changed

+112
-82
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ jobs:
1313
strategy:
1414
matrix:
1515
cfg:
16-
- {puppet_version: '7', ruby: '2.7'}
17-
- {puppet_version: '7', ruby: 'jruby-9.3.7.0'}
1816
- {puppet_version: '8', ruby: '3.2'}
1917
- {puppet_version: '8', ruby: 'jruby-9.4.2.0'}
2018
env:
@@ -51,7 +49,6 @@ jobs:
5149
strategy:
5250
matrix:
5351
cfg:
54-
- {puppet_version: '7', ruby: '2.7'}
5552
- {puppet_version: '8', ruby: '3.2', extra: 'bundle config set with integration'}
5653
env:
5754
PUPPET_GEM_VERSION: ~> ${{ matrix.cfg.puppet_version }}

.github/workflows/nightly.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ jobs:
1111
strategy:
1212
matrix:
1313
cfg:
14-
- {puppet_version: '7', ruby: '2.7'}
15-
- {puppet_version: '7', ruby: 'jruby-9.3.7.0'}
1614
- {puppet_version: '8', ruby: '3.2'}
1715
- {puppet_version: '8', ruby: 'jruby-9.4.2.0'}
1816
env:
@@ -49,7 +47,6 @@ jobs:
4947
strategy:
5048
matrix:
5149
cfg:
52-
- {puppet_version: '7', ruby: '2.7'}
5350
- {puppet_version: '8', ruby: '3.2', extra: 'bundle config set with integration'}
5451
env:
5552
PUPPET_GEM_VERSION: ~> ${{ matrix.cfg.puppet_version }}

.rubocop.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ inherit_from: .rubocop_todo.yml
33

44
require: rubocop-rspec
55
AllCops:
6-
TargetRubyVersion: '2.5'
6+
NewCops: enable
7+
TargetRubyVersion: '3.1'
78
Include:
89
- "**/*.rb"
910
Exclude:

.rubocop_todo.yml

Lines changed: 65 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,35 @@
11
# This configuration was generated by
22
# `rubocop --auto-gen-config`
3-
# on 2023-12-19 10:44:38 UTC using RuboCop version 1.48.1.
3+
# on 2025-03-10 20:03:26 UTC using RuboCop version 1.70.0.
44
# The point is for the user to remove these configuration records
55
# one by one as the offenses are removed from the code base.
66
# Note that changes in the inspected code, or installation of new
77
# versions of RuboCop, may require this file to be generated again.
88

9+
# Offense count: 19
10+
# Configuration parameters: AllowComments, AllowEmptyLambdas.
11+
Lint/EmptyBlock:
12+
Exclude:
13+
- 'lib/puppet/resource_api/value_creator.rb'
14+
- 'spec/puppet/resource_api/base_context_spec.rb'
15+
16+
# Offense count: 12
17+
# Configuration parameters: AllowComments.
18+
Lint/EmptyClass:
19+
Exclude:
20+
- 'lib/puppet/resource_api/type_definition.rb'
21+
- 'lib/puppet/util/network_device/simple/device.rb'
22+
- 'spec/puppet/provider/test_provider/test_provider.rb'
23+
- 'spec/puppet/resource_api/transport/wrapper_spec.rb'
24+
- 'spec/puppet/resource_api/transport_spec.rb'
25+
- 'spec/puppet/resource_api_spec.rb'
26+
927
# Offense count: 25
1028
# Configuration parameters: IgnoredMetadata.
1129
RSpec/DescribeClass:
1230
Enabled: false
1331

14-
# Offense count: 33
32+
# Offense count: 37
1533
# Configuration parameters: CountAsOne.
1634
RSpec/ExampleLength:
1735
Max: 16
@@ -23,7 +41,7 @@ RSpec/InstanceVariable:
2341
- 'spec/acceptance/namevar_spec.rb'
2442
- 'spec/puppet/resource_api/data_type_handling_spec.rb'
2543

26-
# # Offense count: 15
44+
# Offense count: 15
2745
RSpec/LeakyConstantDeclaration:
2846
Exclude:
2947
- 'spec/puppet/resource_api/base_context_spec.rb'
@@ -49,3 +67,47 @@ RSpec/NestedGroups:
4967
RSpec/SubjectStub:
5068
Exclude:
5169
- 'spec/puppet/resource_api/base_context_spec.rb'
70+
71+
# Offense count: 24
72+
# This cop supports unsafe autocorrection (--autocorrect-all).
73+
# Configuration parameters: EnforcedStyle.
74+
# SupportedStyles: constant, string
75+
RSpec/VerifiedDoubleReference:
76+
Exclude:
77+
- 'spec/integration/resource_api_spec.rb'
78+
- 'spec/puppet/resource_api/property_spec.rb'
79+
- 'spec/puppet/resource_api/puppet_context_spec.rb'
80+
- 'spec/puppet/resource_api/simple_provider_spec.rb'
81+
- 'spec/puppet/resource_api/transport_spec.rb'
82+
- 'spec/puppet/resource_api/type_definition_spec.rb'
83+
- 'spec/puppet/resource_api_spec.rb'
84+
85+
# Offense count: 1
86+
# This cop supports unsafe autocorrection (--autocorrect-all).
87+
# Configuration parameters: AllowedReceivers.
88+
Style/CollectionCompact:
89+
Exclude:
90+
- 'lib/puppet/resource_api.rb'
91+
92+
# Offense count: 3
93+
# This cop supports unsafe autocorrection (--autocorrect-all).
94+
# Configuration parameters: AllowSplatArgument.
95+
Style/HashConversion:
96+
Exclude:
97+
- 'lib/puppet/resource_api.rb'
98+
- 'lib/puppet/resource_api/glue.rb'
99+
- 'lib/puppet/resource_api/simple_provider.rb'
100+
101+
# Offense count: 2
102+
# This cop supports unsafe autocorrection (--autocorrect-all).
103+
# Configuration parameters: AllowedReceivers.
104+
# AllowedReceivers: Thread.current
105+
Style/HashEachMethods:
106+
Exclude:
107+
- 'lib/puppet/resource_api/type_definition.rb'
108+
109+
# Offense count: 1
110+
# This cop supports unsafe autocorrection (--autocorrect-all).
111+
Style/SlicingWithRange:
112+
Exclude:
113+
- 'lib/puppet/resource_api.rb'

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ group :tests do
1919
# since the Resource API runs inside the puppetserver, test against the JRuby versions we ship
2020
# these require special dependencies to have everything load properly
2121
# rubocop 1.48 supports JRuby 9.3+, which includes coverage for versions we support
22-
gem 'rubocop', '~> 1.48.1', require: false
22+
gem 'rubocop', '~> 1.70.0', require: false
2323
gem 'rubocop-rspec', '~> 2.20.0', require: false
2424
gem 'rubocop-performance', '~> 1.17.1', require: false
2525
end

contrib/pre-commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Code modified from: https://gist.github.com/hanloong/9849098
55
require 'English'
66

7-
changed_files = `git diff --name-only --cached --diff-filter=ACM`.split(/\n/)
7+
changed_files = `git diff --name-only --cached --diff-filter=ACM`.split("\n")
88
changed_files = changed_files.select do |file_name|
99
File.extname(file_name) == '.rb'
1010
end.join(' ')

lib/puppet/resource_api.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def initialize(attributes)
104104
attributes[:title] = @title if attributes[:title].nil? && !type_definition.namevars.empty?
105105
end
106106

107-
super(attributes)
107+
super
108108
end
109109

110110
def name
@@ -541,8 +541,8 @@ def load_provider(type_name)
541541
end
542542
rescue NameError
543543
if device_name # line too long # rubocop:disable Style/GuardClause
544-
raise Puppet::DevError, "Found neither the device-specific provider class Puppet::Provider::#{class_name}::#{device_class_name} in puppet/provider/#{type_name}/#{device_name}"\
545-
" nor the generic provider class Puppet::Provider::#{class_name}::#{class_name} in puppet/provider/#{type_name}/#{type_name}"
544+
raise Puppet::DevError, "Found neither the device-specific provider class Puppet::Provider::#{class_name}::#{device_class_name} in puppet/provider/#{type_name}/#{device_name} " \
545+
"nor the generic provider class Puppet::Provider::#{class_name}::#{class_name} in puppet/provider/#{type_name}/#{type_name}"
546546
else
547547
raise Puppet::DevError, "provider class Puppet::Provider::#{class_name}::#{class_name} not found in puppet/provider/#{type_name}/#{type_name}"
548548
end

lib/puppet/resource_api/data_type_handling.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ def self.boolean_munge(value)
142142
# @private
143143
def self.ambiguous_error_msg(error_msg_prefix, value, type)
144144
"#{error_msg_prefix} #{value.inspect} is not unabiguously convertable to " \
145-
"#{type}"
145+
"#{type}"
146146
end
147147

148148
# Validates the `value` against the specified `type`.
@@ -195,9 +195,9 @@ def self.parse_puppet_type(attr_name, type)
195195
Puppet::Pops::Types::TypeParser.singleton.parse(type)
196196
rescue Puppet::ParseErrorWithIssue => e
197197
raise Puppet::DevError, "The type of the `#{attr_name}` attribute " \
198-
"`#{type}` could not be parsed: #{e.message}"
198+
"`#{type}` could not be parsed: #{e.message}"
199199
rescue Puppet::ParseError => e
200200
raise Puppet::DevError, "The type of the `#{attr_name}` attribute " \
201-
"`#{type}` is not recognised: #{e.message}"
201+
"`#{type}` is not recognised: #{e.message}"
202202
end
203203
end

lib/puppet/resource_api/transport.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def self.validate(name, connection_info)
9494
transport_schema = transports[name]
9595
raise Puppet::DevError, format('Transport for `%<target>s` not registered with `%<environment>s`', target: name, environment: current_environment_name) if transport_schema.nil?
9696

97-
clean_bolt_attributes(transport_schema, connection_info) if connection_info.key?(:"remote-transport")
97+
clean_bolt_attributes(transport_schema, connection_info) if connection_info.key?(:'remote-transport')
9898

9999
apply_defaults(transport_schema, connection_info)
100100
message_prefix = 'The connection info provided does not match the Transport Schema'

lib/puppet/resource_api/transport/wrapper.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ def respond_to_missing?(name, _include_private)
4141
(@transport.respond_to? name) || super
4242
end
4343

44-
def method_missing(method_name, *args, &block)
44+
def method_missing(method_name, ...)
4545
if @transport.respond_to? method_name
46-
@transport.send(method_name, *args, &block)
46+
@transport.send(method_name, ...)
4747
else
4848
super
4949
end

0 commit comments

Comments
 (0)