Hostname Validation Bug
Appears #149 has a bug in hostname validation, at least something that might be unexpected.
This -is- configurable but I think it's unexpected as some people encode locations/environments in their FQDN. Maybe default to accepted dot? What do you think?
I think the sane default is to only accept a hostname fragment.
I would prefer we:
- Highlight this fact the config and install documentation
- Use the error case "invalid name" to start a FAQ/user guide
+1 to allowing FQDN
As an example, my devices are named by site so the first label in the DNS name (eg: pe1) appears in every site. We operate a large MPLS L2VPN network so these devices would all be considered as part of the same "network" in nsot.
I don't think it would be too onerous to support both, or ditch the restriction entirely (looking forwards to nuts who don't use the DNS).
Whoops, ignore me - didn't fully understand the previous comment - can someone point me in the right direction for the configuration option? :)
Hey @dowlingw :)
If I understand correctly, you have devices like:
pe1.site1.example.compe1.site2.example.cometc...
If so then yeah, it's relevant to this ticket. It's possible but just not default. In nsot.conf.py, the parameter you want to tweak is DEVICE_NAME.
# Current default
DEVICE_NAME = re.compile(r"^([A-Za-z0-9][A-Za-z0-9\-]{0,61}[A-Za-z0-9]|[A-Za-z0-9])$")
# What I think you want
DEVICE_NAME = re.compile(r"^([A-Za-z0-9][A-Za-z0-9\-\.]{0,61}[A-Za-z0-9]|[A-Za-z0-9])$")
See: https://regex101.com/r/vO1xJ6/1
Addressing this will fix #264