From 152b6f6d27c85d003beb2bbb2a8666e556bb8606 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Sun, 21 Aug 2022 01:25:10 +0900 Subject: [PATCH] Remove support for upstart ... because this module no longer supports Ubuntu 14.04 or CentOS 6. This also removes the unit tests with Ubuntu 14.04. Change-Id: Ib2bf73ba379b61f96c5faf3712c15aa39c0a301e --- manifests/mirror.pp | 16 +- manifests/mon.pp | 30 +-- manifests/rgw.pp | 27 +- spec/classes/ceph_repo_spec.rb | 20 +- spec/defines/ceph_mon_spec.rb | 231 +----------------- .../ceph_rgw_apache_proxy_fcgi_spec.rb | 4 +- spec/defines/ceph_rgw_spec.rb | 83 +------ 7 files changed, 28 insertions(+), 383 deletions(-) diff --git a/manifests/mirror.pp b/manifests/mirror.pp index 249a0401..82d06d54 100644 --- a/manifests/mirror.pp +++ b/manifests/mirror.pp @@ -48,22 +48,10 @@ define ceph::mirror ( $service_name = "ceph-rbd-mirror@${name}" - #Xenial reports 'debian' as the service provider - #'systemd' should cover supported RHEL type systems - if( ( $::service_provider == 'systemd' ) or - ( $::operatingsystemrelease == '16.04' ) ) - { - Service{ - name => $service_name, - enable => $rbd_mirror_enable, - } - } - else { - fail( 'Unsupported operating system. Ubuntu 16.04 and RedHat/CentOS 7 are supported' ) - } - service { $service_name: ensure => $rbd_mirror_ensure, + enable => $rbd_mirror_enable, + name => $service_name, tag => ['ceph-rbd-mirror'] } diff --git a/manifests/mon.pp b/manifests/mon.pp index f8dad439..4c05a8bc 100644 --- a/manifests/mon.pp +++ b/manifests/mon.pp @@ -84,26 +84,6 @@ define ceph::mon ( # different than the actual service name. $mon_service = "ceph-mon-${id}" - # For Ubuntu Trusty system - if $::service_provider == 'upstart' { - $init = 'upstart' - Service { - name => 'ceph-mon', - provider => $::service_provider, - start => "start ceph-mon id=${id}", - stop => "stop ceph-mon id=${id}", - status => "status ceph-mon id=${id}", - enable => $mon_enable, - } - # Everything else that is supported by puppet-ceph should run systemd. - } else { - $init = 'systemd' - Service { - name => "ceph-mon@${id}", - enable => $mon_enable, - } - } - if $ensure == present { $ceph_mkfs = "ceph-mon-mkfs-${id}" @@ -177,8 +157,8 @@ if [ ! -d \$mon_data ] ; then --mkfs \ --id ${id} \ --keyring ${keyring_path} ; then - touch \$mon_data/done \$mon_data/${init} \$mon_data/keyring - chown -h ceph:ceph \$mon_data/done \$mon_data/${init} \$mon_data/keyring + touch \$mon_data/done \$mon_data/systemd \$mon_data/keyring + chown -h ceph:ceph \$mon_data/done \$mon_data/systemd \$mon_data/keyring else rm -fr \$mon_data fi @@ -187,7 +167,7 @@ if [ ! -d \$mon_data ] ; then --mkfs \ --id ${id} \ --keyring ${keyring_path} ; then - touch \$mon_data/done \$mon_data/${init} \$mon_data/keyring + touch \$mon_data/done \$mon_data/systemd \$mon_data/keyring else rm -fr \$mon_data fi @@ -204,6 +184,8 @@ test -d \$mon_data } -> service { $mon_service: ensure => running, + enable => $mon_enable, + name => "ceph-mon@${id}", } # if the service is running before we setup the configs, notify service @@ -227,6 +209,8 @@ test ! -e ${keyring_path} } elsif $ensure == absent { service { $mon_service: ensure => stopped, + enable => $mon_enable, + name => "ceph-mon@${id}", } -> exec { "remove-mon-${id}": command => "/bin/true # comment to satisfy puppet syntax requirements diff --git a/manifests/rgw.pp b/manifests/rgw.pp index f5945fd1..4b891d24 100644 --- a/manifests/rgw.pp +++ b/manifests/rgw.pp @@ -166,33 +166,10 @@ define ceph::rgw ( # than the actual service name $rgw_service = "radosgw-${name}" - # service definition - # if Ubuntu does not use systemd - if $::service_provider == 'upstart' { - if $rgw_enable { - file { "${rgw_data}/done": - ensure => present, - before => Service[$rgw_service], - } - } - - Service { - name => 'radosgw', - start => "start radosgw id=${name}", - stop => "stop radosgw id=${name}", - status => "status radosgw id=${name}", - provider => $::service_provider, - } - # Everything else that is supported by puppet-ceph should run systemd. - } else { - Service { - name => "ceph-radosgw@${name}", - enable => $rgw_enable, - } - } - service { $rgw_service: ensure => $rgw_ensure, + enable => $rgw_enable, + name => "ceph-radosgw@${name}", tag => ['ceph-radosgw'] } diff --git a/spec/classes/ceph_repo_spec.rb b/spec/classes/ceph_repo_spec.rb index 4abbe175..935e0847 100644 --- a/spec/classes/ceph_repo_spec.rb +++ b/spec/classes/ceph_repo_spec.rb @@ -72,8 +72,8 @@ describe 'ceph::repo' do before do facts.merge!( :osfamily => 'Debian', :lsbdistid => 'Ubuntu', - :lsbdistcodename => 'trusty', - :lsbdistrelease => '14.04', + :lsbdistcodename => 'xenial', + :lsbdistrelease => '16.04', :hardwaremodel => 'x86_64' ) end @@ -86,7 +86,7 @@ describe 'ceph::repo' do it { should contain_apt__source('ceph').with( :location => 'http://download.ceph.com/debian-nautilus/', - :release => 'trusty', + :release => 'xenial', )} end @@ -99,7 +99,7 @@ describe 'ceph::repo' do it { should contain_apt__source('ceph').with( :location => 'http://download.ceph.com/debian-firefly/', - :release => 'trusty', + :release => 'xenial', )} end @@ -117,13 +117,13 @@ describe 'ceph::repo' do it { should contain_apt__source('ceph').with( :location => 'http://download.ceph.com/debian-nautilus/', - :release => 'trusty', + :release => 'xenial', )} it { should contain_apt__source('ceph-fastcgi').with( :ensure => 'present', - :location => 'http://gitbuilder.ceph.com/libapache-mod-fastcgi-deb-trusty-x86_64-basic/ref/master', - :release => 'trusty', + :location => 'http://gitbuilder.ceph.com/libapache-mod-fastcgi-deb-xenial-x86_64-basic/ref/master', + :release => 'xenial', :require => 'Apt::Key[ceph-gitbuilder]' )} end @@ -139,13 +139,13 @@ describe 'ceph::repo' do it { should contain_apt__source('ceph').with( :ensure => 'absent', :location => 'http://download.ceph.com/debian-nautilus/', - :release => 'trusty', + :release => 'xenial', )} it { should contain_apt__source('ceph-fastcgi').with( :ensure => 'absent', - :location => 'http://gitbuilder.ceph.com/libapache-mod-fastcgi-deb-trusty-x86_64-basic/ref/master', - :release => 'trusty', + :location => 'http://gitbuilder.ceph.com/libapache-mod-fastcgi-deb-xenial-x86_64-basic/ref/master', + :release => 'xenial', :require => 'Apt::Key[ceph-gitbuilder]' )} end diff --git a/spec/defines/ceph_mon_spec.rb b/spec/defines/ceph_mon_spec.rb index 19a775c6..5e3f3294 100644 --- a/spec/defines/ceph_mon_spec.rb +++ b/spec/defines/ceph_mon_spec.rb @@ -21,239 +21,11 @@ require 'spec_helper' describe 'ceph::mon' do - shared_examples 'ceph::mon on Ubuntu 14.04' do - before do - facts.merge!( :osfamily => 'Debian', - :operatingsystem => 'Ubuntu', - :operatingsystemrelease => '14.04', - :service_provider => 'upstart' ) - end - - context 'with default params' do - let :title do - 'A' - end - - it { should raise raise_error(Puppet::Error, /authentication_type cephx requires either key or keyring to be set but both are undef/) } - end - - context 'with key' do - let :title do - 'A' - end - - let :params do - { - :key => 'AQATGHJTUCBqIBAA7M2yafV1xctn1pgr3GcKPg==', - } - end - - it { should contain_service('ceph-mon-A').with('ensure' => 'running') } - - it { should contain_exec('create-keyring-A').with( - :command => '/bin/true # comment to satisfy puppet syntax requirements -set -ex -cat > /tmp/ceph-mon-keyring-A << EOF -[mon.] - key = AQATGHJTUCBqIBAA7M2yafV1xctn1pgr3GcKPg== - caps mon = "allow *" -EOF - -chmod 0444 /tmp/ceph-mon-keyring-A -', - :unless => '/bin/true # comment to satisfy puppet syntax requirements -set -ex -mon_data=$(ceph-mon --cluster ceph --id A --show-config-value mon_data) || exit 1 -# if ceph-mon fails then the mon is probably not configured yet -test -e $mon_data/done -') } - - it { should contain_exec('ceph-mon-ceph.client.admin.keyring-A').with( - :command => '/bin/true # comment to satisfy puppet syntax requirements -set -ex -touch /etc/ceph/ceph.client.admin.keyring' - ) } - - it { should contain_exec('ceph-mon-mkfs-A').with( - :command => "/bin/true # comment to satisfy puppet syntax requirements -set -ex -mon_data=\$(ceph-mon --cluster ceph --id A --show-config-value mon_data) -if [ ! -d \$mon_data ] ; then - mkdir -p \$mon_data - if getent passwd ceph >/dev/null 2>&1; then - chown -h ceph:ceph \$mon_data - if ceph-mon --cluster ceph \ - --setuser ceph --setgroup ceph \ - --mkfs \ - --id A \ - --keyring /tmp/ceph-mon-keyring-A ; then - touch \$mon_data/done \$mon_data/upstart \$mon_data/keyring - chown -h ceph:ceph \$mon_data/done \$mon_data/upstart \$mon_data/keyring - else - rm -fr \$mon_data - fi - else - if ceph-mon --cluster ceph \ - --mkfs \ - --id A \ - --keyring /tmp/ceph-mon-keyring-A ; then - touch \$mon_data/done \$mon_data/upstart \$mon_data/keyring - else - rm -fr \$mon_data - fi - fi -fi -", - :logoutput => true )} - - it { should contain_exec('rm-keyring-A').with('command' => '/bin/rm /tmp/ceph-mon-keyring-A') } - end - - context 'with keyring' do - let :title do - 'A' - end - - let :params do - { - :keyring => '/etc/ceph/ceph.mon.keyring', - } - end - - it { should contain_service('ceph-mon-A').with('ensure' => 'running') } - - it { should contain_exec('ceph-mon-ceph.client.admin.keyring-A').with( - :command => '/bin/true # comment to satisfy puppet syntax requirements -set -ex -touch /etc/ceph/ceph.client.admin.keyring' - )} - - it { should contain_exec('ceph-mon-mkfs-A').with( - :command => "/bin/true # comment to satisfy puppet syntax requirements -set -ex -mon_data=\$(ceph-mon --cluster ceph --id A --show-config-value mon_data) -if [ ! -d \$mon_data ] ; then - mkdir -p \$mon_data - if getent passwd ceph >/dev/null 2>&1; then - chown -h ceph:ceph \$mon_data - if ceph-mon --cluster ceph \ - --setuser ceph --setgroup ceph \ - --mkfs \ - --id A \ - --keyring /etc/ceph/ceph.mon.keyring ; then - touch \$mon_data/done \$mon_data/upstart \$mon_data/keyring - chown -h ceph:ceph \$mon_data/done \$mon_data/upstart \$mon_data/keyring - else - rm -fr \$mon_data - fi - else - if ceph-mon --cluster ceph \ - --mkfs \ - --id A \ - --keyring /etc/ceph/ceph.mon.keyring ; then - touch \$mon_data/done \$mon_data/upstart \$mon_data/keyring - else - rm -fr \$mon_data - fi - fi -fi -", - :logoutput => true )} - end - - context 'with custom params' do - let :title do - 'A' - end - - let :params do - { - :public_addr => '127.0.0.1', - :authentication_type => 'none', - :cluster => 'testcluster', - } - end - - it { should contain_service('ceph-mon-A').with('ensure' => 'running') } - it { should contain_ceph_config('mon.A/public_addr').with_value("127.0.0.1") } - - it { should contain_exec('ceph-mon-testcluster.client.admin.keyring-A').with( - :command => '/bin/true # comment to satisfy puppet syntax requirements -set -ex -touch /etc/ceph/testcluster.client.admin.keyring' - )} - - it { should contain_exec('ceph-mon-mkfs-A').with( - :command => "/bin/true # comment to satisfy puppet syntax requirements -set -ex -mon_data=\$(ceph-mon --cluster testcluster --id A --show-config-value mon_data) -if [ ! -d \$mon_data ] ; then - mkdir -p \$mon_data - if getent passwd ceph >/dev/null 2>&1; then - chown -h ceph:ceph \$mon_data - if ceph-mon --cluster testcluster \ - --setuser ceph --setgroup ceph \ - --mkfs \ - --id A \ - --keyring /dev/null ; then - touch \$mon_data/done \$mon_data/upstart \$mon_data/keyring - chown -h ceph:ceph \$mon_data/done \$mon_data/upstart \$mon_data/keyring - else - rm -fr \$mon_data - fi - else - if ceph-mon --cluster testcluster \ - --mkfs \ - --id A \ - --keyring /dev/null ; then - touch \$mon_data/done \$mon_data/upstart \$mon_data/keyring - else - rm -fr \$mon_data - fi - fi -fi -", - :logoutput => true )} - end - - context 'with ensure absent' do - let :title do - 'A' - end - - let :params do - { - :ensure => 'absent', - :public_addr => '127.0.0.1', - :authentication_type => 'none', - :cluster => 'testcluster', - } - end - - it { should contain_service('ceph-mon-A').with('ensure' => 'stopped') } - - it { should contain_exec('remove-mon-A').with( - :command => "/bin/true # comment to satisfy puppet syntax requirements -set -ex -mon_data=\$(ceph-mon --cluster testcluster --id A --show-config-value mon_data) -rm -fr \$mon_data -", - :unless => "/bin/true # comment to satisfy puppet syntax requirements -set -ex -which ceph-mon || exit 0 # if ceph-mon is not available we already uninstalled ceph and there is nothing to do -mon_data=\$(ceph-mon --cluster testcluster --id A --show-config-value mon_data) -test ! -d \$mon_data -", - :logoutput => true )} - end - end - shared_examples 'ceph::mon on Ubuntu 16.04' do before do facts.merge!( :osfamily => 'Debian', :operatingsystem => 'Ubuntu', - :operatingsystemrelease => '16.04', - :service_provider => 'systemd' ) + :operatingsystemrelease => '16.04', ) end context 'with default params' do @@ -732,7 +504,6 @@ test ! -d \$mon_data end # if facts[:operatingsystem] == 'Ubuntu' -# it_behaves_like 'ceph::mon on Ubuntu 14.04' # it_behaves_like 'ceph::mon on Ubuntu 16.04' # elsif facts[:operatingsystem] == 'CentOS' # it_behaves_like 'ceph::mon on RHEL7' diff --git a/spec/defines/ceph_rgw_apache_proxy_fcgi_spec.rb b/spec/defines/ceph_rgw_apache_proxy_fcgi_spec.rb index bc427776..1b32b4ea 100644 --- a/spec/defines/ceph_rgw_apache_proxy_fcgi_spec.rb +++ b/spec/defines/ceph_rgw_apache_proxy_fcgi_spec.rb @@ -24,8 +24,8 @@ describe 'ceph::rgw::apache_proxy_fcgi' do before do facts.merge!( :operatingsystem => 'Ubuntu', :lsbdistid => 'Ubuntu', - :operatingsystemrelease => '14.04', - :lsbdistcodename => 'trusty' ) + :operatingsystemrelease => '16.04', + :lsbdistcodename => 'xenial' ) end context 'activated with default params' do diff --git a/spec/defines/ceph_rgw_spec.rb b/spec/defines/ceph_rgw_spec.rb index 06ac9b07..f7e09ed9 100644 --- a/spec/defines/ceph_rgw_spec.rb +++ b/spec/defines/ceph_rgw_spec.rb @@ -22,11 +22,10 @@ describe 'ceph::rgw' do 'include ceph::params' end - shared_examples 'ceph::rgw on Ubuntu 14.04' do + shared_examples 'ceph::rgw on Ubuntu 16.04' do before do facts.merge!( :operatingsystem => 'Ubuntu', - :operatingsystemrelease => '14.04', - :service_provider => 'upstart' ) + :operatingsystemrelease => '16.04' ) end context 'activated with default params' do @@ -56,7 +55,6 @@ describe 'ceph::rgw' do :selinux_ignore_defaults => true, )} - it { should contain_file('/var/lib/ceph/radosgw/ceph-radosgw.gateway/done') } it { should contain_service('radosgw-radosgw.gateway') } end @@ -70,9 +68,9 @@ describe 'ceph::rgw' do :pkg_radosgw => 'pkgradosgw', :rgw_ensure => 'stopped', :rgw_enable => false, - :rgw_data => "/var/lib/ceph/radosgw/ceph-radosgw.custom", + :rgw_data => '/var/lib/ceph/radosgw/ceph-radosgw.custom', :user => 'wwwuser', - :keyring_path => "/etc/ceph/ceph.radosgw.custom.keyring", + :keyring_path => '/etc/ceph/ceph.radosgw.custom.keyring', :log_file => '/var/log/ceph/mylogfile.log', :rgw_dns_name => 'mydns.hostname', :rgw_swift_url => 'https://mydns.hostname:443' @@ -101,78 +99,6 @@ describe 'ceph::rgw' do end end - shared_examples 'ceph::rgw on Ubuntu 16.04' do - before do - facts.merge!( :operatingsystem => 'Ubuntu', - :operatingsystemrelease => '16.04', - :service_provider => 'systemd' ) - end - - context 'activated with default params' do - let :title do - 'radosgw.gateway' - end - - it { should contain_package('radosgw').with('ensure' => 'installed') } - it { should contain_ceph_config('client.radosgw.gateway/user').with_value('www-data') } - it { should contain_ceph_config('client.radosgw.gateway/host').with_value('myhost') } - 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_file('/var/lib/ceph/radosgw').with( - :ensure => 'directory', - :mode => '0755', - :selinux_ignore_defaults => true, - )} - - it { should contain_file('/var/lib/ceph/radosgw/ceph-radosgw.gateway').with( - :ensure => 'directory', - :owner => 'root', - :group => 'root', - :mode => '0750', - :selinux_ignore_defaults => true, - )} - - it { should contain_service('radosgw-radosgw.gateway') } - end - - context 'activated with custom params' do - let :title do - 'radosgw.custom' - end - - let :params do - { - :pkg_radosgw => 'pkgradosgw', - :rgw_ensure => 'stopped', - :rgw_enable => false, - :rgw_data => '/var/lib/ceph/radosgw/ceph-radosgw.custom', - :user => 'wwwuser', - :keyring_path => '/etc/ceph/ceph.radosgw.custom.keyring', - :log_file => '/var/log/ceph/mylogfile.log', - } - end - - it { should contain_package('pkgradosgw').with('ensure' => 'installed') } - - it { should contain_ceph_config('client.radosgw.custom/host').with_value('myhost') } - 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/user').with_value('wwwuser') } - - it { should contain_file('/var/lib/ceph/radosgw/ceph-radosgw.custom').with( - :ensure => 'directory', - :owner => 'root', - :group => 'root', - :mode => '0750', - :selinux_ignore_defaults => true, - )} - - it { should_not contain_file('/var/lib/ceph/radosgw/ceph-radosgw.gateway/done') } - it { should contain_service('radosgw-radosgw.custom').with('ensure' => 'stopped' ) } - end - end - shared_examples 'ceph::rgw on RedHat' do before do facts.merge!( :operatingsystem => 'RedHat', @@ -255,7 +181,6 @@ describe 'ceph::rgw' do end if facts[:operatingsystem] == 'Ubuntu' - it_behaves_like 'ceph::rgw on Ubuntu 14.04' it_behaves_like 'ceph::rgw on Ubuntu 16.04' end