Teardown after installation #4491#4536
Conversation
|
Reverted this a draft: Test matrix is very large. Missing no enc generic umount + lazy fallback for when procs might still be active |
| cmd = ['vgchange', '-a', active_flag, vg.name] | ||
|
|
||
| debug(f'vgchange volume group: {" ".join(cmd)}') | ||
| SysCommand(cmd) |
There was a problem hiding this comment.
I feel like an error handling might be useful here for debugging purposes
| from archinstall.lib.output import debug, info, warn | ||
|
|
||
| if TYPE_CHECKING: | ||
| from archinstall.lib.installer import Installer |
There was a problem hiding this comment.
Is this causeing circular dependencies? If not can we move this to the top
|
|
||
| info('Tearing down installation target') | ||
|
|
||
| with suppress(Exception): |
There was a problem hiding this comment.
We shouldn't supress things, either handle it or log it
|
|
||
|
|
||
| def _teardown_lvm(installer: Installer) -> None: | ||
| from archinstall.lib.disk.lvm import lvm_vg_change, lvm_vol_change |
| raise DiskError(f'Could not enable swap {path}:\n{err.message}') | ||
|
|
||
|
|
||
| def teardown(installer: Installer) -> None: |
There was a problem hiding this comment.
We should be passing the configuration here not the installer
| if exc_type is not None: | ||
| error(str(exc_value)) | ||
| try: | ||
| if exc_type is not None: |
There was a problem hiding this comment.
Can we move this whle thing out of the exit as that will only be run when Installer is used in the with context. So it would be better to have this as a function
def cleanup(...)
that can be called
installer = Installer(...)
# install steps
installer.cleanup()
Moves the large def out of installer into
archinstall/lib/disk/utils.pyAlso preserves @kill74 's commit in #4496 which did the heavy lifting