Revision 449a1c40
b/snf-tools/synnefo_tools/burnin/cyclades_common.py | ||
---|---|---|
356 | 356 |
d_image = self.clients.cyclades.get_image_details(image['id']) |
357 | 357 |
return d_image['metadata']['osfamily'].lower().find(osfamily) >= 0 |
358 | 358 |
|
359 |
# Method could be a function. pylint: disable-msg=R0201 |
|
359 | 360 |
def _ssh_execute(self, hostip, username, password, command): |
360 | 361 |
"""Execute a command via ssh""" |
361 | 362 |
ssh = paramiko.SSHClient() |
362 | 363 |
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) |
363 | 364 |
try: |
364 | 365 |
ssh.connect(hostip, username=username, password=password) |
365 |
except socket.error as err:
|
|
366 |
self.fail(err)
|
|
367 |
try:
|
|
368 |
_, stdout, _ = ssh.exec_command(command)
|
|
369 |
except paramiko.SSHException as err:
|
|
370 |
self.fail(err)
|
|
366 |
except paramiko.SSHException as excpt:
|
|
367 |
if excpt.code == 104: # Error reading SSH protocol banner
|
|
368 |
raise Retry()
|
|
369 |
else:
|
|
370 |
raise
|
|
371 |
_, stdout, _ = ssh.exec_command(command)
|
|
371 | 372 |
status = stdout.channel.recv_exit_status() |
372 | 373 |
output = stdout.readlines() |
373 | 374 |
ssh.close() |
Also available in: Unified diff