-
Notifications
You must be signed in to change notification settings - Fork 400
Validate pump settings #1129
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
Validate pump settings #1129
Conversation
Test for file existence and greater than zero size as part of validity
|
Why did you invert the success criteria? Doesn’t that change it from an AND to an OR, such that only one validation must be successful? |
|
Command return values are inverted from normal boolean logic. 0 is true, and anything not zero is false. The first check for SUCCESS in each line allows the function to skip the remaining checks once an error occurs. The second check for SUCCESS in each line limits the echo statement to only the error instead of the error and every line after. Here is a test output from copy and pasting the function into the shell: |
|
@scottleibrand, did that answer your question above? |
|
In function get_settings you do |
|
@scottleibrand, in get_settings, we weren't trying to use the value to set the return value of the function. I can reverse it to be more intuitive in the body (shell return values always seem counter-intuitive to me being C was my first language 😄), then test the value and return 0 or 1 depending on the value of SUCCESS. |
|
Oh, ok. I missed that we were directly using it as the return code. I agree that the new reversed logic is much easier to understand: thanks. |
If pump settings read is interrupted from an event such as a kill or rig reboot, the loop will fail until profile or settings needs to be refreshed.
This validates the pump settings files contain valid content as part of the decision to call get_settings.