From 8b88ce61a5f65ec32d86452ff925adf795e98d72 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Thu, 2 Mar 2023 14:57:04 +0900 Subject: [PATCH] Replace legacy facts and use fact hash ... because the latest lint no longer allows usage of legacy facts and top scope fact. This also disables puppet 5 unit test job because the job is broken with structured facts. Change-Id: Id11ccaf89a44d093de29ba3c15165153eea4be56 --- .zuul.yaml | 1 + USECASES.md | 4 +- manifests/mds.pp | 4 +- manifests/osd.pp | 2 +- manifests/params.pp | 7 +- manifests/profile/mds.pp | 4 +- manifests/profile/mgr.pp | 2 +- manifests/profile/mon.pp | 4 +- manifests/repo.pp | 23 +- manifests/rgw.pp | 10 +- manifests/rgw/apache_proxy_fcgi.pp | 4 +- spec/classes/ceph_mds_spec.rb | 6 +- spec/classes/ceph_profile_base_spec.rb | 4 +- spec/classes/ceph_profile_client_spec.rb | 6 +- spec/classes/ceph_profile_fs_spec.rb | 2 +- spec/classes/ceph_profile_mds_spec.rb | 6 +- spec/classes/ceph_profile_mgr_spec.rb | 6 +- spec/classes/ceph_profile_mon_spec.rb | 8 +- spec/classes/ceph_profile_osd_spec.rb | 8 +- spec/classes/ceph_profile_params_spec.rb | 4 +- spec/classes/ceph_repo_spec.rb | 239 +++++++++--------- spec/defines/ceph_fs_spec.rb | 2 +- .../ceph_rgw_apache_proxy_fcgi_spec.rb | 9 +- spec/defines/ceph_rgw_beast_spec.rb | 15 +- spec/defines/ceph_rgw_civetweb_spec.rb | 16 +- spec/defines/ceph_rgw_spec.rb | 15 +- spec/fixtures/hieradata/hiera.yaml | 2 +- 27 files changed, 199 insertions(+), 214 deletions(-) diff --git a/.zuul.yaml b/.zuul.yaml index 4b25012e..b17eb7d8 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -15,6 +15,7 @@ name: puppet-ceph-unit-5.5-centos-8-stream parent: puppet-openstack-unit-base nodeset: centos-8-stream + voting: false # stable/ussuri is the last release with Puppet 5.x support override-checkout: stable/ussuri vars: diff --git a/USECASES.md b/USECASES.md index 3a8cbabd..118f0a4c 100644 --- a/USECASES.md +++ b/USECASES.md @@ -60,13 +60,13 @@ Enjoy your ceph cluster! mon_initial_members => 'mon1,mon2,mon3', mon_host => ',,', } - ceph::mon { $::hostname: + ceph::mon { $facts['networking']['hostname']: key => $mon_key, } Ceph::Key { inject => true, inject_as_id => 'mon.', - inject_keyring => "/var/lib/ceph/mon/ceph-${::hostname}/keyring", + inject_keyring => "/var/lib/ceph/mon/ceph-${facts['networking']['hostname']}/keyring", } ceph::key { 'client.admin': secret => $admin_key, diff --git a/manifests/mds.pp b/manifests/mds.pp index a42d9dc8..e64c0738 100644 --- a/manifests/mds.pp +++ b/manifests/mds.pp @@ -42,7 +42,7 @@ # Optional. Default is running. # # [*mds_id*] The ID of the MDS instance. -# Optional. Default is $::hostname +# Optional. Default is $facts['networking']['hostname'] # # [*keyring*] The location of the keyring used by MDSs # Optional. Same default as ceph. @@ -58,7 +58,7 @@ class ceph::mds ( $mds_data = undef, $mds_enable = true, $mds_ensure = 'running', - $mds_id = $::hostname, + $mds_id = $facts['networking']['hostname'], $keyring = undef, $cluster = 'ceph', ) inherits ceph::params { diff --git a/manifests/osd.pp b/manifests/osd.pp index ac44a2c4..c5a68e0e 100644 --- a/manifests/osd.pp +++ b/manifests/osd.pp @@ -186,7 +186,7 @@ ceph-volume lvm list ${data} timeout => $exec_timeout, tag => 'prepare', } - if (str2bool($::selinux) == true) { + if (str2bool($facts['os']['selinux']['enabled']) == true) { ensure_packages($ceph::params::pkg_policycoreutils, {'ensure' => 'present'}) exec { "fcontext_${name}": command => "/bin/true # comment to satisfy puppet syntax requirements diff --git a/manifests/params.pp b/manifests/params.pp index 2114abbc..eed797fb 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -49,7 +49,7 @@ class ceph::params ( ) { $pkg_mds = 'ceph-mds' - case $::osfamily { + case $facts['os']['family'] { 'Debian': { $pkg_radosgw = 'radosgw' $user_radosgw = 'www-data' @@ -61,7 +61,7 @@ class ceph::params ( $pkg_radosgw = 'ceph-radosgw' $user_radosgw = 'apache' $pkg_fastcgi = 'mod_fastcgi' - if (Integer.new($::os['release']['major']) > 7) { + if (Integer.new($facts['os']['release']['major']) > 7) { $pkg_policycoreutils = 'policycoreutils-python-utils' } else { $pkg_policycoreutils = 'policycoreutils-python' @@ -69,8 +69,7 @@ class ceph::params ( } default: { - fail("Unsupported osfamily: ${::osfamily} operatingsystem: ${::operatingsystem}, \ -module ${module_name} only supports osfamily Debian or RedHat") + fail("Unsupported osfamily: ${facts['os']['family']}") } } } diff --git a/manifests/profile/mds.pp b/manifests/profile/mds.pp index 2ee59daa..97b37461 100644 --- a/manifests/profile/mds.pp +++ b/manifests/profile/mds.pp @@ -27,12 +27,12 @@ class ceph::profile::mds { } if !empty($ceph::profile::params::mds_key) { - ceph::key { "mds.${::hostname}": + ceph::key { "mds.${facts['networking']['hostname']}": cap_mon => 'allow profile mds', cap_osd => 'allow rwx', cap_mds => 'allow', inject => true, - keyring_path => "/var/lib/ceph/mds/ceph-${::hostname}/keyring", + keyring_path => "/var/lib/ceph/mds/ceph-${facts['networking']['hostname']}/keyring", secret => $ceph::profile::params::mds_key, user => 'ceph', group => 'ceph' diff --git a/manifests/profile/mgr.pp b/manifests/profile/mgr.pp index d2437cdc..014da1ce 100644 --- a/manifests/profile/mgr.pp +++ b/manifests/profile/mgr.pp @@ -22,7 +22,7 @@ class ceph::profile::mgr { require ceph::profile::base - ceph::mgr { $::hostname: + ceph::mgr { $facts['networking']['hostname']: authentication_type => $ceph::profile::params::authentication_type, key => $ceph::profile::params::mgr_key, inject_key => true, diff --git a/manifests/profile/mon.pp b/manifests/profile/mon.pp index 85676105..8a2939e1 100644 --- a/manifests/profile/mon.pp +++ b/manifests/profile/mon.pp @@ -23,7 +23,7 @@ class ceph::profile::mon { require ceph::profile::base - ceph::mon { $::hostname: + ceph::mon { $facts['networking']['hostname']: authentication_type => $ceph::profile::params::authentication_type, key => $ceph::profile::params::mon_key, keyring => $ceph::profile::params::mon_keyring, @@ -33,7 +33,7 @@ class ceph::profile::mon { $defaults = { inject => true, inject_as_id => 'mon.', - inject_keyring => "/var/lib/ceph/mon/ceph-${::hostname}/keyring", + inject_keyring => "/var/lib/ceph/mon/ceph-${facts['networking']['hostname']}/keyring", } if !empty($ceph::profile::params::client_keys) { diff --git a/manifests/repo.pp b/manifests/repo.pp index bbb788dc..ac8b7f93 100644 --- a/manifests/repo.pp +++ b/manifests/repo.pp @@ -74,7 +74,7 @@ class ceph::repo ( $stream = false, $ceph_mirror = undef, ) inherits ceph::params { - case $::osfamily { + case $facts['os']['family'] { 'Debian': { include apt @@ -93,7 +93,7 @@ class ceph::repo ( apt::source { 'ceph': ensure => $ensure, location => $ceph_mirror_real, - release => $::lsbdistcodename, + release => $facts['os']['distro']['codename'], tag => 'ceph', } @@ -107,8 +107,8 @@ class ceph::repo ( apt::source { 'ceph-fastcgi': ensure => $ensure, - location => "http://gitbuilder.ceph.com/libapache-mod-fastcgi-deb-${::lsbdistcodename}-${::hardwaremodel}-basic/ref/master", - release => $::lsbdistcodename, + location => "http://gitbuilder.ceph.com/libapache-mod-fastcgi-deb-${facts['os']['distro']['codename']}-${facts['os']['hardware']}-basic/ref/master", + release => $facts['os']['distro']['codename'], require => Apt::Key['ceph-gitbuilder'], } @@ -124,23 +124,23 @@ class ceph::repo ( # If you want to deploy Ceph using packages provided by CentOS SIG # https://wiki.centos.org/SpecialInterestGroup/Storage/ if $enable_sig { - if $::operatingsystem != 'CentOS' { + if $facts['os']['name'] != 'CentOS' { warning("CentOS SIG repository is only supported on CentOS operating system, \ -not on ${::operatingsystem}, which can lead to packaging issues.") +not on ${facts['os']['name']}, which can lead to packaging issues.") } if $ceph_mirror { $ceph_mirror_real = $ceph_mirror } else { # NOTE(tobias-urdin): mirror.centos.org doesnt have https support if $stream { - if versioncmp($::operatingsystemmajrelease, '9') >= 0 { + if versioncmp($facts['os']['release']['major'], '9') >= 0 { $centos_mirror = 'mirror.stream.centos.org/SIGs' } else { $centos_mirror = 'mirror.centos.org/centos' } - $ceph_mirror_real = "http://${centos_mirror}/${::operatingsystemmajrelease}-stream/storage/x86_64/ceph-${release}/" + $ceph_mirror_real = "http://${centos_mirror}/${facts['os']['release']['major']}-stream/storage/x86_64/ceph-${release}/" } else { - $ceph_mirror_real = "http://mirror.centos.org/centos/${::operatingsystemmajrelease}/storage/x86_64/ceph-${release}/" + $ceph_mirror_real = "http://mirror.centos.org/centos/${facts['os']['release']['major']}/storage/x86_64/ceph-${release}/" } } yumrepo { 'ceph-luminous-sig': @@ -157,7 +157,7 @@ not on ${::operatingsystem}, which can lead to packaging issues.") Yumrepo['ceph-luminous-sig'] -> Yumrepo['ceph-storage-sig'] -> Package<| tag == 'ceph' |> } else { # If you want to deploy Ceph using packages provided by ceph.com repositories. - $el = $::operatingsystemmajrelease + $el = $facts['os']['release']['major'] Yumrepo { proxy => $proxy, @@ -232,8 +232,7 @@ not on ${::operatingsystem}, which can lead to packaging issues.") } default: { - fail("Unsupported osfamily: ${::osfamily} operatingsystem: ${::operatingsystem}, \ -module ${module_name} only supports osfamily Debian and RedHat") + fail("Unsupported osfamily: ${facts['os']['family']}") } } } diff --git a/manifests/rgw.pp b/manifests/rgw.pp index 8560f64c..e5883502 100644 --- a/manifests/rgw.pp +++ b/manifests/rgw.pp @@ -50,7 +50,7 @@ # Optional. Default is '/var/log/ceph/radosgw.log'. # # [*rgw_dns_name*] Hostname to use for the service. -# Optional. Default is $fqdn. +# Optional. Default is $facts['networking']['fqdn']. # # [*rgw_socket_path*] Path to socket file. # Optional. Default is '/tmp/radosgw.sock'. @@ -69,7 +69,7 @@ # Optional. Default is undef. # # [*rgw_swift_url*] The URL for the Ceph Object Gateway Swift API. -# Optional. Default is http://$fqdn:7480. +# Optional. Default is "http://${facts['networking']['fqdn']}:7480". # # [*rgw_swift_url_prefix*] The URL prefix for the Swift API. # Optional. Default is 'swift'. @@ -101,13 +101,13 @@ define ceph::rgw ( $user = $ceph::params::user_radosgw, $keyring_path = "/etc/ceph/ceph.client.${name}.keyring", $log_file = '/var/log/ceph/radosgw.log', - $rgw_dns_name = $::fqdn, + $rgw_dns_name = $facts['networking']['fqdn'], $rgw_socket_path = $ceph::params::rgw_socket_path, $rgw_print_continue = false, $rgw_port = undef, $frontend_type = 'civetweb', $rgw_frontends = undef, - $rgw_swift_url = "http://${::fqdn}:7480", + $rgw_swift_url = "http://${facts['networking']['fqdn']}:7480", $rgw_swift_url_prefix = 'swift', $rgw_swift_account_in_url = false, $rgw_swift_versioning_enabled = false, @@ -133,7 +133,7 @@ define ceph::rgw ( } ceph_config { - "client.${name}/host": value => $::hostname; + "client.${name}/host": value => $facts['networking']['hostname']; "client.${name}/keyring": value => $keyring_path; "client.${name}/log_file": value => $log_file; "client.${name}/user": value => $user; diff --git a/manifests/rgw/apache_proxy_fcgi.pp b/manifests/rgw/apache_proxy_fcgi.pp index 4a06f617..9735c504 100644 --- a/manifests/rgw/apache_proxy_fcgi.pp +++ b/manifests/rgw/apache_proxy_fcgi.pp @@ -34,7 +34,7 @@ # Optional. Default is 80. # # [*rgw_dns_name*] Hostname to use for the service. -# Optional. Default is $fqdn. +# Optional. Default is $facts['networking']['fqdn']. # # [*rewrite_rule*] RewriteRule for the apache config. # Optional. Default is '.* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]'. @@ -67,7 +67,7 @@ define ceph::rgw::apache_proxy_fcgi ( $admin_email = 'root@localhost', $docroot = '/var/www', - $rgw_dns_name = $::fqdn, + $rgw_dns_name = $facts['networking']['fqdn'], $rgw_port = 80, $rewrite_rule = '.* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]', $setenv = 'proxy-nokeepalive 1', diff --git a/spec/classes/ceph_mds_spec.rb b/spec/classes/ceph_mds_spec.rb index f4eb24ec..b8e1f87e 100644 --- a/spec/classes/ceph_mds_spec.rb +++ b/spec/classes/ceph_mds_spec.rb @@ -21,8 +21,8 @@ describe 'ceph::mds' do shared_examples 'ceph mds' do describe "activated with default params" do - it { should contain_ceph_config('mds/mds_data').with_value('/var/lib/ceph/mds/ceph-myhostname') } - it { should contain_ceph_config('mds/keyring').with_value('/var/lib/ceph/mds/ceph-myhostname/keyring') } + it { should contain_ceph_config('mds/mds_data').with_value('/var/lib/ceph/mds/ceph-foo') } + it { should contain_ceph_config('mds/keyring').with_value('/var/lib/ceph/mds/ceph-foo/keyring') } it { should contain_package('ceph-mds').with('ensure' => 'present') } end @@ -68,7 +68,7 @@ describe 'ceph::mds' do on_supported_os.each do |os,facts| context "on #{os}" do let (:facts) do - facts.merge!(OSDefaults.get_facts({:hostname => 'myhostname'})) + facts.merge!(OSDefaults.get_facts()) end it_behaves_like 'ceph mds' diff --git a/spec/classes/ceph_profile_base_spec.rb b/spec/classes/ceph_profile_base_spec.rb index b48358f3..31e73c15 100644 --- a/spec/classes/ceph_profile_base_spec.rb +++ b/spec/classes/ceph_profile_base_spec.rb @@ -39,8 +39,8 @@ describe 'ceph::profile::base' do on_supported_os.each do |os, facts| context "on #{os}" do - let(:facts) do - facts.merge({}) + let (:facts) do + facts.merge!(OSDefaults.get_facts()) end it_behaves_like 'ceph profile base' diff --git a/spec/classes/ceph_profile_client_spec.rb b/spec/classes/ceph_profile_client_spec.rb index a9f4f24a..25f6ac23 100644 --- a/spec/classes/ceph_profile_client_spec.rb +++ b/spec/classes/ceph_profile_client_spec.rb @@ -58,7 +58,7 @@ describe 'ceph::profile::client' do context 'with the specific client keys defined in client.yaml' do before :each do - facts.merge!( :hostname => 'client') + facts[:networking]['hostname'] = 'client' end it { should contain_class('ceph::profile::base') } @@ -91,8 +91,8 @@ describe 'ceph::profile::client' do on_supported_os.each do |os, facts| context "on #{os}" do - let(:facts) do - facts.merge({}) + let (:facts) do + facts.merge!(OSDefaults.get_facts()) end it_behaves_like 'ceph profile client' diff --git a/spec/classes/ceph_profile_fs_spec.rb b/spec/classes/ceph_profile_fs_spec.rb index 237742dd..0ce32082 100644 --- a/spec/classes/ceph_profile_fs_spec.rb +++ b/spec/classes/ceph_profile_fs_spec.rb @@ -28,7 +28,7 @@ describe 'ceph::profile::fs' do on_supported_os.each do |os, facts| context "on #{os}" do let (:facts) do - facts.merge!(OSDefaults.get_facts({:hostname => 'myhostname'})) + facts.merge!(OSDefaults.get_facts()) end it_behaves_like 'ceph profile fs' diff --git a/spec/classes/ceph_profile_mds_spec.rb b/spec/classes/ceph_profile_mds_spec.rb index 53e267a3..5c02f7b8 100644 --- a/spec/classes/ceph_profile_mds_spec.rb +++ b/spec/classes/ceph_profile_mds_spec.rb @@ -24,12 +24,12 @@ describe 'ceph::profile::mds' do it { should contain_class('ceph::mds').with( 'public_addr' => '10.11.12.2', )} - it { should contain_ceph__key('mds.myhostname').with( + it { should contain_ceph__key('mds.foo').with( :cap_mon => 'allow profile mds', :cap_osd => 'allow rwx', :cap_mds => 'allow', :inject => true, - :keyring_path => "/var/lib/ceph/mds/ceph-myhostname/keyring", + :keyring_path => "/var/lib/ceph/mds/ceph-foo/keyring", :secret => 'AQDLOh1VgEp6FRAAFzT7Zw+Y9V6JJExQAsRnRQ==', :user => 'ceph', :group => 'ceph' @@ -39,7 +39,7 @@ describe 'ceph::profile::mds' do on_supported_os.each do |os, facts| context "on #{os}" do let (:facts) do - facts.merge!(OSDefaults.get_facts({:hostname => 'myhostname'})) + facts.merge!(OSDefaults.get_facts()) end it_behaves_like 'ceph profile mds' diff --git a/spec/classes/ceph_profile_mgr_spec.rb b/spec/classes/ceph_profile_mgr_spec.rb index 35134e60..66191e62 100644 --- a/spec/classes/ceph_profile_mgr_spec.rb +++ b/spec/classes/ceph_profile_mgr_spec.rb @@ -20,7 +20,7 @@ require 'spec_helper' describe 'ceph::profile::mgr' do shared_examples 'ceph profile mgr' do - it { should contain_ceph__mgr('first').with( + it { should contain_ceph__mgr('foo').with( :authentication_type => 'cephx', :key => 'AQASGFDFUHBHDG9SDdsyffV1xgsn1pgr3GcKPg==', :inject_key => true) @@ -29,8 +29,8 @@ describe 'ceph::profile::mgr' do on_supported_os.each do |os, facts| context "on #{os}" do - let(:facts) do - facts.merge({:hostname => 'first'}) + let (:facts) do + facts.merge!(OSDefaults.get_facts()) end it_behaves_like 'ceph profile mgr' diff --git a/spec/classes/ceph_profile_mon_spec.rb b/spec/classes/ceph_profile_mon_spec.rb index 180d0b22..07215d46 100644 --- a/spec/classes/ceph_profile_mon_spec.rb +++ b/spec/classes/ceph_profile_mon_spec.rb @@ -21,7 +21,7 @@ describe 'ceph::profile::mon' do shared_examples 'ceph profile mon' do - it { should contain_ceph__mon('first').with( + it { should contain_ceph__mon('foo').with( :authentication_type => 'cephx', :key => 'AQATGHJTUCBqIBAA7M2yafV1xctn1pgr3GcKPg==', :public_addr => '10.11.12.2') @@ -57,15 +57,15 @@ describe 'ceph::profile::mon' do 'defaults' => { 'inject' => true, 'inject_as_id' => 'mon.', - 'inject_keyring' => '/var/lib/ceph/mon/ceph-first/keyring' + 'inject_keyring' => '/var/lib/ceph/mon/ceph-foo/keyring' } )} end on_supported_os.each do |os, facts| context "on #{os}" do - let(:facts) do - facts.merge({:hostname => 'first'}) + let (:facts) do + facts.merge!(OSDefaults.get_facts()) end it_behaves_like 'ceph profile mon' diff --git a/spec/classes/ceph_profile_osd_spec.rb b/spec/classes/ceph_profile_osd_spec.rb index 736ec74c..d0eb8ef9 100644 --- a/spec/classes/ceph_profile_osd_spec.rb +++ b/spec/classes/ceph_profile_osd_spec.rb @@ -23,7 +23,7 @@ describe 'ceph::profile::osd' do context 'with the default osd defined in common.yaml' do before :each do - facts.merge!( :hostname => 'osd') + facts[:networking]['hostname'] = 'osd' end it { should contain_class('ceph::profile::client') } @@ -34,7 +34,7 @@ describe 'ceph::profile::osd' do context 'with the host specific first.yaml' do before :each do - facts.merge!( :hostname => 'first') + facts[:networking]['hostname'] = 'first' end it { should contain_class('ceph::profile::client') } @@ -44,8 +44,8 @@ describe 'ceph::profile::osd' do on_supported_os.each do |os, facts| context "on #{os}" do - let(:facts) do - facts.merge({}) + let (:facts) do + facts.merge!(OSDefaults.get_facts()) end it_behaves_like 'ceph profile osd' diff --git a/spec/classes/ceph_profile_params_spec.rb b/spec/classes/ceph_profile_params_spec.rb index 6eb41512..84843f8a 100644 --- a/spec/classes/ceph_profile_params_spec.rb +++ b/spec/classes/ceph_profile_params_spec.rb @@ -48,8 +48,8 @@ describe 'ceph::profile::params' do on_supported_os.each do |os, facts| context "on #{os}" do - let(:facts) do - facts.merge({}) + let (:facts) do + facts.merge!(OSDefaults.get_facts()) end it_behaves_like 'ceph profile params' diff --git a/spec/classes/ceph_repo_spec.rb b/spec/classes/ceph_repo_spec.rb index dabd50bd..976ad63d 100644 --- a/spec/classes/ceph_repo_spec.rb +++ b/spec/classes/ceph_repo_spec.rb @@ -30,7 +30,7 @@ describe 'ceph::repo' do it { should contain_apt__source('ceph').with( :location => 'http://download.ceph.com/debian-nautilus/', - :release => facts[:lsbdistcodename], + :release => facts[:os]['distro']['codename'], )} end @@ -43,7 +43,7 @@ describe 'ceph::repo' do it { should contain_apt__source('ceph').with( :location => 'http://myserver.com/debian-nautilus/', - :release => facts[:lsbdistcodename], + :release => facts[:os]['distro']['codename'], )} end @@ -61,13 +61,13 @@ describe 'ceph::repo' do it { should contain_apt__source('ceph').with( :location => 'http://download.ceph.com/debian-nautilus/', - :release => facts[:lsbdistcodename], + :release => facts[:os]['distro']['codename'], )} it { should contain_apt__source('ceph-fastcgi').with( :ensure => 'present', - :location => "http://gitbuilder.ceph.com/libapache-mod-fastcgi-deb-#{facts[:lsbdistcodename]}-x86_64-basic/ref/master", - :release => facts[:lsbdistcodename], + :location => "http://gitbuilder.ceph.com/libapache-mod-fastcgi-deb-#{facts[:os]['distro']['codename']}-x86_64-basic/ref/master", + :release => facts[:os]['distro']['codename'], :require => 'Apt::Key[ceph-gitbuilder]' )} end @@ -83,13 +83,13 @@ describe 'ceph::repo' do it { should contain_apt__source('ceph').with( :ensure => 'absent', :location => 'http://download.ceph.com/debian-nautilus/', - :release => facts[:lsbdistcodename], + :release => facts[:os]['distro']['codename'], )} it { should contain_apt__source('ceph-fastcgi').with( :ensure => 'absent', - :location => "http://gitbuilder.ceph.com/libapache-mod-fastcgi-deb-#{facts[:lsbdistcodename]}-x86_64-basic/ref/master", - :release => facts[:lsbdistcodename], + :location => "http://gitbuilder.ceph.com/libapache-mod-fastcgi-deb-#{facts[:os]['distro']['codename']}-x86_64-basic/ref/master", + :release => facts[:os]['distro']['codename'], :require => 'Apt::Key[ceph-gitbuilder]' )} end @@ -97,14 +97,14 @@ describe 'ceph::repo' do shared_examples 'ceph::repo on RedHat' do context 'with default params' do - it { should contain_yumrepo("ext-epel-#{facts[:operatingsystemmajrelease]}").with( + it { should contain_yumrepo("ext-epel-#{facts[:os]['release']['major']}").with( :enabled => '1', - :descr => "External EPEL #{facts[:operatingsystemmajrelease]}", - :name => "ext-epel-#{facts[:operatingsystemmajrelease]}", + :descr => "External EPEL #{facts[:os]['release']['major']}", + :name => "ext-epel-#{facts[:os]['release']['major']}", :baseurl => 'absent', :gpgcheck => '1', - :gpgkey => "https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-#{facts[:operatingsystemmajrelease]}", - :mirrorlist => "http://mirrors.fedoraproject.org/metalink?repo=epel-#{facts[:operatingsystemmajrelease]}&arch=$basearch", + :gpgkey => "https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-#{facts[:os]['release']['major']}", + :mirrorlist => "http://mirrors.fedoraproject.org/metalink?repo=epel-#{facts[:os]['release']['major']}&arch=$basearch", :priority => '20', :exclude => 'python-ceph-compat python-rbd python-rados python-cephfs', )} @@ -113,7 +113,7 @@ describe 'ceph::repo' do :enabled => '1', :descr => 'External Ceph nautilus', :name => 'ext-ceph-nautilus', - :baseurl => "http://download.ceph.com/rpm-nautilus/el#{facts[:operatingsystemmajrelease]}/$basearch", + :baseurl => "http://download.ceph.com/rpm-nautilus/el#{facts[:os]['release']['major']}/$basearch", :gpgcheck => '1', :gpgkey => 'https://download.ceph.com/keys/release.asc', :mirrorlist => 'absent', @@ -124,7 +124,7 @@ describe 'ceph::repo' do :enabled => '1', :descr => 'External Ceph noarch', :name => 'ext-ceph-nautilus-noarch', - :baseurl => "http://download.ceph.com/rpm-nautilus/el#{facts[:operatingsystemmajrelease]}/noarch", + :baseurl => "http://download.ceph.com/rpm-nautilus/el#{facts[:os]['release']['major']}/noarch", :gpgcheck => '1', :gpgkey => 'https://download.ceph.com/keys/release.asc', :mirrorlist => 'absent', @@ -139,14 +139,14 @@ describe 'ceph::repo' do } end - it { should contain_yumrepo("ext-epel-#{facts[:operatingsystemmajrelease]}").with( + it { should contain_yumrepo("ext-epel-#{facts[:os]['release']['major']}").with( :enabled => '1', - :descr => "External EPEL #{facts[:operatingsystemmajrelease]}", - :name => "ext-epel-#{facts[:operatingsystemmajrelease]}", + :descr => "External EPEL #{facts[:os]['release']['major']}", + :name => "ext-epel-#{facts[:os]['release']['major']}", :baseurl => 'absent', :gpgcheck => '1', - :gpgkey => "https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-#{facts[:operatingsystemmajrelease]}", - :mirrorlist => "http://mirrors.fedoraproject.org/metalink?repo=epel-#{facts[:operatingsystemmajrelease]}&arch=$basearch", + :gpgkey => "https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-#{facts[:os]['release']['major']}", + :mirrorlist => "http://mirrors.fedoraproject.org/metalink?repo=epel-#{facts[:os]['release']['major']}&arch=$basearch", :priority => '20', :exclude => 'python-ceph-compat python-rbd python-rados python-cephfs', )} @@ -155,7 +155,7 @@ describe 'ceph::repo' do :enabled => '1', :descr => 'External Ceph firefly', :name => 'ext-ceph-firefly', - :baseurl => "http://download.ceph.com/rpm-firefly/el#{facts[:operatingsystemmajrelease]}/$basearch", + :baseurl => "http://download.ceph.com/rpm-firefly/el#{facts[:os]['release']['major']}/$basearch", :gpgcheck => '1', :gpgkey => 'https://download.ceph.com/keys/release.asc', :mirrorlist => 'absent', @@ -166,7 +166,7 @@ describe 'ceph::repo' do :enabled => '1', :descr => 'External Ceph noarch', :name => 'ext-ceph-firefly-noarch', - :baseurl => "http://download.ceph.com/rpm-firefly/el#{facts[:operatingsystemmajrelease]}/noarch", + :baseurl => "http://download.ceph.com/rpm-firefly/el#{facts[:os]['release']['major']}/noarch", :gpgcheck => '1', :gpgkey => 'https://download.ceph.com/keys/release.asc', :mirrorlist => 'absent', @@ -181,7 +181,7 @@ describe 'ceph::repo' do } end - it { should_not contain_yumrepo("ext-epel-#{facts[:operatingsystemmajrelease]}") } + it { should_not contain_yumrepo("ext-epel-#{facts[:os]['release']['major']}") } end context 'when using a proxy for yum repositories' do @@ -193,14 +193,14 @@ describe 'ceph::repo' do } end - it { should contain_yumrepo("ext-epel-#{facts[:operatingsystemmajrelease]}").with( + it { should contain_yumrepo("ext-epel-#{facts[:os]['release']['major']}").with( :enabled => '1', - :descr => "External EPEL #{facts[:operatingsystemmajrelease]}", - :name => "ext-epel-#{facts[:operatingsystemmajrelease]}", + :descr => "External EPEL #{facts[:os]['release']['major']}", + :name => "ext-epel-#{facts[:os]['release']['major']}", :baseurl => 'absent', :gpgcheck => '1', - :gpgkey => "https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-#{facts[:operatingsystemmajrelease]}", - :mirrorlist => "http://mirrors.fedoraproject.org/metalink?repo=epel-#{facts[:operatingsystemmajrelease]}&arch=$basearch", + :gpgkey => "https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-#{facts[:os]['release']['major']}", + :mirrorlist => "http://mirrors.fedoraproject.org/metalink?repo=epel-#{facts[:os]['release']['major']}&arch=$basearch", :priority => '20', :exclude => 'python-ceph-compat python-rbd python-rados python-cephfs', :proxy => 'http://someproxy.com:8080/', @@ -212,7 +212,7 @@ describe 'ceph::repo' do :enabled => '1', :descr => 'External Ceph nautilus', :name => 'ext-ceph-nautilus', - :baseurl => "http://download.ceph.com/rpm-nautilus/el#{facts[:operatingsystemmajrelease]}/$basearch", + :baseurl => "http://download.ceph.com/rpm-nautilus/el#{facts[:os]['release']['major']}/$basearch", :gpgcheck => '1', :gpgkey => 'https://download.ceph.com/keys/release.asc', :mirrorlist => 'absent', @@ -226,7 +226,7 @@ describe 'ceph::repo' do :enabled => '1', :descr => 'External Ceph noarch', :name => 'ext-ceph-nautilus-noarch', - :baseurl => "http://download.ceph.com/rpm-nautilus/el#{facts[:operatingsystemmajrelease]}/noarch", + :baseurl => "http://download.ceph.com/rpm-nautilus/el#{facts[:os]['release']['major']}/noarch", :gpgcheck => '1', :gpgkey => 'https://download.ceph.com/keys/release.asc', :mirrorlist => 'absent', @@ -245,14 +245,14 @@ describe 'ceph::repo' do } end - it { should contain_yumrepo("ext-epel-#{facts[:operatingsystemmajrelease]}").with( + it { should contain_yumrepo("ext-epel-#{facts[:os]['release']['major']}").with( :enabled => '0', - :descr => "External EPEL #{facts[:operatingsystemmajrelease]}", - :name => "ext-epel-#{facts[:operatingsystemmajrelease]}", + :descr => "External EPEL #{facts[:os]['release']['major']}", + :name => "ext-epel-#{facts[:os]['release']['major']}", :baseurl => 'absent', :gpgcheck => '1', - :gpgkey => "https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-#{facts[:operatingsystemmajrelease]}", - :mirrorlist => "http://mirrors.fedoraproject.org/metalink?repo=epel-#{facts[:operatingsystemmajrelease]}&arch=$basearch", + :gpgkey => "https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-#{facts[:os]['release']['major']}", + :mirrorlist => "http://mirrors.fedoraproject.org/metalink?repo=epel-#{facts[:os]['release']['major']}&arch=$basearch", :priority => '20', :exclude => 'python-ceph-compat python-rbd python-rados python-cephfs', )} @@ -261,7 +261,7 @@ describe 'ceph::repo' do :enabled => '0', :descr => 'External Ceph nautilus', :name => 'ext-ceph-nautilus', - :baseurl => "http://download.ceph.com/rpm-nautilus/el#{facts[:operatingsystemmajrelease]}/$basearch", + :baseurl => "http://download.ceph.com/rpm-nautilus/el#{facts[:os]['release']['major']}/$basearch", :gpgcheck => '1', :gpgkey => 'https://download.ceph.com/keys/release.asc', :mirrorlist => 'absent', @@ -272,7 +272,7 @@ describe 'ceph::repo' do :enabled => '0', :descr => 'External Ceph noarch', :name => 'ext-ceph-nautilus-noarch', - :baseurl => "http://download.ceph.com/rpm-nautilus/el#{facts[:operatingsystemmajrelease]}/noarch", + :baseurl => "http://download.ceph.com/rpm-nautilus/el#{facts[:os]['release']['major']}/noarch", :gpgcheck => '1', :gpgkey => 'https://download.ceph.com/keys/release.asc', :mirrorlist => 'absent', @@ -283,7 +283,7 @@ describe 'ceph::repo' do :enabled => '0', :descr => 'FastCGI basearch packages for Ceph', :name => 'ext-ceph-fastcgi', - :baseurl => "http://gitbuilder.ceph.com/mod_fastcgi-rpm-rhel#{facts[:operatingsystemmajrelease]}-x86_64-basic/ref/master", + :baseurl => "http://gitbuilder.ceph.com/mod_fastcgi-rpm-rhel#{facts[:os]['release']['major']}-x86_64-basic/ref/master", :gpgcheck => '1', :gpgkey => 'https://download.ceph.com/keys/autobuild.asc', :mirrorlist => 'absent', @@ -298,14 +298,14 @@ describe 'ceph::repo' do } end - it { should contain_yumrepo("ext-epel-#{facts[:operatingsystemmajrelease]}").with( + it { should contain_yumrepo("ext-epel-#{facts[:os]['release']['major']}").with( :enabled => '1', - :descr => "External EPEL #{facts[:operatingsystemmajrelease]}", - :name => "ext-epel-#{facts[:operatingsystemmajrelease]}", + :descr => "External EPEL #{facts[:os]['release']['major']}", + :name => "ext-epel-#{facts[:os]['release']['major']}", :baseurl => 'absent', :gpgcheck => '1', - :gpgkey => "https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-#{facts[:operatingsystemmajrelease]}", - :mirrorlist => "http://mirrors.fedoraproject.org/metalink?repo=epel-#{facts[:operatingsystemmajrelease]}&arch=$basearch", + :gpgkey => "https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-#{facts[:os]['release']['major']}", + :mirrorlist => "http://mirrors.fedoraproject.org/metalink?repo=epel-#{facts[:os]['release']['major']}&arch=$basearch", :priority => '20', :exclude => 'python-ceph-compat python-rbd python-rados python-cephfs', )} @@ -314,7 +314,7 @@ describe 'ceph::repo' do :enabled => '1', :descr => 'External Ceph nautilus', :name => 'ext-ceph-nautilus', - :baseurl => "http://download.ceph.com/rpm-nautilus/el#{facts[:operatingsystemmajrelease]}/$basearch", + :baseurl => "http://download.ceph.com/rpm-nautilus/el#{facts[:os]['release']['major']}/$basearch", :gpgcheck => '1', :gpgkey => 'https://download.ceph.com/keys/release.asc', :mirrorlist => 'absent', @@ -325,7 +325,7 @@ describe 'ceph::repo' do :enabled => '1', :descr => 'External Ceph noarch', :name => 'ext-ceph-nautilus-noarch', - :baseurl => "http://download.ceph.com/rpm-nautilus/el#{facts[:operatingsystemmajrelease]}/noarch", + :baseurl => "http://download.ceph.com/rpm-nautilus/el#{facts[:os]['release']['major']}/noarch", :gpgcheck => '1', :gpgkey => 'https://download.ceph.com/keys/release.asc', :mirrorlist => 'absent', @@ -336,7 +336,7 @@ describe 'ceph::repo' do :enabled => '1', :descr => 'FastCGI basearch packages for Ceph', :name => 'ext-ceph-fastcgi', - :baseurl => "http://gitbuilder.ceph.com/mod_fastcgi-rpm-rhel#{facts[:operatingsystemmajrelease]}-x86_64-basic/ref/master", + :baseurl => "http://gitbuilder.ceph.com/mod_fastcgi-rpm-rhel#{facts[:os]['release']['major']}-x86_64-basic/ref/master", :gpgcheck => '1', :gpgkey => 'https://download.ceph.com/keys/autobuild.asc', :mirrorlist => 'absent', @@ -347,14 +347,14 @@ describe 'ceph::repo' do shared_examples 'ceph::repo on CentOS' do context 'with default params' do - it { should contain_yumrepo("ext-epel-#{facts[:operatingsystemmajrelease]}").with( + it { should contain_yumrepo("ext-epel-#{facts[:os]['release']['major']}").with( :enabled => '1', - :descr => "External EPEL #{facts[:operatingsystemmajrelease]}", - :name => "ext-epel-#{facts[:operatingsystemmajrelease]}", + :descr => "External EPEL #{facts[:os]['release']['major']}", + :name => "ext-epel-#{facts[:os]['release']['major']}", :baseurl => 'absent', :gpgcheck => '1', - :gpgkey => "https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-#{facts[:operatingsystemmajrelease]}", - :mirrorlist => "http://mirrors.fedoraproject.org/metalink?repo=epel-#{facts[:operatingsystemmajrelease]}&arch=$basearch", + :gpgkey => "https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-#{facts[:os]['release']['major']}", + :mirrorlist => "http://mirrors.fedoraproject.org/metalink?repo=epel-#{facts[:os]['release']['major']}&arch=$basearch", :priority => '20', :exclude => 'python-ceph-compat python-rbd python-rados python-cephfs', )} @@ -363,7 +363,7 @@ describe 'ceph::repo' do :enabled => '1', :descr => 'External Ceph nautilus', :name => 'ext-ceph-nautilus', - :baseurl => "http://download.ceph.com/rpm-nautilus/el#{facts[:operatingsystemmajrelease]}/$basearch", + :baseurl => "http://download.ceph.com/rpm-nautilus/el#{facts[:os]['release']['major']}/$basearch", :gpgcheck => '1', :gpgkey => 'https://download.ceph.com/keys/release.asc', :mirrorlist => 'absent', @@ -374,7 +374,7 @@ describe 'ceph::repo' do :enabled => '1', :descr => 'External Ceph noarch', :name => 'ext-ceph-nautilus-noarch', - :baseurl => "http://download.ceph.com/rpm-nautilus/el#{facts[:operatingsystemmajrelease]}/noarch", + :baseurl => "http://download.ceph.com/rpm-nautilus/el#{facts[:os]['release']['major']}/noarch", :gpgcheck => '1', :gpgkey => 'https://download.ceph.com/keys/release.asc', :mirrorlist => 'absent', @@ -389,14 +389,14 @@ describe 'ceph::repo' do } end - it { should contain_yumrepo("ext-epel-#{facts[:operatingsystemmajrelease]}").with( + it { should contain_yumrepo("ext-epel-#{facts[:os]['release']['major']}").with( :enabled => '1', - :descr => "External EPEL #{facts[:operatingsystemmajrelease]}", - :name => "ext-epel-#{facts[:operatingsystemmajrelease]}", + :descr => "External EPEL #{facts[:os]['release']['major']}", + :name => "ext-epel-#{facts[:os]['release']['major']}", :baseurl => 'absent', :gpgcheck => '1', - :gpgkey => "https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-#{facts[:operatingsystemmajrelease]}", - :mirrorlist => "http://mirrors.fedoraproject.org/metalink?repo=epel-#{facts[:operatingsystemmajrelease]}&arch=$basearch", + :gpgkey => "https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-#{facts[:os]['release']['major']}", + :mirrorlist => "http://mirrors.fedoraproject.org/metalink?repo=epel-#{facts[:os]['release']['major']}&arch=$basearch", :priority => '20', :exclude => 'python-ceph-compat python-rbd python-rados python-cephfs', )} @@ -405,7 +405,7 @@ describe 'ceph::repo' do :enabled => '1', :descr => 'External Ceph firefly', :name => 'ext-ceph-firefly', - :baseurl => "http://download.ceph.com/rpm-firefly/el#{facts[:operatingsystemmajrelease]}/$basearch", + :baseurl => "http://download.ceph.com/rpm-firefly/el#{facts[:os]['release']['major']}/$basearch", :gpgcheck => '1', :gpgkey => 'https://download.ceph.com/keys/release.asc', :mirrorlist => 'absent', @@ -416,7 +416,7 @@ describe 'ceph::repo' do :enabled => '1', :descr => 'External Ceph noarch', :name => 'ext-ceph-firefly-noarch', - :baseurl => "http://download.ceph.com/rpm-firefly/el#{facts[:operatingsystemmajrelease]}/noarch", + :baseurl => "http://download.ceph.com/rpm-firefly/el#{facts[:os]['release']['major']}/noarch", :gpgcheck => '1', :gpgkey => 'https://download.ceph.com/keys/release.asc', :mirrorlist => 'absent', @@ -431,49 +431,13 @@ describe 'ceph::repo' do } end - it { should_not contain_yumrepo("ext-epel-#{facts[:operatingsystemmajrelease]}") } + it { should_not contain_yumrepo("ext-epel-#{facts[:os]['release']['major']}") } it { should_not contain_yumrepo('ext-ceph') } it { should_not contain_yumrepo('ext-ceph-noarch') } it { should contain_yumrepo('ceph-luminous-sig').with_ensure('absent') } it { should contain_yumrepo('ceph-storage-sig').with( - :baseurl => "http://mirror.centos.org/centos/#{facts[:operatingsystemmajrelease]}/storage/x86_64/ceph-nautilus/", - )} - end - - context 'when using CentOS SIG repository and CentOS Stream 8' do - before do - facts.merge!( :operatingsystemmajrelease => "8" ) - end - - let :params do - { - :enable_sig => true, - :stream => true, - } - end - - it { should contain_yumrepo('ceph-luminous-sig').with_ensure('absent') } - - it { should contain_yumrepo('ceph-storage-sig').with( - :baseurl => 'http://mirror.centos.org/centos/8-stream/storage/x86_64/ceph-nautilus/', - )} - end - - context 'when using CentOS SIG repository and CentOS Stream 9' do - before do - facts.merge!( :operatingsystemmajrelease => "9" ) - end - - let :params do - { - :enable_sig => true, - :stream => true, - } - end - - it { should contain_yumrepo('ceph-storage-sig').with( - :baseurl => 'http://mirror.stream.centos.org/SIGs/9-stream/storage/x86_64/ceph-nautilus/', + :baseurl => "http://mirror.centos.org/centos/#{facts[:os]['release']['major']}/storage/x86_64/ceph-nautilus/", )} end @@ -485,7 +449,7 @@ describe 'ceph::repo' do } end - it { should_not contain_yumrepo("ext-epel-#{facts[:operatingsystemmajrelease]}") } + it { should_not contain_yumrepo("ext-epel-#{facts[:os]['release']['major']}") } it { should_not contain_yumrepo('ext-ceph') } it { should_not contain_yumrepo('ext-ceph-noarch') } it { should contain_yumrepo('ceph-luminous-sig').with_ensure('absent') } @@ -503,14 +467,14 @@ describe 'ceph::repo' do } end - it { should contain_yumrepo("ext-epel-#{facts[:operatingsystemmajrelease]}").with( + it { should contain_yumrepo("ext-epel-#{facts[:os]['release']['major']}").with( :enabled => '0', - :descr => "External EPEL #{facts[:operatingsystemmajrelease]}", - :name => "ext-epel-#{facts[:operatingsystemmajrelease]}", + :descr => "External EPEL #{facts[:os]['release']['major']}", + :name => "ext-epel-#{facts[:os]['release']['major']}", :baseurl => 'absent', :gpgcheck => '1', - :gpgkey => "https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-#{facts[:operatingsystemmajrelease]}", - :mirrorlist => "http://mirrors.fedoraproject.org/metalink?repo=epel-#{facts[:operatingsystemmajrelease]}&arch=$basearch", + :gpgkey => "https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-#{facts[:os]['release']['major']}", + :mirrorlist => "http://mirrors.fedoraproject.org/metalink?repo=epel-#{facts[:os]['release']['major']}&arch=$basearch", :priority => '20', :exclude => 'python-ceph-compat python-rbd python-rados python-cephfs', )} @@ -519,7 +483,7 @@ describe 'ceph::repo' do :enabled => '0', :descr => 'External Ceph nautilus', :name => 'ext-ceph-nautilus', - :baseurl => "http://download.ceph.com/rpm-nautilus/el#{facts[:operatingsystemmajrelease]}/$basearch", + :baseurl => "http://download.ceph.com/rpm-nautilus/el#{facts[:os]['release']['major']}/$basearch", :gpgcheck => '1', :gpgkey => 'https://download.ceph.com/keys/release.asc', :mirrorlist => 'absent', @@ -530,7 +494,7 @@ describe 'ceph::repo' do :enabled => '0', :descr => 'External Ceph noarch', :name => 'ext-ceph-nautilus-noarch', - :baseurl => "http://download.ceph.com/rpm-nautilus/el#{facts[:operatingsystemmajrelease]}/noarch", + :baseurl => "http://download.ceph.com/rpm-nautilus/el#{facts[:os]['release']['major']}/noarch", :gpgcheck => '1', :gpgkey => 'https://download.ceph.com/keys/release.asc', :mirrorlist => 'absent', @@ -541,7 +505,7 @@ describe 'ceph::repo' do :enabled => '0', :descr => 'FastCGI basearch packages for Ceph', :name => 'ext-ceph-fastcgi', - :baseurl => "http://gitbuilder.ceph.com/mod_fastcgi-rpm-rhel#{facts[:operatingsystemmajrelease]}-x86_64-basic/ref/master", + :baseurl => "http://gitbuilder.ceph.com/mod_fastcgi-rpm-rhel#{facts[:os]['release']['major']}-x86_64-basic/ref/master", :gpgcheck => '1', :gpgkey => 'https://download.ceph.com/keys/autobuild.asc', :mirrorlist => 'absent', @@ -556,14 +520,14 @@ describe 'ceph::repo' do } end - it { should contain_yumrepo("ext-epel-#{facts[:operatingsystemmajrelease]}").with( + it { should contain_yumrepo("ext-epel-#{facts[:os]['release']['major']}").with( :enabled => '1', - :descr => "External EPEL #{facts[:operatingsystemmajrelease]}", - :name => "ext-epel-#{facts[:operatingsystemmajrelease]}", + :descr => "External EPEL #{facts[:os]['release']['major']}", + :name => "ext-epel-#{facts[:os]['release']['major']}", :baseurl => 'absent', :gpgcheck => '1', - :gpgkey => "https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-#{facts[:operatingsystemmajrelease]}", - :mirrorlist => "http://mirrors.fedoraproject.org/metalink?repo=epel-#{facts[:operatingsystemmajrelease]}&arch=$basearch", + :gpgkey => "https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-#{facts[:os]['release']['major']}", + :mirrorlist => "http://mirrors.fedoraproject.org/metalink?repo=epel-#{facts[:os]['release']['major']}&arch=$basearch", :priority => '20', :exclude => 'python-ceph-compat python-rbd python-rados python-cephfs', )} @@ -572,7 +536,7 @@ describe 'ceph::repo' do :enabled => '1', :descr => 'External Ceph nautilus', :name => 'ext-ceph-nautilus', - :baseurl => "http://download.ceph.com/rpm-nautilus/el#{facts[:operatingsystemmajrelease]}/$basearch", + :baseurl => "http://download.ceph.com/rpm-nautilus/el#{facts[:os]['release']['major']}/$basearch", :gpgcheck => '1', :gpgkey => 'https://download.ceph.com/keys/release.asc', :mirrorlist => 'absent', @@ -583,7 +547,7 @@ describe 'ceph::repo' do :enabled => '1', :descr => 'External Ceph noarch', :name => 'ext-ceph-nautilus-noarch', - :baseurl => "http://download.ceph.com/rpm-nautilus/el#{facts[:operatingsystemmajrelease]}/noarch", + :baseurl => "http://download.ceph.com/rpm-nautilus/el#{facts[:os]['release']['major']}/noarch", :gpgcheck => '1', :gpgkey => 'https://download.ceph.com/keys/release.asc', :mirrorlist => 'absent', @@ -594,7 +558,7 @@ describe 'ceph::repo' do :enabled => '1', :descr => 'FastCGI basearch packages for Ceph', :name => 'ext-ceph-fastcgi', - :baseurl => "http://gitbuilder.ceph.com/mod_fastcgi-rpm-rhel#{facts[:operatingsystemmajrelease]}-x86_64-basic/ref/master", + :baseurl => "http://gitbuilder.ceph.com/mod_fastcgi-rpm-rhel#{facts[:os]['release']['major']}-x86_64-basic/ref/master", :gpgcheck => '1', :gpgkey => 'https://download.ceph.com/keys/autobuild.asc', :mirrorlist => 'absent', @@ -603,18 +567,53 @@ describe 'ceph::repo' do end end - on_supported_os({ - :supported_os => OSDefaults.get_supported_os - }).each do |os,facts| + shared_examples 'ceph::repo on CentOS Stream 7' do + # No specific test cases + end + + shared_examples 'ceph::repo on CentOS Stream 8' do + context 'when using CentOS SIG repository and CentOS Stream 8' do + let :params do + { + :enable_sig => true, + :stream => true, + } + end + + it { should contain_yumrepo('ceph-luminous-sig').with_ensure('absent') } + + it { should contain_yumrepo('ceph-storage-sig').with( + :baseurl => 'http://mirror.centos.org/centos/8-stream/storage/x86_64/ceph-nautilus/', + )} + end + end + + shared_examples 'ceph::repo on CentOS Stream 9' do + context 'when using CentOS SIG repository and CentOS Stream 9' do + let :params do + { + :enable_sig => true, + :stream => true, + } + end + + it { should contain_yumrepo('ceph-storage-sig').with( + :baseurl => 'http://mirror.stream.centos.org/SIGs/9-stream/storage/x86_64/ceph-nautilus/', + )} + end + end + + on_supported_os.each do |os, facts| context "on #{os}" do let (:facts) do facts.merge!(OSDefaults.get_facts()) end - it_behaves_like "ceph::repo on #{facts[:osfamily]}" + it_behaves_like "ceph::repo on #{facts[:os]['family']}" - if facts[:operatingsystem] == 'CentOS' + if facts[:os]['name'] == 'CentOS' it_behaves_like 'ceph::repo on CentOS' + it_behaves_like "ceph::repo on CentOS Stream #{facts[:os]['release']['major']}" end end end diff --git a/spec/defines/ceph_fs_spec.rb b/spec/defines/ceph_fs_spec.rb index 8ca62caa..7436faa3 100644 --- a/spec/defines/ceph_fs_spec.rb +++ b/spec/defines/ceph_fs_spec.rb @@ -39,7 +39,7 @@ describe 'ceph::fs' do on_supported_os.each do |os,facts| context "on #{os}" do let (:facts) do - facts.merge!(OSDefaults.get_facts({:hostname => 'myhostname'})) + facts.merge!(OSDefaults.get_facts()) end it_behaves_like 'ceph fs' diff --git a/spec/defines/ceph_rgw_apache_proxy_fcgi_spec.rb b/spec/defines/ceph_rgw_apache_proxy_fcgi_spec.rb index de41528f..fdb591e7 100644 --- a/spec/defines/ceph_rgw_apache_proxy_fcgi_spec.rb +++ b/spec/defines/ceph_rgw_apache_proxy_fcgi_spec.rb @@ -26,8 +26,8 @@ describe 'ceph::rgw::apache_proxy_fcgi' do 'radosgw.gateway' end - it { should contain_apache__vhost('myhost.domain-radosgw').with( - :servername => 'myhost.domain', + it { should contain_apache__vhost('foo.example.com-radosgw').with( + :servername => 'foo.example.com', :serveradmin => 'root@localhost', :port => 80, :docroot => '/var/www', @@ -104,10 +104,7 @@ describe 'ceph::rgw::apache_proxy_fcgi' do on_supported_os.each do |os, facts| context "on #{os}" do let (:facts) do - facts.merge!(OSDefaults.get_facts( - :fqdn => 'myhost.domain', - :hostname => 'myhost' - )) + facts.merge!(OSDefaults.get_facts()) end it_behaves_like 'ceph::rgw::apache_proxy_fcgi' diff --git a/spec/defines/ceph_rgw_beast_spec.rb b/spec/defines/ceph_rgw_beast_spec.rb index 1d62de9b..6229117e 100644 --- a/spec/defines/ceph_rgw_beast_spec.rb +++ b/spec/defines/ceph_rgw_beast_spec.rb @@ -34,12 +34,12 @@ describe 'ceph::rgw' do end it { should contain_ceph_config('client.radosgw.beast/user').with_value("#{platform_params[:user]}") } - it { should contain_ceph_config('client.radosgw.beast/host').with_value('myhost') } + it { should contain_ceph_config('client.radosgw.beast/host').with_value('foo') } it { should contain_ceph_config('client.radosgw.beast/keyring').with_value('/etc/ceph/ceph.client.radosgw.beast.keyring') } it { should contain_ceph_config('client.radosgw.beast/log_file').with_value('/var/log/ceph/radosgw.log') } it { should contain_ceph_config('client.radosgw.beast/rgw_frontends').with_value('beast port=7480') } - it { should contain_ceph_config('client.radosgw.beast/rgw_dns_name').with_value('myhost.domain') } - it { should contain_ceph_config('client.radosgw.beast/rgw_swift_url').with_value('http://myhost.domain:7480') } + it { should contain_ceph_config('client.radosgw.beast/rgw_dns_name').with_value('foo.example.com') } + it { should contain_ceph_config('client.radosgw.beast/rgw_swift_url').with_value('http://foo.example.com:7480') } end describe "activated with custom beast params" do @@ -59,7 +59,7 @@ describe 'ceph::rgw' do it { should contain_ceph_config('client.radosgw.custom/rgw_frontends').with_value('beast endpoint=0.0.0.0:8080 port=8080') } it { should contain_ceph_config('client.radosgw.custom/user').with_value('root') } - it { should contain_ceph_config('client.radosgw.custom/host').with_value('myhost') } + it { should contain_ceph_config('client.radosgw.custom/host').with_value('foo') } it { should contain_ceph_config('client.radosgw.custom/keyring').with_value('/etc/ceph/ceph.client.radosgw.custom.keyring') } it { should contain_ceph_config('client.radosgw.custom/log_file').with_value('/var/log/ceph/radosgw.log') } it { should contain_ceph_config('client.radosgw.custom/rgw_dns_name').with_value('mydns.hostname') } @@ -70,14 +70,11 @@ describe 'ceph::rgw' do on_supported_os.each do |os, facts| context "on #{os}" do let (:facts) do - facts.merge!(OSDefaults.get_facts( - :fqdn => 'myhost.domain', - :hostname => 'myhost' - )) + facts.merge!(OSDefaults.get_facts()) end let :platform_params do - case facts[:osfamily] + case facts[:os]['family'] when 'Debian' { :user => 'www-data', diff --git a/spec/defines/ceph_rgw_civetweb_spec.rb b/spec/defines/ceph_rgw_civetweb_spec.rb index c48179ad..01261e6e 100644 --- a/spec/defines/ceph_rgw_civetweb_spec.rb +++ b/spec/defines/ceph_rgw_civetweb_spec.rb @@ -35,12 +35,12 @@ describe 'ceph::rgw' do end it { should contain_ceph_config('client.radosgw.civetweb/user').with_value("#{platform_params[:user]}") } - it { should contain_ceph_config('client.radosgw.civetweb/host').with_value('myhost') } + it { should contain_ceph_config('client.radosgw.civetweb/host').with_value('foo') } it { should contain_ceph_config('client.radosgw.civetweb/keyring').with_value('/etc/ceph/ceph.client.radosgw.civetweb.keyring') } it { should contain_ceph_config('client.radosgw.civetweb/log_file').with_value('/var/log/ceph/radosgw.log') } it { should contain_ceph_config('client.radosgw.civetweb/rgw_frontends').with_value('civetweb port=7480') } - it { should contain_ceph_config('client.radosgw.civetweb/rgw_dns_name').with_value('myhost.domain') } - it { should contain_ceph_config('client.radosgw.civetweb/rgw_swift_url').with_value('http://myhost.domain:7480') } + it { should contain_ceph_config('client.radosgw.civetweb/rgw_dns_name').with_value('foo.example.com') } + it { should contain_ceph_config('client.radosgw.civetweb/rgw_swift_url').with_value('http://foo.example.com:7480') } end describe "activated with custom civetweb params" do @@ -60,7 +60,7 @@ describe 'ceph::rgw' do it { should contain_ceph_config('client.radosgw.custom/rgw_frontends').with_value('civetweb port=7481') } it { should contain_ceph_config('client.radosgw.custom/user').with_value('root') } - it { should contain_ceph_config('client.radosgw.custom/host').with_value('myhost') } + it { should contain_ceph_config('client.radosgw.custom/host').with_value('foo') } it { should contain_ceph_config('client.radosgw.custom/keyring').with_value('/etc/ceph/ceph.client.radosgw.custom.keyring') } it { should contain_ceph_config('client.radosgw.custom/log_file').with_value('/var/log/ceph/radosgw.log') } it { should contain_ceph_config('client.radosgw.custom/rgw_dns_name').with_value('mydns.hostname') } @@ -71,15 +71,11 @@ describe 'ceph::rgw' do on_supported_os.each do |os,facts| context "on #{os}" do let (:facts) do - facts.merge!(OSDefaults.get_facts({ - :concat_basedir => '/var/lib/puppet/concat', - :fqdn => 'myhost.domain', - :hostname => 'myhost', - })) + facts.merge!(OSDefaults.get_facts()) end let :platform_params do - case facts[:osfamily] + case facts[:os]['family'] when 'Debian' { :pkg_radosgw => 'radosgw', diff --git a/spec/defines/ceph_rgw_spec.rb b/spec/defines/ceph_rgw_spec.rb index 278e6683..18c3c686 100644 --- a/spec/defines/ceph_rgw_spec.rb +++ b/spec/defines/ceph_rgw_spec.rb @@ -31,11 +31,11 @@ describe 'ceph::rgw' do it { should contain_package(platform_params[:pkg_radosgw]).with('ensure' => 'installed') } it { should contain_ceph_config('client.radosgw.gateway/rgw_enable_apis').with_ensure('absent') } it { should contain_ceph_config('client.radosgw.gateway/user').with_value(platform_params[:user]) } - it { should contain_ceph_config('client.radosgw.gateway/host').with_value('myhost') } + it { should contain_ceph_config('client.radosgw.gateway/host').with_value('foo') } it { should contain_ceph_config('client.radosgw.gateway/keyring').with_value('/etc/ceph/ceph.client.radosgw.gateway.keyring') } it { should contain_ceph_config('client.radosgw.gateway/log_file').with_value('/var/log/ceph/radosgw.log') } - it { should contain_ceph_config('client.radosgw.gateway/rgw_dns_name').with_value('myhost.domain') } - it { should contain_ceph_config('client.radosgw.gateway/rgw_swift_url').with_value('http://myhost.domain:7480') } + it { should contain_ceph_config('client.radosgw.gateway/rgw_dns_name').with_value('foo.example.com') } + it { should contain_ceph_config('client.radosgw.gateway/rgw_swift_url').with_value('http://foo.example.com:7480') } it { should contain_ceph_config('client.radosgw.gateway/rgw_swift_url_prefix').with_value('swift') } it { should contain_ceph_config('client.radosgw.gateway/rgw_swift_account_in_url').with_value(false) } it { should contain_ceph_config('client.radosgw.gateway/rgw_swift_versioning_enabled').with_value(false) } @@ -85,7 +85,7 @@ describe 'ceph::rgw' do it { should contain_package('pkgradosgw').with('ensure' => 'installed') } it { should contain_ceph_config('client.radosgw.custom/rgw_enable_apis').with_value('s3,swift') } it { should contain_ceph_config('client.radosgw.custom/user').with_value('wwwuser') } - it { should contain_ceph_config('client.radosgw.custom/host').with_value('myhost') } + it { should contain_ceph_config('client.radosgw.custom/host').with_value('foo') } it { should contain_ceph_config('client.radosgw.custom/keyring').with_value('/etc/ceph/ceph.radosgw.custom.keyring') } it { should contain_ceph_config('client.radosgw.custom/log_file').with_value('/var/log/ceph/mylogfile.log') } it { should contain_ceph_config('client.radosgw.custom/rgw_dns_name').with_value('mydns.hostname') } @@ -111,14 +111,11 @@ describe 'ceph::rgw' do on_supported_os.each do |os, facts| context "on #{os}" do let (:facts) do - facts.merge!(OSDefaults.get_facts( - :fqdn => 'myhost.domain', - :hostname => 'myhost' - )) + facts.merge!(OSDefaults.get_facts()) end let(:platform_params) do - case facts[:osfamily] + case facts[:os]['family'] when 'Debian' { :pkg_radosgw => 'radosgw', diff --git a/spec/fixtures/hieradata/hiera.yaml b/spec/fixtures/hieradata/hiera.yaml index 81c0fc9e..62964f2c 100644 --- a/spec/fixtures/hieradata/hiera.yaml +++ b/spec/fixtures/hieradata/hiera.yaml @@ -4,5 +4,5 @@ :yaml: :datadir: /var/lib/hiera :hierarchy: - - "nodes/%{::hostname}" + - "nodes/%{facts.networking.hostname}" - common