Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Be systematic about parsing and validating hostnames and addresses #12165
This adds a parse_address(pattern) utility function that returns
This is a proof of concept for how I think it should be done. Some changes are needed: for example, we may want to be a bit more restrictive about hostnames (e.g. "foo-" should be disallowed), and a few other details may need to be cleaned up. But this is a solid foundation, and it should be backwards-compatible as well.
See also discussion in #11747
I welcome feedback/reviews/testing.
See also the later discussion in #12108 regarding defining
@jimi-c said that we don't want to support this; the code in this PR already rejects the notation.
(Aside: if desired, however, "proper" support could easily be added on the basis of this PR, i.e. to detect the user@ prefix, remove it, and set
I did a bit more testing and implemented more precise validation of hostname labels (e.g. to enforce the DNS rule that a label can't end with a hyphen, i.e.
At this point, my suggestion would be to merge this during the 2.0 alpha period so that we can see if there are any more obscure/undocumented/broken inventory definitions in the wild (such as
@chrrrles mentioned on IRC that this patch apparently caused an integration test failure. I had a quick look. The test in question is from
First, there's a trivial missing import in
If I change this to use, e.g.
I can understand supporting Unicode word characters in inventory hostnames for convenience (though it's not very convenient in practice, because you have to set
@chrrrles @abadger I've rebased, fixed the import error, made the
(BTW, I can't help but feel a bit pleased that the sum total of changes required to make the new code support unicode inventory hostnames was two lines.)
AFAIK, I've addressed all the substantive comments on this PR, and it's ready to merge now.