|
@@ 320-335 (lines=16) @@
|
| 317 |
|
if community: |
| 318 |
|
cmd.add_element("community", community) |
| 319 |
|
|
| 320 |
|
if privacy_algorithm is not None or privacy_password: |
| 321 |
|
_xmlprivacy = cmd.add_element("privacy") |
| 322 |
|
|
| 323 |
|
if privacy_algorithm is not None: |
| 324 |
|
if not isinstance(privacy_algorithm, SnmpPrivacyAlgorithm): |
| 325 |
|
raise InvalidArgument( |
| 326 |
|
"create_credential requires algorithm to be a " |
| 327 |
|
"SnmpPrivacyAlgorithm instance" |
| 328 |
|
) |
| 329 |
|
|
| 330 |
|
_xmlprivacy.add_element( |
| 331 |
|
"algorithm", privacy_algorithm.value |
| 332 |
|
) |
| 333 |
|
|
| 334 |
|
if privacy_password: |
| 335 |
|
_xmlprivacy.add_element("password", privacy_password) |
| 336 |
|
|
| 337 |
|
if credential_type == CredentialType.PGP_ENCRYPTION_KEY: |
| 338 |
|
if not public_key: |
|
@@ 448-461 (lines=14) @@
|
| 445 |
|
if community: |
| 446 |
|
cmd.add_element("community", community) |
| 447 |
|
|
| 448 |
|
if privacy_algorithm is not None or privacy_password is not None: |
| 449 |
|
_xmlprivacy = cmd.add_element("privacy") |
| 450 |
|
|
| 451 |
|
if privacy_algorithm is not None: |
| 452 |
|
if not isinstance(privacy_algorithm, SnmpPrivacyAlgorithm): |
| 453 |
|
raise InvalidArgument( |
| 454 |
|
"modify_credential requires privacy_algorithm to be " |
| 455 |
|
"a SnmpPrivacyAlgorithm instance" |
| 456 |
|
) |
| 457 |
|
|
| 458 |
|
_xmlprivacy.add_element("algorithm", privacy_algorithm.value) |
| 459 |
|
|
| 460 |
|
if privacy_password is not None: |
| 461 |
|
_xmlprivacy.add_element("password", privacy_password) |
| 462 |
|
|
| 463 |
|
if public_key: |
| 464 |
|
_xmlkey = cmd.add_element("key") |