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

Fix resume task. (backport #464) #470

Merged
merged 2 commits into from
Oct 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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