diff options
author | Cole Robinson <crobinso@redhat.com> | 2020-11-10 10:11:15 -0500 |
---|---|---|
committer | Cole Robinson <crobinso@redhat.com> | 2020-11-10 12:04:25 -0500 |
commit | b1328202447a479196a7c2e6c28e32f5d0a07fd1 (patch) | |
tree | 712b877502532c697e1289ad7f00210bcb0aa222 | |
parent | 49a01b5482ee5009f4a59953d21eb8741670f813 (diff) | |
download | virt-manager-b1328202447a479196a7c2e6c28e32f5d0a07fd1.tar.gz |
devices: disk: Skip check_path_search for path=""
virt-manager can trigger this when ejecting cdrom media
Fixes: #180
Signed-off-by: Cole Robinson <crobinso@redhat.com>
-rw-r--r-- | tests/test_disk.py | 7 | ||||
-rw-r--r-- | virtinst/devices/disk.py | 3 |
2 files changed, 9 insertions, 1 deletions
diff --git a/tests/test_disk.py b/tests/test_disk.py index 17e72d19..b313b53c 100644 --- a/tests/test_disk.py +++ b/tests/test_disk.py @@ -65,6 +65,13 @@ def test_disk_dir_searchable(monkeypatch): tmpobj = tempfile.TemporaryDirectory(prefix="virtinst-test-search") tmpdir = tmpobj.name try: + # path="" should trigger early return + searchdata = virtinst.DeviceDisk.check_path_search(conn, "") + assert searchdata.uid is None + # path=None should trigger early return + searchdata = virtinst.DeviceDisk.check_path_search(conn, None) + assert searchdata.uid is None + # Invalid uid _set_caps_baselabel_uid(-1) searchdata = virtinst.DeviceDisk.check_path_search(conn, tmpdir) diff --git a/virtinst/devices/disk.py b/virtinst/devices/disk.py index 24a31807..412216bd 100644 --- a/virtinst/devices/disk.py +++ b/virtinst/devices/disk.py @@ -109,6 +109,7 @@ class DeviceDisk(Device): - username we checked for or None if not applicable - uid we checked for or None if not application """ + log.debug("DeviceDisk.check_path_search path=%s", path) class SearchData(object): def __init__(self): self.user = None @@ -116,7 +117,7 @@ class DeviceDisk(Device): self.fixlist = [] searchdata = SearchData() - if path is None: + if not path: return searchdata if conn.is_remote(): |