Merge "Avoid hard-coding OS user/group in each manifest"
This commit is contained in:
@@ -87,8 +87,8 @@ class swift::dispersion (
|
|||||||
|
|
||||||
file { '/etc/swift/dispersion.conf':
|
file { '/etc/swift/dispersion.conf':
|
||||||
ensure => file,
|
ensure => file,
|
||||||
owner => 'swift',
|
owner => $::swift::params::user,
|
||||||
group => 'swift',
|
group => $::swift::params::group,
|
||||||
mode => '0640',
|
mode => '0640',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -68,8 +68,8 @@ class swift(
|
|||||||
}
|
}
|
||||||
|
|
||||||
File {
|
File {
|
||||||
owner => 'swift',
|
owner => $::swift::params::user,
|
||||||
group => 'swift',
|
group => $::swift::params::group,
|
||||||
tag => 'swift-file',
|
tag => 'swift-file',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -75,8 +75,8 @@ class swift::memcache (
|
|||||||
|
|
||||||
file { '/etc/swift/memcache.conf':
|
file { '/etc/swift/memcache.conf':
|
||||||
ensure => file,
|
ensure => file,
|
||||||
owner => 'swift',
|
owner => $::swift::params::user,
|
||||||
group => 'swift',
|
group => $::swift::params::group,
|
||||||
mode => '0640',
|
mode => '0640',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -8,6 +8,8 @@ class swift::params {
|
|||||||
$client_package = 'python3-swiftclient'
|
$client_package = 'python3-swiftclient'
|
||||||
$dnspython_pakage_name = 'python3-dnspython'
|
$dnspython_pakage_name = 'python3-dnspython'
|
||||||
$service_provider = undef
|
$service_provider = undef
|
||||||
|
$user = 'swift'
|
||||||
|
$group = 'swift'
|
||||||
|
|
||||||
case $::osfamily {
|
case $::osfamily {
|
||||||
'Debian': {
|
'Debian': {
|
||||||
|
@@ -53,8 +53,8 @@ class swift::ringserver(
|
|||||||
rsync::server::module { 'swift_server':
|
rsync::server::module { 'swift_server':
|
||||||
path => '/etc/swift',
|
path => '/etc/swift',
|
||||||
lock_file => '/var/lock/swift_server.lock',
|
lock_file => '/var/lock/swift_server.lock',
|
||||||
uid => 'swift',
|
uid => $::swift::params::user,
|
||||||
gid => 'swift',
|
gid => $::swift::params::group,
|
||||||
max_connections => $max_connections,
|
max_connections => $max_connections,
|
||||||
read_only => true,
|
read_only => true,
|
||||||
}
|
}
|
||||||
|
@@ -70,12 +70,13 @@ define swift::storage::disk(
|
|||||||
) {
|
) {
|
||||||
|
|
||||||
include swift::deps
|
include swift::deps
|
||||||
|
include swift::params
|
||||||
|
|
||||||
if(!defined(File[$mnt_base_dir])) {
|
if(!defined(File[$mnt_base_dir])) {
|
||||||
file { $mnt_base_dir:
|
file { $mnt_base_dir:
|
||||||
ensure => directory,
|
ensure => directory,
|
||||||
owner => 'swift',
|
owner => $::swift::params::user,
|
||||||
group => 'swift',
|
group => $::swift::params::group,
|
||||||
require => Anchor['swift::config::begin'],
|
require => Anchor['swift::config::begin'],
|
||||||
before => Anchor['swift::config::end'],
|
before => Anchor['swift::config::end'],
|
||||||
}
|
}
|
||||||
|
@@ -58,8 +58,8 @@ define swift::storage::generic(
|
|||||||
|
|
||||||
file { "/etc/swift/${name}-server/":
|
file { "/etc/swift/${name}-server/":
|
||||||
ensure => directory,
|
ensure => directory,
|
||||||
owner => 'swift',
|
owner => $::swift::params::user,
|
||||||
group => 'swift',
|
group => $::swift::params::group,
|
||||||
tag => 'swift-file',
|
tag => 'swift-file',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -39,6 +39,7 @@ define swift::storage::loopback(
|
|||||||
) {
|
) {
|
||||||
|
|
||||||
include swift::deps
|
include swift::deps
|
||||||
|
include swift::params
|
||||||
|
|
||||||
if(!defined(File[$base_dir])) {
|
if(!defined(File[$base_dir])) {
|
||||||
file { $base_dir:
|
file { $base_dir:
|
||||||
@@ -51,8 +52,8 @@ define swift::storage::loopback(
|
|||||||
if(!defined(File[$mnt_base_dir])) {
|
if(!defined(File[$mnt_base_dir])) {
|
||||||
file { $mnt_base_dir:
|
file { $mnt_base_dir:
|
||||||
ensure => directory,
|
ensure => directory,
|
||||||
owner => 'swift',
|
owner => $::swift::params::user,
|
||||||
group => 'swift',
|
group => $::swift::params::group,
|
||||||
require => Anchor['swift::config::begin'],
|
require => Anchor['swift::config::begin'],
|
||||||
before => Anchor['swift::config::end'],
|
before => Anchor['swift::config::end'],
|
||||||
}
|
}
|
||||||
|
@@ -29,6 +29,7 @@ define swift::storage::mount(
|
|||||||
) {
|
) {
|
||||||
|
|
||||||
include swift::deps
|
include swift::deps
|
||||||
|
include swift::params
|
||||||
|
|
||||||
if($loopback){
|
if($loopback){
|
||||||
$options = 'noatime,nodiratime,nofail,loop'
|
$options = 'noatime,nodiratime,nofail,loop'
|
||||||
@@ -46,8 +47,8 @@ define swift::storage::mount(
|
|||||||
# needs to exist
|
# needs to exist
|
||||||
file { "${mnt_base_dir}/${name}":
|
file { "${mnt_base_dir}/${name}":
|
||||||
ensure => directory,
|
ensure => directory,
|
||||||
owner => 'swift',
|
owner => $::swift::params::user,
|
||||||
group => 'swift',
|
group => $::swift::params::group,
|
||||||
require => Anchor['swift::config::begin'],
|
require => Anchor['swift::config::begin'],
|
||||||
before => Anchor['swift::config::end'],
|
before => Anchor['swift::config::end'],
|
||||||
}
|
}
|
||||||
|
@@ -24,11 +24,11 @@
|
|||||||
#
|
#
|
||||||
# [*owner*]
|
# [*owner*]
|
||||||
# (optional) Owner (uid) of rsync server.
|
# (optional) Owner (uid) of rsync server.
|
||||||
# Defaults to 'swift'.
|
# Defaults to $::swift::params::user.
|
||||||
#
|
#
|
||||||
# [*group*]
|
# [*group*]
|
||||||
# (optional) Group (gid) of rsync server.
|
# (optional) Group (gid) of rsync server.
|
||||||
# Defaults to 'swift'.
|
# Defaults to $::swift::params::group.
|
||||||
#
|
#
|
||||||
# [*max_connections*]
|
# [*max_connections*]
|
||||||
# (optional) maximum number of simultaneous connections allowed.
|
# (optional) maximum number of simultaneous connections allowed.
|
||||||
@@ -45,8 +45,8 @@ define swift::storage::node(
|
|||||||
$mnt_base_dir,
|
$mnt_base_dir,
|
||||||
$zone,
|
$zone,
|
||||||
$weight = 1,
|
$weight = 1,
|
||||||
$owner = 'swift',
|
$owner = undef,
|
||||||
$group = 'swift',
|
$group = undef,
|
||||||
$max_connections = 25,
|
$max_connections = 25,
|
||||||
$storage_local_net_ip = '127.0.0.1',
|
$storage_local_net_ip = '127.0.0.1',
|
||||||
$policy_index = undef,
|
$policy_index = undef,
|
||||||
@@ -61,8 +61,8 @@ define swift::storage::node(
|
|||||||
storage_local_net_ip => $storage_local_net_ip,
|
storage_local_net_ip => $storage_local_net_ip,
|
||||||
devices => $mnt_base_dir,
|
devices => $mnt_base_dir,
|
||||||
max_connections => $max_connections,
|
max_connections => $max_connections,
|
||||||
owner => $owner,
|
owner => pick($owner, $::swift::params::user),
|
||||||
group => $group,
|
group => pick($group, $::swift::params::group),
|
||||||
}
|
}
|
||||||
|
|
||||||
swift::storage::server { "60${name}0":
|
swift::storage::server { "60${name}0":
|
||||||
|
@@ -20,11 +20,11 @@
|
|||||||
#
|
#
|
||||||
# [*owner*]
|
# [*owner*]
|
||||||
# (optional) Owner (uid) of rsync server.
|
# (optional) Owner (uid) of rsync server.
|
||||||
# Defaults to 'swift'.
|
# Defaults to $::swift::params::user.
|
||||||
#
|
#
|
||||||
# [*group*]
|
# [*group*]
|
||||||
# (optional) Group (gid) of rsync server.
|
# (optional) Group (gid) of rsync server.
|
||||||
# Defaults to 'swift'.
|
# Defaults to $::swift::params::group.
|
||||||
#
|
#
|
||||||
# [*max_connections*]
|
# [*max_connections*]
|
||||||
# (optional) maximum number of simultaneous connections allowed.
|
# (optional) maximum number of simultaneous connections allowed.
|
||||||
@@ -57,7 +57,7 @@
|
|||||||
#
|
#
|
||||||
# [*user*]
|
# [*user*]
|
||||||
# (optional) User to run as
|
# (optional) User to run as
|
||||||
# Defaults to 'swift'.
|
# Defaults to $::swift::params::user.
|
||||||
#
|
#
|
||||||
# [*workers*]
|
# [*workers*]
|
||||||
# (optional) Override the number of pre-forked workers that will accept
|
# (optional) Override the number of pre-forked workers that will accept
|
||||||
@@ -201,15 +201,15 @@ define swift::storage::server(
|
|||||||
$type,
|
$type,
|
||||||
$storage_local_net_ip,
|
$storage_local_net_ip,
|
||||||
$devices = '/srv/node',
|
$devices = '/srv/node',
|
||||||
$owner = 'swift',
|
$owner = undef,
|
||||||
$group = 'swift',
|
$group = undef,
|
||||||
$incoming_chmod = 'Du=rwx,g=rx,o=rx,Fu=rw,g=r,o=r',
|
$incoming_chmod = 'Du=rwx,g=rx,o=rx,Fu=rw,g=r,o=r',
|
||||||
$outgoing_chmod = 'Du=rwx,g=rx,o=rx,Fu=rw,g=r,o=r',
|
$outgoing_chmod = 'Du=rwx,g=rx,o=rx,Fu=rw,g=r,o=r',
|
||||||
$max_connections = 25,
|
$max_connections = 25,
|
||||||
$pipeline = ["${type}-server"],
|
$pipeline = ["${type}-server"],
|
||||||
$mount_check = true,
|
$mount_check = true,
|
||||||
$servers_per_port = 0,
|
$servers_per_port = 0,
|
||||||
$user = 'swift',
|
$user = undef,
|
||||||
$workers = $::os_workers,
|
$workers = $::os_workers,
|
||||||
$replicator_concurrency = 1,
|
$replicator_concurrency = 1,
|
||||||
$replicator_interval = 30,
|
$replicator_interval = 30,
|
||||||
@@ -248,6 +248,9 @@ define swift::storage::server(
|
|||||||
){
|
){
|
||||||
|
|
||||||
include swift::deps
|
include swift::deps
|
||||||
|
include swift::params
|
||||||
|
|
||||||
|
$user_real = pick($user, $::swift::params::user)
|
||||||
|
|
||||||
if $allow_versions != undef {
|
if $allow_versions != undef {
|
||||||
warning('The allow_versions parameter is deprecated and will be removed in a future release')
|
warning('The allow_versions parameter is deprecated and will be removed in a future release')
|
||||||
@@ -285,8 +288,8 @@ define swift::storage::server(
|
|||||||
rsync::server::module { $type:
|
rsync::server::module { $type:
|
||||||
path => $devices,
|
path => $devices,
|
||||||
lock_file => "/var/lock/${type}.lock",
|
lock_file => "/var/lock/${type}.lock",
|
||||||
uid => $owner,
|
uid => pick($owner, $::swift::params::user),
|
||||||
gid => $group,
|
gid => pick($group, $::swift::params::group),
|
||||||
incoming_chmod => $incoming_chmod,
|
incoming_chmod => $incoming_chmod,
|
||||||
outgoing_chmod => $outgoing_chmod,
|
outgoing_chmod => $outgoing_chmod,
|
||||||
max_connections => $max_connections,
|
max_connections => $max_connections,
|
||||||
@@ -294,8 +297,8 @@ define swift::storage::server(
|
|||||||
}
|
}
|
||||||
|
|
||||||
concat { "/etc/swift/${config_file_path}":
|
concat { "/etc/swift/${config_file_path}":
|
||||||
owner => $owner,
|
owner => pick($owner, $::swift::params::user),
|
||||||
group => $group,
|
group => pick($group, $::swift::params::group),
|
||||||
notify => Anchor['swift::config::end'],
|
notify => Anchor['swift::config::end'],
|
||||||
require => Anchor['swift::install::end'],
|
require => Anchor['swift::install::end'],
|
||||||
tag => 'swift-concat',
|
tag => 'swift-concat',
|
||||||
|
@@ -50,6 +50,7 @@ define swift::storage::xfs(
|
|||||||
) {
|
) {
|
||||||
|
|
||||||
include swift::deps
|
include swift::deps
|
||||||
|
include swift::params
|
||||||
include swift::xfs
|
include swift::xfs
|
||||||
|
|
||||||
if $device == '' {
|
if $device == '' {
|
||||||
@@ -74,8 +75,8 @@ define swift::storage::xfs(
|
|||||||
if(!defined(File[$mnt_base_dir])) {
|
if(!defined(File[$mnt_base_dir])) {
|
||||||
file { $mnt_base_dir:
|
file { $mnt_base_dir:
|
||||||
ensure => directory,
|
ensure => directory,
|
||||||
owner => 'swift',
|
owner => $::swift::params::user,
|
||||||
group => 'swift',
|
group => $::swift::params::group,
|
||||||
require => Anchor['swift::config::begin'],
|
require => Anchor['swift::config::begin'],
|
||||||
before => Anchor['swift::config::end'],
|
before => Anchor['swift::config::end'],
|
||||||
}
|
}
|
||||||
|
@@ -1,8 +1,6 @@
|
|||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe 'swift::storage::mount' do
|
describe 'swift::storage::mount' do
|
||||||
# TODO add unit tests
|
|
||||||
|
|
||||||
let :title do
|
let :title do
|
||||||
'dans_mount_point'
|
'dans_mount_point'
|
||||||
end
|
end
|
||||||
@@ -44,16 +42,16 @@ describe 'swift::storage::mount' do
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
let :facts do
|
before do
|
||||||
{
|
facts.merge!({
|
||||||
:selinux => 'true',
|
:selinux => 'true',
|
||||||
}
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
it { is_expected.to contain_exec("restorecon_mount_dans_mount_point").with(
|
it { is_expected.to contain_exec("restorecon_mount_dans_mount_point").with(
|
||||||
{:command => "restorecon /srv/node/dans_mount_point",
|
:command => "restorecon /srv/node/dans_mount_point",
|
||||||
:path => ['/usr/sbin', '/sbin'],
|
:path => ['/usr/sbin', '/sbin'],
|
||||||
:refreshonly => true}
|
:refreshonly => true
|
||||||
)}
|
)}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@@ -3,7 +3,7 @@ devices = <%= @devices %>
|
|||||||
bind_ip = <%= @storage_local_net_ip %>
|
bind_ip = <%= @storage_local_net_ip %>
|
||||||
bind_port = <%= @bind_port %>
|
bind_port = <%= @bind_port %>
|
||||||
mount_check = <%= @mount_check %>
|
mount_check = <%= @mount_check %>
|
||||||
user = <%= @user %>
|
user = <%= @user_real %>
|
||||||
workers = <%= @workers %>
|
workers = <%= @workers %>
|
||||||
log_name = <%= @log_name %>
|
log_name = <%= @log_name %>
|
||||||
log_facility = <%= @log_facility %>
|
log_facility = <%= @log_facility %>
|
||||||
|
@@ -3,7 +3,7 @@ devices = <%= @devices %>
|
|||||||
bind_ip = <%= @storage_local_net_ip %>
|
bind_ip = <%= @storage_local_net_ip %>
|
||||||
bind_port = <%= @bind_port %>
|
bind_port = <%= @bind_port %>
|
||||||
mount_check = <%= @mount_check %>
|
mount_check = <%= @mount_check %>
|
||||||
user = <%= @user %>
|
user = <%= @user_real %>
|
||||||
log_name = <%= @log_name %>
|
log_name = <%= @log_name %>
|
||||||
log_facility = <%= @log_facility %>
|
log_facility = <%= @log_facility %>
|
||||||
log_level = <%= @log_level %>
|
log_level = <%= @log_level %>
|
||||||
|
@@ -4,7 +4,7 @@ bind_ip = <%= @storage_local_net_ip %>
|
|||||||
bind_port = <%= @bind_port %>
|
bind_port = <%= @bind_port %>
|
||||||
mount_check = <%= @mount_check %>
|
mount_check = <%= @mount_check %>
|
||||||
servers_per_port = <%= @servers_per_port %>
|
servers_per_port = <%= @servers_per_port %>
|
||||||
user = <%= @user %>
|
user = <%= @user_real %>
|
||||||
log_name = <%= @log_name %>
|
log_name = <%= @log_name %>
|
||||||
log_facility = <%= @log_facility %>
|
log_facility = <%= @log_facility %>
|
||||||
log_level = <%= @log_level %>
|
log_level = <%= @log_level %>
|
||||||
|
Reference in New Issue
Block a user