pylib: fix getHostname to work with domain name not present in database

when bootstrapping now we have the hostname
somehostname.localdomain
but in the database we have the hostname
somehostname
and the domain is the private network domain (which is the only
network registered in the database)
localhost
So rocks list host localhost calls getHostname(None) which does
socket.gethostname() and then verifies the both the hostname
and the domainname are in the database.

With this patch getHostname verifies that only the hostname is
in the database before returning that