Skip to content

Commit

Permalink
Merge pull request avocado-framework#3122 from dzhengfy/enhance_pkg_i…
Browse files Browse the repository at this point in the history
…nstall_error

utils_package: print error log
  • Loading branch information
dzhengfy authored Aug 9, 2021
2 parents 7354676 + 6dcfec0 commit 0495e03
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions virttest/utils_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,21 @@ def operate(self, timeout, default_status, internal_timeout=2):
need = True
if need:
cmd = self.cmd + pkg
if self.session.cmd_status(cmd, timeout, internal_timeout):
status, output = self.session.cmd_status_output(cmd,
timeout,
internal_timeout)
if status:
logging.error("'%s' execution failed "
"with %s", cmd, output)
# Try to clean the repo db and re-try installation
if not self.clean():
logging.error("Package %s was broken",
self.package_manager)
return False
if self.session.cmd_status(cmd, timeout):
logging.error("Operate %s with %s failed", pkg, cmd)
status, output = self.session.cmd_status_output(cmd, timeout)
if status:
logging.error("'%s' execution failed "
"with %s", cmd, output)
return False
return True

Expand Down

0 comments on commit 0495e03

Please sign in to comment.