[sysadmin-bin] Create auth was causing too much to ldap-back at the beginning of each hour when cron ran. Add a tim



commit fd612b1ff87fe1de8d7111cfc06a62d646218aaa
Author: Andrea Veri <av gnome org>
Date:   Fri Jul 19 16:59:57 2013 +0200

    Create auth was causing too much to ldap-back at the beginning of each hour when cron ran. Add a 
time.sleep call so that the script doesn't get executed at the same time on all the machines.

 create-auth |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/create-auth b/create-auth
index 34f444b..097ee73 100755
--- a/create-auth
+++ b/create-auth
@@ -65,6 +65,9 @@ def _get_group_from_ldap(group):
     return members
 
 def _get_user_data_from_ldap(filter):
+    if options.random_sleep:
+           time.sleep(random.randint(0, 600))
+
     user_data = {}
     try:
         searchattrs = ('uid', 'homeDirectory', 'authorizedKey',
@@ -448,6 +451,9 @@ if __name__ == '__main__':
     parser.add_option("--create-homedirs",
                       action="store_const", dest="homedirs", const="basic")
 
+    parser.add_option("--random-sleep",  action="store_true", 
+                      help="Sets a random sleep time before executing the script, useful to not overload 
ldap-back")
+
     parser.set_defaults(homedirs=None)
 
     (options, group_list) = parser.parse_args()


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