luet version 0.22.0-g7f7e1418c1316149c5424bacaf7993f4daaa3e99 2021-12-27 10:49:33 UTC
CPU architecture, OS, and Version:
x86_64
Describe the bug
When using Luet as a library the use of os.Exit in several places limits the possibility of proper error handling. In fact I'd strictly limit the use the os.Exit to very limited and known places and not inside any exposed code potentially used as a library. In rancher-sandbox/elemental-cli this is causing issues to properly handle errors caused by luet.
To Reproduce
Run something like elemental-cli install /dev/sda --docker-image quay.io/costoolkit/releases-green:cos-system-0.7.11-18 from https://github.com/rancher-sandbox/elemental-cli/pull/34 and the cosign plugin will fail causing the program to exit without unmounting any of the images and partitions that were mounted during the installation. In fact non of the deferred functions will be executed.
Expected behavior
If there is an error on any of the exported luet packages this is not causing an os.Exit, at least a panic, so the code managing the library can decide to continue with the panic execution or eventually recover.
Luet version:
luet version 0.22.0-g7f7e1418c1316149c5424bacaf7993f4daaa3e99 2021-12-27 10:49:33 UTC
CPU architecture, OS, and Version:
x86_64
Describe the bug
When using Luet as a library the use of
os.Exit
in several places limits the possibility of proper error handling. In fact I'd strictly limit the use theos.Exit
to very limited and known places and not inside any exposed code potentially used as a library. In rancher-sandbox/elemental-cli this is causing issues to properly handle errors caused by luet.To Reproduce
Run something like
elemental-cli install /dev/sda --docker-image quay.io/costoolkit/releases-green:cos-system-0.7.11-18
from https://github.com/rancher-sandbox/elemental-cli/pull/34 and the cosign plugin will fail causing the program to exit without unmounting any of the images and partitions that were mounted during the installation. In fact non of the deferred functions will be executed.Expected behavior
If there is an error on any of the exported luet packages this is not causing an
os.Exit
, at least a panic, so the code managing the library can decide to continue with the panic execution or eventually recover.Logs
Additional context