Replace legacy facts and use fact hash

... because the latest lint no longer allows usage of legacy facts and
top scope fact.

Change-Id: I9549ee743a4b20d76a1a63e482f84a111e0dd69a
This commit is contained in:
Takashi Kajinami 2023-03-01 16:23:57 +09:00
parent d8b0f65228
commit 645e80a543
4 changed files with 10 additions and 10 deletions

View File

@ -141,8 +141,8 @@ class vswitch::dpdk (
kmod::load { 'vfio-pci': }
if $::osfamily != 'Redhat' {
fail( "${::osfamily} not yet supported for dpdk installation by puppet-vswitch")
if $facts['os']['family'] != 'Redhat' {
fail( "${facts['os']['family']} not yet supported for dpdk installation by puppet-vswitch")
}
package { $::vswitch::params::ovs_dpdk_package_name:

View File

@ -3,7 +3,7 @@
class vswitch::params {
include openstacklib::defaults
case $::osfamily {
case $facts['os']['family'] {
'Redhat': {
$ovs_package_name = 'openvswitch'
# OVS2.5 in Red Hat family is unified package which will support plain
@ -25,7 +25,7 @@ class vswitch::params {
$provider = 'ovs'
}
default: {
fail " Osfamily ${::osfamily} not supported yet"
fail " Osfamily ${facts['os']['family']} not supported yet"
}
} # Case $::osfamily
} # Case $facts['os']['family']
}

View File

@ -183,7 +183,7 @@ describe 'vswitch::dpdk' do
facts.merge!(OSDefaults.get_facts({ :ovs_version => '2.6.1' }))
end
let (:platform_params) do
case facts[:osfamily]
case facts[:os]['family']
when 'Debian'
{
# not supported
@ -197,7 +197,7 @@ describe 'vswitch::dpdk' do
}
end
end
it_behaves_like "vswitch::dpdk on #{facts[:osfamily]}"
it_behaves_like "vswitch::dpdk on #{facts[:os]['family']}"
end
end
end

View File

@ -110,16 +110,16 @@ describe 'vswitch::ovs' do
end
let (:platform_params) do
case facts[:osfamily]
case facts[:os]['family']
when 'Debian'
if facts[:operatingsystem] == 'Debian'
if facts[:os]['name'] == 'Debian'
{
:ovs_package_name => 'openvswitch-switch',
:ovs_service_name => 'openvswitch-switch',
:provider => 'ovs',
:service_hasstatus => true,
}
elsif facts[:operatingsystem] == 'Ubuntu'
elsif facts[:os]['name'] == 'Ubuntu'
{
:ovs_package_name => 'openvswitch-switch',
:ovs_service_name => 'openvswitch-switch',