getAndSetTargetState in the APIBinder had a check for whether the target state has changed.
When triggering an update from the API, we want to *always* call triggerApplyTarget, especially
when the update is forced. Otherwise the API endpoint doesn't work for forced updates (and in general,
will rarely trigger an update unless a change in the API's target state has happened)
Change-type: patch
Signed-off-by: Pablo Carranza Velez <pablo@balena.io>
In commit 19cd310da3 this line was deleted,
probably to avoid deleting local mode apps when setting the API target and
viceversa but we need to delete old apps to avoid problems when moving
the device between apps.
We now filter by source to avoid the problem with local mode too.
Change-type: patch
Signed-off-by: Pablo Carranza Velez <pablo@balena.io>
We've seen at least one case where the 10ms delay
wasn't enough, causing the tests to fail where they shouldn't.
(Ideally we should find a better way to detect when the streams
have finished propagating, but this will avoid failures in the meantime).
Change-type: patch
Signed-off-by: Pablo Carranza Velez <pablo@balena.io>
This fixes occasional timeouts in rsync after applying v2 deltas, which
cause unnecessary fallbacks to a regular pull.
This change also removes the need for the mkfifo native dependency (since
docker-delta 2.2.2 stops using it).
Change-type: patch
Signed-off-by: Pablo Carranza Velez <pablo@balena.io>
Otherwise we may skip saving a target image to the db when updating from legacy supervisors,
which in turn prevents from deleting the legacy image entry (with imageId = 1), leaving the
supervisor in a state where it can't report its current state to the API.
While we're at it, we also remove an unused variable in _getStatus.
Change-type: patch
Signed-off-by: Pablo Carranza Velez <pablo@balena.io>
We do this by formatting the keys from the target state before comparing them
with the ones from the current state (that are already formatted to strip the namespace
prefix).
Change-type: patch
Signed-off-by: Pablo Carranza Velez <pablo@balena.io>
This avoids issues on provisioning where the current state
(esp. config.txt) that we want to save is retrieved without
a RESIN_ or BALENA_ prefix, causing those values to be lost.
Change-type: patch
Signed-off-by: Pablo Carranza Velez <pablo@balena.io>
Otherwise old releases (where applications expected tty to be true)
would break.
Change-type: patch
Signed-off-by: Pablo Carranza Velez <pablo@balena.io>
i.e. if we're not provisioned or if the target state is empty (of apps), then we
read apps.json to preload. We then mark that the target state has been set to avoid
trying to preload again if we ever get an empty target state from the API.
Change-type: patch
Signed-off-by: Pablo Carranza Velez <pablo@balena.io>