From 27730b077f85f600539d2097b49a8ebc33924f50 Mon Sep 17 00:00:00 2001 From: Massimiliano Adamo Date: Wed, 25 Oct 2023 22:10:03 +0200 Subject: [PATCH 1/7] remove apt repo for ubuntu 22.04 --- manifests/params.pp | 6 +++++- spec/classes/repo_apt_spec.rb | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/manifests/params.pp b/manifests/params.pp index 058a4215..55312e95 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/spec/classes/repo_apt_spec.rb b/spec/classes/repo_apt_spec.rb index 5925ddfb..74792f3a 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' and os_facts[:os]['release']['major'] != '22.04' do let(:facts) { os_facts } let(:pre_condition) { 'require gluster::params' } From af4d6518015ab98bf35ea1d965933c046430456c Mon Sep 17 00:00:00 2001 From: Massimiliano Adamo Date: Wed, 25 Oct 2023 22:20:39 +0200 Subject: [PATCH 2/7] fix condition in the spec test --- spec/classes/repo_apt_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/classes/repo_apt_spec.rb b/spec/classes/repo_apt_spec.rb index 74792f3a..f7cbbb81 100644 --- a/spec/classes/repo_apt_spec.rb +++ b/spec/classes/repo_apt_spec.rb @@ -5,7 +5,7 @@ describe 'gluster::repo::apt', type: :class do on_supported_os.each do |os, os_facts| # Ubuntu 22.04 does not require a repo - context "on #{os}", if: os_facts[:os]['family'] == 'Debian' and os_facts[:os]['release']['major'] != '22.04' do + 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' } From d52b386dd27253e42bfb3ed149959002ef65b0de Mon Sep 17 00:00:00 2001 From: Massimiliano Adamo Date: Wed, 25 Oct 2023 22:26:39 +0200 Subject: [PATCH 3/7] strip support for ubuntu 18.04 and add 22.04 --- metadata.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/metadata.json b/metadata.json index 478cf868..69146ce6 100644 --- a/metadata.json +++ b/metadata.json @@ -43,8 +43,8 @@ { "operatingsystem": "Ubuntu", "operatingsystemrelease": [ - "18.04", - "20.04" + "20.04", + "22.04" ] } ], From b23bc340ab41c083088e8e32a26a0ea3c56bff70 Mon Sep 17 00:00:00 2001 From: Massimiliano Adamo Date: Thu, 26 Oct 2023 12:33:07 +0200 Subject: [PATCH 4/7] further remove apt repo on ubuntu 22.04 --- spec/classes/client_spec.rb | 17 +++++++++++------ spec/classes/init_spec.rb | 28 +++++++++++++++++----------- spec/classes/install_spec.rb | 2 +- 3 files changed, 29 insertions(+), 18 deletions(-) diff --git a/spec/classes/client_spec.rb b/spec/classes/client_spec.rb index 26bd8e9b..0a0b98e0 100644 --- a/spec/classes/client_spec.rb +++ b/spec/classes/client_spec.rb @@ -60,13 +60,18 @@ it { is_expected.to contain_class('gluster::client') } it { is_expected.to compile.with_all_deps } - it 'includes gluster::install' do - is_expected.to create_class('gluster::install').with( - repo: true, - client_package: 'glusterfs-client', - version: 'LATEST' - ) + repo_params = { + client_package: 'glusterfs-client', + version: 'LATEST' + } + if os == 'ubuntu-22.04-x86_64' + repo_params[:repo] = false + else + repo_params[:repo] = true end + it 'includes gluster::install' do + is_expected.to create_class('gluster::install').with(repo_params) + end end context 'when a version number is specified' do diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index ef4ff096..2f163bd6 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,24 @@ 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', + } + if os == 'ubuntu-22.04-x86_64' + repo_params[:repo] = false + else + repo_params[:repo] = true + end 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 a610111d..5a2dcc24 100644 --- a/spec/classes/install_spec.rb +++ b/spec/classes/install_spec.rb @@ -24,7 +24,7 @@ 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 From 40e041c76e18ce286e6eca20b56612fb26207753 Mon Sep 17 00:00:00 2001 From: Massimiliano Adamo Date: Thu, 26 Oct 2023 13:37:00 +0200 Subject: [PATCH 5/7] make rubocop happy --- spec/classes/client_spec.rb | 9 +++------ spec/classes/init_spec.rb | 6 +----- spec/classes/install_spec.rb | 1 + 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/spec/classes/client_spec.rb b/spec/classes/client_spec.rb index 0a0b98e0..8ffb38ce 100644 --- a/spec/classes/client_spec.rb +++ b/spec/classes/client_spec.rb @@ -64,14 +64,11 @@ client_package: 'glusterfs-client', version: 'LATEST' } - if os == 'ubuntu-22.04-x86_64' - repo_params[:repo] = false - else - repo_params[:repo] = true - end + repo_params[:repo] = 'ubuntu-22.04-x86_64'.eql?(os) + it 'includes gluster::install' do is_expected.to create_class('gluster::install').with(repo_params) - end + end end context 'when a version number is specified' do diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index 2f163bd6..a9241f41 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -83,11 +83,7 @@ client_package: 'glusterfs-client', version: 'LATEST', } - if os == 'ubuntu-22.04-x86_64' - repo_params[:repo] = false - else - repo_params[:repo] = true - end + repo_params[:repo] = 'ubuntu-22.04-x86_64'.eql?(os) it 'creates gluster::install' do is_expected.to create_class('gluster::install').with(repo_params) diff --git a/spec/classes/install_spec.rb b/spec/classes/install_spec.rb index 5a2dcc24..f853bca2 100644 --- a/spec/classes/install_spec.rb +++ b/spec/classes/install_spec.rb @@ -24,6 +24,7 @@ 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') } unless os == 'ubuntu-22.04-x86_64' # rubocop:enable RSpec/RepeatedExample end From 9437b80232c6680f446b637859eaa49b9a242552 Mon Sep 17 00:00:00 2001 From: Massimiliano Adamo Date: Thu, 26 Oct 2023 13:52:47 +0200 Subject: [PATCH 6/7] use negation to check os --- spec/classes/client_spec.rb | 2 +- spec/classes/init_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/classes/client_spec.rb b/spec/classes/client_spec.rb index 8ffb38ce..53f1efd7 100644 --- a/spec/classes/client_spec.rb +++ b/spec/classes/client_spec.rb @@ -64,7 +64,7 @@ client_package: 'glusterfs-client', version: 'LATEST' } - repo_params[:repo] = 'ubuntu-22.04-x86_64'.eql?(os) + repo_params[:repo] = !'ubuntu-22.04-x86_64'.eql?(os) it 'includes gluster::install' do is_expected.to create_class('gluster::install').with(repo_params) diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index a9241f41..f3f55ae7 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -83,7 +83,7 @@ client_package: 'glusterfs-client', version: 'LATEST', } - repo_params[:repo] = 'ubuntu-22.04-x86_64'.eql?(os) + repo_params[:repo] = !'ubuntu-22.04-x86_64'.eql?(os) it 'creates gluster::install' do is_expected.to create_class('gluster::install').with(repo_params) From 91087b533f3a15eaa3098adc20f3b94ec43a3d76 Mon Sep 17 00:00:00 2001 From: Massimiliano Adamo Date: Thu, 26 Oct 2023 14:05:10 +0200 Subject: [PATCH 7/7] do not raise error on Ubuntu 22.04 --- spec/classes/install_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/classes/install_spec.rb b/spec/classes/install_spec.rb index f853bca2..58600761 100644 --- a/spec/classes/install_spec.rb +++ b/spec/classes/install_spec.rb @@ -74,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