[TEST] delete and recreate config dir if already existing

Original commit: elastic/x-pack-elasticsearch@90af42b95d
This commit is contained in:
javanna 2014-11-27 12:34:34 +01:00 committed by Luca Cavanna
parent a995ed9cca
commit 8c1fcb52ea
1 changed files with 5 additions and 0 deletions

View File

@ -151,6 +151,11 @@ public class ShieldSettingsSource extends ClusterDiscoveryConfiguration.UnicastZ
private static File createFolder(File parent, String name) {
File createdFolder = new File(parent, name);
if (createdFolder.exists()) {
if (!createdFolder.delete()) {
throw new RuntimeException("Could not delete existing temporary folder: " + createdFolder.getAbsolutePath());
}
}
if (!createdFolder.mkdir()) {
throw new RuntimeException("Could not create temporary folder: " + createdFolder.getAbsolutePath());
}