Skip to content

Commit

Permalink
Repo class supports AlmaLinux 9 and RedHat 9 platforms (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
enricovianello authored Jul 31, 2024
1 parent b7efc32 commit c4329b8
Show file tree
Hide file tree
Showing 3 changed files with 194 additions and 79 deletions.
12 changes: 9 additions & 3 deletions manifests/repo.pp
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,18 @@

) {
$base = 'https://repo.cloud.cnaf.infn.it/repository'
$el = $facts['os']['distro']['release']['major']
$el = $facts['os']['release']['major']

case $facts['os']['name'] {
'RedHat', 'AlmaLinux': { $dist = 'redhat' }
'CentOS', 'Scientific': { $dist = 'centos' }
default: { $dist = 'redhat' }
}

$installed.each | $repo | {
$enabled = $repo in $enabled ? { true => 1, default => 0 }
$name = "storm-${repo}-centos${el}"
$baseurl = "${base}/storm-rpm-${repo}/centos${el}/"
$name = "storm-${repo}-${dist}${el}"
$baseurl = "${base}/storm-rpm-${repo}/${dist}${el}/"

yumrepo { $name:
ensure => present,
Expand Down
12 changes: 12 additions & 0 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,18 @@
"7"
]
},
{
"operatingsystem": "RedHat",
"operatingsystemrelease": [
"9"
]
},
{
"operatingsystem": "AlmaLinux",
"operatingsystemrelease": [
"9"
]
},
{
"operatingsystem": "Scientific",
"operatingsystemrelease": [
Expand Down
249 changes: 173 additions & 76 deletions spec/classes/storm/storm_repo_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,37 +8,74 @@
end

context 'check default configuration' do
case facts[:operatingsystemmajrelease]
when '7'
it 'storm-stable-centos7 is installed and enabled' do
is_expected.to contain_yumrepo('storm-stable-centos7').with(
ensure: 'present',
baseurl: 'https://repo.cloud.cnaf.infn.it/repository/storm-rpm-stable/centos7/',
enabled: 1,
protect: 1,
gpgcheck: 0,
priority: 1,
)
case facts[:operatingsystem]
when 'CentOS', 'Scientific'
case facts[:operatingsystemmajrelease]
when '7'
it 'storm-stable-centos7 is installed and enabled' do
is_expected.to contain_yumrepo('storm-stable-centos7').with(
ensure: 'present',
baseurl: 'https://repo.cloud.cnaf.infn.it/repository/storm-rpm-stable/centos7/',
enabled: 1,
protect: 1,
gpgcheck: 0,
priority: 1,
)
end
it 'storm-beta-centos7 is installed but disabled' do
is_expected.to contain_yumrepo('storm-beta-centos7').with(
ensure: 'present',
baseurl: 'https://repo.cloud.cnaf.infn.it/repository/storm-rpm-beta/centos7/',
enabled: 0,
protect: 1,
gpgcheck: 0,
priority: 1,
)
end
it 'storm-nightly-centos7 is installed but disabled' do
is_expected.to contain_yumrepo('storm-nightly-centos7').with(
ensure: 'present',
baseurl: 'https://repo.cloud.cnaf.infn.it/repository/storm-rpm-nightly/centos7/',
enabled: 0,
protect: 1,
gpgcheck: 0,
priority: 1,
)
end
end
it 'storm-beta-centos7 is installed but disabled' do
is_expected.to contain_yumrepo('storm-beta-centos7').with(
ensure: 'present',
baseurl: 'https://repo.cloud.cnaf.infn.it/repository/storm-rpm-beta/centos7/',
enabled: 0,
protect: 1,
gpgcheck: 0,
priority: 1,
)
end
it 'storm-nightly-centos7 is installed but disabled' do
is_expected.to contain_yumrepo('storm-nightly-centos7').with(
ensure: 'present',
baseurl: 'https://repo.cloud.cnaf.infn.it/repository/storm-rpm-nightly/centos7/',
enabled: 0,
protect: 1,
gpgcheck: 0,
priority: 1,
)
when 'RedHat', 'AlmaLinux'
case facts[:operatingsystemmajrelease]
when '9'
it 'storm-stable-redhat9 is installed and enabled' do
is_expected.to contain_yumrepo('storm-stable-redhat9').with(
ensure: 'present',
baseurl: 'https://repo.cloud.cnaf.infn.it/repository/storm-rpm-stable/redhat9/',
enabled: 1,
protect: 1,
gpgcheck: 0,
priority: 1,
)
end
it 'storm-beta-redhat9 is installed but disabled' do
is_expected.to contain_yumrepo('storm-beta-redhat9').with(
ensure: 'present',
baseurl: 'https://repo.cloud.cnaf.infn.it/repository/storm-rpm-beta/redhat9/',
enabled: 0,
protect: 1,
gpgcheck: 0,
priority: 1,
)
end
it 'storm-nightly-redhat9 is installed but disabled' do
is_expected.to contain_yumrepo('storm-nightly-redhat9').with(
ensure: 'present',
baseurl: 'https://repo.cloud.cnaf.infn.it/repository/storm-rpm-nightly/redhat9/',
enabled: 0,
protect: 1,
gpgcheck: 0,
priority: 1,
)
end
end
end
end
Expand All @@ -50,37 +87,74 @@
}
end

case facts[:operatingsystemmajrelease]
when '7'
it 'storm-stable-centos7 is installed but disabled' do
is_expected.to contain_yumrepo('storm-stable-centos7').with(
ensure: 'present',
baseurl: 'https://repo.cloud.cnaf.infn.it/repository/storm-rpm-stable/centos7/',
enabled: 0,
protect: 1,
gpgcheck: 0,
priority: 1,
)
end
it 'storm-beta-centos7 is installed and enabled' do
is_expected.to contain_yumrepo('storm-beta-centos7').with(
ensure: 'present',
baseurl: 'https://repo.cloud.cnaf.infn.it/repository/storm-rpm-beta/centos7/',
enabled: 1,
protect: 1,
gpgcheck: 0,
priority: 1,
)
case facts[:operatingsystem]
when 'CentOS', 'Scientific'
case facts[:operatingsystemmajrelease]
when '7'
it 'storm-stable-centos7 is installed but disabled' do
is_expected.to contain_yumrepo('storm-stable-centos7').with(
ensure: 'present',
baseurl: 'https://repo.cloud.cnaf.infn.it/repository/storm-rpm-stable/centos7/',
enabled: 0,
protect: 1,
gpgcheck: 0,
priority: 1,
)
end
it 'storm-beta-centos7 is installed and enabled' do
is_expected.to contain_yumrepo('storm-beta-centos7').with(
ensure: 'present',
baseurl: 'https://repo.cloud.cnaf.infn.it/repository/storm-rpm-beta/centos7/',
enabled: 1,
protect: 1,
gpgcheck: 0,
priority: 1,
)
end
it 'storm-nightly-centos7 is installed and enabled' do
is_expected.to contain_yumrepo('storm-nightly-centos7').with(
ensure: 'present',
baseurl: 'https://repo.cloud.cnaf.infn.it/repository/storm-rpm-nightly/centos7/',
enabled: 1,
protect: 1,
gpgcheck: 0,
priority: 1,
)
end
end
it 'storm-nightly-centos7 is installed and enabled' do
is_expected.to contain_yumrepo('storm-nightly-centos7').with(
ensure: 'present',
baseurl: 'https://repo.cloud.cnaf.infn.it/repository/storm-rpm-nightly/centos7/',
enabled: 1,
protect: 1,
gpgcheck: 0,
priority: 1,
)
when 'RedHat', 'AlmaLinux'
case facts[:operatingsystemmajrelease]
when '9'
it 'storm-stable-redhat9 is installed but disabled' do
is_expected.to contain_yumrepo('storm-stable-redhat9').with(
ensure: 'present',
baseurl: 'https://repo.cloud.cnaf.infn.it/repository/storm-rpm-stable/redhat9/',
enabled: 0,
protect: 1,
gpgcheck: 0,
priority: 1,
)
end
it 'storm-beta-redhat9 is installed and enabled' do
is_expected.to contain_yumrepo('storm-beta-redhat9').with(
ensure: 'present',
baseurl: 'https://repo.cloud.cnaf.infn.it/repository/storm-rpm-beta/redhat9/',
enabled: 1,
protect: 1,
gpgcheck: 0,
priority: 1,
)
end
it 'storm-nightly-redhat9 is installed and enabled' do
is_expected.to contain_yumrepo('storm-nightly-redhat9').with(
ensure: 'present',
baseurl: 'https://repo.cloud.cnaf.infn.it/repository/storm-rpm-nightly/redhat9/',
enabled: 1,
protect: 1,
gpgcheck: 0,
priority: 1,
)
end
end
end
end
Expand All @@ -92,23 +166,46 @@
}
end

case facts[:operatingsystemmajrelease]
when '7'
it 'storm-stable-centos7 is installed and enabled' do
is_expected.to contain_yumrepo('storm-stable-centos7').with(
ensure: 'present',
baseurl: 'https://repo.cloud.cnaf.infn.it/repository/storm-rpm-stable/centos7/',
enabled: 1,
protect: 1,
gpgcheck: 0,
priority: 1,
)
end
it 'storm-beta-centos7 is not present' do
is_expected.not_to contain_yumrepo('storm-beta-centos7')
case facts[:operatingsystem]
when 'CentOS', 'Scientific'
case facts[:operatingsystemmajrelease]
when '7'
it 'storm-stable-centos7 is installed and enabled' do
is_expected.to contain_yumrepo('storm-stable-centos7').with(
ensure: 'present',
baseurl: 'https://repo.cloud.cnaf.infn.it/repository/storm-rpm-stable/centos7/',
enabled: 1,
protect: 1,
gpgcheck: 0,
priority: 1,
)
end
it 'storm-beta-centos7 is not present' do
is_expected.not_to contain_yumrepo('storm-beta-centos7')
end
it 'storm-nightly-centos7 is not present' do
is_expected.not_to contain_yumrepo('storm-nightly-centos7')
end
end
it 'storm-nightly-centos7 is not present' do
is_expected.not_to contain_yumrepo('storm-nightly-centos7')
when 'RedHat', 'AlmaLinux'
case facts[:operatingsystemmajrelease]
when '9'
it 'storm-stable-redhat9 is installed and enabled' do
is_expected.to contain_yumrepo('storm-stable-redhat9').with(
ensure: 'present',
baseurl: 'https://repo.cloud.cnaf.infn.it/repository/storm-rpm-stable/redhat9/',
enabled: 1,
protect: 1,
gpgcheck: 0,
priority: 1,
)
end
it 'storm-beta-redhat9 is not present' do
is_expected.not_to contain_yumrepo('storm-beta-redhat9')
end
it 'storm-nightly-redhat9 is not present' do
is_expected.not_to contain_yumrepo('storm-nightly-redhat9')
end
end
end
end
Expand Down

0 comments on commit c4329b8

Please sign in to comment.