Re: crmsh fails to stop already stopped resource
Lars Marowsky-Bree <[email protected]> Mon, 16 Feb 2015 12:34:33 +0100
| Newsgroups | gmane.linux.highavailability.user |
|---|---|
| Message-ID | <[email protected]> |
On 2015-02-16T09:20:22, Kristoffer Grönlund <[email protected]> wrote: > Actually, I decided that it does make sense to return 0 as the error > code even if the resource to delete doesn't exist, so I pushed a commit > to change this. The error message is still printed, though. I'm not sure I agree, for once. Idempotency is for resource agent operations, not necessarily all operations everywhere. Especially because crmsh doesn't know whether the object doesn't exist because it was deleted, or because it was misspelled. Compare the Unix-as-little-else rm command; rm -f /tmp/idontexist will give an error code. Now a caller of crmsh has to *parse the output* to know whether the delete command succeeded or not, which is rather non-trivial. If the caller doesn't care whether the command succeeded or not, it should be the caller that ignores the error code. Or if you want to get real fancy, return different exit codes for "referenced object does not exist", or "generic syntax error". > >> Following fails with the current crmsh (e4b10ee). > >> # crm resource stop cl-http-lv > >> # crm resource stop cl-http-lv > >> ERROR: crm_diff apparently failed to produce the diff (rc=0) > >> ERROR: Failed to commit updates to cl-http-lv > >> # echo $? > >> 1 And, yeah, well, this shouldn't happen. Here idempotency applies ;-) Regards, Lars -- Architect Storage/HA SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Jennifer Guild, Dilip Upmanyu, Graham Norton, HRB 21284 (AG Nürnberg) "Experience is the name everyone gives to their mistakes." -- Oscar Wilde _______________________________________________ Linux-HA mailing list [email protected] http://lists.linux-ha.org/mailman/listinfo/linux-ha See also: http://linux-ha.org/ReportingProblems