Add Host Primary Disk to registration form
-
Hello FOG Team,
Almost every machine we are dealing with has more than one hard drive connected, typically one SSD for the OS, one SSD for fast scratch, and one or several for the data.
I realized that I can specify the SSD for the OS in the Host Management Edit Host Primary Disk, however, I would like to deploy images directly after registration and, therefore, it would be great to be able to set it during this process already.
I think I can adjust the registration form similiar to that:
https://forums.fogproject.org/topic/13500/dynamically-patching-fos-using-a-postinit-scriptHowever, I am not sure how I to add the specific entry to the hosts FOG server entry.
I looked at the API system following this guide:
https://news.fogproject.org/simplified-api-documentation/And I succesfully did
curl -H 'fog-api-token: TOKEN' -H 'fog-user-token: TOKEN_USER' -X GET http://FOG-PXE-SRV.mpi-dortmund.mpg.de/fog/host/list
and realized that it is the kernelDevice entry of my device that I want to modify.
Do you have an advise how to put together the respective βPOSTβ command to change this entry or do you have another suggestion how to approach the problem in the first place?
Thank you!
Best,
Markus -
Ok that was fast, So I answered my own question with the help of
https://forums.fogproject.org/topic/11058/fog-api/13curl -H 'fog-api-token: TOKEN' -H 'fog-user-token: TOKEN_USER' -X PUT -d '{"kernelDevice": "/dev/sda"}' http://FOG-PXE-SRV.mpi-dortmund.mpg.de/fog/host/HOST_ID/edit
I checked the API page:
https://news.fogproject.org/simplified-api-documentation/But it seems that the search option is not working the way I think it works:
curl -H 'fog-api-token: TOKEN' -H 'fog-user-token: TOKEN_USER' -X GET http://FOG-PXE-SRV.mpi-dortmund.mpg.de/fog/search/HOSTNAME
However, my idea for a workaround would be now to parse the host list for the hostname to figure out the HOST_ID and afterwards set the respective entry with the provided infos.
So now the only thing left is to modify the registration formBest,
Markus -
Ok I also found the answer to my search question:
https://forums.fogproject.org/topic/10036/api/2
The search syntax is slightly different to the news article.So here would be an example command for completion:
curl -H 'fog-api-token: TOKEN' -H 'fog-user-token: TOKEN' -X GET http://FOG-PXE-SRV.mpi-dortmund.mpg.de/fog/host | jq '.hosts[] | select(.name == "HOSTNAME") | .name'
Thanks again for letting me do my inner monologue on your platform!
Best,
Markus