Skip to content

hostgetkey store token before save in db and return#748

Merged
mastacontrola merged 1 commit intoFOGProject:dev-branchfrom
kbats183:hostgetkey-fix
Mar 2, 2026
Merged

hostgetkey store token before save in db and return#748
mastacontrola merged 1 commit intoFOGProject:dev-branchfrom
kbats183:hostgetkey-fix

Conversation

@kbats183
Copy link
Copy Markdown

@kbats183 kbats183 commented Oct 6, 2025

I encountered an issue when trying to pull tasks using fog/service/hostinfo.php.

In some cases, fog/status/hostgetkey.php generates a new token, saves it to the database, but returns an empty string as the token value.
I believe this happens due to a race condition between storing the token in the database and retrieving it for returning.

This change generates the new token before updating the database and reuses it for both the DB update and the return value.
This ensures the function always returns the correct token.

@darksidemilk
Copy link
Copy Markdown
Member

darksidemilk commented Oct 6, 2025 via email

@kbats183
Copy link
Copy Markdown
Author

kbats183 commented Oct 6, 2025

I’m pulling tasks via the PHP file using the same approach that FOG uses to get kernel argument properties during USB boot.

My use case is that I have more than 100 laptops that I want to image via FOG multicast only once (without continuous management through FOG afterward).
I’m using the Quick Registration option to register the hosts, assign an image, and add them to a group — and I’d like to run this whole process without requiring an extra reboot between quick registration and imaging.
I’ve also patched the kernel slightly to support this workflow.

@mastacontrola mastacontrola merged commit de6aed5 into FOGProject:dev-branch Mar 2, 2026
@mastacontrola
Copy link
Copy Markdown
Member

I added this as it make sense and is a very likely case. Thank you!

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