]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind: fix cephfs.OSError initialization 15018/head
authorYan, Zheng <zyan@redhat.com>
Fri, 12 May 2017 02:38:51 +0000 (10:38 +0800)
committerYan, Zheng <zyan@redhat.com>
Fri, 12 May 2017 02:41:43 +0000 (10:41 +0800)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "cephfs.pyx", line 672, in cephfs.LibCephFS.open (/home/zhyan/Ceph/ceph-2/build/src/pybind/cephfs/pyrex/cephfs.c:10160)
  File "cephfs.pyx", line 155, in cephfs.OSError.__init__ (/home/zhyan/Ceph/ceph-2/build/src/pybind/cephfs/pyrex/cephfs.c:1889)
TypeError: __init__() takes exactly 3 positional arguments (2 given)

Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
src/pybind/cephfs/cephfs.pyx

index e7b4ec1e97e55b3120a1340d78eb0d6d6520d5c3..806e0ab4c3756365a09d0fc63ed629a7628206fe 100644 (file)
@@ -356,7 +356,8 @@ cdef class LibCephFS(object):
         self.state = "uninitialized"
         if rados_inst is not None:
             if auth_id is not None or conffile is not None or conf is not None:
-                raise InvalidValue("May not pass RADOS instance as well as other configuration")
+                raise make_ex(errno.EINVAL,
+                              "May not pass RADOS instance as well as other configuration")
 
             self.create_with_rados(rados_inst)
         else:
@@ -669,8 +670,8 @@ cdef class LibCephFS(object):
                     elif access_flags > 0 and c == '+':
                         access_flags = 3;
                     else:
-                        raise OperationNotSupported(
-                            "open flags doesn't support %s" % c)
+                        raise make_ex(errno.EOPNOTSUPP,
+                                      "open flags doesn't support %s" % c)
 
                 if access_flags == 1:
                     cephfs_flags |= os.O_RDONLY;