Skip to content
This repository has been archived by the owner on Sep 17, 2024. It is now read-only.

chore: fail warm-up if the installers could not be downloaded #320

Merged
merged 1 commit into from
Sep 22, 2020
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
28 changes: 20 additions & 8 deletions e2e/_suites/ingest-manager/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,18 +172,28 @@ func GetElasticAgentInstaller(image string) ElasticAgentInstaller {
"image": image,
}).Debug("Configuring installer for the agent")

var installer ElasticAgentInstaller
var err error
if "centos-systemd" == image {
return newCentosInstaller("centos-systemd", "latest")
installer, err = newCentosInstaller("centos-systemd", "latest")
} else if "debian-systemd" == image {
return newDebianInstaller()
installer, err = newDebianInstaller()
} else {
log.WithField("image", image).Fatal("Sorry, we currently do not support this installer")
return ElasticAgentInstaller{}
}

log.WithField("image", image).Fatal("Sorry, we currently do not support this installer")
return ElasticAgentInstaller{}
if err != nil {
log.WithFields(log.Fields{
"error": err,
"image": image,
}).Fatal("Sorry, we could not download the installer")
}
return installer
}

// newCentosInstaller returns an instance of the Centos installer
func newCentosInstaller(image string, tag string) ElasticAgentInstaller {
func newCentosInstaller(image string, tag string) (ElasticAgentInstaller, error) {
service := image
profile := IngestManagerProfileName

Expand All @@ -204,6 +214,7 @@ func newCentosInstaller(image string, tag string) ElasticAgentInstaller {
"extension": extension,
"error": err,
}).Error("Could not download the binary for the agent")
return ElasticAgentInstaller{}, err
}

fn := func() error {
Expand All @@ -229,11 +240,11 @@ func newCentosInstaller(image string, tag string) ElasticAgentInstaller {
profile: profile,
service: service,
tag: tag,
}
}, nil
}

// newDebianInstaller returns an instance of the Debian installer
func newDebianInstaller() ElasticAgentInstaller {
func newDebianInstaller() (ElasticAgentInstaller, error) {
image := "debian-systemd"
service := image
tag := "stretch"
Expand All @@ -256,6 +267,7 @@ func newDebianInstaller() ElasticAgentInstaller {
"extension": extension,
"error": err,
}).Error("Could not download the binary for the agent")
return ElasticAgentInstaller{}, err
}

fn := func() error {
Expand All @@ -281,7 +293,7 @@ func newDebianInstaller() ElasticAgentInstaller {
profile: profile,
service: service,
tag: tag,
}
}, nil
}

func systemctlRun(profile string, image string, service string, command string) error {
Expand Down