Merge "Adds the ability to force metadata with dhcp agent"
This commit is contained in:
commit
d76ff5b160
@ -53,6 +53,10 @@
|
||||
# (optional) enable metadata support on isolated networks.
|
||||
# Defaults to false.
|
||||
#
|
||||
# [*enable_force_metadata*]
|
||||
# (optional) enable metadata support on all networks.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*enable_metadata_network*]
|
||||
# (optional) Allows for serving metadata requests coming from a dedicated metadata
|
||||
# access network whose cidr is 169.254.169.254/16 (or larger prefix), and is
|
||||
@ -86,6 +90,7 @@ class neutron::agents::dhcp (
|
||||
$dnsmasq_config_file = $::os_service_default,
|
||||
$dhcp_delete_namespaces = true,
|
||||
$enable_isolated_metadata = false,
|
||||
$enable_force_metadata = $::os_service_default,
|
||||
$enable_metadata_network = false,
|
||||
$dhcp_broadcast_reply = $::os_service_default,
|
||||
# DEPRECATED PARAMETERS
|
||||
@ -110,11 +115,12 @@ class neutron::agents::dhcp (
|
||||
}
|
||||
}
|
||||
|
||||
if (! $enable_isolated_metadata) and $enable_metadata_network {
|
||||
fail('enable_metadata_network to true requires enable_isolated_metadata also enabled.')
|
||||
if (! ($enable_isolated_metadata or $enable_force_metadata)) and $enable_metadata_network {
|
||||
fail('enable_metadata_network to true requires enable_isolated_metadata or enable_force_metadata also enabled.')
|
||||
} else {
|
||||
neutron_dhcp_agent_config {
|
||||
'DEFAULT/enable_isolated_metadata': value => $enable_isolated_metadata;
|
||||
'DEFAULT/force_metadata': value => $enable_force_metadata;
|
||||
'DEFAULT/enable_metadata_network': value => $enable_metadata_network;
|
||||
}
|
||||
}
|
||||
|
@ -48,6 +48,7 @@ describe 'neutron::agents::dhcp' do
|
||||
is_expected.to contain_neutron_dhcp_agent_config('DEFAULT/root_helper').with_value(p[:root_helper]);
|
||||
is_expected.to contain_neutron_dhcp_agent_config('DEFAULT/dhcp_delete_namespaces').with_value(p[:dhcp_delete_namespaces]);
|
||||
is_expected.to contain_neutron_dhcp_agent_config('DEFAULT/enable_isolated_metadata').with_value(p[:enable_isolated_metadata]);
|
||||
is_expected.to contain_neutron_dhcp_agent_config('DEFAULT/force_metadata').with_value('<SERVICE DEFAULT>');
|
||||
is_expected.to contain_neutron_dhcp_agent_config('DEFAULT/enable_metadata_network').with_value(p[:enable_metadata_network]);
|
||||
is_expected.to contain_neutron_dhcp_agent_config('DEFAULT/dhcp_broadcast_reply').with_value('<SERVICE DEFAULT>');
|
||||
end
|
||||
@ -107,12 +108,32 @@ describe 'neutron::agents::dhcp' do
|
||||
end
|
||||
end
|
||||
|
||||
context 'when enabling metadata networks without enabling isolated metadata' do
|
||||
context 'when enabling metadata networks without enabling isolated metadata or force metadata' do
|
||||
before :each do
|
||||
params.merge!(:enable_isolated_metadata => false, :enable_metadata_network => true)
|
||||
params.merge!(:enable_isolated_metadata => false, :enable_force_metadata => false, :enable_metadata_network => true)
|
||||
end
|
||||
|
||||
it_raises 'a Puppet::Error', /enable_metadata_network to true requires enable_isolated_metadata also enabled./
|
||||
it_raises 'a Puppet::Error', /enable_metadata_network to true requires enable_isolated_metadata or enable_force_metadata also enabled./
|
||||
end
|
||||
|
||||
context 'when enabling force metadata only' do
|
||||
before :each do
|
||||
params.merge!(:enable_force_metadata => true, :enable_metadata_network => false)
|
||||
end
|
||||
it 'should enable force_metadata only' do
|
||||
is_expected.to contain_neutron_dhcp_agent_config('DEFAULT/force_metadata').with_value('true');
|
||||
is_expected.to contain_neutron_dhcp_agent_config('DEFAULT/enable_metadata_network').with_value('false');
|
||||
end
|
||||
end
|
||||
|
||||
context 'when enabling force metadata with metadata networks' do
|
||||
before :each do
|
||||
params.merge!(:enable_force_metadata => true, :enable_metadata_network => true)
|
||||
end
|
||||
it 'should enable both force_metadata and metadata_network' do
|
||||
is_expected.to contain_neutron_dhcp_agent_config('DEFAULT/force_metadata').with_value('true');
|
||||
is_expected.to contain_neutron_dhcp_agent_config('DEFAULT/enable_metadata_network').with_value('true');
|
||||
end
|
||||
end
|
||||
|
||||
context 'with use_namespaces as false' do
|
||||
|
Loading…
Reference in New Issue
Block a user