Skip to content

The cross-harness, self-improving memory layer for AI agents. Join our community: https://discord.com/invite/zdNChS2fBu

Remove redundant template re-rendering and unused logPath parameters

Cursor Agentab23b54fa1c0
diff --git a/cli/beacon/internal/endpoint/datadog/datadog.go b/cli/beacon/internal/endpoint/datadog/datadog.go
index 2141fc88..0429656e 100644
--- a/cli/beacon/internal/endpoint/datadog/datadog.go
+++ b/cli/beacon/internal/endpoint/datadog/datadog.go
@@ -101,15 +101,7 @@ func InstallPack(outputDir, logPath string) error {
return err
}
for _, file := range files {
- content := file.Content
- if file.Name == "conf.yaml" {
- s, err := ConfigSnippet(logPath)
- if err != nil {
- return err
- }
- content = s
- }
- if err := os.WriteFile(filepath.Join(outputDir, file.Name), []byte(content), 0644); err != nil {
+ if err := os.WriteFile(filepath.Join(outputDir, file.Name), []byte(file.Content), 0644); err != nil {
return err
}
}
diff --git a/cli/beacon/internal/endpoint/elastic/elastic.go b/cli/beacon/internal/endpoint/elastic/elastic.go
index e1268883..7ca5e344 100644
--- a/cli/beacon/internal/endpoint/elastic/elastic.go
+++ b/cli/beacon/internal/endpoint/elastic/elastic.go
@@ -158,22 +158,7 @@ func InstallPack(outputDir, logPath string) error {
return err
}
for _, file := range files {
- content := file.Content
- switch file.Name {
- case "filebeat.yml":
- s, err := InputSnippet(logPath)
- if err != nil {
- return err
- }
- content = s
- case "elastic-agent-standalone.yml":
- s, err := standaloneAgentConfig(logPath)
- if err != nil {
- return err
- }
- content = s
- }
- if err := os.WriteFile(filepath.Join(outputDir, file.Name), []byte(content), 0644); err != nil {
+ if err := os.WriteFile(filepath.Join(outputDir, file.Name), []byte(file.Content), 0644); err != nil {
return err
}
}
diff --git a/cli/beacon/internal/endpoint/rapid7/rapid7.go b/cli/beacon/internal/endpoint/rapid7/rapid7.go
index e77f8527..2c71fc66 100644
--- a/cli/beacon/internal/endpoint/rapid7/rapid7.go
+++ b/cli/beacon/internal/endpoint/rapid7/rapid7.go
@@ -55,8 +55,9 @@ func uploadSmokeTestFromFS(fsys fs.FS, logPath string) (string, error) {
}
// filesFromFS builds the full file list from the supplied FS, propagating any
-// read errors instead of panicking.
-func filesFromFS(fsys fs.FS, logPath string) ([]File, error) {
+// read errors instead of panicking. Template substitution of LOG_PATH is
+// deferred to siempack.Install via the TemplateLogPath field.
+func filesFromFS(fsys fs.FS) ([]File, error) {
readme, err := siempack.ReadFile(fsys, "pack/README.md")
if err != nil {
return nil, fmt.Errorf("rapid7 pack asset %q: %w", "pack/README.md", err)
@@ -83,7 +84,7 @@ func filesFromFS(fsys fs.FS, logPath string) ([]File, error) {
// Files returns all pack files, propagating any embedded asset read error.
func Files() ([]File, error) {
- return filesFromFS(packFS, DefaultLogPath)
+ return filesFromFS(packFS)
}
// UploadSmokeTest returns the Rapid7 upload smoke-test script with logPath substituted.
@@ -99,7 +100,7 @@ func InstallPack(outputDir, logPath string) error {
if logPath == "" {
logPath = DefaultLogPath
}
- files, err := filesFromFS(packFS, logPath)
+ files, err := filesFromFS(packFS)
if err != nil {
return err
}
diff --git a/cli/beacon/internal/endpoint/rapid7/rapid7_test.go b/cli/beacon/internal/endpoint/rapid7/rapid7_test.go
index 138851e8..8e227fd4 100644
--- a/cli/beacon/internal/endpoint/rapid7/rapid7_test.go
+++ b/cli/beacon/internal/endpoint/rapid7/rapid7_test.go
@@ -173,7 +173,7 @@ func TestFiles_ContainsAllRequiredNames(t *testing.T) {
func TestFilesFromFS_PropagatesReadError(t *testing.T) {
emptyFS := fstest.MapFS{}
- _, err := filesFromFS(emptyFS, DefaultLogPath)
+ _, err := filesFromFS(emptyFS)
if err == nil {
t.Fatal("filesFromFS with empty FS should return an error")
}
diff --git a/cli/beacon/internal/endpoint/sumo/sumo.go b/cli/beacon/internal/endpoint/sumo/sumo.go
index 37848de6..e32fa064 100644
--- a/cli/beacon/internal/endpoint/sumo/sumo.go
+++ b/cli/beacon/internal/endpoint/sumo/sumo.go
@@ -55,8 +55,9 @@ func uploadSmokeTestFromFS(fsys fs.FS, logPath string) (string, error) {
}
// filesFromFS builds the full file list from the supplied FS, propagating any
-// read errors instead of panicking.
-func filesFromFS(fsys fs.FS, logPath string) ([]File, error) {
+// read errors instead of panicking. Template substitution of LOG_PATH is
+// deferred to siempack.Install via the TemplateLogPath field.
+func filesFromFS(fsys fs.FS) ([]File, error) {
readme, err := siempack.ReadFile(fsys, "pack/README.md")
if err != nil {
return nil, fmt.Errorf("sumo pack asset %q: %w", "pack/README.md", err)
@@ -83,7 +84,7 @@ func filesFromFS(fsys fs.FS, logPath string) ([]File, error) {
// Files returns all pack files, propagating any embedded asset read error.
func Files() ([]File, error) {
- return filesFromFS(packFS, DefaultLogPath)
+ return filesFromFS(packFS)
}
// UploadSmokeTest returns the Sumo upload smoke-test script with logPath substituted.
@@ -99,7 +100,7 @@ func InstallPack(outputDir, logPath string) error {
if logPath == "" {
logPath = DefaultLogPath
}
- files, err := filesFromFS(packFS, logPath)
+ files, err := filesFromFS(packFS)
if err != nil {
return err
}
diff --git a/cli/beacon/internal/endpoint/sumo/sumo_test.go b/cli/beacon/internal/endpoint/sumo/sumo_test.go
index 2e99b320..c7e2b748 100644
--- a/cli/beacon/internal/endpoint/sumo/sumo_test.go
+++ b/cli/beacon/internal/endpoint/sumo/sumo_test.go
@@ -179,7 +179,7 @@ func TestFiles_ContainsAllRequiredNames(t *testing.T) {
func TestFilesFromFS_PropagatesReadError(t *testing.T) {
emptyFS := fstest.MapFS{}
- _, err := filesFromFS(emptyFS, DefaultLogPath)
+ _, err := filesFromFS(emptyFS)
if err == nil {
t.Fatal("filesFromFS with empty FS should return an error")
}