Commit 912dd534 authored by 广宏伟's avatar 广宏伟

Merged in dev (pull request #118)

[Update] sftp 去掉windows资产
parents bffa242b 4755ab3e
...@@ -88,7 +88,6 @@ class SFTPVolume(BaseVolume): ...@@ -88,7 +88,6 @@ class SFTPVolume(BaseVolume):
def list(self, target, name_only=False): def list(self, target, name_only=False):
""" Returns a list of files/directories in the target directory. """ """ Returns a list of files/directories in the target directory. """
path = self._path(target) path = self._path(target)
print("List {} {}".format(target, path))
with self.lock: with self.lock:
return self._list(path) return self._list(path)
...@@ -96,7 +95,6 @@ class SFTPVolume(BaseVolume): ...@@ -96,7 +95,6 @@ class SFTPVolume(BaseVolume):
""" Get the sub directory of directory """ Get the sub directory of directory
""" """
path = self._path(target) path = self._path(target)
print("Tree {} {}".format(target, path))
with self.lock: with self.lock:
infos = self._list(path) infos = self._list(path)
tree = list(filter(lambda x: x['mime'] == 'directory', infos)) tree = list(filter(lambda x: x['mime'] == 'directory', infos))
...@@ -107,7 +105,6 @@ class SFTPVolume(BaseVolume): ...@@ -107,7 +105,6 @@ class SFTPVolume(BaseVolume):
获取目录的父目录, 如果deep为0,则直到根 获取目录的父目录, 如果deep为0,则直到根
""" """
path = self._path(target).rstrip(self.path_sep) path = self._path(target).rstrip(self.path_sep)
print("Parents {} {}".format(target, path))
with self.lock: with self.lock:
return self._parents(path, depth=depth) return self._parents(path, depth=depth)
...@@ -173,7 +170,6 @@ class SFTPVolume(BaseVolume): ...@@ -173,7 +170,6 @@ class SFTPVolume(BaseVolume):
remote_path = self._remote_path(path) remote_path = self._remote_path(path)
try: try:
data = self.sftp.lstat(remote_path) data = self.sftp.lstat(remote_path)
print(data)
exist = True exist = True
except FileNotFoundError: except FileNotFoundError:
exist = False exist = False
...@@ -188,7 +184,6 @@ class SFTPVolume(BaseVolume): ...@@ -188,7 +184,6 @@ class SFTPVolume(BaseVolume):
def paste(self, targets, dest, cut): def paste(self, targets, dest, cut):
""" Moves/copies target files/directories from source to dest. """ """ Moves/copies target files/directories from source to dest. """
print("Paste {} {} {}".format(targets, dest, cut))
dest_parent_path = self._path(dest) dest_parent_path = self._path(dest)
added = [] added = []
removed = [] removed = []
...@@ -198,9 +193,7 @@ class SFTPVolume(BaseVolume): ...@@ -198,9 +193,7 @@ class SFTPVolume(BaseVolume):
dest_path = self._join(dest_parent_path, self._base_name(src_path)) dest_path = self._join(dest_parent_path, self._base_name(src_path))
if self.is_dir(src_path): if self.is_dir(src_path):
raise OSError("Copy folder unsupported now") raise OSError("Copy folder unsupported now")
print("Paste {} to => {}".format(src_path, dest_parent_path))
if self.is_exist(dest_path): if self.is_exist(dest_path):
print("Exist {}".format(dest_path))
continue continue
src_remote_path = self._remote_path(src_path) src_remote_path = self._remote_path(src_path)
dest_remote_path = self._remote_path(dest_path) dest_remote_path = self._remote_path(dest_path)
......
...@@ -422,7 +422,7 @@ ...@@ -422,7 +422,7 @@
'minsLeft' : '剩余 $1 分钟', // from v2.1.17 added 13.11.2016 'minsLeft' : '剩余 $1 分钟', // from v2.1.17 added 13.11.2016
'openAsEncoding' : '使用所选编码重新打开', // from v2.1.19 added 2.12.2016 'openAsEncoding' : '使用所选编码重新打开', // from v2.1.19 added 2.12.2016
'saveAsEncoding' : '使用所选编码保存', // from v2.1.19 added 2.12.2016 'saveAsEncoding' : '使用所选编码保存', // from v2.1.19 added 2.12.2016
'selectFolder' : '选择目录', // from v2.1.20 added 13.12.2016 'selectFolder' : '选择目录(暂不支持)', // from v2.1.20 added 13.12.2016
'firstLetterSearch': '首字母搜索', // from v2.1.23 added 24.3.2017 'firstLetterSearch': '首字母搜索', // from v2.1.23 added 24.3.2017
'presets' : '预置', // from v2.1.25 added 26.5.2017 'presets' : '预置', // from v2.1.25 added 26.5.2017
'tooManyToTrash' : '项目太多,不能移动到回收站.', // from v2.1.25 added 9.6.2017 'tooManyToTrash' : '项目太多,不能移动到回收站.', // from v2.1.25 added 9.6.2017
......
...@@ -332,7 +332,6 @@ class BaseServer: ...@@ -332,7 +332,6 @@ class BaseServer:
return self._cmd_parser.parse_output(self.output_data) return self._cmd_parser.parse_output(self.output_data)
def _parse_input(self): def _parse_input(self):
print("Parse input: {}".format(self.input_data))
if not self.input_data: if not self.input_data:
return return
return self._cmd_parser.parse_input(self.input_data) return self._cmd_parser.parse_input(self.input_data)
......
...@@ -73,6 +73,8 @@ class SFTPServer(paramiko.SFTPServerInterface): ...@@ -73,6 +73,8 @@ class SFTPServer(paramiko.SFTPServerInterface):
self.server.connection.user self.server.connection.user
) )
for asset in assets: for asset in assets:
if asset.protocol != 'ssh':
continue
value = {} value = {}
key = asset.hostname key = asset.hostname
if asset.org_id: if asset.org_id:
...@@ -96,7 +98,6 @@ class SFTPServer(paramiko.SFTPServerInterface): ...@@ -96,7 +98,6 @@ class SFTPServer(paramiko.SFTPServerInterface):
active_channels = [c for c in trans._channels.values() if not c.closed] active_channels = [c for c in trans._channels.values() if not c.closed]
if not active_channels: if not active_channels:
print("CLose transport")
trans.close() trans.close()
if proxy: if proxy:
proxy.close() proxy.close()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment