diff --git a/core/src/main/python/discover.py b/core/src/main/python/discover.py index 7464a6610..b959fa70a 100644 --- a/core/src/main/python/discover.py +++ b/core/src/main/python/discover.py @@ -17,6 +17,7 @@ from oracle.weblogic.deploy.util import PyOrderedDict from oracle.weblogic.deploy.util import PyWLSTException from oracle.weblogic.deploy.util import TranslateException +from oracle.weblogic.deploy.util import WebLogicDeployToolingVersion from oracle.weblogic.deploy.util import WLSDeployArchive from oracle.weblogic.deploy.util import WLSDeployArchiveIOException from oracle.weblogic.deploy.validate import ValidateException @@ -26,6 +27,7 @@ from wlsdeploy.aliases import model_constants from wlsdeploy.aliases.aliases import Aliases from wlsdeploy.aliases.location_context import LocationContext +from wlsdeploy.aliases.model_constants import DOMAIN_INFO from wlsdeploy.aliases.wlst_modes import WlstModes from wlsdeploy.exception import exception_helper from wlsdeploy.exception.expection_types import ExceptionType @@ -464,9 +466,18 @@ def __persist_model(model, model_context): __logger.entering(class_name=_class_name, method_name=_method_name) + # add model comments to dictionary extracted from the Model object + model_dict = model.get_model() + message_1 = exception_helper.get_message('WLSDPLY-06039', WebLogicDeployToolingVersion.getVersion(), _program_name) + model_dict.addComment(DOMAIN_INFO, message_1) + message_2 = exception_helper.get_message('WLSDPLY-06040', WlstModes.values()[__wlst_mode], + model_context.get_target_wls_version()) + model_dict.addComment(DOMAIN_INFO, message_2) + model_dict.addComment(DOMAIN_INFO, '') + model_file_name = model_context.get_model_file() model_file = FileUtils.getCanonicalFile(File(model_file_name)) - model_translator.PythonToFile(model.get_model()).write_to_file(model_file.getAbsolutePath()) + model_translator.PythonToFile(model_dict).write_to_file(model_file.getAbsolutePath()) __logger.exiting(class_name=_class_name, method_name=_method_name) diff --git a/core/src/main/resources/oracle/weblogic/deploy/aliases/category_modules/Domain.json b/core/src/main/resources/oracle/weblogic/deploy/aliases/category_modules/Domain.json index a00e946ca..1692f5fbc 100644 --- a/core/src/main/resources/oracle/weblogic/deploy/aliases/category_modules/Domain.json +++ b/core/src/main/resources/oracle/weblogic/deploy/aliases/category_modules/Domain.json @@ -26,7 +26,7 @@ "DbPassiveMode": [ {"version": "[12.2.1.3,)", "wlst_mode": "both", "wlst_name": "${Db:DB}PassiveMode", "wlst_path": "WP001", "default_value": "false", "wlst_type": "boolean" } ], "DbPassiveModeGracePeriodSeconds": [ {"version": "[12.2.1.3,)", "wlst_mode": "both", "wlst_name": "${Db:DB}PassiveModeGracePeriodSeconds", "wlst_path": "WP001", "default_value": 30, "wlst_type": "integer" } ], "DiagnosticContextCompatibilityModeEnabled": [ {"version": "[12.2.1,)", "wlst_mode": "both", "wlst_name": "DiagnosticContextCompatibilityModeEnabled", "wlst_path": "WP001", "default_value": "true", "wlst_type": "boolean" } ], - "DomainVersion": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "DomainVersion", "wlst_path": "WP001", "default_value": null, "wlst_type": "string", "access": "RO"} ], + "DomainVersion": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "DomainVersion", "wlst_path": "WP001", "default_value": null, "wlst_type": "string", "access": "IGNORED"} ], "EnableEeCompliantClassloadingForEmbeddedAdapters": [ {"version": "[12.2.1,)", "wlst_mode": "both", "wlst_name": "Enable${Ee:EE}CompliantClassloadingForEmbeddedAdapters", "wlst_path": "WP001", "default_value": "${false:true}", "wlst_type": "boolean", "get_method": "LSA" } ], "ExalogicOptimizationsEnabled": [ {"version": "[10.3.4,)", "wlst_mode": "both", "wlst_name": "ExalogicOptimizationsEnabled", "wlst_path": "WP001", "default_value": "false", "wlst_type": "boolean", "restart_required": "true" } ], "GuardianEnabled": [ {"version": "[10,12.2.1.3)", "wlst_mode": "both", "wlst_name": "GuardianEnabled", "wlst_path": "WP001", "default_value": "false", "wlst_type": "boolean" } , diff --git a/core/src/main/resources/oracle/weblogic/deploy/messages/wlsdeploy_rb.properties b/core/src/main/resources/oracle/weblogic/deploy/messages/wlsdeploy_rb.properties index 0ab109a8b..b546555d6 100644 --- a/core/src/main/resources/oracle/weblogic/deploy/messages/wlsdeploy_rb.properties +++ b/core/src/main/resources/oracle/weblogic/deploy/messages/wlsdeploy_rb.properties @@ -630,6 +630,8 @@ WLSDPLY-06035=Unable to write the results file specified by environment variable WLSDPLY-06036=Unable to determine if production mode is enabled for the domain: {0} WLSDPLY-06037=Target directory for model file argument {0} does not exist WLSDPLY-06038=Unable to determine if secure mode is enabled for the domain: {0} +WLSDPLY-06039=This model was created using the WebLogic Deploy Tooling {0} {1} tool +WLSDPLY-06040=running in {0} mode against a domain using WebLogic Server {1}. # discoverer.py WLSDPLY-06100=Find attributes at location {0} diff --git a/core/src/test/python/aliases_test.py b/core/src/test/python/aliases_test.py index a803788d4..806f24ee2 100644 --- a/core/src/test/python/aliases_test.py +++ b/core/src/test/python/aliases_test.py @@ -1,5 +1,5 @@ """ -Copyright (c) 2017, 2022, Oracle and/or its affiliates. +Copyright (c) 2017, 2023, Oracle and/or its affiliates. Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl. """ from org.python.modules import jarray @@ -1347,13 +1347,13 @@ def testJTAMigratableConstrainedCandidateServer(self): self.assertEquals(wlst_value_expected, wlst_value) def testReadOnlyDiscoverAttribute(self): - location = LocationContext() - location.add_name_token(self.online_aliases.get_name_token(location), 'my-domain') + location = LocationContext().append_location(FOLDERS.APPLICATION) + location.add_name_token(self.online_aliases.get_name_token(location), 'my-app') model_attribute, model_value = \ - self.online_aliases.get_model_attribute_name_and_value(location, FOLDERS.DOMAIN_VERSION, '12.2.1.3.0') - self.assertEquals('12.2.1.3.0', model_value) + self.online_aliases.get_model_attribute_name_and_value(location, FOLDERS.STAGE_MODE, 'mymode') + self.assertEquals('mymode', model_value) wlst_attribute, wlst_value = \ - self.online_aliases.get_wlst_attribute_name_and_value(location, FOLDERS.DOMAIN_VERSION, '12.2.1.3.0') + self.online_aliases.get_wlst_attribute_name_and_value(location, FOLDERS.STAGE_MODE, 'mymode') self.assertEquals(None, wlst_value) def testFolderOrder(self): diff --git a/integration-tests/system-test/src/test/java/oracle/weblogic/deploy/integration/ITWdt.java b/integration-tests/system-test/src/test/java/oracle/weblogic/deploy/integration/ITWdt.java index 1302824cc..379cfcea8 100644 --- a/integration-tests/system-test/src/test/java/oracle/weblogic/deploy/integration/ITWdt.java +++ b/integration-tests/system-test/src/test/java/oracle/weblogic/deploy/integration/ITWdt.java @@ -1219,7 +1219,6 @@ private void verifyDiscoveredJDBCWalletModelFile(String expectedModelFile) throw checkContents.add("topology:"); checkContents.add(" Name: domain2"); checkContents.add(" AdminServerName: admin-server"); - checkContents.add(" DomainVersion: 12.2.1.3.0"); checkContents.add(" ProductionModeEnabled: true"); checkContents.add(" NMProperties:"); checkContents.add(" JavaHome: /usr/java/jdk1.8.0_361");