Code Duplication    Length = 47-47 lines in 2 locations

gvm/protocols/gmpv7/gmpv7.py 1 location

@@ 4593-4639 (lines=47) @@
4590
4591
        return self._send_xml_command(cmd)
4592
4593
    def modify_config_set_nvt_preference(
4594
        self,
4595
        config_id: str,
4596
        name: str,
4597
        nvt_oid: str,
4598
        *,
4599
        value: Optional[str] = None,
4600
    ) -> Any:
4601
        """Modifies the nvt preferences of an existing scan config.
4602
4603
        Arguments:
4604
            config_id: UUID of scan config to modify.
4605
            name: Name for nvt preference to change.
4606
            nvt_oid: OID of the NVT associated with preference to modify
4607
            value: New value for the preference. None to delete the preference
4608
                and to use the default instead.
4609
        """
4610
        if not config_id:
4611
            raise RequiredArgument(
4612
                function=self.modify_config_set_nvt_preference.__name__,
4613
                argument='config_id',
4614
            )
4615
4616
        if not nvt_oid:
4617
            raise RequiredArgument(
4618
                function=self.modify_config_set_nvt_preference.__name__,
4619
                argument='nvt_oid',
4620
            )
4621
4622
        if not name:
4623
            raise RequiredArgument(
4624
                function=self.modify_config_set_nvt_preference.__name__,
4625
                argument='name',
4626
            )
4627
4628
        cmd = XmlCommand("modify_config")
4629
        cmd.set_attribute("config_id", str(config_id))
4630
4631
        _xmlpref = cmd.add_element("preference")
4632
4633
        _xmlpref.add_element("nvt", attrs={"oid": nvt_oid})
4634
        _xmlpref.add_element("name", name)
4635
4636
        if value:
4637
            _xmlpref.add_element("value", _to_base64(value))
4638
4639
        return self._send_xml_command(cmd)
4640
4641
    def modify_config_set_name(self, config_id: str, name: str) -> Any:
4642
        """Modifies the name of an existing scan config

gvm/protocols/gmpv208/gmpv208.py 1 location

@@ 6059-6105 (lines=47) @@
6056
6057
        return self._send_xml_command(cmd)
6058
6059
    def modify_config_set_nvt_preference(
6060
        self,
6061
        config_id: str,
6062
        name: str,
6063
        nvt_oid: str,
6064
        *,
6065
        value: Optional[str] = None,
6066
    ) -> Any:
6067
        """Modifies the nvt preferences of an existing scan config.
6068
6069
        Arguments:
6070
            config_id: UUID of scan config to modify.
6071
            name: Name for nvt preference to change.
6072
            nvt_oid: OID of the NVT associated with preference to modify
6073
            value: New value for the preference. None to delete the preference
6074
                and to use the default instead.
6075
        """
6076
        if not config_id:
6077
            raise RequiredArgument(
6078
                function=self.modify_config_set_nvt_preference.__name__,
6079
                argument='config_id',
6080
            )
6081
6082
        if not nvt_oid:
6083
            raise RequiredArgument(
6084
                function=self.modify_config_set_nvt_preference.__name__,
6085
                argument='nvt_oid',
6086
            )
6087
6088
        if not name:
6089
            raise RequiredArgument(
6090
                function=self.modify_config_set_nvt_preference.__name__,
6091
                argument='name',
6092
            )
6093
6094
        cmd = XmlCommand("modify_config")
6095
        cmd.set_attribute("config_id", str(config_id))
6096
6097
        _xmlpref = cmd.add_element("preference")
6098
6099
        _xmlpref.add_element("nvt", attrs={"oid": nvt_oid})
6100
        _xmlpref.add_element("name", name)
6101
6102
        if value:
6103
            _xmlpref.add_element("value", _to_base64(value))
6104
6105
        return self._send_xml_command(cmd)
6106
6107
    def modify_config_set_name(self, config_id: str, name: str) -> Any:
6108
        """Modifies the name of an existing scan config