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

@@ 514-524 (lines=11) @@
511
        if (credential_type == 'up' or credential_type == 'snmp') and password:
512
            cmd.add_element('password', password)
513
514
        if credential_type == 'usk':
515
            if not private_key:
516
                raise RequiredArgument(
517
                    'create_credential requires certificate argument for '
518
                    'credential_type usk')
519
520
            _xmlkey = cmd.add_element('key')
521
            _xmlkey.add_element('private', private_key)
522
523
            if key_phrase:
524
                _xmlkey.add_element('phrase', key_phrase)
525
526
        if credential_type == 'cc' and private_key:
527
            _xmlkey = cmd.add_element('key')