aboutsummaryrefslogtreecommitdiffstats
path: root/node-admin/src/main/java
diff options
context:
space:
mode:
authorHåkon Hallingstad <hakon@oath.com>2018-01-31 00:44:12 +0100
committerHåkon Hallingstad <hakon@oath.com>2018-01-31 00:44:12 +0100
commit8cb0db31b98e02e0d3f89b36b1f68b112ffba8f7 (patch)
treed0676a404c90c5abaf742bd0cf09c9b57cae0bd2 /node-admin/src/main/java
parent7923c31a91388782f6f6b169358a6cecdf63d2fc (diff)
Fix regex for no-op yum commands
Diffstat (limited to 'node-admin/src/main/java')
-rw-r--r--node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/yum/Yum.java14
1 files changed, 6 insertions, 8 deletions
diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/yum/Yum.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/yum/Yum.java
index 35729b5a428..dbb4c909a4b 100644
--- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/yum/Yum.java
+++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/yum/Yum.java
@@ -16,12 +16,10 @@ import java.util.regex.Pattern;
* @author hakonhall
*/
public class Yum {
- private static final Pattern INSTALL_NOOP_PATTERN =
- Pattern.compile("\nNothing to do\n$");
- private static final Pattern UPGRADE_NOOP_PATTERN =
- Pattern.compile("\nNo packages marked for update\n$");
- private static final Pattern REMOVE_NOOP_PATTERN =
- Pattern.compile("\nNo Packages marked for removal\n$");
+ // Note: "(?dm)" makes newline be \n (only), and enables multiline mode where ^$ match lines with find()
+ private static final Pattern INSTALL_NOOP_PATTERN = Pattern.compile("(?dm)^Nothing to do$");
+ private static final Pattern UPGRADE_NOOP_PATTERN = Pattern.compile("(?dm)^No packages marked for update$");
+ private static final Pattern REMOVE_NOOP_PATTERN = Pattern.compile("(?dm)^No Packages marked for removal$");
private final TaskContext taskContext;
private final Supplier<Command> commandSupplier;
@@ -58,7 +56,7 @@ public class Yum {
}
public static class GenericYumCommand {
- private static Logger logger = Logger.getLogger(Yum.class.getName());
+ private static Logger logger = Logger.getLogger(GenericYumCommand.class.getName());
private final TaskContext taskContext;
private final Supplier<Command> commandSupplier;
@@ -102,7 +100,7 @@ public class Yum {
// There's no way to figure out whether a yum command would have been a no-op.
// Therefore, run the command and parse the output to decide.
String output = childProcess.getUtf8Output();
- if (commandOutputNoopPattern.matcher(output).matches()) {
+ if (commandOutputNoopPattern.matcher(output).find()) {
return false;
} else {
childProcess.logAsModifyingSystemAfterAll(logger);