Replace legacy facts and use fact hash

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

Change-Id: I1127eb2066a93b642b21186f4d351a12c40e6296
This commit is contained in:
Takashi Kajinami 2023-03-01 16:26:38 +09:00
parent 9f91e4b106
commit f831d81a5f
4 changed files with 9 additions and 12 deletions

View File

@ -36,7 +36,7 @@
#
# [*hostname*]
# (optional) The hostname to use with the external id
# Defaults to $::fqdn
# Defaults to $facts['networking']['fqdn']
#
# [*ovn_bridge*]
# (optional) Name of the integration bridge.
@ -118,7 +118,7 @@ class ovn::controller(
$ovn_encap_tos = undef,
$ovn_bridge_mappings = [],
$bridge_interface_mappings = [],
$hostname = $::fqdn,
$hostname = $facts['networking']['fqdn'],
$ovn_bridge = 'br-int',
$mac_table_size = undef,
$datapath_type = undef,

View File

@ -5,7 +5,7 @@
#
class ovn::params {
include openstacklib::defaults
case $::osfamily {
case $facts['os']['family'] {
'RedHat': {
$ovn_northd_package_name = 'openvswitch-ovn-central'
$ovn_controller_package_name = 'openvswitch-ovn-host'
@ -31,7 +31,7 @@ class ovn::params {
$ovn_controller_service_pattern = 'ovn-controller'
}
default: {
fail " Osfamily ${::osfamily} not supported yet"
fail " Osfamily ${facts['os']['family']} not supported yet"
}
}
}

View File

@ -48,7 +48,7 @@ describe 'ovn::controller' do
:value => params[:ovn_encap_ip],
)
is_expected.to contain_vs_config('external_ids:hostname').with(
:value => 'server0.example.com',
:value => 'foo.example.com',
)
is_expected.to contain_vs_config('external_ids:ovn-bridge').with(
:value => 'br-int',
@ -236,12 +236,10 @@ describe 'ovn::controller' do
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts({
:fqdn => 'server0.example.com'
}))
facts.merge!(OSDefaults.get_facts())
end
case facts[:osfamily]
case facts[:os]['family']
when 'Debian'
let :platform_params do
{

View File

@ -95,11 +95,10 @@ describe 'ovn::northd' do
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts({
}))
facts.merge!(OSDefaults.get_facts())
end
case facts[:osfamily]
case facts[:os]['family']
when 'Debian'
let(:platform_params) do
{