Github user revans2 commented on a diff in the pull request: https://github.com/apache/storm/pull/2747#discussion_r199566898 --- Diff: storm-core/src/jvm/org/apache/storm/command/UploadCredentials.java --- @@ -52,7 +61,37 @@ public static void main(String[] args) throws Exception { credentialsMap.put(rawCredentials.get(i), rawCredentials.get(i + 1)); } } - StormSubmitter.pushCredentials(topologyName, new HashMap<>(), credentialsMap); + + Map<String, Object> topologyConf = new HashMap<>(); + //Try to get the topology conf from nimbus, so we can reuse it. + try (NimbusClient nc = NimbusClient.getConfiguredClient(new HashMap<>())) { + Nimbus.Iface client = nc.getClient(); + ClusterSummary summary = client.getClusterInfo(); + for (TopologySummary topo : summary.get_topologies()) { + if (topologyName.equals(topo.get_name())) { + //We found the topology, lets get the conf + String topologyId = topo.get_id(); + topologyConf = (Map<String, Object>) JSONValue.parse(client.getTopologyConf(topologyId)); + LOG.info("Using topology conf from {} as basis for getting new creds", topologyId); + + Map<String, Object> commandLine = Utils.readCommandLineOpts(); + List<String> clCreds = (List<String>)commandLine.get(Config.TOPOLOGY_AUTO_CREDENTIALS); + List<String> topoCreds = (List<String>)topologyConf.get(Config.TOPOLOGY_AUTO_CREDENTIALS); + + if (clCreds != null) { + Set<String> extra = new HashSet<>(clCreds); + if (topoCreds != null) { + extra.removeAll(topoCreds); + } + if (!extra.isEmpty()) { --- End diff -- In the case where we are missing credentials the old ones will be preserved, but I think you are right I'll add it in.
---