mirror of https://github.com/apache/cloudstack.git
marvin: remoteSSHclient logs
Adding logging for commands sent, and executed with results returned frmo the remote host.
This commit is contained in:
parent
6f29317a84
commit
fb5ea25a4d
|
|
@ -19,6 +19,7 @@ import paramiko
|
|||
import time
|
||||
import cloudstackException
|
||||
import contextlib
|
||||
import logging
|
||||
from contextlib import closing
|
||||
|
||||
class remoteSSHClient(object):
|
||||
|
|
@ -34,6 +35,7 @@ class remoteSSHClient(object):
|
|||
while True:
|
||||
try:
|
||||
self.ssh.connect(str(host),int(port), user, passwd)
|
||||
logging.debug("[SSHClient] connecting to server %s @ port % with user:passwd %s:%s"%(str(host), port, user, passwd))
|
||||
except paramiko.SSHException, sshex:
|
||||
if retry_count == 0:
|
||||
raise cloudstackException.InvalidParameterException(repr(sshex))
|
||||
|
|
@ -46,6 +48,7 @@ class remoteSSHClient(object):
|
|||
|
||||
def execute(self, command):
|
||||
stdin, stdout, stderr = self.ssh.exec_command(command)
|
||||
logging.debug("[SSHClient] sending command %s to host"%(command, str(self.host)))
|
||||
output = stdout.readlines()
|
||||
errors = stderr.readlines()
|
||||
results = []
|
||||
|
|
@ -57,7 +60,7 @@ class remoteSSHClient(object):
|
|||
else:
|
||||
for strOut in output:
|
||||
results.append(strOut.rstrip())
|
||||
|
||||
logging.debug("[SSHClient] command %s returned %s"%(command, results))
|
||||
return results
|
||||
|
||||
def scp(self, srcFile, destPath):
|
||||
|
|
|
|||
Loading…
Reference in New Issue