Skip to content

Commit

Permalink
Addressing conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
ycombinator committed Sep 29, 2023
1 parent bd562dc commit f02a34c
Showing 1 changed file with 1 addition and 24 deletions.
25 changes: 1 addition & 24 deletions internal/pkg/agent/install/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,6 @@ func Install(cfgFile, topPath string) error {
return errors.New(err, "failed to discover the source directory for installation", errors.TypeFilesystem)
}

<<<<<<< HEAD
// Uninstall current installation
//
// There is no uninstall token for "install" command.
// Uninstall will fail on protected agent.
// The protected Agent will need to be uninstalled first before it can be installed.
err = Uninstall(cfgFile, topPath, "")
if err != nil {
return errors.New(
err,
fmt.Sprintf("failed to uninstall Agent at (%s)", filepath.Dir(topPath)),
errors.M("directory", filepath.Dir(topPath)))
=======
// We only uninstall Agent if it is currently installed.
status, _ := Status(topPath)
if status == Installed {
Expand All @@ -49,17 +36,13 @@ func Install(cfgFile, topPath string) error {
// There is no uninstall token for "install" command.
// Uninstall will fail on protected agent.
// The protected Agent will need to be uninstalled first before it can be installed.
s := pt.StepStart("Uninstalling current Elastic Agent")
err = Uninstall(cfgFile, topPath, "", s)
err = Uninstall(cfgFile, topPath, "")
if err != nil {
s.Failed()
return errors.New(
err,
fmt.Sprintf("failed to uninstall Agent at (%s)", filepath.Dir(topPath)),
errors.M("directory", filepath.Dir(topPath)))
}
s.Succeeded()
>>>>>>> 0c43005695 (`elastic-agent install`: Only uninstall when Agent is installed (#3415))
}

// ensure parent directory exists, copy source into install path
Expand All @@ -70,12 +53,6 @@ func Install(cfgFile, topPath string) error {
fmt.Sprintf("failed to create installation parent directory (%s)", filepath.Dir(topPath)),
errors.M("directory", filepath.Dir(topPath)))
}
<<<<<<< HEAD
=======

// copy source into install path
s := pt.StepStart("Copying files")
>>>>>>> 0c43005695 (`elastic-agent install`: Only uninstall when Agent is installed (#3415))
err = copy.Copy(dir, topPath, copy.Options{
OnSymlink: func(_ string) copy.SymlinkAction {
return copy.Shallow
Expand Down

0 comments on commit f02a34c

Please sign in to comment.