ranger-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mad...@apache.org
Subject incubator-argus git commit: ARGUS-186: Updated usersync service for better handling of failures in sending users/groups to policy admin.
Date Tue, 18 Nov 2014 23:08:50 GMT
Repository: incubator-argus
Updated Branches:
  refs/heads/master 526345bdb -> e902c5c9c


ARGUS-186: Updated usersync service for better handling of failures in
sending users/groups to policy admin.

Project: http://git-wip-us.apache.org/repos/asf/incubator-argus/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-argus/commit/e902c5c9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-argus/tree/e902c5c9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-argus/diff/e902c5c9

Branch: refs/heads/master
Commit: e902c5c9c14fbe4c6a9eb6444c00b6fc90a4be9b
Parents: 526345b
Author: Madhan Neethiraj <madhan@apache.org>
Authored: Tue Nov 18 13:54:18 2014 -0800
Committer: Madhan Neethiraj <madhan@apache.org>
Committed: Tue Nov 18 13:54:18 2014 -0800

----------------------------------------------------------------------
 .../com/xasecure/usergroupsync/UserGroupSync.java    | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/e902c5c9/ugsync/src/main/java/com/xasecure/usergroupsync/UserGroupSync.java
----------------------------------------------------------------------
diff --git a/ugsync/src/main/java/com/xasecure/usergroupsync/UserGroupSync.java b/ugsync/src/main/java/com/xasecure/usergroupsync/UserGroupSync.java
index 6456a96..81643da 100644
--- a/ugsync/src/main/java/com/xasecure/usergroupsync/UserGroupSync.java
+++ b/ugsync/src/main/java/com/xasecure/usergroupsync/UserGroupSync.java
@@ -19,13 +19,10 @@
 
  package com.xasecure.usergroupsync;
 
-import java.util.List;
 
 import org.apache.log4j.Logger;
 
 import com.xasecure.unixusersync.config.UserGroupSyncConfig;
-import com.xasecure.unixusersync.process.PolicyMgrUserGroupBuilder;
-import com.xasecure.unixusersync.process.UnixUserGroupBuilder;
 
 public class UserGroupSync implements Runnable {
 	
@@ -77,6 +74,8 @@ public class UserGroupSync implements Runnable {
 				}
 			}
 
+			boolean forceSync = false;
+
 			while (! shutdownFlag ) {
 				try {
 					Thread.sleep(sleepTimeBetweenCycleInMillis);
@@ -85,12 +84,14 @@ public class UserGroupSync implements Runnable {
 				}
 
 				try {
-					syncUserGroup() ;
+					syncUserGroup(forceSync) ;
+
+					forceSync = false;
 				}
 				catch(Throwable t) {
 					LOG.error("Failed to synchronize UserGroup information. Error details: ", t) ;
 
-					System.exit(1);
+					forceSync = true;  // force sync to the destination in the next attempt
 				}
 			}
 		
@@ -103,11 +104,11 @@ public class UserGroupSync implements Runnable {
 		}
 	}
 	
-	private void syncUserGroup() throws Throwable {
+	private void syncUserGroup(boolean forceSync) throws Throwable {
 		UserGroupSyncConfig config = UserGroupSyncConfig.getInstance() ;
 
 		if (config.isUserSyncEnabled()) {
-			if (ugSource.isChanged()) {
+			if (forceSync || ugSource.isChanged()) {
 				LOG.info("Begin: update user/group from source==>sink");
 				ugSource.updateSink(ugSink);
 				LOG.info("End: update user/group from source==>sink");


Mime
View raw message