Red Hat: Add crond service support
- Add cron service support for both Debian & RH OS families. - Clean unit tests Bug #396 Signed-off-by: Emilien Macchi <emilien.macchi@enovance.com>
This commit is contained in:
@@ -67,7 +67,13 @@ This node is under the control of Puppet ${::puppetversion}.
|
|||||||
uid => '0',
|
uid => '0',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$cron_service_name = $::osfamily ? {
|
||||||
|
'RedHat' => 'crond',
|
||||||
|
default => 'cron',
|
||||||
|
}
|
||||||
|
|
||||||
service { 'cron':
|
service { 'cron':
|
||||||
|
name => $cron_service_name,
|
||||||
ensure => running,
|
ensure => running,
|
||||||
enable => true
|
enable => true
|
||||||
}
|
}
|
||||||
|
@@ -20,6 +20,10 @@ require 'spec_helper'
|
|||||||
|
|
||||||
describe 'cloud' do
|
describe 'cloud' do
|
||||||
|
|
||||||
|
let :params do
|
||||||
|
{ }
|
||||||
|
end
|
||||||
|
|
||||||
shared_examples_for 'private cloud node' do
|
shared_examples_for 'private cloud node' do
|
||||||
|
|
||||||
let :pre_condition do
|
let :pre_condition do
|
||||||
@@ -37,26 +41,8 @@ describe 'cloud' do
|
|||||||
{:ensure => 'file'}.merge(file_defaults)
|
{:ensure => 'file'}.merge(file_defaults)
|
||||||
)}
|
)}
|
||||||
|
|
||||||
it 'should build motd file with correct message' do
|
it { should contain_service('cron').with({
|
||||||
verify_contents(subject, '/etc/motd',
|
:name => platform_params[:cron_service_name],
|
||||||
[
|
|
||||||
"############################################################################",
|
|
||||||
"# eNovance IT Operations #",
|
|
||||||
"############################################################################",
|
|
||||||
"# #",
|
|
||||||
"# *** RESTRICTED ACCESS *** #",
|
|
||||||
"# Only the authorized users may access this system. #",
|
|
||||||
"# Any attempted unauthorized access or any action affecting the computer #",
|
|
||||||
"# system of eNovance is punishable under articles 323-1 to 323-7 of #",
|
|
||||||
"# French criminal law. #",
|
|
||||||
"# #",
|
|
||||||
"############################################################################",
|
|
||||||
"This node is under the control of Puppet ${::puppetversion}."
|
|
||||||
]
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
it { shoud contain_service('cron').with({
|
|
||||||
:ensure => 'running',
|
:ensure => 'running',
|
||||||
:enable => true
|
:enable => true
|
||||||
}) }
|
}) }
|
||||||
@@ -70,7 +56,11 @@ describe 'cloud' do
|
|||||||
:puppetversion => '3.3' }
|
:puppetversion => '3.3' }
|
||||||
end
|
end
|
||||||
|
|
||||||
# it_configures 'private cloud node'
|
let :platform_params do
|
||||||
|
{ :cron_service_name => 'cron'}
|
||||||
|
end
|
||||||
|
|
||||||
|
it_configures 'private cloud node'
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'on RedHat platforms' do
|
context 'on RedHat platforms' do
|
||||||
@@ -81,11 +71,15 @@ describe 'cloud' do
|
|||||||
:hostname => 'redhat1' }
|
:hostname => 'redhat1' }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
let :platform_params do
|
||||||
|
{ :cron_service_name => 'crond'}
|
||||||
|
end
|
||||||
|
|
||||||
let :params do
|
let :params do
|
||||||
{ :rhn_registration => { "username" => "rhn", "password" => "pass" } }
|
{ :rhn_registration => { "username" => "rhn", "password" => "pass" } }
|
||||||
end
|
end
|
||||||
|
|
||||||
# it_configures 'private cloud node'
|
it_configures 'private cloud node'
|
||||||
|
|
||||||
it { should contain_rhn_register('rhn-redhat1') }
|
it { should contain_rhn_register('rhn-redhat1') }
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user