Skip to content

Commit

Permalink
fixed fstab.read issue
Browse files Browse the repository at this point in the history
(to be squashed)
  • Loading branch information
japokorn committed Oct 17, 2023
1 parent a741460 commit 5f881f9
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion blivet/fstab.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 5f881f9

Please sign in to comment.