Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
coco
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
coco
Commits
8b1eab83
Commit
8b1eab83
authored
Jul 18, 2019
by
BaiJiangJie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Update] sftp获取资产优先使用InteractiveServer缓存
parent
a70156a1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
3 deletions
+11
-3
sftp.py
coco/sftp.py
+11
-3
No files found.
coco/sftp.py
View file @
8b1eab83
...
@@ -11,6 +11,7 @@ from coco.utils import get_logger
...
@@ -11,6 +11,7 @@ from coco.utils import get_logger
from
.conf
import
config
from
.conf
import
config
from
.service
import
app_service
from
.service
import
app_service
from
.connection
import
SSHConnection
from
.connection
import
SSHConnection
from
.interactive
import
InteractiveServer
from
.const
import
(
from
.const
import
(
PERMS_ACTION_NAME_DOWNLOAD_FILE
,
PERMS_ACTION_NAME_UPLOAD_FILE
,
PERMS_ACTION_NAME_DOWNLOAD_FILE
,
PERMS_ACTION_NAME_UPLOAD_FILE
,
)
)
...
@@ -73,11 +74,18 @@ class SFTPServer(paramiko.SFTPServerInterface):
...
@@ -73,11 +74,18 @@ class SFTPServer(paramiko.SFTPServerInterface):
self
.
hosts
=
self
.
get_permed_hosts
()
self
.
hosts
=
self
.
get_permed_hosts
()
self
.
is_finished
=
False
self
.
is_finished
=
False
def
get_user_assets
(
self
):
user_id
=
self
.
server
.
connection
.
user
.
id
assets
=
InteractiveServer
.
_user_assets_cached
.
get
(
user_id
)
if
assets
is
None
:
assets
,
new_etag
=
app_service
.
get_user_assets
(
self
.
server
.
connection
.
user
,
cache_policy
=
'1'
)
return
assets
def
get_permed_hosts
(
self
):
def
get_permed_hosts
(
self
):
hosts
=
{}
hosts
=
{}
assets
=
app_service
.
get_user_assets
(
assets
=
self
.
get_user_assets
()
self
.
server
.
connection
.
user
,
cache_policy
=
'1'
,
)
for
asset
in
assets
:
for
asset
in
assets
:
if
not
asset
.
has_protocol
(
'ssh'
):
if
not
asset
.
has_protocol
(
'ssh'
):
continue
continue
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment