[ovirt-users] Python SDK .remove() does not return True?

Yaniv Kaul ykaul at redhat.com
Sun Dec 18 20:34:07 UTC 2016


On Dec 18, 2016 8:39 PM, "Juan Hernández" <jhernand at redhat.com> wrote:

On 12/18/2016 05:32 PM, Yaniv Kaul wrote:
> I'd expect, like other actions, add() for example, that I can ensure
> .remove() (for clusters, DCs, etc.) will return True as a sign for
success.
> Is that a bug or a design choice?
> TIA,
> Y.
>

It is by design. The method returns nothing, because in HTTP the DELETE
method doesn't receive or return a body: it only returns the HTTP status
code. In the SDK, success HTTP status code results in returning nothing,
and failures result in throwing an exception. So, if the methods doesn't
throw an exception then you can assume that it worked successfully.


So I should wrap it in try-except? And catch what?
TIA,
Y.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ovirt.org/pipermail/users/attachments/20161218/b3bee916/attachment.html>


More information about the Users mailing list