fix(jvmId): correct query for Targets with null jvmId (backport #496) #502
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.
Welcome to Cryostat3! 👋
Before contributing, make sure you have:
main
branch[chore, ci, docs, feat, fix, test]
To recreate commits with GPG signature
git fetch upstream && git rebase --force --gpg-sign upstream/main
Fixes: #495
Description of the change:
Corrects a database query. Previously it queried with
find("id", (String) null)
, which generates a SQL query likeselect from Target where jvmId = null
and returns no results, even when there are targets with null JVM IDs. The new query is slightly different:select from Target where jvmId is null
, with the is null being the significant difference. With this the database query correctly comes back with the targets with a null JVM ID.https://stackoverflow.com/questions/9581745/sql-is-null-and-null
Motivation for the change:
This fixes the Target persist hook that is responsible for checking if newly stored credentials apply to targets, checking for targets which do not yet have a JVM ID, and then using the new credentials to try to set the target's JVM ID.
How to manually test:
./smoketest.bash -Ot
target.alias.contains('andrew')
,admin:adminpass123
. TheCredentialsStored
notification should appear, and so should a target update notification for each targetThis is an automatic backport of pull request #496 done by [Mergify](https://mergify.com).