This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git
commit 13c64f39c50b05e08290c2c8efd139e8f4e750b2 Author: Alex Heneveld <[email protected]> AuthorDate: Wed Mar 29 16:28:18 2023 +0100 clean up provisioned location on software process entities prevent dangling reference to removed location --- .../software/base/lifecycle/MachineLifecycleEffectorTasks.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/software/base/src/main/java/org/apache/brooklyn/entity/software/base/lifecycle/MachineLifecycleEffectorTasks.java b/software/base/src/main/java/org/apache/brooklyn/entity/software/base/lifecycle/MachineLifecycleEffectorTasks.java index b63f6e08a0..fb813be22a 100644 --- a/software/base/src/main/java/org/apache/brooklyn/entity/software/base/lifecycle/MachineLifecycleEffectorTasks.java +++ b/software/base/src/main/java/org/apache/brooklyn/entity/software/base/lifecycle/MachineLifecycleEffectorTasks.java @@ -1173,6 +1173,13 @@ public abstract class MachineLifecycleEffectorTasks { } protected void clearEntityLocationAttributes(Location machine, boolean removeLocation) { if (removeLocation) entity().removeLocations(ImmutableList.of(machine)); + + MachineProvisioningLocation oldProvisioningLocation = entity().sensors().get(SoftwareProcess.PROVISIONING_LOCATION); + if (oldProvisioningLocation!=null && !Locations.isManaged(oldProvisioningLocation)) { + // clear it if it has been unmanaged, to prevent rebind dangles + entity().sensors().set(SoftwareProcess.PROVISIONING_LOCATION, null); + } + entity().sensors().set(Attributes.HOSTNAME, null); entity().sensors().set(Attributes.ADDRESS, null); entity().sensors().set(Attributes.SUBNET_HOSTNAME, null);
