Accept an array value for valid_interfaces

The valid_interfaces parameter is defined as a ListOpt and accepts
a string value which represents a list.
This change allows passing an array value in addition to a string value
so that the list can be defined more flexibly.

Change-Id: Id9bf2ee0d7d6f153a1142c14f1ae9f6aad6441cc
This commit is contained in:
Takashi Kajinami
2021-11-01 19:01:40 +09:00
parent f3df791f26
commit ef1c808195
4 changed files with 27 additions and 4 deletions

View File

@@ -118,7 +118,7 @@ class nova::network::neutron (
'neutron/user_domain_name': value => $user_domain_name;
'neutron/password': value => $password, secret => true;
'neutron/auth_url': value => $auth_url;
'neutron/valid_interfaces': value => $valid_interfaces;
'neutron/valid_interfaces': value => join(any2array($valid_interfaces), ',');
'neutron/endpoint_override': value => $endpoint_override;
'neutron/ovs_bridge': value => $ovs_bridge;
'neutron/extension_sync_interval': value => $extension_sync_interval;

View File

@@ -71,7 +71,7 @@ class nova::placement(
'placement/user_domain_name': value => $user_domain_name;
'placement/username': value => $username;
'placement/region_name': value => $region_name;
'placement/valid_interfaces': value => $valid_interfaces;
'placement/valid_interfaces': value => join(any2array($valid_interfaces), ',');
}
}

View File

@@ -64,7 +64,7 @@ describe 'nova::network::neutron' do
:username => 'neutron2',
:user_domain_name => 'neutron_domain',
:auth_url => 'http://10.0.0.1:5000/v2',
:valid_interfaces => 'public',
:valid_interfaces => 'internal,public',
:endpoint_override => 'http://127.0.0.1:9696',
:http_retries => 3,
:ovs_bridge => 'br-int',
@@ -97,6 +97,17 @@ describe 'nova::network::neutron' do
should contain_nova_config('DEFAULT/vif_plugging_timeout').with_value(params[:vif_plugging_timeout])
end
end
context 'when valid_interfaces is an array' do
before do
params.merge!(
:valid_interfaces => ['internal', 'public']
)
end
it 'configures the valid_interfaces parameter with a commma-separated string' do
is_expected.to contain_nova_config('neutron/valid_interfaces').with_value('internal,public')
end
end
end
on_supported_os({

View File

@@ -40,7 +40,7 @@ describe 'nova::placement' do
:project_name => 'service',
:project_domain_name => 'default',
:region_name => 'RegionTwo',
:valid_interfaces => 'internal',
:valid_interfaces => 'internal,public',
:username => 'placement2',
:user_domain_name => 'default',
:auth_url => 'https://127.0.0.1:5000/v3',
@@ -59,6 +59,18 @@ describe 'nova::placement' do
is_expected.to contain_nova_config('placement/auth_url').with_value(params[:auth_url])
end
end
context 'when valid_interfaces is an array' do
before do
params.merge!(
:valid_interfaces => ['internal', 'public']
)
end
it 'configures the valid_interfaces parameter with a commma-separated string' do
is_expected.to contain_nova_config('placement/valid_interfaces').with_value('internal,public')
end
end
end
on_supported_os({