pykolab/cli
Jeroen van Meeuwen
vanmeeuwen at kolabsys.com
Wed Dec 31 12:26:58 CET 2014
pykolab/cli/cmd_user_info.py | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
New commits:
commit a488e572eaac1719a2abed952e9025b940791b2a
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date: Wed Dec 31 12:26:44 2014 +0100
Bail out if the user cannot be found
diff --git a/pykolab/cli/cmd_user_info.py b/pykolab/cli/cmd_user_info.py
index 1e1e969..c120353 100644
--- a/pykolab/cli/cmd_user_info.py
+++ b/pykolab/cli/cmd_user_info.py
@@ -17,6 +17,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
+import sys
+
import commands
import pykolab
@@ -38,11 +40,16 @@ def execute(*args, **kw):
except IndexError, errmsg:
user = utils.ask_question(_("Email address"))
- wap_client.authenticate(username=conf.get("ldap", "bind_dn"), password=conf.get("ldap", "bind_pw"))
+ result = wap_client.authenticate(username=conf.get("ldap", "bind_dn"), password=conf.get("ldap", "bind_pw"))
+
if len(user.split('@')) > 1:
wap_client.system_select_domain(user.split('@')[1])
user_info = wap_client.user_find({'mail':user})
+ if user_info == None or not user_info:
+ print >> sys.stderr, _("No such user %s") % (user)
+ sys.exit(0)
+
for (k,v) in user_info.iteritems():
print "%s: %r" % (k,v)
More information about the commits
mailing list