Fix internal error in the user-status command.

https://fedorahosted.org/freeipa/ticket/4066
This commit is contained in:
Jan Cholasta
2013-12-05 14:43:19 +01:00
committed by Petr Viktorin
parent 1e0405880f
commit 36502a6367

View File

@@ -922,14 +922,14 @@ class user_status(LDAPQuery):
other_ldap.connect(ccache=os.environ['KRB5CCNAME'])
except Exception, e:
self.error("user_status: Connecting to %s failed with %s" % (host, str(e)))
newresult = ldap.make_entry(dn)
newresult = {'dn': dn}
newresult['server'] = _("%(host)s failed: %(error)s") % dict(host=host, error=str(e))
entries.append(newresult)
count += 1
continue
try:
entry = other_ldap.get_entry(dn, attr_list)
newresult = ldap.make_entry(dn)
newresult = {'dn': dn}
for attr in ['krblastsuccessfulauth', 'krblastfailedauth']:
newresult[attr] = entry[1].get(attr, [u'N/A'])
newresult['krbloginfailedcount'] = entry[1].get('krbloginfailedcount', u'0')
@@ -958,7 +958,7 @@ class user_status(LDAPQuery):
self.obj.handle_not_found(*keys)
except Exception, e:
self.error("user_status: Retrieving status for %s failed with %s" % (dn, str(e)))
newresult = ldap.make_entry(dn)
newresult = {'dn': dn}
newresult['server'] = _("%(host)s failed") % dict(host=host)
entries.append(newresult)
count += 1