in updater/aws.go [389:419]
func (u *updater) verifyUpdate(inst instance) (bool, error) {
log.Println("Verifying update by checking there is no new version available to update" +
" and validate the active version")
ec2IDs := []string{inst.instanceID}
updateStatus, err := u.sendCommand(ec2IDs, u.checkDocument)
if err != nil {
return false, fmt.Errorf("failed to send update check command: %w", err)
}
updateResult, err := u.getCommandResult(updateStatus, inst.instanceID)
if err != nil {
return false, fmt.Errorf("failed to get check command output: %w", err)
}
output, err := parseCommandOutput(updateResult)
if err != nil {
return false, fmt.Errorf("failed to parse command output %q, manual verification required: %w", string(updateResult), err)
}
updatedVersion := output.ActivePartition.Image.Version
if updatedVersion == inst.bottlerocketVersion {
log.Printf("Container instance %q did not update, its current "+
"version %s and updated version %s are the same", inst.containerInstanceID, inst.bottlerocketVersion, updatedVersion)
return false, nil
} else if output.UpdateState == updateStateAvailable {
log.Printf("Container instance %q was updated to version %q successfully, however another newer version was recently released;"+
" Instance will be updated to newer version in next iteration.", inst.containerInstanceID, updatedVersion)
return true, nil
} else {
log.Printf("Container instance %q updated to version %q", inst.containerInstanceID, updatedVersion)
}
return true, nil
}