Skip to content

Commit

Permalink
Delete all containers after reprovision (Azure#4833)
Browse files Browse the repository at this point in the history
Removes all containers after a device reprovision. This is done because identities for containers might no longer be valid after the reprovision. Edgelet will refresh the identities on its next run.

Resolves Azure#4458
  • Loading branch information
gordonwang0 committed Apr 21, 2021
1 parent a46838f commit 77ad781
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions edgelet/iotedged/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,14 @@ where

tokio_runtime.block_on(reprovision)?;

// After reprovisioning, previous module keys may no longer be valid.
// Delete all containers to allow module keys to be updated on the next run.
tokio_runtime
.block_on(runtime.remove_all())
.context(ErrorKind::Initialize(
InitializeErrorReason::RemoveExistingModules,
))?;

// Return an error here to let the daemon exit with an error code.
// This will make `systemd` restart the daemon which will re-execute the
// provisioning flow and if the device has been re-provisioned, the daemon
Expand Down

0 comments on commit 77ad781

Please sign in to comment.