Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BREAKING: Major updates - read description #21

Merged
merged 1 commit into from Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 13 additions & 12 deletions .github/workflows/ci.yaml
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
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
@@ -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
15 changes: 10 additions & 5 deletions .sync.yml
Expand Up @@ -2,15 +2,14 @@
.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:
Expand All @@ -19,3 +18,9 @@ spec/spec_helper_acceptance.rb:
spec_overrides:
- "proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))"
- "copy_root_module_to(hosts, source: File.join(proj_root, 'tests/site_munge'), module_name: 'site_munge', ignore_list: [])"
spec/acceptance/nodesets/el9.yml:
delete: true
spec/acceptance/nodesets/debian-11.yml:
delete: true
spec/acceptance/nodesets/ubuntu-2204.yml:
delete: true
26 changes: 9 additions & 17 deletions Gemfile
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
@@ -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
43 changes: 21 additions & 22 deletions manifests/config.pp
@@ -1,53 +1,52 @@
# @summary Manage munge config
# @api private
class munge::config {

file { '/etc/munge/munge.key':
ensure => 'file',
path => $::munge::munge_key_path,
owner => $::munge::user,
group => $::munge::group,
path => $munge::munge_key_path,
owner => $munge::user,
group => $munge::group,
mode => '0400',
source => $::munge::munge_key_source,
content => $::munge::munge_key_content,
source => $munge::munge_key_source,
content => $munge::munge_key_content,
}

if $::munge::conf_dir {
if $munge::conf_dir {
file { '/etc/munge':
ensure => 'directory',
path => $::munge::conf_dir,
owner => $::munge::user,
group => $::munge::group,
path => $munge::conf_dir,
owner => $munge::user,
group => $munge::group,
mode => '0700',
}
}

if $::munge::log_dir {
if $munge::log_dir {
file { '/var/log/munge':
ensure => 'directory',
path => $::munge::log_dir,
owner => $::munge::user,
group => $::munge::group,
path => $munge::log_dir,
owner => $munge::user,
group => $munge::group,
mode => '0700',
}
}

if $::munge::lib_dir {
if $munge::lib_dir {
file { '/var/lib/munge':
ensure => 'directory',
path => $::munge::lib_dir,
owner => $::munge::user,
group => $::munge::group,
path => $munge::lib_dir,
owner => $munge::user,
group => $munge::group,
mode => '0700',
}
}

if $::munge::run_dir {
if $munge::run_dir {
file { '/run/munge':
ensure => 'directory',
path => $::munge::run_dir,
owner => $::munge::user,
group => $::munge::group,
path => $munge::run_dir,
owner => $munge::user,
group => $munge::group,
mode => '0755',
}
}
Expand Down
22 changes: 10 additions & 12 deletions manifests/init.pp
Expand Up @@ -84,17 +84,15 @@
Stdlib::Absolutepath $munge_user_home = '/var/run/munge',
Optional[Array[String]] $package_install_options = undef,
) {
contain munge::user
contain munge::repo
contain munge::install
contain munge::config
contain munge::service

if ! $facts['os']['family'] in ['RedHat'] {
fail("Unsupported osfamily: ${facts['os']['family']}, module ${module_name} only support osfamily RedHat")
}

anchor { 'munge::start': }
-> class { '::munge::user': }
-> class { '::munge::repo': }
-> class { '::munge::install': }
-> class { '::munge::config': }
~> class { '::munge::service': }
-> anchor { 'munge::end': }

Class['munge::user']
-> Class['munge::repo']
-> Class['munge::install']
-> Class['munge::config']
~> Class['munge::service']
}
15 changes: 7 additions & 8 deletions manifests/install.pp
@@ -1,18 +1,17 @@
# @summary Manage munge packages
# @api private
class munge::install {

package { 'munge':
ensure => $::munge::package_ensure,
name => $::munge::package_name,
install_options => $::munge::package_install_options,
ensure => $munge::package_ensure,
name => $munge::package_name,
install_options => $munge::package_install_options,
notify => Service['munge'],
}

if $::munge::install_dev {
if $munge::install_dev {
package { 'munge-devel':
ensure => $::munge::package_ensure,
name => $::munge::dev_package_name,
ensure => $munge::package_ensure,
name => $munge::dev_package_name,
}
}

}
8 changes: 3 additions & 5 deletions manifests/repo.pp
@@ -1,16 +1,14 @@
# @summary Manage munge repo
# @api private
class munge::repo {

if $::munge::manage_repo {
case $::osfamily {
if $munge::manage_repo {
case $facts['os']['family'] {
'RedHat': {
contain ::epel
contain epel
}
default: {
# Do nothing
}
}
}

}