diff --git a/src/api-service/__app__/onefuzzlib/azure/vmss.py b/src/api-service/__app__/onefuzzlib/azure/vmss.py index bb8ab22a5..54e0f17a2 100644 --- a/src/api-service/__app__/onefuzzlib/azure/vmss.py +++ b/src/api-service/__app__/onefuzzlib/azure/vmss.py @@ -184,7 +184,23 @@ def update_scale_in_protection( compute_client.virtual_machine_scale_set_vms.begin_update( resource_group, name, instance_id, instance_vm ) - except (ResourceNotFoundError, CloudError): + except (ResourceNotFoundError, CloudError, HttpResponseError) as err: + if isinstance(err, HttpResponseError): + err_str = str(err) + instance_not_found = ( + " is not an active Virtual Machine Scale Set VM instanceId." + ) + if ( + instance_not_found in err_str + and instance_vm.protection_policy.protect_from_scale_in is False + and protect_from_scale_in + == instance_vm.protection_policy.protect_from_scale_in + ): + logging.info( + "Tried to remove scale in protection on node %s but the instance no longer exists" # noqa: E501 + % instance_id + ) + return None return Error( code=ErrorCode.UNABLE_TO_UPDATE, errors=["unable to set protection policy on: %s:%s" % (vm_id, instance_id)], diff --git a/src/api-service/__app__/onefuzzlib/workers/nodes.py b/src/api-service/__app__/onefuzzlib/workers/nodes.py index 35bbd5c33..ed8e1a5a0 100644 --- a/src/api-service/__app__/onefuzzlib/workers/nodes.py +++ b/src/api-service/__app__/onefuzzlib/workers/nodes.py @@ -390,7 +390,6 @@ class Node(BASE_NODE, ORMMixin): # if we're going to reimage, make sure the node doesn't pick up new work # too. self.send_stop_if_free() - self.release_scale_in_protection() self.save()