Code Duplication    Length = 11-11 lines in 2 locations

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:

gvm/protocols/gmpv7.py 1 location

@@ 674-684 (lines=11) @@
671
        if (credential_type == "up" or credential_type == "snmp") and password:
672
            cmd.add_element("password", password)
673
674
        if credential_type == "usk":
675
            if not private_key:
676
                raise RequiredArgument(
677
                    "create_credential requires certificate argument for "
678
                    "credential_type usk"
679
                )
680
681
            _xmlkey = cmd.add_element("key")
682
            _xmlkey.add_element("private", private_key)
683
684
            if key_phrase:
685
                _xmlkey.add_element("phrase", key_phrase)
686
687
        if credential_type == "cc" and private_key: