Ignore readonly drives exported by the device

This commit is contained in:
Kovid Goyal 2016-01-19 10:00:41 +05:30
parent c015a92e0c
commit 15b66c1f40

View File

@ -248,14 +248,15 @@ class Device(DeviceConfig, DevicePlugin):
filtered = set() filtered = set()
for dl in dlmap['drive_letters']: for dl in dlmap['drive_letters']:
pnp_id = dlmap['pnp_id_map'][dl].upper() pnp_id = dlmap['pnp_id_map'][dl].upper()
if self.windows_filter_pnp_id(pnp_id): if dl in dlmap['readonly_drives']:
filtered.add(dl)
if debug:
prints('Ignoring the drive %s as it is readonly' % dl)
elif self.windows_filter_pnp_id(pnp_id):
filtered.add(dl) filtered.add(dl)
if debug: if debug:
prints('Ignoring the drive %s because of a PNP filter on %s' % (dl, pnp_id)) prints('Ignoring the drive %s because of a PNP filter on %s' % (dl, pnp_id))
dlmap['drive_letters'] = [dl for dl in dlmap['drive_letters'] if dl not in filtered] elif not drive_is_ok(dl, debug=debug):
filtered = set()
for dl in dlmap['drive_letters']:
if not drive_is_ok(dl, debug=debug):
filtered.add(dl) filtered.add(dl)
if debug: if debug:
prints('Ignoring the drive %s because failed to get free space for it' % dl) prints('Ignoring the drive %s because failed to get free space for it' % dl)