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
b3b9c653
Commit
b3b9c653
authored
Mar 21, 2020
by
金凯强
🎨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
安装docker增加校验
parent
a14f5621
Pipeline
#21279
passed with stage
in 40 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
0 deletions
+14
-0
install_service.py
app/install/install_service.py
+14
-0
No files found.
app/install/install_service.py
View file @
b3b9c653
...
...
@@ -166,6 +166,8 @@ class InstallService(HSBaseUCService):
password
=
remote_server_info
[
'server_password'
])
with
ssh_conenct
as
ssh
:
# 验证远端服务器有没有按照docker
self
.
validate_remote_server_install_docker
(
ssh
)
# 先上传必要的文件
logger
.
info
(
'上传文件docker-19.03.4.tgz'
)
ssh
.
upload
(
os
.
path
.
join
(
system_file_dir
,
'docker-19.03.4.tgz'
),
'/docker-19.03.4.tgz'
)
...
...
@@ -183,3 +185,15 @@ class InstallService(HSBaseUCService):
logger
.
info
(
f
'执行重启命令信息:{out2},错误信息:{err2}'
)
logger
.
info
(
f
'执行成功,静等服务器重启。。。'
)
logger
.
info
(
'dokcer安装成功'
)
def
validate_remote_server_install_docker
(
self
,
ssh
):
'''
验证远端服务器是否安装docker
:param ssh:
:return:
'''
out
,
err
=
ssh
.
exec_command
(
'docker -v'
)
if
'Docker version'
in
out
or
err
:
logger
.
info
(
'dokcer安装失败'
)
raise
HSException
(
'远端服务器已经安装docker,不需要重新安装'
)
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