diff --git a/files/gvm_library.py b/files/gvm_library.py index 975ead45c1248765f3d5d6944ab099ae73753cba..229c24d88961fcf6b5c7167e63262d1a2b8a9660 100644 --- a/files/gvm_library.py +++ b/files/gvm_library.py @@ -38,6 +38,10 @@ GVM_STATUS_CREATE_OK = "201" OBJ_ALREADY_CREATED = "Already created. Collected from server" FIRST_OBJ_CONSIDERED = "The first one will be considered" +# Notification Type +CLASSIC_NOTICATION = "Complete" +ONLY_NEW_NOTICATION = "Incremental" + # Custom Exceptions class GvmException(Exception): pass @@ -811,12 +815,12 @@ class ReportManager(): logging.debug(f"NOTIFICATION TYPE: {self.notification_type}") self.oids_to_notify = None - if self.notification_type == "Complete" \ + if self.notification_type == CLASSIC_NOTICATION \ and self.summary[self.REPORT_GLOBAL] == self.MSG_NOK: self.summary[self.REPORT_NOTIFICATION] = self.NOTIFY_YES self.oids_to_notify = self.classified_oids - elif self.notification_type == "Incremental" \ + elif self.notification_type == ONLY_NEW_NOTICATION \ and self.is_os \ and len(self.discovered_oids) > 0: self.summary[self.REPORT_NOTIFICATION] = self.NOTIFY_YES diff --git a/files/scan.py b/files/scan.py index 542d7a786f6bd7823a6191a078ea49d0a7c236c6..6fe424ff2b4f8068a918e3ef3def67f9fb833bb5 100644 --- a/files/scan.py +++ b/files/scan.py @@ -6,6 +6,7 @@ import os from gvm_library import GVMClient, ReportFormats, GvmException from gvm_library import PortList, Task, Target from gvm_library import ReportManager +from gvm_library import CLASSIC_NOTICATION, ONLY_NEW_NOTICATION from utilities import import_dep_info import argparse @@ -51,8 +52,8 @@ parser.add_argument( parser.add_argument( "--notification-type", - choices=["Complete", "Incremental"], - default="Complete" + choices=[CLASSIC_NOTICATION, ONLY_NEW_NOTICATION], + default=CLASSIC_NOTICATION ) args = parser.parse_args()