if not os.path.exists(self.res_dir):
os.makedirs(self.res_dir)
cmd = ['vmtp', '-sc']
- output = subprocess.check_output(cmd)
+ output = subprocess.check_output(cmd).decode("utf-8")
self.__logger.info("%s\n%s", " ".join(cmd), output)
with open(self.config, "w+") as conf:
vmtp_conf = yaml.full_load(output)
conf.write(yaml.dump(vmtp_conf))
def run_vmtp(self):
+ # pylint: disable=unexpected-keyword-arg
"""Run Vmtp and generate charts
Raises: Exception on error
OS_USERNAME=self.project.user.name,
OS_PROJECT_NAME=self.project.project.name,
OS_PROJECT_ID=self.project.project.id,
+ OS_PROJECT_DOMAIN_NAME=self.project.domain.name,
+ OS_USER_DOMAIN_NAME=self.project.domain.name,
OS_PASSWORD=self.project.password)
if not new_env["OS_AUTH_URL"].endswith(('v3', 'v3/')):
new_env["OS_AUTH_URL"] = "{}/v3".format(new_env["OS_AUTH_URL"])
cmd = ['vmtp', '-d', '--json', '{}/vmtp.json'.format(self.res_dir),
'-c', self.config]
output = subprocess.check_output(
- cmd, stderr=subprocess.STDOUT, env=new_env)
+ cmd, stderr=subprocess.STDOUT, env=new_env).decode("utf-8")
self.__logger.info("%s\n%s", " ".join(cmd), output)
cmd = ['vmtp_genchart', '-c', '{}/vmtp.html'.format(self.res_dir),
'{}/vmtp.json'.format(self.res_dir)]
- output = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
+ output = subprocess.check_output(
+ cmd, stderr=subprocess.STDOUT).decode("utf-8")
self.__logger.info("%s\n%s", " ".join(cmd), output)
with open('{}/vmtp.json'.format(self.res_dir), 'r') as res_file:
self.details = json.load(res_file)
status = testcase.TestCase.EX_OK
except subprocess.CalledProcessError as cpe:
self.__logger.error(
- "Exception when calling %s\n%s", cpe.cmd, cpe.output)
+ "Exception when calling %s\n%s", cpe.cmd,
+ cpe.output.decode("utf-8"))
self.result = 0
except Exception: # pylint: disable=broad-except
self.__logger.exception("Cannot run vmtp")