Skip to content

Fixes #39630 - REX Job Wizard host autofill when display_fqdn_for_host setting is disabled - #1069

Open
snarya07 wants to merge 1 commit into
theforeman:masterfrom
snarya07:feature/test_case
Open

snarya07 wants to merge 1 commit into
theforeman:masterfrom
snarya07:feature/test_case

Conversation

@snarya07

Copy link
Copy Markdown

Summary

Fixes #39630 — REX Job Wizard shows "0 selected hosts" when triggered from Hosts Overview page with display_fqdn_for_hosts settings is disabled

Root cause

When scheduling a job from host Overview with display_fqdn_for_hosts disabled, autofill.js stored the short display_name in the name property used by buildHostQuery. That produced a name ^ (shortname) search against the FQDN stored in the database, so the host preview showed 0 hosts even though the host was fetched by ID.

  • The fix keeps name as the canonical FQDN for queries and displayName for UI labels, and resolves non-numeric host_ids[] with name ^ (hostname) instead of id = hostname.

Fix

  • Add buildHostSearchFromIds() for correct API search by ID or hostname
  • Store name (canonical FQDN) and displayName (UI label) separately in autofill host targets

Files changed

  • webpack/JobWizard/autofill.js
  • webpack/JobWizard/steps/HostsAndInputs/__tests__/HostsAndInputs.test.js

Test plan

  • cd ~/foreman && npm run test:plugins foreman_remote_execution -- webpack/JobWizard/steps/HostsAndInputs/__tests__/HostsAndInputs.test.js
  • Manual: display_fqdn_for_hosts = No → Host Overview → Schedule a job → 1 host selected
  • Manual: display_fqdn_for_hosts = Yes → same flow, no regression

Assisted by Cursor

Comment thread webpack/JobWizard/autofill.js Outdated
Comment thread webpack/JobWizard/autofill.js Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants