Re: [Freeipa-devel] [PATCH] 211 Fix internal error in the user-status command

2013-12-10 Thread Petr Viktorin

On 12/05/2013 02:45 PM, Jan Cholasta wrote:

Hi,

the attached patch fixes https://fedorahosted.org/freeipa/ticket/4066.

Honza


Patch looks good, ACK.

I've added a small regression test for this, does it look OK?

--
Petr³

From bb333401aa551f84a16192d2d42de20bd5633f84 Mon Sep 17 00:00:00 2001
From: Petr Viktorin pvikt...@redhat.com
Date: Tue, 10 Dec 2013 12:16:25 +0100
Subject: [PATCH] Regression test for user_status crash

https://fedorahosted.org/freeipa/ticket/4066
---
 ipatests/test_xmlrpc/test_user_plugin.py | 25 +
 1 file changed, 25 insertions(+)

diff --git a/ipatests/test_xmlrpc/test_user_plugin.py b/ipatests/test_xmlrpc/test_user_plugin.py
index 2f07e1495ff31cac7ea4db2eb42453e065aec418..14a4b501d49537eb1ddcc6c593ad4b75c15da6da 100644
--- a/ipatests/test_xmlrpc/test_user_plugin.py
+++ b/ipatests/test_xmlrpc/test_user_plugin.py
@@ -23,6 +23,8 @@
 Test the `ipalib/plugins/user.py` module.
 
 
+import re
+
 from ipalib import api, errors
 from ipatests.test_xmlrpc import objectclasses
 from ipatests.util import assert_equal, assert_not_equal
@@ -45,6 +47,9 @@
 sshpubkey = u'ssh-rsa B3NzaC1yc2EDAQABAAABAQDGAX3xAeLeaJggwTqMjxNwa6XHBUAikXPGMzEpVrlLDCZtv00djsFTBi38PkgxBJVkgRWMrcBsr/35lq7P6w8KGIwA8GI48Z0qBS2NBMJ2u9WQ2hjLN6GdMlo77O0uJY3251p12pCVIS/bHRSq8kHO2No8g7KA9fGGcagPfQH+ee3t7HUkpbQkFTmbPPN++r3V8oVUk5LxbryB3UIIVzNmcSIn3JrXynlvui4MixvrtX6zx+O/bBo68o8/eZD26QrahVbA09fivrn/4h3TM019Eu/c2jOdckfU3cHUV/3Tno5d6JicibyaoDDK7S/yjdn5jhaz8MSEayQvFkZkiF0L public key test'
 sshpubkeyfp = u'13:67:6B:BF:4E:A2:05:8E:AE:25:8B:A1:31:DE:6F:1B public key test (ssh-rsa)'
 
+# Date in ISO format (2013-12-10T12:00:00)
+isodate_re = re.compile('^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$')
+
 
 def get_user_result(uid, givenname, sn, operation='show', omit=[],
 **overrides):
@@ -1449,4 +1454,24 @@ class test_user(Declarative):
 ),
 ),
 
+dict(
+desc='Query status of %s' % user1,
+command=('user_status', [user1], {}),
+expected=dict(
+count=1,
+result=[
+dict(
+dn=get_user_dn(user1),
+krblastfailedauth=[u'N/A'],
+krblastsuccessfulauth=[u'N/A'],
+krbloginfailedcount=u'0',
+now=isodate_re.match,
+server=api.env.host,
+),
+],
+summary=u'Account disabled: False',
+truncated=False,
+),
+),
+
 ]
-- 
1.8.3.1

___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Re: [Freeipa-devel] [PATCH] 211 Fix internal error in the user-status command

2013-12-10 Thread Jan Cholasta

On 10.12.2013 12:18, Petr Viktorin wrote:

On 12/05/2013 02:45 PM, Jan Cholasta wrote:

Hi,

the attached patch fixes https://fedorahosted.org/freeipa/ticket/4066.

Honza


Patch looks good, ACK.

I've added a small regression test for this, does it look OK?


Thanks, it looks OK except I don't see dn in result and I would rename 
isodate_re to generalizedtime_re.


--
Jan Cholasta

___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel


Re: [Freeipa-devel] [PATCH] 211 Fix internal error in the user-status command

2013-12-10 Thread Petr Viktorin

On 12/10/2013 02:15 PM, Jan Cholasta wrote:

On 10.12.2013 12:18, Petr Viktorin wrote:

On 12/05/2013 02:45 PM, Jan Cholasta wrote:

Hi,

the attached patch fixes https://fedorahosted.org/freeipa/ticket/4066.

Honza


Patch looks good, ACK.

I've added a small regression test for this, does it look OK?


Thanks, it looks OK except I don't see dn in result and I would rename
isodate_re to generalizedtime_re.


Your patch adds dn.

user_status without --raw will report time in ISO 8601 
(%Y-%m-%dT%H:%M:%SZ). GeneralizedTime would be %Y%m%d%H%M%SZ.


--
Petr³

___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel


Re: [Freeipa-devel] [PATCH] 211 Fix internal error in the user-status command

2013-12-10 Thread Jan Cholasta

On 10.12.2013 15:18, Petr Viktorin wrote:

On 12/10/2013 02:15 PM, Jan Cholasta wrote:

On 10.12.2013 12:18, Petr Viktorin wrote:

On 12/05/2013 02:45 PM, Jan Cholasta wrote:

Hi,

the attached patch fixes
https://fedorahosted.org/freeipa/ticket/4066.

Honza


Patch looks good, ACK.

I've added a small regression test for this, does it look OK?


Thanks, it looks OK except I don't see dn in result and I would rename
isodate_re to generalizedtime_re.


Your patch adds dn.


Oh, right.



user_status without --raw will report time in ISO 8601
(%Y-%m-%dT%H:%M:%SZ). GeneralizedTime would be %Y%m%d%H%M%SZ.



Also right.

Sorry for the fuss then, ACK.

--
Jan Cholasta

___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel


Re: [Freeipa-devel] [PATCH] 211 Fix internal error in the user-status command

2013-12-10 Thread Petr Viktorin

On 12/10/2013 03:23 PM, Jan Cholasta wrote:

On 10.12.2013 15:18, Petr Viktorin wrote:

On 12/10/2013 02:15 PM, Jan Cholasta wrote:

On 10.12.2013 12:18, Petr Viktorin wrote:

On 12/05/2013 02:45 PM, Jan Cholasta wrote:

Hi,

the attached patch fixes
https://fedorahosted.org/freeipa/ticket/4066.

Honza


Patch looks good, ACK.

I've added a small regression test for this, does it look OK?


Thanks, it looks OK except I don't see dn in result and I would rename
isodate_re to generalizedtime_re.


Your patch adds dn.


Oh, right.



user_status without --raw will report time in ISO 8601
(%Y-%m-%dT%H:%M:%SZ). GeneralizedTime would be %Y%m%d%H%M%SZ.



Also right.

Sorry for the fuss then, ACK.



Thanks, pushed both to master: b6563984154e577cdf430f8f74f15f912ac0ee12

--
Petr³

___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel


[Freeipa-devel] [PATCH] 211 Fix internal error in the user-status command

2013-12-05 Thread Jan Cholasta

Hi,

the attached patch fixes https://fedorahosted.org/freeipa/ticket/4066.

Honza

--
Jan Cholasta
From 751ba817f04ba189b2000e0d0f02611ac62243cb Mon Sep 17 00:00:00 2001
From: Jan Cholasta jchol...@redhat.com
Date: Thu, 5 Dec 2013 14:43:19 +0100
Subject: [PATCH] Fix internal error in the user-status command.

https://fedorahosted.org/freeipa/ticket/4066
---
 ipalib/plugins/user.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/ipalib/plugins/user.py b/ipalib/plugins/user.py
index c855145..ae927b6 100644
--- a/ipalib/plugins/user.py
+++ b/ipalib/plugins/user.py
@@ -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
-- 
1.8.4.2

___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel