Skip to content

Commit f89f306

Browse files
authored
Merge pull request #49 from oracle/Issue#46-Validate-discovered-domain
validate discovered mode
2 parents 177e673 + 241ddd2 commit f89f306

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

core/src/main/python/discover.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
from oracle.weblogic.deploy.util import WebLogicDeployToolingVersion
2323
from oracle.weblogic.deploy.util import WLSDeployArchive
2424
from oracle.weblogic.deploy.util import WLSDeployArchiveIOException
25+
from oracle.weblogic.deploy.validate import ValidateException
2526

2627
sys.path.append(os.path.dirname(os.path.realpath(sys.argv[0])))
2728

@@ -35,6 +36,7 @@
3536
from wlsdeploy.tool.discover.multi_tenant_discoverer import MultiTenantDiscoverer
3637
from wlsdeploy.tool.discover.resources_discoverer import ResourcesDiscoverer
3738
from wlsdeploy.tool.discover.topology_discoverer import TopologyDiscoverer
39+
from wlsdeploy.tool.validate.validator import Validator
3840
from wlsdeploy.tool.util import filter_helper
3941
from wlsdeploy.util import wlst_helper
4042
from wlsdeploy.util import model_translator
@@ -354,14 +356,27 @@ def __persist_model(model, model_context):
354356
return
355357

356358

357-
def __check_and_customize_model(model):
359+
def __check_and_customize_model(model, model_context):
360+
"""
361+
Customize the model dictionary before persisting. Validate the model after customization for informational
362+
purposes. Any validation errors will not stop the discovered model to be persisted.
363+
:param model: completely discovered model
364+
"""
358365
_method_name = '__check_and_customize_model'
359366
__logger.entering(class_name=_class_name, method_name=_method_name)
360367

361368
if filter_helper.apply_filters(model.get_model(), "discover"):
362369
__logger.info('WLSDPLY-06014', _class_name=_class_name, method_name=_method_name)
363370

364-
__logger.exiting(class_name=_class_name, method_name=_method_name)
371+
372+
try:
373+
validator = Validator(model_context, wlst_mode=__wlst_mode)
374+
375+
# no variables are generated by the discover tool
376+
return_code = validator.validate_in_tool_mode(model.get_model(), variables_file_name=None,
377+
archive_file_name=model_context.get_archive_file_name())
378+
except ValidateException, ex:
379+
__logger.warning('WLSDPLY-06015', ex.getLocalizedMessage(), class_name=_class_name, method_name=_method_name)
365380

366381

367382
def __log_and_exit(exit_code, _class_name, _method_name):
@@ -415,7 +430,7 @@ def main():
415430
error=ex, class_name=_class_name, method_name=_method_name)
416431
__log_and_exit(CommandLineArgUtil.PROG_ERROR_EXIT_CODE, _class_name, _method_name)
417432

418-
__check_and_customize_model(model)
433+
__check_and_customize_model(model, model_context)
419434

420435
try:
421436
__persist_model(model, model_context)

core/src/main/resources/oracle/weblogic/deploy/messages/wlsdeploy_rb.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,7 @@ WLSDPLY-06011={0} failed to discover domain {1} at {2} : {3}
406406
WLSDPLY-06012={0} failed to persist the model to the archive file {1}: {2}
407407
WLSDPLY-06013={0} failed to create the archive file at {1}: {2}
408408
WLSDPLY-06014=Filters applied to the model
409+
WLSDPLY-06015=Unable to run validation against the discovered model : {0}
409410

410411

411412
# discoverer.py

0 commit comments

Comments
 (0)