Skip to content

Commit

Permalink
BREAKING: Major updates - see description (#25)
Browse files Browse the repository at this point in the history
* Drop Puppet 6
* Add Puppet 8
* Drop Debian 9 and Ubuntu 18.04
  • Loading branch information
treydock authored Aug 21, 2023
1 parent 3d99936 commit 583ced8
Show file tree
Hide file tree
Showing 31 changed files with 220 additions and 257 deletions.
25 changes: 13 additions & 12 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 All @@ -47,15 +48,13 @@ jobs:
fail-fast: false
matrix:
set:
- "centos-7"
- "rocky-8"
- "debian-9"
- "el7"
- "el8"
- "debian-10"
- "ubuntu-1804"
- "ubuntu-2004"
puppet:
- "puppet6"
- "puppet7"
- "puppet8"
env:
BUNDLE_WITHOUT: development:release
BEAKER_debug: true
Expand All @@ -70,14 +69,16 @@ jobs:
run: |
set -x
sudo apt-get remove mysql-server --purge
sudo apt-get update
sudo apt-get install apparmor-profiles
sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Setup ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '2.7'
bundler-cache: true
cache-version: 2
bundler: '2.1.0'
- name: Run tests
run: bundle exec rake beaker
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
39 changes: 14 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,20 @@ 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/MultipleMemoizedHelpers:
Enabled: false
RSpec/RepeatedExampleGroupBody:
Enabled: false
RSpec/MessageSpies:
EnforcedStyle: receive
Style/Documentation:
Expand All @@ -93,15 +88,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
33 changes: 20 additions & 13 deletions .sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,42 @@
.github/workflows/ci.yaml:
acceptance_matrix:
set:
- centos-7
- rocky-8
- debian-9
- el7
- el8
- ---el9
- debian-10
- ubuntu-1804
- ubuntu-2004
puppet:
- puppet6
- puppet7
- puppet8
.gitlab-ci.yml:
delete: true
appveyor.yml:
delete: true
spec/acceptance/nodesets/centos-7.yml:
.rubocop.yml:
profiles:
strict:
configs:
RSpec/MultipleMemoizedHelpers:
Enabled: false
RSpec/RepeatedExampleGroupBody:
Enabled: false
spec/acceptance/nodesets/el7.yml:
packages:
- git
spec/acceptance/nodesets/rocky-8.yml:
packages:
- git
spec/acceptance/nodesets/debian-9.yml:
spec/acceptance/nodesets/el8.yml:
packages:
- git
spec/acceptance/nodesets/el9.yml:
delete: true
spec/acceptance/nodesets/debian-10.yml:
packages:
- git
spec/acceptance/nodesets/ubuntu-1804.yml:
packages:
- git
spec/acceptance/nodesets/debian-11.yml:
delete: true
spec/acceptance/nodesets/ubuntu-2004.yml:
packages:
- cron
- git
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", '5.4.1', 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/nhc_version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# nhc_version.rb

Facter.add(:nhc_version) do
Expand All @@ -6,7 +8,7 @@
setcode do
nhc_v = nil
nhc_v_match = nil
nhc_v_out = Facter::Util::Resolution.exec("rpm -q --queryformat '%{NAME}-%{VERSION}' lbnl-nhc")
nhc_v_out = Facter::Core::Execution.execute("rpm -q --queryformat '%{NAME}-%{VERSION}' lbnl-nhc")
nhc_v_match = nhc_v_out.match(%r{^lbnl-nhc-(.*)$}) unless nhc_v_out.nil?
if nhc_v_match
nhc_v = nhc_v_match[1]
Expand Down
16 changes: 7 additions & 9 deletions manifests/conf.pp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
Optional[Stdlib::Absolutepath] $sysconfig_path = undef,
Optional[Stdlib::Absolutepath] $log_file = undef,
) {

case $ensure {
'present': {
$directory_ensure = 'directory'
Expand All @@ -65,11 +64,11 @@
default: {}
}

include ::nhc
include nhc

$_conf_dir = pick($conf_dir, $::nhc::conf_dir)
$_conf_dir = pick($conf_dir, $nhc::conf_dir)
$_conf_file = pick($conf_file, "${_conf_dir}/${name}.conf")
$_include_dir = pick($include_dir, $::nhc::include_dir)
$_include_dir = pick($include_dir, $nhc::include_dir)
$_sysconfig_path = pick($sysconfig_path, "/etc/sysconfig/${name}")
$_log_file = pick($log_file, "/var/log/${name}.log")

Expand All @@ -84,7 +83,7 @@

$configs = merge($default_configs, $config_overrides)

if $_conf_dir != $::nhc::conf_dir {
if $_conf_dir != $nhc::conf_dir {
file { $_conf_dir:
ensure => $directory_ensure,
force => $_directory_force,
Expand All @@ -95,7 +94,7 @@
}
}

if $_conf_file != $::nhc::conf_file {
if $_conf_file != $nhc::conf_file {
file { $_conf_file:
ensure => $file_ensure,
content => template('nhc/nhc.conf.erb'),
Expand All @@ -106,7 +105,7 @@
}
}

if $_include_dir != $::nhc::include_dir {
if $_include_dir != $nhc::include_dir {
file { $_include_dir:
ensure => $directory_ensure,
owner => 'root',
Expand All @@ -116,7 +115,7 @@
}
}

if $_sysconfig_path != $::nhc::sysconfig_path {
if $_sysconfig_path != $nhc::sysconfig_path {
file { $_sysconfig_path:
ensure => $file_ensure,
content => template('nhc/sysconfig.erb'),
Expand All @@ -125,5 +124,4 @@
mode => '0644',
}
}

}
Loading

0 comments on commit 583ced8

Please sign in to comment.