Log instance console when ssh fails in EC2 test

To aid in debugging gate failures, this change adds logging of the
instance console when ssh to the instance fails. This is already
being done in the tempest/scenario/manager.py

Change-Id: I34a792378350f52081b6857084521fdd60ede6c2
This commit is contained in:
melanie witt 2015-05-21 18:50:42 +00:00
parent fc4e26ac70
commit 99fff279d4
1 changed files with 11 additions and 1 deletions

View File

@ -283,7 +283,17 @@ class InstanceRunTest(boto_test.BotoTestCase):
CONF.compute.ssh_user,
pkey=self.keypair.material)
text = data_utils.rand_name("Pattern text for console output")
resp = ssh.write_to_console(text)
try:
resp = ssh.write_to_console(text)
except Exception:
if not CONF.compute_feature_enabled.console_output:
LOG.debug('Console output not supported, cannot log')
else:
console_output = instance.get_console_output().output
LOG.debug('Console output for %s\nbody=\n%s',
instance.id, console_output)
raise
self.assertFalse(resp)
def _output():