Skip to content

Commit

Permalink
Rename count_total_excluded -> count_excluded
Browse files Browse the repository at this point in the history
With a past PR the progress calculation was adjusted and introduced a new count_total_excluded, which replaced the count_excluded field. This caused issues parsing the XML.
As the name count_total was completely replaced by count_total_excluded, renaming it fixed this issue.
  • Loading branch information
Chris Chandler committed Mar 11, 2024
1 parent 83a90f4 commit a97892a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions ospd/ospd.py
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,7 @@ def _get_scan_progress_raw(self, scan_id: str) -> Dict:
current_progress['count_dead'] = self.scan_collection.get_count_dead(
scan_id
)
current_progress['count_total_excluded'] = (
current_progress['count_excluded'] = (
self.scan_collection.get_simplified_exclude_host_count(scan_id)
)

Expand Down Expand Up @@ -1262,7 +1262,7 @@ def set_scan_total_excluded_hosts(
) -> None:
"""Sets a scan's total excluded hosts. Allow the scanner to update
the total excluded count of hosts from the host to be scanned."""
self.scan_collection.update_count_total_excluded(
self.scan_collection.update_count_excluded(
scan_id, excluded_hosts
)

Expand Down
10 changes: 5 additions & 5 deletions ospd/scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ def unpickle_scan_info(self, scan_id: str) -> None:
scan_info['count_alive'] = 0
scan_info['count_dead'] = 0
scan_info['count_total'] = None
scan_info['count_total_excluded'] = 0
scan_info['count_excluded'] = 0
scan_info['excluded_simplified'] = None
scan_info['target'] = unpickled_scan_info.pop('target')
scan_info['vts'] = unpickled_scan_info.pop('vts')
Expand Down Expand Up @@ -384,17 +384,17 @@ def update_count_total(self, scan_id: str, count_total: int) -> int:

self.scans_table[scan_id]['count_total'] = count_total

def update_count_total_excluded(
def update_count_excluded(
self, scan_id: str, count_excluded: int
) -> int:
"""Sets a scan's total hosts."""

self.scans_table[scan_id]['count_total_excluded'] = count_excluded
self.scans_table[scan_id]['count_excluded'] = count_excluded

def get_count_total_excluded(self, scan_id: str) -> int:
def get_count_excluded(self, scan_id: str) -> int:
"""Get a scan's total host count."""

count_excluded = self.scans_table[scan_id]['count_total_excluded']
count_excluded = self.scans_table[scan_id]['count_excluded']
return count_excluded

def get_count_total(self, scan_id: str) -> int:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_scan_and_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -1370,7 +1370,7 @@ def test_get_scan_progress_xml(self):
current_hosts = progress.findall('host')
self.assertEqual(len(current_hosts), 2)

count_excluded = progress.findtext('count_total_excluded')
count_excluded = progress.findtext('count_excluded')
self.assertEqual(count_excluded, '0')

def test_set_get_vts_version(self):
Expand Down

0 comments on commit a97892a

Please sign in to comment.