From c9951abf87ccdcc9e68dded729b544008b4522b8 Mon Sep 17 00:00:00 2001 From: Dmitry Tantsur Date: Tue, 17 Oct 2017 12:35:30 +0200 Subject: [PATCH] Turn on DHCP logging in ironic-inspector when debug is true Thanks to Dan Radez for pointing out this cool feature to me. Change-Id: Ica31ab87b646e3bad21d55ba939437094f42cf9c --- releasenotes/notes/log-dhcp-700336a5fa27096d.yaml | 5 +++++ spec/classes/ironic_inspector_spec.rb | 6 ++++++ templates/inspector_dnsmasq_http.erb | 4 ++++ templates/inspector_dnsmasq_tftp.erb | 4 ++++ 4 files changed, 19 insertions(+) create mode 100644 releasenotes/notes/log-dhcp-700336a5fa27096d.yaml diff --git a/releasenotes/notes/log-dhcp-700336a5fa27096d.yaml b/releasenotes/notes/log-dhcp-700336a5fa27096d.yaml new file mode 100644 index 00000000..c84df5c5 --- /dev/null +++ b/releasenotes/notes/log-dhcp-700336a5fa27096d.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + When ``inspector::debug`` is set to ``true``, DHCP queries and responses + will be logged by the ironic-inspector dnsmasq services. diff --git a/spec/classes/ironic_inspector_spec.rb b/spec/classes/ironic_inspector_spec.rb index d8321bfd..0baaf841 100644 --- a/spec/classes/ironic_inspector_spec.rb +++ b/spec/classes/ironic_inspector_spec.rb @@ -227,6 +227,12 @@ describe 'ironic::inspector' do is_expected.to contain_file('/etc/ironic-inspector/dnsmasq.conf').with_content( /dhcp-range=192.168.0.100,192.168.0.120,10m/ ) + is_expected.to contain_file('/etc/ironic-inspector/dnsmasq.conf').with_content( + /log-dhcp/ + ) + is_expected.to contain_file('/etc/ironic-inspector/dnsmasq.conf').with_content( + /log-queries/ + ) end it 'should contain file /var/www/httpboot/inspector.ipxe' do is_expected.to contain_file('/var/www/httpboot/inspector.ipxe').with( diff --git a/templates/inspector_dnsmasq_http.erb b/templates/inspector_dnsmasq_http.erb index 92d14ee8..97a0d23f 100644 --- a/templates/inspector_dnsmasq_http.erb +++ b/templates/inspector_dnsmasq_http.erb @@ -1,6 +1,10 @@ port=0 interface=<%= @dnsmasq_interface %> bind-interfaces +<% if @debug %> +log-dhcp +log-queries +<% end %> <% @dnsmasq_ip_subnets_real.each do |s| -%> <% if s['tag'] and s['netmask'] -%> dhcp-range=set:<%= s['tag'] -%>,<%= s['ip_range'] -%>,<%= s['netmask'] -%>,10m diff --git a/templates/inspector_dnsmasq_tftp.erb b/templates/inspector_dnsmasq_tftp.erb index bf639f69..2d557429 100644 --- a/templates/inspector_dnsmasq_tftp.erb +++ b/templates/inspector_dnsmasq_tftp.erb @@ -1,6 +1,10 @@ port=0 interface=<%= @dnsmasq_interface %> bind-interfaces +<% if @debug %> +log-dhcp +log-queries +<% end %> <% @dnsmasq_ip_subnets_real.each do |s| -%> <% if s['tag'] and s['netmask'] -%> dhcp-range=set:<%= s['tag'] -%>,<%= s['ip_range'] -%>,<%= s['netmask'] -%>,10m