Skip to content

Commit

Permalink
Major updates - read description
Browse files Browse the repository at this point in the history
* Drop Puppet 6 support
* Add Puppet 8 support
* Add EL9 support
* Support latest module dependencies
  • Loading branch information
treydock committed Dec 24, 2023
1 parent 772c1ec commit 167843d
Show file tree
Hide file tree
Showing 34 changed files with 208 additions and 200 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
- master
pull_request:


jobs:
unit:
runs-on: ubuntu-latest
Expand All @@ -15,27 +16,27 @@ jobs:
fail-fast: false
matrix:
include:
- ruby: 2.5.7
puppet: 6
- ruby: 2.7.7
puppet: 7
fixtures: .fixtures.yml
allow_failure: false
- ruby: 2.7.0
puppet: 7
- ruby: 3.2.2
puppet: 8
fixtures: .fixtures.yml
allow_failure: false
env:
BUNDLE_WITHOUT: system_tests:release
PUPPET_GEM_VERSION: "~> ${{ matrix.puppet }}.0"
FACTER_GEM_VERSION: "< 4.0"
FIXTURES_YML: ${{ matrix.fixtures }}
name: Puppet ${{ matrix.puppet }} (Ruby ${{ matrix.ruby }})
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Setup ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
cache-version: 2
bundler: '2.1.0'
- name: Validate
run: bundle exec rake check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop syntax lint metadata_lint
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
Expand Down
35 changes: 10 additions & 25 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
---
require:
- rubocop-rspec
- rubocop-i18n
AllCops:
DisplayCopNames: true
TargetRubyVersion: '2.1'
TargetRubyVersion: '2.5'
Include:
- "./**/*.rb"
- "**/*.rb"
Exclude:
- bin/*
- ".vendor/**/*"
Expand All @@ -21,13 +20,6 @@ AllCops:
Metrics/LineLength:
Description: People have wide screens, use them.
Max: 200
GetText:
Enabled: false
GetText/DecorateString:
Description: We don't want to decorate test output.
Exclude:
- spec/**/*
Enabled: false
RSpec/BeforeAfterAll:
Description: Beware of using after(:all) as it may cause state to leak between tests.
A necessary evil in acceptance testing.
Expand All @@ -40,10 +32,6 @@ Style/BlockDelimiters:
Description: Prefer braces for chaining. Mostly an aesthetical choice. Better to
be consistent then.
EnforcedStyle: braces_for_chaining
Style/BracesAroundHashParameters:
Description: Braces are required by Ruby 2.7. Cop removed from RuboCop v0.80.0.
See https://github.com/rubocop-hq/rubocop/pull/7643
Enabled: true
Style/ClassAndModuleChildren:
Description: Compact style reduces the required amount of indentation.
EnforcedStyle: compact
Expand Down Expand Up @@ -72,13 +60,16 @@ Style/TrailingCommaInArguments:
Description: Prefer always trailing comma on multiline argument lists. This makes
diffs, and re-ordering nicer.
EnforcedStyleForMultiline: comma
Style/TrailingCommaInLiteral:
Description: Prefer always trailing comma on multiline literals. This makes diffs,
and re-ordering nicer.
EnforcedStyleForMultiline: comma
Style/SymbolArray:
Description: Using percent style obscures symbolic intent of array's contents.
EnforcedStyle: brackets
RSpec/ImplicitSubject:
Enabled: false
Lint/BooleanSymbol:
Enabled: false
Naming/MethodParameterName:
AllowedNames:
- is
RSpec/MessageSpies:
EnforcedStyle: receive
Style/Documentation:
Expand All @@ -93,15 +84,9 @@ Style/MethodCalledOnDoEndBlock:
Enabled: true
Style/StringMethods:
Enabled: true
GetText/DecorateFunctionMessage:
Enabled: false
GetText/DecorateStringFormattingUsingInterpolation:
Enabled: false
GetText/DecorateStringFormattingUsingPercent:
Enabled: false
Layout/EndOfLine:
Enabled: false
Layout/IndentHeredoc:
Layout/HeredocIndentation:
Enabled: false
Metrics/AbcSize:
Enabled: false
Expand Down
12 changes: 3 additions & 9 deletions .sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,9 @@
delete: true
appveyor.yml:
delete: true
spec/acceptance/nodesets/debian-8.yml:
delete: true
spec/acceptance/nodesets/debian-9.yml:
delete: true
spec/acceptance/nodesets/debian-10.yml:
delete: true
spec/acceptance/nodesets/ubuntu-1604.yml:
delete: true
spec/acceptance/nodesets/ubuntu-1804.yml:
spec/acceptance/nodesets/debian-11.yml:
delete: true
spec/acceptance/nodesets/ubuntu-2004.yml:
delete: true
spec/acceptance/nodesets/ubuntu-2204.yml:
delete: true
26 changes: 9 additions & 17 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,22 @@ ruby_version_segments = Gem::Version.new(RUBY_VERSION.dup).segments
minor_version = ruby_version_segments[0..1].join('.')

group :development do
gem "fast_gettext", '1.1.0', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.1.0')
gem "fast_gettext", require: false if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.1.0')
gem "json_pure", '<= 2.0.1', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.0.0')
gem "json", '= 1.8.1', require: false if Gem::Version.new(RUBY_VERSION.dup) == Gem::Version.new('2.1.9')
gem "json", '= 2.0.4', require: false if Gem::Requirement.create('~> 2.4.2').satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
gem "json", '= 2.1.0', require: false if Gem::Requirement.create(['>= 2.5.0', '< 2.7.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
gem "rb-readline", '= 0.5.5', require: false, platforms: [:mswin, :mingw, :x64_mingw]
gem "puppet-module-posix-default-r#{minor_version}", '~> 0.4', require: false, platforms: [:ruby]
gem "puppet-module-posix-dev-r#{minor_version}", '~> 0.4', require: false, platforms: [:ruby]
gem "puppet-module-win-default-r#{minor_version}", '~> 0.4', require: false, platforms: [:mswin, :mingw, :x64_mingw]
gem "puppet-module-win-dev-r#{minor_version}", '~> 0.4', require: false, platforms: [:mswin, :mingw, :x64_mingw]
gem "puppet-lint-param-docs", require: false
gem "github_changelog_generator", require: false
gem "voxpupuli-test", '7.0.0', require: false
gem "faraday", '~> 1.0', require: false
gem "github_changelog_generator", require: false
gem "puppet-blacksmith", require: false
gem "puppet-strings", require: false
end
group :system_tests do
gem "puppet-module-posix-system-r#{minor_version}", '~> 0.5', require: false, platforms: [:ruby]
gem "puppet-module-win-system-r#{minor_version}", '~> 0.5', require: false, platforms: [:mswin, :mingw, :x64_mingw]
gem "beaker", *location_for(ENV['BEAKER_VERSION'] || '~> 4.0')
gem "beaker", *location_for(ENV['BEAKER_VERSION'] || '~> 4.29')
gem "beaker-abs", *location_for(ENV['BEAKER_ABS_VERSION'] || '~> 0.1')
gem "beaker-pe", require: false
gem "beaker-hostgenerator"
gem "beaker-rspec"
gem "beaker-docker", *location_for(ENV['BEAKER_DOCKER_VERSION'] || '~> 0.7.0')
gem "beaker-docker"
gem "beaker-puppet"
gem "beaker-puppet_install_helper", require: false
gem "beaker-module_install_helper", require: false
end

puppet_version = ENV['PUPPET_GEM_VERSION']
Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# frozen_string_literal: true

require 'puppet_litmus/rake_tasks' if Bundler.rubygems.find_name('puppet_litmus').any?
require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet-syntax/tasks/puppet-syntax'
require 'beaker-rspec/rake_task' if Bundler.rubygems.find_name('beaker-rspec').any?
require 'puppet_blacksmith/rake_tasks' if Bundler.rubygems.find_name('puppet-blacksmith').any?
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?
Expand Down
4 changes: 3 additions & 1 deletion lib/facter/has_mellanox_infiniband.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# Fact: has_mellanox_infiniband
#
# Purpose: Determine if the system's hardware supports Mellanox InfiniBand.
Expand All @@ -12,6 +14,6 @@
confine kernel: 'Linux'
setcode do
ib_device_count = Facter::Util::MellanoxInfiniband.count_ib_devices
ib_device_count > 0
ib_device_count.positive?
end
end
2 changes: 2 additions & 0 deletions lib/facter/mellanox_ofed_version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# Fact: mellanox_ofed_version
#
# Purpose: Determine version of Mellanox OFED installed
Expand Down
4 changes: 3 additions & 1 deletion lib/facter/util/mellanox_infiniband.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# frozen_string_literal: true

# Class for Mellanox Infiniband fact functions
class Facter::Util::MellanoxInfiniband
# REF: http://cateee.net/lkddb/web-lkddb/INFINIBAND.html
LSPCI_IB_REGEX = %r{\s15b3:}
LSPCI_IB_REGEX = %r{\s15b3:}.freeze

# lspci is a delegating helper method intended to make it easier to stub the
# system call without affecting other calls to Facter::Core::Execution.exec
Expand Down
1 change: 0 additions & 1 deletion manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,4 @@

create_resources('shellvar', $mofed::openib_shellvars, $_shellvar_defaults)
}

}
10 changes: 0 additions & 10 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,6 @@
Hash $openib_shellvars = {},
Hash $interfaces = {}
) {

$osfamily = $facts.dig('os', 'family')
$osmajor = $facts.dig('os', 'release', 'major')
$supported = ['RedHat-6','RedHat-7','RedHat-8']
$os = "${osfamily}-${osmajor}"
if ! ($os in $supported) {
fail("Unsupported OS: ${osfamily}, module ${module_name} only supports RedHat 6, 7, and 8")
}

if $restart_service {
$openib_shellvar_notify = Service['openibd']
} else {
Expand All @@ -101,5 +92,4 @@
-> Class['mofed::service']

create_resources('mofed::interface', $interfaces)

}
1 change: 0 additions & 1 deletion manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,4 @@
ensure_packages($extra_packages)
}
}

}
6 changes: 2 additions & 4 deletions manifests/interface.pp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
# @param bonding_opts
# The bonding options to use for this bonding interface
#
define mofed::interface(
define mofed::interface (
Enum['present', 'absent'] $ensure = 'present',
Optional[Stdlib::Compat::Ip_address] $ipaddr = undef,
Optional[Stdlib::Compat::Ip_address] $netmask = undef ,
Expand All @@ -44,7 +44,6 @@
Array[String] $bonding_slaves = [],
String $bonding_opts = 'mode=active-backup miimon=100',
) {

if $ensure == 'present' {
if ! $ipaddr {
fail('ipaddr is required with ensure=present')
Expand All @@ -66,7 +65,7 @@
'CONNECTED_MODE' => $connected_mode,
}

if $mofed::osfamily == 'RedHat' and versioncmp($mofed::osmajor, '8') >= 0 {
if $facts['os']['family'] == 'RedHat' and versioncmp($facts['os']['release']['major'], '8') >= 0 {
$_nm_controlled = pick($nm_controlled, false)
} else {
$_nm_controlled = pick($nm_controlled, 'no')
Expand Down Expand Up @@ -120,5 +119,4 @@
options_extra_redhat => $options_extra_redhat,
}
}

}
34 changes: 15 additions & 19 deletions manifests/opensm.pp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
Array $ports = [],
Integer $sweep = 10,
) {

include mofed

case $ensure {
Expand Down Expand Up @@ -82,26 +81,23 @@
require => Package['opensm'],
}

if versioncmp($::operatingsystemrelease, '7.0') >= 0 {
systemd::unit_file { '[email protected]':
ensure => $file_ensure,
source => 'puppet:///modules/mofed/opensm/[email protected]',
}
systemd::unit_file { '[email protected]':
ensure => $file_ensure,
source => 'puppet:///modules/mofed/opensm/[email protected]',
}

$ports.each |Integer $index, String $port| {
$i = $index + 1
service { "opensmd@${i}":
ensure => $service_ensure,
enable => $service_enable,
hasstatus => true,
hasrestart => true,
subscribe => [
File['/etc/sysconfig/opensm'],
Systemd::Unit_file['[email protected]']
]
}
$ports.each |Integer $index, String $port| {
$i = $index + 1
service { "opensmd@${i}":
ensure => $service_ensure,
enable => $service_enable,
hasstatus => true,
hasrestart => true,
subscribe => [
File['/etc/sysconfig/opensm'],
Systemd::Unit_file['[email protected]']
],
}
}
}

}
3 changes: 1 addition & 2 deletions manifests/repo.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
assert_private()

if $mofed::manage_repo {
case $::osfamily {
case $facts['os']['family'] {
'RedHat': {
yumrepo { 'mlnx_ofed':
descr => 'MLNX_OFED Repository',
Expand All @@ -20,5 +20,4 @@
}
}
}

}
1 change: 0 additions & 1 deletion manifests/service.pp
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,4 @@
hasrestart => $mofed::openibd_service_hasrestart,
}
}

}
Loading

0 comments on commit 167843d

Please sign in to comment.