fix constants iteration

add logging for running cli in tempest

Depends-On: I52db440a82f2e4280ea8f59c11f4ba34566e1da4
Change-Id: I66429ddcccaa45975b29c05b39dc90638b696c66
This commit is contained in:
Eyal 2018-01-11 15:28:11 +02:00
parent 042858d98a
commit a49d23f3dd
2 changed files with 17 additions and 11 deletions

View File

@ -63,8 +63,7 @@ class EdgeLabel(object):
@staticmethod
def labels():
return [EdgeLabel.__dict__[label]
for label in vars(EdgeLabel)
return [value for label, value in vars(EdgeLabel).items()
if not label.startswith(('_', 'labels'))]
@ -86,8 +85,7 @@ class EntityCategory(object):
@staticmethod
def categories():
return [EntityCategory.__dict__[category]
for category in vars(EntityCategory)
return [value for category, value in vars(EntityCategory).items()
if not category.startswith(('_', 'categories'))]

View File

@ -77,17 +77,25 @@ def run_vitrage_command(command, conf):
LOG.info('Full command: %s', full_command)
p = subprocess.Popen(full_command,
shell=True,
executable="/bin/bash",
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
stdout, stderr = p.communicate()
child = subprocess.Popen(full_command,
shell=True,
executable="/bin/bash",
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
stdout, stderr = child.communicate()
if stderr:
LOG.error('error from command %(command)s = %(error)s',
{'error': stderr, 'command': full_command})
return stdout.decode('utf-8')
output = stdout.decode('utf-8')
LOG.info('cli stdout: %s', output)
if child.returncode:
LOG.error('process return code is not 0 : return code = %d',
child.returncode)
return output
def get_property_value(environment_name, conf_name, default_value, conf):