Github user justinleet commented on a diff in the pull request:
https://github.com/apache/metron/pull/760#discussion_r139547949
--- Diff:
metron-platform/metron-common/src/main/java/org/apache/metron/common/cli/ConfigurationManager.java
---
@@ -130,29 +201,39 @@ public void pull(CuratorFramework client, String
outFileStr, final boolean force
public void visit(ConfigurationType configurationType, String name,
String data) {
File out = getFile(outputDir, configurationType, name);
if (!out.exists() || force) {
- if(!out.exists()) {
+ if (!out.exists()) {
out.getParentFile().mkdirs();
}
try {
Files.write(data, out, Charset.defaultCharset());
} catch (IOException e) {
throw new RuntimeException("Sorry, something bad happened
writing the config to " + out.getAbsolutePath() + ": " + e.getMessage(), e);
}
- }
- else if(out.exists() && !force) {
+ } else if (out.exists() && !force) {
throw new IllegalStateException("Unable to overwrite existing
file (" + out.getAbsolutePath() + ") without the force flag (-f or --force)
being set.");
}
}
});
}
public void push(String inputDirStr, CuratorFramework client) throws
Exception {
- final File inputDir = new File(inputDirStr);
+ final File inputDir = new File(inputDirStr);
--- End diff --
Yeah, I think we could definitely handle the scripts better in general.
I'm not opposed to just leaving this as-is, but it seems like a decent /
small opportunity to make it more usable. Up to you.
---