Skip to content

Commit 3614c41

Browse files
authored
Configure OHS in offline mode (#604)
* Issue #143 - Deploy SystemComponent model folder * Issue #143 - Corrected version * Issue #143 - Corrections for online deploy * Add discover for SystemComponent * Issue #143 - Deploy and discover OHS resources online * Issue #143 - Add checks and warnings for online deploy and discover
1 parent 6813ec4 commit 3614c41

File tree

8 files changed

+164
-4
lines changed

8 files changed

+164
-4
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,14 @@
5151
from wlsdeploy.aliases.model_constants import DOMAIN_INFO_ALIAS
5252
from wlsdeploy.aliases.model_constants import KUBERNETES_ALIAS
5353
from wlsdeploy.aliases.model_constants import JOLT_CONNECTION_POOL
54-
from wlsdeploy.aliases.model_constants import ODL_CONFIGURATION
5554
from wlsdeploy.aliases.model_constants import KUBERNETES
55+
from wlsdeploy.aliases.model_constants import ODL_CONFIGURATION
56+
from wlsdeploy.aliases.model_constants import OHS
5657
from wlsdeploy.aliases.model_constants import RCU_DB_INFO
5758
from wlsdeploy.aliases.model_constants import RESOURCE_MANAGER
5859
from wlsdeploy.aliases.model_constants import RESOURCES
5960
from wlsdeploy.aliases.model_constants import SERVER_POD
61+
from wlsdeploy.aliases.model_constants import SYSTEM_COMPONENT
6062
from wlsdeploy.aliases.model_constants import TOPOLOGY
6163
from wlsdeploy.aliases.model_constants import WLS_ROLES
6264
from wlsdeploy.aliases.model_constants import WTC_SERVER
@@ -123,6 +125,7 @@ class AliasEntries(object):
123125
'MailSession',
124126
'MessagingBridge',
125127
ODL_CONFIGURATION,
128+
OHS,
126129
'Partition',
127130
'PartitionWorkManager',
128131
'PathService',
@@ -134,6 +137,7 @@ class AliasEntries(object):
134137
'ShutdownClass',
135138
'SingletonService',
136139
'StartupClass',
140+
SYSTEM_COMPONENT,
137141
'WebAppContainer',
138142
'WLDFSystemResource',
139143
WTC_SERVER

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@
184184
NODE_MANAGER_USER_NAME = 'NodeManagerUsername'
185185
NOVELL_AUTHENTICATOR = 'NovellAuthenticator'
186186
ODL_CONFIGURATION = 'ODLConfiguration'
187+
OHS = 'OHS'
187188
OPEN_LDAP_AUTHENTICATOR = 'OpenLDAPAuthenticator'
188189
ORACLE_OID_AUTHENTICATOR = 'OracleInternetDirectoryAuthenticator'
189190
ORACLE_OUD_AUTHENTICATOR = 'OracleUnifiedDirectoryAuthenticator'
@@ -255,6 +256,7 @@
255256
STORE = 'Store'
256257
SUB_DEPLOYMENT = 'SubDeployment'
257258
SUB_DEPLOYMENT_NAME = 'SubDeploymentName'
259+
SYSTEM_COMPONENT = 'SystemComponent'
258260
SYSTEM_PASSWORD_VALIDATOR = 'SystemPasswordValidator'
259261
TARGET = 'Target'
260262
TARGET_DESTINATION = 'TargetDestination'
@@ -305,6 +307,7 @@
305307
ACTION = 'Action'
306308
ACTIVE_TYPE = 'ActiveType'
307309
ARGUMENTS = 'Arguments'
310+
COMPONENT_TYPE = 'ComponentType'
308311
CONSTRAINED_CANDIDATE_SERVER = 'ConstrainedCandidateServer'
309312
CUSTOM_IDENTITY_KEYSTORE_FILE = 'CustomIdentityKeyStoreFileName'
310313
CUSTOM_TRUST_KEYSTORE_FILE = 'CustomTrustKeyStoreFileName'

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

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Copyright (c) 2017, 2019, Oracle Corporation and/or its affiliates. All rights reserved.
2+
Copyright (c) 2017, 2020, Oracle Corporation and/or its affiliates. All rights reserved.
33
Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
44
"""
55

@@ -12,18 +12,21 @@
1212
from wlsdeploy.aliases.model_constants import JOLT_CONNECTION_POOL
1313
from wlsdeploy.aliases.model_constants import MAIL_SESSION
1414
from wlsdeploy.aliases.model_constants import MESSAGING_BRIDGE
15+
from wlsdeploy.aliases.model_constants import OHS
1516
from wlsdeploy.aliases.model_constants import PATH_SERVICE
1617
from wlsdeploy.aliases.model_constants import SAF_AGENT
1718
from wlsdeploy.aliases.model_constants import SELF_TUNING
1819
from wlsdeploy.aliases.model_constants import WORK_MANAGER
1920
from wlsdeploy.aliases.model_constants import WEBAPP_CONTAINER
2021
from wlsdeploy.aliases.model_constants import WTC_SERVER
2122
from wlsdeploy.aliases.model_constants import SINGLETON_SERVICE
23+
from wlsdeploy.aliases.model_constants import SYSTEM_COMPONENT
2224
from wlsdeploy.aliases.model_constants import MIME_MAPPING_FILE
2325
from wlsdeploy.aliases.wlst_modes import WlstModes
2426
from wlsdeploy.tool.deploy.deployer import Deployer
2527
from wlsdeploy.util import dictionary_utils
2628

29+
2730
class CommonResourcesDeployer(Deployer):
2831
"""
2932
class docstring
@@ -217,3 +220,26 @@ def add_singleton_service(self, parent_dict, location):
217220
self._add_named_elements(SINGLETON_SERVICE, singleton_services, location)
218221

219222
return
223+
224+
def add_system_components(self, parent_dict, location):
225+
"""
226+
Deploy the system components in the dictionary at the specified location.
227+
:param parent_dict: the dictionary possibly containing system component elements
228+
:param location: the location to deploy the elements
229+
"""
230+
system_components = dictionary_utils.get_dictionary_element(parent_dict, SYSTEM_COMPONENT)
231+
self._add_named_elements(SYSTEM_COMPONENT, system_components, location)
232+
233+
def add_ohs_components(self, parent_dict, location):
234+
"""
235+
Deploy the OHS components in the dictionary at the specified location.
236+
:param parent_dict: the dictionary possibly containing OHS component elements
237+
:param location: the location to deploy the elements
238+
"""
239+
_method_name = 'add_ohs_components'
240+
241+
system_components = dictionary_utils.get_dictionary_element(parent_dict, OHS)
242+
if self.wlst_mode == WlstModes.ONLINE:
243+
self.logger.warning('WLSDPLY-09405', OHS, class_name=self._class_name, method_name=_method_name)
244+
else:
245+
self._add_named_elements(OHS, system_components, location)

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Copyright (c) 2017, 2019, Oracle Corporation and/or its affiliates. All rights reserved.
2+
Copyright (c) 2017, 2020, Oracle Corporation and/or its affiliates. All rights reserved.
33
Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
44
"""
55
import wlsdeploy.util.dictionary_utils as dictionary_utils
@@ -87,6 +87,8 @@ def _add_resources(self, location):
8787
common_deployer.add_coherence_clusters(self._resources, location)
8888
common_deployer.add_webapp_container(self._resources, location)
8989
common_deployer.add_singleton_service(self._resources, location)
90+
common_deployer.add_system_components(self._resources, location)
91+
common_deployer.add_ohs_components(self._resources, location)
9092
return
9193

9294
def _add_startup_classes(self, location):

core/src/main/python/wlsdeploy/tool/discover/common_resources_discoverer.py

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313
from wlsdeploy.aliases.location_context import LocationContext
1414
from wlsdeploy.aliases.wlst_modes import WlstModes
1515
from wlsdeploy.exception import exception_helper
16-
from wlsdeploy.exception.expection_types import ExceptionType
1716
from wlsdeploy.logging.platform_logger import PlatformLogger
1817
from wlsdeploy.tool.discover import discoverer
1918
from wlsdeploy.tool.discover.coherence_resources_discoverer import CoherenceResourcesDiscoverer
2019
from wlsdeploy.tool.discover.discoverer import Discoverer
2120
from wlsdeploy.tool.discover.jms_resources_discoverer import JmsResourcesDiscoverer
21+
from wlsdeploy.util import dictionary_utils
2222

2323
_class_name = 'CommonResourcesDiscoverer'
2424
_logger = PlatformLogger(discoverer.get_discover_logger_name())
@@ -65,6 +65,10 @@ def discover(self):
6565
aliases=self._aliases, variable_injector=self._get_variable_injector()).discover()
6666
model_folder_name, folder_result = self.get_wldf_system_resources()
6767
discoverer.add_to_model_if_not_empty(self._dictionary, model_folder_name, folder_result)
68+
model_folder_name, folder_result = self.get_system_component_resources()
69+
discoverer.add_to_model_if_not_empty(self._dictionary, model_folder_name, folder_result)
70+
model_folder_name, folder_result = self.get_ohs_resources()
71+
discoverer.add_to_model_if_not_empty(self._dictionary, model_folder_name, folder_result)
6872
CoherenceResourcesDiscoverer(self._model_context, self._dictionary, self._base_location,
6973
wlst_mode=self._wlst_mode, aliases=self._aliases,
7074
variable_injector=self._get_variable_injector()).discover()
@@ -327,6 +331,34 @@ def get_wldf_system_resources(self):
327331
_logger.exiting(class_name=_class_name, method_name=_method_name, result=model_top_folder_name)
328332
return model_top_folder_name, result
329333

334+
def get_system_component_resources(self):
335+
"""
336+
Discover each system component resource in the domain.
337+
:return: model name and dictionary for the discovered system component resources
338+
"""
339+
_method_name = 'get_system_component_resources'
340+
_logger.entering(class_name=_class_name, method_name=_method_name)
341+
name, dictionary = self._get_named_resources(model_constants.SYSTEM_COMPONENT)
342+
343+
# for online, warn that any OHS configurations are not discovered
344+
if self._wlst_mode == WlstModes.ONLINE:
345+
for key, nodes in dictionary.iteritems():
346+
component_type = dictionary_utils.get_element(nodes, model_constants.COMPONENT_TYPE)
347+
if model_constants.OHS == component_type:
348+
_logger.warning('WLSDPLY-06366', model_constants.OHS, model_constants.SYSTEM_COMPONENT, key,
349+
class_name=_class_name, method_name=_method_name)
350+
351+
return name, dictionary
352+
353+
def get_ohs_resources(self):
354+
"""
355+
Discover each OHS resource in the domain.
356+
:return: model name and dictionary for the discovered OHS resources
357+
"""
358+
_method_name = 'get_ohs_resources'
359+
_logger.entering(class_name=_class_name, method_name=_method_name)
360+
return self._get_named_resources(model_constants.OHS)
361+
330362
# private methods
331363

332364
def _add_wldf_script(self, model_name, model_value, location):
@@ -364,6 +396,34 @@ def _add_wldf_script(self, model_name, model_value, location):
364396
_logger.exiting(class_name=_class_name, method_name=_method_name, result=new_script_name)
365397
return new_script_name
366398

399+
def _get_named_resources(self, folder_name):
400+
"""
401+
Discover each resource of the specified type in the domain.
402+
:return: model name and dictionary for the discovered resources
403+
"""
404+
_method_name = '_get_named_resources'
405+
_logger.entering(folder_name, class_name=_class_name, method_name=_method_name)
406+
407+
result = OrderedDict()
408+
model_top_folder_name = folder_name
409+
location = LocationContext(self._base_location)
410+
location.append_location(model_top_folder_name)
411+
resource_names = self._find_names_in_folder(location)
412+
if resource_names is not None:
413+
_logger.info('WLSDPLY-06364', len(resource_names), folder_name, class_name=_class_name,
414+
method_name=_method_name)
415+
name_token = self._alias_helper.get_name_token(location)
416+
for resource_name in resource_names:
417+
_logger.info('WLSDPLY-06365', folder_name, resource_name, class_name=_class_name,
418+
method_name=_method_name)
419+
location.add_name_token(name_token, resource_name)
420+
result[resource_name] = OrderedDict()
421+
self._populate_model_parameters(result[resource_name], location)
422+
self._discover_subfolders(result[resource_name], location)
423+
location.remove_name_token(name_token)
424+
_logger.exiting(class_name=_class_name, method_name=_method_name, result=model_top_folder_name)
425+
return model_top_folder_name, result
426+
367427

368428
def _fix_passwords_in_properties(dictionary):
369429
"""
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"copyright": "Copyright (c) 2020, Oracle Corporation and/or its affiliates.",
3+
"license": "Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl",
4+
"wlst_type": "OHS",
5+
"child_folders_type": "multiple",
6+
"folders": { },
7+
"attributes": {
8+
"AdminHost": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "AdminHost", "wlst_path": "WP001", "value": {"default": "127.0.0.1" }, "wlst_type": "string" } ],
9+
"AdminPort": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "AdminPort", "wlst_path": "WP001", "value": {"default": "7779" }, "wlst_type": "string" } ],
10+
"ListenAddress": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "ListenAddress", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string" } ],
11+
"ListenPort": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "ListenPort", "wlst_path": "WP001", "value": {"default": "7777" }, "wlst_type": "string" } ],
12+
"SSLListenPort": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "SSLListenPort", "wlst_path": "WP001", "value": {"default": "4443" }, "wlst_type": "string" } ],
13+
"ServerName": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "ServerName", "wlst_path": "WP001", "value": {"default": "http://localhost:7777" }, "wlst_type": "string" } ]
14+
},
15+
"wlst_attributes_path": "WP001",
16+
"wlst_paths": {
17+
"WP001": "/OHS/%OHS%"
18+
}
19+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"copyright": "Copyright (c) 2020, Oracle Corporation and/or its affiliates.",
3+
"license": "Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl",
4+
"wlst_type": "SystemComponent${:s}",
5+
"child_folders_type": "multiple",
6+
"folders": {
7+
"SystemComponentStart": {
8+
"wlst_type": "SystemComponentStart",
9+
"child_folders_type": "single_unpredictable",
10+
"default_name_value": "${NO_NAME_0:%SYSTEMCOMPONENT%}",
11+
"folders": {},
12+
"attributes": {
13+
"Arguments": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "Arguments", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string" } ],
14+
"BeaHome": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "BeaHome", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string", "uses_path_tokens": "true" } ],
15+
"ClassPath": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "ClassPath", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "delimited_string[path_separator]", "preferred_model_type": "delimited_string", "uses_path_tokens": "true" } ],
16+
"JavaHome": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "JavaHome", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string", "uses_path_tokens": "true" } ],
17+
"JavaVendor": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "JavaVendor", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string" } ],
18+
"MWHome": [ {"version": "[12.1.3,)", "wlst_mode": "both", "wlst_name": "MWHome", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string", "uses_path_tokens": "true" } ],
19+
"Notes": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "Notes", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string" } ],
20+
"RootDirectory": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "RootDirectory", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string", "uses_path_tokens": "true" } ]
21+
},
22+
"wlst_attributes_path": "WP001",
23+
"wlst_paths": {
24+
"WP001": "/SystemComponent${:s}/%SYSTEMCOMPONENT%/SystemComponentStart/%SYSTEMCOMPONENTSTART%"
25+
}
26+
}
27+
},
28+
"attributes": {
29+
"AutoRestart": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "AutoRestart", "wlst_path": "WP001", "value": {"default": true }, "wlst_type": "boolean" } ],
30+
"ComponentType": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "ComponentType", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string" } ],
31+
"Machine": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "Machine", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string", "get_method": "LSA", "set_method":"${:MBEAN.set_machine_mbean}", "set_mbean_type": "${:weblogic.management.configuration.MachineMBean}" } ],
32+
"NMSocketCreateTimeoutInMillis": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "NMSocketCreateTimeoutInMillis", "wlst_path": "WP001", "value": {"default": 180000 }, "wlst_type": "integer" } ],
33+
"Notes": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "Notes", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string" } ],
34+
"RestartDelaySeconds": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "RestartDelaySeconds", "wlst_path": "WP001", "value": {"default": 0 }, "wlst_type": "integer" } ],
35+
"RestartIntervalSeconds": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "RestartIntervalSeconds", "wlst_path": "WP001", "value": {"default": 3600 }, "wlst_type": "integer" } ],
36+
"RestartMax": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "RestartMax", "wlst_path": "WP001", "value": {"default": 2 }, "wlst_type": "integer" } ]
37+
},
38+
"wlst_attributes_path": "WP001",
39+
"wlst_paths": {
40+
"WP001": "/SystemComponent${:s}/%SYSTEMCOMPONENT%"
41+
}
42+
}

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,9 @@ WLSDPLY-06360=Unable to locate and add {0} Script file {1} to archive file : {2}
570570
WLSDPLY-06361=Skipping {0} JDBC System Resource {1}
571571
WLSDPLY-06362=Skipping {0} WLDF System Resource {1}
572572
WLSDPLY-06363=Skipping {0} File Store {1}
573+
WLSDPLY-06364=Discovering {0} {1} elements
574+
WLSDPLY-06365=Adding {0} {1}
575+
WLSDPLY-06366={0} configuration for {1} {2} will not be discovered in online mode
573576

574577
# deployments_discoverer.py
575578
WLSDPLY-06380=Discovering domain model deployments
@@ -1008,6 +1011,7 @@ WLSDPLY-09401=PartitionWorkManager was specified in the test file but are not su
10081011
WLSDPLY-09402=Failed to create directory for FileStore {0} because the location {1} exists but is not a directory
10091012
WLSDPLY-09403=Created FileStore {0} directory {1}
10101013
WLSDPLY-09404=Failed to create directory for FileStore {0} at location {1}
1014+
WLSDPLY-09405={0} resources in the model are not configured in online mode
10111015

10121016
# wlsdeploy/tool/deploy/jms_resources_deployer.py
10131017
WLSDPLY-09500=Creating placeholder for Template {0}

0 commit comments

Comments
 (0)