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>
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=[
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
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):