修复sudo 命令 小写all 引起的推送失败

pull/134/head
yumaojun 2016-02-23 21:14:54 +08:00
parent d4b1bdef8e
commit f24b34758c
1 changed files with 12 additions and 2 deletions

View File

@ -619,7 +619,12 @@ def perm_sudo_add(request):
raise ServerError(u"sudo name 和 commands是必填项!")
pattern = re.compile(r'[\n,\r]')
commands = ', '.join(list_drop_str(pattern.split(commands), u''))
deal_commands = list_drop_str(pattern.split(commands), u'')
for command in deal_commands:
if command.lower() == "all":
deal_commands.remove(command)
deal_commands.append(command.upper())
commands = ', '.join(deal_commands)
logger.debug(u'添加sudo %s: %s' % (name, commands))
if get_object(PermSudo, name=name):
@ -656,7 +661,12 @@ def perm_sudo_edit(request):
raise ServerError(u"sudo name 和 commands是必填项!")
pattern = re.compile(r'[\n,\r]')
commands = ', '.join(list_drop_str(pattern.split(commands), u'')).strip()
deal_commands = list_drop_str(pattern.split(commands), u'')
for command in deal_commands:
if command.lower() == "all":
deal_commands.remove(command)
deal_commands.append(command.upper())
commands = ', '.join(deal_commands).strip()
logger.debug(u'添加sudo %s: %s' % (name, commands))
sudo.name = name.strip()