-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Catch errors when scraping datadir from help output #218
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
Conversation
Related to #216 (comment) |
LGTM! cc @ltangvald |
Maybe separate it from the datadir fetch? We have a commit for this in the upstream image, actually: |
I'm not sure I understand the need to separate the error detection from the datadir scraping. This code ensures we only have to run |
It's somewhat a personal preference since I think it's easier to read and understand the code, but there is some benefit to keeping different logical operations (fetch datadir and check for errors) separate, since it makes future debugging and maintenance simpler. |
That makes sense, though the only problem I have with separating them is that they could become out of sync. The reason for checking for errors is to make sure the datadir scraping will succeed. As an alternative solution, we could just ignore the failure and add an |
Yeah, we added it as a more general error checking to fail fast and notify users if e.g. a custom config contains invalid entries, not specifically for the datadir scrape. I think it's a useful thing to have, since it lets us print a decent error message in such cases. Can't really think of anything else that would cause the scrape to fail. |
d414024
to
a1fce0d
Compare
Updated to separate config error check and datadir scraping. |
if ! errors="$("${toRun[@]}" 2>&1 >/dev/null)"; then | ||
cat >&2 <<-EOM | ||
|
||
ERROR: mysqld failed while attempting to determine datadir |
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 need to update this text to something more appropriate.
LGTM |
👍 |
Before this change, a user would just get the container exiting and zero output. Now a user will get some friendly output about the command that was run and then the error messages that
mysqld
emitted.