Skip to content

Commit

Permalink
Add RockyLinux 8 support (#306)
Browse files Browse the repository at this point in the history
* Add RockyLinux 8 support

This patch adds support for RockyLinux 8

The patch enforces a standardized asset baseline using simp/puppetsync,
and may also apply other updates to ensure conformity.

* Updated legacy facts and fixed a linting issue

* Decompose (parellelize) PR test matrix

* dear facter: waht?!

* No such dir

* Prod GHA

* Gen reference

* What is a "serversettings?"

* Adding missing fact for spec tests

---------

Co-authored-by: Chris Tessmer <chris.tessmer@onyxpoint.com>
  • Loading branch information
michael-riddle and op-ct authored Aug 28, 2023
1 parent 77b4d2b commit ae5e03d
Show file tree
Hide file tree
Showing 15 changed files with 1,096 additions and 1,035 deletions.
34 changes: 28 additions & 6 deletions .github/workflows/pr_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,20 +103,40 @@ jobs:
run: 'bundle exec pdk build --force'

spec-tests:
name: 'Puppet Spec'
name: 'Spec (${{matrix.test_suite.label}}, ${{matrix.puppet.label}})'
needs: [puppet-syntax]
runs-on: ubuntu-latest
strategy:
matrix:
puppet:
- label: 'Puppet 7.x'
puppet_version: '~> 7.21.0'
- label: 'Puppet 7.x [SIMP 6.6/PE 2021.7]'
puppet_version: '~> 7.0'
ruby_version: '2.7'
experimental: false
- label: 'Puppet 8.x'
puppet_version: '~> 8.0'
ruby_version: '3.2'
ruby_version: 3.1
experimental: true
test_suite:
- label: classes 01
run: bundle exec rspec spec/classes/01_classes
- label: classes 10
run: bundle exec rspec spec/classes/10_classes
- label: classes 20
run: bundle exec rspec spec/classes/20_classes
- label: classes 00
run: bundle exec rspec spec/classes/00_classes
- label: facter
run: bundle exec rspec spec/facter
- label: functions
run: bundle exec rspec spec/functions
- label: aliases
run: bundle exec rspec spec/type_aliases
- label: unit
run: bundle exec rspec spec/unit
fail-fast: false
env:
PUPPET_VERSION: '${{matrix.puppet.puppet_version}}'
PUPPET_VERSION: ${{matrix.puppet.puppet_version}}
steps:
- uses: actions/checkout@v3
- name: 'Install Ruby ${{matrix.puppet.ruby_version}}'
Expand All @@ -125,7 +145,9 @@ jobs:
ruby-version: ${{matrix.puppet.ruby_version}}
bundler-cache: true
- run: 'command -v rpm || if command -v apt-get; then sudo apt-get update; sudo apt-get install -y rpm; fi ||:'
- run: 'bundle exec rake spec'
- run: 'bundle exec rake spec_prep'
- run: ${{matrix.test_suite.run}}
continue-on-error: ${{matrix.puppet.experimental}}

# dump_contexts:
# name: 'Examine Context contents'
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/tag_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,10 @@ jobs:
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
IS_PRERELEASE: ${{ steps.tag-check.outputs.prerelease }}
run: |
echo "${RELEASE_MESSAGE}" > /tmp/.commit-msg.txt
args=(--file /tmp/.commit-msg.txt)
[[ $IS_PRERELEASE == yes ]] && args+=(--prerelease)
[[ ${{ steps.tag-check.outputs.prerelease }} == yes ]] && args+=(--prerelease)
hub release create ${args[@]} "$TARGET_TAG"
Expand Down
3 changes: 2 additions & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -367,10 +367,11 @@ pup7.pe-unit_slow:
<<: *pup_7_pe
<<: *slow_unit_tests

# Commented until we are ready for puppet 8
#pup8.x-unit:
# <<: *pup_8_x
# <<: *unit_tests

#
#pup8.x-unit_slow:
# <<: *pup_8_x
# <<: *slow_unit_tests
Expand Down
2 changes: 1 addition & 1 deletion .puppet-lint.rc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
--no-class_inherits_from_params_class-check
--no-140chars-check
--no-trailing_comma-check
--no-empty_string_assignment-check
--no-params-empty-string-assignment-check
# This is here because the code can't handle lookups in parameters and SIMP
# modules have a LOT of those
--no-parameter_order-check
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
* Mon Jul 31 2023 Chris Tessmer <chris.tessmer@onyxpoint.com> - 4.17.0
- Add RockyLinux 8 support

* Wed May 31 2023 Mike Riddle <mike@sicura.us> - 4.16.8
- Fixed a bug in the authselect nsswitch logic

Expand Down
2 changes: 0 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ group :test do
gem 'puppetlabs_spec_helper'
gem 'metadata-json-lint'
gem 'puppet-strings'
gem 'scanf'
gem 'puppet-lint-empty_string-check', :require => false
gem 'puppet-lint-trailing_comma-check', :require => false
gem 'simp-rspec-puppet-facts', ENV['SIMP_RSPEC_PUPPET_FACTS_VERSION'] || '~> 3.1'
gem 'simp-rake-helpers', ENV['SIMP_RAKE_HELPERS_VERSION'] || ['>= 5.12.1', '< 6']
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ for direct overall system modification and management.

## Setup

### What simp affects
### What SIMP affects

The ``simp`` module is meant to be the central controller of all node
configurations. The suggested usage is to place the following in your
Expand Down
2,020 changes: 1,024 additions & 996 deletions REFERENCE.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion manifests/admin.pp
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@
if $set_selinux_login {
include selinux::install

if $facts['selinux_current_mode'] and ($facts['selinux_current_mode'] != 'disabled') {
if $facts['os']['selinux']['current_mode'] and ($facts['os']['selinux']['current_mode'] != 'disabled') {
selinux_login { "%${admin_group}":
seuser => $selinux_user_context,
mls_range => $selinux_user_mls_range
Expand Down
2 changes: 1 addition & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
Hash $scenario_map,
String $scenario = 'simp',
Boolean $enable_data_includes = true,
Optional[Array] $classes = [],
Array $classes = [],
Variant[Boolean,Enum['remote']] $mail_server = true,
Variant[Boolean,Simplib::Host] $rsync_stunnel = simplib::lookup('simp_options::stunnel', { 'default_value' => true }),
Boolean $use_ssh_global_known_hosts = false,
Expand Down
20 changes: 10 additions & 10 deletions manifests/yum/repo/local_os_updates.pp
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@
Array[Simp::HostOrURL] $servers,
Boolean $enable_repo = true,
Simp::Urls $extra_gpgkey_urls = [],
String[1] $relative_repo_path = "${facts['os']['name']}/${facts['os']['release']['major']}/${facts['architecture']}",
String[1] $relative_gpgkey_path = "SIMP/GPGKEYS",
String[1] $relative_repo_path = "${facts['os']['name']}/${facts['os']['release']['major']}/${facts['os']['architecture']}",
String[1] $relative_gpgkey_path = 'SIMP/GPGKEYS',
Optional[String[1]] $baseurl = undef,
Optional[String[1]] $gpgkey = simp::yum::repo::gpgkey_string(
$servers,
Expand All @@ -83,16 +83,16 @@
simplib::module_metadata::assert($module_name, { 'blacklist' => ['Windows'] })
$_enable_repo = $enable_repo ? { true => 1, default => 0 }

if "${facts['os']['release']['major']}" > '7' {
if $facts['os']['release']['major'] > '7' {

if $baseurl {
$_os_updates_url = "$baseurl/BaseOS"
$_os_updates_url = "${baseurl}/BaseOS"
} else {
$_os_updates_url = simp::yum::repo::baseurl_string($servers, "${relative_repo_path}/BaseOS")
}
yumrepo { 'local_baseos':
baseurl => "$_os_updates_url",
descr => "${facts['os']['name']} ${facts['os']['release']['major']} ${facts['architecture']} base packages and updates",
baseurl => $_os_updates_url,
descr => "${facts['os']['name']} ${facts['os']['release']['major']} ${facts['os']['architecture']} base packages and updates",
enabled => $_enable_repo,
enablegroups => 1,
gpgcheck => 1,
Expand All @@ -105,13 +105,13 @@
}

if $baseurl {
$_os_appstream_repo = "$baseurl/AppStream"
$_os_appstream_repo = "${baseurl}/AppStream"
} else {
$_os_appstream_repo = simp::yum::repo::baseurl_string($servers, "${relative_repo_path}/AppStream")
}
yumrepo { 'local_appstream':
baseurl => "$_os_appstream_repo",
descr => "${facts['os']['name']} ${facts['os']['release']['major']} ${facts['architecture']} app stream packages",
baseurl => $_os_appstream_repo,
descr => "${facts['os']['name']} ${facts['os']['release']['major']} ${facts['os']['architecture']} app stream packages",
enabled => $_enable_repo,
enablegroups => 1,
gpgcheck => 1,
Expand All @@ -133,7 +133,7 @@

yumrepo { 'os_updates':
baseurl => $_baseurl,
descr => "All ${facts['os']['name']} ${facts['os']['release']['major']} ${facts['architecture']} base packages and updates",
descr => "All ${facts['os']['name']} ${facts['os']['release']['major']} ${facts['os']['architecture']} base packages and updates",
enabled => $_enable_repo,
enablegroups => 0,
gpgcheck => 1,
Expand Down
8 changes: 4 additions & 4 deletions manifests/yum/repo/local_simp.pp
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@
Boolean $enable_repo = true,
Simp::Urls $extra_gpgkey_urls = [],
String[1] $relative_repo_path = "SIMP/${facts['os'][name]}/${facts['os']['release']['major']}",
String[1] $relative_gpgkey_path = "SIMP/GPGKEYS",
Optional[String[1]] $baseurl = simp::yum::repo::baseurl_string($servers, "${relative_repo_path}/${facts['architecture']}"),
String[1] $relative_gpgkey_path = 'SIMP/GPGKEYS',
Optional[String[1]] $baseurl = simp::yum::repo::baseurl_string($servers, "${relative_repo_path}/${facts['os']['architecture']}"),
Optional[String[1]] $gpgkey = simp::yum::repo::gpgkey_string(
$servers,
simp::yum::repo::gpgkeys::simp(),
Expand All @@ -109,7 +109,7 @@
skip_if_unavailable => 1
}

$_descr_base = "SIMP ${facts['os']['name']} ${facts['os']['release']['major']} ${facts['architecture']}"
$_descr_base = "SIMP ${facts['os']['name']} ${facts['os']['release']['major']} ${facts['os']['architecture']}"

if $facts['package_provider'] == 'dnf' {
yumrepo { 'simp':
Expand Down Expand Up @@ -150,7 +150,7 @@
}
else {
yumrepo { 'simp':
baseurl => "${baseurl}",
baseurl => $baseurl,
descr => "${_descr_base} product packages",
* => $_common_attrs
}
Expand Down
10 changes: 8 additions & 2 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "simp-simp",
"version": "4.16.8",
"version": "4.17.0",
"author": "SIMP Team",
"summary": "default profiles for core SIMP installations",
"license": "Apache-2.0",
Expand Down Expand Up @@ -37,7 +37,7 @@
},
{
"name": "puppetlabs/stdlib",
"version_requirement": ">= 6.6.0 < 9.0.0"
"version_requirement": ">= 8.0.0 < 9.0.0"
},
{
"name": "saz/timezone",
Expand Down Expand Up @@ -233,6 +233,12 @@
"8.1",
"10"
]
},
{
"operatingsystem": "Rocky",
"operatingsystemrelease": [
"8"
]
}
]
}
6 changes: 5 additions & 1 deletion spec/classes/00_classes/puppetdb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@
it { expect{ is_expected.to compile.with_all_deps }.to raise_error(/'windows .+' is not supported/) }
else
let(:facts) do
{ :puppet_settings => { 'main' => { 'hostprivkey' => 'blah' } }}.merge(os_facts)
{
:serversettings => Puppet.version,
:serverversion => Puppet.version,
:puppet_settings => { 'main' => { 'hostprivkey' => 'blah' } }
}.merge(os_facts)
end

if os_facts[:os][:release][:major] == '7'
Expand Down
14 changes: 7 additions & 7 deletions spec/facter/simp_rsync_environments_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

describe "SIMP Rsync Environments" do
after :each do
Facter.clear
LegacyFacter.clear
end

rsync_env_dir = '/var/simp/environments'
Expand All @@ -25,11 +25,11 @@
'simp/rsync/Global/clamav'
])

Facter.collection.load(:simp_rsync_environments)
LegacyFacter.collection.load(:simp_rsync_environments)
end

it 'should return a Hash of environments' do
expect(Facter.fact(:simp_rsync_environments).value).to eql({
expect(LegacyFacter.fact(:simp_rsync_environments).value).to eql({
'simp' => {
'id' => 'simp',
'rsync' => {
Expand All @@ -51,11 +51,11 @@
before :each do
File.stubs(:directory?).returns(false)

Facter.collection.load(:simp_rsync_environments)
LegacyFacter.collection.load(:simp_rsync_environments)
end

it 'should be empty' do
expect(Facter.fact(:simp_rsync_environments)).to be_nil
expect(LegacyFacter.fact(:simp_rsync_environments)).to be_nil
end
end

Expand All @@ -68,11 +68,11 @@

Facter::Core::Execution.expects(:exec).with("find -L simp -name '.shares'").at_least_once.returns('')

Facter.collection.load(:simp_rsync_environments)
LegacyFacter.collection.load(:simp_rsync_environments)
end

it 'should be empty' do
expect(Facter.fact(:simp_rsync_environments).value).to be_empty
expect(LegacyFacter.fact(:simp_rsync_environments).value).to be_empty
end
end
end

0 comments on commit ae5e03d

Please sign in to comment.