@@ 2601-2619 (lines=19) @@ | ||
2598 | if community: |
|
2599 | cmd.add_element("community", community) |
|
2600 | ||
2601 | if privacy_algorithm is not None or privacy_password: |
|
2602 | _xmlprivacy = cmd.add_element("privacy") |
|
2603 | ||
2604 | if privacy_algorithm is not None: |
|
2605 | if not isinstance( |
|
2606 | privacy_algorithm, self.types.SnmpPrivacyAlgorithm |
|
2607 | ): |
|
2608 | raise InvalidArgumentType( |
|
2609 | function=self.create_credential.__name__, |
|
2610 | argument='privacy_algorithm', |
|
2611 | arg_type=SnmpPrivacyAlgorithm.__name__, |
|
2612 | ) |
|
2613 | ||
2614 | _xmlprivacy.add_element( |
|
2615 | "algorithm", privacy_algorithm.value |
|
2616 | ) |
|
2617 | ||
2618 | if privacy_password: |
|
2619 | _xmlprivacy.add_element("password", privacy_password) |
|
2620 | ||
2621 | if credential_type == CredentialType.PGP_ENCRYPTION_KEY: |
|
2622 | if not public_key: |
|
@@ 2723-2739 (lines=17) @@ | ||
2720 | if community: |
|
2721 | cmd.add_element("community", community) |
|
2722 | ||
2723 | if privacy_algorithm is not None or privacy_password is not None: |
|
2724 | _xmlprivacy = cmd.add_element("privacy") |
|
2725 | ||
2726 | if privacy_algorithm is not None: |
|
2727 | if not isinstance( |
|
2728 | privacy_algorithm, self.types.SnmpPrivacyAlgorithm |
|
2729 | ): |
|
2730 | raise InvalidArgumentType( |
|
2731 | function=self.modify_credential.__name__, |
|
2732 | argument='privacy_algorithm', |
|
2733 | arg_type=SnmpPrivacyAlgorithm.__name__, |
|
2734 | ) |
|
2735 | ||
2736 | _xmlprivacy.add_element("algorithm", privacy_algorithm.value) |
|
2737 | ||
2738 | if privacy_password is not None: |
|
2739 | _xmlprivacy.add_element("password", privacy_password) |
|
2740 | ||
2741 | if public_key: |
|
2742 | _xmlkey = cmd.add_element("key") |