Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cherry-pick #21772 to 7.x: [Elastic Agent] Don't perform install until after enroll #21816

Merged
merged 2 commits into from
Oct 14, 2020

Conversation

blakerouse
Copy link
Contributor

@blakerouse blakerouse commented Oct 14, 2020

Cherry-pick of PR #21772 to 7.x branch. Original message:

What does this PR do?

This switches the installation to be based on successful enrollment. First agent is installed in the correct location (but is not started), then enrollment is performed. In the case that enrollment fails the installation directory is removed, if enrollment is successful then it starts the persistent service.

This also adds a check to ensure that an Elastic Agent is not already running from the extracted Elastic Agent directory. This is because an already running Elastic Agent in that directory will cause installation to fail because on Windows some of the files will not be able to be opened to be copied to there new location.

Why is it important?

It removes the need to restart an already running Elastic Agent that was just started. It removes the requirement to start Elastic Agent in standalone mode first then switching it to Fleet mode. It helps ensure that installation is only successful when enrollment is successful.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • [ ] I have made corresponding changes to the documentation
  • [ ] I have made corresponding change to the default configuration files
  • [ ] I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

Related issues

* Flip install and enroll.

* Update order.

* Always perform uninstall of service.

* Fix issue with no enrolling.

* Fix enrollment no.

* Add changelog.

(cherry picked from commit 34da9c9)
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Oct 14, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/ingest-management (Team:Ingest Management)

@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Oct 14, 2020
@blakerouse blakerouse self-assigned this Oct 14, 2020
Copy link
Contributor

@michalpristas michalpristas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Backport looks ok

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: [Pull request #21816 opened]

  • Start Time: 2020-10-14T17:46:55.852+0000

  • Duration: 36 min 10 sec

Test stats 🧪

Test Results
Failed 0
Passed 1390
Skipped 4
Total 1394

@blakerouse blakerouse merged commit a967338 into elastic:7.x Oct 14, 2020
@blakerouse blakerouse deleted the backport_21772_7.x branch October 14, 2020 19:44
@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: [Pull request #21816 updated]

  • Start Time: 2020-10-14T19:31:58.938+0000

  • Duration: 36 min 14 sec

Test stats 🧪

Test Results
Failed 0
Passed 1394
Skipped 4
Total 1398

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants