aaron-sierra commented on PR #2066:
URL: https://github.com/apache/libcloud/pull/2066#issuecomment-6775801421
> > I probably prefer to return `None` when the domain is not related, as in
the example `notexample.com`. `""` should only be returned when using the same
domain as a prefix. What do you think?
>
> I thought a bit on this and probably returning the full DNS name can be
the best solution: as in the example `notexample.com` will return
`notexample.com`.
I think we need to clarify what should happen when a hostname (unrooted) and
an FQDN (rooted) are passed into these functions. In the following examples,
`zone.domain == "example.com"`.
1. In the case of an unrelated hostname ("notexample.com") , these functions
can't *really* do much more than treat the input as a prefix and output garbage:
* `zone.prefix("notexample.com") == "notexample.com"`
* `zone.hostname("notexample.com") == "notexample.com.example.com"`
* `zone.fqdn("notexample.com") == "notexample.com.example.com."`
2. In the case of an unrelated FQDN ("notexample.com.") , these functions
*know* that the input is garbage and can return `None` (or raise an exception):
* `zone.prefix("notexample.com.") == None`
* `zone.hostname("notexample.com.") == None`
* `zone.fqdn("notexample.com.") == None`
I think that I prefer raising an exception in the unrelated FQDN case,
considering how #2065 notes inconsistent usage of `None` and the empty string
by various DNS driver implementations.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]