mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-10-13 00:34:43 +00:00
Name both digests when a container update preflight refuses
The digest-drift refusal only said the digest no longer matched, which left no way to tell a genuine plan/image drift from a comparison bug (#1666 shipped refusals on every classic-overlay2 host for exactly that reason, and the report had to correlate image stores to get close). Include the planned digest plus the local image id and repo digest in the refusal so the action record itself carries the evidence. Contract-Neutral: agent preflight refusal message detail only; no payload or schema change, error stays within the existing 1024-byte bounded field
This commit is contained in:
parent
cf55b7a2d0
commit
022316fca6
1 changed files with 8 additions and 3 deletions
|
|
@ -34,16 +34,21 @@ func (a *Agent) TypedContainerUpdate(ctx context.Context, runtime, containerID,
|
|||
localImageID := strings.TrimSpace(inspect.Image)
|
||||
matchesLocalID := strings.EqualFold(localImageID, expectedImageDigest)
|
||||
matchesRepoDigest := false
|
||||
repoDigest := ""
|
||||
if !matchesLocalID {
|
||||
imageName := ""
|
||||
if inspect.Config != nil {
|
||||
imageName = inspect.Config.Image
|
||||
}
|
||||
repoDigest, _, _, _ := a.getImageRepoDigest(ctx, localImageID, imageName)
|
||||
matchesRepoDigest = strings.EqualFold(strings.TrimSpace(repoDigest), expectedImageDigest)
|
||||
repoDigest, _, _, _ = a.getImageRepoDigest(ctx, localImageID, imageName)
|
||||
repoDigest = strings.TrimSpace(repoDigest)
|
||||
matchesRepoDigest = strings.EqualFold(repoDigest, expectedImageDigest)
|
||||
}
|
||||
if !matchesLocalID && !matchesRepoDigest {
|
||||
return agentexec.DockerContainerUpdateOutcome{}, fmt.Errorf("container image digest no longer matches the planned update")
|
||||
if repoDigest == "" {
|
||||
repoDigest = "unavailable"
|
||||
}
|
||||
return agentexec.DockerContainerUpdateOutcome{}, fmt.Errorf("container image digest no longer matches the planned update (expected %s, local image id %s, local repo digest %s)", expectedImageDigest, localImageID, repoDigest)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue