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

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