SOLVED Truncate hostname
I know some people have had problems with this in the past and have written their own fixes/hacks but would be nice to have the following in 0.33.
On full host registration, ask for OS selection before the hostname.
When windows based host is selected, truncate/limit the hostname to 15 characters as per windows naming convention.
When windows is selected for a host, limit the hostname box on the web interface to 15 characters.
Maybe warn about unsupported characters?
Just looking at this post:
Perhaps my suggestion should be changed slightly.
Ask for the Image first on Full host registration first and then limit the following hostname box accordingly.
In FOG 0.33, the host no longer has an OS. The OS is tied to the image.
I have modified the script in the init.gz to truncate to 15 characters and warn if truncation was necessary. I still have not modified the webUI to limit the field in html, or to truncate the value in the processing of the form data.
I agree this would be nice, and for the most part, I never need over 15 characters. Maybe this could be configurable through the FOG settings for a max host name length in case there was some need to have it longer than 15. There is a limit due to the field size in the datastore also, but that can be queried to make sure the UI or registration scripts are not exceeding that.
I realise the web page already has a limit, but that limit is 16.
From the Microsoft support documentation “Note The 16th character is reserved to identify the functionality that is installed on the registered network device.”
The limit needs to be 15 for the hostname.
The reason for having the image/os first on registration, is so that the script can then limit the hostname entry to 15 when a windows image/OS is selected.
I’ve no idea if linux/other OS’s have the same restrictions or not, but you could then apply each OS’s hostname restriction after choosing the relevant image/OS.
Asking for hostname, and/or, image ID first isn’t a hard task to accomplish, however it is still a script that’s reading the data. There are checks and balances however within the auto.register.php file that check if the hostname is longer than a certain number of characters. If it is, it stores the system’s MAC as the hostname without Colons.
Checking for Special characters may be slightly more difficult, but I’ll look into it.