Skip to content

Commit 29250b2

Browse files
Wdt 343 ds assigned to admin because not targeted (#546)
* remove extra updates * Datasource targeted to datasource by create domain * fix for create domain order of applying templates * fix integration test now exposed problem from rearrange of code * fix the rest of the integration test mismatches * Fix for update domain when adding new server or cluster along with targeted resources
1 parent 0980f60 commit 29250b2

File tree

9 files changed

+131
-472
lines changed

9 files changed

+131
-472
lines changed

core/src/main/python/update.py

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,23 @@ def __update_online(model, model_context, aliases):
239239

240240
exit_code = 0
241241

242+
__update_online_domain(model_context)
243+
244+
topology_updater.set_server_groups()
245+
__update_online_domain(model_context)
246+
model_deployer.deploy_applications(model, model_context, aliases, wlst_mode=__wlst_mode)
247+
248+
try:
249+
__wlst_helper.disconnect()
250+
except BundleAwareException, ex:
251+
# All the changes are made and active so don't raise an error that causes the program
252+
# to indicate a failure...just log the error since the process is going to exit anyway.
253+
__logger.warning('WLSDPLY-09009', _program_name, ex.getLocalizedMessage(), error=ex,
254+
class_name=_class_name, method_name=_method_name)
255+
return exit_code
256+
257+
258+
def __update_online_domain(model_context):
242259
try:
243260
# First we enable the stdout again and then redirect the stdoout to a string output stream
244261
# call isRestartRequired to get the output, capture the string and then silence wlst output again
@@ -263,17 +280,6 @@ def __update_online(model, model_context, aliases):
263280
__release_edit_session_and_disconnect()
264281
raise ex
265282

266-
model_deployer.deploy_applications(model, model_context, aliases, wlst_mode=__wlst_mode)
267-
268-
try:
269-
__wlst_helper.disconnect()
270-
except BundleAwareException, ex:
271-
# All the changes are made and active so don't raise an error that causes the program
272-
# to indicate a failure...just log the error since the process is going to exit anyway.
273-
__logger.warning('WLSDPLY-09009', _program_name, ex.getLocalizedMessage(), error=ex,
274-
class_name=_class_name, method_name=_method_name)
275-
return exit_code
276-
277283

278284
def __update_offline(model, model_context, aliases):
279285
"""
@@ -298,11 +304,11 @@ def __update_offline(model, model_context, aliases):
298304
rcu_helper = RCUHelper(model, model_context, aliases)
299305
rcu_helper.update_rcu_password()
300306

301-
try:
302-
__wlst_helper.update_domain()
303-
except BundleAwareException, ex:
304-
__close_domain_on_error()
305-
raise ex
307+
__update_offline_domain()
308+
309+
topology_updater.set_server_groups()
310+
311+
__update_offline_domain()
306312

307313
model_deployer.deploy_model_after_update(model, model_context, aliases, wlst_mode=__wlst_mode)
308314

@@ -316,6 +322,14 @@ def __update_offline(model, model_context, aliases):
316322
return 0
317323

318324

325+
def __update_offline_domain():
326+
327+
try:
328+
__wlst_helper.update_domain()
329+
except BundleAwareException, ex:
330+
__close_domain_on_error()
331+
raise ex
332+
319333
def __release_edit_session_and_disconnect():
320334
"""
321335
An online error recovery method.

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

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

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

Lines changed: 69 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,9 @@ def create(self):
174174
self.__fail_mt_1221_domain_creation()
175175
self.__create_domain()
176176
self.__deploy()
177+
self.__deploy_after_update()
177178
self.__create_boot_dot_properties()
179+
178180
self.logger.exiting(class_name=self.__class_name, method_name=_method_name)
179181
return
180182

@@ -339,11 +341,12 @@ def __create_domain(self):
339341
self.model_context.set_domain_home(self._domain_home)
340342

341343
if self.wls_helper.is_select_template_supported():
342-
self.__create_domain_with_select_template(self._domain_home)
344+
self.__create_base_domain_with_select_template(self._domain_home)
343345
else:
344346
self.__create_base_domain(self._domain_home)
345-
self.__extend_domain(self._domain_home)
346347

348+
topology_folder_list = self.alias_helper.get_model_topology_top_level_folder_names()
349+
self.__apply_base_domain_config(topology_folder_list)
347350
if len(self.files_to_extract_from_archive) > 0:
348351
for file_to_extract in self.files_to_extract_from_archive:
349352
self.archive_helper.extract_file(file_to_extract)
@@ -356,23 +359,48 @@ def __create_domain(self):
356359
self.logger.exiting(class_name=self.__class_name, method_name=_method_name)
357360
return
358361

362+
def __extend_domain_svrgrps(self):
363+
"""
364+
Create the domain.
365+
:raises: CreateException: if an error occurs
366+
"""
367+
_method_name = '__create_domain'
368+
369+
self.logger.entering(class_name=self.__class_name, method_name=_method_name)
370+
domain_type = self.model_context.get_domain_type()
371+
self.logger.info('WLSDPLY-12203', domain_type, class_name=self.__class_name, method_name=_method_name)
372+
373+
self.wlst_helper.read_domain(self._domain_home)
374+
375+
if self.wls_helper.is_select_template_supported():
376+
self.__extend_domain_with_select_template(self._domain_home)
377+
else:
378+
self.__extend_domain(self._domain_home)
379+
380+
self.wlst_helper.update_domain()
381+
self.logger.exiting(class_name=self.__class_name, method_name=_method_name)
382+
return
383+
359384
def __deploy(self):
360385
"""
361386
Update the domain with domain attributes, resources and deployments.
387+
Check for the correct method of updating the domain for creation.
362388
:raises: CreateException: if an error occurs while reading or updating the domain.
363389
"""
364390
self.model_context.set_domain_home(self._domain_home)
365-
self.wlst_helper.read_domain(self._domain_home)
366391
self.__set_domain_attributes()
367392
self._configure_security_configuration()
368393
self.__deploy_resources_and_apps()
369394
self.wlst_helper.update_domain()
370-
371-
model_deployer.deploy_model_after_update(self.model, self.model_context, self.aliases)
372-
373395
self.wlst_helper.close_domain()
396+
374397
return
375398

399+
def __deploy_after_update(self):
400+
401+
self.__extend_domain_svrgrps()
402+
model_deployer.deploy_model_after_update(self.model, self.model_context, self.aliases)
403+
376404
def __deploy_resources_and_apps(self):
377405
"""
378406
Deploy the resources and applications.
@@ -397,15 +425,15 @@ def __create_base_domain(self, domain_home):
397425
base_template = self._domain_typedef.get_base_template()
398426
self.logger.info('WLSDPLY-12204', base_template, class_name=self.__class_name, method_name=_method_name)
399427
self.wlst_helper.read_template(base_template)
400-
self.__apply_base_domain_config(self.__topology_folder_list)
428+
self.__set_core_domain_params()
401429

402430
self.logger.info('WLSDPLY-12205', self._domain_name, domain_home,
403431
class_name=self.__class_name, method_name=_method_name)
404432
self.wlst_helper.write_domain(domain_home)
405433

406434
self.logger.info('WLSDPLY-12206', self._domain_name, class_name=self.__class_name, method_name=_method_name)
407435
self.wlst_helper.close_template()
408-
436+
self.wlst_helper.read_domain(domain_home)
409437
self.logger.exiting(class_name=self.__class_name, method_name=_method_name)
410438
return
411439

@@ -418,14 +446,14 @@ def __extend_domain(self, domain_home):
418446
_method_name = '__extend_domain'
419447

420448
self.logger.entering(domain_home, class_name=self.__class_name, method_name=_method_name)
449+
421450
extension_templates = self._domain_typedef.get_extension_templates()
422451
custom_templates = self._domain_typedef.get_custom_extension_templates()
423452
if (len(extension_templates) == 0) and (len(custom_templates) == 0):
424453
return
425454

426455
self.logger.info('WLSDPLY-12207', self._domain_name, domain_home,
427456
class_name=self.__class_name, method_name=_method_name)
428-
self.wlst_helper.read_domain(domain_home)
429457
self.__set_app_dir()
430458

431459
for extension_template in extension_templates:
@@ -444,56 +472,74 @@ def __extend_domain(self, domain_home):
444472
# 12c versions set server groups directly
445473
server_groups_to_target = self._domain_typedef.get_server_groups_to_target()
446474
self.target_helper.target_server_groups_to_servers(server_groups_to_target)
447-
self.wlst_helper.update_domain()
448475

449476
elif self._domain_typedef.is_jrf_domain_type() or \
450477
(self._domain_typedef.get_targeting() == TargetingType.APPLY_JRF):
451478
# for 11g, if template list includes JRF, or if specified in domain typedef, use applyJRF
452-
self.target_helper.target_jrf_groups_to_clusters_servers(domain_home)
453-
454-
else:
455-
# for 11g, if no targeting was needed, just update the domain
456-
self.wlst_helper.update_domain()
479+
self.target_helper.target_jrf_groups_to_clusters_servers()
457480

458-
self.wlst_helper.close_domain()
459481
self.logger.info('WLSDPLY-12209', self._domain_name,
460482
class_name=self.__class_name, method_name=_method_name)
461483

462484
self.logger.exiting(class_name=self.__class_name, method_name=_method_name)
463485
return
464486

465-
def __create_domain_with_select_template(self, domain_home):
487+
def __create_base_domain_with_select_template(self, domain_home):
466488
"""
467489
Create and extend the domain, as needed, for WebLogic Server versions 12.2.1 and above.
468490
:param domain_home: the domain home directory
469491
:raises: CreateException: if an error occurs
470492
"""
471-
_method_name = '__create_domain_with_select_template'
493+
_method_name = '__create_base_domain_with_select_template'
472494

473495
self.logger.entering(domain_home, class_name=self.__class_name, method_name=_method_name)
474496
base_template = self._domain_typedef.get_base_template()
475497
self.logger.info('WLSDPLY-12210', base_template,
476498
class_name=self.__class_name, method_name=_method_name)
477499

478500
self.wlst_helper.select_template(base_template)
501+
self.wlst_helper.load_templates()
502+
503+
self.__set_core_domain_params()
504+
self.logger.info('WLSDPLY-12205', self._domain_name, domain_home,
505+
class_name=self.__class_name, method_name=_method_name)
506+
self.wlst_helper.write_domain(domain_home)
507+
self.wlst_helper.close_template()
508+
self.logger.info('WLSDPLY-12206', self._domain_name, domain_home,
509+
class_name=self.__class_name, method_name=_method_name)
510+
self.wlst_helper.read_domain(domain_home)
511+
512+
self.logger.exiting(class_name=self.__class_name, method_name=_method_name)
513+
return
514+
515+
def __extend_domain_with_select_template(self, domain_home):
516+
"""
517+
Create and extend the domain, as needed, for WebLogic Server versions 12.2.1 and above.
518+
:param domain_home: the domain home directory
519+
:raises: CreateException: if an error occurs
520+
"""
521+
_method_name = '__extend_domain_with_select_template'
522+
523+
self.logger.entering(domain_home, class_name=self.__class_name, method_name=_method_name)
479524

480525
extension_templates = self._domain_typedef.get_extension_templates()
526+
custom_templates = self._domain_typedef.get_custom_extension_templates()
527+
if (len(extension_templates) == 0) and (len(custom_templates) == 0):
528+
return
529+
481530
for extension_template in extension_templates:
482531
self.logger.info('WLSDPLY-12211', extension_template,
483532
class_name=self.__class_name, method_name=_method_name)
484533
self.wlst_helper.select_template(extension_template)
485534

486-
custom_templates = self._domain_typedef.get_custom_extension_templates()
487535
for custom_template in custom_templates:
488536
self.logger.info('WLSDPLY-12245', custom_template,
489537
class_name=self.__class_name, method_name=_method_name)
490538
self.wlst_helper.select_custom_template(custom_template)
491539

492540
self.logger.info('WLSDPLY-12212', class_name=self.__class_name, method_name=_method_name)
493-
self.wlst_helper.load_templates()
494-
495-
topology_folder_list = self.alias_helper.get_model_topology_top_level_folder_names()
496-
self.__apply_base_domain_config(topology_folder_list)
541+
if len(extension_templates) > 0 or len(custom_templates) > 0:
542+
self.wlst_helper.load_templates()
497543

498544
if len(extension_templates) > 0:
499545
self.__set_app_dir()
@@ -509,9 +555,6 @@ def __create_domain_with_select_template(self, domain_home):
509555

510556
self.__configure_opss_secrets()
511557

512-
self.wlst_helper.write_domain(domain_home)
513-
self.wlst_helper.close_template()
514-
515558
if len(dynamic_assigns) > 0:
516559
self.target_helper.target_server_groups_to_dynamic_clusters(dynamic_assigns)
517560

@@ -533,8 +576,6 @@ def __apply_base_domain_config(self, topology_folder_list):
533576
domain_name_token = self.alias_helper.get_name_token(location)
534577
location.add_name_token(domain_name_token, self._domain_name)
535578

536-
self.__set_core_domain_params()
537-
538579
self.__create_security_folder(location)
539580
topology_folder_list.remove(SECURITY)
540581

@@ -718,7 +759,6 @@ def __create_clusters_and_servers(self, location):
718759
# create placeholders for JDBC resources that may be referenced in cluster definition.
719760
resources_dict = self.model.get_model_resources()
720761
self.topology_helper.create_placeholder_jdbc_resources(resources_dict)
721-
722762
cluster_nodes = dictionary_utils.get_dictionary_element(self._topology, CLUSTER)
723763
if len(cluster_nodes) > 0:
724764
self._create_named_mbeans(CLUSTER, cluster_nodes, location, log_created=True)

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

Lines changed: 6 additions & 7 deletions
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.
33
Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
44
"""
55
from wlsdeploy.aliases.location_context import LocationContext
@@ -125,23 +125,22 @@ def update(self):
125125
for folder_name in remaining:
126126
self._process_section(self._topology, folder_list, folder_name, location)
127127

128+
self.library_helper.install_domain_libraries()
129+
self.library_helper.extract_classpath_libraries()
130+
self.library_helper.install_domain_scripts()
131+
132+
def set_server_groups(self):
128133
if self.wls_helper.is_set_server_groups_supported():
129134
server_groups_to_target = self._domain_typedef.get_server_groups_to_target()
130135
server_assigns, dynamic_assigns = \
131136
self.target_helper.target_server_groups_to_servers(server_groups_to_target)
132137
if len(dynamic_assigns) > 0:
133-
self.wlst_helper.save_and_close(self.model_context)
134138
self.target_helper.target_server_groups_to_dynamic_clusters(dynamic_assigns)
135-
self.wlst_helper.reopen(self.model_context)
136139
if len(server_assigns) > 0:
137140
self.target_helper.target_server_groups(server_assigns)
138141
elif self._domain_typedef.is_jrf_domain_type():
139142
self.target_helper.target_jrf_groups_to_clusters_servers()
140143

141-
self.library_helper.install_domain_libraries()
142-
self.library_helper.extract_classpath_libraries()
143-
self.library_helper.install_domain_scripts()
144-
145144
def _process_section(self, folder_dict, folder_list, key, location):
146145
if key in folder_dict:
147146
nodes = dictionary_utils.get_dictionary_element(folder_dict, key)

0 commit comments

Comments
 (0)