mirror of https://github.com/jumpserver/jumpserver
fix (jperm.view): 修复回收主机时, 未修改sudoers文件的bug
1. 恢复ansible 使用的 连接器配置未 smart 2. 修改perm_role_recycle 删除, 添加回收sudo配置.pull/91/head
parent
c6823be302
commit
835706f780
|
@ -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
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# -*- 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)
|
||||
|
|
Loading…
Reference in New Issue