aboutsummaryrefslogtreecommitdiffstats
path: root/func/env_setup.py
diff options
context:
space:
mode:
authorYujun Zhang <zhang.yujunz@zte.com.cn>2016-09-21 07:17:52 +0000
committerGerrit Code Review <gerrit@172.30.200.206>2016-09-21 07:17:52 +0000
commit58ac79cd54821bf8c3891d136be4254aa79bfa08 (patch)
tree52bd6f03a9e7d50b44ffce15dab47d5ddead381c /func/env_setup.py
parentad90940e82c0039372d68f3136791851994557a9 (diff)
parent6183cefebbc1af8ad1987dc61372d6c2d6a59f6d (diff)
Merge "add unified logger process for qtip"
Diffstat (limited to 'func/env_setup.py')
-rw-r--r--func/env_setup.py27
1 files changed, 14 insertions, 13 deletions
diff --git a/func/env_setup.py b/func/env_setup.py
index 3697f235..f10f8620 100644
--- a/func/env_setup.py
+++ b/func/env_setup.py
@@ -8,18 +8,19 @@
##############################################################################
import os
+import random
+import socket
import sys
-from collections import defaultdict
-import yaml
import time
-import paramiko
-import socket
+from collections import defaultdict
from os.path import expanduser
-import random
-import logging
-LOG = logging.getLogger(__name__)
-LOG.setLevel(logging.DEBUG)
+import paramiko
+import yaml
+
+from utils import logger_utils
+
+logger = logger_utils.QtipLogger('env_setup').get
class Env_setup:
@@ -100,7 +101,7 @@ class Env_setup:
@staticmethod
def fetch_compute_ips():
- LOG.info("Fetch compute ips through installer")
+ logger.info("Fetch compute ips through installer")
ips = []
installer_type = str(os.environ['INSTALLER_TYPE'].lower())
@@ -112,18 +113,18 @@ class Env_setup:
cmd = "bash ./func/fetch_compute_ips.sh -i %s -a %s" % \
(installer_type, installer_ip)
- LOG.info(cmd)
+ logger.info(cmd)
os.system(cmd)
home = expanduser("~")
with open(home + "/ips.log", "r") as file:
data = file.read()
if data:
ips.extend(data.rstrip('\n').split('\n'))
- LOG.info("All compute ips: %s" % ips)
+ logger.info("All compute ips: %s" % ips)
return ips
def check_machine_ips(self, host_tag):
- LOG.info("Check machine ips")
+ logger.info("Check machine ips")
ips = self.fetch_compute_ips()
ips_num = len(ips)
num = len(host_tag)
@@ -137,7 +138,7 @@ class Env_setup:
if host_tag[hostlabel]['ip'] in ips:
info = "%s's ip %s is defined by test case yaml file" % \
(hostlabel, host_tag[hostlabel]['ip'])
- LOG.info(info)
+ logger.info(info)
else:
err = "%s is not in %s" % (host_tag[hostlabel]['ip'], ips)
raise RuntimeError(err)