No client names the holder of the seat mesh-provisioner: each reader keeps its own constant, held to its manifest (ADR 0625 section 4, issue 1966)
Claude-Session: https://claude.ai/code/session_01NcbgfFSnn24M3GcqttoU7i
This commit is contained in:
@@ -78,7 +78,14 @@ const ProvisionerPrefix = "provisioner."
|
||||
// seat mesh-provisioner's state `plans`, `<node>.<module>` (novox/hq ADR 0570 clause 2), no longer the controller's
|
||||
// assignments. A plan is read as the assignment's value carried it (asAssignment), so the rules that read a plan are
|
||||
// unchanged.
|
||||
const AssignmentsRead = meshprovisionerclient.PlansRead
|
||||
const AssignmentsRead = provisionerModule + "." + meshprovisionerclient.PlansState
|
||||
|
||||
// ProvisionsRead is the seat's state provisions as the manifest's `reads` names it; provisionerModule the module holding the seat
|
||||
// mesh-provisioner (TestThePlacementNamesAreTheManifests).
|
||||
const (
|
||||
ProvisionsRead = provisionerModule + "." + meshprovisionerclient.ProvisionsState
|
||||
provisionerModule = "mesh-provisioner"
|
||||
)
|
||||
|
||||
// asAssignment is a plan's key in the form the vault's rules read: `{node, module, provisioning: plan}`, nil for none.
|
||||
func asAssignment(key string, raw []byte, err error) ([]byte, error) {
|
||||
|
||||
@@ -9,7 +9,6 @@ package main
|
||||
|
||||
import (
|
||||
"git.novox.be/novox/mesh-contracts/health-and-repair/go/clients/meshconditionsclient"
|
||||
"git.novox.be/novox/mesh-contracts/provisioning/go/clients/meshprovisionerclient"
|
||||
|
||||
"encoding/json"
|
||||
|
||||
@@ -80,7 +79,7 @@ func build() *Env {
|
||||
Delete: func(key string) error { return stdio.State(BoundState).Delete(key) },
|
||||
Keys: func() ([]string, error) { return stdio.State(BoundState).Keys() },
|
||||
Provision: func(key string) ([]byte, error) {
|
||||
e, err := stdio.State(meshprovisionerclient.ProvisionsRead).Get(key)
|
||||
e, err := stdio.State(ProvisionsRead).Get(key)
|
||||
if err != nil || e == nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -220,7 +219,7 @@ func watchCredentialAsks(env *Env, kick chan<- struct{}) bool {
|
||||
if env.Vault == nil {
|
||||
return true
|
||||
}
|
||||
err := stdio.State(meshprovisionerclient.ProvisionsRead).Watch("", func(c stdio.StateChange) error {
|
||||
err := stdio.State(ProvisionsRead).Watch("", func(c stdio.StateChange) error {
|
||||
if !c.Current && credentialAsked(c.Value) {
|
||||
select {
|
||||
case kick <- struct{}{}:
|
||||
|
||||
@@ -86,6 +86,15 @@ func TestThePlacementNamesAreTheManifests(t *testing.T) {
|
||||
if err := json.Unmarshal(raw, &m); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
var reads struct {
|
||||
Reads []string `json:"reads"`
|
||||
}
|
||||
_ = json.Unmarshal(raw, &reads)
|
||||
for _, r := range []string{AssignmentsRead, ProvisionsRead} {
|
||||
if !slices.Contains(reads.Reads, r) {
|
||||
t.Errorf("the vault reads %s, its manifest's reads are %v", r, reads.Reads)
|
||||
}
|
||||
}
|
||||
if !slices.Contains(m.Invokes, PlacementTool) || !slices.Contains(m.Consumes, PlacementViewsEvent) {
|
||||
t.Errorf("the vault asks %s and follows %s, its manifest invokes %v and consumes %v", PlacementTool, PlacementViewsEvent, m.Invokes, m.Consumes)
|
||||
}
|
||||
|
||||
@@ -204,9 +204,9 @@ func TestNoBucketHoldsASecret(t *testing.T) {
|
||||
for _, call := range []string{"Get(", "Put(", "Delete(", "Keys("} {
|
||||
code = []byte(strings.Replace(string(code), "stdio.State(BoundState)."+call, "", 1))
|
||||
}
|
||||
code = []byte(strings.Replace(string(code), "stdio.State(meshprovisionerclient.ProvisionsRead).Get(", "", 1))
|
||||
code = []byte(strings.Replace(string(code), "stdio.State(ProvisionsRead).Get(", "", 1))
|
||||
// And one watch of them, for a credential asked of the vault (issue 1126).
|
||||
code = []byte(strings.Replace(string(code), "stdio.State(meshprovisionerclient.ProvisionsRead).Watch(", "", 1))
|
||||
code = []byte(strings.Replace(string(code), "stdio.State(ProvisionsRead).Watch(", "", 1))
|
||||
}
|
||||
if m := bucket.Find(code); m != nil {
|
||||
t.Errorf("%s opens a bucket (%s): the vault keeps every secret in its own store only", f, m)
|
||||
|
||||
Reference in New Issue
Block a user