Cherry-pick #22322 to 7.x: Fix incorrect hash when upgrading agent (#22322) #22323
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.
Cherry-pick of PR #22322 to 7.x branch. Original message:
What does this PR do?
For some weird special case when
elastic-agent
sha512 file contains a filename prefixed with./
e.g:
elastic agent evaluates hashes incorrectly because it just trims the filename suffix. agent does not consider
./
to be part of the filename so it suspects that hash is748e927284f8eac2f5d8724f85a3be34d271b207147024906be4d254c5ff60affc51b191b7895e53bc3a1f4d1e76ef72e97c993d10b4be4804d9d6065ffefb9e ./
instead of748e927284f8eac2f5d8724f85a3be34d271b207147024906be4d254c5ff60affc51b191b7895e53bc3a1f4d1e76ef72e97c993d10b4be4804d9d6065ffefb9e
This PR just finds a correct line in a file and takes hash which is a fixed size string anyway without trimming suffixes.
Why is it important?
Fixes: #22306
Checklist
CHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.