From 35a26073ed01e53b70af07780b508fc53d0239e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20de=20la=20Pe=C3=B1a?= Date: Tue, 23 Feb 2021 15:40:56 +0100 Subject: [PATCH] fix: update flags for the enroll command (#804) * fix: update enroll command flags * chore: extract flags generation to a method --- e2e/_suites/fleet/services.go | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/e2e/_suites/fleet/services.go b/e2e/_suites/fleet/services.go index 5888fd5ca9..e428825218 100644 --- a/e2e/_suites/fleet/services.go +++ b/e2e/_suites/fleet/services.go @@ -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, @@ -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/" @@ -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/" @@ -449,9 +449,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)) } //