Skip to content

Commit

Permalink
Merge pull request #1149 from puppetlabs/CAT-1608-pdk-update
Browse files Browse the repository at this point in the history
Cat 1608 pdk update
  • Loading branch information
bastelfreak authored Nov 28, 2023
2 parents cb21d0b + c2b2376 commit 146fe0b
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 28 deletions.
6 changes: 3 additions & 3 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
---
inherit_from: .rubocop_todo.yml

require:
- rubocop-performance
- rubocop-rspec
AllCops:
NewCops: enable
DisplayCopNames: true
TargetRubyVersion: '2.6'
TargetRubyVersion: '2.7'
Include:
- "**/*.rb"
Exclude:
Expand All @@ -20,6 +19,7 @@ AllCops:
- "**/Puppetfile"
- "**/Vagrantfile"
- "**/Guardfile"
inherit_from: ".rubocop_todo.yml"
Layout/LineLength:
Description: People have wide screens, use them.
Max: 200
Expand Down
11 changes: 2 additions & 9 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2023-06-08 10:35:18 UTC using RuboCop version 1.48.1.
# on 2023-11-28 13:42:03 UTC using RuboCop version 1.48.1.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 6
# This cop supports safe autocorrection (--autocorrect).
Lint/RedundantCopDisableDirective:
Exclude:
- 'lib/puppet/provider/apt_key/apt_key.rb'
- 'spec/unit/puppet/provider/apt_key_spec.rb'

# Offense count: 204
# Offense count: 200
# Configuration parameters: EnforcedStyle, IgnoreSharedExamples.
# SupportedStyles: always, named_only
RSpec/NamedSubject:
Expand Down
2 changes: 2 additions & 0 deletions .sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
delete: true
appveyor.yml:
delete: true
.rubocop.yml:
include_todos: true

Gemfile:
Rakefile:
Expand Down
6 changes: 5 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ group :development do
gem "json", '= 2.5.1', require: false if Gem::Requirement.create(['>= 3.0.0', '< 3.0.5']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
gem "json", '= 2.6.1', require: false if Gem::Requirement.create(['>= 3.1.0', '< 3.1.3']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
gem "json", '= 2.6.3', require: false if Gem::Requirement.create(['>= 3.2.0', '< 4.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
gem "racc", '~> 1.4.0', require: false if Gem::Requirement.create(['>= 2.7.0', '< 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
gem "voxpupuli-puppet-lint-plugins", '~> 5.0', require: false
gem "facterdb", '~> 1.18', require: false
gem "metadata-json-lint", '~> 3.0', require: false
gem "puppetlabs_spec_helper", '~> 7.0', require: false
gem "rspec-puppet-facts", '~> 2.0', require: false
gem "codecov", '~> 0.2', require: false
gem "dependency_checker", '~> 1.0.0', require: false
Expand All @@ -39,6 +39,10 @@ group :system_tests do
gem "puppet_litmus", '~> 1.0', require: false, platforms: [:ruby, :x64_mingw]
gem "serverspec", '~> 2.41', require: false
end
group :release_prep do
gem "puppet-strings", '~> 4.0', require: false
gem "puppetlabs_spec_helper", '~> 7.0', require: false
end

puppet_version = ENV['PUPPET_GEM_VERSION']
facter_version = ENV['FACTER_GEM_VERSION']
Expand Down
8 changes: 4 additions & 4 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# frozen_string_literal: true

require 'bundler'
require 'puppet_litmus/rake_tasks' if Bundler.rubygems.find_name('puppet_litmus').any?
require 'puppet_litmus/rake_tasks' if Gem.loaded_specs.key? 'puppet_litmus'
require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet-syntax/tasks/puppet-syntax'
require 'github_changelog_generator/task' if Bundler.rubygems.find_name('github_changelog_generator').any?
require 'puppet-strings/tasks' if Bundler.rubygems.find_name('puppet-strings').any?
require 'github_changelog_generator/task' if Gem.loaded_specs.key? 'github_changelog_generator'
require 'puppet-strings/tasks' if Gem.loaded_specs.key? 'puppet-strings'

def changelog_user
return unless Rake.application.top_level_tasks.include? "changelog"
Expand Down Expand Up @@ -44,7 +44,7 @@ PuppetLint.configuration.send('disable_relative')
PuppetLint.configuration.send('disable_anchor_resource')


if Bundler.rubygems.find_name('github_changelog_generator').any?
if Gem.loaded_specs.key? 'github_changelog_generator'
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
raise "Set CHANGELOG_GITHUB_TOKEN environment variable eg 'export CHANGELOG_GITHUB_TOKEN=valid_token_here'" if Rake.application.top_level_tasks.include? "changelog" and ENV['CHANGELOG_GITHUB_TOKEN'].nil?
config.user = "#{changelog_user}"
Expand Down
4 changes: 2 additions & 2 deletions lib/puppet/provider/apt_key/apt_key.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
end
require 'tempfile'

Puppet::Type.type(:apt_key).provide(:apt_key) do # rubocop:disable Metrics/BlockLength
Puppet::Type.type(:apt_key).provide(:apt_key) do
desc 'apt-key provider for apt_key resource'

confine osfamily: :debian
defaultfor osfamily: :debian
commands apt_key: 'apt-key'
commands gpg: '/usr/bin/gpg'

def self.instances # rubocop:disable Metrics/AbcSize
def self.instances
key_array = []

cli_args = ['adv', '--no-tty', '--list-keys', '--with-colons', '--fingerprint', '--fixed-list-mode']
Expand Down
4 changes: 2 additions & 2 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@
}
],
"template-url": "https://github.com/puppetlabs/pdk-templates.git#main",
"template-ref": "heads/main-0-g9675180",
"pdk-version": "2.7.1"
"template-ref": "heads/main-0-g01c6a19",
"pdk-version": "3.0.0"
}
6 changes: 3 additions & 3 deletions spec/default_facts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Facts specified here will override the values provided by rspec-puppet-facts.
---
networking:
ip: "172.16.254.254"
ip6: "FE80:0000:0000:0000:AAAA:AAAA:AAAA"
mac: "AA:AA:AA:AA:AA:AA"
ip: "172.16.254.254"
ip6: "FE80:0000:0000:0000:AAAA:AAAA:AAAA"
mac: "AA:AA:AA:AA:AA:AA"
is_pe: false
8 changes: 4 additions & 4 deletions spec/unit/puppet/provider/apt_key_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
).and_return(command_output)
end

it 'returns 2 resources' do # rubocop:disable RSpec/MultipleExpectations
it 'returns 2 resources' do
expect(described_class.instances.size).to eq(2)
expect(described_class.instances[0].name).to eq('630239CC130E1A7FD81A27B140976EAF437D05B5')
expect(described_class.instances[0].id).to eq('40976EAF437D05B5')
Expand Down Expand Up @@ -116,7 +116,7 @@
expect(provider).to be_exist
end

it 'apt_key with content set' do # rubocop:disable RSpec/MultipleExpectations
it 'apt_key with content set' do
expect(described_class).to receive(:apt_key).with(array_including('add', kind_of(String)))
resource = Puppet::Type::Apt_key.new(name: 'gsd',
id: 'C105B9DE',
Expand All @@ -130,7 +130,7 @@
expect(provider).to be_exist
end

it 'apt_key with source set' do # rubocop:disable RSpec/MultipleExpectations
it 'apt_key with source set' do
expect(described_class).to receive(:apt_key).with(array_including('add', kind_of(String)))
resource = Puppet::Type::Apt_key.new(name: 'gsd',
id: 'C105B9DE',
Expand All @@ -144,7 +144,7 @@
expect(provider).to be_exist
end

it 'apt_key with source and weak ssl verify set' do # rubocop:disable RSpec/MultipleExpectations
it 'apt_key with source and weak ssl verify set' do
expect(described_class).to receive(:apt_key).with(array_including('add', kind_of(String)))
resource = Puppet::Type::Apt_key.new(name: 'gsd',
id: 'C105B9DE',
Expand Down

0 comments on commit 146fe0b

Please sign in to comment.