[sysadmin-bin] Do not add a white space before new_comment when has_description is False



commit a7c2b60acd03756f496bc063ff12952f33f57a60
Author: Andrea Veri <av gnome org>
Date:   Sat Oct 31 19:21:49 2015 +0100

    Do not add a white space before new_comment when has_description is False

 cleanup-inactive-ldap-accounts.py |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/cleanup-inactive-ldap-accounts.py b/cleanup-inactive-ldap-accounts.py
index 926d08a..c8f5f39 100755
--- a/cleanup-inactive-ldap-accounts.py
+++ b/cleanup-inactive-ldap-accounts.py
@@ -113,14 +113,14 @@ def add_remove_comment_to_user(username, group):
     except KeyError:
         has_description = False
 
-        current_comment = ''
-
-    comment = '%s %s' % (current_comment, new_comment)
-
     if has_description == False:
+        comment = new_comment
+
         update_comment = [(ldap.MOD_ADD, 'description', comment)]
         l.modify_s('uid=%s,%s' % (username, LDAP_USER_BASE), update_comment)
     elif has_description == True:
+        comment = '%s %s' % (current_comment, new_comment)
+
         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]