Skip to content
This repository has been archived by the owner on Nov 29, 2021. It is now read-only.

Commit

Permalink
Merge pull request #470 from greenbone/mergify/bp/master/pr-464
Browse files Browse the repository at this point in the history
Fix resume task. (backport #464)
  • Loading branch information
y0urself committed Oct 13, 2021
2 parents 9ac74d3 + 37337a9 commit 1df8875
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Deprecated
### Removed
### Fixed
- Fix resume scan. [#464](https://github.com/greenbone/ospd/pull/464)


[Unreleased]: https://github.com/greenbone/ospd/compare/v21.4.3...HEAD

Expand Down
12 changes: 11 additions & 1 deletion ospd/scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,17 @@ def get_end_time(self, scan_id: str) -> str:
def get_host_list(self, scan_id: str) -> Dict:
"""Get a scan's host list."""

return self.scans_table[scan_id]['target'].get('hosts')
target = None
try:
target = self.scans_table[scan_id]['target'].get('hosts')
except KeyError:
logger.warning(
'%s: Scan ID is in the scan table, but it was '
'not initialized.',
scan_id,
)

return target

def get_host_count(self, scan_id: str) -> int:
"""Get total host count in the target."""
Expand Down

0 comments on commit 1df8875

Please sign in to comment.