Skip to content
This repository has been archived by the owner on May 21, 2024. It is now read-only.

Commit

Permalink
Try harder while getting aktualizr status/info (#1454)
Browse files Browse the repository at this point in the history
Try harder while getting aktualizr status/info
  • Loading branch information
lbonn authored Nov 21, 2019
2 parents fbcd070 + 8bc4583 commit e77f1e4
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions tests/test_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def run(self, run_mode):
subprocess.run([self._aktualizr_primary_exe, '-c', self._config_file, '--run-mode', run_mode],
check=True, env=self._run_env)

def get_info(self, retry=10):
def get_info(self, retry=15):
info_exe_res = None
for ii in range(0, retry):
info_exe_res = subprocess.run([self._aktualizr_info_exe, '-c', self._config_file],
Expand All @@ -151,6 +151,7 @@ def get_info(self, retry=10):
if info_exe_res and info_exe_res.returncode == 0:
return str(info_exe_res.stdout)
else:
logger.error(str(info_exe_res.stderr))
return None

# ugly stuff that could be removed if Aktualizr had exposed API to check status
Expand Down Expand Up @@ -197,9 +198,13 @@ def _get_current_image_info(self, ecu_id):
def get_current_primary_image_info(self):
primary_hash_field = 'Current primary ecu running version: '
aktualizr_status = self.get_info()
start = aktualizr_status.find(primary_hash_field)
end = aktualizr_status.find('\\n', start)
return aktualizr_status[start + len(primary_hash_field):end]
if aktualizr_status:
start = aktualizr_status.find(primary_hash_field)
end = aktualizr_status.find('\\n', start)
return aktualizr_status[start + len(primary_hash_field):end]
else:
logger.error("Failed to get aktualizr info/status")
return ""

# ugly stuff that could be removed if Aktualizr had exposed API to check status
# or aktializr-info had output status/info in a structured way (e.g. json)
Expand Down

0 comments on commit e77f1e4

Please sign in to comment.