From 8b2910adcf116ea22b6a808f94ac0c52156c584e Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Wed, 28 May 2025 13:39:00 -0400 Subject: [PATCH] need to store agent enrollment details (#967) --- environment/env_core/model.go | 1 + environment/env_v0_3/api.go | 4 ++++ environment/env_v0_4/api.go | 4 ++++ environment/env_v0_4/dirs.go | 8 ++++++++ 4 files changed, 17 insertions(+) diff --git a/environment/env_core/model.go b/environment/env_core/model.go index f7d5f74c..b2a59720 100644 --- a/environment/env_core/model.go +++ b/environment/env_core/model.go @@ -30,6 +30,7 @@ type Root interface { AgentSocket() (string, error) AgentRegistry() (string, error) + AgentEnrollment() (string, error) } type Environment struct { diff --git a/environment/env_v0_3/api.go b/environment/env_v0_3/api.go index cf0f610a..899a5642 100644 --- a/environment/env_v0_3/api.go +++ b/environment/env_v0_3/api.go @@ -201,6 +201,10 @@ func (r *Root) AgentRegistry() (string, error) { return "", errors.Errorf("this environment version does not support the zrok Agent; please 'zrok update' this environment") } +func (r *Root) AgentEnrollment() (string, error) { + return "", errors.Errorf("this environment version does not support the zrok Agent; please 'zrok update' this environment") +} + func (r *Root) Obliterate() error { zrd, err := rootDir() if err != nil { diff --git a/environment/env_v0_4/api.go b/environment/env_v0_4/api.go index d2aec7e6..63af2e4b 100644 --- a/environment/env_v0_4/api.go +++ b/environment/env_v0_4/api.go @@ -200,6 +200,10 @@ func (r *Root) AgentRegistry() (string, error) { return agentRegistry() } +func (r *Root) AgentEnrollment() (string, error) { + return agentEnrollment() +} + func (r *Root) Obliterate() error { zrd, err := rootDir() if err != nil { diff --git a/environment/env_v0_4/dirs.go b/environment/env_v0_4/dirs.go index 328eeb80..baf23be8 100644 --- a/environment/env_v0_4/dirs.go +++ b/environment/env_v0_4/dirs.go @@ -69,3 +69,11 @@ func agentRegistry() (string, error) { } return filepath.Join(zrd, "agent-registry.json"), nil } + +func agentEnrollment() (string, error) { + zrd, err := rootDir() + if err != nil { + return "", err + } + return filepath.Join(zrd, "agent-enrollment.json"), nil +}