Add manage_service feature
puppet-glance lacks of disabling service managing. This patch adds $manage_service parameter to relevant classes. Change-Id: I222b1a3318f5163f6ad1e39cbb8be10c440ab99f Closes-bug: #1359823
This commit is contained in:
parent
a432119ff6
commit
da217a13f5
|
@ -96,6 +96,10 @@
|
|||
# (optional) User to authenticate as with keystone.
|
||||
# Defaults to 'glance'.
|
||||
#
|
||||
# [*manage_service*]
|
||||
# (optional) If Puppet should manage service startup / shutdown.
|
||||
# Defaults to true.
|
||||
#
|
||||
# [*enabled*]
|
||||
# (optional) Whether to enable services.
|
||||
# Defaults to true.
|
||||
|
@ -183,6 +187,7 @@ class glance::api(
|
|||
$pipeline = 'keystone+cachemanagement',
|
||||
$keystone_tenant = 'services',
|
||||
$keystone_user = 'glance',
|
||||
$manage_service = true,
|
||||
$enabled = true,
|
||||
$use_syslog = false,
|
||||
$log_facility = 'LOG_USER',
|
||||
|
@ -425,10 +430,12 @@ class glance::api(
|
|||
'/etc/glance/glance-cache.conf']:
|
||||
}
|
||||
|
||||
if $enabled {
|
||||
$service_ensure = 'running'
|
||||
} else {
|
||||
$service_ensure = 'stopped'
|
||||
if $manage_service {
|
||||
if $enabled {
|
||||
$service_ensure = 'running'
|
||||
} else {
|
||||
$service_ensure = 'stopped'
|
||||
}
|
||||
}
|
||||
|
||||
service { 'glance-api':
|
||||
|
|
|
@ -84,8 +84,13 @@
|
|||
# (optional) Syslog facility to receive log lines.
|
||||
# Defaults to LOG_USER.
|
||||
#
|
||||
# [*manage_service*]
|
||||
# (optional) If Puppet should manage service startup / shutdown.
|
||||
# Defaults to true.
|
||||
#
|
||||
# [*enabled*]
|
||||
# (optional) Should the service be enabled. Defaults to true.
|
||||
# (optional) Should the service be enabled.
|
||||
# Defaults to true.
|
||||
#
|
||||
# [*purge_config*]
|
||||
# (optional) Whether to create only the specified config values in
|
||||
|
@ -130,6 +135,7 @@ class glance::registry(
|
|||
$pipeline = 'keystone',
|
||||
$use_syslog = false,
|
||||
$log_facility = 'LOG_USER',
|
||||
$manage_service = true,
|
||||
$enabled = true,
|
||||
$purge_config = false,
|
||||
$cert_file = false,
|
||||
|
@ -319,21 +325,23 @@ class glance::registry(
|
|||
'/etc/glance/glance-registry-paste.ini']:
|
||||
}
|
||||
|
||||
if $enabled {
|
||||
|
||||
Exec['glance-manage db_sync'] ~> Service['glance-registry']
|
||||
if $manage_service {
|
||||
if $enabled {
|
||||
Exec['glance-manage db_sync'] ~> Service['glance-registry']
|
||||
|
||||
exec { 'glance-manage db_sync':
|
||||
command => $::glance::params::db_sync_command,
|
||||
path => '/usr/bin',
|
||||
user => 'glance',
|
||||
refreshonly => true,
|
||||
logoutput => on_failure,
|
||||
subscribe => [Package[$glance::params::registry_package_name], File['/etc/glance/glance-registry.conf']],
|
||||
exec { 'glance-manage db_sync':
|
||||
command => $::glance::params::db_sync_command,
|
||||
path => '/usr/bin',
|
||||
user => 'glance',
|
||||
refreshonly => true,
|
||||
logoutput => on_failure,
|
||||
subscribe => [Package[$glance::params::registry_package_name], File['/etc/glance/glance-registry.conf']],
|
||||
}
|
||||
$service_ensure = 'running'
|
||||
} else {
|
||||
$service_ensure = 'stopped'
|
||||
}
|
||||
$service_ensure = 'running'
|
||||
} else {
|
||||
$service_ensure = 'stopped'
|
||||
}
|
||||
|
||||
service { 'glance-registry':
|
||||
|
|
|
@ -22,6 +22,7 @@ describe 'glance::api' do
|
|||
:log_dir => '/var/log/glance',
|
||||
:auth_type => 'keystone',
|
||||
:enabled => true,
|
||||
:manage_service => true,
|
||||
:backlog => '4096',
|
||||
:workers => '7',
|
||||
:auth_host => '127.0.0.1',
|
||||
|
@ -81,7 +82,7 @@ describe 'glance::api' do
|
|||
it { should contain_class 'glance' }
|
||||
|
||||
it { should contain_service('glance-api').with(
|
||||
'ensure' => param_hash[:enabled] ? 'running': 'stopped',
|
||||
'ensure' => (param_hash[:manage_service] && param_hash[:enabled]) ? 'running': 'stopped',
|
||||
'enable' => param_hash[:enabled],
|
||||
'hasstatus' => true,
|
||||
'hasrestart' => true
|
||||
|
@ -154,6 +155,23 @@ describe 'glance::api' do
|
|||
end
|
||||
end
|
||||
|
||||
describe 'with disabled service managing' do
|
||||
let :params do
|
||||
{
|
||||
:keystone_password => 'ChangeMe',
|
||||
:manage_service => false,
|
||||
:enabled => false,
|
||||
}
|
||||
end
|
||||
|
||||
it { should contain_service('glance-api').with(
|
||||
'ensure' => nil,
|
||||
'enable' => false,
|
||||
'hasstatus' => true,
|
||||
'hasrestart' => true
|
||||
) }
|
||||
end
|
||||
|
||||
describe 'with overridden pipeline' do
|
||||
let :params do
|
||||
{
|
||||
|
|
|
@ -18,6 +18,7 @@ describe 'glance::registry' do
|
|||
:database_connection => 'sqlite:///var/lib/glance/glance.sqlite',
|
||||
:database_idle_timeout => '3600',
|
||||
:enabled => true,
|
||||
:manage_service => true,
|
||||
:auth_type => 'keystone',
|
||||
:auth_host => '127.0.0.1',
|
||||
:auth_port => '35357',
|
||||
|
@ -64,7 +65,7 @@ describe 'glance::registry' do
|
|||
it { should contain_class 'glance::registry' }
|
||||
|
||||
it { should contain_service('glance-registry').with(
|
||||
'ensure' => param_hash[:enabled] ? 'running' : 'stopped',
|
||||
'ensure' => (param_hash[:manage_service] && param_hash[:enabled]) ? 'running' : 'stopped',
|
||||
'enable' => param_hash[:enabled],
|
||||
'hasstatus' => true,
|
||||
'hasrestart' => true,
|
||||
|
@ -118,6 +119,25 @@ describe 'glance::registry' do
|
|||
end
|
||||
end
|
||||
|
||||
describe 'with disabled service managing' do
|
||||
let :params do
|
||||
{
|
||||
:keystone_password => 'ChangeMe',
|
||||
:manage_service => false,
|
||||
:enabled => false,
|
||||
}
|
||||
end
|
||||
|
||||
it { should contain_service('glance-registry').with(
|
||||
'ensure' => nil,
|
||||
'enable' => false,
|
||||
'hasstatus' => true,
|
||||
'hasrestart' => true,
|
||||
'subscribe' => 'File[/etc/glance/glance-registry.conf]',
|
||||
'require' => 'Class[Glance]'
|
||||
)}
|
||||
end
|
||||
|
||||
describe 'with overridden pipeline' do
|
||||
# At the time of writing there was only blank and keystone as options
|
||||
# but there is no reason that there can't be more options in the future.
|
||||
|
|
Loading…
Reference in New Issue