rework service and fix service for debian jessie
- use ::vswitch::params for service parameters - on debian jessie openvswitch has now proper init scripts with status. This patch avoids restarting ovs on each puppet run on jessie. - this patch breaks debian versions older than wheezy (which are not supported by debian anymore) Change-Id: I48c81b9987935c848009b4bf3ed010c70ab1a404 Co-Authored-By: Alex Schultz <aschultz@redhat.com>
This commit is contained in:
parent
3bf8dbb121
commit
0b1ea47ed2
@ -47,29 +47,6 @@ class vswitch::ovs(
|
||||
}
|
||||
}
|
||||
|
||||
case $::operatingsystem {
|
||||
'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'
|
||||
}
|
||||
}
|
||||
service { 'openvswitch':
|
||||
ensure => true,
|
||||
enable => true,
|
||||
name => $::vswitch::params::ovs_service_name,
|
||||
hasstatus => false, # the supplied command returns true even if it's not running
|
||||
status => $ovs_status,
|
||||
}
|
||||
|
||||
if $::ovs_version {
|
||||
$major_version = regsubst($::ovs_version, '^(\d+).*', '\1')
|
||||
if $major_version == '1' {
|
||||
@ -80,51 +57,35 @@ class vswitch::ovs(
|
||||
}
|
||||
|
||||
}
|
||||
'Redhat': {
|
||||
service { 'openvswitch':
|
||||
ensure => true,
|
||||
enable => true,
|
||||
name => $::vswitch::params::ovs_service_name,
|
||||
}
|
||||
}
|
||||
'FreeBSD': {
|
||||
Package {
|
||||
provider => 'pkgng',
|
||||
}
|
||||
service { 'ovsdb-server':
|
||||
ensure => true,
|
||||
enable => true,
|
||||
name => $::vswitch::params::ovsdb_service_name,
|
||||
status => $::vswitch::params::ovsdb_status,
|
||||
}
|
||||
~>
|
||||
service { 'openvswitch':
|
||||
ensure => true,
|
||||
enable => true,
|
||||
name => $::vswitch::params::ovs_service_name,
|
||||
status => $::vswitch::params::ovs_status,
|
||||
}
|
||||
}
|
||||
'Solaris': {
|
||||
service { 'ovsdb-server':
|
||||
ensure => true,
|
||||
enable => true,
|
||||
name => $::vswitch::params::ovsdb_service_name,
|
||||
status => $::vswitch::params::ovsdb_status,
|
||||
}
|
||||
~>
|
||||
service { 'openvswitch':
|
||||
ensure => true,
|
||||
enable => true,
|
||||
name => $::vswitch::params::ovs_service_name,
|
||||
status => $::vswitch::params::ovs_status,
|
||||
}
|
||||
}
|
||||
default: {
|
||||
fail( "${::osfamily} not yet supported by puppet-vswitch")
|
||||
# to appease the lint gods.
|
||||
}
|
||||
}
|
||||
|
||||
service { 'openvswitch':
|
||||
ensure => true,
|
||||
enable => true,
|
||||
name => $::vswitch::params::ovs_service_name,
|
||||
status => $::vswitch::params::ovs_status,
|
||||
hasstatus => $::vswitch::params::ovs_service_hasstatus
|
||||
}
|
||||
|
||||
if $::vswitch::params::ovsdb_service_name {
|
||||
service { 'ovsdb-server':
|
||||
ensure => true,
|
||||
enable => true,
|
||||
name => $::vswitch::params::ovsdb_service_name,
|
||||
status => $::vswitch::params::ovsdb_status,
|
||||
}
|
||||
|
||||
Service['ovsdb-server'] ~> Service['openvswitch']
|
||||
}
|
||||
|
||||
package { $::vswitch::params::ovs_package_name:
|
||||
ensure => $package_ensure,
|
||||
before => Service['openvswitch'],
|
||||
|
@ -25,6 +25,30 @@ class vswitch::params {
|
||||
$ovs_dkms_package_name = 'openvswitch-datapath-dkms'
|
||||
$ovs_service_name = 'openvswitch-switch'
|
||||
$provider = 'ovs'
|
||||
case $::operatingsystem {
|
||||
'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"'
|
||||
}
|
||||
$ovs_service_hasstatus = false
|
||||
}
|
||||
'debian': {
|
||||
if ($::lsbdistcodename == 'wheezy') {
|
||||
$ovs_service_hasstatus = false
|
||||
$ovs_status = '/etc/init.d/openvswitch-switch status | fgrep -q "not running"; if [ $? -eq 0 ]; then exit 1; else exit 0; fi' # lint:ignore:140chars
|
||||
} else {
|
||||
$ovs_service_hasstatus = true
|
||||
}
|
||||
}
|
||||
default: {
|
||||
fail('Unsupported Debian based system')
|
||||
}
|
||||
}
|
||||
}
|
||||
'FreeBSD': {
|
||||
$ovs_package_name = 'openvswitch'
|
||||
|
4
releasenotes/notes/ovs-debian-6eb866a703b1ced5.yaml
Normal file
4
releasenotes/notes/ovs-debian-6eb866a703b1ced5.yaml
Normal file
@ -0,0 +1,4 @@
|
||||
---
|
||||
fixes:
|
||||
- Updates to service options for ovs when running under Debian jessie to
|
||||
not restart ovs on each puppet run.
|
@ -261,8 +261,7 @@ describe 'vswitch::ovs' do
|
||||
:ovs_dkms_package_name => 'openvswitch-datapath-dkms',
|
||||
:ovs_service_name => 'openvswitch-switch',
|
||||
:provider => 'ovs',
|
||||
:service_hasstatus => false,
|
||||
:service_status => '/etc/init.d/openvswitch-switch status | fgrep -q "not running"; if [ $? -eq 0 ]; then exit 1; else exit 0; fi',
|
||||
:service_hasstatus => true,
|
||||
}
|
||||
elsif facts[:operatingsystem] == 'Ubuntu'
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user