From: John Spray Date: Thu, 17 Sep 2015 15:12:57 +0000 (+0100) Subject: pybind: allow CephFS constructor to take ID X-Git-Tag: v10.0.3~16^2~12 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e3b9477d497801be12a3a66f837fc9765010a0e1;p=ceph.git pybind: allow CephFS constructor to take ID For those folks who aren't running as 'admin'. We already allow this at the C layer, it was just left out of the python binding. Signed-off-by: John Spray --- diff --git a/src/pybind/cephfs.py b/src/pybind/cephfs.py index f11b6dcfe586..1216f68bcaa0 100644 --- a/src/pybind/cephfs.py +++ b/src/pybind/cephfs.py @@ -194,13 +194,18 @@ class LibCephFS(object): raise LibCephFSStateError("You cannot perform that operation on a " "CephFS object in state %s." % (self.state)) - def __init__(self, conf=None, conffile=None): + def __init__(self, conf=None, conffile=None, auth_id=None): self.libcephfs = load_libcephfs() self.cluster = c_void_p() if conffile is not None and not isinstance(conffile, basestring): raise TypeError('conffile must be a string or None') - ret = self.libcephfs.ceph_create(byref(self.cluster), c_char_p(0)) + + if auth_id is not None and not isinstance(auth_id, basestring): + raise TypeError('auth_id must be a string or None') + + ret = self.libcephfs.ceph_create(byref(self.cluster), + c_char_p(auth_id) if auth_id else c_char_p(0)) if ret != 0: raise Error("libcephfs_initialize failed with error code: %d" % ret) self.state = "configuring"