Add 'rsync_use_xinetd' as argument to swift::ringserver

Since in RHEL/CentOS >= 8 rsyncd systemd unit is shipped in a
different package (rsync-dameon), we need to be able to not
use xinetd to manage rsync service.
The dependency on rsync-daemon for RHEL/CentOS >= 8
is handled in puppet-rsync with [1].

[1] https://github.com/puppetlabs/puppetlabs-rsync/pull/139/files

Closes-Bug: #1930855
Change-Id: I85abf3811d61fa8bfc0a1607818d6495549b5a6b
This commit is contained in:
Joel Capitao 2021-06-08 17:25:31 +02:00 committed by Takashi Kajinami
parent 5f57e5521a
commit 053a3a2a56
6 changed files with 54 additions and 23 deletions

View File

@ -35,6 +35,7 @@ class swift::params {
$account_reaper_service_name = 'swift-account-reaper'
$account_replicator_service_name = 'swift-account-replicator'
$ceilometermiddleware_package_name = 'python3-ceilometermiddleware'
$xinetd_available = true
}
'RedHat': {
$package_name = 'openstack-swift'
@ -61,6 +62,11 @@ class swift::params {
$account_reaper_service_name = 'openstack-swift-account-reaper'
$account_replicator_service_name = 'openstack-swift-account-replicator'
$ceilometermiddleware_package_name = 'python3-ceilometermiddleware'
if (Integer.new($::os['release']['major']) > 8) {
$xinetd_available = false
} else {
$xinetd_available = true
}
}
default: {
fail("Unsupported osfamily: ${::osfamily} operatingsystem: ${::operatingsystem}, \

View File

@ -11,6 +11,10 @@
# (optional) maximum connections to rsync server
# Defaults to 5
#
# [*rsync_use_xinetd*]
# (optional) Override whether to use xinetd to manage rsync service
# Defaults to swift::params::xinetd_available
#
# == Dependencies
#
# Class['swift']
@ -27,15 +31,20 @@
#
class swift::ringserver(
$local_net_ip,
$max_connections = 5
) {
$max_connections = 5,
$rsync_use_xinetd = $::swift::params::xinetd_available,
) inherits swift::params {
include swift::deps
Class['swift::ringbuilder'] -> Class['swift::ringserver']
if $rsync_use_xinetd and ! $::swift::params::xinetd_available {
fail('xinetd is not available in this distro')
}
if !defined(Class['rsync::server']) {
class { 'rsync::server':
use_xinetd => true,
use_xinetd => $rsync_use_xinetd,
address => $local_net_ip,
use_chroot => 'no',
}

View File

@ -8,8 +8,9 @@
# [*storage_local_net_ip*] ip address that the swift servers should
# bind to. Required.
#
# [*rsync_use_xinetd*] indicate if xinetd should be used to manage
# rsync service, Default to True.
# [*rsync_use_xinetd*]
# (optional) Override whether to use xinetd to manage rsync service
# Defaults to swift::params::xinetd_available
#
# == Dependencies
#
@ -25,11 +26,15 @@
#
class swift::storage(
$storage_local_net_ip,
$rsync_use_xinetd = true,
) {
$rsync_use_xinetd = $::swift::params::xinetd_available,
) inherits swift::params {
include swift::deps
if $rsync_use_xinetd and ! $::swift::params::xinetd_available {
fail('xinetd is not available in this distro')
}
if !defined(Class['rsync::server']){
class{ 'rsync::server':
use_xinetd => $rsync_use_xinetd,

View File

@ -119,6 +119,10 @@
# (optional) maximum number of simultaneous connections allowed for rsync.
# Defaults to 25.
#
# [*rsync_use_xinetd*]
# (optional) Override whether to use xinetd to manage rsync service
# Defaults to swift::params::xinetd_available
#
class swift::storage::all(
$storage_local_net_ip,
$devices = '/srv/node',
@ -149,7 +153,8 @@ class swift::storage::all(
$object_server_mb_per_sync = 512,
$splice = false,
$max_connections = 25,
) {
$rsync_use_xinetd = $::swift::params::xinetd_available,
) inherits swift::params {
include swift::deps
@ -168,8 +173,13 @@ from 6001 to 6201 and will be changed in a later release')
from 6002 to 6202 and will be changed in a later release')
}
if $rsync_use_xinetd and ! $::swift::params::xinetd_available {
fail('xinetd is not available in this distro')
}
class { 'swift::storage':
storage_local_net_ip => $storage_local_net_ip,
rsync_use_xinetd => $rsync_use_xinetd,
}
Swift::Storage::Server {

View File

@ -0,0 +1,8 @@
---
features:
- |
The new rsync_use_xinetd parameter has been added to the following classes,
to add the ability to enable/disable usage of xinetd to run rsync server.
- ``swift::ringserver``
- ``swift::storage::all``

View File

@ -4,6 +4,13 @@ require 'spec_helper'
WebMock.disable_net_connect!(:allow => "169.254.169.254")
describe 'swift::ringserver' do
let :params do
{ :local_net_ip => '127.0.0.1',
:max_connections => 5,
:rsync_use_xinetd => true,
}
end
shared_examples 'swift::ringserver' do
context 'when storage.pp was already included' do
let :pre_condition do
@ -12,13 +19,6 @@ describe 'swift::ringserver' do
include swift::ringbuilder"
end
let :params do
{
:local_net_ip => '127.0.0.1',
:max_connections => 5
}
end
it 'does not create the rsync::server class' do
is_expected.to compile
end
@ -41,13 +41,6 @@ describe 'swift::ringserver' do
include swift::ringbuilder"
end
let :params do
{
:local_net_ip => '127.0.0.1',
:max_connections => 5
}
end
it 'does create the rsync::server class' do
is_expected.to contain_class('rsync::server').with({
'use_xinetd' => 'true',
@ -77,7 +70,7 @@ describe 'swift::ringserver' do
facts.merge(OSDefaults.get_facts())
end
it_configures 'swift::ringserver'
it_behaves_like 'swift::ringserver'
end
end
end