Re: crmsh fails to stop already stopped resource
Vladislav Bogdanov <[email protected]> Mon, 16 Feb 2015 15:19:55 +0300
| Newsgroups | gmane.linux.highavailability.user |
|---|---|
| Message-ID | <[email protected]> |
16.02.2015 14:34, Lars Marowsky-Bree wrote: > On 2015-02-16T09:20:22, Kristoffer Gr=F6nlund <[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. btw with '-f' it wont. ;) And it would be enough for me if 'crm -F' = behave the same. Best, Vladislav > > 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=3D0) >>>> ERROR: Failed to commit updates to cl-http-lv >>>> # echo $? >>>> 1 > > And, yeah, well, this shouldn't happen. Here idempotency applies ;-) > > > > Regards, > Lars > _______________________________________________ Linux-HA mailing list [email protected] http://lists.linux-ha.org/mailman/listinfo/linux-ha See also: http://linux-ha.org/ReportingProblems