From 6050e88371c4110d3d85d65d5fbb0e70a844a128 Mon Sep 17 00:00:00 2001 From: Dan Scott Date: Wed, 14 Sep 2011 16:47:38 -0400 Subject: [PATCH] Don't update the barcode if user was not created Check the return value and bail if the user creation was a failure. For large updates, one can use --create and --push to update barcodes for users who already exist. Signed-off-by: Dan Scott --- tools/patron-load/ldap_osrf_sync | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/patron-load/ldap_osrf_sync b/tools/patron-load/ldap_osrf_sync index a79b40536c..2bab8b6bd2 100755 --- a/tools/patron-load/ldap_osrf_sync +++ b/tools/patron-load/ldap_osrf_sync @@ -305,7 +305,8 @@ def find_ldap_users(con, ldap_filter, attributes, auth): dump_data(result_data) if ARGS.create_users: res = create_evergreen_user(auth, user) - update_ldap_barcode(con, user) + if res: + update_ldap_barcode(con, user) if ARGS.push_barcode: try: uid = find_evergreen_user(auth, user) @@ -457,6 +458,7 @@ def create_evergreen_user(auth, user): create_stat_cats(newau, user) print("Created: %s with barcode %s" % (newau.usrname(), user.barcode)) + return user.barcode def update_ldap_barcode(con, user): """ -- 2.11.0