Feature Request: 'Rename Host in FOG database' option on the PXE menu
Would it be possible to have a ‘rename host in FOG’ option on the PXE menu?
This would be really handy for us, mainly because our naming convention for computers reflects the physical location of the machine within our organisation. So, when I decommission / redeploy machines if I haven’t remember to edit or delete them in FOG first it can cause problems when I try and register them with FOG again.
A few times I have been re-deploying old machines that already exist in the FOG database, and I can’t remember if I previously deleted them from FOG when they were deployed elsewhere (and had different hostnames). When I boot into the FOG menu and attempt to register the host with FOG, FOG correctly tells me that it can’t register the host, as there is already one with the same MAC address in FOG.
What would be great is at this point, rather than just rebooting, if there was an option to change the hostname in FOG.
I appreciate that the FOG devs are probably already quite busy, so I’ll probably attempt to add this functionality myself. Would anyone else find it useful?
I already have a fix in place for this. In creating the pxe delete host option, I now know exactly where to go.
The file you’ll need to edit would be within the init.gz file, if you’ve already added the delete options, this will take just a couple lines of code:
When it says unable to register host as it already exists, call the fog.auto.del script, it should take over from that point, within the fog.auto.del post, it will ask if you want to re-inventory of where you can change the hostname. This should be useful, though I don’t have time to test all aspects.
Sadly, I haven’t had the time to spend on this that I had hoped, sorry :-(
Huck last edited by
This would be an awesome feature!! I’ve just searched the forums for a way to do this… Any updates MR626? Help needed? :)
Fantastic! Many thanks for the reply. I’ll try and get started on this soon
BryceZ last edited by
What you’re looking for is /etc/init.d/S99fog in the boot image (/tftpboot/fog/images/init.gz).
[CODE]cp /tftpboot/fog/images/init.gz /tftpboot/fog/images/init.gz.BACKUP
mount -o loop /tftpboot/fog/images/init /mnt/init[/CODE]
That will get you into the mounted boot image to make whatever changes you like, and when you’re done…
You’ll most likely need to write a new php script on the web server side, something like the service scripts where you can POST the MAC address of the host and it’s new name.
Best of luck!
I’m trying to start work on this, but I could use a hand in understanding how fog operates.
I can see in the ‘default’ file that holds the configuration for the fog pxe menu that different fog functions are called from the menu like so:
append initrd=fog/images/init.gz root=/dev/ram0 rw ramdisk_size=127000 ip=dhcp dns= mode=quickimage keymap= web=192.168.1.1/fog/ loglevel=4 consoleblank=0
MENU LABEL Quick Image
This mode will allow you to image this host quickly with
it’s default assigned image.
In the above example, the ‘mode=quickimage’ is obviously what determines how fog will operate when that menu item is selected. What I’m not clear on is where the underlying code is located that receives this argument. In theory, we can then write a function for renaming the host (probably re-using lots of code from one of the existing functions, as we’ll be accessing similar parts of the fog database). Then, we can simply add a new entry to the ‘default’ pxe menu config file with ‘mode=renamehost’
For the time being, I’ve left a grep -iR command running to see if I can find the code myself ;)
Cool, well I’m glad I’m not the only one who would value this.
Depending on my workload I’ll attempt to start work on this soon.
neodawg last edited by
I would like to +1 this feature request as well.
Derek Boyer last edited by
I would absolutely love to have that feature as I name my machines in a similar fashion. There have been times when I have deployed a previously decommissioned machine to find out while trying to register that it is already in the database.