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

@@ 594-604 (lines=11) @@
591
        if (credential_type == 'up' or credential_type == 'snmp') and password:
592
            cmd.add_element('password', password)
593
594
        if credential_type == 'usk':
595
            if not private_key:
596
                raise RequiredArgument(
597
                    'create_credential requires certificate argument for '
598
                    'credential_type usk')
599
600
            _xmlkey = cmd.add_element('key')
601
            _xmlkey.add_element('private', private_key)
602
603
            if key_phrase:
604
                _xmlkey.add_element('phrase', key_phrase)
605
606
        if credential_type == 'cc' and private_key:
607
            _xmlkey = cmd.add_element('key')