Code Duplication    Length = 11-11 lines in 2 locations

gvm/protocols/gmpv8.py 1 location

@@ 129-139 (lines=11) @@
126
        if (credential_type == 'up' or credential_type == 'snmp') and password:
127
            cmd.add_element('password', password)
128
129
        if credential_type == 'usk':
130
            if not private_key:
131
                raise RequiredArgument(
132
                    'create_credential requires certificate argument for '
133
                    'credential_type usk')
134
135
            _xmlkey = cmd.add_element('key')
136
            _xmlkey.add_element('private', private_key)
137
138
            if key_phrase:
139
                _xmlkey.add_element('phrase', key_phrase)
140
141
        if credential_type == 'cc' and private_key:
142
            _xmlkey = cmd.add_element('key')

gvm/protocols/gmpv7.py 1 location

@@ 484-494 (lines=11) @@
481
        if (credential_type == 'up' or credential_type == 'snmp') and password:
482
            cmd.add_element('password', password)
483
484
        if credential_type == 'usk':
485
            if not private_key:
486
                raise RequiredArgument(
487
                    'create_credential requires certificate argument for '
488
                    'credential_type usk')
489
490
            _xmlkey = cmd.add_element('key')
491
            _xmlkey.add_element('private', private_key)
492
493
            if key_phrase:
494
                _xmlkey.add_element('phrase', key_phrase)
495
496
        if credential_type == 'cc' and private_key:
497
            _xmlkey = cmd.add_element('key')