Skip to content

Commit 5dd13b7

Browse files
Merge pull request #955 from elfosardo/fix-inspector-ipxe-tls-urls
🐛 Fix inspector.ipxe IPA URLs unreachable under iPXE TLS
2 parents daa3103 + a541413 commit 5dd13b7

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

ironic-config/apache2-ipxe.conf.j2

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ Listen {{ env.IPXE_TLS_PORT }}
1818
<Directory ~ "/shared/html/(redfish|ilo|images)/?">
1919
Require all denied
2020
</Directory>
21+
<Directory "/shared/html/images">
22+
<FilesMatch "^ironic-python-agent\.">
23+
Require all granted
24+
</FilesMatch>
25+
</Directory>
2126

2227
<Location ~ "^/.*">
2328
SSLRequireSSL

ironic-config/inspector.ipxe.j2

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ kernel --timeout 60000 {{ kernel_path }} ipa-insecure={{ env.IRONIC_IPA_INSECURE
1212
{%- set kernel_by_arch = {} -%}
1313
{%- for item in env.DEPLOY_KERNEL_BY_ARCH.split(',') -%}
1414
{%- set arch = item.split(':')[0] -%}
15-
{%- set url = item.split(':', 1)[1] | replace(file_url_prefix, env.IRONIC_HTTP_URL + '/') -%}
15+
{%- set url = item.split(':', 1)[1] | replace(file_url_prefix, env.IRONIC_IPA_BASE_URL + '/') -%}
1616
{%- set _ = kernel_by_arch.update({arch: url}) -%}
1717
{%- endfor -%}
1818
{%- set ramdisk_by_arch = {} -%}
1919
{%- for item in env.DEPLOY_RAMDISK_BY_ARCH.split(',') -%}
2020
{%- set arch = item.split(':')[0] -%}
21-
{%- set url = item.split(':', 1)[1] | replace(file_url_prefix, env.IRONIC_HTTP_URL + '/') -%}
21+
{%- set url = item.split(':', 1)[1] | replace(file_url_prefix, env.IRONIC_IPA_BASE_URL + '/') -%}
2222
{%- set _ = ramdisk_by_arch.update({arch: url}) -%}
2323
{%- endfor -%}
2424
# Architecture-specific boot selection
@@ -43,8 +43,8 @@ goto boot
4343

4444
:fallback
4545
echo Booting fallback IPA for ${buildarch}
46-
set ipa_kernel {{ env.IRONIC_HTTP_URL }}/images/ironic-python-agent.kernel
47-
set ipa_ramdisk {{ env.IRONIC_HTTP_URL }}/images/ironic-python-agent.initramfs
46+
set ipa_kernel {{ env.IRONIC_IPA_BASE_URL }}/images/ironic-python-agent.kernel
47+
set ipa_ramdisk {{ env.IRONIC_IPA_BASE_URL }}/images/ironic-python-agent.initramfs
4848
set ipa_ramdisk_name ironic-python-agent.initramfs
4949
goto boot
5050

@@ -61,7 +61,7 @@ boot
6161
imgfree
6262
# NOTE(dtantsur): keep inspection kernel params in [mdns]params in
6363
# ironic-inspector-image and configuration in configure-ironic.sh
64-
{{ kernel_cmdline(env.IRONIC_HTTP_URL + '/images/ironic-python-agent.kernel', 'ironic-python-agent.initramfs') }}
65-
initrd --timeout 60000 {{ env.IRONIC_HTTP_URL }}/images/ironic-python-agent.initramfs || goto retry_boot
64+
{{ kernel_cmdline(env.IRONIC_IPA_BASE_URL + '/images/ironic-python-agent.kernel', 'ironic-python-agent.initramfs') }}
65+
initrd --timeout 60000 {{ env.IRONIC_IPA_BASE_URL }}/images/ironic-python-agent.initramfs || goto retry_boot
6666
boot
6767
{% endif %}

scripts/ironic-common.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,12 @@ wait_for_interface_or_ip()
144144
export IRONIC_HTTP_URL="${IRONIC_HTTP_URL:-http://${IRONIC_URL_HOST}:${HTTP_PORT}}"
145145
export IRONIC_TFTP_URL="${IRONIC_TFTP_URL:-tftp://${IRONIC_URL_HOST}}"
146146
export IRONIC_BASE_URL=${IRONIC_BASE_URL:-"${IRONIC_SCHEME}://${IRONIC_URL_HOST}:${IRONIC_ACCESS_PORT}"}
147+
148+
if [[ "${IPXE_TLS_SETUP:-false}" == "true" ]]; then
149+
export IRONIC_IPA_BASE_URL="${IRONIC_IPA_BASE_URL:-${IPXE_SCHEME}://${IRONIC_URL_HOST}:${IPXE_TLS_PORT}}"
150+
else
151+
export IRONIC_IPA_BASE_URL="${IRONIC_IPA_BASE_URL:-${IRONIC_HTTP_URL}}"
152+
fi
147153
}
148154

149155
render_j2_config()

0 commit comments

Comments
 (0)