auth: improve pam flow and user status
This commit is contained in:
@ -133,8 +133,15 @@ def disable_user(
|
||||
if play_sound:
|
||||
_play_sound_if_available()
|
||||
|
||||
_run(["sudo", "pkill", "-KILL", "-u", user])
|
||||
steps.append("sessions terminated")
|
||||
try:
|
||||
_run(["sudo", "pkill", "-KILL", "-u", user])
|
||||
steps.append("sessions terminated")
|
||||
except subprocess.CalledProcessError as exc:
|
||||
if exc.returncode == 1:
|
||||
# pkill returns 1 when no matching processes exist; not an error here.
|
||||
steps.append("no sessions to terminate")
|
||||
else:
|
||||
raise
|
||||
|
||||
if logged_in:
|
||||
_run(["sudo", "shutdown", "now"])
|
||||
|
||||
Reference in New Issue
Block a user