Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Fix filemarker creation process, update error message on uninstall #4172
Fix filemarker creation process, update error message on uninstall #4172
Changes from 10 commits
fdf8b28
e6b77f1
1e52607
400bb0d
43bf5f0
75c93dc
d7538fe
fdb90cc
97fdec6
297bb1a
10d9218
a398e25
7960e16
5506e07
bb3416d
13bd8f6
ba39105
ab8797f
d0048f9
995a1f3
140752e
088232d
ee51e43
49b84f8
6d3edba
3f4a7f0
ef4b866
2911ad4
59b9d29
62f0c01
9c20838
aa4e4c1
791ba0e
b848e5b
91ee83d
4cff2f1
c0e82e9
28ad7df
d6d0fac
e2d5d89
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was expecting this call to be moved before the copy of other files, aren't we going to have the same issue if the copy of files above fails or gets interrupted for whatever reason ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, the install marker is just there so
elastic-agent
doesn't complain during an uninstall operation. However, if that initial copy doesn't complete, we might not even have anelastic-agent
binary or any files, and anything that is copied can either be removed viarm
or just overwritten on the next install. This is a less troublesome failure mode than creating the install marker at the end, where we'd have to remove service files, systemd config, etc, by hand. If the copy operation fails, you can also end up with a directory that is completely empty save for a.installed
file, which seems a bit weird.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still happening after the
copyFiles
call, it should be immediately after theerr = os.MkdirAll(filepath.Dir(topPath), 0755)
earlier in this function.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, I chose to not put it there, since putting the
.installed
file before anything has been installed seemed counter-intuitive, and if the copy fails we might not be able to runelastic-agent
at all. Unless there's something I'm not factoring in?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can't run
elastic-agent uninstall
unless the.installed
marker exists, so if you put it after the copy you can't remove the copied files from disk with theelastic-agent uninstall
command.