Code Duplication    Length = 12-12 lines in 2 locations

gvm/protocols/gmpv8/gmpv8.py 1 location

@@ 244-255 (lines=12) @@
241
        ) and password:
242
            cmd.add_element("password", password)
243
244
        if credential_type == CredentialType.USERNAME_SSH_KEY:
245
            if not private_key:
246
                raise RequiredArgument(
247
                    function=self.create_credential.__name__,
248
                    argument='private_key',
249
                )
250
251
            _xmlkey = cmd.add_element("key")
252
            _xmlkey.add_element("private", private_key)
253
254
            if key_phrase:
255
                _xmlkey.add_element("phrase", key_phrase)
256
257
        if credential_type == CredentialType.CLIENT_CERTIFICATE and private_key:
258
            _xmlkey = cmd.add_element("key")

gvm/protocols/gmpv7/gmpv7.py 1 location

@@ 665-676 (lines=12) @@
662
        ) and password:
663
            cmd.add_element("password", password)
664
665
        if credential_type == CredentialType.USERNAME_SSH_KEY:
666
            if not private_key:
667
                raise RequiredArgument(
668
                    function=self.create_credential.__name__,
669
                    argument="private_key",
670
                )
671
672
            _xmlkey = cmd.add_element("key")
673
            _xmlkey.add_element("private", private_key)
674
675
            if key_phrase:
676
                _xmlkey.add_element("phrase", key_phrase)
677
678
        if credential_type == CredentialType.CLIENT_CERTIFICATE and private_key:
679
            _xmlkey = cmd.add_element("key")