You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When you do a PUT api call on a host object (http://fog-server/fog/host/{hostID}/edit) and you inlcude the 'name' in the json body, where that is the current name and is not changing, it fails with an { "error": "Already created" } If you update with a changed name or omit the name it works fine. If you include other fields with their current values, no errors occur and the values stay the same.
To Reproduce
Steps to reproduce the behavior:
There are other ways to use the api, but I found this using the fogApi powershell module.
So in a powershell session
#if you don't already have the fogpai module configured
install-module FogApi;
Set-fogserversettings -interactive; #follow the prompts to connect your server
$myHost = get-foghost;
# just an example of a change on the description field
$myHost.description = "some new description"
# create json of the whole host object
Update-FogObject -type object -coreObject host -jsonData ($myhost | convertto-json -compress) -idofobject $myhost.id -verbose
If you do this, to omit the name and macs in the json, it will update the description correctly, you could also select only the description/changed fields
The resulting fog host object would then be displayed:
id : 1847
name : myComputerName
description : some new description
...
#full results of host object omitted
Expected behavior
Including the current name shouldn't affect the api call when the name isn't changing. I'm fairly sure (like 80% sure) it didn't previously do this. I believe it used to ignore the macs field too, but I'm less sure about that, setting macs to a host is a separate table/api path. But this bug is about the name field.
Software (please complete the following information):
FOG version [e.g. 1.5.10]
FOS kernel n/a
OS: [e.g. centos 7 (also found on centos 9)]
The text was updated successfully, but these errors were encountered:
Describe the bug
When you do a PUT api call on a host object (http://fog-server/fog/host/{hostID}/edit) and you inlcude the 'name' in the json body, where that is the current name and is not changing, it fails with an
{ "error": "Already created" }
If you update with a changed name or omit the name it works fine. If you include other fields with their current values, no errors occur and the values stay the same.To Reproduce
Steps to reproduce the behavior:
There are other ways to use the api, but I found this using the fogApi powershell module.
So in a powershell session
you'll get an error such as this
If you do this, to omit the name and macs in the json, it will update the description correctly, you could also select only the description/changed fields
The resulting fog host object would then be displayed:
Expected behavior
Including the current name shouldn't affect the api call when the name isn't changing. I'm fairly sure (like 80% sure) it didn't previously do this. I believe it used to ignore the macs field too, but I'm less sure about that, setting macs to a host is a separate table/api path. But this bug is about the name field.
Software (please complete the following information):
The text was updated successfully, but these errors were encountered: