Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions core/src/main/python/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
CommandLineArgUtil.PASSPHRASE_SWITCH,
CommandLineArgUtil.OUTPUT_DIR_SWITCH,
CommandLineArgUtil.DISCARD_CURRENT_EDIT_SWITCH,
CommandLineArgUtil.ROLLBACK_IF_RESTART_REQ_SWITCH
CommandLineArgUtil.CANCEL_CHANGES_IF_RESTART_REQ_SWITCH
]


Expand Down Expand Up @@ -152,15 +152,16 @@ def __deploy_online(model, model_context, aliases):
restart_required = __wlst_helper.is_restart_required()
is_restartreq_output = sostream.get_string()
__wlst_helper.silence()
if model_context.is_rollback_if_restart_required() and restart_required:
if model_context.is_cancel_changes_if_restart_required() and restart_required:
__wlst_helper.cancel_edit()
__logger.warning('WLSDPLY_09015', is_restartreq_output)
exit_code = CommandLineArgUtil.PROG_ROLLBACK_IF_RESTART_EXIT_CODE
deployer_utils.list_rollback_changes(model_context, is_restartreq_output)
exit_code = CommandLineArgUtil.PROG_CANCEL_CHANGES_IF_RESTART_EXIT_CODE
deployer_utils.list_non_dynamic_changes(model_context, is_restartreq_output)
else:
__wlst_helper.save()
__wlst_helper.activate(model_context.get_model_config().get_activate_timeout())
if restart_required:
deployer_utils.list_non_dynamic_changes(model_context, is_restartreq_output)
exit_code = CommandLineArgUtil.PROG_RESTART_REQUIRED
exit_code = deployer_utils.list_restarts(model_context, exit_code)
except BundleAwareException, ex:
Expand Down
13 changes: 7 additions & 6 deletions core/src/main/python/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
CommandLineArgUtil.ADMIN_PASS_SWITCH,
CommandLineArgUtil.USE_ENCRYPTION_SWITCH,
CommandLineArgUtil.PASSPHRASE_SWITCH,
CommandLineArgUtil.ROLLBACK_IF_RESTART_REQ_SWITCH,
CommandLineArgUtil.CANCEL_CHANGES_IF_RESTART_REQ_SWITCH,
CommandLineArgUtil.OUTPUT_DIR_SWITCH,
CommandLineArgUtil.UPDATE_RCU_SCHEMA_PASS_SWITCH,
CommandLineArgUtil.DISCARD_CURRENT_EDIT_SWITCH
Expand Down Expand Up @@ -168,9 +168,9 @@ def __update_online(model, model_context, aliases):
raise de

exit_code = __check_update_require_domain_restart(model_context)
# if user requested rollback if restart required stops
# if user requested cancel changes if restart required stops

if exit_code != CommandLineArgUtil.PROG_ROLLBACK_IF_RESTART_EXIT_CODE:
if exit_code != CommandLineArgUtil.PROG_CANCEL_CHANGES_IF_RESTART_EXIT_CODE:
model_deployer.deploy_applications(model, model_context, aliases, wlst_mode=__wlst_mode)

try:
Expand All @@ -197,16 +197,17 @@ def __check_update_require_domain_restart(model_context):
restart_required = __wlst_helper.is_restart_required()
is_restartreq_output = sostream.get_string()
__wlst_helper.silence()
if model_context.is_rollback_if_restart_required() and restart_required:
if model_context.is_cancel_changes_if_restart_required() and restart_required:
__wlst_helper.cancel_edit()
__logger.warning('WLSDPLY_09015', is_restartreq_output)
exit_code = CommandLineArgUtil.PROG_ROLLBACK_IF_RESTART_EXIT_CODE
deployer_utils.list_rollback_changes(model_context, is_restartreq_output)
exit_code = CommandLineArgUtil.PROG_CANCEL_CHANGES_IF_RESTART_EXIT_CODE
deployer_utils.list_non_dynamic_changes(model_context, is_restartreq_output)
else:
__wlst_helper.save()
__wlst_helper.activate(model_context.get_model_config().get_activate_timeout())
if restart_required:
exit_code = CommandLineArgUtil.PROG_RESTART_REQUIRED
deployer_utils.list_non_dynamic_changes(model_context, is_restartreq_output)
exit_code = deployer_utils.list_restarts(model_context, exit_code)

except BundleAwareException, ex:
Expand Down
14 changes: 7 additions & 7 deletions core/src/main/python/wlsdeploy/tool/deploy/deployer_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,19 +494,19 @@ def list_restarts(model_context, exit_code):
return result


def list_rollback_changes(model_context, rollback_string):
def list_non_dynamic_changes(model_context, non_dynamic_changes_string):
"""
If output dir is present in the model context, write the restart data to the output dir as rollback.file.
If output dir is present in the model context, write the restart data to the output dir as non_dynamic_changes.file.
:param model_context: Current context with the run parameters.
:param rollback_string: java.lang.String of changes that were rolled back
:param non_dynamic_changes_string: java.lang.String of changes that were non dynamic
"""
_method_name = 'list_rollback_changes'
_method_name = 'list_non_dynamic_changes'
_logger.entering(class_name=_class_name, method_name=_method_name)
output_dir = model_context.get_output_dir()
if len(str(rollback_string)) > 0 and output_dir is not None:
file_name = os.path.join(output_dir, 'rollback.file')
if len(str(non_dynamic_changes_string)) > 0 and output_dir is not None:
file_name = os.path.join(output_dir, 'non_dynamic_changes.file')
pw = FileUtils.getPrintWriter(file_name)
pw.println(rollback_string)
pw.println(non_dynamic_changes_string)
pw.close()


Expand Down
6 changes: 3 additions & 3 deletions core/src/main/python/wlsdeploy/util/cla_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class CommandLineArgUtil(object):
ENCRYPT_MANUAL_SWITCH = '-manual'
# phony arg used as a key to store the password
ONE_PASS_SWITCH = '-password'
ROLLBACK_IF_RESTART_REQ_SWITCH = '-rollback_if_restart_required'
CANCEL_CHANGES_IF_RESTART_REQ_SWITCH = '-cancel_changes_if_restart_required'
USE_ENCRYPTION_SWITCH = '-use_encryption'
RUN_RCU_SWITCH = '-run_rcu'
TARGET_VERSION_SWITCH = '-target_version'
Expand Down Expand Up @@ -96,7 +96,7 @@ class CommandLineArgUtil(object):
FOLDERS_ONLY_SWITCH,
MODEL_SAMPLE_SWITCH,
RECURSIVE_SWITCH,
ROLLBACK_IF_RESTART_REQ_SWITCH,
CANCEL_CHANGES_IF_RESTART_REQ_SWITCH,
RUN_RCU_SWITCH,
UPDATE_RCU_SCHEMA_PASS_SWITCH,
DISCARD_CURRENT_EDIT_SWITCH,
Expand All @@ -119,7 +119,7 @@ class CommandLineArgUtil(object):
USAGE_ERROR_EXIT_CODE = 99
ARG_VALIDATION_ERROR_EXIT_CODE = 98
PROG_RESTART_REQUIRED = 103
PROG_ROLLBACK_IF_RESTART_EXIT_CODE = 104
PROG_CANCEL_CHANGES_IF_RESTART_EXIT_CODE = 104
PROG_ERROR_EXIT_CODE = 2
PROG_WARNING_EXIT_CODE = 1
PROG_OK_EXIT_CODE = 0
Expand Down
16 changes: 8 additions & 8 deletions core/src/main/python/wlsdeploy/util/model_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def __init__(self, program_name, arg_map):
self._opss_wallet = None
self._update_rcu_schema_pass = False
self._validation_method = None
self._rollback_if_restart_required = None
self._cancel_changes_if_restart_required = None
self._domain_resource_file = None
self._output_dir = None
self._target = None
Expand Down Expand Up @@ -187,8 +187,8 @@ def __copy_from_args(self, arg_map):
if CommandLineArgUtil.ONE_PASS_SWITCH in arg_map:
self._encrypt_one_pass = arg_map[CommandLineArgUtil.ONE_PASS_SWITCH]

if CommandLineArgUtil.ROLLBACK_IF_RESTART_REQ_SWITCH in arg_map:
self._rollback_if_restart_required = arg_map[CommandLineArgUtil.ROLLBACK_IF_RESTART_REQ_SWITCH]
if CommandLineArgUtil.CANCEL_CHANGES_IF_RESTART_REQ_SWITCH in arg_map:
self._cancel_changes_if_restart_required = arg_map[CommandLineArgUtil.CANCEL_CHANGES_IF_RESTART_REQ_SWITCH]

if CommandLineArgUtil.USE_ENCRYPTION_SWITCH in arg_map:
self._use_encryption = arg_map[CommandLineArgUtil.USE_ENCRYPTION_SWITCH]
Expand Down Expand Up @@ -296,8 +296,8 @@ def __copy__(self):
arg_map[CommandLineArgUtil.ENCRYPT_MANUAL_SWITCH] = self._encrypt_manual
if self._encrypt_one_pass is not None:
arg_map[CommandLineArgUtil.ONE_PASS_SWITCH] = self._encrypt_one_pass
if self._rollback_if_restart_required is not None:
arg_map[CommandLineArgUtil.ROLLBACK_IF_RESTART_REQ_SWITCH] = self._rollback_if_restart_required
if self._cancel_changes_if_restart_required is not None:
arg_map[CommandLineArgUtil.CANCEL_CHANGES_IF_RESTART_REQ_SWITCH] = self._cancel_changes_if_restart_required
if self._use_encryption is not None:
arg_map[CommandLineArgUtil.USE_ENCRYPTION_SWITCH] = self._use_encryption
if self._archive_file is not None:
Expand Down Expand Up @@ -452,12 +452,12 @@ def get_archive_file_name(self):
"""
return self._archive_file_name

def is_rollback_if_restart_required(self):
def is_cancel_changes_if_restart_required(self):
"""
Get the rollback if restart required
Get the cancel changes if restart required
:return: true or false
"""
return self._rollback_if_restart_required
return self._cancel_changes_if_restart_required

def is_discard_current_edit(self):
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1013,7 +1013,7 @@ WLSDPLY-09012=While handling an error, failed to stop the current edit session a
WLSDPLY-09013=While handling an error, failed to close the domain: {0}
WLSDPLY-09014={0} was unable to load the model from {1} due to a translation error: {2}
WLSDPLY-09015={0} deployment failed: {1}
WLSDPLY_09015=Online update has been rollback because the flag rollback_if_restart_required is set and the update requires \
WLSDPLY_09015=Online update has been canceled because the flag cancel_changes_if_restart_required is set and the update requires \
restart: {0}
WLSDPLY-09016=There are outstanding changes but -discard_current_edit has been specified, all changes have been \
discarded before processing update.
Expand Down
6 changes: 3 additions & 3 deletions installer/src/main/bin/deployApps.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ ECHO [-model_file ^<model_file^>]
ECHO [-variable_file ^<variable_file^>]
ECHO [-domain_type ^<domain_type^>]
ECHO [-wlst_path ^<wlst_path^>]
ECHO [-rollback_if_restart_required]
ECHO [-canel_changes_if_restart_required]
ECHO [-discard_current_edit]
ECHO [-output_dir]
ECHO [-admin_url ^<admin_url^>
Expand Down Expand Up @@ -115,12 +115,12 @@ ECHO admin_url - the admin server URL (used for online deploy)
ECHO.
ECHO admin_user - the admin username (used for online deploy)
ECHO.
ECHO rollback_if_restart_required - rollback the changes if the update requires domain restart
ECHO cancel_changes_if_restart_required - cancel the changes if the update requires domain restart
ECHO.
ECHO discard_current_edit - discard all existing changes before starting update
ECHO.
ECHO output_dir - if present, write restart information to this directory as restart.file, or,
ECHO if rollback_if_restart_required used, write rollback information to rollback.file
ECHO if cancel_changes_if_restart_required used, write non dynamic changes information to non_dynamic_changes.file
ECHO.
ECHO The -use_encryption switch tells the program that one or more of the
ECHO passwords in the model or variables files are encrypted. The program will
Expand Down
6 changes: 3 additions & 3 deletions installer/src/main/bin/deployApps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ usage() {
echo " [-variable_file <variable_file>]"
echo " [-domain_type <domain_type>]"
echo " [-wlst_path <wlst_path>]"
echo " [-rollback_if_restart_required]"
echo " [-cancel_changes_if_restart_required]"
echo " [-discard_current_edit]"
echo " [-output_dir]"
echo " [-admin_url <admin_url>"
Expand Down Expand Up @@ -76,12 +76,12 @@ usage() {
echo ""
echo " admin_user - the admin username (used for online deploy)"
echo ""
echo " rollback_if_restart_required - rollback the changes if the update requires domain restart"
echo " cancel_changes_if_restart_required - cancel the changes if the update requires domain restart"
echo ""
echo " discard_current_edit - discard all existing changes before starting update"
echo ""
echo " output_dir - if present, write restart information to this directory in restart.file, or,"
echo " if rollback_if_restart_required used, write rollback information to rollback.file"
echo " if canel_changes_if_restart_required used, write non dynamic changes information to non_dynamic_changes.file"
echo ""
echo " The -use_encryption switch tells the program that one or more of the"
echo " passwords in the model or variables files are encrypted. The program will"
Expand Down
2 changes: 1 addition & 1 deletion installer/src/main/bin/shared.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ GOTO :EOF

IF "%RETURN_CODE%" == "104" (
ECHO.
ECHO %SCRIPT_NAME% completed successfully but the domain changes have been rolled back because -rollback_if_restart_required is specified ^(exit code = %RETURN_CODE%^)
ECHO %SCRIPT_NAME% completed successfully but the domain changes have been canceled because -cancel_changes_if_restart_required is specified ^(exit code = %RETURN_CODE%^)
EXIT /B %RETURN_CODE%
)
IF "%RETURN_CODE%" == "103" (
Expand Down
2 changes: 1 addition & 1 deletion installer/src/main/bin/shared.sh
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ checkExitCode() {

if [ $returnCode -eq 104 ]; then
echo ""
echo "$scriptName completed successfully but the domain changes have been rolled back because -rollback_if_restart_required is specified (exit code = ${RETURN_CODE})"
echo "$scriptName completed successfully but the domain changes have been canceled because -cancel_changes_if_restart_required is specified (exit code = ${RETURN_CODE})"
elif [ $returnCode -eq 103 ]; then
echo ""
echo "$scriptName completed successfully but the domain requires a restart for the changes to take effect (exit code = ${RETURN_CODE})"
Expand Down
6 changes: 3 additions & 3 deletions installer/src/main/bin/updateDomain.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ ECHO [-model_file ^<model_file^>]
ECHO [-variable_file ^<variable_file^>]
ECHO [-domain_type ^<domain_type^>]
ECHO [-wlst_path ^<wlst_path^>]
ECHO [-rollback_if_restart_required]
ECHO [-cancel_changes_if_restart_required]
ECHO [-discard_current_edit]
ECHO [-output_dir]
ECHO [-admin_url ^<admin_url^>
Expand Down Expand Up @@ -115,12 +115,12 @@ ECHO admin_url - the admin server URL (used for online deploy)
ECHO.
ECHO admin_user - the admin username (used for online deploy)
ECHO.
ECHO rollback_if_restart_required - rollback the changes if the update requires domain restart
ECHO cancel_changes_if_restart_required - cancel the changes if the update requires domain restart
ECHO.
ECHO discard_current_edit - discard all existing changes before starting update
ECHO.
ECHO output_dir - if present, write restart information to this directory as restart.file, or
ECHO if rollback_if_restart_required used, write rollback information to rollback.file
ECHO if cancel_changes_if_restart_required used, write non dynamic changes information to non_dynamic_changes.file
ECHO.
ECHO The -use_encryption switch tells the program that one or more of the
ECHO passwords in the model or variables files are encrypted. The program will
Expand Down
6 changes: 3 additions & 3 deletions installer/src/main/bin/updateDomain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ usage() {
echo " [-variable_file <variable_file>]"
echo " [-domain_type <domain_type>]"
echo " [-wlst_path <wlst_path>]"
echo " [-rollback_if_restart_required]"
echo " [-cancel_changes_if_restart_required]"
echo " [-discard_current_edit]"
echo " [-output_dir]"
echo " [-admin_url <admin_url>"
Expand Down Expand Up @@ -76,12 +76,12 @@ usage() {
echo ""
echo " admin_user - the admin username (used for online deploy)"
echo ""
echo " rollback_if_restart_required - rollback the changes if the update requires domain restart"
echo " cancel_changes_if_restart_required - cancel the changes if the update requires domain restart"
echo ""
echo " discard_current_edit - discard all existing changes before starting update"
echo ""
echo " output_dir - if present, write restart information to this directory in restart.file, or,"
echo " if rollback_if_restart_required used, write rollback information to rollback.file"
echo " if cancel_changes_if_restart_required used, write non dynamic changes information to non_dynamic_changes.file"
echo ""
echo " The -use_encryption switch tells the program that one or more of the"
echo " passwords in the model or variables files are encrypted. The program will"
Expand Down
2 changes: 1 addition & 1 deletion site/deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ As usual, the tool will prompt for the password (it can also be supplied by pipi
When running the tool in WLST online mode, the deploy operation may require server restarts or a domain restart to pick up the changes. The deploy operation can also encounter situations where it cannot complete its operation until the domain is restarted. To communicate these conditions to scripts that may be calling the Deploy Applications Tool, the shell scripts have three special, non-zero exit codes to communicate these states:

- `103` - The entire domain needs to be restarted.
- `104` - The domain changes have been rolled back because the changes in the model requires a domain restart and -rollback_if_restart_required is specified.
- `104` - The domain changes have been canceled because the changes in the model requires a domain restart and -cancel_changes_if_restart_required is specified.

### Using an Encrypted Model

Expand Down
2 changes: 1 addition & 1 deletion site/update.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ The Update Domain Tool will not attempt to recreate or add schemas for the RCU d
When running the tool in WLST online mode, the update operation may require server restarts or a domain restart to pick up the changes. The update operation can also encounter situations where it cannot complete its operation until the domain is restarted. To communicate these conditions to scripts that may be calling the Update Domain Tool, the shell scripts have three special, non-zero exit codes to communicate these states:

- `103` - The entire domain needs to be restarted.
- `104` - The domain changes have been rolled back because the changes in the model requires a domain restart and -rollback_if_restart_required is specified.
- `104` - The domain changes have been canceled because the changes in the model requires a domain restart and -cancel_changes_if_restart_required is specified.

### Using an Encrypted Model

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ public void testDOnlineUpdate1() throws Exception {


/**
* testDOnlineUpdate2 check for 104 return code if an update rollback changes.
* testDOnlineUpdate2 check for 104 return code if an update cancel changes.
* @throws Exception - if any error occurs
*/
@Test
Expand Down Expand Up @@ -450,7 +450,7 @@ public void testDOnlineUpdate2() throws Exception {

String cmd = "echo welcome1 | " + updateDomainScript + " -oracle_home " + mwhome_12213 + " -domain_home " +
domainParent12213 + FS + "jrfDomain1 -model_file " +
tmpWdtModel + " -admin_url t3://localhost:7001 -admin_user weblogic -rollback_if_restart_required ";
tmpWdtModel + " -admin_url t3://localhost:7001 -admin_user weblogic -cancel_changes_if_restart_required ";
ExecResult result = ExecCommand.exec(cmd);
int updateResult = result.exitValue();
if (updateResult != 0 || updateResult != 104) {
Expand Down