Code Duplication    Length = 42-42 lines in 2 locations

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,

gvm/protocols/gmpv208/gmpv208.py 1 location

@@ 6190-6231 (lines=42) @@
6187
6188
        return self._send_xml_command(cmd)
6189
6190
    def modify_config_set_nvt_selection(
6191
        self, config_id: str, family: str, nvt_oids: List[str]
6192
    ) -> Any:
6193
        """Modifies the selected nvts of an existing scan config
6194
6195
        The manager updates the given family in the config to include only the
6196
        given NVTs.
6197
6198
        Arguments:
6199
            config_id: UUID of scan config to modify.
6200
            family: Name of the NVT family to include NVTs from
6201
            nvt_oids: List of NVTs to select for the family.
6202
        """
6203
        if not config_id:
6204
            raise RequiredArgument(
6205
                function=self.modify_config_set_nvt_selection.__name__,
6206
                argument='config_id',
6207
            )
6208
6209
        if not family:
6210
            raise RequiredArgument(
6211
                function=self.modify_config_set_nvt_selection.__name__,
6212
                argument='family argument',
6213
            )
6214
6215
        if not _is_list_like(nvt_oids):
6216
            raise InvalidArgumentType(
6217
                function=self.modify_config_set_nvt_selection.__name__,
6218
                argument='nvt_oids',
6219
                arg_type='list',
6220
            )
6221
6222
        cmd = XmlCommand("modify_config")
6223
        cmd.set_attribute("config_id", str(config_id))
6224
6225
        _xmlnvtsel = cmd.add_element("nvt_selection")
6226
        _xmlnvtsel.add_element("family", family)
6227
6228
        for nvt in nvt_oids:
6229
            _xmlnvtsel.add_element("nvt", attrs={"oid": nvt})
6230
6231
        return self._send_xml_command(cmd)
6232
6233
    def modify_config_set_family_selection(
6234
        self,