From 7ca54d524b60d423d84fa49b62087cef08f982bb Mon Sep 17 00:00:00 2001
From: atlurie <atlurie@uab.edu>
Date: Fri, 22 Apr 2022 02:28:20 -0500
Subject: [PATCH] Restrict user state given via cmdline args.

If the user gives any state other than the three given choices,
throw an error and print usage help. This helps avoid unacked msgs
that are stuck in the workflow queue cause problems.
---
 account_manager.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/account_manager.py b/account_manager.py
index 3e9632d..cd9ebbb 100755
--- a/account_manager.py
+++ b/account_manager.py
@@ -14,7 +14,7 @@ parser = argparse.ArgumentParser(description = "Account management driver script
 parser.add_argument(
     "username", help="Username that should be locked/unlocked")
 parser.add_argument(
-    "state", help="Choose from states (ok,block,certify) to put the user in")
+    "state", choices=['ok', 'block', 'certification'], help="Choose from states (ok,blocked,certification)")
 parser.add_argument(
     "-s", "--service", nargs='+', default='all', choices=['ssh', 'newjobs', 'expiration', 'all'], help="List one or more services to be blocked (default: %(default)s)")
 parser.add_argument(
-- 
GitLab