Closed drwetter closed 3 years ago
My python is a bit vague. But If I just had a look at the code, it seems you're assuming that everything which has four "octets" qualifies for an IPv4 address. :-(
In my case the hostname is sub1.sub2.domain.tld
.
If I edit if len(octets) != 4:
to 5 and supply my hostname I do not see this error.
So you maybe want to check e.g. for numbers or real octets before.
I have a fix for this. It seems to be working in this particular location -- when I get a chance later today I'll do some more testing and do the same fix in other places that take an IPV4 address before submitting my PR.
@bbeale just a hint, before you check on numbers only and next occasion another dude has a similar problem: hostnames also can contain numbers. There are several regex patterns out there which seem to do a good job
@drwetter thanks for the tip. I think the regex that I ended up using should be sufficient, but the fix I added went a step further with the validation. It may have been overkill. You're right though, there were several patterns just within the first couple search results.
I had a similar problem once in my project and I found the patterns quite useful.
Stale issue message
Happens both on Debian 10 and with a docker image (via docker build).
Supplied hostname resolves fine but has
probablynot one A record but a CNAME record which has two A name records.