Skip to content

Commit b513c8a

Browse files
committed
In wko_filter, check for servers with different listen ports in the same cluster
1 parent c3fb530 commit b513c8a

File tree

3 files changed

+37
-6
lines changed

3 files changed

+37
-6
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def _apply_filter(model, the_filter, model_context, filter_file_location):
9595
path = dictionary_utils.get_element(the_filter, 'path')
9696
if path is not None:
9797
name = dictionary_utils.get_element(the_filter, 'name')
98-
__logger.info('WLSDPLY-20035', name, class_name=__class_name, method_name=_method_name)
98+
__logger.info('WLSDPLY-20033', name, class_name=__class_name, method_name=_method_name)
9999
return _apply_path_filter(model, path)
100100

101101
__logger.severe('WLSDPLY-20019', str(filter_file_location), class_name=__class_name, method_name=_method_name)

core/src/main/python/wlsdeploy/tool/util/filters/wko_filter.py

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
from wlsdeploy.aliases.model_constants import CALCULATED_LISTEN_PORTS
1212
from wlsdeploy.aliases.model_constants import CLUSTER
1313
from wlsdeploy.aliases.model_constants import DYNAMIC_SERVERS
14+
from wlsdeploy.aliases.model_constants import LISTEN_PORT
15+
from wlsdeploy.aliases.model_constants import SERVER
1416
from wlsdeploy.aliases.model_constants import TOPOLOGY
1517
from wlsdeploy.aliases.validation_codes import ValidationCodes
1618
from wlsdeploy.aliases.wlst_modes import WlstModes
@@ -64,10 +66,36 @@ def check_clustered_server_ports(model, model_context):
6466
if dynamic_folder:
6567
calculated_listen_ports = dynamic_folder[CALCULATED_LISTEN_PORTS]
6668
if (calculated_listen_ports is None) or alias_utils.convert_boolean(calculated_listen_ports):
67-
_logger.info('WLSDPLY-20036', CALCULATED_LISTEN_PORTS, cluster_name, class_name=_class_name,
69+
_logger.info('WLSDPLY-20202', CALCULATED_LISTEN_PORTS, CLUSTER, cluster_name, class_name=_class_name,
6870
method_name=_method_name)
6971
dynamic_folder[CALCULATED_LISTEN_PORTS] = False
7072

73+
# be sure every server assigned to a cluster has the same listen port
74+
75+
server_port_map = {}
76+
servers_folder = dictionary_utils.get_dictionary_element(topology_folder, SERVER)
77+
for server_name, server_fields in servers_folder.items():
78+
server_cluster = server_fields[CLUSTER]
79+
server_port = server_fields[LISTEN_PORT]
80+
81+
if server_cluster and (server_port is not None):
82+
server_port_text = str(server_port)
83+
if '@@' in server_port_text:
84+
# prepareModel filters the model before and after it is tokenized,
85+
# so disregard variable values in the tokenized pass
86+
continue
87+
88+
if server_cluster in server_port_map:
89+
cluster_info = server_port_map[server_cluster]
90+
first_server = cluster_info["firstServer"]
91+
cluster_port = cluster_info["serverPort"]
92+
if server_port_text != cluster_port:
93+
_logger.warning('WLSDPLY-20203', SERVER, first_server, server_name, CLUSTER, server_cluster,
94+
LISTEN_PORT, cluster_port, server_port_text, class_name=_class_name,
95+
method_name=_method_name)
96+
else:
97+
server_port_map[server_cluster] = {"firstServer": server_name, "serverPort": server_port_text}
98+
7199

72100
class OnlineAttributeFilter(ModelTraverse):
73101
"""
@@ -89,5 +117,5 @@ def unrecognized_field(self, model_dict, key, model_location):
89117
result, message = self._aliases.is_valid_model_attribute_name(model_location, key)
90118
if result == ValidationCodes.VERSION_INVALID:
91119
path = self._aliases.get_model_folder_path(model_location)
92-
_logger.info('WLSDPLY-20033', key, path, class_name=_class_name, method_name=_method_name)
120+
_logger.info('WLSDPLY-20201', key, path, class_name=_class_name, method_name=_method_name)
93121
del model_dict[key]

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1633,10 +1633,13 @@ WLSDPLY-20029=Specified validation method to use was empty or null
16331633
WLSDPLY-20030=Specified validation method {0} is invalid, must be one of: {1}
16341634
WLSDPLY-20031={0} specified Variable File {1} is not a valid file: {2}
16351635
WLSDPLY-20032=No model specified and no model in archive, no validation performed
1636-
WLSDPLY-20033=Unsupported attribute {0} at location {1} removed from model
1636+
WLSDPLY-20033=Applying filter with name "{0}"
16371637
WLSDPLY-20034=Applying filter with ID "{0}"
1638-
WLSDPLY-20035=Applying filter with name "{0}"
1639-
WLSDPLY-20036=Changing {0} to false for cluster "{1}"
1638+
1639+
# Messages for internal filters
1640+
WLSDPLY-20201=Unsupported attribute {0} at location {1} removed from model
1641+
WLSDPLY-20202=Changing {0} to false for {1} "{2}"
1642+
WLSDPLY-20203={0} entries "{1}" and "{2}" in {3} "{4}" have different {5} values: {6} and {7}
16401643

16411644
# Common messages used for tool exit and clean-up
16421645
WLSDPLY-21000={0} Messages:

0 commit comments

Comments
 (0)