[Tutor] How to convert short name to fqdn

Sterba_Robert at emc.com Sterba_Robert at emc.com
Wed May 19 20:19:58 CEST 2010


I have a likely simple question, that for some reason is not working as expected.
 
I need to take a servers shortname and convert it to fully qualified.  These servers reside in various subdomains, so simply appending a suffix will not work.
 
my hope was that socket.getfqdn('servername') would do this, however this only appears to work if the connection specific domain suffix is the same as the server I'm looking up.  If it's different, it just returns the client name.
 
example.  my workstation is on   subdomaina.domain.com
               client is on                  subdomainb.domain.com
               any short name I put in on subdmainA comes back correctly, but if i put in a short name that resolves to any other subdomain, it just returns the shortname.  This is the intended behaviour if socket.getfqdn() cann't resolve the name, however I don't see why it can't resolve the name.
 
from nslookup, I can resolve the client to fqdn just fine there is only one entry for it, so it is not a resolution issue, but appears to be specific to the way the socket.getfqdn() works.  
 
Is there something I'm missing, or is there an easy way to do this?
 
Thanks, 
Rob


More information about the Tutor mailing list