]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume: no need to return osd_id from util.prepare.check_id
authorAndrew Schoen <aschoen@redhat.com>
Wed, 31 Jan 2018 15:04:09 +0000 (09:04 -0600)
committerAndrew Schoen <aschoen@redhat.com>
Wed, 31 Jan 2018 15:04:09 +0000 (09:04 -0600)
Now that osd_id is passed to util.prepare.create_id it doesn't
make any sense to return osd_id from check_id anymore as it's
not being used.

Signed-off-by: Andrew Schoen <aschoen@redhat.com>
src/ceph-volume/ceph_volume/tests/util/test_prepare.py
src/ceph-volume/ceph_volume/util/prepare.py

index 8f1fb7cd9a3472df06a30d0b9f21e3828a0f1ee9..6bcdfbabd72370d2b08c0219f61a39fc7a62bda4 100644 (file)
@@ -24,7 +24,6 @@ class TestCheckID(object):
         monkeypatch.setattr('ceph_volume.process.call', lambda *a, **kw: (stdout, '', 0))
         result = prepare.check_id(0)
         assert result
-        assert result == "0"
 
     def test_id_does_not_exist(self, monkeypatch):
         stdout = dict(nodes=[
index a254f43d9a624c5fe7a1907cfab5dd00eb9fe750..8d8de6ee7631ea50b4afd6d79d1a81d02cfadf87 100644 (file)
@@ -78,7 +78,7 @@ def create_id(fsid, json_secrets, osd_id=None):
 
 def check_id(osd_id):
     """
-    Checks to see if an osd ID exists or not. Returns osd_id
+    Checks to see if an osd ID exists or not. Returns True
     if it does exist, False if it doesn't.
 
     :param osd_id: The osd ID to check
@@ -103,11 +103,7 @@ def check_id(osd_id):
 
     output = json.loads(''.join(stdout).strip())
     osds = output['nodes']
-    found_osd = any([str(osd['id']) == str(osd_id) for osd in osds])
-    if found_osd:
-        # return a string so an ID of 0 evaluates to True
-        return str(osd_id)
-    return False
+    return any([str(osd['id']) == str(osd_id) for osd in osds])
 
 
 def mount_tmpfs(path):