Code Duplication    Length = 12-12 lines in 2 locations

gvm/protocols/gmpv7/__init__.py 1 location

@@ 655-666 (lines=12) @@
652
        ) and password:
653
            cmd.add_element("password", password)
654
655
        if credential_type == CredentialType.USERNAME_SSH_KEY:
656
            if not private_key:
657
                raise RequiredArgument(
658
                    function=self.create_credential.__name__,
659
                    argument="private_key",
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 == CredentialType.CLIENT_CERTIFICATE and private_key:
669
            _xmlkey = cmd.add_element("key")

gvm/protocols/gmpv8/__init__.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")