puppet-swift/manifests/storage/account.pp
Emilien Macchi 1b8869e6ae Pass subscribe and require into service resource
Before this update, subscribe and require could be passed
into the service class and work due to some default puppet
behaviors. This resulted in unknown variable warnings.  Removal
of these parameters would remove the required resource dependencies.

Adding new parameters 'service_subscribe' and 'service_require'
to pass in these dependencies. The 'service_' prefix is used
here because use of 'subscribe' or 'require' as parameter names
would also print a meta parameter warning.

Change-Id: I33d2d6028347bbe50dc9b3f36b3f86b217db7c0c
2016-11-21 23:35:23 +00:00

66 lines
2.0 KiB
Puppet

# Class swift::storage::account
#
# == Parameters
# [*enabled*]
# (optional) Should the service be enabled to start
# at boot. Defaults to true
#
# [*manage_service*]
# (optional) Whether the service should be managed by Puppet.
# Defaults to true.
#
# [*package_ensure*]
# (optional) Value of package resource parameter 'ensure'.
# Defaults to 'present'.
#
# [*config_file_name*]
# (optional) The configuration file name.
# Starting at the path "/etc/swift/"
# Defaults to "account-server.conf"
#
# [*service_provider*]
# (optional)
# To use the swiftinit service provider to manage swift services, set
# service_provider to "swiftinit". When enable is true the provider
# will populate boot files that start swift using swift-init at boot.
# See README for more details.
# Defaults to $::swift::params::service_provider.
#
class swift::storage::account(
$manage_service = true,
$enabled = true,
$package_ensure = 'present',
$config_file_name = 'account-server.conf',
$service_provider = $::swift::params::service_provider
) inherits ::swift::params {
include ::swift::deps
Swift_config<| |> ~> Service['swift-account-reaper']
swift::storage::generic { 'account':
manage_service => $manage_service,
enabled => $enabled,
package_ensure => $package_ensure,
config_file_name => $config_file_name,
service_provider => $service_provider
}
if $manage_service {
if $enabled {
$service_ensure = 'running'
} else {
$service_ensure = 'stopped'
}
}
swift::service { 'swift-account-reaper':
os_family_service_name => $::swift::params::account_reaper_service_name,
service_ensure => $service_ensure,
enabled => $enabled,
config_file_name => $config_file_name,
service_provider => $service_provider,
service_require => Package['swift-account'],
service_subscribe => Concat["/etc/swift/${config_file_name}"],
}
}