Venom1991 / refind-btrfs

Generate rEFInd manual boot stanzas from Btrfs snapshots
GNU General Public License v3.0
144 stars 8 forks source link

Changes in configuration are not backward-compatible #19

Closed rogueai closed 2 years ago

rogueai commented 2 years ago

Hi, I know it's probably expected, but it seems there have been some configuration changes that are not compatible with my current config:

Initializing the block devices using lsblk.
Initializing the physical partition table for device '/dev/nvme0n1' using lsblk.
Initializing the live partition table for device '/dev/nvme0n1' using findmnt.
Found the ESP mounted at '/efi' on '/dev/nvme0n1p1'.
Found the root partition on '/dev/nvme0n1p6'.
Searching for snapshots of the '@' subvolume in the '/.snapshots' directory.
Found subvolume '@' mounted as the root partition.
Found 9 snapshots of the '@' subvolume.
Searching for the 'refind.conf' file on '/dev/nvme0n1p1'.
Found 1 boot stanza matched with the root partition.
Initializing the static partition table for subvolume '@snapshots/380/snapshot' from its fstab file.
Initializing the static partition table for subvolume '@snapshots/379/snapshot' from its fstab file.
Initializing the static partition table for subvolume '@snapshots/378/snapshot' from its fstab file.
Found 3 snapshots for addition.
Found 3 snapshots for removal.
ERROR (refind_btrfs/__init__.py/main): An unexpected error happened, exiting...
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/refind_btrfs/__init__.py", line 80, in main
    exit_code = runner.run()
  File "/usr/lib/python3.9/site-packages/refind_btrfs/console/cli_runner.py", line 49, in run
    if not machine.run():
  File "/usr/lib/python3.9/site-packages/refind_btrfs/state_management/refind_btrfs_machine.py", line 102, in run
    while model.next_state():
  File "/usr/lib/python3.9/site-packages/transitions/core.py", line 401, in trigger
    return self.machine._process(func)
  File "/usr/lib/python3.9/site-packages/transitions/core.py", line 1187, in _process
    return trigger()
  File "/usr/lib/python3.9/site-packages/transitions/core.py", line 426, in _trigger
    return self._process(event_data)
  File "/usr/lib/python3.9/site-packages/transitions/core.py", line 435, in _process
    if trans.execute(event_data):
  File "/usr/lib/python3.9/site-packages/transitions/core.py", line 269, in execute
    if not self._eval_conditions(event_data):
  File "/usr/lib/python3.9/site-packages/transitions/core.py", line 250, in _eval_conditions
    if not cond.check(event_data):
  File "/usr/lib/python3.9/site-packages/transitions/core.py", line 189, in check
    return predicate(*event_data.args, **event_data.kwargs) == self.target
  File "/usr/lib/python3.9/site-packages/refind_btrfs/state_management/conditions.py", line 261, in check_boot_stanzas_with_snapshots
    if package_config.exit_if_no_changes_are_detected:
  File "/usr/lib/python3.9/site-packages/refind_btrfs/common/package_config.py", line 105, in exit_if_no_changes_are_detected
    return self._exit_if_no_changes_are_detected
AttributeError: 'PackageConfig' object has no attribute '_exit_if_no_changes_are_detected'

It was an easy fix once I got an idea of what was wrong, but perhaps it could fail in a more controlled manner in such a case

And finally, thanks for the great tool!

Venom1991 commented 2 years ago

Yeah, I forgot to increase the the PackageConfig's expected version to "1.2.0" here.

If I did, this piece of code would have returned "None" because 1.1.0 (the currently persisted version) is less than 1.2.0 (the one expected by the program). This failed check consequently forces the parsing of the config file. I actually implemented this fairly recently because breakage that you've just experienced started getting on my nerves.

Alternatively, a simple "touch refind-btrfs.conf" would suffice but that would be an ugly packaging workaround, imho.

I'll probably have something to commit and push in the coming days (if everything works out) so I'll increase that expected version as well.