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
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
8 deletions
+16
-8
tasks.py
apps/assets/tasks.py
+16
-8
No files found.
apps/assets/tasks.py
View file @
d0c74a77
...
...
@@ -374,19 +374,16 @@ def test_system_user_connectivity_period():
#### Push system user tasks ####
def
get_push_linux_system_user_tasks
(
system_user
):
tasks
=
[]
if
system_user
.
password
:
tasks
.
append
({
tasks
=
[
{
'name'
:
'Add user {}'
.
format
(
system_user
.
username
),
'action'
:
{
'module'
:
'user'
,
'args'
:
'name={} shell={} state=present
password={}
'
.
format
(
'args'
:
'name={} shell={} state=present'
.
format
(
system_user
.
username
,
system_user
.
shell
,
encrypt_password
(
system_user
.
password
,
salt
=
"K3mIlKK"
),
),
}
})
tasks
.
extend
([
},
{
'name'
:
'Check home dir exists'
,
'action'
:
{
...
...
@@ -403,7 +400,18 @@ def get_push_linux_system_user_tasks(system_user):
},
'when'
:
'home_existed.stat.exists == true'
}
])
]
if
system_user
.
password
:
tasks
.
append
({
'name'
:
'Set {} password'
.
format
(
system_user
.
username
),
'action'
:
{
'module'
:
'user'
,
'args'
:
'name={} shell={} state=present password={}'
.
format
(
system_user
.
username
,
system_user
.
shell
,
encrypt_password
(
system_user
.
password
,
salt
=
"K3mIlKK"
),
),
}
})
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