Skip to content

Clean create_cfg.py updated readme#10

Merged
ericbsd merged 1 commit intomasterfrom
fixes
Nov 29, 2025
Merged

Clean create_cfg.py updated readme#10
ericbsd merged 1 commit intomasterfrom
fixes

Conversation

@ericbsd
Copy link
Member

@ericbsd ericbsd commented Nov 29, 2025

  • Trim unnecessary trailing whitespaces
  • Simplify logic in error and disk partition checks
  • Replace ambiguous return with a more Pythonic not errors
  • Enhance IOError handling for clarity
  • Update README.md for clearer installer purpose and flow

Summary by Sourcery

Improve configuration validation clarity in the installer and refresh installer documentation wording.

Enhancements:

  • Use a more idiomatic boolean check in configuration validation and simplify partition line filtering.
  • Clarify IOError propagation when writing the installation configuration file.

Documentation:

  • Clarify the purpose of Install Station and its relationship with Setup Station in the README.

- Trim unnecessary trailing whitespaces
- Simplify logic in error and disk partition checks
- Replace ambiguous return with a more Pythonic `not errors`
- Enhance IOError handling for clarity
- Update `README.md` for clearer installer purpose and flow
@ericbsd ericbsd requested review from a team as code owners November 29, 2025 19:50
@sourcery-ai
Copy link

sourcery-ai bot commented Nov 29, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Refactors installation configuration validation and file-writing logic in create_cfg.py to be more Pythonic and robust, while also clarifying the installer’s purpose in the README.

Sequence diagram for installation config validation and writing

sequenceDiagram
    actor User
    participant InstallerCLI
    participant InstallConfigManager
    participant InstallationData
    participant FileSystem

    User->>InstallerCLI: start_installation()
    InstallerCLI->>InstallConfigManager: create_cfg()

    InstallConfigManager->>InstallConfigManager: sanity_check()
    InstallConfigManager->>InstallationData: read boot,zfs_config_data,disk,slice,scheme,new_partition
    InstallConfigManager-->>InstallConfigManager: is_valid,errors (not_errors,errors)

    alt invalid_config
        InstallConfigManager-->>InstallerCLI: raise ValueError(error_msg)
        InstallerCLI-->>User: display_validation_errors
    else valid_config
        InstallConfigManager->>FileSystem: open(installation_config,w)
        FileSystem-->>InstallConfigManager: file_handle
        InstallConfigManager->>FileSystem: write_installation_settings
        FileSystem-->>InstallConfigManager: write_success
        InstallConfigManager-->>InstallerCLI: return_success
        InstallerCLI-->>User: report_install_config_created
    end

    InstallConfigManager->>FileSystem: may_raise_IOError
    FileSystem-->>InstallConfigManager: IOError
    InstallConfigManager-->>InstallerCLI: raise IOError_with_context
Loading

Updated class diagram for installation configuration management

classDiagram
    class InstallationData {
        +boot
        +zfs_config_data
        +disk
        +slice
        +scheme
        +new_partition
    }

    class InstallConfigManager {
        +sanity_check(cls)
        +create_cfg(cls)
    }

    InstallConfigManager ..> InstallationData : reads
Loading

File-Level Changes

Change Details Files
Make validation logic in sanity_check clearer and more idiomatic.
  • Normalize whitespace in the function for readability
  • Keep structured checks for boot manager, ZFS config, and custom partitioning fields
  • Replace boolean expression based on len(errors) with a more Pythonic not errors return value
install_station/create_cfg.py
Slightly simplify configuration creation and error reporting in create_cfg.
  • Preserve validation error aggregation and ValueError formatting before writing the config
  • Retain disk/partition iteration while simplifying the partition filter for BOOT/BIOS/UEFI lines using a single conditional
  • Improve IOError handling by chaining the original exception with from e while re-raising with a clearer message
install_station/create_cfg.py
Clarify the installer’s role and flow in the project documentation.
  • Rewrite README introduction to describe Install Station as the streamlined installer
  • Clarify separation of responsibilities between Install Station (disk/OS) and Setup Station (users/system setup at first boot)
README.md

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 and they look great!

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location> `install_station/create_cfg.py:161` </location>
<code_context>
                 f.write("runCommand=pw userdel -n ghostbsd -r\n")
                 f.write("runCommand=sed -i '' 's/ghostbsd/root/g' /etc/gettytab\n")
                 f.write("runCommand=sed -i '' 's/ghostbsd/root/g' /etc/ttys\n")
-                f.write("runCommand=mv /usr/local/etc/devd/automount_devd"
-                        ".conf.skip /usr/local/etc/devd/automount_devd.conf\n")
-                f.write("runCommand=mv /usr/local/etc/devd/automount_devd"
</code_context>

<issue_to_address>
**question (bug_risk):** Removal of the `automount_devd` mv commands may alter post-install behavior.

These `mv` commands were what enabled devd-based automount on first boot. Without an equivalent replacement, new installs may lose automount (e.g., removable media not mounting automatically). If this behavior is being changed intentionally, please confirm where the new enablement happens or that disabling automount is desired.
</issue_to_address>

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.

@ericbsd ericbsd merged commit 01e903d into master Nov 29, 2025
2 checks passed
@ericbsd ericbsd deleted the fixes branch November 29, 2025 19:51
@ericbsd ericbsd moved this from In Review to Done in Development Tracker Jan 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant