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

Fix progress and improvements. #101

Merged
merged 6 commits into from
Apr 15, 2019
Merged

Conversation

jjnicola
Copy link
Member

@jjnicola jjnicola commented Apr 12, 2019

  • Use enum for scan status.
  • Update the test accordingly.
  • Remove legacy_target string from the scan_info table.
  • Fix progress calculation for legacy target mode.
  • Check for scan status before trying to deleted.

Add new status init for the new scan still not launched.
Update the test accordingly.
@jjnicola jjnicola changed the title Use enum for scan status. Resume Task - Part 2 Apr 12, 2019
@codecov
Copy link

codecov bot commented Apr 12, 2019

Codecov Report

Merging #101 into master will decrease coverage by <.01%.
The diff coverage is 75%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #101      +/-   ##
==========================================
- Coverage   67.38%   67.37%   -0.01%     
==========================================
  Files           8        8              
  Lines        1533     1548      +15     
==========================================
+ Hits         1033     1043      +10     
- Misses        500      505       +5
Impacted Files Coverage Δ
ospd/ospd.py 66.3% <62.5%> (+0.08%) ⬆️
ospd/misc.py 67.59% <85.71%> (-0.15%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6f2eaed...056182f. Read the comment docs.

This improve target handling and make easier to work with legacy targets.
Update tests accordingly.
Also fix an issue which finished target forced others scans to stop.
@jjnicola jjnicola changed the title Resume Task - Part 2 Fix progress and improvements. Apr 15, 2019
Copy link
Contributor

@bjoernricks bjoernricks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only one small mistake Dict instead of dict

ospd/misc.py Outdated
""" Creates a new scan with provided scan information. """

if self.data_manager is None:
self.data_manager = multiprocessing.Manager()
if not options:
options = Dict()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
options = Dict()
options = dict()

ospd/misc.py Outdated
return self.scans_table[scan_id]['target_progress']
total_hosts = len(target_str_to_list(target))
host_progresses = self.scans_table[scan_id]['target_progress'].get(target)
t_prog = sum(host_progresses.values()) / total_hosts
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you check and ensure that total_hosts will never be zero?

ospd/misc.py Outdated
@@ -202,14 +215,11 @@ def get_end_time(self, scan_id):

def get_target(self, scan_id):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally I would rename the method to get_targets or get_target_list.

Check for division by zero error.
Fix typo for dict().
Rename get_target() to get_target_list().
@jjnicola jjnicola merged commit 4bbe718 into greenbone:master Apr 15, 2019
@jjnicola jjnicola deleted the resume-tasks branch April 15, 2019 13:50
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants