From b27b55b42a14e4e5499d81d668147b8f0ab89855 Mon Sep 17 00:00:00 2001 From: Rob Sweet Date: Fri, 8 May 2015 11:58:00 -0400 Subject: [PATCH] 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 --- manifests/ovs.pp | 3 +-- spec/classes/vswitch_ovs_spec.rb | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/manifests/ovs.pp b/manifests/ovs.pp index 9735e4af..554dd60a 100644 --- a/manifests/ovs.pp +++ b/manifests/ovs.pp @@ -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, } diff --git a/spec/classes/vswitch_ovs_spec.rb b/spec/classes/vswitch_ovs_spec.rb index 5cbb0281..0dc57ba1 100644 --- a/spec/classes/vswitch_ovs_spec.rb +++ b/spec/classes/vswitch_ovs_spec.rb @@ -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