|
@@ 448-465 (lines=18) @@
|
| 445 |
|
if community: |
| 446 |
|
cmd.add_element("community", community) |
| 447 |
|
|
| 448 |
|
if privacy_algorithm is not None or privacy_password: |
| 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 |
|
"create_credential requires algorithm to be a " |
| 455 |
|
"SnmpPrivacyAlgorithm instance", |
| 456 |
|
function="create_credential", |
| 457 |
|
argument="privacy_algorithm", |
| 458 |
|
) |
| 459 |
|
|
| 460 |
|
_xmlprivacy.add_element( |
| 461 |
|
"algorithm", privacy_algorithm.value |
| 462 |
|
) |
| 463 |
|
|
| 464 |
|
if privacy_password: |
| 465 |
|
_xmlprivacy.add_element("password", privacy_password) |
| 466 |
|
|
| 467 |
|
if credential_type == CredentialType.PGP_ENCRYPTION_KEY: |
| 468 |
|
if not public_key: |
|
@@ 581-596 (lines=16) @@
|
| 578 |
|
if community: |
| 579 |
|
cmd.add_element("community", community) |
| 580 |
|
|
| 581 |
|
if privacy_algorithm is not None or privacy_password is not None: |
| 582 |
|
_xmlprivacy = cmd.add_element("privacy") |
| 583 |
|
|
| 584 |
|
if privacy_algorithm is not None: |
| 585 |
|
if not isinstance(privacy_algorithm, SnmpPrivacyAlgorithm): |
| 586 |
|
raise InvalidArgument( |
| 587 |
|
"modify_credential requires privacy_algorithm to be " |
| 588 |
|
"a SnmpPrivacyAlgorithm instance", |
| 589 |
|
argument="privacy_algorithm", |
| 590 |
|
function="modify_credential", |
| 591 |
|
) |
| 592 |
|
|
| 593 |
|
_xmlprivacy.add_element("algorithm", privacy_algorithm.value) |
| 594 |
|
|
| 595 |
|
if privacy_password is not None: |
| 596 |
|
_xmlprivacy.add_element("password", privacy_password) |
| 597 |
|
|
| 598 |
|
if public_key: |
| 599 |
|
_xmlkey = cmd.add_element("key") |