Skip to content

Commit d97117a

Browse files
Reversed changes not meant to commit
1 parent 4a48b98 commit d97117a

File tree

2 files changed

+62
-57
lines changed

2 files changed

+62
-57
lines changed

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

Lines changed: 61 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -90,71 +90,76 @@ def target_server_groups_to_servers(self, server_groups_to_target):
9090
_method_name = '__target_server_groups_to_servers'
9191

9292
self.logger.entering(server_groups_to_target, class_name=self.__class_name, method_name=_method_name)
93-
if len(server_groups_to_target) > 0:
94-
location = LocationContext()
95-
root_path = self.alias_helper.get_wlst_attributes_path(location)
96-
self.wlst_helper.cd(root_path)
93+
if len(server_groups_to_target) == 0:
94+
return
9795

98-
# We need to get the effective list of servers for the domain. Since any servers
99-
# referenced in the model have already been created but the templates may have
100-
# defined new servers not listed in the model, get the list from WLST.
101-
server_names = self.get_existing_server_names()
102-
103-
# Get the clusters and and their members
104-
cluster_map = self.get_clusters_and_members_map()
105-
106-
location = LocationContext()
107-
root_path = self.alias_helper.get_wlst_attributes_path(location)
108-
self.wlst_helper.cd(root_path)
96+
location = LocationContext()
97+
root_path = self.alias_helper.get_wlst_attributes_path(location)
98+
self.wlst_helper.cd(root_path)
10999

110-
# We need to get the effective list of servers for the domain. Since any servers
111-
# referenced in the model have already been created but the templates may have
112-
# defined new servers not listed in the model, get the list from WLST.
113-
server_names = self.get_existing_server_names()
100+
# We need to get the effective list of servers for the domain. Since any servers
101+
# referenced in the model have already been created but the templates may have
102+
# defined new servers not listed in the model, get the list from WLST.
103+
server_names = self._get_existing_server_names()
114104

115-
# Get the clusters and and their members
116-
cluster_map = self.get_clusters_and_members_map()
105+
# Get the clusters and and their members
106+
cluster_map = self._get_clusters_and_members_map()
117107

118-
# Get any limits that may have been defined in the model
119-
domain_info = self.model.get_model_domain_info()
108+
# Get any limits that may have been defined in the model
109+
domain_info = self.model.get_model_domain_info()
110+
server_group_targeting_limits = \
111+
dictionary_utils.get_dictionary_element(domain_info, SERVER_GROUP_TARGETING_LIMITS)
112+
if len(server_group_targeting_limits) > 0:
120113
server_group_targeting_limits = \
121-
dictionary_utils.get_dictionary_element(domain_info, SERVER_GROUP_TARGETING_LIMITS)
122-
if len(server_group_targeting_limits) > 0:
123-
server_group_targeting_limits = \
124-
self._get_server_group_targeting_limits(server_group_targeting_limits, cluster_map)
125-
126-
# Get the map of server names to server groups to target
127-
server_to_server_groups_map =\
128-
self._get_server_to_server_groups_map(self._admin_server_name,
129-
server_names,
130-
server_groups_to_target,
131-
server_group_targeting_limits) # type: dict
132-
133-
if len(server_names) > 1:
134-
for server, server_groups in server_to_server_groups_map.iteritems():
135-
if len(server_groups) > 0:
136-
server_name = self.wlst_helper.get_quoted_name_for_wlst(server)
137-
self.logger.info('WLSDPLY-12224', str(server_groups), server_name,
138-
class_name=self.__class_name, method_name=_method_name)
139-
self.wlst_helper.set_server_groups(server_name, server_groups)
140-
141-
elif len(server_group_targeting_limits) == 0:
142-
#
143-
# Domain has no managed servers and there were not targeting limits specified to target
144-
# server groups to the admin server so make sure that the server groups are targeted to
145-
# the admin server.
146-
#
147-
# This is really a best effort attempt. It works for JRF domains but it is certainly possible
148-
# that it may cause problems with other custom domain types. Of course, creating a domain with
149-
# no managed servers is not a primary use case of this tool so do it and hope for the best...
150-
#
151-
server_name = self.wlst_helper.get_quoted_name_for_wlst(server_names[0])
152-
self.wlst_helper.set_server_groups(server_name, server_groups_to_target)
114+
self._get_server_group_targeting_limits(server_group_targeting_limits, cluster_map)
115+
116+
# Get the map of server names to server groups to target
117+
server_to_server_groups_map =\
118+
self._get_server_to_server_groups_map(self._admin_server_name,
119+
server_names,
120+
server_groups_to_target,
121+
server_group_targeting_limits) # type: dict
122+
123+
if len(server_names) > 1:
124+
for server, server_groups in server_to_server_groups_map.iteritems():
125+
if len(server_groups) > 0:
126+
server_name = self.wlst_helper.get_quoted_name_for_wlst(server)
127+
self.logger.info('WLSDPLY-12224', str(server_groups), server_name,
128+
class_name=self.__class_name, method_name=_method_name)
129+
self.wlst_helper.set_server_groups(server_name, server_groups)
130+
131+
elif len(server_group_targeting_limits) == 0:
132+
#
133+
# Domain has no managed servers and there were not targeting limits specified to target
134+
# server groups to the admin server so make sure that the server groups are targeted to
135+
# the admin server.
136+
#
137+
# This is really a best effort attempt. It works for JRF domains but it is certainly possible
138+
# that it may cause problems with other custom domain types. Of course, creating a domain with
139+
# no managed servers is not a primary use case of this tool so do it and hope for the best...
140+
#
141+
server_name = self.wlst_helper.get_quoted_name_for_wlst(server_names[0])
142+
self.wlst_helper.set_server_groups(server_name, server_groups_to_target)
153143

154144
self.logger.exiting(class_name=self.__class_name, method_name=_method_name)
155145
return
156146

157-
def get_clusters_and_members_map(self):
147+
def _get_existing_server_names(self):
148+
"""
149+
Get the list of server names from WLST.
150+
:return: the list of server names
151+
:raises: BundleAwareException of the specified type: is an error occurs reading from the aliases or WLST
152+
"""
153+
_method_name = '_get_existing_server_names'
154+
155+
self.logger.entering(class_name=self.__class_name, method_name=_method_name)
156+
server_location = LocationContext().append_location(SERVER)
157+
server_list_path = self.alias_helper.get_wlst_list_path(server_location)
158+
result = self.wlst_helper.get_existing_object_list(server_list_path)
159+
self.logger.exiting(class_name=self.__class_name, method_name=_method_name, result=result)
160+
return result
161+
162+
def _get_clusters_and_members_map(self):
158163
"""
159164
Get a map keyed by cluster name with values that are a list of member server names
160165
:return: the cluster name to member server names map

core/src/main/typedefs/RestrictedJRF.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
},
1818
"RJRF_12213": {
1919
"baseTemplate": "Basic WebLogic Server Domain",
20-
"extensionTemplates": [ "Oracle Restricted JRF" ],
20+
"extensionTemplates": [ "Oracle Restricted JRF", "Oracle Enterprise Manager-Restricted JRF" ],
2121
"serverGroupsToTarget": [ "JRF-MAN-SVR", "WSM-CACHE-SVR", "JRF-WS-CORE-MAN-SVR" ],
2222
"rcuSchemas": [ ]
2323
},

0 commit comments

Comments
 (0)