puppet-swift/manifests/storage/generic.pp
Mathieu Gagné 0098067226 Fix puppet-lint warnings about ensure
Fix warning: "ensure found on line but it's not the first attribute"

Change-Id: Iecc0cd4fe267c40fbef9a84ff1da2eaff5aa45a7
2013-08-25 23:29:34 -04:00

64 lines
1.7 KiB
Puppet

# Creates the files packages and services that are
# needed to deploy each type of storage server.
#
# == Parameters
# [*package_ensure*] The desired ensure state of the swift storage packages.
# Optional. Defaults to present.
# [*service_provider*] The provider to use for the service
#
# == Dependencies
# Requires Class[swift::storage]
# == Examples
#
# == Authors
#
# Dan Bode dan@puppetlabs.com
#
# == Copyright
#
# Copyright 2011 Puppetlabs Inc, unless otherwise noted.
define swift::storage::generic(
$package_ensure = 'present',
$service_provider = $::swift::params::service_provider
) {
include swift::params
Class['swift::storage'] -> Swift::Storage::Generic[$name]
validate_re($name, '^object|container|account$')
package { "swift-${name}":
ensure => $package_ensure,
# this is a way to dynamically build the variables to lookup
# sorry its so ugly :(
name => inline_template("<%= scope.lookupvar('::swift::params::${name}_package_name') %>"),
before => Service["swift-${name}", "swift-${name}-replicator"],
}
file { "/etc/swift/${name}-server/":
ensure => directory,
owner => 'swift',
group => 'swift',
}
service { "swift-${name}":
ensure => running,
name => inline_template("<%= scope.lookupvar('::swift::params::${name}_service_name') %>"),
enable => true,
hasstatus => true,
provider => $service_provider,
subscribe => Package["swift-${name}"],
}
service { "swift-${name}-replicator":
ensure => running,
name => inline_template("<%= scope.lookupvar('::swift::params::${name}_replicator_service_name') %>"),
enable => true,
hasstatus => true,
provider => $service_provider,
subscribe => Package["swift-${name}"],
}
}