Add check status command for Ubuntu 16.04

Add case for status command for Ubuntu 16.04 (Xenial), which
doesn't have upstart.

Change-Id: I2c96e114ad642a7666b6039ada9d1fa50ad8bdcd
This commit is contained in:
Denis Egorenko 2016-05-24 16:32:57 +03:00
parent a14015f489
commit 83ad1e5aa5
2 changed files with 21 additions and 12 deletions

View File

@ -48,8 +48,15 @@ class vswitch::ovs(
}
case $::operatingsystem {
'ubuntu': {
$ovs_status = '/sbin/status openvswitch-switch | fgrep "start/running"'
'Ubuntu': {
# ubuntu 16.04 doesn't have upstart
# this workaround should be removed when https://bugs.launchpad.net/ubuntu/+source/openvswitch/+bug/1585201
# will be resolved
if versioncmp($::operatingsystemmajrelease, '16') >= 0 {
$ovs_status = '/etc/init.d/openvswitch-switch status | fgrep -q "not running"; if [ $? -eq 0 ]; then exit 1; else exit 0; fi'
} else {
$ovs_status = '/sbin/status openvswitch-switch | fgrep "start/running"'
}
}
default: {
$ovs_status = '/etc/init.d/openvswitch-switch status | fgrep -q "not running"; if [ $? -eq 0 ]; then exit 1; else exit 0; fi'

View File

@ -107,8 +107,8 @@ describe 'vswitch::ovs' do
let :params do default_params end
let :facts do
{:osfamily => 'Redhat',
:ovs_version => '1.4.2',
{:osfamily => 'Redhat',
:ovs_version => '1.4.2',
}
end
@ -126,8 +126,8 @@ describe 'vswitch::ovs' do
end
let :facts do
{:osfamily => 'Redhat',
:ovs_version => '1.4.2',
{:osfamily => 'Redhat',
:ovs_version => '1.4.2',
}
end
let :platform_params do redhat_platform_params end
@ -174,9 +174,10 @@ describe 'vswitch::ovs' do
let :params do default_params end
let :facts do
{:osfamily => 'Debian',
:operatingsystem => 'ubuntu',
:ovs_version => '1.4.2',
{:osfamily => 'Debian',
:operatingsystem => 'Ubuntu',
:operatingsystemmajrelease => '14',
:ovs_version => '1.4.2',
}
end
let :platform_params do ubuntu_platform_params end
@ -193,9 +194,10 @@ describe 'vswitch::ovs' do
end
let :facts do
{:osfamily => 'Debian',
:operatingsystem => 'ubuntu',
:ovs_version => '1.4.2',
{:osfamily => 'Debian',
:operatingsystem => 'Ubuntu',
:operatingsystemmajrelease => '14',
:ovs_version => '1.4.2',
}
end
let :platform_params do ubuntu_platform_params end