Skip to content

Commit d1f2f51

Browse files
Fix interdependencies and attribute issues for /Server/JTAMigratableTarget
1 parent 264dba7 commit d1f2f51

File tree

6 files changed

+79
-19
lines changed

6 files changed

+79
-19
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -677,6 +677,8 @@ def __create_clusters_and_servers(self, location):
677677
# Finally, create/update the servers.
678678
#
679679
server_nodes = dictionary_utils.get_dictionary_element(self._topology, SERVER)
680+
# There may be a dependency to other servers when the server is in a cluster
681+
self.topology_helper.create_placeholder_servers_in_cluster(self._topology)
680682
if len(server_nodes) > 0:
681683
self._create_named_mbeans(SERVER, server_nodes, location, log_created=True)
682684

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@ def update(self):
9898

9999
self._process_section(self._topology, folder_list, CLUSTER, location)
100100
self._process_section(self._topology, folder_list, SERVER_TEMPLATE, location)
101+
102+
# create placeholders for Servers that are in a cluster as /Server/JTAMigratableTarget
103+
# can reference "other" servers
104+
self._topology_helper.create_placeholder_servers_in_cluster(self._topology)
101105
self._process_section(self._topology, folder_list, SERVER, location)
102106

103107
self._process_section(self._topology, folder_list, MIGRATABLE_TARGET, location)

core/src/main/python/wlsdeploy/tool/util/topology_helper.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,33 @@ def _create_placeholder_coherence_cluster(self, cluster_name):
6767

6868
self.wlst_helper.cd(original_location)
6969

70+
def create_placeholder_servers_in_cluster(self, topology):
71+
"""
72+
Create a placeholder for servers that are in a cluster, as these are migratable entities that
73+
can reference other servers in the cluster.
74+
:param topology: The topology model nodes containing the full set of Servers to add for the create / update
75+
"""
76+
_method_name = 'create_placeholder_servers_in_cluster'
77+
self.logger.entering(class_name=self.__class_name, method_name=_method_name)
78+
original_location = self.wlst_helper.get_pwd()
79+
server_location = LocationContext().append_location(SERVER)
80+
81+
if self.alias_helper.get_wlst_mbean_type(server_location) is not None:
82+
existing_names = deployer_utils.get_existing_object_list(server_location, self.alias_helper)
83+
84+
server_nodes = dictionary_utils.get_dictionary_element(topology, SERVER)
85+
for server_name in server_nodes:
86+
if server_name not in existing_names and self.is_clustered_server(server_name, server_nodes):
87+
self.logger.info('WLSDPLY-19402', server_name, class_name=self.__class_name,
88+
method_name=_method_name)
89+
90+
server_token = self.alias_helper.get_name_token(server_location)
91+
server_location.add_name_token(server_token, server_name)
92+
deployer_utils.create_and_cd(server_location, existing_names, self.alias_helper)
93+
94+
self.wlst_helper.cd(original_location)
95+
self.logger.exiting(class_name=self.__class_name, method_name=_method_name)
96+
7097
def create_placeholder_server_templates(self, topology):
7198
"""
7299
Create a placeholder server template for each name in the topology.
@@ -133,3 +160,14 @@ def qualify_nm_properties(self, type_name, model_nodes, base_location, model_con
133160
value = model_context.get_domain_home() + "/" + keystore_file
134161
attribute_setter.set_attribute(location, CUSTOM_IDENTITY_KEYSTORE_FILE, value)
135162

163+
def is_clustered_server(self, server_name, servers_dictionary):
164+
"""
165+
Return true if the server's Cluster attribute is set.
166+
:param server_name: name of the server in the dictionary
167+
:param servers_dictionary: model topology section of servers
168+
:return: True if a clustered server
169+
"""
170+
server_dictionary = dictionary_utils.get_dictionary_element(servers_dictionary, server_name)
171+
if dictionary_utils.is_empty_dictionary_element(server_dictionary, CLUSTER):
172+
return False
173+
return True

core/src/main/resources/oracle/weblogic/deploy/aliases/category_modules/Server.json

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -196,24 +196,27 @@
196196
"wlst_type": "JTAMigratableTarget",
197197
"folders": {},
198198
"attributes": {
199-
"AdditionalMigrationAttempts": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "AdditionalMigrationAttempts", "wlst_path": "WP001", "value": {"default": 2 }, "wlst_type": "integer" } ],
200-
"Cluster": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "Cluster", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string", "get_method": "LSA", "set_method": "MBEAN.set_cluster_mbean", "set_mbean_type": "weblogic.management.configuration.ClusterMBean"} ],
201-
"ConstrainedCandidateServer": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "ConstrainedCandidateServer", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string", "get_method": "LSA"} ],
202-
"Critical": [ {"version": "[12.2.1,)", "wlst_mode": "both", "wlst_name": "Critical", "wlst_path": "WP001", "value": {"default": "false" }, "wlst_type": "boolean" } ],
203-
"DestinationServer": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "DestinationServer", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string" } ],
204-
"HostingServer": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "HostingServer", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string" } ],
205-
"MigrationPolicy": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "MigrationPolicy", "wlst_path": "WP001", "value": {"default": "manual"}, "wlst_type": "string" } ],
206-
"MillisToSleepBetweenAttempts": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "MillisToSleepBetweenAttempts", "wlst_path": "WP001", "value": {"default": 300000 }, "wlst_type": "integer" } ],
207-
"NonLocalPostAllowed": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "NonLocalPostAllowed", "wlst_path": "WP001", "value": {"default": "false" }, "wlst_type": "boolean" } ],
208-
"Notes": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "Notes", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string" } ],
209-
"NumberOfRestartAttempts": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "NumberOfRestartAttempts", "wlst_path": "WP001", "value": {"default": 6 }, "wlst_type": "integer" } ],
210-
"PostScript": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "PostScript", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string" } ],
211-
"PostScriptFailureFatal": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "PostScriptFailureFatal", "wlst_path": "WP001", "value": {"default": "true" }, "wlst_type": "boolean" } ],
212-
"PreScript": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "PreScript", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string" } ],
213-
"RestartOnFailure": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "RestartOnFailure", "wlst_path": "WP001", "value": {"default": "false" }, "wlst_type": "boolean" } ],
214-
"SecondsBetweenRestarts": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "SecondsBetweenRestarts", "wlst_path": "WP001", "value": {"default": 30 }, "wlst_type": "integer" } ],
215-
"StrictOwnershipCheck": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "StrictOwnershipCheck", "wlst_path": "WP001", "value": {"default": "false" }, "wlst_type": "boolean" } ],
216-
"UserPreferredServer": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "UserPreferredServer", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string" } ]
199+
"AdditionalMigrationAttempts": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "AdditionalMigrationAttempts", "wlst_path": "WP001", "value": {"default": 2 }, "wlst_type": "integer" } ],
200+
"AllCandidateServers": [ {"version": "[10,)", "wlst_mode": "online", "wlst_name": "AllCandidateServers", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "jarray", "access": "RO", "preferred_model_type": "delimited_string", "get_method": "GET" } ],
201+
"Cluster": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "Cluster", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string", "access": "RO", "get_method": "LSA" } ],
202+
"ConstrainedCandidateServer": [ {"version": "[10,)", "wlst_mode": "offline", "wlst_name": "ConstrainedCandidateServer", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "delimited_string", "preferred_model_type": "delimited_string", "get_method": "LSA" } ,
203+
{"version": "[10,)", "wlst_mode": "online", "wlst_name": "ConstrainedCandidateServers", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "jarray", "preferred_model_type": "delimited_string", "get_method": "GET", "set_method": "MBEAN.set_server_mbeans", "set_mbean_type": "weblogic.management.configuration.ServerMBean"} ],
204+
"Critical": [ {"version": "[12.2.1,)", "wlst_mode": "both", "wlst_name": "Critical", "wlst_path": "WP001", "value": {"default": "false" }, "wlst_type": "boolean" } ],
205+
"DestinationServer": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "DestinationServer", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string", "access": "RO" } ],
206+
"HostingServer": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "HostingServer", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string", "access": "RO" } ],
207+
"MigrationPolicy": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "MigrationPolicy", "wlst_path": "WP001", "value": {"default": "manual"}, "wlst_type": "string" } ],
208+
"MillisToSleepBetweenAttempts": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "MillisToSleepBetweenAttempts", "wlst_path": "WP001", "value": {"default": 300000 }, "wlst_type": "integer" } ],
209+
"NonLocalPostAllowed": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "NonLocalPostAllowed", "wlst_path": "WP001", "value": {"default": "false" }, "wlst_type": "boolean" } ],
210+
"Notes": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "Notes", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string" } ],
211+
"NumberOfRestartAttempts": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "NumberOfRestartAttempts", "wlst_path": "WP001", "value": {"default": 6 }, "wlst_type": "integer" } ],
212+
"PostScript": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "PostScript", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string" } ],
213+
"PostScriptFailureFatal": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "PostScriptFailureFatal", "wlst_path": "WP001", "value": {"default": "true" }, "wlst_type": "boolean" } ],
214+
"PreScript": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "PreScript", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string" } ],
215+
"RestartOnFailure": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "RestartOnFailure", "wlst_path": "WP001", "value": {"default": "false" }, "wlst_type": "boolean" } ],
216+
"SecondsBetweenRestarts": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "SecondsBetweenRestarts", "wlst_path": "WP001", "value": {"default": 30 }, "wlst_type": "integer" } ],
217+
"StrictOwnershipCheck": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "StrictOwnershipCheck", "wlst_path": "WP001", "value": {"default": "false" }, "wlst_type": "boolean" } ],
218+
"UserPreferredServer": [ {"version": "[10,)", "wlst_mode": "offline", "wlst_name": "UserPreferredServer", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string", "get_method": "LSA" } ,
219+
{"version": "[10,)", "wlst_mode": "online", "wlst_name": "UserPreferredServer", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string", "get_method": "GET", "set_method": "MBEAN.set_server_mbean", "set_mbean_type": "weblogic.management.configuration.ServerMBean" } ]
217220
},
218221
"wlst_attributes_path": "WP001",
219222
"wlst_paths": {
@@ -1353,7 +1356,7 @@
13531356
"ClasspathServletDisabled": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "ClasspathServletDisabled", "wlst_path": "WP001", "value": {"default": "false" }, "wlst_type": "boolean" } ],
13541357
"ClasspathServletSecureModeEnabled": [ {"version": "[12.2.1.3,)", "wlst_mode": "both", "wlst_name": "ClasspathServletSecureModeEnabled", "wlst_path": "WP001", "value": {"default": "false" }, "wlst_type": "boolean" } ],
13551358
"ClientCertProxyEnabled": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "ClientCertProxyEnabled", "wlst_path": "WP001", "value": {"default": "false" }, "wlst_type": "boolean" } ],
1356-
"Cluster": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "Cluster", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string", "get_method": "LSA", "set_method": "${MBEAN.set_server_cluster_mbean:MBEAN.set_server_cluster_mbean}", "set_mbean_type": "${:weblogic.management.configuration.ClusterMBean}" } ],
1359+
"Cluster": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "Cluster", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string", "get_method": "LSA", "set_method": "${MBEAN.set_server_cluster_mbean:MBEAN.set_cluster_mbean}", "set_mbean_type": "weblogic.management.configuration.ClusterMBean" } ],
13571360
"ClusterWeight": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "ClusterWeight", "wlst_path": "WP001", "value": {"default": 100 }, "wlst_type": "integer" } ],
13581361
"CoherenceClusterSystemResource": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "CoherenceClusterSystemResource", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string", "get_method": "LSA", "set_method": "${:MBEAN.set_coherence_cluster_mbean}", "set_mbean_type": "${:weblogic.management.configuration.CoherenceClusterSystemResourceMBean}" } ],
13591362
"CompleteCOMMessageTimeout": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "CompleteCOMMessageTimeout", "wlst_path": "WP001", "value": {"default": -1 }, "wlst_type": "integer" } ],

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
@@ -1216,6 +1216,7 @@ WLSDPLY-19307=Unable to extract classpath libraries from archive file {0} to dom
12161216
# wlsdeploy/tool/util/topology_helper.py
12171217
WLSDPLY-19400=Creating placeholder for server template {0}
12181218
WLSDPLY-19401=Creating placeholder for JDBC resource {0}
1219+
WLSDPLY-19402=Creating placeholder for Server resource {0}
12191220

12201221
# wlsdeploy/tool/util/variable_injector.py
12211222
WLSDPLY-19500=Model variable injector values loaded from location {0}

core/src/test/python/aliases_test.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1344,6 +1344,18 @@ def testGetJTA(self):
13441344
online_path = self.online_aliases.get_wlst_mbean_name(location)
13451345
self.assertEqual('mydomain', online_path)
13461346

1347+
def testJTAMigratableConstrainedCandidateServer(self):
1348+
model_value = [ 'MS-1', 'MS-2']
1349+
wlst_value_expected = 'MS-1,MS-2'
1350+
location = LocationContext()
1351+
location.append_location(FOLDERS.SERVER)
1352+
location.add_name_token(self.aliases.get_name_token(location), 'MS-1')
1353+
location.append_location(FOLDERS.JTA_MIGRATABLE_TARGET)
1354+
location.add_name_token(self.aliases.get_name_token(location), 'NO_NAME_0')
1355+
wlst_attribute, wlst_value = \
1356+
self.aliases.get_wlst_attribute_name_and_value(location, FOLDERS.CONSTRAINED_CANDIDATE_SERVER, model_value)
1357+
self.assertEquals(wlst_value_expected, wlst_value)
1358+
13471359

13481360
if __name__ == '__main__':
13491361
unittest.main()

0 commit comments

Comments
 (0)