Browse Source

[Update] sudo命令添加help text

pull/2461/head
ibuler 6 years ago
parent
commit
1a247d60e7
  1. 3
      apps/assets/forms/user.py
  2. 9
      apps/assets/tasks.py
  3. 1673
      apps/locale/zh/LC_MESSAGES/django.po

3
apps/assets/forms/user.py

@ -150,5 +150,6 @@ class SystemUserForm(OrgModelForm, PasswordAndKeyAuthForm):
'priority': _('1-100, High level will be using login asset as default, '
'if user was granted more than 2 system user'),
'login_mode': _('If you choose manual login mode, you do not '
'need to fill in the username and password.')
'need to fill in the username and password.'),
'sudo': _("Use comma split multi command, ex: /bin/whoami,/bin/ifconfig")
}

9
apps/assets/tasks.py

@ -341,6 +341,12 @@ def get_push_system_user_tasks(system_user):
}
})
if system_user.sudo:
sudo = system_user.sudo.replace('\r\n', '\n').replace('\r', '\n')
sudo_list = sudo.split('\n')
sudo_tmp = []
for s in sudo_list:
sudo_tmp.append(s.strip(','))
sudo = ','.join(sudo_tmp)
tasks.append({
'name': 'Set {} sudo setting'.format(system_user.username),
'action': {
@ -348,8 +354,7 @@ def get_push_system_user_tasks(system_user):
'args': "dest=/etc/sudoers state=present regexp='^{0} ALL=' "
"line='{0} ALL=(ALL) NOPASSWD: {1}' "
"validate='visudo -cf %s'".format(
system_user.username,
system_user.sudo,
system_user.username, sudo,
)
}
})

1673
apps/locale/zh/LC_MESSAGES/django.po

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save