From: Andrew Schoen Date: Wed, 31 Jan 2018 15:04:09 +0000 (-0600) Subject: ceph-volume: no need to return osd_id from util.prepare.check_id X-Git-Tag: v13.0.2~387^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f88f2d3bc1f5dcae1e9b2be62dab20942374fc29;p=ceph.git ceph-volume: no need to return osd_id from util.prepare.check_id 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 --- diff --git a/src/ceph-volume/ceph_volume/tests/util/test_prepare.py b/src/ceph-volume/ceph_volume/tests/util/test_prepare.py index 8f1fb7cd9a34..6bcdfbabd723 100644 --- a/src/ceph-volume/ceph_volume/tests/util/test_prepare.py +++ b/src/ceph-volume/ceph_volume/tests/util/test_prepare.py @@ -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=[ diff --git a/src/ceph-volume/ceph_volume/util/prepare.py b/src/ceph-volume/ceph_volume/util/prepare.py index a254f43d9a62..8d8de6ee7631 100644 --- a/src/ceph-volume/ceph_volume/util/prepare.py +++ b/src/ceph-volume/ceph_volume/util/prepare.py @@ -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):