Code Duplication    Length = 11-11 lines in 2 locations

gvm/protocols/gmpv7.py 1 location

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

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')