Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 16de95c

Browse files
vchepkovekohl
authored andcommittedJan 31, 2023
refactor legacy facts to add compatibility with puppet 8
1 parent c51f7a1 commit 16de95c

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed
 

‎manifests/current.pp

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
require => Package[$package_name],
6969
}
7070

71-
if versioncmp($::operatingsystemrelease, '7.0') >= 0 {
71+
if versioncmp($facts['os']['release']['full'], '7.0') >= 0 {
7272
file { [
7373
"/etc/cron.weekly/${package_name}",
7474
"/etc/cron.daily/${package_name}",

‎manifests/init.pp

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@
5454
if $deployment_style {
5555
$class_name = $deployment_style
5656
} else {
57-
if (versioncmp($::operatingsystemrelease, '6.10') < 0 or
58-
(versioncmp($::operatingsystemrelease, '7.0') >= 0 and versioncmp($::operatingsystemrelease, '7.5') < 0)) {
57+
if (versioncmp($facts['os']['release']['full'], '6.10') < 0 or
58+
(versioncmp($facts['os']['release']['full'], '7.0') >= 0 and versioncmp($facts['os']['release']['full'], '7.5') < 0)) {
5959
$class_name = 'old'
6060
} else {
6161
$class_name = 'current'

‎spec/classes/current_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
describe 'access_insights_client::current' do
44
context 'on 6.10' do
55
let :facts do
6-
{:operatingsystemrelease => '6.10'}
6+
{os: {release: {full: '6.10'}}}
77
end
88

99
it { is_expected.to compile.with_all_deps }
@@ -21,7 +21,7 @@
2121

2222
context 'on 7.0' do
2323
let :facts do
24-
{:operatingsystemrelease => '7.0'}
24+
{os: {release: {full: '7.0'}}}
2525
end
2626

2727
it { is_expected.to compile.with_all_deps }

‎spec/classes/init_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
end
99

1010
let :facts do
11-
{:operatingsystemrelease => '6.10'}
11+
{os: {release: {full: '6.10'}}}
1212
end
1313

1414
it { is_expected.to compile.with_all_deps }
@@ -26,7 +26,7 @@
2626
}.each do |version, expected|
2727
context "on #{version}" do
2828
let :facts do
29-
{:operatingsystemrelease => version}
29+
{os: {release: {full: version}}}
3030
end
3131

3232
it { is_expected.to compile.with_all_deps }

0 commit comments

Comments
 (0)
Please sign in to comment.