Skip to content

Commit

Permalink
ltmpl: Add transaction error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
bcl committed Jul 14, 2023
1 parent 132c55a commit 347fa4d
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/pylorax/ltmpl.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import struct

import libdnf5 as dnf5
from libdnf5.base import GoalProblem_NO_PROBLEM as NO_PROBLEM
from libdnf5.common import QueryCmp_EQ as EQ
from libdnf5.common import QueryCmp_GT as GT
from libdnf5.common import QueryCmp_LT as LT
Expand Down Expand Up @@ -787,12 +788,12 @@ def run_pkg_transaction(self):
Actually install all the packages requested by previous 'installpkg'
commands.
'''
try:
logger.info("Checking dependencies")
self.transaction = self.goal.resolve()
except Exception as e:
logger.error("Dependency check failed: %s", e)
raise
logger.info("Checking dependencies")
self.transaction = self.goal.resolve()
if self.transaction.get_problems() != NO_PROBLEM:
err = "\n".join(self.transaction.get_resolve_logs_as_strings())
logger.error("Dependency check failed: %s", err)
raise RuntimeError(err)
num_pkgs = len(self.transaction.get_transaction_packages())
logger.info("%d packages selected", num_pkgs)
if num_pkgs == 0:
Expand Down

0 comments on commit 347fa4d

Please sign in to comment.