Skip to content

Commit

Permalink
fix: properly handle blank lines in fstab (#5643)
Browse files Browse the repository at this point in the history
  • Loading branch information
TheRealFalcon authored Aug 29, 2024
1 parent 6d644e6 commit 93f30bb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cloudinit/config/cc_mounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,8 +374,9 @@ def parse_fstab() -> Tuple[List[str], Dict[str, str], List[str]]:
fstab_removed.append(line)
continue
toks = line.split()
fstab_devs[toks[0]] = line
fstab_lines.append(line)
if toks:
fstab_devs[toks[0]] = line
fstab_lines.append(line)
return fstab_lines, fstab_devs, fstab_removed


Expand Down
1 change: 1 addition & 0 deletions tests/unittests/config/test_cc_mounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,7 @@ def test_fstab_mounts_combinations(self):
"LABEL=keepme none ext4 defaults 0 0\n"
"/dev/sda1 /a auto defaults,comment=cloudconfig 0 2\n"
"LABEL=UEFI\n"
"\n"
"/dev/sda2 /b auto defaults,comment=cloudconfig 0 2\n"
)
with open(cc_mounts.FSTAB_PATH, "w") as fd:
Expand Down

0 comments on commit 93f30bb

Please sign in to comment.