Skip to content

Commit

Permalink
Merge pull request #253 from maxadamo/master
Browse files Browse the repository at this point in the history
remove apt repo for ubuntu 22.04
  • Loading branch information
maxadamo authored Dec 18, 2023
2 parents eb366c9 + 91087b5 commit 7405b17
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 22 deletions.
6 changes: 5 additions & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@
$service_name = 'glusterd'
}
'Debian': {
$repo = true
# Ubuntu 22.04 includes GlusterFS in the base repositories
$repo = "${facts['os']['name']}_${facts['os']['release']['major']}" ? {
'Ubuntu_22.04' => false,
default => true
}
$server_package = 'glusterfs-server'
$client_package = 'glusterfs-client'
$service_name = 'glusterd'
Expand Down
4 changes: 2 additions & 2 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
{
"operatingsystem": "Ubuntu",
"operatingsystemrelease": [
"18.04",
"20.04"
"20.04",
"22.04"
]
}
],
Expand Down
12 changes: 7 additions & 5 deletions spec/classes/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,14 @@
it { is_expected.to contain_class('gluster::client') }
it { is_expected.to compile.with_all_deps }

repo_params = {
client_package: 'glusterfs-client',
version: 'LATEST'
}
repo_params[:repo] = !'ubuntu-22.04-x86_64'.eql?(os)

it 'includes gluster::install' do
is_expected.to create_class('gluster::install').with(
repo: true,
client_package: 'glusterfs-client',
version: 'LATEST'
)
is_expected.to create_class('gluster::install').with(repo_params)
end
end

Expand Down
24 changes: 13 additions & 11 deletions spec/classes/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
it { is_expected.to contain_class('gluster') }
it { is_expected.to contain_class('gluster::params') }

it { is_expected.to contain_class('gluster::repo') } unless facts[:os]['family'] == 'Archlinux' || facts[:os]['family'] == 'Suse'
it { is_expected.to contain_class('gluster::repo') } unless facts[:os]['family'] == 'Archlinux' || facts[:os]['family'] == 'Suse' || os == 'ubuntu-22.04-x86_64'
it { is_expected.to compile.with_all_deps }

it 'includes classes' do
Expand Down Expand Up @@ -73,18 +73,20 @@
end
when 'Debian'
context 'Debian specific stuff' do
it { is_expected.to contain_class('gluster::repo::apt') }
it { is_expected.to contain_apt__source('glusterfs-LATEST') }
it { is_expected.to contain_class('gluster::repo::apt') } unless os == 'ubuntu-22.04-x86_64'
it { is_expected.to contain_apt__source('glusterfs-LATEST') } unless os == 'ubuntu-22.04-x86_64'

repo_params = {
server: true,
server_package: 'glusterfs-server',
client: true,
client_package: 'glusterfs-client',
version: 'LATEST',
}
repo_params[:repo] = !'ubuntu-22.04-x86_64'.eql?(os)

it 'creates gluster::install' do
is_expected.to create_class('gluster::install').with(
server: true,
server_package: 'glusterfs-server',
client: true,
client_package: 'glusterfs-client',
version: 'LATEST',
repo: true
)
is_expected.to create_class('gluster::install').with(repo_params)
end
end

Expand Down
5 changes: 3 additions & 2 deletions spec/classes/install_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
when 'Debian'
it { is_expected.to create_package('glusterfs-server') }
it { is_expected.to create_package('glusterfs-client') }
it { is_expected.to create_class('gluster::repo').with(version: 'LATEST') }

it { is_expected.to create_class('gluster::repo').with(version: 'LATEST') } unless os == 'ubuntu-22.04-x86_64'
# rubocop:enable RSpec/RepeatedExample
end
end
Expand Down Expand Up @@ -73,7 +74,7 @@
when 'Archlinux', 'Suse'
it { is_expected.not_to create_class('gluster::repo') }
else
it { is_expected.to compile.and_raise_error(%r{not yet supported}) }
it { is_expected.to compile.and_raise_error(%r{not yet supported}) } unless os == 'ubuntu-22.04-x86_64'
end
end
end
Expand Down
3 changes: 2 additions & 1 deletion spec/classes/repo_apt_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

describe 'gluster::repo::apt', type: :class do
on_supported_os.each do |os, os_facts|
context "on #{os}", if: os_facts[:os]['family'] == 'Debian' do
# Ubuntu 22.04 does not require a repo
context "on #{os}", if: os_facts[:os]['family'] == 'Debian' && os_facts[:os]['release']['major'] != '22.04' do
let(:facts) { os_facts }
let(:pre_condition) { 'require gluster::params' }

Expand Down

0 comments on commit 7405b17

Please sign in to comment.