Skip to content

Commit 07a819e

Browse files
authored
Merge pull request #771 from oracle/WDT-500-dont-write-empty-restart-file
do not write empty restart file
2 parents d7a10eb + 8cddec7 commit 07a819e

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

core/src/main/python/deploy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ def __deploy_online(model, model_context, aliases):
161161
__wlst_helper.activate(model_context.get_model_config().get_activate_timeout())
162162
if restart_required:
163163
exit_code = CommandLineArgUtil.PROG_RESTART_REQUIRED
164-
deployer_utils.list_restarts(model_context)
164+
exit_code = deployer_utils.list_restarts(model_context, exit_code)
165165
except BundleAwareException, ex:
166166
__release_edit_session_and_disconnect()
167167
raise ex

core/src/main/python/update.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ def __check_update_require_domain_restart(model_context):
199199
__wlst_helper.activate(model_context.get_model_config().get_activate_timeout())
200200
if restart_required:
201201
exit_code = CommandLineArgUtil.PROG_RESTART_REQUIRED
202-
deployer_utils.list_restarts(model_context)
202+
exit_code = deployer_utils.list_restarts(model_context, exit_code)
203203

204204
except BundleAwareException, ex:
205205
__release_edit_session_and_disconnect()

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -453,26 +453,31 @@ def get_cluster_for_server(server_name, aliases):
453453
return cluster_name
454454

455455

456-
def list_restarts(model_context):
456+
def list_restarts(model_context, exit_code):
457457
"""
458458
Get the list of restarts and save this list in format to restart.file
459459
in the -output_dirs location. If the output_dirs is not included, bypass
460460
writing to the restart file.
461461
:param model_context: instance of the tool model context
462+
:param exit_code: current exit code for online restarts
462463
"""
463464
_method_name = 'list_restarts'
464465
_logger.entering(model_context.get_output_dir(), class_name=_class_name, method_name=_method_name)
465466
restart_list = get_list_of_restarts()
466467
output_dirs = model_context.get_output_dir()
467-
if output_dirs is not None:
468+
result = exit_code
469+
if len(restart_list) == 0:
470+
result = 0
471+
elif output_dirs is not None:
468472
file_name = os.path.join(output_dirs, 'restart.file')
469473
pw = FileUtils.getPrintWriter(file_name)
470474
for entry in restart_list:
471475
line = '%s:%s:%s:%s' % (entry[0], entry[1], entry[2], entry[3])
472476
_logger.finer('WLSDPLY-09208', line, class_name=_class_name, method_name=_method_name)
473477
pw.println(line)
474478
pw.close()
475-
_logger.exiting(class_name=_class_name, method_name=_method_name)
479+
_logger.exiting(class_name=_class_name, method_name=_method_name, result=result)
480+
return result
476481

477482

478483
def get_list_of_restarts():

0 commit comments

Comments
 (0)