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
e1eaaf8c
Commit
e1eaaf8c
authored
Jul 24, 2019
by
BaiJiangJie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Update] 解决sftp登录,绕过校验系统用户手动登录的情况2
parent
a246ff2d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
sftp.py
coco/sftp.py
+6
-4
No files found.
coco/sftp.py
View file @
e1eaaf8c
...
...
@@ -14,6 +14,7 @@ from .connection import SSHConnection
from
.interactive
import
InteractiveServer
from
.const
import
(
PERMS_ACTION_NAME_DOWNLOAD_FILE
,
PERMS_ACTION_NAME_UPLOAD_FILE
,
MANUAL_LOGIN
,
)
CURRENT_DIR
=
os
.
path
.
dirname
(
__file__
)
...
...
@@ -118,10 +119,6 @@ class SFTPServer(paramiko.SFTPServerInterface):
if
not
asset
or
not
system_user
:
raise
PermissionError
(
"No asset or system user explicit"
)
if
system_user
.
login_mode
==
'manual'
:
raise
PermissionError
(
"System user is in manual login mode, please "
"use SSH protocol to connect assets first."
)
cache_key
=
'{}@{}'
.
format
(
su
,
host
)
if
cache_key
not
in
self
.
_sftp
:
conn
=
SSHConnection
.
new_connection
(
self
.
server
.
connection
.
user
,
...
...
@@ -134,6 +131,11 @@ class SFTPServer(paramiko.SFTPServerInterface):
}
self
.
_sftp
[
cache_key
]
=
sftp
return
sftp
elif
system_user
.
login_mode
==
MANUAL_LOGIN
:
raise
PermissionError
(
"System user is in manual login mode, "
"please use SSH protocol to connect assets first."
)
else
:
raise
OSError
(
"Can not connect asset sftp server: {}"
.
format
(
conn
.
error
))
else
:
...
...
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