diff --git a/manifests/params.pp b/manifests/params.pp index 058a421..55312e9 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -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' diff --git a/metadata.json b/metadata.json index 478cf86..69146ce 100644 --- a/metadata.json +++ b/metadata.json @@ -43,8 +43,8 @@ { "operatingsystem": "Ubuntu", "operatingsystemrelease": [ - "18.04", - "20.04" + "20.04", + "22.04" ] } ], diff --git a/spec/classes/client_spec.rb b/spec/classes/client_spec.rb index 26bd8e9..53f1efd 100644 --- a/spec/classes/client_spec.rb +++ b/spec/classes/client_spec.rb @@ -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 diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index ef4ff09..f3f55ae 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -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 @@ -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 diff --git a/spec/classes/install_spec.rb b/spec/classes/install_spec.rb index c8f53fb..7289169 100644 --- a/spec/classes/install_spec.rb +++ b/spec/classes/install_spec.rb @@ -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 @@ -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 diff --git a/spec/classes/repo_apt_spec.rb b/spec/classes/repo_apt_spec.rb index 5925ddf..f7cbbb8 100644 --- a/spec/classes/repo_apt_spec.rb +++ b/spec/classes/repo_apt_spec.rb @@ -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' }