|
1 | 1 | """
|
2 |
| -Copyright (c) 2017, 2024, Oracle and/or its affiliates. |
| 2 | +Copyright (c) 2017, 2025, Oracle and/or its affiliates. |
3 | 3 | Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
|
4 | 4 | """
|
5 | 5 | import os
|
|
26 | 26 | from wlsdeploy.aliases.location_context import LocationContext
|
27 | 27 | from wlsdeploy.aliases.model_constants import APPLICATION
|
28 | 28 | from wlsdeploy.aliases.model_constants import APP_DEPLOYMENTS
|
| 29 | +from wlsdeploy.aliases.model_constants import CERTIFICATE_MANAGEMENT |
29 | 30 | from wlsdeploy.aliases.model_constants import CLUSTER
|
30 | 31 | from wlsdeploy.aliases.model_constants import DYNAMIC_CLUSTER_SIZE
|
31 | 32 | from wlsdeploy.aliases.model_constants import DYNAMIC_SERVERS
|
| 33 | +from wlsdeploy.aliases.model_constants import ENABLED |
32 | 34 | from wlsdeploy.aliases.model_constants import FILE_URI
|
33 | 35 | from wlsdeploy.aliases.model_constants import JDBC_RESOURCE
|
34 | 36 | from wlsdeploy.aliases.model_constants import JDBC_DATASOURCE_PARAMS
|
|
41 | 43 | from wlsdeploy.aliases.model_constants import LIBRARY
|
42 | 44 | from wlsdeploy.aliases.model_constants import MACHINE
|
43 | 45 | from wlsdeploy.aliases.model_constants import MAX_DYNAMIC_SERVER_COUNT
|
| 46 | +from wlsdeploy.aliases.model_constants import SECURITY_CONFIGURATION |
44 | 47 | from wlsdeploy.aliases.model_constants import SERVER
|
45 | 48 | from wlsdeploy.aliases.model_constants import SERVER_NAME_PREFIX
|
46 | 49 | from wlsdeploy.aliases.model_constants import SERVER_NAME_START_IDX
|
@@ -720,6 +723,33 @@ def check_if_dynamic_cluster(server_name, cluster_name, aliases):
|
720 | 723 | return True
|
721 | 724 | return False
|
722 | 725 |
|
| 726 | +def set_certificate_management_enabled(topology, domain_name, wlst_helper, aliases): |
| 727 | + """ |
| 728 | + Certificate management must be enabled when Server / KeyStores is set to "DomainKeystores" |
| 729 | + in order to pass validation at writeDomain or updateDomain. |
| 730 | + """ |
| 731 | + security_config_folder = dictionary_utils.get_dictionary_element(topology, SECURITY_CONFIGURATION) |
| 732 | + cert_mgmt_folder = dictionary_utils.get_dictionary_element(security_config_folder, CERTIFICATE_MANAGEMENT) |
| 733 | + cert_mgmt_enabled = dictionary_utils.get_element(cert_mgmt_folder, ENABLED) |
| 734 | + if cert_mgmt_enabled is not None: |
| 735 | + location = LocationContext() |
| 736 | + domain_name_token = aliases.get_name_token(location) |
| 737 | + location.add_name_token(domain_name_token, domain_name) |
| 738 | + location.append_location(SECURITY_CONFIGURATION) |
| 739 | + |
| 740 | + # certificate management doesn't exist in older WLS versions |
| 741 | + code, message = aliases.is_valid_model_folder_name(location, CERTIFICATE_MANAGEMENT) |
| 742 | + if code == ValidationCodes.VALID: |
| 743 | + existing_subfolder_names = get_existing_object_list(location, aliases) |
| 744 | + create_and_cd(location, existing_subfolder_names, aliases) |
| 745 | + |
| 746 | + location.append_location(CERTIFICATE_MANAGEMENT) |
| 747 | + existing_subfolder_names = get_existing_object_list(location, aliases) |
| 748 | + create_and_cd(location, existing_subfolder_names, aliases) |
| 749 | + |
| 750 | + cert_mgmt_enabled = alias_utils.convert_boolean(cert_mgmt_enabled) |
| 751 | + wlst_name = aliases.get_wlst_attribute_name(location, ENABLED) |
| 752 | + wlst_helper.set(wlst_name, cert_mgmt_enabled) |
723 | 753 |
|
724 | 754 | def delete_online_deployment_targets(model, aliases, wlst_mode):
|
725 | 755 | """
|
|
0 commit comments