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

@@ 636-646 (lines=11) @@
633
        if (credential_type == 'up' or credential_type == 'snmp') and password:
634
            cmd.add_element('password', password)
635
636
        if credential_type == 'usk':
637
            if not private_key:
638
                raise RequiredArgument(
639
                    'create_credential requires certificate argument for '
640
                    'credential_type usk')
641
642
            _xmlkey = cmd.add_element('key')
643
            _xmlkey.add_element('private', private_key)
644
645
            if key_phrase:
646
                _xmlkey.add_element('phrase', key_phrase)
647
648
        if credential_type == 'cc' and private_key:
649
            _xmlkey = cmd.add_element('key')