Code Duplication    Length = 11-11 lines in 2 locations

gvm/protocols/gmpv7.py 1 location

@@ 655-665 (lines=11) @@
652
        if (credential_type == "up" or credential_type == "snmp") and password:
653
            cmd.add_element("password", password)
654
655
        if credential_type == "usk":
656
            if not private_key:
657
                raise RequiredArgument(
658
                    "create_credential requires certificate argument for "
659
                    "credential_type usk"
660
                )
661
662
            _xmlkey = cmd.add_element("key")
663
            _xmlkey.add_element("private", private_key)
664
665
            if key_phrase:
666
                _xmlkey.add_element("phrase", key_phrase)
667
668
        if credential_type == "cc" and private_key:

gvm/protocols/gmpv8.py 1 location

@@ 218-228 (lines=11) @@
215
        if (credential_type == "up" or credential_type == "snmp") and password:
216
            cmd.add_element("password", password)
217
218
        if credential_type == "usk":
219
            if not private_key:
220
                raise RequiredArgument(
221
                    "create_credential requires certificate argument for "
222
                    "credential_type usk"
223
                )
224
225
            _xmlkey = cmd.add_element("key")
226
            _xmlkey.add_element("private", private_key)
227
228
            if key_phrase:
229
                _xmlkey.add_element("phrase", key_phrase)
230
231
        if credential_type == "cc" and private_key: