1
0
mirror of https://github.com/samba-team/samba.git synced 2025-07-14 12:59:07 +03:00

samba-tool: improved error handling in user setexpiry

This commit is contained in:
Andrew Tridgell
2011-06-01 14:46:04 +10:00
parent 7b3d8b6c90
commit 1bc1ac0d08
2 changed files with 9 additions and 1 deletions

View File

@ -151,7 +151,11 @@ class cmd_user_setexpiry(Command):
samdb = SamDB(url=H, session_info=system_session(),
credentials=creds, lp=lp)
samdb.setexpiry(filter, days*24*3600, no_expiry_req=noexpiry)
try:
samdb.setexpiry(filter, days*24*3600, no_expiry_req=noexpiry)
except Exception, msg:
raise CommandError("Failed to set expiry for user %s: %s" % (username or filter, msg))
print("Set expiry for user %s to %u days" % (username or filter, days))
class cmd_user(SuperCommand):
"""User management [server connection needed]"""