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