Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
I
install.api
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
Script
install.api
Commits
1e4623ba
Commit
1e4623ba
authored
Mar 13, 2020
by
金凯强
🎨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复上传文件和下载文件bug
parent
6ec57eef
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
12 deletions
+15
-12
api_test.py
api_test.py
+13
-10
ssh_tools.py
app/utils/ssh_tools.py
+2
-2
No files found.
api_test.py
View file @
1e4623ba
...
@@ -57,15 +57,14 @@ if __name__ == '__main__':
...
@@ -57,15 +57,14 @@ if __name__ == '__main__':
# res = requests.post('http://localhost:5000/info/app_upgrade/', json=json_data)
# res = requests.post('http://localhost:5000/info/app_upgrade/', json=json_data)
# print(res.json())
# print(res.json())
# # 获取app升级日志列表
# 获取app升级日志列表
# res = requests.get('http://localhost:5000/info/upgrade_log/')
res
=
requests
.
get
(
'http://localhost:5000/info/upgrade_log/'
)
# print(json.dumps(res.json(), indent=4))
print
(
json
.
dumps
(
res
.
json
(),
indent
=
4
))
#
#
# # 获取app单次升级日志明细
# 获取app单次升级日志明细
# res = requests.get('http://localhost:5000/info/upgrade_log_dtl/1237995081698545664/')
res
=
requests
.
get
(
'http://localhost:5000/info/upgrade_log_dtl/1237995081698545664/'
)
# print(json.dumps(res.json(), indent=4))
print
(
json
.
dumps
(
res
.
json
(),
indent
=
4
))
# 安装runner
# 安装runner
# res = requests.get('http://localhost:5000/install/runner/')
# res = requests.get('http://localhost:5000/install/runner/')
...
@@ -74,3 +73,7 @@ if __name__ == '__main__':
...
@@ -74,3 +73,7 @@ if __name__ == '__main__':
# # 回滚升级
# # 回滚升级
# res = requests.get('http://localhost:5000/upgrade/rollback/1238022723059486720/')
# res = requests.get('http://localhost:5000/upgrade/rollback/1238022723059486720/')
# print(json.dumps(res.json(), indent=4))
# print(json.dumps(res.json(), indent=4))
# 远程升级
res
=
requests
.
get
(
'http://localhost:5000/upgrade/remote/'
)
print
(
json
.
dumps
(
res
.
json
(),
indent
=
4
))
app/utils/ssh_tools.py
View file @
1e4623ba
...
@@ -47,7 +47,7 @@ class SSHConnect():
...
@@ -47,7 +47,7 @@ class SSHConnect():
:param local_path: 本地文件地址
:param local_path: 本地文件地址
:param target_path: 目标文件路径
:param target_path: 目标文件路径
"""
"""
sftp
=
paramiko
.
SFTPClient
.
from_transport
(
self
.
ssh
)
sftp
=
paramiko
.
SFTPClient
.
from_transport
(
self
.
ssh
.
get_transport
()
)
sftp
.
put
(
local_path
,
target_path
)
sftp
.
put
(
local_path
,
target_path
)
def
download
(
self
,
remote_path
,
local_path
):
def
download
(
self
,
remote_path
,
local_path
):
...
@@ -56,5 +56,5 @@ class SSHConnect():
...
@@ -56,5 +56,5 @@ class SSHConnect():
:param remote_path: 服务器文件路径
:param remote_path: 服务器文件路径
:param local_path: 本地目标路径
:param local_path: 本地目标路径
"""
"""
sftp
=
paramiko
.
SFTPClient
.
from_transport
(
self
.
ssh
)
sftp
=
paramiko
.
SFTPClient
.
from_transport
(
self
.
ssh
.
get_transport
()
)
sftp
.
get
(
remote_path
,
local_path
)
sftp
.
get
(
remote_path
,
local_path
)
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