fix build with latest core changes
`Terminal.println(..)` doesn't support varargs arguments anymore Original commit: elastic/x-pack-elasticsearch@533a4f7919
This commit is contained in:
parent
e039ef412f
commit
ffab6da42d
|
@ -160,7 +160,7 @@ public class ESUsersTool extends CliTool {
|
|||
Path file = FileUserPasswdStore.resolveFile(esusersSettings, env);
|
||||
Map<String, char[]> users = new HashMap<>(FileUserPasswdStore.parseFile(file, null));
|
||||
if (users.containsKey(username)) {
|
||||
terminal.println("User [%s] already exists", username);
|
||||
terminal.println(String.format("User [%s] already exists", username));
|
||||
return ExitStatus.CODE_ERROR;
|
||||
}
|
||||
Hasher hasher = Hasher.BCRYPT;
|
||||
|
@ -228,7 +228,7 @@ public class ESUsersTool extends CliTool {
|
|||
Path file = FileUserPasswdStore.resolveFile(esusersSettings, env);
|
||||
Map<String, char[]> users = new HashMap<>(FileUserPasswdStore.parseFile(file, null));
|
||||
if (!users.containsKey(username)) {
|
||||
terminal.println("User [%s] doesn't exist", username);
|
||||
terminal.println(String.format("User [%s] doesn't exist", username));
|
||||
return ExitStatus.NO_USER;
|
||||
}
|
||||
|
||||
|
@ -308,7 +308,7 @@ public class ESUsersTool extends CliTool {
|
|||
Path file = FileUserPasswdStore.resolveFile(esusersSettings, env);
|
||||
Map<String, char[]> users = new HashMap<>(FileUserPasswdStore.parseFile(file, null));
|
||||
if (!users.containsKey(username)) {
|
||||
terminal.println("User [%s] doesn't exist", username);
|
||||
terminal.println(String.format("User [%s] doesn't exist", username));
|
||||
return ExitStatus.NO_USER;
|
||||
}
|
||||
Hasher hasher = Hasher.BCRYPT;
|
||||
|
@ -378,7 +378,7 @@ public class ESUsersTool extends CliTool {
|
|||
String[] allRoles = ArrayUtils.concat(addRoles, removeRoles, String.class);
|
||||
for (String role : allRoles) {
|
||||
if (!ROLE_PATTERN.matcher(role).matches()) {
|
||||
terminal.println("Role name [%s] is not valid. Please use lowercase and numbers only", role);
|
||||
terminal.println(String.format("Role name [%s] is not valid. Please use lowercase and numbers only", role));
|
||||
return ExitStatus.DATA_ERROR;
|
||||
}
|
||||
}
|
||||
|
@ -388,7 +388,7 @@ public class ESUsersTool extends CliTool {
|
|||
Path path = FileUserPasswdStore.resolveFile(esusersSettings, env);
|
||||
Map<String, char[]> usersMap = FileUserPasswdStore.parseFile(path, null);
|
||||
if (!usersMap.containsKey(username)) {
|
||||
terminal.println("User [%s] doesn't exist", username);
|
||||
terminal.println(String.format("User [%s] doesn't exist", username));
|
||||
return ExitStatus.NO_USER;
|
||||
}
|
||||
|
||||
|
@ -451,7 +451,7 @@ public class ESUsersTool extends CliTool {
|
|||
|
||||
if (username != null) {
|
||||
if (!users.contains(username)) {
|
||||
terminal.println("User [%s] doesn't exist", username);
|
||||
terminal.println(String.format("User [%s] doesn't exist", username));
|
||||
return ExitStatus.NO_USER;
|
||||
}
|
||||
|
||||
|
@ -459,15 +459,15 @@ public class ESUsersTool extends CliTool {
|
|||
String[] roles = userRoles.get(username);
|
||||
Set<String> unknownRoles = Sets.difference(Sets.newHashSet(roles), knownRoles);
|
||||
String[] markedRoles = markUnknownRoles(roles, unknownRoles);
|
||||
terminal.println("%-15s: %s", username, Arrays.stream(markedRoles).map(s -> s == null ? "-" : s).collect(Collectors.joining(",")));
|
||||
terminal.println(String.format("%-15s: %s", username, Arrays.stream(markedRoles).map(s -> s == null ? "-" : s).collect(Collectors.joining(","))));
|
||||
if (!unknownRoles.isEmpty()) {
|
||||
// at least one role is marked... so printing the legend
|
||||
Path rolesFile = FileRolesStore.resolveFile(esusersSettings, env).toAbsolutePath();
|
||||
terminal.println();
|
||||
terminal.println(" [*] An unknown role. Please check [%s] to see available roles", rolesFile.toAbsolutePath());
|
||||
terminal.println(String.format(" [*] An unknown role. Please check [%s] to see available roles", rolesFile.toAbsolutePath()));
|
||||
}
|
||||
} else {
|
||||
terminal.println("%-15s: -", username);
|
||||
terminal.println(String.format("%-15s: -", username));
|
||||
}
|
||||
} else {
|
||||
boolean unknownRolesFound = false;
|
||||
|
@ -476,7 +476,7 @@ public class ESUsersTool extends CliTool {
|
|||
String[] roles = entry.getValue();
|
||||
Set<String> unknownRoles = Sets.difference(Sets.newHashSet(roles), knownRoles);
|
||||
String[] markedRoles = markUnknownRoles(roles, unknownRoles);
|
||||
terminal.println("%-15s: %s", entry.getKey(), String.join(",", markedRoles));
|
||||
terminal.println(String.format("%-15s: %s", entry.getKey(), String.join(",", markedRoles)));
|
||||
unknownRolesFound = unknownRolesFound || !unknownRoles.isEmpty();
|
||||
usersExist = true;
|
||||
}
|
||||
|
@ -484,7 +484,7 @@ public class ESUsersTool extends CliTool {
|
|||
Set<String> usersWithoutRoles = Sets.newHashSet(users);
|
||||
usersWithoutRoles.removeAll(userRoles.keySet());
|
||||
for (String user : usersWithoutRoles) {
|
||||
terminal.println("%-15s: -", user);
|
||||
terminal.println(String.format("%-15s: -", user));
|
||||
usersExist = true;
|
||||
}
|
||||
|
||||
|
@ -497,7 +497,7 @@ public class ESUsersTool extends CliTool {
|
|||
// at least one role is marked... so printing the legend
|
||||
Path rolesFile = FileRolesStore.resolveFile(esusersSettings, env).toAbsolutePath();
|
||||
terminal.println();
|
||||
terminal.println(" [*] An unknown role. Please check [%s] to see available roles", rolesFile.toAbsolutePath());
|
||||
terminal.println(String.format(" [*] An unknown role. Please check [%s] to see available roles", rolesFile.toAbsolutePath()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -511,7 +511,7 @@ public class ESUsersTool extends CliTool {
|
|||
return FileRolesStore.parseFileForRoleNames(rolesFile, null);
|
||||
} catch (Throwable t) {
|
||||
// if for some reason, parsing fails (malformatted perhaps) we just warn
|
||||
terminal.println("Warning: Could not parse [%s] for roles verification. Please revise and fix it. Nonetheless, the user will still be associated with all specified roles", rolesFile.toAbsolutePath());
|
||||
terminal.println(String.format("Warning: Could not parse [%s] for roles verification. Please revise and fix it. Nonetheless, the user will still be associated with all specified roles", rolesFile.toAbsolutePath()));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -536,9 +536,9 @@ public class ESUsersTool extends CliTool {
|
|||
Set<String> unknownRoles = Sets.difference(Sets.newHashSet(roles), knownRoles);
|
||||
if (!unknownRoles.isEmpty()) {
|
||||
Path rolesFile = FileRolesStore.resolveFile(settings, env);
|
||||
terminal.println("Warning: The following roles [%s] are unknown. Make sure to add them to the [%s] file. " +
|
||||
terminal.println(String.format("Warning: The following roles [%s] are unknown. Make sure to add them to the [%s] file. " +
|
||||
"Nonetheless the user will still be associated with all specified roles",
|
||||
Strings.collectionToCommaDelimitedString(unknownRoles), rolesFile.toAbsolutePath());
|
||||
Strings.collectionToCommaDelimitedString(unknownRoles), rolesFile.toAbsolutePath()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -97,10 +97,10 @@ public class SystemKeyTool extends CliTool {
|
|||
}
|
||||
terminal.println(Terminal.Verbosity.VERBOSE, "generating...");
|
||||
byte[] key = InternalCryptoService.generateKey();
|
||||
terminal.println("Storing generated key in [%s]...", path.toAbsolutePath());
|
||||
terminal.println(String.format("Storing generated key in [%s]...", path.toAbsolutePath()));
|
||||
Files.write(path, key, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING);
|
||||
} catch (IOException ioe) {
|
||||
terminal.printError("Cannot generate and save system key file [%s]", path.toAbsolutePath());
|
||||
terminal.printError(String.format("Cannot generate and save system key file [%s]", path.toAbsolutePath()));
|
||||
return ExitStatus.IO_ERROR;
|
||||
}
|
||||
|
||||
|
@ -109,7 +109,7 @@ public class SystemKeyTool extends CliTool {
|
|||
try {
|
||||
Files.setPosixFilePermissions(path, PERMISSION_OWNER_READ_WRITE);
|
||||
} catch (IOException ioe) {
|
||||
terminal.printError("Cannot set owner read/write permissions to generated system key file [%s]", path.toAbsolutePath());
|
||||
terminal.printError(String.format("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");
|
||||
|
|
|
@ -121,7 +121,7 @@ public class ManualPublicSmtpServersTester {
|
|||
|
||||
EmailService.EmailSent sent = service.send(email, null, profile);
|
||||
|
||||
terminal.println("email sent via account [%s]", sent.account());
|
||||
terminal.println(String.format("email sent via account [%s]", sent.account()));
|
||||
} finally {
|
||||
service.stop();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue