Archived
Say the adopt switch is the string "true" and that reload only has the kernel reread its exports, as the holders do
mesh/merge-gate pass: builds build-agent, mesh-controller, route-proxy → ace, g14, novox, shanks; no bus step; every machine composes with the change as it…
mesh/repo-check pass: its merge-check.sh passed
mesh/delivery delivered
mesh/delivery-group group feat/mounts-module merged: every member is merged
mesh/merge-gate pass: builds build-agent, mesh-controller, route-proxy → ace, g14, novox, shanks; no bus step; every machine composes with the change as it…
mesh/repo-check pass: its merge-check.sh passed
mesh/delivery delivered
mesh/delivery-group group feat/mounts-module merged: every member is merged
This commit is contained in:
@@ -46,8 +46,9 @@ func nfsServerVerbs() []Verb {
|
|||||||
"address": "a client's address on the private network (optional)",
|
"address": "a client's address on the private network (optional)",
|
||||||
}, []string{"share"}),
|
}, []string{"share"}),
|
||||||
Replaces: []string{"showmount -e"}},
|
Replaces: []string{"showmount -e"}},
|
||||||
{Name: "reload", Description: "Write this machine's export file again from the module's settings and " +
|
{Name: "reload", Description: "Have the kernel read this machine's export files again now (exportfs " +
|
||||||
"have the kernel take it. Changes no shared path.",
|
"-ra) and answer the shares as it then holds them. The module's own process writes its export " +
|
||||||
|
"file; this is for after a change made outside it. Changes no shared path.",
|
||||||
Input: schema(map[string]string{}, nil),
|
Input: schema(map[string]string{}, nil),
|
||||||
Replaces: []string{"exportfs -ra"}},
|
Replaces: []string{"exportfs -ra"}},
|
||||||
{Name: "adopt", Description: "Take over an export a person made by hand: clear a dataset's sharenfs " +
|
{Name: "adopt", Description: "Take over an export a person made by hand: clear a dataset's sharenfs " +
|
||||||
@@ -55,7 +56,7 @@ func nfsServerVerbs() []Verb {
|
|||||||
"confirm, says what it would do and changes nothing.",
|
"confirm, says what it would do and changes nothing.",
|
||||||
Input: schema(map[string]string{
|
Input: schema(map[string]string{
|
||||||
"path": "the shared path whose hand-made export is taken over",
|
"path": "the shared path whose hand-made export is taken over",
|
||||||
"confirm": "true to change it; anything else is a dry run",
|
"confirm": "\"true\": change it (needs why); anything else is a dry run",
|
||||||
"why": "why, for the record",
|
"why": "why, for the record",
|
||||||
}, []string{"path"}, "confirm"),
|
}, []string{"path"}, "confirm"),
|
||||||
Replaces: []string{"zfs set sharenfs=off"}},
|
Replaces: []string{"zfs set sharenfs=off"}},
|
||||||
@@ -87,7 +88,7 @@ func mountsVerbs() []Verb {
|
|||||||
"the mesh's automount for it is armed. Without confirm, says what it would do and changes nothing.",
|
"the mesh's automount for it is armed. Without confirm, says what it would do and changes nothing.",
|
||||||
Input: schema(map[string]string{
|
Input: schema(map[string]string{
|
||||||
"mountpoint": "the mount point whose fstab line is taken over",
|
"mountpoint": "the mount point whose fstab line is taken over",
|
||||||
"confirm": "true to change it; anything else is a dry run",
|
"confirm": "\"true\": change it (needs why); anything else is a dry run",
|
||||||
"why": "why, for the record",
|
"why": "why, for the record",
|
||||||
}, []string{"mountpoint"}, "confirm"),
|
}, []string{"mountpoint"}, "confirm"),
|
||||||
Replaces: []string{"sed -i /etc/fstab"}},
|
Replaces: []string{"sed -i /etc/fstab"}},
|
||||||
|
|||||||
@@ -126,3 +126,36 @@ func TestTheShareVerbsSayWhatTheyReplace(t *testing.T) {
|
|||||||
t.Errorf("%s is not a verb of the compiled seats", verb)
|
t.Errorf("%s is not a verb of the compiled seats", verb)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The confirm switch is the seat's string "true", as every verb's switch is, and its description says so:
|
||||||
|
// a holder handed the boolean reading of "true to change it" would treat the string as a dry run.
|
||||||
|
func TestTheConfirmSwitchIsTheStringTrue(t *testing.T) {
|
||||||
|
for _, seat := range []string{NFSServerSeat, MountsSeat} {
|
||||||
|
s, _ := SeatNamed(seat)
|
||||||
|
for _, v := range s.Serves {
|
||||||
|
props, _ := v.Input["properties"].(map[string]any)
|
||||||
|
confirm, _ := props["confirm"].(map[string]any)
|
||||||
|
if confirm == nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if confirm["type"] != "string" {
|
||||||
|
t.Errorf("%s.%s confirm is %v, not the string switch", seat, v.Name, confirm["type"])
|
||||||
|
}
|
||||||
|
if d, _ := confirm["description"].(string); !strings.Contains(d, `"true"`) {
|
||||||
|
t.Errorf("%s.%s confirm does not name the string \"true\": %q", seat, v.Name, d)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// reload has the kernel read the export files; the module's process writes its file. The description
|
||||||
|
// must not promise a write it does not do.
|
||||||
|
func TestReloadSaysWhatItDoes(t *testing.T) {
|
||||||
|
s, _ := SeatNamed(NFSServerSeat)
|
||||||
|
for _, v := range s.Serves {
|
||||||
|
if v.Name == "reload" && (strings.Contains(v.Description, "Write this machine's export file") ||
|
||||||
|
!strings.Contains(v.Description, "exportfs")) {
|
||||||
|
t.Errorf("reload's description promises a write or does not name exportfs: %s", v.Description)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user