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
835706f7
Commit
835706f7
authored
Feb 25, 2016
by
yumaojun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix (jperm.view): 修复回收主机时, 未修改sudoers文件的bug
1. 恢复ansible 使用的 连接器配置未 smart 2. 修改perm_role_recycle 删除, 添加回收sudo配置.
parent
c6823be3
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
3 deletions
+10
-3
ansible_api.py
jperm/ansible_api.py
+1
-1
views.py
jperm/views.py
+9
-2
No files found.
jperm/ansible_api.py
View file @
835706f7
...
...
@@ -125,7 +125,7 @@ class MyRunner(MyInventory):
self
.
results_raw
=
{}
def
run
(
self
,
module_name
=
'shell'
,
module_args
=
''
,
timeout
=
10
,
forks
=
10
,
pattern
=
'*'
,
become
=
False
,
become_method
=
'sudo'
,
become_user
=
'root'
,
become_pass
=
''
,
transport
=
'
paramiko
'
):
become
=
False
,
become_method
=
'sudo'
,
become_user
=
'root'
,
become_pass
=
''
,
transport
=
'
smart
'
):
"""
run module from andible ad-hoc.
module_name: ansible module_name
...
...
jperm/views.py
View file @
835706f7
# -*- coding: utf-8 -*-
from
__future__
import
unicode_literals
from
django.db.models
import
Q
from
django.http
import
HttpResponseBadRequest
,
HttpResponseNotAllowed
...
...
@@ -705,8 +706,14 @@ def perm_role_recycle(request):
recycle_assets
.
append
(
asset
)
recycle_resource
=
gen_resource
(
recycle_assets
)
task
=
MyTask
(
recycle_resource
)
# TODO: 判断返回结果,处理异常
msg
=
task
.
del_user
(
get_object
(
PermRole
,
id
=
role_id
)
.
name
)
try
:
msg_del_user
=
task
.
del_user
(
get_object
(
PermRole
,
id
=
role_id
)
.
name
)
msg_del_sudo
=
task
.
del_user_sudo
(
get_object
(
PermRole
,
id
=
role_id
)
.
name
)
logger
.
info
(
"recycle user msg:
%
s"
%
msg_del_user
)
logger
.
info
(
"recycle sudo msg:
%
s"
%
msg_del_sudo
)
except
Exception
,
e
:
logger
.
warning
(
"Recycle Role failed:
%
s"
%
e
)
raise
ServerError
(
u"回收已推送的系统用户失败:
%
s"
%
e
)
for
asset_id
in
asset_ids
:
asset
=
get_object
(
Asset
,
id
=
asset_id
)
...
...
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