Skip to content

Commit

Permalink
fix: update error message logging, log subprocess output (#77)
Browse files Browse the repository at this point in the history
  • Loading branch information
gerblesh authored Oct 9, 2023
1 parent 63d40a1 commit 007e1e3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ install_requires =

[flake8]
max-line-length = 90
ignore = E501
10 changes: 4 additions & 6 deletions src/ublue_update/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,9 @@ def run_update_scripts(root_dir: str):
)
if out.returncode != 0:
log.error(
f"""{full_path} returned error code: {out.returncode}
Program output:
{out.stdout.decode("utf-8")}
""",
f"{full_path} returned error code: {out.returncode}, program output:" # noqa: E501
)
log.error(out.stdout.decode("utf-8"))
notify(
"System Updater",
f"Error in update script: {file}, check logs for more info",
Expand Down Expand Up @@ -165,7 +162,7 @@ def run_updates(args):
"""
)

subprocess.run(
out = subprocess.run(
[
"/usr/bin/sudo",
"-u",
Expand All @@ -178,6 +175,7 @@ def run_updates(args):
],
capture_output=True,
)
log.debug(out.stdout.decode("utf-8"))
notify(
"System Updater",
"System update complete, reboot for changes to take effect",
Expand Down
4 changes: 3 additions & 1 deletion src/ublue_update/update_checks/wait.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ def transaction():
"""Parse transaction state"""
return loads(status.stdout)["transaction"]
except (JSONDecodeError, KeyError):
log.error("can't get transaction, system not managed with rpm-ostree container native")
log.error(
"can't get transaction, system not managed with rpm-ostree container native"
)
return None


Expand Down

0 comments on commit 007e1e3

Please sign in to comment.