filter out deleted nodes as to prevent them from being saved later (#391)

In `Scaleset.cleanup_nodes`, nodes that are no longer part of the scaleset should get deleted.  Without filtering the list, the nodes could get re-saved to the Node table later on.
This commit is contained in:
bmc-msft 2021-01-04 15:28:57 -05:00 committed by GitHub
parent 4c2679d61e
commit 29c7cfbd5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -790,6 +790,7 @@ class Scaleset(BASE_SCALESET, ORMMixin):
"no longer in scaleset: %s:%s", self.scaleset_id, node.machine_id
)
node.delete()
nodes = [x for x in nodes if x.machine_id in azure_nodes]
nodes_to_reset = [x for x in nodes if x.state in NodeState.ready_for_reset()]