From: songweibin Date: Mon, 25 Feb 2019 06:58:44 +0000 (+0800) Subject: rbd/pybind: add __enter__ and __exit__ for class Group X-Git-Tag: v13.2.6~110^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1b77ac72a6214ed0082d1b649c1d25f19eaf1056;p=ceph.git rbd/pybind: add __enter__ and __exit__ for class Group Fixes: http://tracker.ceph.com/issues/38468 Signed-off-by: songweibin (cherry picked from commit bb8df22e4ae851d858b081a47f063a1f33b4d0c9) --- diff --git a/src/pybind/rbd/rbd.pyx b/src/pybind/rbd/rbd.pyx index 62aff653464c..0b65bca75420 100644 --- a/src/pybind/rbd/rbd.pyx +++ b/src/pybind/rbd/rbd.pyx @@ -1615,6 +1615,12 @@ cdef class Group(object): self._ioctx = convert_ioctx(ioctx) self._name = name + def __enter__(self): + return self + + def __exit__(self, type_, value, traceback): + return False + def add_image(self, image_ioctx, image_name): """ Add an image to a group.