gofmt -w: 14 files, formatting only, no behaviour change (R-1160)
This commit is contained in:
1 parent
0bc0bc5da0
commit
1edfd8e331
14 files changed
+38
-38
No files matched your search
@@ -14,10 +14,10 @@ func TestClassifyClaim(t *testing.T) {
|
||||
nodes: []claimNode{{name: "sdd", fstype: "", mountpoint: ""}, {name: "sdd1", fstype: "ntfs", mountpoint: ""}}}
|
||||
}
|
||||
cases := []struct {
|
||||
name string
|
||||
mutate func(f *claimFacts)
|
||||
name string
|
||||
mutate func(f *claimFacts)
|
||||
wantUnclaimed bool
|
||||
reasonHas string
|
||||
reasonHas string
|
||||
}{
|
||||
{"clean unclaimed disk (ntfs, unmounted)", func(f *claimFacts) {}, true, "unclaimed"},
|
||||
{"blank disk", func(f *claimFacts) { f.nodes = []claimNode{{name: "sdd"}} }, true, "unclaimed"},
|
||||
|
||||
@@ -103,12 +103,12 @@ type MountSpec struct {
|
||||
// Binaries holds the absolute paths of the allow-listed binaries (overridable from config
|
||||
// so the sudoers entries and the agent agree on exact paths).
|
||||
type Binaries struct {
|
||||
Systemctl string
|
||||
Install string
|
||||
Systemctl string
|
||||
Install string
|
||||
// PrivApply is the root content checker (R-861, agent v0.146.0): a unit file reaches /etc/systemd/system only
|
||||
// through `felhom-priv-apply unit <name>`, which reads the staged copy from /var/lib/felhom-agent/units/ and
|
||||
// refuses anything the renderers here never produce (a bind over /etc, a Where outside /mnt, …).
|
||||
PrivApply string
|
||||
PrivApply string
|
||||
Smartctl string
|
||||
Lvs string
|
||||
Blkid string // device signature probe (8C data-bearing detection)
|
||||
|
||||
@@ -17,12 +17,12 @@ import (
|
||||
// Four states (3A):
|
||||
// - new : durable-id NOT in the store. Never auto-mounted (the user must enroll it).
|
||||
// - enrolled : desired = mounted + bound into the guest. Drift (present && unmounted) with
|
||||
// this intent → reconcile.
|
||||
// this intent → reconcile.
|
||||
// - ejected : an intentional, temporary unmount, set ONLY via the official eject endpoint.
|
||||
// Present && unmounted → left alone. CLEARED to `enrolled` when the drive goes
|
||||
// physically ABSENT, so a replug auto-mounts (the replug rule, for free).
|
||||
// Present && unmounted → left alone. CLEARED to `enrolled` when the drive goes
|
||||
// physically ABSENT, so a replug auto-mounts (the replug rule, for free).
|
||||
// - decommissioned : permanent. Never auto-mounted; SURVIVES absent/present; cleared only by an
|
||||
// explicit re-commission.
|
||||
// explicit re-commission.
|
||||
//
|
||||
// The elegant invariant: intent is recorded ONLY through the official enroll/eject/decommission
|
||||
// paths. "Is it unmounted" ≠ "did someone officially eject it."
|
||||
|
||||
@@ -93,11 +93,11 @@ systemd-1 /mnt/felhom-drives/live autofs rw,relatime,fd=86 0 0
|
||||
where string
|
||||
want bool
|
||||
}{
|
||||
{"/mnt/felhom-drives/live", true}, // real nfs4 (the autofs line for the same path must not confuse it)
|
||||
{"/mnt/felhom-drives/smb", true}, // cifs
|
||||
{"/mnt/felhom-drives/idle", false}, // autofs trigger ONLY — idle automount is NOT mounted
|
||||
{"/mnt/felhom-drives/disk", false}, // a local fs at the path is not a network mount
|
||||
{"/mnt/felhom-drives/nope", false}, // absent
|
||||
{"/mnt/felhom-drives/live", true}, // real nfs4 (the autofs line for the same path must not confuse it)
|
||||
{"/mnt/felhom-drives/smb", true}, // cifs
|
||||
{"/mnt/felhom-drives/idle", false}, // autofs trigger ONLY — idle automount is NOT mounted
|
||||
{"/mnt/felhom-drives/disk", false}, // a local fs at the path is not a network mount
|
||||
{"/mnt/felhom-drives/nope", false}, // absent
|
||||
}
|
||||
for _, tc := range cases {
|
||||
if got := networkMountedIn(procMounts, tc.where); got != tc.want {
|
||||
|
||||
@@ -96,11 +96,11 @@ type Watchdog struct {
|
||||
now func() time.Time
|
||||
spawn func(func()) // spawn a background task (overridable in tests; default `go f()`)
|
||||
|
||||
intent IntentReader // P3: gate re-mount by drive intent (nil = ungated legacy)
|
||||
intent IntentReader // P3: gate re-mount by drive intent (nil = ungated legacy)
|
||||
onAbsent func(durableID string) // P3: called when a known target goes ABSENT (clears `ejected`)
|
||||
|
||||
mu sync.Mutex
|
||||
last map[string]bool // name -> last observed present (only for seen targets)
|
||||
last map[string]bool // name -> last observed present (only for seen targets)
|
||||
lastFire time.Time
|
||||
fired bool // lastFire is valid
|
||||
pending bool // a transition is awaiting the debounce window
|
||||
|
||||
Reference in new issue
Block a user