Fix ovs status command

Make sure the status command returns failure if either the ovsdb-server
or ovs-vswitchd are stopped.

Closes-Bug: 1453211
Change-Id: I372e3f387deb2930d10c209afa3773c7ba3877e3
This commit is contained in:
Rob Sweet 2015-05-08 11:58:00 -04:00 committed by Alex Schultz
parent 989e6a96d5
commit b27b55b42a
2 changed files with 2 additions and 3 deletions

View File

@ -52,7 +52,7 @@ class vswitch::ovs(
$ovs_status = '/sbin/status openvswitch-switch | fgrep "start/running"'
}
default: {
$ovs_status = '/etc/init.d/openvswitch-switch status | fgrep "is running"'
$ovs_status = '/etc/init.d/openvswitch-switch status | fgrep -q "not running"; if [ $? -eq 0 ]; then exit 1; else exit 0; fi'
}
}
service { 'openvswitch':
@ -60,7 +60,6 @@ class vswitch::ovs(
enable => true,
name => $::vswitch::params::ovs_service_name,
hasstatus => false, # the supplied command returns true even if it's not running
# Not perfect - should spot if either service is not running - but it'll do
status => $ovs_status,
}

View File

@ -21,7 +21,7 @@ describe 'vswitch::ovs' do
:ovs_service_name => 'openvswitch-switch',
:provider => 'ovs',
:service_hasstatus => false,
:service_status => '/etc/init.d/openvswitch-switch status | fgrep "is running"',
:service_status => '/etc/init.d/openvswitch-switch status | fgrep -q "not running"; if [ $? -eq 0 ]; then exit 1; else exit 0; fi',
}
end