summaryrefslogtreecommitdiffstats
path: root/func/env_setup.py
diff options
context:
space:
mode:
Diffstat (limited to 'func/env_setup.py')
-rw-r--r--func/env_setup.py29
1 files changed, 15 insertions, 14 deletions
diff --git a/func/env_setup.py b/func/env_setup.py
index 96f984cb..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)
@@ -174,7 +175,7 @@ class Env_setup:
def parse(self, config_file_path):
try:
f_name = open(config_file_path, 'r+')
- doc = yaml.load(f_name)
+ doc = yaml.safe_load(f_name)
f_name.close()
if doc['Scenario']['benchmark']:
self.benchmark = doc['Scenario']['benchmark']