From e758764ea8791980ec884adfbf1a4f1bc11deeac Mon Sep 17 00:00:00 2001 From: Marc Fiuczynski Date: Thu, 7 Feb 2008 16:49:24 +0000 Subject: [PATCH] call gethostname directly via the socket API vs. invoking hostname via the shell --- qaapi/qa/Config.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/qaapi/qa/Config.py b/qaapi/qa/Config.py index cccb4ae..e931de3 100644 --- a/qaapi/qa/Config.py +++ b/qaapi/qa/Config.py @@ -2,6 +2,7 @@ import xmlrpclib import os import sys import re +import socket import utils class Config: @@ -10,6 +11,7 @@ class Config: tests_path = path + os.sep + 'tests' node_tests_path = tests_path + os.sep + 'node' slice_tests_path = tests_path + os.sep + 'slice' + def __init__(self, config_file = path+os.sep+'qa_config'): # Load config file try: @@ -40,8 +42,7 @@ class Config: self.api_type = 'xmlrpc' # try setting hostname and ip - (stdout, stderr) = utils.popen("hostname") - self.hostname = stdout[0].strip() + self.hostname = socket.gethostname() (stdout, stderr) = utils.popen("/sbin/ifconfig eth0 | grep 'inet addr'") inet_addr = re.findall('inet addr:[0-9\.^\w]*', stdout[0])[0] parts = inet_addr.split(":") -- 2.43.0