From 2778634e23eabb462287b7b5ff1432b3eae69f21 Mon Sep 17 00:00:00 2001 From: Jan Pokorny Date: Mon, 16 Oct 2023 14:00:56 +0200 Subject: [PATCH] fixed fstab.read issue (to be squashed) --- blivet/fstab.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/blivet/fstab.py b/blivet/fstab.py index 6401f99f5..7129648bf 100644 --- a/blivet/fstab.py +++ b/blivet/fstab.py @@ -301,7 +301,16 @@ def __init__(self, src_file=None, dest_file=None): self.spec_type = None if self.src_file is not None: - self.read() + # self.read() will raise an exception in case of invalid fstab path. + # This can interrupt object initialization thus preventing even setting read path + # to something else. + # This suppresses the exception. + if os.path.isfile(self.src_file): + self.read() + else: + # Acceptable at this point, but notify the user + log.info("Fstab file '%s' does not exist, setting fstab read path to None", self.src_file) + self.src_file = None def __deepcopy__(self, memo): clone = FSTabManager(src_file=self.src_file, dest_file=self.dest_file)