Comment 2 for bug 1615028

Revision history for this message
Dharini Chandrasekar (dharini-chandrasekar) wrote :

The HostnameOpt type currently does not test for the presence of at least one char.
Due to this, it accepts IPv4 addresses (complete and incomplete). ie. for example: "10.0.0.0" and "10.0" are both taken as valid hostnames while the latter should not be.
Also the Hostname opt type does not accept ipv6 addresses. Nor does it perform strict checks on IP addresses based on their versions.
Editing the HostnameOpt type to accommodate strict checks on IPs will stop it from accepting pure hostnames. (Refer https://github.com/openstack/oslo.config/blob/master/oslo_config/types.py)

Hence a reasonable solution could be to add a new type: HostAddress that will perform strict checks on both IPs and hostnames.
So for opts that can have either a hostname or an IP can be given the new type - HostAddress.