'Get short hostname or fully-qualified hostname of host self'

@staticmethod
def getHostname(fqdn=True):

    key = ('self', 'hostname', fqdn)
    name = DNSUtils.CACHE_ipToName.get(key)
    if (name is None):
        name = ''
        for hostname in ((socket.getfqdn, socket.gethostname) if fqdn else (socket.gethostname, socket.getfqdn)):
            try:
                name = hostname()
                break
            except Exception as e:
                logSys.warning('Retrieving    own    hostnames    failed:    %s', e)
    DNSUtils.CACHE_ipToName.set(key, name)
    return name
