on release, unmanage localhost instances we create, by default now but overridable
diff --git a/core/src/main/java/org/apache/brooklyn/location/localhost/LocalhostMachineProvisioningLocation.java b/core/src/main/java/org/apache/brooklyn/location/localhost/LocalhostMachineProvisioningLocation.java
index 30cd02e..8656f5d 100644
--- a/core/src/main/java/org/apache/brooklyn/location/localhost/LocalhostMachineProvisioningLocation.java
+++ b/core/src/main/java/org/apache/brooklyn/location/localhost/LocalhostMachineProvisioningLocation.java
@@ -78,6 +78,8 @@
public static final ConfigKey<Boolean> SKIP_ON_BOX_BASE_DIR_RESOLUTION = ConfigKeys.newConfigKeyWithDefault(
BrooklynConfigKeys.SKIP_ON_BOX_BASE_DIR_RESOLUTION,
true);
+
+ public static final ConfigKey<Boolean> KEEP_MACHINES = ConfigKeys.newBooleanConfigKey("keep_machines", "Whether by default to keep localhost machine instances available for re-use or to unmanage them", false);
@SetFromFlag("count")
int initialCount;
@@ -256,6 +258,12 @@
for (int p: portsObtained)
releasePort(null, p);
+
+ // prior to 2021-04 we kept the released machines in the queue
+ // this is now governed by a flag; tests that care should set this flag!
+ if (!config().get(KEEP_MACHINES)) {
+ this.removeChild(machine);
+ }
}
public static class LocalhostMachine extends SshMachineLocation implements HasSubnetHostname {