[sysadmin-bin] Decode happens directly on glu now
- From: Andrea Veri <averi src gnome org>
- To: gnome-sysadmin gnome org,commits-list gnome org
- Subject: [sysadmin-bin] Decode happens directly on glu now
- Date: Fri, 25 Feb 2022 12:42:41 +0000 (UTC)
commit e51de435c7b66cc980c94394a13fe1e3db234298
Author: Andrea Veri <averi redhat com>
Date: Fri Feb 25 13:42:31 2022 +0100
Decode happens directly on glu now
membership/foundation-operations.py | 23 ++++++++---------------
1 file changed, 8 insertions(+), 15 deletions(-)
---
diff --git a/membership/foundation-operations.py b/membership/foundation-operations.py
index 81a63a2..f8ce176 100755
--- a/membership/foundation-operations.py
+++ b/membership/foundation-operations.py
@@ -184,30 +184,23 @@ def send_form_letters(form_letter, email, name, *args):
def subscribe_new_members():
- today = str(dt.date.today())
-
if socket.gethostname() != 'restaurant.gnome.org':
sys.exit("This function should only be used on restaurant.gnome.org")
- f = open('/tmp/new_subscribers', 'w')
-
foundationmembers = glu.get_uids_from_group('foundation')
+ new_members = []
for member in foundationmembers:
- ldap_fields = glu.get_attributes_from_ldap(member, 'FirstAdded', 'LastRenewedOn', 'uid')
- first_added_attr = ldap_fields[1]
- last_renewed_on_attr = ldap_fields[2]
- uid_attr = ldap_fields[3]
- gnome_alias = '%s gnome org' % (uid_attr)
-
- if first_added_attr == today:
- f.write(str(gnome_alias) + '\n')
- elif last_renewed_on_attr == today:
- f.write(str(gnome_alias) + '\n')
+ ldap_vars = glu.get_attributes_from_ldap(member, 'FirstAdded', 'LastRenewedOn')
+
+ if (ldap_vars[1] or ldap_vars[2]) == str(dt.date.today()):
+ new_members.append(ldap_vars[0])
else:
pass
- f.close()
+ for i in new_members:
+ with open('/tmp/new_subscribers', 'w') as fl:
+ fl.write(f'{ ldap_vars[0] }@gnome.org' + '\n')
if os.path.getsize('/tmp/new_subscribers') == 0:
os.remove('/tmp/new_subscribers')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]