host does not validate ip or hostname.
for ip ipv4 is quite easy:
(25[0-5]|2[0-4]\d|[0-1]?\d?\d)(\.(25[0-5]|2[0-4]\d|[0-1]?\d?\d)){3}
for ipv6 i think you have to process it and then validate as it have several way of being printed:
uppercase it
split on ':'
for the 6 first , if less than 4 lenght then add 4-lenght 0 before it ( 7A => 007A, '' => 0000)
for the rest: if they are 2 then hexa block no surprise
then if less than 4-lenght then add 4-lenght 0 before it
if there is 1 then it must be an ipv4 adress,
each number should be converted to a hexadecimal number
to rebuild the last 2 hex bloc. So use validate ipv4 and then process
by split(.) then int_to_hex it
now validate the 8 blocks:
([\dA-F]{4}:){7}[\dA-F]{4}
for the hostname:
split by '.'
each part must have lenght =< 75 characters
validate : ([\d\w]+|[\d\w][\d\w\-]+[\d\w])
(must start/end with a letter/digit)
I think we should have a validation library that we can call in the puppet code and also extend with our own validation routines. This should prevent each type to have its own validation for IP or simple things like hostnames...
regards,
Ghislain.