@@ 915-933 (lines=19) @@ | ||
912 | if community: |
|
913 | cmd.add_element("community", community) |
|
914 | ||
915 | if privacy_algorithm is not None or privacy_password: |
|
916 | _xmlprivacy = cmd.add_element("privacy") |
|
917 | ||
918 | if privacy_algorithm is not None: |
|
919 | if not isinstance( |
|
920 | privacy_algorithm, self.types.SnmpPrivacyAlgorithm |
|
921 | ): |
|
922 | raise InvalidArgumentType( |
|
923 | function=self.create_credential.__name__, |
|
924 | argument='privacy_algorithm', |
|
925 | arg_type=SnmpPrivacyAlgorithm.__name__, |
|
926 | ) |
|
927 | ||
928 | _xmlprivacy.add_element( |
|
929 | "algorithm", privacy_algorithm.value |
|
930 | ) |
|
931 | ||
932 | if privacy_password: |
|
933 | _xmlprivacy.add_element("password", privacy_password) |
|
934 | ||
935 | if credential_type == CredentialType.PGP_ENCRYPTION_KEY: |
|
936 | if not public_key: |
|
@@ 1037-1053 (lines=17) @@ | ||
1034 | if community: |
|
1035 | cmd.add_element("community", community) |
|
1036 | ||
1037 | if privacy_algorithm is not None or privacy_password is not None: |
|
1038 | _xmlprivacy = cmd.add_element("privacy") |
|
1039 | ||
1040 | if privacy_algorithm is not None: |
|
1041 | if not isinstance( |
|
1042 | privacy_algorithm, self.types.SnmpPrivacyAlgorithm |
|
1043 | ): |
|
1044 | raise InvalidArgumentType( |
|
1045 | function=self.modify_credential.__name__, |
|
1046 | argument='privacy_algorithm', |
|
1047 | arg_type=SnmpPrivacyAlgorithm.__name__, |
|
1048 | ) |
|
1049 | ||
1050 | _xmlprivacy.add_element("algorithm", privacy_algorithm.value) |
|
1051 | ||
1052 | if privacy_password is not None: |
|
1053 | _xmlprivacy.add_element("password", privacy_password) |
|
1054 | ||
1055 | if public_key: |
|
1056 | _xmlkey = cmd.add_element("key") |