Code Duplication    Length = 21-21 lines in 2 locations

gvm/xml.py 2 locations

@@ 755-775 (lines=21) @@
752
753
        return cmd.to_string()
754
755
    def modify_role_command(self, role_id, kwargs):
756
        """Generates xml string for modify role on gvmd."""
757
        if not role_id:
758
            raise ValueError('modify_role requires a role_id element')
759
760
        cmd = XmlCommand('modify_role')
761
        cmd.set_attribute('role_id', role_id)
762
763
        comment = kwargs.get('comment', '')
764
        if comment:
765
            cmd.add_element('comment', comment)
766
767
        name = kwargs.get('name', '')
768
        if name:
769
            cmd.add_element('name', name)
770
771
        users = kwargs.get('users', '')
772
        if users:
773
            cmd.add_element('users', users)
774
775
        return cmd.to_string()
776
777
    def modify_scanner_command(self, scanner_id, host, port, scanner_type,
778
                               kwargs):
@@ 559-579 (lines=21) @@
556
557
        return cmd.to_string()
558
559
    def modify_group_command(self, group_id, kwargs):
560
        """Generates xml string for modify group on gvmd."""
561
        if not group_id:
562
            raise ValueError('modify_group requires a group_id attribute')
563
564
        cmd = XmlCommand('modify_group')
565
        cmd.set_attribute('group_id', group_id)
566
567
        comment = kwargs.get('comment', '')
568
        if comment:
569
            cmd.add_element('comment', comment)
570
571
        name = kwargs.get('name', '')
572
        if name:
573
            cmd.add_element('name', name)
574
575
        users = kwargs.get('users', '')
576
        if users:
577
            cmd.add_element('users', users)
578
579
        return cmd.to_string()
580
581
    def modify_note_command(self, note_id, text, kwargs):
582
        """Generates xml string for modify note on gvmd."""