]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph_rest_api.py: don't fail if no up OSDs found on startup 1260/head 1261/head
authorDan Mick <dan.mick@inktank.com>
Tue, 18 Feb 2014 21:07:32 +0000 (13:07 -0800)
committerDan Mick <dan.mick@inktank.com>
Tue, 18 Feb 2014 21:07:32 +0000 (13:07 -0800)
allow find_up_osd() to return None, and have caller check for it

Fixes: #7463
Signed-off-by: Dan Mick <dan.mick@inktank.com>
src/pybind/ceph_rest_api.py

index 75e61060544cdbdce41ca53a09f95ca8184ddb5e..46d971edb2f233e5555b93b79c170f4565122abe 100755 (executable)
@@ -56,7 +56,7 @@ def find_up_osd(app):
         raise EnvironmentError(errno.EINVAL, 'Invalid JSON back from osd dump')
     osds = [osd['osd'] for osd in osddump['osds'] if osd['up']]
     if not osds:
-        raise EnvironmentError(errno.ENOENT, 'No up OSDs found')
+        return None
     return int(osds[-1])
 
 
@@ -139,7 +139,7 @@ def api_setup(app, conf, cluster, clientname, clientid, args):
     app.ceph_sigdict = get_command_descriptions(app.ceph_cluster)
 
     osdid = find_up_osd(app)
-    if osdid:
+    if osdid is not None:
         osd_sigdict = get_command_descriptions(app.ceph_cluster,
                                                target=('osd', int(osdid)))