[ https://issues.apache.org/jira/browse/METRON-1188?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16167994#comment-16167994 ]
ASF GitHub Bot commented on METRON-1188: ---------------------------------------- Github user justinleet commented on a diff in the pull request: https://github.com/apache/metron/pull/760#discussion_r139172028 --- Diff: metron-platform/metron-common/src/main/java/org/apache/metron/common/configuration/ConfigurationsUtils.java --- @@ -346,19 +434,56 @@ public static void setupStellarStatically(CuratorFramework client, Optional<Stri } public static Map<String, byte[]> readSensorConfigsFromFile(String rootPath, ConfigurationType configType) throws IOException { + return readSensorConfigsFromFile(rootPath, configType, Optional.empty()); + } + + public static Map<String, byte[]> readSensorConfigsFromFile(String rootPath, + ConfigurationType configType, Optional<String> configName) throws IOException { Map<String, byte[]> sensorConfigs = new HashMap<>(); File configPath = new File(rootPath, configType.getDirectory()); - if (configPath.exists()) { + if (configPath.exists() && configPath.isDirectory()) { File[] children = configPath.listFiles(); - if (children != null) { + if (!configName.isPresent()) { for (File file : children) { - sensorConfigs.put(FilenameUtils.removeExtension(file.getName()), Files.readAllBytes(file.toPath())); + sensorConfigs.put(FilenameUtils.removeExtension(file.getName()), + Files.readAllBytes(file.toPath())); + } + } else { + for (File file : children) { + if (FilenameUtils.removeExtension(file.getName()).equals(configName.get())) { + sensorConfigs.put(FilenameUtils.removeExtension(file.getName()), + Files.readAllBytes(file.toPath())); + } + } + if (sensorConfigs.isEmpty()) { + throw new RuntimeException("Unable to find configuration for " + configName.get()); } } } return sensorConfigs; } + public static void applyConfigPatchToZookeeper(ConfigurationType configurationType, byte[] patchData, String zookeeperUrl) throws Exception { --- End diff -- Javadocs again. > Ambari global configuration management broken > --------------------------------------------- > > Key: METRON-1188 > URL: https://issues.apache.org/jira/browse/METRON-1188 > Project: Metron > Issue Type: Bug > Reporter: Michael Miklavcic > Assignee: Michael Miklavcic > > Ambari currently ignores values from the UI when managing the global.json > file. These values are hard-coded in the status_params.py file as part of the > mpack. In addition, Ambari restarts are clobbering configuration changes in > Zookeeper. -- This message was sent by Atlassian JIRA (v6.4.14#64029)