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 16, 2023
1 parent a741460 commit 76c28ad
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion blivet/fstab.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,15 @@ 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", self.src_file)

def __deepcopy__(self, memo):
clone = FSTabManager(src_file=self.src_file, dest_file=self.dest_file)
Expand Down

0 comments on commit 76c28ad

Please sign in to comment.