cloud-init/backport-fix-properly-handle-blank-lines-in-fstab-5643.patch
shixuantong 9d5ff509e1 fix: properly handle blank lines in fstab
(cherry picked from commit d675a298a11b0e2fc7f2772d3a2a7c8ca91699fe)
2024-11-14 10:21:42 +08:00

33 lines
1.1 KiB
Diff

From 93f30bbfcb073fd8213c18c2e7eb7f857234fc8a Mon Sep 17 00:00:00 2001
From: James Falcon <james.falcon@canonical.com>
Date: Thu, 29 Aug 2024 18:22:23 -0400
Subject: [PATCH] fix: properly handle blank lines in fstab (#5643)
Reference:https://github.com/canonical/cloud-init/commit/93f30bbfcb073fd8213c18c2e7eb7f857234fc8a
Conflict:(1)not change test, the corresponding test case does not exist.
(2)change handle() not parse_fstab(), diff commit is d15a770.
---
cloudinit/config/cc_mounts.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/cloudinit/config/cc_mounts.py b/cloudinit/config/cc_mounts.py
index 2d645b3..f97b870 100644
--- a/cloudinit/config/cc_mounts.py
+++ b/cloudinit/config/cc_mounts.py
@@ -384,8 +384,9 @@ def handle(_name, cfg, cloud, log, _args):
toks = WS.split(line)
except Exception:
pass
- fstab_devs[toks[0]] = line
- fstab_lines.append(line)
+ if toks:
+ fstab_devs[toks[0]] = line
+ fstab_lines.append(line)
device_aliases = cfg.get("device_aliases", {})
--
2.33.0