@@ 1338-1356 (lines=19) @@ | ||
1335 | if community: |
|
1336 | cmd.add_element("community", community) |
|
1337 | ||
1338 | if privacy_algorithm is not None or privacy_password: |
|
1339 | _xmlprivacy = cmd.add_element("privacy") |
|
1340 | ||
1341 | if privacy_algorithm is not None: |
|
1342 | if not isinstance( |
|
1343 | privacy_algorithm, self.types.SnmpPrivacyAlgorithm |
|
1344 | ): |
|
1345 | raise InvalidArgumentType( |
|
1346 | function=self.create_credential.__name__, |
|
1347 | argument='privacy_algorithm', |
|
1348 | arg_type=SnmpPrivacyAlgorithm.__name__, |
|
1349 | ) |
|
1350 | ||
1351 | _xmlprivacy.add_element( |
|
1352 | "algorithm", privacy_algorithm.value |
|
1353 | ) |
|
1354 | ||
1355 | if privacy_password: |
|
1356 | _xmlprivacy.add_element("password", privacy_password) |
|
1357 | ||
1358 | if credential_type == CredentialType.PGP_ENCRYPTION_KEY: |
|
1359 | if not public_key: |
|
@@ 1460-1476 (lines=17) @@ | ||
1457 | if community: |
|
1458 | cmd.add_element("community", community) |
|
1459 | ||
1460 | if privacy_algorithm is not None or privacy_password is not None: |
|
1461 | _xmlprivacy = cmd.add_element("privacy") |
|
1462 | ||
1463 | if privacy_algorithm is not None: |
|
1464 | if not isinstance( |
|
1465 | privacy_algorithm, self.types.SnmpPrivacyAlgorithm |
|
1466 | ): |
|
1467 | raise InvalidArgumentType( |
|
1468 | function=self.modify_credential.__name__, |
|
1469 | argument='privacy_algorithm', |
|
1470 | arg_type=SnmpPrivacyAlgorithm.__name__, |
|
1471 | ) |
|
1472 | ||
1473 | _xmlprivacy.add_element("algorithm", privacy_algorithm.value) |
|
1474 | ||
1475 | if privacy_password is not None: |
|
1476 | _xmlprivacy.add_element("password", privacy_password) |
|
1477 | ||
1478 | if public_key: |
|
1479 | _xmlkey = cmd.add_element("key") |