Skip to content
This repository was archived by the owner on Sep 17, 2024. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions e2e/_suites/fleet/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ func (i *ElasticAgentInstaller) getElasticAgentHash(containerName string) (strin
return getElasticAgentHash(containerName, commitFile)
}

func buildEnrollmentFlags(token string) []string {
return []string{"--url=http://kibana:5601", "--enrollment-token=" + token, "-f", "--insecure"}
}

func getElasticAgentHash(containerName string, commitFile string) (string, error) {
cmd := []string{
"cat", commitFile,
Expand Down Expand Up @@ -240,9 +244,7 @@ func newCentosInstaller(image string, tag string, version string) (ElasticAgentI
}

enrollFn := func(token string) error {
args := []string{"http://kibana:5601", token, "-f", "--insecure"}

return runElasticAgentCommand(profile, image, service, ElasticAgentProcessName, "enroll", args)
return runElasticAgentCommand(profile, image, service, ElasticAgentProcessName, "enroll", buildEnrollmentFlags(token))
}

binDir := "/var/lib/elastic-agent/data/elastic-agent-%s/"
Expand Down Expand Up @@ -305,9 +307,7 @@ func newDebianInstaller(image string, tag string, version string) (ElasticAgentI
}

enrollFn := func(token string) error {
args := []string{"http://kibana:5601", token, "-f", "--insecure"}

return runElasticAgentCommand(profile, image, service, ElasticAgentProcessName, "enroll", args)
return runElasticAgentCommand(profile, image, service, ElasticAgentProcessName, "enroll", buildEnrollmentFlags(token))
}

binDir := "/var/lib/elastic-agent/data/elastic-agent-%s/"
Expand Down Expand Up @@ -450,9 +450,7 @@ func newTarInstaller(image string, tag string, version string) (ElasticAgentInst
binDir := "/usr/bin/"

enrollFn := func(token string) error {
args := []string{"http://kibana:5601", token, "-f", "--insecure"}

return runElasticAgentCommand(profile, image, service, ElasticAgentProcessName, "enroll", args)
return runElasticAgentCommand(profile, image, service, ElasticAgentProcessName, "enroll", buildEnrollmentFlags(token))
}

//
Expand Down