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

Support Puppet 8 #2

Merged
merged 1 commit into from
Dec 5, 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
2 changes: 1 addition & 1 deletion .fixtures.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
fixtures:
repositories:
stdlib:
repo: "git://github.com/puppetlabs/puppetlabs-stdlib"
repo: "https://github.com/puppetlabs/puppetlabs-stdlib.git"
ref: "v6.2.0"
symlinks:
nsswitch: "#{source_dir}"
6 changes: 3 additions & 3 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
# operatingsystem being used.
#
class nsswitch::params {
case $facts['operatingsystem'] {
case $facts['os']['name'] {
/AlmaLinux|CentOS|RedHat|Rocky|Amazon|OEL|OracleLinux|Scientific|CloudLinux/: {
if versioncmp($facts[operatingsystemmajrelease], '6') > 0 {
if versioncmp($facts['os']['release']['major'], '6') > 0 {
$passwd_default = ['files','sss']
$shadow_default = ['files','sss']
$group_default = ['files','sss']
Expand Down Expand Up @@ -208,7 +208,7 @@
$sudoers_default = undef
}
default: {
fail("${facts['operatingsystem']} is not a supported operating system.")
fail("${facts['os']['name']} is not a supported operating system.")
}
}
}
4 changes: 2 additions & 2 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"dependencies": [
{
"name": "puppetlabs/stdlib",
"version_requirement": ">= 4.25.0 < 9.0.0"
"version_requirement": ">= 4.25.0 < 10.0.0"
}
],
"data_provider": null,
Expand Down Expand Up @@ -168,7 +168,7 @@
"requirements": [
{
"name": "puppet",
"version_requirement": ">= 4.0.0 < 8.0.0"
"version_requirement": ">= 4.0.0 < 9.0.0"
}
],
"tags": [
Expand Down
42 changes: 27 additions & 15 deletions spec/classes/nsswitch_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@
context "when used with default parameter on #{os}" do
let(:facts) do
{
operatingsystem: os,
operatingsystemmajrelease: '6',
os: {
name: os,
release: {
major: '6',
},
},
}
end

Expand All @@ -18,32 +22,31 @@
context 'when used with default parameters on Enterprise Linux' do
let(:facts) do
{
operatingsystem: 'RedHat',
os: {
name: 'RedHat',
release: {
major: os_major,
},
},
}
end

context 'version 6' do
let(:facts) do
super().merge(operatingsystemmajrelease: '6')
end
let(:os_major) { '6' }

it { is_expected.to compile.with_all_deps }
it { is_expected.to have_resource_count(1) }
end

context 'version 7' do
let(:facts) do
super().merge(operatingsystemmajrelease: '7')
end
let(:os_major) { '7' }

it { is_expected.to compile.with_all_deps }
it { is_expected.to have_resource_count(1) }
end

context 'version 8' do
let(:facts) do
super().merge(operatingsystemmajrelease: '8')
end
let(:os_major) { '8' }

it { is_expected.to compile.with_all_deps }
it { is_expected.to have_resource_count(1) }
Expand All @@ -53,7 +56,12 @@
context 'when used on an unsupported Operating System' do
let(:facts) do
{
operatingsystem: 'unsupported',
os: {
name: 'unsupported',
release: {
major: '10',
},
},
}
end

Expand All @@ -65,8 +73,12 @@
context 'when passed parameters' do
let(:facts) do
{
operatingsystem: 'CentOS',
operatingsystemmajrelease: '6',
os: {
name: 'CentOS',
release: {
major: '6',
},
},
}
end

Expand Down