-
Notifications
You must be signed in to change notification settings - Fork 21
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
Correctly check if a published Tumbleweed image was found #63
Conversation
| jq -r "[.assets[] | select(.name | test(\"Tumbleweed-$arch-$latest_published_tw_build-Tumbleweed\\\\@$machine.qcow\"))] | .[0] | .name") | ||
if ! [[ $qcow ]]; then | ||
if [[ "$qcow" = "null" ]]; then |
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.
What about the case when the JSON is completely invalid? Maybe $qcow
is still empty then. I also remember that I've tested this case and maybe in some cases $qcow
is really just empty. I'd simply check for both (null and empty) here to be sure.
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.
In case the JSON is invalid, jq and the script should abort because of bash -e
.
But also checking for the empty string doesn't sound like a bad idea.
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.
If the JSON is invalid there's no return value:
parse error: Unfinished JSON term at EOF at line 2, column 0
I can't come up with a case where the return value is the empty string.
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 change makes sense to me. In 9a1ae1d mkittler changed from "sed" to "jq" so instead of an empty string we now get the null value from jq
Also drop the extra check that can't be reached
48cbaf9
to
a4190e4
Compare
jq
returns null not empty when nothing is foundopenqa-cli
in place ofopenqa-client
See: poo#81492