Lars Marowsky-Bree <l...@suse.com> writes:

> On 2015-02-16T09:20:22, Kristoffer Grönlund <kgronl...@suse.com> 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".

I suppose the point of argument is the definition of success here. If
asked to remove something and that something does not exist, is that
success?

But, maybe you are right! Doing all of the removes at once would also
solve this use case, with the added benefit of performing the remove
with a single CIB modification.

If Dejan also votes to revert this change, I will do so.

As a sidenote, I find the automatic removal of related constraints
somewhat strange... To continue the filesystem analogy, it is as if soft
links would be deleted when the file they point to is removed. ;)

>
>> >> 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
> Linux-HA@lists.linux-ha.org
> http://lists.linux-ha.org/mailman/listinfo/linux-ha
> See also: http://linux-ha.org/ReportingProblems
>

-- 
// Kristoffer Grönlund
// kgronl...@suse.com
_______________________________________________
Linux-HA mailing list
Linux-HA@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha
See also: http://linux-ha.org/ReportingProblems

Reply via email to