Skip to content

Add model comments for discover; remove DomainVersion attribute #1383

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion core/src/main/python/discover.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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" } ,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
12 changes: 6 additions & 6 deletions core/src/test/python/aliases_test.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down