Laszlo Ersek 8bcf383510 lib/utils: make "chown_for_libvirt_rhbz_1045069" fail hard
Currently "chown_for_libvirt_rhbz_1045069" is best effort; if it fails, we
suppress the exception (we log it in verbose mode only, even).

That's not proved helpful: it almost certainly leads to later errors, but
those errors are less clear than the original (suppressed) exception.
Namely, the user sees something like

> Failed to connect to '/tmp/v2v.sKlulY/in0': Permission denied

rather than

> Failed to connect socket to '/var/run/libvirt/virtqemud-sock-ro':
> Connection refused

So just allow the exception to propagate outwards.

And then, now that "chown_for_libvirt_rhbz_1045069" will be able to fail,
hoist the call to "On_exit.rm_rf" before the call to
"chown_for_libvirt_rhbz_1045069", after creating the v2v temporary
directory. In the current order, if "chown_for_libvirt_rhbz_1045069" threw
an exception, then we'd leak the temp dir in the filesystem.

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2182024
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20230629123443.188350-3-lersek@redhat.com>
[lersek@redhat.com: reinstate parens under "then" [Rich]]
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
2023-06-30 10:49:52 +02:00
..
2021-09-07 11:24:03 +01:00
2021-09-07 11:24:03 +01:00
2021-09-07 11:24:03 +01:00
2021-09-07 11:24:03 +01:00
2023-01-20 10:29:24 +00:00
2022-12-09 22:01:04 +00:00
2022-12-09 22:01:04 +00:00