class documentation

class Hostname(object):

View In Hierarchy

Class implementing resolver and hostname functionality.

Class Method GetFqdn Return fqdn.
Class Method GetNormalizedName Validate and normalize the given hostname.
Class Method GetSysName Legacy method the get the current system's name.
Static Method GetIP Return IP address of given hostname.
Method __init__ Initialize the host name object.
Instance Variable ip Undocumented
Instance Variable name Undocumented
Constant _VALID_NAME_RE Undocumented
@classmethod
def GetFqdn(cls, hostname=None):

Return fqdn.

If hostname is None the system's fqdn is returned.

Parameters
hostname:strname to be fqdn'ed
Returns
strfqdn of given name, if it exists, unmodified name otherwise
@classmethod
def GetNormalizedName(cls, hostname):

Validate and normalize the given hostname.

Raises
errors.OpPrereqErrorwhen the name is not valid
Unknown Field: attention
the validation is a bit more relaxed than the standards require; most importantly, we allow underscores in names
@classmethod
def GetSysName(cls):

Legacy method the get the current system's name.

@staticmethod
def GetIP(hostname, family=None):

Return IP address of given hostname.

Supports both IPv4 and IPv6.

Parameters
hostname:strhostname to look up
family:intAF_INET | AF_INET6 | None
Returns
strIP address
Raises
errors.ResolverErrorin case of errors in resolving
def __init__(self, name=None, family=None):

Initialize the host name object.

If the name argument is None, it will use this system's name.

Parameters
name:strhostname or None
family:intAF_INET | AF_INET6 | None
ip =

Undocumented

name =

Undocumented

_VALID_NAME_RE =

Undocumented

Value
re.compile(r'^[a-z0-9\._-]{1,255}$')