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
114289ed
Commit
114289ed
authored
Feb 02, 2018
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Bugfix] 修改创建系统用户的bug
parent
45f6a629
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
9 deletions
+12
-9
forms.py
apps/assets/forms.py
+1
-1
tasks.py
apps/assets/tasks.py
+11
-8
No files found.
apps/assets/forms.py
View file @
114289ed
...
...
@@ -308,7 +308,7 @@ class SystemUserForm(PasswordAndKeyAuthForm):
auto_generate_key
=
self
.
cleaned_data
.
get
(
'auto_generate_key'
,
False
)
private_key
,
public_key
=
super
()
.
gen_keys
()
if
not
self
.
instance
and
auto_generate_key
:
if
auto_generate_key
:
logger
.
info
(
'Auto generate key and set system user auth'
)
system_user
.
auto_gen_auth
()
else
:
...
...
apps/assets/tasks.py
View file @
114289ed
...
...
@@ -314,8 +314,10 @@ def get_push_system_user_tasks(system_user):
if
system_user
.
username
==
"root"
:
return
[]
tasks
=
[
{
tasks
=
[]
if
system_user
.
password
:
tasks
.
append
({
'name'
:
'Add user {}'
.
format
(
system_user
.
username
),
'action'
:
{
'module'
:
'user'
,
...
...
@@ -324,8 +326,9 @@ def get_push_system_user_tasks(system_user):
encrypt_password
(
system_user
.
password
,
salt
=
"K3mIlKK"
),
),
}
},
{
})
if
system_user
.
public_key
:
tasks
.
append
({
'name'
:
'Set {} authorized key'
.
format
(
system_user
.
username
),
'action'
:
{
'module'
:
'authorized_key'
,
...
...
@@ -333,8 +336,9 @@ def get_push_system_user_tasks(system_user):
system_user
.
username
,
system_user
.
public_key
)
}
},
{
})
if
system_user
.
sudo
:
tasks
.
append
({
'name'
:
'Set {} sudo setting'
.
format
(
system_user
.
username
),
'action'
:
{
'module'
:
'lineinfile'
,
...
...
@@ -345,8 +349,7 @@ def get_push_system_user_tasks(system_user):
system_user
.
sudo
,
)
}
}
]
})
return
tasks
...
...
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