[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[PATCH 2/2] Improve handling of auto and unknown types in fstab. (#577260)



For entries of type "auto", we will use the scanned type we got
from blkid. We'll also write the actual type, not "auto", to the
new fstab if we write one.

Entries whose type does not resolve to any type we know about, but
whose scanned type does, will be ignored. The obvious example is
an entry of type "ntfs-3g" for which blkid reported "ntfs". We
don't know what to do with that and, frankly, don't care.
---
 storage/__init__.py |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/storage/__init__.py b/storage/__init__.py
index 38bce75..a3f1a73 100644
--- a/storage/__init__.py
+++ b/storage/__init__.py
@@ -1636,15 +1636,15 @@ class FSSet(object):
                                                                 fstype))
             raise UnrecognizedFSTabEntryError()
 
-        if device.format.type is None:
+        fmt = getFormat(fstype, device=device.path)
+        if fstype != "auto" and None in (device.format.type, fmt.type):
             log.info("Unrecognized filesystem type for %s (%s)"
                      % (device.name, fstype))
             raise UnrecognizedFSTabEntryError()
 
         # make sure, if we're using a device from the tree, that
         # the device's format we found matches what's in the fstab
-        fmt = getFormat(fstype, device=device.path)
-        if fmt.type != device.format.type:
+        if fstype != "auto" and fmt.type != device.format.type:
             raise StorageError("scanned format (%s) differs from fstab "
                         "format (%s)" % (device.format.type, fstype))
 
-- 
1.6.6.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]