From 88c4954f0bf1e734db382e91aca67b9e5b82ffc9 Mon Sep 17 00:00:00 2001 From: Derek Higgins Date: Fri, 17 Aug 2012 15:27:54 +0100 Subject: [PATCH] Starting the swift replicator with /usr/bin/swift-init on RedHat Should be changed back to init script when one becomes part of the package. Includes test to ensure original functionality hasn't changed on Ubuntu --- manifests/storage/generic.pp | 25 ++++++++++++++++------ spec/defines/swift_storage_generic_spec.rb | 6 ++++++ 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/manifests/storage/generic.pp b/manifests/storage/generic.pp index 9f97b036..e6ba17b7 100644 --- a/manifests/storage/generic.pp +++ b/manifests/storage/generic.pp @@ -51,13 +51,24 @@ define swift::storage::generic( subscribe => Package["swift-${name}"], } - service { "swift-${name}-replicator": - name => inline_template("<%= scope.lookupvar('::swift::params::${name}_replicator_service_name') %>"), - ensure => running, - enable => true, - hasstatus => true, - provider => $service_provider, - subscribe => Package["swift-${name}"], + if $::osfamily == "RedHat" { + service { "swift-${name}-replicator": + start => "/usr/bin/swift-init ${name}-replicator start", + ensure => running, + enable => true, + hasstatus => true, + provider => base, + subscribe => Package["swift-${name}"], + } + }else{ + service { "swift-${name}-replicator": + name => inline_template("<%= scope.lookupvar('::swift::params::${name}_replicator_service_name') %>"), + ensure => running, + enable => true, + hasstatus => true, + provider => $service_provider, + subscribe => Package["swift-${name}"], + } } } diff --git a/spec/defines/swift_storage_generic_spec.rb b/spec/defines/swift_storage_generic_spec.rb index f1509b83..4094350d 100644 --- a/spec/defines/swift_storage_generic_spec.rb +++ b/spec/defines/swift_storage_generic_spec.rb @@ -55,6 +55,12 @@ describe 'swift::storage::generic' do :hasstatus => true, :provider => param_hash[:service_provider] )} + it { should contain_service("swift-#{t}-replicator").with( + :ensure => 'running', + :enable => true, + :hasstatus => true, + :provider => param_hash[:service_provider] + )} it { should contain_file("/etc/swift/#{t}-server/").with( :ensure => 'directory', :owner => 'swift',