pull/26/head
ibuler 2015-12-10 14:42:01 +08:00
parent e117cd003f
commit 23051a4a05
2 changed files with 2 additions and 3 deletions

View File

@ -430,7 +430,6 @@ def perm_role_push(request):
group_assets_obj.extend(asset_group.asset_set.all()) group_assets_obj.extend(asset_group.asset_set.all())
calc_assets = list(set(assets_obj) | set(group_assets_obj)) calc_assets = list(set(assets_obj) | set(group_assets_obj))
push_resource = gen_resource(calc_assets) push_resource = gen_resource(calc_assets)
logger.debug('Push role res: %s' % push_resource)
# 调用Ansible API 进行推送 # 调用Ansible API 进行推送
password_push = True if request.POST.get("use_password") else False password_push = True if request.POST.get("use_password") else False
@ -451,6 +450,7 @@ def perm_role_push(request):
# 3. 推送sudo配置文件 # 3. 推送sudo配置文件
if password_push or key_push: if password_push or key_push:
sudo_list = set([sudo for sudo in role.sudo.all()]) # set(sudo1, sudo2, sudo3) sudo_list = set([sudo for sudo in role.sudo.all()]) # set(sudo1, sudo2, sudo3)
if sudo_list:
ret['sudo'] = task.push_sudo_file([role], sudo_list) ret['sudo'] = task.push_sudo_file([role], sudo_list)
logger.debug('推送role结果: %s' % ret) logger.debug('推送role结果: %s' % ret)

View File

@ -491,7 +491,6 @@ def defend_attack(func):
return HttpResponse('Forbidden', status=403) return HttpResponse('Forbidden', status=403)
request.session['visit'] = request.session.get('visit', 1) + 1 request.session['visit'] = request.session.get('visit', 1) + 1
request.session.set_expiry(300) request.session.set_expiry(300)
logger.debug(request.session.get('visit'))
return func(request, *args, **kwargs) return func(request, *args, **kwargs)
return _deco return _deco