Expose dnsmasq_pxe_filter/purge_dhcp_hostsdir opt
The purge_dhcp_hostsdir controls wheater Ironic will purge the dhcp_hostdir on initialization. When the directory is purged the dnsmasq service must be restarted as well to ensure the DHCP server config is in sync once the dhcp-hosts directory is populated with new content. Depending on how services are deployed, controlling the dnsmasq service is non- trivial. (I.e containers or different hosts.) Change-Id: Icc532115891c567dde20a28110bf08f54187c49f Related-Bug: #1780421
This commit is contained in:
parent
4e11e3fe4e
commit
524b391f24
|
@ -22,9 +22,18 @@
|
|||
# (optional) A (shell) command line to stop the dnsmasq service.
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
# [*purge_dhcp_hostsdir*]
|
||||
# (optional) Purge the hostsdir upon driver initialization. Setting to false
|
||||
# should only be performed when the deployment of inspector is such that
|
||||
# there are multiple processes executing inside of the same host and
|
||||
# namespace. In this case, the Operator is responsible for setting up a
|
||||
# custom cleaning facility.
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
class ironic::inspector::pxe_filter::dnsmasq (
|
||||
$dnsmasq_start_command = $::os_service_default,
|
||||
$dnsmasq_stop_command = $::os_service_default,
|
||||
$purge_dhcp_hostsdir = $::os_service_default,
|
||||
) {
|
||||
|
||||
include ::ironic::deps
|
||||
|
@ -36,6 +45,7 @@ class ironic::inspector::pxe_filter::dnsmasq (
|
|||
'dnsmasq_pxe_filter/dhcp_hostsdir': value => $hostsdir;
|
||||
'dnsmasq_pxe_filter/dnsmasq_start_command': value => $dnsmasq_start_command;
|
||||
'dnsmasq_pxe_filter/dnsmasq_stop_command': value => $dnsmasq_stop_command;
|
||||
'dnsmasq_pxe_filter/purge_dhcp_hostsdir': value => $purge_dhcp_hostsdir;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ describe 'ironic::inspector::pxe_filter::dnsmasq' do
|
|||
is_expected.to contain_ironic_inspector_config('dnsmasq_pxe_filter/dhcp_hostsdir').with_value('/etc/ironic-inspector/dhcp-hostsdir')
|
||||
is_expected.to contain_ironic_inspector_config('dnsmasq_pxe_filter/dnsmasq_start_command').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_ironic_inspector_config('dnsmasq_pxe_filter/dnsmasq_stop_command').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_ironic_inspector_config('dnsmasq_pxe_filter/purge_dhcp_hostsdir').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_file('/etc/ironic-inspector/dnsmasq.conf').with_content(
|
||||
/dhcp-hostsdir=\/etc\/ironic-inspector\/dhcp-hostsdir/
|
||||
)
|
||||
|
@ -42,6 +43,7 @@ describe 'ironic::inspector::pxe_filter::dnsmasq' do
|
|||
let :params do
|
||||
{ :dnsmasq_start_command => 'dnsmasq --conf-file /etc/ironic-inspector/dnsmasq.conf',
|
||||
:dnsmasq_stop_command => 'kill $(cat /var/run/dnsmasq.pid)',
|
||||
:purge_dhcp_hostsdir => false,
|
||||
}
|
||||
end
|
||||
|
||||
|
@ -53,6 +55,7 @@ describe 'ironic::inspector::pxe_filter::dnsmasq' do
|
|||
is_expected.to contain_ironic_inspector_config('dnsmasq_pxe_filter/dhcp_hostsdir').with_value('/etc/ironic-inspector/dhcp-hostsdir')
|
||||
is_expected.to contain_ironic_inspector_config('dnsmasq_pxe_filter/dnsmasq_start_command').with_value(p[:dnsmasq_start_command])
|
||||
is_expected.to contain_ironic_inspector_config('dnsmasq_pxe_filter/dnsmasq_stop_command').with_value(p[:dnsmasq_stop_command])
|
||||
is_expected.to contain_ironic_inspector_config('dnsmasq_pxe_filter/purge_dhcp_hostsdir').with_value(p[:purge_dhcp_hostsdir])
|
||||
is_expected.to contain_file('/etc/ironic-inspector/dnsmasq.conf').with_content(
|
||||
/dhcp-hostsdir=\/etc\/ironic-inspector\/dhcp-hostsdir/
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue