summaryrefslogtreecommitdiff
path: root/cloudinit/config/cc_mounts.py
diff options
context:
space:
mode:
Diffstat (limited to 'cloudinit/config/cc_mounts.py')
-rw-r--r--cloudinit/config/cc_mounts.py21
1 files changed, 11 insertions, 10 deletions
diff --git a/cloudinit/config/cc_mounts.py b/cloudinit/config/cc_mounts.py
index e57d1b1f..773b8285 100644
--- a/cloudinit/config/cc_mounts.py
+++ b/cloudinit/config/cc_mounts.py
@@ -379,17 +379,18 @@ def handle(_name, cfg, cloud, log, _args):
fstab_devs = {}
fstab_removed = []
- for line in util.load_file(FSTAB_PATH).splitlines():
- if MNT_COMMENT in line:
- fstab_removed.append(line)
- continue
+ if os.path.exists(FSTAB_PATH):
+ for line in util.load_file(FSTAB_PATH).splitlines():
+ if MNT_COMMENT in line:
+ fstab_removed.append(line)
+ continue
- try:
- toks = WS.split(line)
- except Exception:
- pass
- fstab_devs[toks[0]] = line
- fstab_lines.append(line)
+ try:
+ toks = WS.split(line)
+ except Exception:
+ pass
+ fstab_devs[toks[0]] = line
+ fstab_lines.append(line)
for i in range(len(cfgmnt)):
# skip something that wasn't a list