Code Duplication    Length = 21-21 lines in 2 locations

gvm/xml.py 2 locations

@@ 502-522 (lines=21) @@
499
500
        return cmd.to_string()
501
502
    def modify_role_command(self, role_id, kwargs):
503
        """Generates xml string for modify role on gvmd."""
504
        if not role_id:
505
            raise ValueError('modify_role requires a role_id element')
506
507
        cmd = XmlCommand('modify_role')
508
        cmd.set_attribute('role_id', role_id)
509
510
        comment = kwargs.get('comment', '')
511
        if comment:
512
            cmd.add_element('comment', comment)
513
514
        name = kwargs.get('name', '')
515
        if name:
516
            cmd.add_element('name', name)
517
518
        users = kwargs.get('users', '')
519
        if users:
520
            cmd.add_element('users', users)
521
522
        return cmd.to_string()
523
524
    def modify_scanner_command(self, scanner_id, host, port, scanner_type,
525
                               kwargs):
@@ 306-326 (lines=21) @@
303
304
        return cmd.to_string()
305
306
    def modify_group_command(self, group_id, kwargs):
307
        """Generates xml string for modify group on gvmd."""
308
        if not group_id:
309
            raise ValueError('modify_group requires a group_id attribute')
310
311
        cmd = XmlCommand('modify_group')
312
        cmd.set_attribute('group_id', group_id)
313
314
        comment = kwargs.get('comment', '')
315
        if comment:
316
            cmd.add_element('comment', comment)
317
318
        name = kwargs.get('name', '')
319
        if name:
320
            cmd.add_element('name', name)
321
322
        users = kwargs.get('users', '')
323
        if users:
324
            cmd.add_element('users', users)
325
326
        return cmd.to_string()
327
328
    def modify_note_command(self, note_id, text, kwargs):
329
        """Generates xml string for modify note on gvmd."""