]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind: allow CephFS constructor to take ID
authorJohn Spray <john.spray@redhat.com>
Thu, 17 Sep 2015 15:12:57 +0000 (16:12 +0100)
committerJohn Spray <john.spray@redhat.com>
Tue, 5 Jan 2016 00:47:53 +0000 (00:47 +0000)
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 <john.spray@redhat.com>
src/pybind/cephfs.py

index f11b6dcfe586e744647dc0ce787d26ad9c520f9e..1216f68bcaa03b51925e57eb098510d9d59b5c87 100644 (file)
@@ -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"