Skip to content

Commit 6fedd52

Browse files
Merge branch 'master' into wdt_issue_246
2 parents 71cc939 + 9dc86de commit 6fedd52

File tree

27 files changed

+1398
-315
lines changed

27 files changed

+1398
-315
lines changed

core/src/__init__.py

Whitespace-only changes.

core/src/main/__init__.py

Whitespace-only changes.

core/src/main/python/create.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,10 @@ def main(args):
404404
__logger.severe('WLSDPLY-20008', _program_name, ex.getLocalizedMessage(), error=ex,
405405
class_name=_class_name, method_name=_method_name)
406406
__clean_up_temp_files()
407-
tool_exit.end(None, exit_code)
407+
408+
# create a minimal model for summary logging
409+
model_context = ModelContext(_program_name, dict())
410+
tool_exit.end(model_context, exit_code)
408411

409412
model_file = model_context.get_model_file()
410413
try:

core/src/main/python/deploy.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,10 @@ def main(args):
446446
__logger.severe('WLSDPLY-20008', _program_name, ex.getLocalizedMessage(), error=ex,
447447
class_name=_class_name, method_name=_method_name)
448448
__clean_up_temp_files()
449-
tool_exit.end(None, exit_code)
449+
450+
# create a minimal model for summary logging
451+
model_context = ModelContext(_program_name, dict())
452+
tool_exit.end(model_context, exit_code)
450453

451454
model_file = model_context.get_model_file()
452455
try:

core/src/main/python/discover.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,10 @@ def main(args):
489489
if exit_code != CommandLineArgUtil.HELP_EXIT_CODE:
490490
__logger.severe('WLSDPLY-20008', _program_name, ex.getLocalizedMessage(), error=ex,
491491
class_name=_class_name, method_name=_method_name)
492-
__log_and_exit(None, exit_code, _class_name, _method_name)
492+
493+
# create a minimal model for summary logging
494+
model_context = ModelContext(_program_name, dict())
495+
__log_and_exit(model_context, exit_code, _class_name, _method_name)
493496

494497
try:
495498
__clear_archive_file(model_context)

core/src/main/python/update.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,10 @@ def main(args):
465465
__logger.severe('WLSDPLY-20008', _program_name, ex.getLocalizedMessage(), error=ex,
466466
class_name=_class_name, method_name=_method_name)
467467
__clean_up_temp_files()
468-
tool_exit.end(None, exit_code)
468+
469+
# create a minimal model for summary logging
470+
model_context = ModelContext(_program_name, dict())
471+
tool_exit.end(model_context, exit_code)
469472

470473
model_file = model_context.get_model_file()
471474
try:

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

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
from wlsdeploy.tool.util.archive_helper import ArchiveHelper
7777
from wlsdeploy.tool.util.library_helper import LibraryHelper
7878
from wlsdeploy.tool.util.target_helper import TargetHelper
79+
from wlsdeploy.tool.util.targeting_types import TargetingType
7980
from wlsdeploy.tool.util.topology_helper import TopologyHelper
8081
from wlsdeploy.util import dictionary_utils
8182
from wlsdeploy.util import model as model_helper
@@ -394,7 +395,8 @@ def __extend_domain(self, domain_home):
394395

395396
self.logger.entering(domain_home, class_name=self.__class_name, method_name=_method_name)
396397
extension_templates = self._domain_typedef.get_extension_templates()
397-
if len(extension_templates) == 0:
398+
custom_templates = self._domain_typedef.get_custom_extension_templates()
399+
if (len(extension_templates) == 0) and (len(custom_templates) == 0):
398400
return
399401

400402
self.logger.info('WLSDPLY-12207', self._domain_name, domain_home,
@@ -407,15 +409,28 @@ def __extend_domain(self, domain_home):
407409
class_name=self.__class_name, method_name=_method_name)
408410
self.wlst_helper.add_template(extension_template)
409411

412+
for custom_template in custom_templates:
413+
self.logger.info('WLSDPLY-12246', custom_template,
414+
class_name=self.__class_name, method_name=_method_name)
415+
self.wlst_helper.add_template(custom_template)
416+
410417
self.__configure_fmw_infra_database()
411418

412419
if self.wls_helper.is_set_server_groups_supported():
420+
# 12c versions set server groups directly
413421
server_groups_to_target = self._domain_typedef.get_server_groups_to_target()
414422
self.target_helper.target_server_groups_to_servers(server_groups_to_target)
415423
self.wlst_helper.update_domain()
416-
elif self._domain_typedef.is_jrf_domain_type():
424+
425+
elif self._domain_typedef.is_jrf_domain_type() or \
426+
(self._domain_typedef.get_targeting() == TargetingType.APPLY_JRF):
427+
# for 11g, if template list includes JRF, or if specified in domain typedef, use applyJRF
417428
self.target_helper.target_jrf_groups_to_clusters_servers(domain_home)
418429

430+
else:
431+
# for 11g, if no targeting was needed, just update the domain
432+
self.wlst_helper.update_domain()
433+
419434
self.wlst_helper.close_domain()
420435
self.logger.info('WLSDPLY-12209', self._domain_name,
421436
class_name=self.__class_name, method_name=_method_name)
@@ -444,6 +459,12 @@ def __create_domain_with_select_template(self, domain_home):
444459
class_name=self.__class_name, method_name=_method_name)
445460
self.wlst_helper.select_template(extension_template)
446461

462+
custom_templates = self._domain_typedef.get_custom_extension_templates()
463+
for custom_template in custom_templates:
464+
self.logger.info('WLSDPLY-12245', custom_template,
465+
class_name=self.__class_name, method_name=_method_name)
466+
self.wlst_helper.select_custom_template(custom_template)
467+
447468
self.logger.info('WLSDPLY-12212', class_name=self.__class_name, method_name=_method_name)
448469
self.wlst_helper.load_templates()
449470

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

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from wlsdeploy.exception import exception_helper
1313
from wlsdeploy.json.json_translator import JsonToPython
1414
from wlsdeploy.logging.platform_logger import PlatformLogger
15+
from wlsdeploy.tool.util.targeting_types import TargetingType
1516
from wlsdeploy.util.cla_utils import CommandLineArgUtil
1617
from wlsdeploy.util.weblogic_helper import WebLogicHelper
1718

@@ -70,6 +71,8 @@ def __init__(self, program_name, domain_type):
7071
self._model_context = None
7172
self._version_typedef_name = None
7273

74+
self._targeting_type = self._resolve_targeting_type()
75+
7376
if 'system-elements' in self._domain_typedefs_dict:
7477
self._system_elements = self._domain_typedefs_dict['system-elements']
7578
else:
@@ -149,6 +152,15 @@ def get_extension_templates(self):
149152
self.__resolve_paths()
150153
return list(self._domain_typedef['extensionTemplates'])
151154

155+
def get_custom_extension_templates(self):
156+
"""
157+
Get the list of custom extension templates to apply when create/extending the domain.
158+
:return: the list of custom extension templates, or an empty list if no extension templates are needed.
159+
:raises: CreateException: if an error occurs resolving the paths
160+
"""
161+
self.__resolve_paths()
162+
return list(self._domain_typedef['customExtensionTemplates'])
163+
152164
def get_server_groups_to_target(self):
153165
"""
154166
Get the list of server groups to target to the managed servers in the domain.
@@ -176,6 +188,13 @@ def required_rcu(self):
176188
# resolution for create.py argument processing.
177189
return 'rcuSchemas' in self._domain_typedef and len(self._domain_typedef['rcuSchemas']) > 0
178190

191+
def get_targeting(self):
192+
"""
193+
Get the targeting type for the domain, or None if not specified.
194+
:return: the TargetingType enum value for the domain, or None
195+
"""
196+
return self._targeting_type
197+
179198
def is_system_app(self, name):
180199
"""
181200
Determine if the specified name matches a WLS system application.
@@ -313,6 +332,15 @@ def __resolve_paths(self):
313332
else:
314333
self._domain_typedef['extensionTemplates'] = []
315334

335+
if 'customExtensionTemplates' in self._domain_typedef:
336+
extension_templates = self._domain_typedef['customExtensionTemplates']
337+
resolved_templates = []
338+
for extension_template in extension_templates:
339+
resolved_templates.append(self._model_context.replace_token_string(extension_template))
340+
self._domain_typedef['customExtensionTemplates'] = resolved_templates
341+
else:
342+
self._domain_typedef['customExtensionTemplates'] = []
343+
316344
if 'serverGroupsToTarget' not in self._domain_typedef:
317345
self._domain_typedef['serverGroupsToTarget'] = []
318346

@@ -391,3 +419,32 @@ def __match_version_typedef(self, versions_dict):
391419
raise ex
392420
self._logger.exiting(self.__class_name, _method_name, result)
393421
return result
422+
423+
def _resolve_targeting_type(self):
424+
"""
425+
Determine the targeting type based on the value in the definition.
426+
Check for problems or incompatibilities.
427+
:return: the matching TargetType enum value
428+
:raises: ClaException: if there are problems or incompatibilities
429+
"""
430+
_method_name = '_resolve_targeting_type'
431+
432+
if 'targeting' not in self._domain_typedef:
433+
return None
434+
435+
targeting_text = self._domain_typedef['targeting']
436+
437+
# there are no valid targeting types for version 12c and up
438+
if self.wls_helper.is_set_server_groups_supported():
439+
ex = exception_helper.create_cla_exception('WLSDPLY-12311', targeting_text, self._domain_typedef_filename,
440+
self.wls_helper.get_weblogic_version())
441+
self._logger.throwing(ex, class_name=self.__class_name, method_name=_method_name)
442+
raise ex
443+
444+
# if specified, targeting must be one of the known types
445+
if targeting_text not in TargetingType:
446+
ex = exception_helper.create_cla_exception('WLSDPLY-12312', targeting_text, self._domain_typedef_filename)
447+
self._logger.throwing(ex, class_name=self.__class_name, method_name=_method_name)
448+
raise ex
449+
450+
return TargetingType[targeting_text]

0 commit comments

Comments
 (0)