[sysadmin-bin] Append a last_renewed_on field to the membershiplist json



commit 57e6e34af90aba55e0c1fce6c0e0c89715322790
Author: Andrea Veri <averi redhat com>
Date:   Mon May 15 22:35:42 2017 +0200

    Append a last_renewed_on field to the membershiplist json

 membership/foundation-operations.py |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)
---
diff --git a/membership/foundation-operations.py b/membership/foundation-operations.py
index 68bd120..ddcb7bb 100755
--- a/membership/foundation-operations.py
+++ b/membership/foundation-operations.py
@@ -151,19 +151,16 @@ def remove_expired_memberships_from_foundation():
 def generate_membership_list():
     import json
 
-    membershiplist = []
-    membershipdict = {}
     result = []
 
     for member in foundationmembers:
         common_name_attr = _get_attributes_from_ldap(member, 'cn')
-        membershiplist.append(common_name_attr)
+        last_renewed_on_attr = _get_attributes_from_ldap(member, 'LastRenewedOn')
 
-    for cn in membershiplist:
-        d = { 'common_name' : cn }
+        d = { 'common_name' : common_name_attr, 'last_renewed_on' : last_renewed_on_attr }
         result.append(d)
 
-        memberslist = json.dumps(result, ensure_ascii=False, encoding='utf8')
+    memberslist = json.dumps(result, ensure_ascii=False, encoding='utf8')
 
     if len(memberslist) > 0:
         import codecs


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]