Get remote/target IP address >>> pushValue(conf.hostname) >>> conf.hostname = "localhost" >>> getRemoteIP() == "127.0.0.1" True >>> conf.hostname = popValue()
()
| 1994 | return retVal |
| 1995 | |
| 1996 | def getRemoteIP(): |
| 1997 | """ |
| 1998 | Get remote/target IP address |
| 1999 | |
| 2000 | >>> pushValue(conf.hostname) |
| 2001 | >>> conf.hostname = "localhost" |
| 2002 | >>> getRemoteIP() == "127.0.0.1" |
| 2003 | True |
| 2004 | >>> conf.hostname = popValue() |
| 2005 | """ |
| 2006 | |
| 2007 | retVal = None |
| 2008 | |
| 2009 | try: |
| 2010 | retVal = socket.gethostbyname(conf.hostname) |
| 2011 | except socket.gaierror: |
| 2012 | errMsg = "address resolution problem " |
| 2013 | errMsg += "occurred for hostname '%s'" % conf.hostname |
| 2014 | singleTimeLogMessage(errMsg, logging.ERROR) |
| 2015 | |
| 2016 | return retVal |
| 2017 | |
| 2018 | def getFileType(filePath): |
| 2019 | """ |
no test coverage detected
searching dependent graphs…