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

View File

@ -77,17 +77,25 @@ def run_vitrage_command(command, conf):
LOG.info('Full command: %s', full_command) LOG.info('Full command: %s', full_command)
p = subprocess.Popen(full_command, child = subprocess.Popen(full_command,
shell=True, shell=True,
executable="/bin/bash", executable="/bin/bash",
stdout=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.PIPE) stderr=subprocess.PIPE)
stdout, stderr = p.communicate()
stdout, stderr = child.communicate()
if stderr: if stderr:
LOG.error('error from command %(command)s = %(error)s', LOG.error('error from command %(command)s = %(error)s',
{'error': stderr, 'command': full_command}) {'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): def get_property_value(environment_name, conf_name, default_value, conf):