[sysadmin-bin] Set current_comment as an empty string when the has_description is False
- From: Andrea Veri <av src gnome org>
- To: gnome-sysadmin gnome org,commits-list gnome org
- Subject: [sysadmin-bin] Set current_comment as an empty string when the has_description is False
- Date: Sat, 31 Oct 2015 18:12:15 +0000 (UTC)
commit 719aebccc1ba5e68c55f2cbde8ad4e6869ef6544
Author: Andrea Veri <av gnome org>
Date: Sat Oct 31 19:12:01 2015 +0100
Set current_comment as an empty string when the has_description is False
cleanup-inactive-ldap-accounts.py | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/cleanup-inactive-ldap-accounts.py b/cleanup-inactive-ldap-accounts.py
index dfd1dcf..f7f5967 100755
--- a/cleanup-inactive-ldap-accounts.py
+++ b/cleanup-inactive-ldap-accounts.py
@@ -110,13 +110,17 @@ def add_remove_comment_to_user(username, group):
current_comment = results[0][1]['description'][0]
except KeyError:
has_description = False
+
+ current_comment = ''
+ else:
+ has_description = True
comment = '%s %s' % (current_comment, new_comment)
if has_description == False:
update_comment = [(ldap.MOD_ADD, 'description', comment)]
l.modify_s('uid=%s,%s' % (username, LDAP_USER_BASE), update_comment)
- else:
+ elif has_description == True:
update_comment = [(ldap.MOD_REPLACE, 'description', comment)]
l.modify_s('uid=%s,%s' % (username, LDAP_USER_BASE), update_comment)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]