Terminal cleanup

This is the xplugins side of elastic/elasticsearchelastic/elasticsearch#16443

Original commit: elastic/x-pack-elasticsearch@1ab1b4b941
This commit is contained in:
Ryan Ernst 2016-02-04 02:06:37 -08:00
parent 4fa690dbb5
commit ab95b33df5
6 changed files with 9 additions and 9 deletions

View File

@ -107,7 +107,7 @@ public class LicenseGeneratorTool extends CliTool {
builder.endObject();
builder.endObject();
builder.flush();
terminal.print(builder.string());
terminal.println(builder.string());
return ExitStatus.OK;
}

View File

@ -100,7 +100,7 @@ public class LicenseVerificationTool extends CliTool {
builder.endObject();
builder.endObject();
builder.flush();
terminal.print(builder.string());
terminal.println(builder.string());
return ExitStatus.OK;
}
}

View File

@ -463,7 +463,7 @@ public class ESUsersTool extends CliTool {
if (!unknownRoles.isEmpty()) {
// at least one role is marked... so printing the legend
Path rolesFile = FileRolesStore.resolveFile(esusersSettings, env).toAbsolutePath();
terminal.println();
terminal.println("");
terminal.println(String.format(Locale.ROOT, " [*] An unknown role. Please check [%s] to see available roles", rolesFile.toAbsolutePath()));
}
} else {
@ -496,7 +496,7 @@ public class ESUsersTool extends CliTool {
if (unknownRolesFound) {
// at least one role is marked... so printing the legend
Path rolesFile = FileRolesStore.resolveFile(esusersSettings, env).toAbsolutePath();
terminal.println();
terminal.println("");
terminal.println(String.format(Locale.ROOT, " [*] An unknown role. Please check [%s] to see available roles", rolesFile.toAbsolutePath()));
}
}

View File

@ -101,7 +101,7 @@ public class SystemKeyTool extends CliTool {
terminal.println(String.format(Locale.ROOT, "Storing generated key in [%s]...", path.toAbsolutePath()));
Files.write(path, key, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING);
} catch (IOException ioe) {
terminal.printError(String.format(Locale.ROOT, "Cannot generate and save system key file [%s]", path.toAbsolutePath()));
terminal.println(Terminal.Verbosity.SILENT, String.format(Locale.ROOT, "ERROR: Cannot generate and save system key file [%s]", path.toAbsolutePath()));
return ExitStatus.IO_ERROR;
}
@ -110,7 +110,7 @@ public class SystemKeyTool extends CliTool {
try {
Files.setPosixFilePermissions(path, PERMISSION_OWNER_READ_WRITE);
} catch (IOException ioe) {
terminal.printError(String.format(Locale.ROOT, "Cannot set owner read/write permissions to generated system key file [%s]", path.toAbsolutePath()));
terminal.println(Terminal.Verbosity.SILENT, String.format(Locale.ROOT, "ERROR: Cannot set owner read/write permissions to generated system key file [%s]", path.toAbsolutePath()));
return ExitStatus.IO_ERROR;
}
terminal.println("Ensure the generated key can be read by the user that Elasticsearch runs as, permissions are set to owner read/write only");

View File

@ -97,7 +97,7 @@ public class ESUsersToolTests extends CliToolTestCase {
public void testUseraddParseNoPassword() throws Exception {
ESUsersTool tool = new ESUsersTool(new MockTerminal() {
@Override
public char[] readSecret(String text, Object... args) {
public char[] readSecret(String text) {
return "changeme".toCharArray();
}
});
@ -391,7 +391,7 @@ public class ESUsersToolTests extends CliToolTestCase {
final AtomicReference<Boolean> secretRequested = new AtomicReference<>(false);
Terminal terminal = new MockTerminal() {
@Override
public char[] readSecret(String text, Object... args) {
public char[] readSecret(String text) {
secretRequested.set(true);
return "changeme".toCharArray();
}

View File

@ -101,7 +101,7 @@ public class CronEvalTool extends CliTool {
long prevTime = time;
time = cron.getNextValidTimeAfter(time);
if (time < 0) {
terminal.printError((i + 1) + ".\t Could not compute future times since [" + formatter.print(prevTime) + "] " +
terminal.println(Terminal.Verbosity.SILENT, "ERROR: " + (i + 1) + ".\t Could not compute future times since [" + formatter.print(prevTime) + "] " +
"(perhaps the cron expression only points to times in the past?)");
return ExitStatus.OK;
}