Skip to content

Commit

Permalink
payload/rpm-ostree: Include program output in exception
Browse files Browse the repository at this point in the history
The rpm-ostree container deployment path can fail for many reasons
from networking to details in mount setup.

What we really want is a proper API with progress out of bootc/ostree;
I will work on that at some point.

In the meantime though, just capture stderr on failure and include
it in the payload installation error so people don't have to
dig into `program.log` which is very obscure.

Signed-off-by: Colin Walters <[email protected]>
  • Loading branch information
cgwalters committed Jan 7, 2025
1 parent 08db450 commit 3895360
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from pyanaconda.core.glib import GError, Variant, create_new_context, format_size_full
from pyanaconda.core.i18n import _
from pyanaconda.core.path import make_directories, set_system_root
from pyanaconda.core.util import execWithRedirect
from pyanaconda.core.util import execWithRedirect, execProgram
from pyanaconda.modules.common.constants.objects import BOOTLOADER, DEVICE_TREE
from pyanaconda.modules.common.constants.services import LOCALIZATION, STORAGE
from pyanaconda.modules.common.errors.installation import (
Expand All @@ -50,11 +50,12 @@ def safe_exec_with_redirect(cmd, argv, successful_return_codes=(0,), **kwargs):
:raise: PayloadInstallationError if the call fails for any reason
"""
rc = execWithRedirect(cmd, argv, **kwargs)
rc, output = execProgram([cmd] + argv, **kwargs)

if rc not in successful_return_codes:
raise PayloadInstallationError(
"The command '{}' exited with the code {}.".format(" ".join([cmd] + argv), rc)
"The command '{}' exited with the code {}:\n{}".format(" ".join([cmd] + argv), rc,
output)
)


Expand Down

0 comments on commit 3895360

Please sign in to comment.