Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
J
jumpserver
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
jumpserver
Commits
d0c74a77
Commit
d0c74a77
authored
Jul 30, 2019
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Bugfix] 修复只设置公钥不推送的问题
parent
b5aa69db
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
20 deletions
+28
-20
tasks.py
apps/assets/tasks.py
+28
-20
No files found.
apps/assets/tasks.py
View file @
d0c74a77
...
...
@@ -374,10 +374,36 @@ def test_system_user_connectivity_period():
#### Push system user tasks ####
def
get_push_linux_system_user_tasks
(
system_user
):
tasks
=
[]
tasks
=
[
{
'name'
:
'Add user {}'
.
format
(
system_user
.
username
),
'action'
:
{
'module'
:
'user'
,
'args'
:
'name={} shell={} state=present'
.
format
(
system_user
.
username
,
system_user
.
shell
,
),
}
},
{
'name'
:
'Check home dir exists'
,
'action'
:
{
'module'
:
'stat'
,
'args'
:
'path=/home/{}'
.
format
(
system_user
.
username
)
},
'register'
:
'home_existed'
},
{
'name'
:
"Set home dir permission"
,
'action'
:
{
'module'
:
'file'
,
'args'
:
"path=/home/{0} owner={0} group={0} mode=700"
.
format
(
system_user
.
username
)
},
'when'
:
'home_existed.stat.exists == true'
}
]
if
system_user
.
password
:
tasks
.
append
({
'name'
:
'
Add user {}
'
.
format
(
system_user
.
username
),
'name'
:
'
Set {} password
'
.
format
(
system_user
.
username
),
'action'
:
{
'module'
:
'user'
,
'args'
:
'name={} shell={} state=present password={}'
.
format
(
...
...
@@ -386,24 +412,6 @@ def get_push_linux_system_user_tasks(system_user):
),
}
})
tasks
.
extend
([
{
'name'
:
'Check home dir exists'
,
'action'
:
{
'module'
:
'stat'
,
'args'
:
'path=/home/{}'
.
format
(
system_user
.
username
)
},
'register'
:
'home_existed'
},
{
'name'
:
"Set home dir permission"
,
'action'
:
{
'module'
:
'file'
,
'args'
:
"path=/home/{0} owner={0} group={0} mode=700"
.
format
(
system_user
.
username
)
},
'when'
:
'home_existed.stat.exists == true'
}
])
if
system_user
.
public_key
:
tasks
.
append
({
'name'
:
'Set {} authorized key'
.
format
(
system_user
.
username
),
...
...
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