Skip to content
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

fix 'cib-push' exit code when the diff is empty #166

Closed
wants to merge 1 commit into from

Conversation

btravouillon
Copy link
Contributor

pcs cib-should not consider an empty diff as an error. Instead, we notice
the user and exit with 0.

pcs cib-push diff-against= should not consider an empty diff as an
error. Instead, we notice the user and exit with 0.
@tomjelinek
Copy link
Member

Summary of the preceding IRC discussion:
The use case here seems to be that an automated process (puppet module) consider it has to apply some diff while there are no diff. In such a case, pcs should exit with 0 so that the puppet module considers its task to be completed successfully.
The argument for pcs to exit with 1 in the case of an empty diff is that its task is to change something in the CIB and when there is no change, it should be reported. An empty diff may mean the command was used incorrectly or commands run before it didn't do any changes. It's up to the pcs user to decide if the situation is OK or not.

I've been thinking about this and got to a conclusion that pcs should exit with 0 in the case of an empty diff, the current status is in fact a bug. Reasoning: pcs node unstandby exits with 0 no matter if the node was in standby mode or not (considering no errors occur). It is pushing the CIB as a diff internally. When the node is not in standby mode, the diff is empty, yet pcs doesn't exit with 1. When running the same command on a CIB in a file and then pushing it as a diff manually, it should work the same and exit with 0. The same applies for other pcs commands.

Cherry-picked to both pcs-0.9 be7fa7b and pcs-0.10 4eb8c8f. Thanks for bringing this up!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants