3566f9fa65
When creating the filter class name the last part is not capitalized. So Swift::Storage::Filter::Healthcheck[bla] is named Swift::Storage::Filter::healthcheck[bla]. Puppet don't detect the syntax error as the resource is "created" within a string. But puppetdb's parser do not let this work. This fix it and adjust the tests. Change-Id: If11c3ad0e98d14b9387b3daa4afeb118387100f8 Closes-Bug: #1252998
83 lines
2.5 KiB
ObjectPascal
83 lines
2.5 KiB
ObjectPascal
#
|
|
# I am not sure if this is the right name
|
|
# - should it be device?
|
|
#
|
|
# name - is going to be port
|
|
define swift::storage::server(
|
|
$type,
|
|
$storage_local_net_ip,
|
|
$devices = '/srv/node',
|
|
$owner = 'swift',
|
|
$group = 'swift',
|
|
$max_connections = 25,
|
|
$pipeline = ["${type}-server"],
|
|
$mount_check = false,
|
|
$user = 'swift',
|
|
$workers = '1',
|
|
$allow_versions = false,
|
|
$replicator_concurrency = $::processorcount,
|
|
$updater_concurrency = $::processorcount,
|
|
$reaper_concurrency = $::processorcount,
|
|
$log_facility = 'LOG_LOCAL2',
|
|
$log_level = 'INFO',
|
|
$log_address = '/dev/log',
|
|
# this parameters needs to be specified after type and name
|
|
$config_file_path = "${type}-server/${name}.conf"
|
|
) {
|
|
|
|
# TODO if array does not include type-server, warn
|
|
if(
|
|
(is_array($pipeline) and ! member($pipeline, "${type}-server")) or
|
|
$pipeline != "${type}-server"
|
|
) {
|
|
warning("swift storage server ${type} must specify ${type}-server")
|
|
}
|
|
|
|
include "swift::storage::${type}"
|
|
include concat::setup
|
|
|
|
validate_re($name, '^\d+$')
|
|
validate_re($type, '^object|container|account$')
|
|
validate_array($pipeline)
|
|
validate_bool($allow_versions)
|
|
# TODO - validate that name is an integer
|
|
|
|
$bind_port = $name
|
|
|
|
rsync::server::module { $type:
|
|
path => $devices,
|
|
lock_file => "/var/lock/${type}.lock",
|
|
uid => $owner,
|
|
gid => $group,
|
|
max_connections => $max_connections,
|
|
read_only => false,
|
|
}
|
|
|
|
concat { "/etc/swift/${config_file_path}":
|
|
owner => $owner,
|
|
group => $group,
|
|
notify => Service["swift-${type}", "swift-${type}-replicator"],
|
|
mode => 640,
|
|
}
|
|
|
|
$required_middlewares = split(
|
|
inline_template(
|
|
"<%=
|
|
(pipeline - ['${type}-server']).collect do |x|
|
|
'Swift::Storage::Filter::' + x.capitalize + '[${type}]'
|
|
end.join(',')
|
|
%>"), ',')
|
|
|
|
# you can now add your custom fragments at the user level
|
|
concat::fragment { "swift-${type}-${name}":
|
|
target => "/etc/swift/${config_file_path}",
|
|
content => template("swift/${type}-server.conf.erb"),
|
|
order => '00',
|
|
# require classes for each of the elements of the pipeline
|
|
# this is to ensure the user gets reasonable elements if he
|
|
# does not specify the backends for every specified element of
|
|
# the pipeline
|
|
before => $required_middlewares,
|
|
}
|
|
}
|