marvin: remoteSSHclient logs

Adding logging for commands sent, and executed with results returned
frmo the remote host.
This commit is contained in:
Prasanna Santhanam 2012-12-13 15:57:59 -08:00
parent 6f29317a84
commit fb5ea25a4d
1 changed files with 4 additions and 1 deletions

View File

@ -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):