Notify cgconfigparser service after config change

Provide cgconfigparser restart command

Cgconfigparser service is simple script, not a daemon
because of this it is always marked as stopped by upstart.

We need to provide restart + status method to properly
restart cgconfigparser.

Change-Id: If35a62f44a20d5f2d9809b53de5ad65ce1235b89
Closes-Bug: #1564358
This commit is contained in:
Bartosz Kupidura 2016-03-31 13:16:00 +02:00
parent e883be9412
commit 57e10ad82a
3 changed files with 11 additions and 6 deletions

View File

@ -29,11 +29,13 @@ class cgroups(
file { '/etc/cgconfig.conf':
content => template('cgroups/cgconfig.conf.erb'),
notify => Service['cgconfigparser'],
tag => 'cgroups',
}
file { '/etc/cgrules.conf':
content => template('cgroups/cgrules.conf.erb'),
notify => Service['cgrulesengd'],
tag => 'cgroups',
}
@ -41,9 +43,6 @@ class cgroups(
cgroups_settings => $cgroups_set,
}
File <| tag == 'cgroups' |> ~>
Service['cgrulesengd']
Package <| tag == 'cgroups' |> ~>
Service['cgrulesengd']

View File

@ -8,8 +8,11 @@ class cgroups::service (
}
service { 'cgconfigparser':
ensure => running,
require => Service['cgroup-lite'],
ensure => running,
hasstatus => false,
status => '/bin/true',
restart => 'service cgconfigparser restart',
require => Service['cgroup-lite'],
}
service { 'cgrulesengd':

View File

@ -32,8 +32,11 @@ describe 'cgroups', :type => :class do
end
%w(/etc/cgconfig.conf /etc/cgrules.conf).each do |cg_file|
it { is_expected.to contain_file(cg_file).that_notifies('Service[cgrulesengd]').with(file_defaults) }
it { is_expected.to contain_file(cg_file).with(file_defaults) }
it { p catalogue.resource 'file', cg_file }
end
it { is_expected.to contain_file('/etc/cgrules.conf').that_notifies('Service[cgrulesengd]') }
it { is_expected.to contain_file('/etc/cgconfig.conf').that_notifies('Service[cgconfigparser]') }
end
end