Merge "Fix kernel module filename for OVS versions"

This commit is contained in:
Jenkins 2016-01-29 14:44:46 +00:00 committed by Gerrit Code Review
commit 989e6a96d5
3 changed files with 28 additions and 3 deletions

7
lib/facter/ovs.rb Normal file
View File

@ -0,0 +1,7 @@
Facter.add("ovs_version") do
confine :kernel => "Linux"
setcode do
Facter::Core::Execution.exec('/usr/bin/ovs-vsctl --version').gsub(/.*ovs-vsctl\s+\(Open\s+vSwitch\)\s+(\d+\.\d+\.\d+).*/, '\1')
end
end

View File

@ -61,8 +61,16 @@ class vswitch::ovs(
name => $::vswitch::params::ovs_service_name, name => $::vswitch::params::ovs_service_name,
hasstatus => false, # the supplied command returns true even if it's not running 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 # Not perfect - should spot if either service is not running - but it'll do
status => $ovs_status status => $ovs_status,
} }
$major_version = regsubst($::ovs_version, '^(\d+).*', '\1')
if $major_version == '1' {
$kernel_mod_file = "/lib/modules/${::kernelrelease}/updates/dkms/openvswitch_mod.ko"
} else {
$kernel_mod_file = "/lib/modules/${::kernelrelease}/updates/dkms/openvswitch.ko"
}
} }
'Redhat': { 'Redhat': {
service { 'openvswitch': service { 'openvswitch':

View File

@ -96,7 +96,9 @@ describe 'vswitch::ovs' do
let :params do default_params end let :params do default_params end
let :facts do let :facts do
{:osfamily => 'Redhat'} {:osfamily => 'Redhat',
:ovs_version => '1.4.2',
}
end end
let :platform_params do redhat_platform_params end let :platform_params do redhat_platform_params end
@ -113,7 +115,9 @@ describe 'vswitch::ovs' do
end end
let :facts do let :facts do
{:osfamily => 'Redhat'} {:osfamily => 'Redhat',
:ovs_version => '1.4.2',
}
end end
let :platform_params do redhat_platform_params end let :platform_params do redhat_platform_params end
@ -127,6 +131,7 @@ describe 'vswitch::ovs' do
let :facts do let :facts do
{:osfamily => 'Debian', {:osfamily => 'Debian',
:operatingsystem => 'Debian', :operatingsystem => 'Debian',
:ovs_version => '1.4.2',
} }
end end
let :platform_params do debian_platform_params end let :platform_params do debian_platform_params end
@ -145,6 +150,7 @@ describe 'vswitch::ovs' do
let :facts do let :facts do
{:osfamily => 'Debian', {:osfamily => 'Debian',
:operatingsystem => 'Debian', :operatingsystem => 'Debian',
:ovs_version => '1.4.2',
} }
end end
let :platform_params do debian_platform_params end let :platform_params do debian_platform_params end
@ -159,6 +165,7 @@ describe 'vswitch::ovs' do
let :facts do let :facts do
{:osfamily => 'Debian', {:osfamily => 'Debian',
:operatingsystem => 'ubuntu', :operatingsystem => 'ubuntu',
:ovs_version => '1.4.2',
} }
end end
let :platform_params do ubuntu_platform_params end let :platform_params do ubuntu_platform_params end
@ -177,6 +184,7 @@ describe 'vswitch::ovs' do
let :facts do let :facts do
{:osfamily => 'Debian', {:osfamily => 'Debian',
:operatingsystem => 'ubuntu', :operatingsystem => 'ubuntu',
:ovs_version => '1.4.2',
} }
end end
let :platform_params do ubuntu_platform_params end let :platform_params do ubuntu_platform_params end
@ -191,6 +199,7 @@ describe 'vswitch::ovs' do
let :facts do let :facts do
{:osfamily => 'FreeBSD', {:osfamily => 'FreeBSD',
:operatingsystem => 'FreeBSD', :operatingsystem => 'FreeBSD',
:ovs_version => '1.4.2',
} }
end end
let :platform_params do freebsd_platform_params end let :platform_params do freebsd_platform_params end
@ -218,6 +227,7 @@ describe 'vswitch::ovs' do
let :facts do let :facts do
{:osfamily => 'FreeBSD', {:osfamily => 'FreeBSD',
:operatingsystem => 'FreeBSD', :operatingsystem => 'FreeBSD',
:ovs_version => '1.4.2',
} }
end end
let :platform_params do freebsd_platform_params end let :platform_params do freebsd_platform_params end