Skip to content

fix: construct image URL after HTTP server starts#797

Merged
mangelajo merged 1 commit into
jumpstarter-dev:mainfrom
bennyz:worktree-fix-http-port-timing
Jun 16, 2026
Merged

fix: construct image URL after HTTP server starts#797
mangelajo merged 1 commit into
jumpstarter-dev:mainfrom
bennyz:worktree-fix-http-port-timing

Conversation

@bennyz

@bennyz bennyz commented Jun 16, 2026

Copy link
Copy Markdown
Member

get_url() now returns _bound_port (since #740) which is 0 until start() is called. The flash client was calling get_url() before _services_up() started the server, producing http://host:0/image URLs.

Move image_url construction inside the _services_up() context so get_url() runs after the server binds and _bound_port is set.

get_url() now returns _bound_port (since jumpstarter-dev#740) which is 0 until
start() is called. The flash client was calling get_url() before
_services_up() started the server, producing http://host:0/image URLs.

Move image_url construction inside the _services_up() context so
get_url() runs after the server binds and _bound_port is set.

Signed-off-by: Benny Zlotnik <bzlotnik@redhat.com>
Assisted-by: claude-opus-4.6
@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 402a128b-e0c7-493b-ad4b-4452669e0bdb

📥 Commits

Reviewing files that changed from the base of the PR and between a8120be and 21162d8.

📒 Files selected for processing (1)
  • python/packages/jumpstarter-driver-flashers/jumpstarter_driver_flashers/client.py

📝 Walkthrough

Walkthrough

In BaseFlasherClient.flash, the assignment of image_url via self.http.get_url() is moved from immediately after path/operator resolution into the _services_up() context manager, where it is now guarded by the existing should_download_to_httpd flag.

Changes

Deferred image_url assignment in flash()

Layer / File(s) Summary
Move image_url into _services_up() context
python/packages/jumpstarter-driver-flashers/jumpstarter_driver_flashers/client.py
Removes the early unconditional image_url assignment after path resolution (lines 185–186) and adds it inside _services_up() guarded by should_download_to_httpd (lines 221–223), so self.http.get_url() is only called after HTTP/TFTP services are started.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐇 A URL once leapt too soon,
Before the services saw the moon.
Now tucked inside the context tight,
It waits until the services alight.
Order restored, all hops delight! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main fix: constructing the image URL after the HTTP server starts, which directly addresses the timing issue described in the PR.
Description check ✅ Passed The description clearly explains the problem (get_url() returning 0 before server starts) and the solution (moving URL construction inside _services_up()), directly relating to the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@eballetbo eballetbo left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - I reported the problem and after applying this PR I can say that fixes the issue. Logs report the correct port now and the flashing workflow is able to find the file in the http server and flash it.

@bennyz bennyz requested a review from mangelajo June 16, 2026 09:56
@mangelajo mangelajo merged commit 8597d19 into jumpstarter-dev:main Jun 16, 2026
32 checks passed
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.

3 participants