image-info: ignore lines with only whitespace characters in fstab
image-info could produce a weird fstab error with an empty list as a member, when analysing images not built using osbuild. Ensure that any lines in fstab with only whitespace characters are skipped during image analysis. Signed-off-by: Tomas Hozza <thozza@redhat.com>
This commit is contained in:
parent
53109945ef
commit
972515ad84
1 changed files with 1 additions and 2 deletions
|
|
@ -555,7 +555,6 @@ def read_fstab(tree):
|
||||||
|
|
||||||
An example return value:
|
An example return value:
|
||||||
[
|
[
|
||||||
[],
|
|
||||||
[
|
[
|
||||||
"UUID=6d066eb4-e4c1-4472-91f9-d167097f48d1",
|
"UUID=6d066eb4-e4c1-4472-91f9-d167097f48d1",
|
||||||
"/",
|
"/",
|
||||||
|
|
@ -569,7 +568,7 @@ def read_fstab(tree):
|
||||||
result = []
|
result = []
|
||||||
with contextlib.suppress(FileNotFoundError):
|
with contextlib.suppress(FileNotFoundError):
|
||||||
with open(f"{tree}/etc/fstab") as f:
|
with open(f"{tree}/etc/fstab") as f:
|
||||||
result = sorted([line.split() for line in f if line and not line.startswith("#")])
|
result = sorted([line.split() for line in f if line.strip() and not line.startswith("#")])
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue