File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -54,16 +54,20 @@ def create_credentials_element(_xmlcredentials, credentials):
5454def create_vt_selection_element (_xmlvtselection , vt_selection ):
5555 """Generates an xml element with a selection of Vulnerability tests."""
5656 for vt_id , vt_values in vt_selection .items ():
57- if vt_id != 'vt_groups' :
57+ if vt_id != 'vt_groups' and isinstance ( vt_values , dict ) :
5858 _xmlvt = _xmlvtselection .add_element ('vt_single' ,
5959 attrs = {'id' : vt_id })
6060 if vt_values :
6161 for key , value in vt_values .items ():
6262 _xmlvt .add_element ('vt_value' , value , attrs = {'id' : key })
63- else :
63+ elif vt_id == 'vt_groups' and isinstance ( vt_values , list ) :
6464 for group in vt_values :
6565 _xmlvt = _xmlvtselection .add_element (
6666 'vt_group' , attrs = {'filter' : group })
67+ else :
68+ raise InvalidArgument (
69+ 'It was not possible to add {} to the VTs '
70+ 'selection.' .format (vt_id ))
6771
6872 return _xmlvtselection
6973
You can’t perform that action at this time.
0 commit comments