Martin Kosek wrote:
On Wed, 2012-02-29 at 11:20 +0100, Petr Viktorin wrote:
On 02/27/2012 06:31 PM, Martin Kosek wrote:
4) Minor change:
- except Exception:
+ except:
Don't do that. It would for example disable Ctrl+C by trapping
KeyboardInterrupt.
PEP8 has a paragraph on this, search for 'except Exception:'
Good to know, thanks. Rob, in that case please ignore issue #4.
Martin
Updated patch attached.
rob
>From 8acf1185967e6039cdcb25321dd079ec34ed4970 Mon Sep 17 00:00:00 2001
From: Rob Crittenden <rcrit...@redhat.com>
Date: Thu, 1 Mar 2012 16:24:41 -0500
Subject: [PATCH] Add status command to retrieve user lockout status
This information is not replicated so pull from all IPA masters
and display the status across all servers.
https://fedorahosted.org/freeipa/ticket/2162
---
ipalib/plugins/user.py | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/ipalib/plugins/user.py b/ipalib/plugins/user.py
index 54e32f2358f035a6fd4944c38a64c4776b12fdea..ca11315bd939b545d1ea96e22afe29fdd6f9cb1d 100644
--- a/ipalib/plugins/user.py
+++ b/ipalib/plugins/user.py
@@ -747,12 +747,15 @@ class user_status(LDAPQuery):
try:
entry = other_ldap.get_entry(dn, attr_list)
newresult = dict()
- for attr in attr_list:
- newresult[attr] = entry[1].get(attr, '')
+ for attr in ['krblastsuccessfulauth', 'krblastfailedauth']:
+ newresult[attr] = entry[1].get(attr, [u'N/A'])
+ newresult['krbloginfailedcount'] = entry[1].get('krbloginfailedcount', u'0')
if not options.get('raw', False):
for attr in ['krblastsuccessfulauth', 'krblastfailedauth']:
try:
- newtime = time.strptime(newresult[attr][0], '%Y%m%d%H%M%S%Z')
+ if newresult[attr][0] == u'N/A':
+ continue
+ newtime = time.strptime(newresult[attr][0], '%Y%m%d%H%M%SZ')
newresult[attr][0] = unicode(time.strftime('%Y-%m-%dT%H:%M:%SZ', newtime))
except Exception, e:
self.debug("time conversion failed with %s" % str(e))
@@ -761,6 +764,8 @@ class user_status(LDAPQuery):
newresult['server'] = host
entries.append(newresult)
count += 1
+ except errors.NotFound:
+ self.obj.handle_not_found(*keys)
except Exception, e:
raise e
--
1.7.6
_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel