You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ranger.apache.org by sn...@apache.org on 2014/10/22 21:30:47 UTC

git commit: ARGUS-128:Fixed Topology lookup during storm policy creation

Repository: incubator-argus
Updated Branches:
  refs/heads/master a8f75bd61 -> dd87ada1b


ARGUS-128:Fixed Topology lookup during storm policy creation

Signed-off-by: sneethiraj <sn...@apache.org>


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

Branch: refs/heads/master
Commit: dd87ada1b507109272cb5110473852b1fa4243ce
Parents: a8f75bd
Author: vperiasamy <vp...@hortonworks.com>
Authored: Wed Oct 22 14:18:50 2014 -0400
Committer: sneethiraj <sn...@apache.org>
Committed: Wed Oct 22 15:26:46 2014 -0400

----------------------------------------------------------------------
 .../com/xasecure/storm/client/StormClient.java  | 27 ++++++++++++--------
 .../main/java/com/xasecure/biz/AssetMgr.java    |  3 +++
 2 files changed, 20 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/dd87ada1/lookup-client/src/main/java/com/xasecure/storm/client/StormClient.java
----------------------------------------------------------------------
diff --git a/lookup-client/src/main/java/com/xasecure/storm/client/StormClient.java b/lookup-client/src/main/java/com/xasecure/storm/client/StormClient.java
index 95e49a9..f1c7449 100644
--- a/lookup-client/src/main/java/com/xasecure/storm/client/StormClient.java
+++ b/lookup-client/src/main/java/com/xasecure/storm/client/StormClient.java
@@ -101,10 +101,10 @@ public class StormClient {
 					response = webResource.accept(EXPECTED_MIME_TYPE)
 						    .get(ClientResponse.class);
 					
-					LOG.info("getTopologyList():calling " + url);
+					LOG.debug("getTopologyList():calling " + url);
 					
 					if (response != null) {
-						LOG.info("getTopologyList():response.getStatus()= " + response.getStatus());	
+						LOG.debug("getTopologyList():response.getStatus()= " + response.getStatus());	
 						if (response.getStatus() == 200) {
 							String jsonString = response.getEntity(String.class);
 							Gson gson = new GsonBuilder().setPrettyPrinting().create();
@@ -113,8 +113,11 @@ public class StormClient {
 								if (topologyListResponse.getTopologyList() != null) {
 									for(Topology topology : topologyListResponse.getTopologyList()) {
 										String toplogyName = topology.getName() ;
+										LOG.debug("getTopologyList():Found topology " + toplogyName);
+										LOG.debug("getTopologyList():topology Name=[" + topology.getName() + "], topologyNameMatching=[" + topologyNameMatching + "]");
 										if (toplogyName != null) {
-											if (topologyNameMatching == null || topologyNameMatching.isEmpty() || FilenameUtils.wildcardMatch(topology.getName(), topologyNameMatching)) {
+											if (topologyNameMatching == null || topologyNameMatching.isEmpty() || FilenameUtils.wildcardMatch(topology.getName(), topologyNameMatching + "*")) {
+												LOG.debug("getTopologyList():Adding topology " + toplogyName);
 												lret.add(toplogyName) ;
 											}
 										}
@@ -122,9 +125,10 @@ public class StormClient {
 								}
 							}
 						} else{
-							LOG.info("getTopologyList():response.getStatus()= " + response.getStatus() + " for URL " + url);	
+							LOG.info("getTopologyList():response.getStatus()= " + response.getStatus() + " for URL " + url + ", so returning null list");	
 							String jsonString = response.getEntity(String.class);
 							LOG.info(jsonString);
+							lret = null;
 						}
 					} else {
 						String msgDesc = "Unable to get a valid response for "
@@ -228,7 +232,7 @@ public class StormClient {
 					throw hdpException;
 				}
                 
-				LOG.info("getAppConfigurationEntry():" + kerberosOptions.get("principal"));
+				LOG.debug("getAppConfigurationEntry():" + kerberosOptions.get("principal"));
 				
                 return new AppConfigurationEntry[] { KERBEROS_PWD_SAVER, KEYTAB_KERBEROS_LOGIN };
 			}
@@ -242,15 +246,15 @@ public class StormClient {
 
 		try {
 		    subject = new Subject();
-			LOG.info("executeUnderKerberos():user=" + userName + ",pass=");
-			LOG.info("executeUnderKerberos():Creating config..");
+			LOG.debug("executeUnderKerberos():user=" + userName + ",pass=");
+			LOG.debug("executeUnderKerberos():Creating config..");
 			MySecureClientLoginConfiguration loginConf = new MySecureClientLoginConfiguration(
 					userName, password);
-			LOG.info("executeUnderKerberos():Creating Context..");
+			LOG.debug("executeUnderKerberos():Creating Context..");
 			loginContext = new LoginContext("hadoop-keytab-kerberos", subject,
 					null, loginConf);
 			
-			LOG.info("executeUnderKerberos():Logging in..");
+			LOG.debug("executeUnderKerberos():Logging in..");
 			loginContext.login();
 
 			Subject loginSubj = loginContext.getSubject();
@@ -305,7 +309,7 @@ public class StormClient {
 				connectionProperties);
 		strList = getStormResources(stormClient, "");
 
-		if (strList != null && (strList.size() != 0)) {
+		if (strList != null) {
 			connectivityStatus = true;
 		}
 
@@ -370,6 +374,9 @@ public class StormClient {
 						: topologyName.trim();
 				resultList = stormClient
 						.getTopologyList(finalTopologyNameMatching);
+				if (resultList != null) {
+					LOG.debug("Returning list of " + resultList.size() + " topologies");
+				}
 			}
 		} catch (HadoopException he) {
 			throw he;

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/dd87ada1/security-admin/src/main/java/com/xasecure/biz/AssetMgr.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/biz/AssetMgr.java b/security-admin/src/main/java/com/xasecure/biz/AssetMgr.java
index aa02e07..a96dab9 100644
--- a/security-admin/src/main/java/com/xasecure/biz/AssetMgr.java
+++ b/security-admin/src/main/java/com/xasecure/biz/AssetMgr.java
@@ -3183,6 +3183,9 @@ public class AssetMgr extends AssetMgrBase {
         VXStringList ret = null ;
         XXAsset asset = xADaoManager.getXXAsset().findByAssetName(dataSourceName);
         String config = asset.getConfig() ;
+        if(!stringUtil.isEmpty(config)){
+			config=xAssetService.getConfigWithDecryptedPassword(config);
+		}
         if (config == null || config.trim().isEmpty()) {
                 logger.error("Connection Config is empty");