[inspection] allow to configure HTTP port

We currently allow changing the HTTP port for Ironic iPXE support,
but we don't allow the same for ironic-inspector. This patch fixes it.

Change-Id: I62effb9d0196474a3768ef7e80528f730df8a543
Closes-Bug: #1602976
This commit is contained in:
Dmitry Tantsur 2016-07-14 13:48:35 +02:00
parent 7526bfa4fa
commit 270b0cb7c7
4 changed files with 15 additions and 5 deletions

View File

@ -162,6 +162,10 @@
# (optional) ipxe timeout in second. Should be an integer.
# Defaults to '0' for unlimited.
#
# [*http_port*]
# (optional) port used by the HTTP service serving introspection images.
# Defaults to 8088.
#
class ironic::inspector (
$package_ensure = 'present',
$enabled = true,
@ -199,6 +203,7 @@ class ironic::inspector (
$additional_processing_hooks = undef,
$ramdisk_kernel_args = undef,
$ipxe_timeout = 0,
$http_port = 8088,
) {
include ::ironic::params

View File

@ -48,7 +48,8 @@ describe 'ironic::inspector' do
:swift_auth_url => 'http://127.0.0.1:5000/v2.0',
:dnsmasq_ip_range => '192.168.0.100,192.168.0.120',
:dnsmasq_local_ip => '192.168.0.1',
:ipxe_timeout => 0, }
:ipxe_timeout => 0,
:http_port => 8088, }
end
let :params do
@ -161,6 +162,7 @@ describe 'ironic::inspector' do
:additional_processing_hooks => 'hook1,hook2',
:ramdisk_kernel_args => 'foo=bar',
:enable_uefi => true,
:http_port => 3816,
)
end
it 'should replace default parameter with new value' do
@ -181,6 +183,9 @@ describe 'ironic::inspector' do
'require' => 'Package[ironic-inspector]',
'content' => /ipxe/,
)
is_expected.to contain_file('/etc/ironic-inspector/dnsmasq.conf').with_content(
/dhcp-boot=tag:ipxe,http:\/\/192.168.0.1:3816\/inspector.ipxe/
)
end
it 'should contain file /httpboot/inspector.ipxe' do
is_expected.to contain_file('/httpboot/inspector.ipxe').with(
@ -189,7 +194,7 @@ describe 'ironic::inspector' do
'content' => /ipxe/,
)
is_expected.to contain_file('/httpboot/inspector.ipxe').with_content(
/kernel http:\/\/192.168.0.1:8088\/agent.kernel ipa-inspection-callback-url=http:\/\/192.168.0.1:5050\/v1\/continue ipa-inspection-collectors=default.* foo=bar || goto retry_boot/
/kernel http:\/\/192.168.0.1:3816\/agent.kernel ipa-inspection-callback-url=http:\/\/192.168.0.1:5050\/v1\/continue ipa-inspection-collectors=default.* foo=bar || goto retry_boot/
)
end
it 'should contain iPXE chainload images' do

View File

@ -10,7 +10,7 @@ dhcp-match=ipxe,175
dhcp-match=set:efi,option:client-arch,7
<% end -%>
# Client is running iPXE; move to next stage of chainloading
dhcp-boot=tag:ipxe,http://<%= @dnsmasq_local_ip %>:8088/inspector.ipxe
dhcp-boot=tag:ipxe,http://<%= @dnsmasq_local_ip %>:<%= @http_port %>/inspector.ipxe
<% if @enable_uefi -%>
# Client is running PXE over EFI; send EFI version of iPXE chainloader
dhcp-boot=tag:efi,ipxe.efi

View File

@ -5,6 +5,6 @@ dhcp || goto retry_dhcp
:retry_boot
imgfree
kernel <% if @ipxe_timeout != "0" %>--timeout <%= Integer(@ipxe_timeout) * 1000 %> <% end %>http://<%= @dnsmasq_local_ip %>:8088/agent.kernel ipa-inspection-callback-url=http://<%= @dnsmasq_local_ip %>:5050/v1/continue ipa-inspection-collectors=<%= @ramdisk_collectors %> systemd.journald.forward_to_console=yes BOOTIF=${mac} <%= @ramdisk_kernel_args %> initrd=agent.ramdisk || goto retry_boot
initrd <% if @ipxe_timeout != "0" %>--timeout <%= Integer(@ipxe_timeout) * 1000 %> <% end %>http://<%= @dnsmasq_local_ip %>:8088/agent.ramdisk || goto retry_boot
kernel <% if @ipxe_timeout != "0" %>--timeout <%= Integer(@ipxe_timeout) * 1000 %> <% end %>http://<%= @dnsmasq_local_ip %>:<%= @http_port %>/agent.kernel ipa-inspection-callback-url=http://<%= @dnsmasq_local_ip %>:5050/v1/continue ipa-inspection-collectors=<%= @ramdisk_collectors %> systemd.journald.forward_to_console=yes BOOTIF=${mac} <%= @ramdisk_kernel_args %> initrd=agent.ramdisk || goto retry_boot
initrd <% if @ipxe_timeout != "0" %>--timeout <%= Integer(@ipxe_timeout) * 1000 %> <% end %>http://<%= @dnsmasq_local_ip %>:<%= @http_port %>/agent.ramdisk || goto retry_boot
boot