Use static service resource name
... which is independent from actual service name, to avoid difference in distros. Change-Id: I3a6b8e58d89be6651726d6c533ea77a0009a525e Signed-off-by: Takashi Kajinami <kajinamit@oss.nttdata.com>
This commit is contained in:
@@ -37,7 +37,7 @@ class zaqar::server (
|
|||||||
}
|
}
|
||||||
|
|
||||||
if $service_name == $zaqar::params::service_name {
|
if $service_name == $zaqar::params::service_name {
|
||||||
service { $zaqar::params::service_name:
|
service { 'zaqar-server':
|
||||||
ensure => $ensure,
|
ensure => $ensure,
|
||||||
name => $zaqar::params::service_name,
|
name => $zaqar::params::service_name,
|
||||||
enable => $enabled,
|
enable => $enabled,
|
||||||
@@ -45,7 +45,7 @@ class zaqar::server (
|
|||||||
tag => 'zaqar-service',
|
tag => 'zaqar-service',
|
||||||
}
|
}
|
||||||
} elsif $service_name == 'httpd' {
|
} elsif $service_name == 'httpd' {
|
||||||
service { $zaqar::params::service_name:
|
service { 'zaqar-server':
|
||||||
ensure => 'stopped',
|
ensure => 'stopped',
|
||||||
name => $zaqar::params::service_name,
|
name => $zaqar::params::service_name,
|
||||||
enable => false,
|
enable => false,
|
||||||
@@ -53,7 +53,7 @@ class zaqar::server (
|
|||||||
}
|
}
|
||||||
|
|
||||||
# we need to make sure zaqar-server is stopped before trying to start apache
|
# we need to make sure zaqar-server is stopped before trying to start apache
|
||||||
Service[$zaqar::params::service_name] -> Service[$service_name]
|
Service['zaqar-server'] -> Service[$service_name]
|
||||||
Service <| title == 'httpd' |> { tag +> 'zaqar-service' }
|
Service <| title == 'httpd' |> { tag +> 'zaqar-service' }
|
||||||
} else {
|
} else {
|
||||||
fail("Invalid service_name. Either zaqar-server/openstack-zaqar for \
|
fail("Invalid service_name. Either zaqar-server/openstack-zaqar for \
|
||||||
|
|||||||
@@ -34,10 +34,11 @@ define zaqar::server_instance (
|
|||||||
content => template('zaqar/zaqar.conf.erb'),
|
content => template('zaqar/zaqar.conf.erb'),
|
||||||
}
|
}
|
||||||
|
|
||||||
service { "${zaqar::params::service_name}@${name}":
|
service { "zaqar-server@${name}":
|
||||||
ensure => $service_ensure,
|
ensure => $service_ensure,
|
||||||
|
name => "${zaqar::params::service_name}@${name}",
|
||||||
enable => $enabled,
|
enable => $enabled,
|
||||||
tag => 'zaqar-service',
|
tag => ['zaqar-service'],
|
||||||
}
|
}
|
||||||
|
|
||||||
Package['zaqar-common'] ~> File["/etc/zaqar/${name}.conf"]
|
Package['zaqar-common'] ~> File["/etc/zaqar/${name}.conf"]
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ require 'spec_helper'
|
|||||||
describe 'zaqar::server' do
|
describe 'zaqar::server' do
|
||||||
|
|
||||||
shared_examples_for 'zaqar::server' do
|
shared_examples_for 'zaqar::server' do
|
||||||
describe 'with a zaqar server enabled' do
|
|
||||||
let :pre_condition do
|
let :pre_condition do
|
||||||
"class { 'zaqar::keystone::authtoken':
|
"class { 'zaqar::keystone::authtoken':
|
||||||
password => 'foo',
|
password => 'foo',
|
||||||
@@ -10,15 +9,39 @@ describe 'zaqar::server' do
|
|||||||
class { 'zaqar::keystone::trust':
|
class { 'zaqar::keystone::trust':
|
||||||
password => 'foo',
|
password => 'foo',
|
||||||
}
|
}
|
||||||
class { 'zaqar': }"
|
class { 'zaqar': }
|
||||||
|
class { 'apache': }"
|
||||||
end
|
end
|
||||||
|
|
||||||
it { is_expected.to contain_service(platform_params[:zaqar_service_name]).with(
|
context 'with defaults' do
|
||||||
|
it { is_expected.to contain_service('zaqar-server').with(
|
||||||
:ensure => 'running',
|
:ensure => 'running',
|
||||||
:enable => true
|
:name => platform_params[:zaqar_service_name],
|
||||||
|
:enable => true,
|
||||||
|
:tag => ['zaqar-service'],
|
||||||
)}
|
)}
|
||||||
it { is_expected.to contain_class('zaqar::policy') }
|
it { is_expected.to contain_class('zaqar::policy') }
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when running zaqar-server in wsgi' do
|
||||||
|
let :params do
|
||||||
|
{ :service_name => 'httpd' }
|
||||||
|
end
|
||||||
|
|
||||||
|
it { is_expected.to contain_service('zaqar-server').with(
|
||||||
|
:ensure => 'stopped',
|
||||||
|
:name => platform_params[:zaqar_service_name],
|
||||||
|
:enable => false,
|
||||||
|
:tag => ['zaqar-service'],
|
||||||
|
)}
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'with service management disabled' do
|
||||||
|
let :params do
|
||||||
|
{ :manage_service => false }
|
||||||
|
end
|
||||||
|
|
||||||
|
it { is_expected.to_not contain_service('zaqar-server') }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -24,9 +24,11 @@ describe 'zaqar::server_instance' do
|
|||||||
end
|
end
|
||||||
|
|
||||||
context 'with a websocket server instance 1' do
|
context 'with a websocket server instance 1' do
|
||||||
it { is_expected.to contain_service("#{platform_params[:zaqar_service_name]}@1").with(
|
it { is_expected.to contain_service('zaqar-server@1').with(
|
||||||
:ensure => 'running',
|
:ensure => 'running',
|
||||||
:enable => true
|
:name => "#{platform_params[:zaqar_service_name]}@1",
|
||||||
|
:enable => true,
|
||||||
|
:tag => ['zaqar-service'],
|
||||||
)}
|
)}
|
||||||
it { is_expected.to contain_file('/etc/zaqar/1.conf') }
|
it { is_expected.to contain_file('/etc/zaqar/1.conf') }
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user