carlos / platform Public

Clone
git clone https://amadan.net/carlos/platform

Plain git — no account needed to clone.

Download

Download this file

1package hostguard
2
3import (
4 "context"
5 "sort"
6 "strings"
7)
8
9// MigrationInstallations is a refusal-only census, including incomplete
10// inventory. It makes no repair writes before the active-move preflight.
11// A settled installation (SettleObsoleteRootInventory) is listed, marked
12// Settled; any other quarantined or pending one refuses the census.
13func (a *RootAuthority) MigrationInstallations(ctx context.Context) ([]FenceView, error) {
14 names, err := a.store.Names()
15 if err != nil {
16 return nil, err
17 }
18 sort.Strings(names)
19 out := []FenceView{}
20 for _, name := range names {
21 if err := ctx.Err(); err != nil {
22 return nil, err
23 }
24 if strings.HasSuffix(name, ".lock") {
25 continue
26 }
27 if !strings.HasSuffix(name, ".json") {
28 return nil, ErrMalformedRecord
29 }
30 host := strings.TrimSuffix(name, ".json")
31 r, err := a.read(host)
32 if err != nil {
33 return nil, err
34 }
35 view, err := a.readView(host, Captured{Incarnation: r.Incarnation, Stamp: r.installation.Stamp}, true)
36 if err != nil {
37 return nil, err
38 }
39 out = append(out, view)
40 }
41 return out, nil
42}
43