Skip to content

Commit b4a6a52

Browse files
rakillenddsharpe
authored andcommitted
Configure ODL using WDT model (#478)
* Issue #412 - Configure ODL from the model * Issue #412 - Added exception handling and additional checks * Issue #412 - Revise model structure; use alias definition for validate and print-usage * Issue #412 - Move ODL configuration after updateDomain * Issue #412 - Skip ODL configuration for non-JRF domain types * Issue #412 - Skip ODL configuration for non-JRF domain types, including Restricted JRF * Issue #412 - Make ODL WLS imports conditional, for non-JRF WLS installs * Issue #412 - Added readme file * Issue #412 - Added version information * Issue #412 - Created test exception
1 parent 9bd9c78 commit b4a6a52

File tree

13 files changed

+494
-59
lines changed

13 files changed

+494
-59
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Many organizations are using WebLogic Server, with or without other Oracle Fusio
2323
- [JRF Trust Service Identity Asserter](site/security_providers.md#trust-service-identity-asserter)
2424
- [Custom Security Providers](site/security_providers.md#custom-security-providers)
2525
- [Modeling WebLogic Users, Groups, and Roles](site/security_users_groups_roles.md)
26+
- [ODL Configuration](site/odl_configuration.md)
2627
- [Variable Injection](site/variable_injection.md)
2728
- [Model Filters](site/tool_filters.md)
2829
- [Downloading and Installing](#downloading-and-installing-the-software)

core/src/main/python/deploy.py

+2
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,8 @@ def __deploy_offline(model, model_context, aliases):
295295
__close_domain_on_error()
296296
raise ex
297297

298+
model_deployer.deploy_model_after_update(model, model_context, aliases, wlst_mode=__wlst_mode)
299+
298300
try:
299301
__wlst_helper.close_domain()
300302
except BundleAwareException, ex:

core/src/main/python/update.py

+2
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,8 @@ def __update_offline(model, model_context, aliases):
313313
__close_domain_on_error()
314314
raise ex
315315

316+
model_deployer.deploy_model_after_update(model, model_context, aliases, wlst_mode=__wlst_mode)
317+
316318
try:
317319
__wlst_helper.close_domain()
318320
except BundleAwareException, ex:

core/src/main/python/wlsdeploy/aliases/alias_entries.py

+30-58
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
from wlsdeploy.aliases import password_utils
1515
from wlsdeploy.aliases.alias_constants import ChildFoldersTypes
1616
from wlsdeploy.aliases.location_context import LocationContext
17+
from wlsdeploy.aliases.model_constants import APPLICATION
18+
from wlsdeploy.aliases.model_constants import ODL_CONFIGURATION
19+
from wlsdeploy.aliases.model_constants import RESOURCE_MANAGER
1720
from wlsdeploy.aliases.validation_codes import ValidationCodes
1821
from wlsdeploy.aliases.wlst_modes import WlstModes
1922
from wlsdeploy.exception import exception_helper
@@ -72,57 +75,6 @@ class AliasEntries(object):
7275
__category_modules_dir_name = 'oracle/weblogic/deploy/aliases/category_modules/'
7376
__domain_category = 'Domain'
7477

75-
__model_categories_map = {
76-
'AdminConsole': 'AdminConsole',
77-
'Application': 'AppDeployment',
78-
'Cluster': 'Cluster',
79-
'CoherenceClusterSystemResource': 'CoherenceClusterSystemResource',
80-
'Domain': 'Domain',
81-
'EmbeddedLDAP': 'EmbeddedLDAP',
82-
'FileStore': 'FileStore',
83-
'ForeignJNDIProvider': 'ForeignJNDIProvider',
84-
'JDBCStore': 'JDBCStore',
85-
'JDBCSystemResource': 'JDBCSystemResource',
86-
'JMSBridgeDestination': 'JMSBridgeDestination',
87-
'JMSServer': 'JMSServer',
88-
'JMSSystemResource': 'JMSSystemResource',
89-
'JMX': 'JMX',
90-
'JTA': 'JTA',
91-
'Library': 'Library',
92-
'Log': 'Log',
93-
'LogFilter': 'LogFilter',
94-
'Machine': 'Machine',
95-
'MailSession': 'MailSession',
96-
'MessagingBridge': 'MessagingBridge',
97-
'MigratableTarget': 'MigratableTarget',
98-
'NMProperties': 'NMProperties',
99-
'Partition': 'Partition',
100-
'PartitionWorkManager': 'PartitionWorkManager',
101-
'PathService': 'PathService',
102-
'ResourceGroup': 'ResourceGroup',
103-
'ResourceGroupTemplate': 'ResourceGroupTemplate',
104-
'ResourceManagement': 'ResourceManagement',
105-
'ResourceManager': 'ResourceManager',
106-
'RestfulManagementServices': 'RestfulManagementServices',
107-
'SAFAgent': 'SAFAgent',
108-
'Security': 'Security',
109-
'SecurityConfiguration': 'SecurityConfiguration',
110-
'SelfTuning': 'SelfTuning',
111-
'Server': 'Server',
112-
'ServerTemplate': 'ServerTemplate',
113-
'ShutdownClass': 'ShutdownClass',
114-
'SingletonService': 'SingletonService',
115-
'StartupClass': 'StartupClass',
116-
'UnixMachine': 'UnixMachine',
117-
'VirtualHost': 'VirtualHost',
118-
'VirtualTarget': 'VirtualTarget',
119-
'WebAppContainer': 'WebAppContainer',
120-
'WLDFSystemResource': 'WLDFSystemResource',
121-
'WSReliableDeliveryPolicy': 'WSReliableDeliveryPolicy',
122-
'XMLEntityCache': 'XMLEntityCache',
123-
'XMLRegistry': 'XMLRegistry'
124-
}
125-
12678
__topology_top_level_folders = [
12779
'AdminConsole',
12880
'Cluster',
@@ -158,6 +110,7 @@ class AliasEntries(object):
158110
'JMSSystemResource',
159111
'MailSession',
160112
'MessagingBridge',
113+
ODL_CONFIGURATION,
161114
'Partition',
162115
'PartitionWorkManager',
163116
'PathService',
@@ -178,6 +131,8 @@ class AliasEntries(object):
178131
'Library'
179132
]
180133

134+
__all_model_categories = []
135+
181136
__domain_info_attributes_and_types = {
182137
'AdminUserName': 'string',
183138
'AdminPassword': 'password',
@@ -211,6 +166,11 @@ def __init__(self, wlst_mode=WlstModes.OFFLINE, wls_version=None):
211166
self._wls_helper = WebLogicHelper(_logger, wls_version)
212167
self._wls_version = wls_version
213168

169+
self.__all_model_categories.extend(self.__topology_top_level_folders)
170+
self.__all_model_categories.extend(self.__resources_top_level_folders)
171+
self.__all_model_categories.extend(self.__app_deployments_top_level_folders)
172+
self.__all_model_categories.append(RESOURCE_MANAGER)
173+
214174
return
215175

216176
def get_dictionary_for_location(self, location, resolve=True):
@@ -241,7 +201,7 @@ def get_model_domain_subfolder_names(self):
241201
_method_name = 'get_model_domain_subfolder_names'
242202

243203
_logger.entering(class_name=_class_name, method_name=_method_name)
244-
folder_list = list(self.__model_categories_map.keys())
204+
folder_list = list(self.__all_model_categories)
245205
#
246206
# Remove all folders that do not appear at the WLST root level
247207
#
@@ -914,12 +874,24 @@ def _unit_test_only_get_category_map_files(self):
914874
:return: blob of stuff
915875
"""
916876
result = {}
917-
for key, value in self.__model_categories_map.iteritems():
918-
category_file_name = '%s.json' % value
877+
for key in self.__all_model_categories:
878+
category_file_name = '%s.json' % self._get_category_file_prefix(key)
919879
category_file_path = '%s%s' % (self.__category_modules_dir_name, category_file_name)
920880
result[key] = category_file_path
921881
return result
922882

883+
def _get_category_file_prefix(self, category_name):
884+
"""
885+
Return the file prefix for the specified top-level category.
886+
The file prefix should match the category name exactly.
887+
File name for Application is different for some reason
888+
:param category_name: the name to be checked
889+
:return: the corressponding file name prefix
890+
"""
891+
if category_name == APPLICATION:
892+
return 'AppDeployment'
893+
return category_name
894+
923895
def __get_dictionary_for_location(self, location, resolve_path_tokens=True):
924896
"""
925897
Get the dictionary for a location with or without path tokens resolved
@@ -941,7 +913,7 @@ def __get_dictionary_for_location(self, location, resolve_path_tokens=True):
941913
model_category_name = self.__domain_category
942914
else:
943915
model_category_name = location_folders[0]
944-
if model_category_name not in self.__model_categories_map:
916+
if model_category_name not in self.__all_model_categories:
945917
ex = exception_helper.create_alias_exception('WLSDPLY-08116', model_category_name)
946918
_logger.throwing(ex, class_name=_class_name, method_name=_method_name)
947919
raise ex
@@ -993,7 +965,7 @@ def __load_category(self, model_category_name):
993965
_method_name = '__load_category'
994966

995967
_logger.entering(model_category_name, class_name=_class_name, method_name=_method_name)
996-
model_category_file = self.__model_categories_map[model_category_name]
968+
model_category_file = self._get_category_file_prefix(model_category_name)
997969
raw_category_dict = self.__load_category_file(model_category_file)
998970
_logger.fine('WLSDPLY-08118', model_category_name, class_name=_class_name, method_name=_method_name)
999971

@@ -1083,8 +1055,8 @@ def __load_contains_categories(self, model_category_name, raw_model_dict, base_p
10831055

10841056
contained_folders = raw_model_dict[CONTAINS]
10851057
for contained_folder in contained_folders:
1086-
if contained_folder in self.__model_categories_map:
1087-
folder_file = self.__model_categories_map[contained_folder]
1058+
if contained_folder in self.__all_model_categories:
1059+
folder_file = self._get_category_file_prefix(contained_folder)
10881060
else:
10891061
ex = exception_helper.create_alias_exception('WLSDPLY-08122', contained_folder, model_category_name)
10901062
_logger.throwing(ex, class_name=_class_name, method_name=_method_name)

core/src/main/python/wlsdeploy/aliases/model_constants.py

+1
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@
174174
NODE_MANAGER_PW_ENCRYPTED = 'NodeManagerPasswordEncrypted'
175175
NODE_MANAGER_USER_NAME = 'NodeManagerUsername'
176176
NOVELL_AUTHENTICATOR = 'NovellAuthenticator'
177+
ODL_CONFIGURATION = 'ODLConfiguration'
177178
OPEN_LDAP_AUTHENTICATOR = 'OpenLDAPAuthenticator'
178179
ORACLE_OID_AUTHENTICATOR = 'OracleInternetDirectoryAuthenticator'
179180
ORACLE_OUD_AUTHENTICATOR = 'OracleUnifiedDirectoryAuthenticator'

core/src/main/python/wlsdeploy/tool/create/domain_creator.py

+3
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,9 @@ def __deploy(self):
364364
self._configure_security_configuration()
365365
self.__deploy_resources_and_apps()
366366
self.wlst_helper.update_domain()
367+
368+
model_deployer.deploy_model_after_update(self.model, self.model_context, self.aliases)
369+
367370
self.wlst_helper.close_domain()
368371
return
369372

core/src/main/python/wlsdeploy/tool/deploy/model_deployer.py

+22
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,28 @@ def deploy_model_offline(model, model_context, aliases, wlst_mode=WlstModes.OFFL
7373
return
7474

7575

76+
def deploy_model_after_update(model, model_context, aliases, wlst_mode=WlstModes.OFFLINE):
77+
"""
78+
Deploy the resources that must be done after WLST updateDomain.
79+
:param model: the model
80+
:param model_context: the model context
81+
:param aliases: the aliases object
82+
:param wlst_mode: the WLST mode to use
83+
:raises DeployException: if an error occurs
84+
"""
85+
_method_name = 'deploy_model_offline_after_update'
86+
87+
try:
88+
location = LocationContext()
89+
resources_deployer = ResourcesDeployer(model, model_context, aliases, wlst_mode=wlst_mode)
90+
resources_deployer.deploy_after_update(location)
91+
except PyWLSTException, pwe:
92+
ex = exception_helper.create_deploy_exception('WLSDPLY-09650', pwe.getLocalizedMessage(), error=pwe)
93+
_logger.throwing(ex, class_name=_class_name, method_name=_method_name)
94+
raise ex
95+
return
96+
97+
7698
def deploy_resources_and_apps_for_create(model, model_context, aliases):
7799
"""
78100
Deploy the resources and appDeployments sections after create handles the topology section of the model.

0 commit comments

Comments
 (0)