Code Duplication    Length = 21-21 lines in 2 locations

gvm/xml.py 2 locations

@@ 1089-1109 (lines=21) @@
1086
1087
        return cmd.to_string()
1088
1089
    def modify_role_command(self, role_id, kwargs):
1090
        """Generates xml string for modify role on gvmd."""
1091
        if not role_id:
1092
            raise ValueError('modify_role requires a role_id element')
1093
1094
        cmd = XmlCommand('modify_role')
1095
        cmd.set_attribute('role_id', role_id)
1096
1097
        comment = kwargs.get('comment', '')
1098
        if comment:
1099
            cmd.add_element('comment', comment)
1100
1101
        name = kwargs.get('name', '')
1102
        if name:
1103
            cmd.add_element('name', name)
1104
1105
        users = kwargs.get('users', '')
1106
        if users:
1107
            cmd.add_element('users', users)
1108
1109
        return cmd.to_string()
1110
1111
    def modify_scanner_command(self, scanner_id, host, port, scanner_type,
1112
                               kwargs):
@@ 893-913 (lines=21) @@
890
891
        return cmd.to_string()
892
893
    def modify_group_command(self, group_id, kwargs):
894
        """Generates xml string for modify group on gvmd."""
895
        if not group_id:
896
            raise ValueError('modify_group requires a group_id attribute')
897
898
        cmd = XmlCommand('modify_group')
899
        cmd.set_attribute('group_id', group_id)
900
901
        comment = kwargs.get('comment', '')
902
        if comment:
903
            cmd.add_element('comment', comment)
904
905
        name = kwargs.get('name', '')
906
        if name:
907
            cmd.add_element('name', name)
908
909
        users = kwargs.get('users', '')
910
        if users:
911
            cmd.add_element('users', users)
912
913
        return cmd.to_string()
914
915
    def modify_note_command(self, note_id, text, kwargs):
916
        """Generates xml string for modify note on gvmd."""