Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0e5597fcc0 |
@@ -0,0 +1,23 @@
|
||||
package pb
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
// A phased update is flagged on the wire; an ordinary one carries no field at
|
||||
// all, so an old server or agent sees exactly the shape it always did.
|
||||
func TestPackageUpdatePhasedOnWire(t *testing.T) {
|
||||
b, err := json.Marshal(PackageUpdate{Name: "libkrb5-3", NewVersion: "1.20", Phased: true})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !strings.Contains(string(b), `"phased":true`) {
|
||||
t.Fatalf("phased missing: %s", b)
|
||||
}
|
||||
b, _ = json.Marshal(PackageUpdate{Name: "curl", NewVersion: "8"})
|
||||
if strings.Contains(string(b), "phased") {
|
||||
t.Fatalf("an ordinary update must not carry phased: %s", b)
|
||||
}
|
||||
}
|
||||
@@ -85,6 +85,10 @@ type PackageUpdate struct {
|
||||
Name string `json:"name"`
|
||||
CurrentVersion string `json:"current_version,omitempty"`
|
||||
NewVersion string `json:"new_version"`
|
||||
// Phased marks an Ubuntu phased update this host is not yet selected for:
|
||||
// apt lists it as upgradable, but an upgrade defers it until the host's
|
||||
// phase comes up. It is pending, not installable, so counts leave it out.
|
||||
Phased bool `json:"phased,omitempty"`
|
||||
}
|
||||
|
||||
type ReportUpdatesRequest struct {
|
||||
|
||||
@@ -127,6 +127,7 @@ message PackageUpdate {
|
||||
string name = 1;
|
||||
string current_version = 2;
|
||||
string new_version = 3;
|
||||
bool phased = 4; // Ubuntu phased update this host is not yet selected for; deferred by apt
|
||||
}
|
||||
|
||||
message ReportUpdatesRequest {
|
||||
|
||||
Reference in New Issue
Block a user