package hostguard import ( "context" "sort" "strings" ) // MigrationInstallations is a refusal-only census, including incomplete // inventory. It makes no repair writes before the active-move preflight. // A settled installation (SettleObsoleteRootInventory) is listed, marked // Settled; any other quarantined or pending one refuses the census. func (a *RootAuthority) MigrationInstallations(ctx context.Context) ([]FenceView, error) { names, err := a.store.Names() if err != nil { return nil, err } sort.Strings(names) out := []FenceView{} for _, name := range names { if err := ctx.Err(); err != nil { return nil, err } if strings.HasSuffix(name, ".lock") { continue } if !strings.HasSuffix(name, ".json") { return nil, ErrMalformedRecord } host := strings.TrimSuffix(name, ".json") r, err := a.read(host) if err != nil { return nil, err } view, err := a.readView(host, Captured{Incarnation: r.Incarnation, Stamp: r.installation.Stamp}, true) if err != nil { return nil, err } out = append(out, view) } return out, nil }