Code Duplication    Length = 11-11 lines in 2 locations

gvm/protocols/gmpv8.py 1 location

@@ 209-219 (lines=11) @@
206
        if (credential_type == 'up' or credential_type == 'snmp') and password:
207
            cmd.add_element('password', password)
208
209
        if credential_type == 'usk':
210
            if not private_key:
211
                raise RequiredArgument(
212
                    'create_credential requires certificate argument for '
213
                    'credential_type usk')
214
215
            _xmlkey = cmd.add_element('key')
216
            _xmlkey.add_element('private', private_key)
217
218
            if key_phrase:
219
                _xmlkey.add_element('phrase', key_phrase)
220
221
        if credential_type == 'cc' and private_key:
222
            _xmlkey = cmd.add_element('key')

gvm/protocols/gmpv7.py 1 location

@@ 647-657 (lines=11) @@
644
        if (credential_type == 'up' or credential_type == 'snmp') and password:
645
            cmd.add_element('password', password)
646
647
        if credential_type == 'usk':
648
            if not private_key:
649
                raise RequiredArgument(
650
                    'create_credential requires certificate argument for '
651
                    'credential_type usk')
652
653
            _xmlkey = cmd.add_element('key')
654
            _xmlkey.add_element('private', private_key)
655
656
            if key_phrase:
657
                _xmlkey.add_element('phrase', key_phrase)
658
659
        if credential_type == 'cc' and private_key:
660
            _xmlkey = cmd.add_element('key')