Replace point-to-point communication between deviceauth and inventory with workflows
Description
When we released Mender 2.4, we were in a hurry as it was a last-minute discovery and decided to have direct communication between deviceauth and inventory to update the device identity, instead of using workflows, which decouples the two microservices and provide retries.
from my findings it looks like it's working (or not working) as follows: make_accepted_device method from testutils creates pending device and then accepts it; deviceauth is starting a couple of workflows; the interesting ones are udpate_device_status in our case two of them are started - the first one wants to set the status to "pending" and the second one to "accepted"; because the workflows are started almost at the same time there is no way to guarantee which status will be propagated first; it happens sometimes that the status is being set to "accepted" first and then to "pending" which results in devices being stuck in a pending state in inventory
When we released Mender 2.4, we were in a hurry as it was a last-minute discovery and decided to have direct communication between deviceauth and inventory to update the device identity, instead of using workflows, which decouples the two microservices and provide retries.
Replace the direct communication with a workflow.
References:
https://github.com/mendersoftware/deviceauth/blob/master/devauth/devauth.go#L224
https://github.com/mendersoftware/deviceauth/blob/master/devauth/devauth.go#L994