Code Duplication    Length = 42-42 lines in 2 locations

gvm/protocols/gmpv208/gmpv208.py 1 location

@@ 6158-6199 (lines=42) @@
6155
6156
        return self._send_xml_command(cmd)
6157
6158
    def modify_config_set_nvt_selection(
6159
        self, config_id: str, family: str, nvt_oids: List[str]
6160
    ) -> Any:
6161
        """Modifies the selected nvts of an existing scan config
6162
6163
        The manager updates the given family in the config to include only the
6164
        given NVTs.
6165
6166
        Arguments:
6167
            config_id: UUID of scan config to modify.
6168
            family: Name of the NVT family to include NVTs from
6169
            nvt_oids: List of NVTs to select for the family.
6170
        """
6171
        if not config_id:
6172
            raise RequiredArgument(
6173
                function=self.modify_config_set_nvt_selection.__name__,
6174
                argument='config_id',
6175
            )
6176
6177
        if not family:
6178
            raise RequiredArgument(
6179
                function=self.modify_config_set_nvt_selection.__name__,
6180
                argument='family argument',
6181
            )
6182
6183
        if not _is_list_like(nvt_oids):
6184
            raise InvalidArgumentType(
6185
                function=self.modify_config_set_nvt_selection.__name__,
6186
                argument='nvt_oids',
6187
                arg_type='list',
6188
            )
6189
6190
        cmd = XmlCommand("modify_config")
6191
        cmd.set_attribute("config_id", str(config_id))
6192
6193
        _xmlnvtsel = cmd.add_element("nvt_selection")
6194
        _xmlnvtsel.add_element("family", family)
6195
6196
        for nvt in nvt_oids:
6197
            _xmlnvtsel.add_element("nvt", attrs={"oid": nvt})
6198
6199
        return self._send_xml_command(cmd)
6200
6201
    def modify_config_set_family_selection(
6202
        self,

gvm/protocols/gmpv7/gmpv7.py 1 location

@@ 4724-4765 (lines=42) @@
4721
4722
        return self._send_xml_command(cmd)
4723
4724
    def modify_config_set_nvt_selection(
4725
        self, config_id: str, family: str, nvt_oids: List[str]
4726
    ) -> Any:
4727
        """Modifies the selected nvts of an existing scan config
4728
4729
        The manager updates the given family in the config to include only the
4730
        given NVTs.
4731
4732
        Arguments:
4733
            config_id: UUID of scan config to modify.
4734
            family: Name of the NVT family to include NVTs from
4735
            nvt_oids: List of NVTs to select for the family.
4736
        """
4737
        if not config_id:
4738
            raise RequiredArgument(
4739
                function=self.modify_config_set_nvt_selection.__name__,
4740
                argument='config_id',
4741
            )
4742
4743
        if not family:
4744
            raise RequiredArgument(
4745
                function=self.modify_config_set_nvt_selection.__name__,
4746
                argument='family argument',
4747
            )
4748
4749
        if not _is_list_like(nvt_oids):
4750
            raise InvalidArgumentType(
4751
                function=self.modify_config_set_nvt_selection.__name__,
4752
                argument='nvt_oids',
4753
                arg_type='list',
4754
            )
4755
4756
        cmd = XmlCommand("modify_config")
4757
        cmd.set_attribute("config_id", str(config_id))
4758
4759
        _xmlnvtsel = cmd.add_element("nvt_selection")
4760
        _xmlnvtsel.add_element("family", family)
4761
4762
        for nvt in nvt_oids:
4763
            _xmlnvtsel.add_element("nvt", attrs={"oid": nvt})
4764
4765
        return self._send_xml_command(cmd)
4766
4767
    def modify_config_set_family_selection(
4768
        self,