From 83ad1e5aa539b545bc546eca577499cd06477b6e Mon Sep 17 00:00:00 2001 From: Denis Egorenko Date: Tue, 24 May 2016 16:32:57 +0300 Subject: [PATCH] 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 --- manifests/ovs.pp | 11 +++++++++-- spec/classes/vswitch_ovs_spec.rb | 22 ++++++++++++---------- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/manifests/ovs.pp b/manifests/ovs.pp index acb29cfe..261afa56 100644 --- a/manifests/ovs.pp +++ b/manifests/ovs.pp @@ -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' diff --git a/spec/classes/vswitch_ovs_spec.rb b/spec/classes/vswitch_ovs_spec.rb index 4ce6ee95..5d0789a2 100644 --- a/spec/classes/vswitch_ovs_spec.rb +++ b/spec/classes/vswitch_ovs_spec.rb @@ -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