storm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ar...@apache.org
Subject [1/3] storm git commit: STORM-2519: Modify AbstractAutoCreds to look for configKeys in both nimbus and topology configs.
Date Thu, 18 May 2017 07:45:40 GMT
Repository: storm
Updated Branches:
  refs/heads/1.x-branch 40586234b -> fa48720e5


STORM-2519: Modify AbstractAutoCreds to look for configKeys in both nimbus and topology configs.


Project: http://git-wip-us.apache.org/repos/asf/storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/97f8ba01
Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/97f8ba01
Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/97f8ba01

Branch: refs/heads/1.x-branch
Commit: 97f8ba016a47f141e2665d3413733f65fc3adfcb
Parents: 4058623
Author: Arun Mahadevan <arunm@apache.org>
Authored: Wed May 17 14:39:12 2017 +0530
Committer: Arun Mahadevan <arunm@apache.org>
Committed: Wed May 17 16:26:29 2017 +0530

----------------------------------------------------------------------
 .../apache/storm/common/AbstractAutoCreds.java  | 28 ++++++++++++--------
 1 file changed, 17 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/storm/blob/97f8ba01/external/storm-autocreds/src/main/java/org/apache/storm/common/AbstractAutoCreds.java
----------------------------------------------------------------------
diff --git a/external/storm-autocreds/src/main/java/org/apache/storm/common/AbstractAutoCreds.java
b/external/storm-autocreds/src/main/java/org/apache/storm/common/AbstractAutoCreds.java
index cc374c9..1506638 100644
--- a/external/storm-autocreds/src/main/java/org/apache/storm/common/AbstractAutoCreds.java
+++ b/external/storm-autocreds/src/main/java/org/apache/storm/common/AbstractAutoCreds.java
@@ -52,21 +52,18 @@ public abstract class AbstractAutoCreds implements IAutoCredentials, ICredential
     private static final Logger LOG = LoggerFactory.getLogger(AbstractAutoCreds.class);
     public static final String CONFIG_KEY_RESOURCES = "resources";
 
-    private List<String> configKeys = new ArrayList<>();
+    private Set<String> configKeys = new HashSet<>();
     private Map<String, Map<String, Object>> configMap = new HashMap<>();
 
     @Override
     public void prepare(Map conf) {
         doPrepare(conf);
-        String configKeyString = getConfigKeyString();
-        if (conf.containsKey(configKeyString)) {
-            configKeys.addAll((List<String>) conf.get(configKeyString));
-            for (String key : configKeys) {
-                if (conf.containsKey(key)) {
-                    Map<String, Object> config = (Map<String, Object>) conf.get(key);
-                    configMap.put(key, config);
-                    LOG.info("configKey = {}, config = {}", key, config);
-                }
+        loadConfigKeys(conf);
+        for (String key : configKeys) {
+            if (conf.containsKey(key)) {
+                Map<String, Object> config = (Map<String, Object>) conf.get(key);
+                configMap.put(key, config);
+                LOG.info("configKey = {}, config = {}", key, config);
             }
         }
     }
@@ -74,6 +71,7 @@ public abstract class AbstractAutoCreds implements IAutoCredentials, ICredential
     @Override
     public void populateCredentials(Map<String, String> credentials, Map conf) {
         try {
+            loadConfigKeys(conf);
             if (!configKeys.isEmpty()) {
                 Map<String, Object> updatedConf = updateConfigs(conf);
                 for (String configKey : configKeys) {
@@ -111,7 +109,6 @@ public abstract class AbstractAutoCreds implements IAutoCredentials, ICredential
                 DatatypeConverter.printBase64Binary("dummy place holder".getBytes()));
     }
 
-
     /**
      * {@inheritDoc}
      */
@@ -121,6 +118,7 @@ public abstract class AbstractAutoCreds implements IAutoCredentials, ICredential
         addTokensToUGI(subject);
     }
 
+
     /**
      * {@inheritDoc}
      */
@@ -245,4 +243,12 @@ public abstract class AbstractAutoCreds implements IAutoCredentials,
ICredential
 
     }
 
+    private void loadConfigKeys(Map conf) {
+        List<String> keys;
+        String configKeyString = getConfigKeyString();
+        if ((keys = (List<String>) conf.get(configKeyString)) != null) {
+            configKeys.addAll(keys);
+        }
+    }
+
 }


Mime
View raw message