diff options
author | ying.yunlong <ying.yunlong@zte.com.cn> | 2017-10-13 14:30:35 +0800 |
---|---|---|
committer | ying.yunlong <ying.yunlong@zte.com.cn> | 2017-10-13 14:30:35 +0800 |
commit | 51e14898d77466bbc5b03d960b5b9962d594bbc6 (patch) | |
tree | 53df20c060534e2d27d5e205aa1912eda97f6c78 | |
parent | ee7095efd0c5837768fff17453e945d316951e20 (diff) |
Fallback vfc-lcm sftp download file
Change-Id: I980c0ae29c202ecd7e992d7bdbbad77445edc3f2
Issue-ID: VFC-533
Signed-off-by: ying.yunlong <ying.yunlong@zte.com.cn>
-rw-r--r-- | lcm/pub/utils/toscaparser/basemodel.py | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/lcm/pub/utils/toscaparser/basemodel.py b/lcm/pub/utils/toscaparser/basemodel.py index e6359667..b80b275f 100644 --- a/lcm/pub/utils/toscaparser/basemodel.py +++ b/lcm/pub/utils/toscaparser/basemodel.py @@ -21,6 +21,7 @@ import re import shutil import urllib +import paramiko from toscaparser.functions import GetInput from toscaparser.tosca_template import ToscaTemplate @@ -120,16 +121,16 @@ class BaseInfoModel(object): return localFileName def sftp_get(self, userName, userPwd, hostIp, hostPort, remoteFileName, localFileName): - return - # t = None - # try: - # t = paramiko.Transport(hostIp, int(hostPort)) - # t.connect(username=userName, password=userPwd) - # sftp = paramiko.SFTPClient.from_transport(t) - # sftp.get(remoteFileName, localFileName) - # finally: - # if t is not None: - # t.close() + # return + t = None + try: + t = paramiko.Transport(hostIp, int(hostPort)) + t.connect(username=userName, password=userPwd) + sftp = paramiko.SFTPClient.from_transport(t) + sftp.get(remoteFileName, localFileName) + finally: + if t is not None: + t.close() def ftp_get(self, userName, userPwd, hostIp, hostPort, remoteFileName, localFileName): f = None |