Skip to content

Conversation

@vojtechtrefny
Copy link
Collaborator

@vojtechtrefny vojtechtrefny commented Sep 29, 2025

When /etc/fstab is not present, we'll simply skip parsing it.

Fixes: #557
Resolves: RHEL-115033

Summary by Sourcery

Bug Fixes:

  • Skip parsing /etc/fstab when the file is not present to avoid errors on systems without it

When /etc/fstab is not present, we'll simply skip parsing it.

Fixes: linux-system-roles#557
Resolves: RHEL-115033
@sourcery-ai
Copy link

sourcery-ai bot commented Sep 29, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adds a guard clause in parse() to skip parsing when /etc/fstab is missing, preventing errors on systems without the file.

Class diagram for updated parse() method in blivet.py

classDiagram
class Blivet {
  +parse()
}
Blivet : +parse()  // Now skips parsing if /etc/fstab is missing
Loading

Flow diagram for parse() method with /etc/fstab check

flowchart TD
    A["Start parse()"] --> B{"Does /etc/fstab exist?"}
    B -- No --> C["Return (skip parsing)"]
    B -- Yes --> D["Open /etc/fstab"]
    D --> E["Read lines and parse entries"]
Loading

File-Level Changes

Change Details Files
Guard against missing /etc/fstab in parse method.
  • Check for /etc/fstab existence with os.path.exists
  • Early return from parse() when file is absent
library/blivet.py

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there - I've reviewed your changes - here's some feedback:

  • Move the /etc/fstab existence check before resetting self._entries to avoid unnecessary state resets when the file is missing.
  • Wrap the open call in try/except FileNotFoundError instead of using os.path.exists to better handle race conditions and permission errors.
  • Return a consistent type (e.g. an empty list) from parse when /etc/fstab is absent instead of None to prevent downstream errors.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Move the /etc/fstab existence check before resetting self._entries to avoid unnecessary state resets when the file is missing.
- Wrap the open call in try/except FileNotFoundError instead of using os.path.exists to better handle race conditions and permission errors.
- Return a consistent type (e.g. an empty list) from parse when /etc/fstab is absent instead of None to prevent downstream errors.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@codecov
Copy link

codecov bot commented Sep 29, 2025

Codecov Report

❌ Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 10.36%. Comparing base (59fd1c6) to head (10fa59a).
⚠️ Report is 86 commits behind head on main.

Files with missing lines Patch % Lines
library/blivet.py 0.00% 2 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (59fd1c6) and HEAD (10fa59a). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (59fd1c6) HEAD (10fa59a)
sanity 1 0
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #562      +/-   ##
==========================================
- Coverage   16.54%   10.36%   -6.19%     
==========================================
  Files           2        8       +6     
  Lines         284     2017    +1733     
  Branches       79        0      -79     
==========================================
+ Hits           47      209     +162     
- Misses        237     1808    +1571     
Flag Coverage Δ
sanity ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@richm
Copy link
Contributor

richm commented Sep 29, 2025

@vojtechtrefny what platforms are affected?

@vojtechtrefny
Copy link
Collaborator Author

The original reporter mentions running a live system over PXE, not sure which exactly, but there are more systems that don't use fstab by default, like Fedora CoreOS or bootc systems (and I guess it also possible to manually configure any system replace fstab with systemd mount units if someone really wants).

@richm richm merged commit 9b06aad into linux-system-roles:main Sep 29, 2025
30 of 32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Blivet crash when /etc/fstab isn't present

2 participants