Closed darksidemilk closed 3 months ago
This commit https://github.com/FOGProject/fogproject/commit/b8e076d373e352131176a5c5f39d9b5b48c3666b appears to have fix pxe registration.
However, in for 1.5.X we can create a fog host via the api with a json like
{
"name": "someName",
"macs": [
"1A:2B:3C:4D:5E:6F"
],
"modules": [
"4",
"7",
"1",
"3",
"5",
"8",
"9",
"13",
"10",
"6",
"11",
"2",
"12"
]
}
Which is the json format created by the fogApi powershell module function New-FogHost
In working-1.6 this json produces a 500 error
However, if you remove the macs
array property from the json, it gives an { "error": "Already created" }
in the response.
But, it actually does create the host
If you hover over that host with no mac (it won't open on click) you can view the url that includes the host id, or using the fogApi ps module you can find the host id in the full list of hosts with get-foghosts | ? name -eq 'someName' | select id
Then you can use the api to add the mac to the host as a primary mac
Add-FogHostMac -hostID (get-foghosts | ? name -eq 'someName').id -primary -macAddress "1A:2B:3C:4D:5E:6F" -vb
This function will given an error saying 404 not found at one point because it tries to get the host record before adding the mac, until the mac is added you can't get the record of the host, only view it in the full list of hosts, same as in the UI. But this does add the mac via the api and
However, if you were to add another mac address to that host and mark it as primary too, i.e.
Add-FogHostMac -hostID (get-foghosts | ? name -eq 'someName').id -primary -macAddress "1A:2B:3C:4D:5E:6H"
it creates 2 entries for that host in the hosts view
If you click into either it goes to the same place and lists the more recently set as primary mac as the primary mac
If you click the 'Primary Mac' selection in the UI, it fixes the duplicated display. The duplicated display doesn't happen if you add a non-primary mac via the api
A bit hinky, but hopefully that workaround might help @mastacontrola with debugging what's going on.
Short version
To follow
This has been resolved. I don't recall exactly which commit, it may have been this one https://github.com/FOGProject/fogproject/commit/b8e076d373e352131176a5c5f39d9b5b48c3666b
But as of the current version for sure (https://github.com/FOGProject/fogproject/commit/e6a9f582e7180441338765ebab9e6b5edbca81e4) this is resolved.
Describe the bug
When attempting to add a new host to fog in 1.6 either through the api or pxe full host registration it fails
To Reproduce
Steps to reproduce the behavior for pxe:
Steps to reproduce the behavior for pxe:
Example using fogapi powershell module
Expected behavior
The host should have been added or registered successfully
Screenshots If applicable, add screenshots to help explain your problem.
Error on api call
Error on full pxe registration
Software (please complete the following information):
Additional context Add any other context about the problem here.
It seems to be related to a call to the
ishostnamesafe
function in the host class.if I change this function so it always returns true, then it gets past the error in the pxe host registration
But of course, that's not what we want, we want this check to exist. Also, it does something else weird, it gives it a different name than what I input. i.e. I input
dr-wks-jjv5
as the hostname in the pxe regsitration with the ishostnamesafe set to always return true. It looks fine in the pxe menu but then the hostname that gets registered isZHItd2tzLWpqdjUK
So something is happening with the input between the registration class fullreg call and when the host is registered.
Changing the return to always true doesn't get past the problem in the api call, so something else is happening with that.